build(package): 1.3.1
This commit is contained in:
parent
c57e9fa8e2
commit
321731442e
|
@ -0,0 +1,3 @@
|
|||
debian/changelog merge=ours
|
||||
debian/compat merge=ours
|
||||
debian/source/format merge=ours
|
|
@ -0,0 +1,143 @@
|
|||
# ---> C
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
|
||||
# ---> C++
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# ---> CMake
|
||||
CMakeList.txt.user*
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
|
||||
# ---> Qt
|
||||
# C++ objects and libs
|
||||
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.so
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
/.qt_for_python
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
Makefile*
|
||||
*-build-*
|
||||
*.qm
|
||||
|
||||
# QtCreator
|
||||
|
||||
*.autosave
|
||||
|
||||
#QtCtreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# ---> VisualStudioCode
|
||||
.settings
|
||||
|
||||
build/
|
||||
|
||||
.vscode
|
||||
|
||||
run
|
||||
|
||||
# debian
|
||||
/debian/files
|
||||
|
||||
# global
|
||||
/GPATH
|
||||
/GRTAGS
|
||||
/GTAGS
|
||||
|
||||
# build
|
||||
/obj-*
|
||||
/debian/.debhelper
|
||||
/debian/kylin-printer
|
||||
/debian/kylin-printer.debhelper.log
|
||||
/debian/kylin-printer.substvars
|
||||
|
||||
/.pc
|
||||
|
||||
#nodejs
|
||||
/node_modules
|
||||
/.husky
|
||||
/package.json
|
||||
/package-lock.json
|
||||
/.idea
|
|
@ -0,0 +1,65 @@
|
|||
#include "horizontalorverticalmode.h"
|
||||
|
||||
static const QString KYLIN_ROTATION_PATH = "/";
|
||||
|
||||
static const QString KYLIN_ROTATION_SERVICE = "com.kylin.statusmanager.interface";
|
||||
|
||||
static const QString KYLIN_ROTATION_INTERFACE = "com.kylin.statusmanager.interface";
|
||||
|
||||
HorizontalOrVerticalMode::HorizontalOrVerticalMode()
|
||||
{
|
||||
QDBusConnection::sessionBus().connect(KYLIN_ROTATION_SERVICE, KYLIN_ROTATION_PATH, KYLIN_ROTATION_INTERFACE,
|
||||
QString("rotations_change_signal"), this, SLOT(rotationChanged(QString)));
|
||||
QDBusConnection::sessionBus().connect(KYLIN_ROTATION_SERVICE, KYLIN_ROTATION_PATH, KYLIN_ROTATION_INTERFACE,
|
||||
QString("mode_change_signal"), this, SLOT(modeChanged(bool)));
|
||||
}
|
||||
deviceMode HorizontalOrVerticalMode::defaultModeCapture()
|
||||
{ // method
|
||||
QDBusMessage message_pcORpad = QDBusMessage::createMethodCall(
|
||||
KYLIN_ROTATION_SERVICE, KYLIN_ROTATION_PATH, KYLIN_ROTATION_INTERFACE, QString("get_current_tabletmode"));
|
||||
QDBusPendingReply<bool> reply_pcORpad = QDBusConnection::sessionBus().call(message_pcORpad);
|
||||
if (!reply_pcORpad.isValid()) {
|
||||
return PCMode;
|
||||
}
|
||||
if (reply_pcORpad.value()) { //平板模式
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(
|
||||
KYLIN_ROTATION_SERVICE, KYLIN_ROTATION_PATH, KYLIN_ROTATION_INTERFACE, QString("get_current_rotation"));
|
||||
QDBusPendingReply<QString> reply = QDBusConnection::sessionBus().call(message);
|
||||
if (reply.value() == "normal" || reply.value() == "upside-down") {
|
||||
return PADHorizontalMode; //横屏
|
||||
} else {
|
||||
return PADVerticalMode; //竖屏
|
||||
}
|
||||
return PADHorizontalMode; //横屏
|
||||
|
||||
} else {
|
||||
return PCMode; // pc模式
|
||||
}
|
||||
return PCMode; // pc模式
|
||||
}
|
||||
|
||||
void HorizontalOrVerticalMode::rotationChanged(QString res)
|
||||
{ // signal
|
||||
if (res == QString::fromLocal8Bit("normal") || res == QString::fromLocal8Bit("upside-down")) {
|
||||
Q_EMIT RotationSig(PADHorizontalMode); //平板横屏
|
||||
} else {
|
||||
Q_EMIT RotationSig(PADVerticalMode); //平板竖屏
|
||||
}
|
||||
}
|
||||
void HorizontalOrVerticalMode::modeChanged(bool res)
|
||||
{
|
||||
if (res) {
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(
|
||||
KYLIN_ROTATION_SERVICE, KYLIN_ROTATION_PATH, KYLIN_ROTATION_INTERFACE, QString("get_current_rotation"));
|
||||
QDBusPendingReply<QString> reply = QDBusConnection::sessionBus().call(message);
|
||||
if (reply.value() == "normal" || reply.value() == "upside-down") {
|
||||
Q_EMIT RotationSig(PADHorizontalMode); //平板横屏
|
||||
|
||||
} else {
|
||||
Q_EMIT RotationSig(PADVerticalMode); //平板竖屏
|
||||
}
|
||||
} else {
|
||||
Q_EMIT RotationSig(PCMode); // pc模式
|
||||
}
|
||||
Q_EMIT RotationSig(PCMode); // pc模式
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef HORIZONTALORVERTICALMODE_H
|
||||
#define HORIZONTALORVERTICALMODE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
enum deviceMode {
|
||||
PADHorizontalMode = 1, //平板横屏
|
||||
PADVerticalMode = 2, //平板竖屏
|
||||
PCMode = 3 // pc模式
|
||||
};
|
||||
|
||||
class HorizontalOrVerticalMode : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HorizontalOrVerticalMode();
|
||||
deviceMode defaultModeCapture();
|
||||
Q_SIGNALS:
|
||||
void RotationSig(deviceMode); // true:horizontal;false:vertical
|
||||
private Q_SLOTS:
|
||||
void rotationChanged(QString res);
|
||||
void modeChanged(bool res);
|
||||
};
|
||||
|
||||
|
||||
#endif // HORIZONTALORVERTICALMODE_H
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
template<typename T>
|
||||
class Singleton {
|
||||
public:
|
||||
static T& instance() {
|
||||
static T instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected:
|
||||
Singleton() {}
|
||||
virtual ~Singleton() {}
|
||||
|
||||
private:
|
||||
Singleton(const Singleton&) = delete;
|
||||
Singleton& operator= (const Singleton) = delete;
|
||||
};
|
|
@ -0,0 +1,61 @@
|
|||
//#include "gsettings_monitor.h"
|
||||
#include "horizontalorverticalmode.h"
|
||||
#include "ukui_settings_monitor.h"
|
||||
#include "QTimer"
|
||||
UkuiSettingsMonitor::UkuiSettingsMonitor()
|
||||
{
|
||||
// d_ptrGsetting = new GsettingsMonitor();
|
||||
d_ptrDbus = new HorizontalOrVerticalMode();
|
||||
|
||||
// connect(d_ptrGsetting, &GsettingsMonitor::transparencyUpdate, this, &UkuiSettingsMonitor::transparencyUpdate);
|
||||
// connect(d_ptrGsetting, &GsettingsMonitor::styleStatusUpdate, this, [=](GsettingsMonitor::StyleStatus status){
|
||||
// emit styleStatusUpdate(StyleStatus(status));
|
||||
// });
|
||||
connect(d_ptrDbus, &HorizontalOrVerticalMode::RotationSig, this, [=](deviceMode mode){
|
||||
emit tabletModeUpdate(TabletStatus(mode));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
UkuiSettingsMonitor::~UkuiSettingsMonitor()
|
||||
{
|
||||
// delete d_ptrGsetting;
|
||||
delete d_ptrDbus;
|
||||
}
|
||||
|
||||
//int UkuiSettingsMonitor::transparency() const
|
||||
//{
|
||||
// return d_ptrGsetting->transparency();
|
||||
//}
|
||||
|
||||
//UkuiSettingsMonitor::StyleStatus UkuiSettingsMonitor::styleStatus() const
|
||||
//{
|
||||
// return StyleStatus(d_ptrGsetting->styleStatus());
|
||||
//}
|
||||
|
||||
UkuiSettingsMonitor::TabletStatus UkuiSettingsMonitor::tabletMode() const
|
||||
{
|
||||
return TabletStatus(d_ptrDbus->defaultModeCapture());
|
||||
}
|
||||
|
||||
void UkuiSettingsMonitor::startTest(TabletStatus status)
|
||||
{
|
||||
static int cnt = 0;
|
||||
QTimer *timer = new QTimer();
|
||||
connect(timer, &QTimer::timeout, [=](){
|
||||
if (status != None) {
|
||||
emit this->tabletModeUpdate(status);
|
||||
return ;
|
||||
}
|
||||
cnt++;
|
||||
|
||||
if (cnt % 2 == 0) {
|
||||
emit this->tabletModeUpdate(TabletStatus::PCMode);
|
||||
} else {
|
||||
emit this->tabletModeUpdate(TabletStatus::PADHorizontalMode);
|
||||
}
|
||||
});
|
||||
timer->start(1000);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef UKUI_SETTINGS_MONITOR_H
|
||||
#define UKUI_SETTINGS_MONITOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include "singleton.h"
|
||||
|
||||
//class GsettingsMonitor;
|
||||
class HorizontalOrVerticalMode;
|
||||
|
||||
class UkuiSettingsMonitor final : public QObject,
|
||||
public Singleton<UkuiSettingsMonitor>
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Singleton<UkuiSettingsMonitor>;
|
||||
private:
|
||||
UkuiSettingsMonitor();
|
||||
~UkuiSettingsMonitor() override;
|
||||
public:
|
||||
enum TabletStatus {
|
||||
None = 0,
|
||||
PADHorizontalMode = 1, //平板横屏
|
||||
PADVerticalMode = 2, //平板竖屏
|
||||
PCMode = 3 // pc模式
|
||||
};
|
||||
|
||||
enum StyleStatus{
|
||||
NONE = 0,
|
||||
LIGHT,
|
||||
DARK
|
||||
};
|
||||
|
||||
|
||||
void startTest(TabletStatus status = None);
|
||||
// int transparency() const;
|
||||
// StyleStatus styleStatus() const;
|
||||
TabletStatus tabletMode() const;
|
||||
|
||||
signals:
|
||||
// void transparencyUpdate(int transparency);
|
||||
// void styleStatusUpdate(StyleStatus styleStatus);
|
||||
void tabletModeUpdate(TabletStatus tabletMode);
|
||||
|
||||
private:
|
||||
// GsettingsMonitor *d_ptrGsetting{nullptr};
|
||||
HorizontalOrVerticalMode *d_ptrDbus{nullptr};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // UKUI_SETTINGS_MONITOR_H
|
|
@ -30,7 +30,9 @@ find_package(KF5WindowSystem REQUIRED)
|
|||
#Gsetting
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(QGSETTINGS REQUIRED IMPORTED_TARGET gsettings-qt)
|
||||
|
||||
pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
|
||||
pkg_check_modules(KYSDKKABASE_PKG kysdk-kabase)
|
||||
pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
|
||||
set (SOURCE_PATH ../..)
|
||||
|
||||
# add ukui log
|
||||
|
@ -38,9 +40,9 @@ file(GLOB_RECURSE UKUI_LOG4QT "/usr/lib/libukui-log4qt.so")
|
|||
|
||||
#add include
|
||||
include_directories(${SOURCE_PATH}/printer_manager/)
|
||||
include_directories(${SOURCE_PATH}/device_manager/)
|
||||
include_directories(${SOURCE_PATH}/common/)
|
||||
include_directories(${SOURCE_PATH}/util/)
|
||||
include_directories(${SOURCE_PATH}/backend/)
|
||||
include_directories(${SOURCE_PATH}/ui/)
|
||||
|
||||
add_definitions("-Wall")
|
||||
|
@ -48,10 +50,12 @@ add_definitions("-Wall")
|
|||
|
||||
file(GLOB ${PROJECT_NAME}_SRC
|
||||
"main.cpp"
|
||||
"${SOURCE_PATH}/ui/gse*"
|
||||
"${SOURCE_PATH}/printer_manager/deviceInfo*"
|
||||
"${SOURCE_PATH}/printer_manager/ukuiApt*"
|
||||
"${SOURCE_PATH}/device_manager/device_information.*"
|
||||
"${SOURCE_PATH}/printer_manager/ukui_apt*"
|
||||
"${SOURCE_PATH}/common/common*"
|
||||
"${SOURCE_PATH}/common/global_variable.h"
|
||||
"${SOURCE_PATH}/ui/gsettings_monitor.*"
|
||||
"${SOURCE_PATH}/util/information_collector.*"
|
||||
)
|
||||
# SET(ui_RESOURCE ${SOURCE_PATH}/ui/picture.qrc)
|
||||
|
||||
|
@ -72,6 +76,16 @@ add_executable(${PROJECT_NAME}
|
|||
# ${QM_FILES}
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets ${KYSDKQTWIDGETS_PKG_LIBRARIES})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKKABASE_PKG_INCLUDE_DIRS})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKKABASE_PKG_LIBRARY_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} ${KYSDKKABASE_PKG_LIBRARIES})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets ${KYSDKQTWIDGETS_PKG_LIBRARIES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${UKUI_LOG4QT})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::X11Extras Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::DBus)
|
||||
|
|
|
@ -1,25 +1,55 @@
|
|||
#include "ukuiApt.h"
|
||||
#include "ukui_apt.h"
|
||||
#include <QEventLoop>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
void apt_test()
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
bool install = false;
|
||||
aptUtilHelper* aptHelper = new aptUtilHelper(DeviceInformation());
|
||||
|
||||
AptUtilHelper* aptHelper = new AptUtilHelper(DeviceInformation());
|
||||
QEventLoop eventloop;
|
||||
|
||||
QObject::connect(aptHelper, &aptUtilHelper::succeed, [&eventloop, &install]() {
|
||||
QObject::connect(aptHelper, &AptUtilHelper::succeed, [&eventloop, &install]() {
|
||||
// qDebug() << devInfo.name <<"`s package: Install succeed";
|
||||
install = true;
|
||||
eventloop.quit();
|
||||
});
|
||||
QObject::connect(aptHelper, &aptUtilHelper::failed, [&eventloop, &install]() {
|
||||
QObject::connect(aptHelper, &AptUtilHelper::failed, [&eventloop, &install]() {
|
||||
// qDebug() << devInfo.name <<"`s package: Install failed";
|
||||
install = false;
|
||||
eventloop.quit();
|
||||
});
|
||||
aptHelper->startWorker();
|
||||
eventloop.exec();
|
||||
}
|
||||
|
||||
void deb_test()
|
||||
{
|
||||
bool install = false;
|
||||
|
||||
// DebUtilHelper* aptHelper = new DebUtilHelper("/home/kylin/upgrade_hub/kylin-update-frontend/kylin-update-frontend_1.0.0.36kord_amd64.deb");
|
||||
DebUtilHelper* aptHelper = new DebUtilHelper("/home/kylin/upgrade_hub/kylin-system-updater/kylin-calculator_1.1.0~rc12_amd64.deb");
|
||||
QEventLoop eventloop;
|
||||
|
||||
QObject::connect(aptHelper, &DebUtilHelper::succeed, [&eventloop, &install]() {
|
||||
// qDebug() << devInfo.name <<"`s package: Install succeed";
|
||||
install = true;
|
||||
eventloop.quit();
|
||||
});
|
||||
QObject::connect(aptHelper, &DebUtilHelper::failed, [&eventloop, &install]() {
|
||||
// qDebug() << devInfo.name <<"`s package: Install failed";
|
||||
install = false;
|
||||
eventloop.quit();
|
||||
});
|
||||
aptHelper->startWorker();
|
||||
eventloop.exec();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
// apt_test();
|
||||
deb_test();
|
||||
app.exec();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,9 @@ int main(int argc, char **argv) {
|
|||
// test_LpinfoBrowser();
|
||||
|
||||
// test_snmpwalk();
|
||||
|
||||
// "usb://HP/LaserJet%20M506?serial=PHC8LC5BFW"
|
||||
// "HP-LaserJet-M506"
|
||||
// "hp/hp-laserjet_m506-ps.ppd.gz"
|
||||
// UkuiPrinterManager::getInstance().addPrinter("a", "b", "c", "d");
|
||||
|
||||
return app.exec();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "global_variable.h"
|
||||
|
||||
RemoteWidget::RemoteWidget(QWidget *parent)
|
||||
:CustomWidget(parent)
|
||||
:CustomTransWidget(parent)
|
||||
{
|
||||
initUi();
|
||||
initConnect();
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#include <QStandardItemModel>
|
||||
#include <QModelIndexList>
|
||||
#include "custom_push_button.h"
|
||||
#include "custom_widget.h"
|
||||
#include "custom_trans_widget.h"
|
||||
#include <QAction>
|
||||
|
||||
class RemoteWidget : public CustomWidget
|
||||
class RemoteWidget : public CustomTransWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
# Set Project Name
|
||||
project(custom_combo_box LANGUAGES C CXX)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.7.0")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets LinguistTools X11Extras Network DBus REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets LinguistTools X11Extras Network DBus REQUIRED)
|
||||
|
||||
|
||||
set (SOURCE_PATH ../../../..)
|
||||
#add include_directories
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/${SOURCE_PATH}/ui/custom_ui
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_SRC
|
||||
${PROJECT_SOURCE_DIR}/${SOURCE_PATH}/ui/custom_ui/custom_combo_box.cpp
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_HDR
|
||||
${PROJECT_SOURCE_DIR}/${SOURCE_PATH}/ui/custom_ui/custom_combo_box.h
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
main.cpp
|
||||
${${PROJECT_NAME}_SRC}
|
||||
${${PROJECT_NAME}_HDR}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::X11Extras Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::DBus)
|
||||
|
||||
#dependencies
|
||||
target_link_libraries(${PROJECT_NAME} "-lpthread -lz")
|
|
@ -0,0 +1,26 @@
|
|||
#include <QApplication>
|
||||
#include "custom_combo_box.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
CustomComboBox *b = new CustomComboBox();
|
||||
|
||||
b->setDefaultPreItem("1");
|
||||
b->setDefaultPreItem("2", true);
|
||||
|
||||
b->setDefaultAfterItem("3");
|
||||
// b->setDefaultAfterItem("4", true);
|
||||
b->setDefaultAfterItem("5");
|
||||
|
||||
// b->addItem("aaa");
|
||||
|
||||
// b->clear();
|
||||
|
||||
b->addItem("aaa");
|
||||
|
||||
b->show();
|
||||
|
||||
app.exec();
|
||||
}
|
|
@ -33,6 +33,7 @@ QPushButton *CustomMessageBox::clickedButton()
|
|||
|
||||
int CustomMessageBox::exec()
|
||||
{
|
||||
this->setWindowTitle("");
|
||||
m_ret = QMessageBox::exec();
|
||||
return m_ret;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,6 @@ void LeftWidget::initDeviceListSector()
|
|||
|
||||
m_ScrollArea->setProperty("drawScrollBarGroove", false);
|
||||
|
||||
m_ScrollArea->setFixedSize(DEVICE_LIST_SECTION);
|
||||
m_ScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_HLayoutDeviceList->setSpacing(0);
|
||||
|
|
|
@ -92,20 +92,18 @@ void MainWindow::initModule()
|
|||
setWindowTitle(tr("Printer"));
|
||||
// setWindowIcon(QIcon::fromTheme("kylin-printer"));
|
||||
setFixedSize(MAIN_WIN_WIDTH,MAIN_WIN_HEIGHT);
|
||||
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
|
||||
//Dbus
|
||||
m_dbus = DaemonIpcDbus::getInstance();
|
||||
|
||||
m_leftWidget = new LeftWidget(this);
|
||||
m_leftWidget->setObjectName("leftWidget");
|
||||
m_leftWidget->setFixedSize(QSize(NAVIGATION_SECTOR_WIDTH,MAIN_WIN_HEIGHT));
|
||||
m_leftWidget->setFixedWidth(NAVIGATION_SECTOR_WIDTH);
|
||||
m_leftWidget->setAutoFillBackground(true);
|
||||
m_leftWidget->setBackgroundRole(QPalette::Window);
|
||||
|
||||
m_rightWidget= new RightWidget(this);
|
||||
m_rightWidget->setObjectName("rightWidget");
|
||||
m_rightWidget->setFixedSize(QSize(EXHBITION_SECTOR_WIDTH,MAIN_WIN_HEIGHT));
|
||||
m_rightWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
m_rightWidget->setAutoFillBackground(true);
|
||||
m_rightWidget->setBackgroundRole(QPalette::Base);
|
||||
m_rightWidget->hideExhbitionSector();
|
||||
|
@ -154,6 +152,9 @@ void MainWindow::initConnect()
|
|||
connect(g_popWindow,&PopWindowManager::manualInstallShowRequest,this,&MainWindow::recvDeviceIn);
|
||||
connect(this,SIGNAL(updateMainWin()),this,SLOT(updateImmediately()));
|
||||
connect(this,SIGNAL(modifyPPD(QString)),this,SLOT(updateByChangePPD(QString)));
|
||||
|
||||
connect(&UkuiSettingsMonitor::instance(), &UkuiSettingsMonitor::tabletModeUpdate,
|
||||
this, &MainWindow::handleTabletMode);
|
||||
}
|
||||
void MainWindow::initQSS()
|
||||
{
|
||||
|
@ -165,7 +166,6 @@ void MainWindow::initQSS()
|
|||
m_HLayoutWholeWin->addSpacing(0);
|
||||
m_HLayoutWholeWin->addWidget(m_leftWidget);
|
||||
m_HLayoutWholeWin->addWidget(m_rightWidget);
|
||||
m_HLayoutWholeWin->addStretch();
|
||||
}
|
||||
|
||||
void MainWindow::updateRightWidgetByCheckBtn(const UkuiUsbPrinter& printer)
|
||||
|
@ -431,3 +431,46 @@ quint32 MainWindow::getWindowId(void)
|
|||
{
|
||||
return m_windowId;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::enableMaximum()
|
||||
{
|
||||
setMaximumSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX);
|
||||
}
|
||||
|
||||
void MainWindow::disableMaximum()
|
||||
{
|
||||
setMaximumSize(this->minimumSize());
|
||||
}
|
||||
|
||||
void MainWindow::handleTabletMode(UkuiSettingsMonitor::TabletStatus status)
|
||||
{
|
||||
switch (status) {
|
||||
case UkuiSettingsMonitor::TabletStatus::PCMode:
|
||||
handlePCMode();
|
||||
break;
|
||||
case UkuiSettingsMonitor::TabletStatus::PADHorizontalMode:
|
||||
case UkuiSettingsMonitor::TabletStatus::PADVerticalMode:
|
||||
handlePADMode();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handlePADMode()
|
||||
{
|
||||
enableMaximum();
|
||||
showMaximized();
|
||||
}
|
||||
|
||||
void MainWindow::handlePCMode()
|
||||
{
|
||||
disableMaximum();
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
handleTabletMode(UkuiSettingsMonitor::instance().tabletMode());
|
||||
QMainWindow::showEvent(event);
|
||||
}
|
|
@ -18,6 +18,8 @@
|
|||
#include "job_manager_window.h"
|
||||
#include "deb_install_window.h"
|
||||
|
||||
#include "ukui_settings_monitor.h"
|
||||
|
||||
#define g_printerManger UkuiPrinterManager::getInstance()
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -25,8 +27,8 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
static MainWindow *getInstance();
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
bool eventFilter(QObject* watched, QEvent* event);
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
signals:
|
||||
void updateMainWin();
|
||||
void modifyPPD(QString);
|
||||
|
@ -64,6 +66,8 @@ private slots:
|
|||
void updateImmediately();
|
||||
void updateByRename(QString printerName);
|
||||
void recvDeviceIn(DeviceInformation&);
|
||||
void enableMaximum();
|
||||
void disableMaximum();
|
||||
|
||||
private:
|
||||
~MainWindow();
|
||||
|
@ -102,7 +106,13 @@ private:
|
|||
|
||||
//=======================test接口=========================
|
||||
|
||||
protected:
|
||||
virtual void handlePCMode();
|
||||
virtual void handlePADMode();
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
private:
|
||||
void handleTabletMode(UkuiSettingsMonitor::TabletStatus status);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ RenamePrinterDialog::RenamePrinterDialog(QString printerName, QWidget *parent)
|
|||
|
||||
connect(ui->acceptButton, &QPushButton::clicked, this, &RenamePrinterDialog::acceptButtonClicked);
|
||||
connect(ui->cancelButton, &QPushButton::clicked, this, &RenamePrinterDialog::reject);
|
||||
connect(ui->printerNameEdit, &QLineEdit::returnPressed, this, &RenamePrinterDialog::acceptButtonClicked);
|
||||
connect(ui->printerNameEdit, &QLineEdit::textChanged, [=](const QString &str){
|
||||
ui->statusLabel->setText("");
|
||||
auto res = UkuiPrinterManager::getInstance().printerNameCheck(str, m_printers);
|
||||
|
|
Loading…
Reference in New Issue