From 27e3eda4b90ec477714b9a5a98ffc36d26112ed6 Mon Sep 17 00:00:00 2001 From: zhaoyingzhen Date: Sat, 16 Nov 2024 13:45:34 +0800 Subject: [PATCH] chore: adapt to qt6 1.adapt to qt6 2.change gsettings to dconfig 3.Resolve compilation warnings Log: as title Task: https://pms.uniontech.com/task-view-367947.html --- CMakeLists.txt | 13 ++--- common/CMakeLists.txt | 4 +- dde-bluetooth-dialog/CMakeLists.txt | 14 ++--- dde-bluetooth-dialog/src/CMakeLists.txt | 6 +- dde-bluetooth-dialog/src/main.cpp | 5 +- dde-bluetooth-dialog/src/pincodedialog.cpp | 21 +++---- dde-bluetooth-dialog/src/pincodedialog.h | 10 +--- dde-bluetooth-dialog/tests/CMakeLists.txt | 8 +-- .../tests/ut_pincodedialog.cpp | 2 + dde-hints-dialog/CMakeLists.txt | 14 ++--- dde-hints-dialog/src/CMakeLists.txt | 6 +- dde-hints-dialog/src/hintsdialog.cpp | 4 +- dde-hints-dialog/src/horizontalseperator.cpp | 1 - dde-hints-dialog/src/main.cpp | 5 +- dde-license-dialog/CMakeLists.txt | 18 +++--- dde-license-dialog/src/CMakeLists.txt | 6 +- dde-license-dialog/src/content.cpp | 22 ++++++-- dde-license-dialog/src/content.h | 1 + dde-license-dialog/src/main.cpp | 6 +- dde-license-dialog/src/mainwindow.cpp | 4 +- dde-lowpower/CMakeLists.txt | 18 +++--- dde-lowpower/src/main.cpp | 5 +- dde-lowpower/tests/CMakeLists.txt | 2 +- dde-pixmix/CMakeLists.txt | 14 ++--- dde-pixmix/src/CMakeLists.txt | 6 +- dde-suspend-dialog/CMakeLists.txt | 16 +++--- dde-suspend-dialog/src/CMakeLists.txt | 6 +- dde-suspend-dialog/src/main.cpp | 5 +- dde-suspend-dialog/tests/CMakeLists.txt | 2 +- dde-switchtogreeter/CMakeLists.txt | 6 +- dde-switchtogreeter/src/CMakeLists.txt | 6 +- dde-touchscreen-dialog/CMakeLists.txt | 23 ++++---- dde-touchscreen-dialog/src/CMakeLists.txt | 6 +- dde-touchscreen-dialog/src/main.cpp | 8 +-- .../src/monitorindicator.cpp | 12 ++-- dde-touchscreen-dialog/tests/CMakeLists.txt | 8 +-- dde-warning-dialog/CMakeLists.txt | 18 +++--- dde-warning-dialog/src/CMakeLists.txt | 6 +- dde-warning-dialog/src/main.cpp | 5 +- dde-welcome/CMakeLists.txt | 9 ++- dde-welcome/src/main.cpp | 7 ++- dde-welcome/src/mainwidget.cpp | 25 ++++++--- dde-welcome/src/mainwidget.h | 7 --- dde-welcome/src/updatecontent.cpp | 2 +- dde-welcome/src/utils.cpp | 1 - dde-welcome/tests/CMakeLists.txt | 2 +- dde-welcome/tests/ut_mainwidget.cpp | 6 +- .../tests/widgets/ut_fullscreenbackground.cpp | 4 +- dde-wm-chooser/CMakeLists.txt | 22 ++++---- dde-wm-chooser/src/CMakeLists.txt | 6 +- dde-wm-chooser/src/main.cpp | 6 +- dde-wm-chooser/src/wmframe.cpp | 11 +++- dde-wm-chooser/tests/CMakeLists.txt | 2 +- debian/control | 18 +++--- dnetwork-secret-dialog/CMakeLists.txt | 22 ++++---- dnetwork-secret-dialog/src/CMakeLists.txt | 6 +- dnetwork-secret-dialog/src/main.cpp | 8 +-- dnetwork-secret-dialog/tests/CMakeLists.txt | 8 +-- global_util/CMakeLists.txt | 4 +- global_util/dbus/CMakeLists.txt | 55 +++---------------- global_util/dbus/types/screenrect.h | 2 + .../dbus/types/touchscreeninfolist.cpp | 7 ++- global_util/dbus/types/touchscreeninfolist.h | 16 +++++- .../dbus/types/touchscreeninfolist_v2.cpp | 7 ++- .../dbus/types/touchscreeninfolist_v2.h | 15 ++++- global_util/multiscreenmanager.cpp | 2 - reset-password-dialog/CMakeLists.txt | 23 +++----- reset-password-dialog/passwordwidget.cpp | 2 +- reset-password-dialog/resetpassworddialog.cpp | 7 +-- reset-password-dialog/resetpasswordworker.cpp | 8 ++- .../securityquestionswidget.cpp | 7 +-- reset-password-dialog/unionidwidget.cpp | 16 +++--- widgets/CMakeLists.txt | 2 +- widgets/fullscreenbackground.cpp | 3 +- widgets/fullscreenbackground.h | 2 +- 75 files changed, 349 insertions(+), 343 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e09af97e..ffc2bb2a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,9 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall") option(DISABLE_SYS_UPDATE "disable sys update" OFF) +set(QT_VERSION_MAJOR 6) +set(DTK_VERSION_MAJOR 6) + # 增加安全编译参数 ADD_DEFINITIONS("-fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") @@ -50,11 +53,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) find_package(PkgConfig REQUIRED) find_package(GTest REQUIRED) find_package(GMock REQUIRED) -find_package(Dtk REQUIRED COMPONENTS Core Widget) -find_package(Qt5 REQUIRED COMPONENTS Widgets DBus X11Extras Xml Concurrent Svg Sql Network Test) +find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Core Widget Tools) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus Xml Concurrent Svg Sql Network Test) -pkg_check_modules(GSETTINGS REQUIRED IMPORTED_TARGET gsettings-qt) -pkg_check_modules(DdeDockInterface REQUIRED dde-dock) pkg_check_modules(XCB_EWMH REQUIRED IMPORTED_TARGET xcb-ewmh) pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GIO REQUIRED gio-unix-2.0) @@ -67,8 +68,6 @@ set(Test_Libraries -lgmock ) -find_package(DtkTools REQUIRED) - # shared objects add_subdirectory("common") add_subdirectory("widgets") @@ -80,7 +79,7 @@ add_subdirectory("dde-bluetooth-dialog") add_subdirectory("dde-hints-dialog") add_subdirectory("dde-license-dialog") add_subdirectory("dde-lowpower") -add_subdirectory("dde-osd") +#add_subdirectory("dde-osd") add_subdirectory("dde-pixmix") add_subdirectory("dde-suspend-dialog") add_subdirectory("dde-switchtogreeter") diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2c8020518..ad231600a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -18,6 +18,6 @@ PUBLIC target_link_libraries(session-ui-common-shared PRIVATE - Qt5::Widgets - Dtk::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Dtk${DTK_VERSION_MAJOR}::Widget ) diff --git a/dde-bluetooth-dialog/CMakeLists.txt b/dde-bluetooth-dialog/CMakeLists.txt index eb47383da..22cc13464 100644 --- a/dde-bluetooth-dialog/CMakeLists.txt +++ b/dde-bluetooth-dialog/CMakeLists.txt @@ -10,16 +10,14 @@ file(GLOB_RECURSE Bluetooth_Dialog_SRCS list(REMOVE_ITEM Bluetooth_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-bluetooth-dialog/src/main.cpp") set(Bluetooth_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - ${GSETTINGS_INCLUDE_DIRS} - Qt5::Widgets - Qt5::DBus + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus ) set(Bluetooth_Dialog_Libraries - ${DtkWidget_LIBRARIES} - ${GSETTINGS_LIBRARIES} - Qt5::Widgets - Qt5::DBus + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus ) add_subdirectory("src") diff --git a/dde-bluetooth-dialog/src/CMakeLists.txt b/dde-bluetooth-dialog/src/CMakeLists.txt index 90b518299..c4295f5a7 100644 --- a/dde-bluetooth-dialog/src/CMakeLists.txt +++ b/dde-bluetooth-dialog/src/CMakeLists.txt @@ -8,16 +8,16 @@ add_executable(${Bluetooth_Dialog_Name} ${Common_SRCS} ${Bluetooth_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Bluetooth_Dialog_Name} PUBLIC ${Bluetooth_Dialog_Includes} - ) +) target_link_libraries(${Bluetooth_Dialog_Name} PRIVATE session-ui-dbus-shared ${Bluetooth_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Bluetooth_Dialog_Name} DESTINATION ${DAEMON_LIB_PATH}) diff --git a/dde-bluetooth-dialog/src/main.cpp b/dde-bluetooth-dialog/src/main.cpp index 97760c180..331584eb4 100644 --- a/dde-bluetooth-dialog/src/main.cpp +++ b/dde-bluetooth-dialog/src/main.cpp @@ -26,8 +26,9 @@ int main(int argc, char *argv[]) app.setOrganizationName("deepin"); app.setApplicationName("dde-bluetooth-dialog"); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - app.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + app.installTranslator(&translator); + } QStringList arguslist = app.arguments(); if (arguslist.size() < 4) { diff --git a/dde-bluetooth-dialog/src/pincodedialog.cpp b/dde-bluetooth-dialog/src/pincodedialog.cpp index 739151a00..2e9e23234 100644 --- a/dde-bluetooth-dialog/src/pincodedialog.cpp +++ b/dde-bluetooth-dialog/src/pincodedialog.cpp @@ -4,17 +4,22 @@ #include "pincodedialog.h" #include "largelabel.h" +#include "org_deepin_dde_bluetooth1.h" #include #include -#include + +#include + +using DBusBluetooth = org::deepin::dde::Bluetooth1; PinCodeDialog::PinCodeDialog(const QString &pinCode, const QString &devicepath, const QString &starttime, const bool &cancelable) : DDialog(), m_pinCodeLabel(new LargeLabel(this)), - m_titileLabel(new LargeLabel(this)), - m_bluetoothInter(new DBusBluetooth("org.deepin.dde.Bluetooth1", "/org/deepin/dde/Bluetooth1", QDBusConnection::sessionBus(), this)) + m_titileLabel(new LargeLabel(this)) { + auto bluetoothInter = new DBusBluetooth("org.deepin.dde.Bluetooth1", "/org/deepin/dde/Bluetooth1", QDBusConnection::sessionBus(), this); + setAccessibleName("PinCodeDialog"); QString titilestr = tr("The PIN for connecting to the Bluetooth device is:"); setIcon(QIcon::fromTheme("notification-bluetooth-connected")); @@ -41,10 +46,6 @@ PinCodeDialog::PinCodeDialog(const QString &pinCode, const QString &devicepath, m_pinCodeLabel->setText(pinCode); uint pinsectime = 60; - QGSettings setting("com.deepin.dde.osd", "/com/deepin/dde/osd/"); - if (setting.keys().contains("pindialogTimeSec")) - pinsectime = setting.get("pindialog-time-sec").toUInt(); - qint64 msec = pinsectime * 1000 - QDateTime::currentMSecsSinceEpoch() + starttime.toLongLong(); if (msec < 0){ qDebug() << "timeout"; @@ -54,13 +55,13 @@ PinCodeDialog::PinCodeDialog(const QString &pinCode, const QString &devicepath, close(); }); - connect(m_bluetoothInter, &DBusBluetooth::AdapterPropertiesChanged, this, &PinCodeDialog::HandleBlutoothPower); + connect(bluetoothInter, &DBusBluetooth::AdapterPropertiesChanged, this, &PinCodeDialog::HandleBlutoothPower); connect(this, &PinCodeDialog::buttonClicked, this, [ = ](int index, const QString & text) { Q_UNUSED(text) - m_bluetoothInter->Confirm(QDBusObjectPath(devicepath), index == 1 ? true : false); + bluetoothInter->Confirm(QDBusObjectPath(devicepath), index == 1 ? true : false); }); connect(this, &PinCodeDialog::closed, this, [ = ]() { - m_bluetoothInter->Confirm(QDBusObjectPath(devicepath), false); + bluetoothInter->Confirm(QDBusObjectPath(devicepath), false); qApp->quit(); }); } diff --git a/dde-bluetooth-dialog/src/pincodedialog.h b/dde-bluetooth-dialog/src/pincodedialog.h index 8736c6ceb..f3973743d 100644 --- a/dde-bluetooth-dialog/src/pincodedialog.h +++ b/dde-bluetooth-dialog/src/pincodedialog.h @@ -5,18 +5,11 @@ #ifndef DCC_BLUETOOTH_PINCODEDIALOG_H #define DCC_BLUETOOTH_PINCODEDIALOG_H -#include -#include "org_deepin_dde_bluetooth1.h" - -#include -#include +#include DWIDGET_USE_NAMESPACE -using DBusBluetooth = org::deepin::dde::Bluetooth1; - class LargeLabel; - class PinCodeDialog : public DDialog { Q_OBJECT @@ -31,7 +24,6 @@ private Q_SLOTS: private: LargeLabel *m_pinCodeLabel; LargeLabel *m_titileLabel; - DBusBluetooth *m_bluetoothInter; }; #endif // DCC_BLUETOOTH_PINCODEDIALOG_H diff --git a/dde-bluetooth-dialog/tests/CMakeLists.txt b/dde-bluetooth-dialog/tests/CMakeLists.txt index eff065b78..137ff7a35 100644 --- a/dde-bluetooth-dialog/tests/CMakeLists.txt +++ b/dde-bluetooth-dialog/tests/CMakeLists.txt @@ -6,13 +6,13 @@ set(UT_Bluetooth_Dialog_Name ut-dde-bluetooth-dialog) file(GLOB_RECURSE UT_Bluetooth_Dialog_SRCS "*.cpp" - ) +) add_executable(${UT_Bluetooth_Dialog_Name} ${Common_SRCS} ${Bluetooth_Dialog_SRCS} ${UT_Bluetooth_Dialog_SRCS} - ) +) # 用于测试覆盖率的编译条件 target_compile_options(${UT_Bluetooth_Dialog_Name} PRIVATE -fprofile-arcs -ftest-coverage) @@ -20,10 +20,10 @@ target_compile_options(${UT_Bluetooth_Dialog_Name} PRIVATE -fprofile-arcs -ftest target_include_directories(${UT_Bluetooth_Dialog_Name} PUBLIC ${Bluetooth_Dialog_Includes} ../src/ - ) +) target_link_libraries(${UT_Bluetooth_Dialog_Name} PRIVATE session-ui-dbus-shared ${Bluetooth_Dialog_Libraries} ${Test_Libraries} - ) +) diff --git a/dde-bluetooth-dialog/tests/ut_pincodedialog.cpp b/dde-bluetooth-dialog/tests/ut_pincodedialog.cpp index ca325163e..2393acaa7 100644 --- a/dde-bluetooth-dialog/tests/ut_pincodedialog.cpp +++ b/dde-bluetooth-dialog/tests/ut_pincodedialog.cpp @@ -2,6 +2,8 @@ // // SPDX-License-Identifier: GPL-3.0-or-later +#include + #define private public #include "pincodedialog.h" #undef private diff --git a/dde-hints-dialog/CMakeLists.txt b/dde-hints-dialog/CMakeLists.txt index 93c0f197a..9214ed414 100644 --- a/dde-hints-dialog/CMakeLists.txt +++ b/dde-hints-dialog/CMakeLists.txt @@ -5,19 +5,19 @@ file(GLOB_RECURSE Hints_Dialog_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Hints_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-hints-dialog/src/main.cpp") set(Hints_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets +) set(Hints_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets +) add_subdirectory("src") #add_subdirectory("tests") diff --git a/dde-hints-dialog/src/CMakeLists.txt b/dde-hints-dialog/src/CMakeLists.txt index 684dd2c68..b1e57b75c 100644 --- a/dde-hints-dialog/src/CMakeLists.txt +++ b/dde-hints-dialog/src/CMakeLists.txt @@ -7,15 +7,15 @@ set(Hints_Dialog_Name dde-hints-dialog) add_executable(${Hints_Dialog_Name} ${Hints_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Hints_Dialog_Name} PUBLIC ${Hints_Dialog_Includes} - ) +) target_link_libraries(${Hints_Dialog_Name} PRIVATE ${Hints_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Hints_Dialog_Name} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dde-hints-dialog/src/hintsdialog.cpp b/dde-hints-dialog/src/hintsdialog.cpp index 8354bef2a..0e842a0db 100644 --- a/dde-hints-dialog/src/hintsdialog.cpp +++ b/dde-hints-dialog/src/hintsdialog.cpp @@ -35,7 +35,7 @@ HintsDialog::HintsDialog(QWidget *parent) m_content->setWordWrap(true); QHBoxLayout *titlelayout = new QHBoxLayout; - titlelayout->setMargin(0); + titlelayout->setContentsMargins(0, 0, 0, 0); titlelayout->setSpacing(0); titlelayout->addWidget(m_title, 1, Qt::AlignLeft | Qt::AlignVCenter); titlelayout->addWidget(m_closeButton, 0, Qt::AlignRight | Qt::AlignVCenter); @@ -48,7 +48,7 @@ HintsDialog::HintsDialog(QWidget *parent) HorizontalSeperator * seperator = new HorizontalSeperator(this); QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(15); + layout->setContentsMargins(15, 15, 15, 15); layout->setSpacing(0); layout->addWidget(widget); layout->addSpacing(10); diff --git a/dde-hints-dialog/src/horizontalseperator.cpp b/dde-hints-dialog/src/horizontalseperator.cpp index 8f062a52d..710b1bb87 100644 --- a/dde-hints-dialog/src/horizontalseperator.cpp +++ b/dde-hints-dialog/src/horizontalseperator.cpp @@ -4,7 +4,6 @@ #include "horizontalseperator.h" -#include #include diff --git a/dde-hints-dialog/src/main.cpp b/dde-hints-dialog/src/main.cpp index 4d3cbabfa..36aa43b0b 100644 --- a/dde-hints-dialog/src/main.cpp +++ b/dde-hints-dialog/src/main.cpp @@ -25,8 +25,9 @@ int main(int argc, char *argv[]) a.setQuitOnLastWindowClosed(true); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - a.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + a.installTranslator(&translator); + } QStringList arguslist = a.arguments(); if (arguslist.size() < 3) { diff --git a/dde-license-dialog/CMakeLists.txt b/dde-license-dialog/CMakeLists.txt index 10f1955bd..c8e42288c 100644 --- a/dde-license-dialog/CMakeLists.txt +++ b/dde-license-dialog/CMakeLists.txt @@ -5,21 +5,21 @@ file(GLOB_RECURSE License_Dialog_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM License_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-license-dialog/src/main.cpp") set(License_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - Qt5::Concurrent - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Concurrent +) set(License_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - Qt5::Concurrent - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Concurrent +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-license-dialog/src/CMakeLists.txt b/dde-license-dialog/src/CMakeLists.txt index b8edd6570..2f3932b54 100644 --- a/dde-license-dialog/src/CMakeLists.txt +++ b/dde-license-dialog/src/CMakeLists.txt @@ -8,15 +8,15 @@ add_executable(${License_Dialog_Name} ${Common_SRCS} ${License_Dialog_SRCS} main.cpp - ) +) target_include_directories(${License_Dialog_Name} PUBLIC ${License_Dialog_Includes} - ) +) target_link_libraries(${License_Dialog_Name} PRIVATE ${License_Dialog_Libraries} - ) +) ## bin install(TARGETS ${License_Dialog_Name} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dde-license-dialog/src/content.cpp b/dde-license-dialog/src/content.cpp index 01d8ff540..ee25f56e3 100644 --- a/dde-license-dialog/src/content.cpp +++ b/dde-license-dialog/src/content.cpp @@ -51,7 +51,7 @@ Content::Content(QWidget *parent) m_source->setAccessibleName("SourceLabel"); m_languageBtn->setAccessibleName("LanguageBtn"); QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); setLayout(layout); @@ -99,7 +99,7 @@ Content::Content(QWidget *parent) m_scrollArea->setWidget(sourceWidget); QHBoxLayout *bottomLayout = new QHBoxLayout; - bottomLayout->setMargin(0); + bottomLayout->setContentsMargins(0, 0, 0, 0); bottomLayout->setSpacing(0); bottomLayout->addSpacing(10); bottomLayout->addWidget(m_acceptCheck, 0, Qt::AlignVCenter); @@ -261,16 +261,26 @@ void Content::updateLanguageBtn() void Content::updateContent() { - QTranslator trans; + if (!m_translator) { + m_translator = new QTranslator(this); + } else { + qApp->removeTranslator(m_translator); + } + setSource(m_isCn ? m_cn : m_en); m_acceptCheck->setText(m_isCn ? m_allow : m_enallow); m_acceptCheck->setVisible(m_isCn ? !m_allow.isEmpty() : !m_enallow.isEmpty()); + QString tsFilePath; if (m_hasCn && m_hasEn) { - trans.load(QString("/usr/share/dde-session-ui/translations/dde-session-ui_%1").arg(m_isCn ? "zh_CN" : "en_US")); + tsFilePath = QString("/usr/share/dde-session-ui/translations/dde-session-ui_%1").arg(m_isCn ? "zh_CN" : "en_US"); } else { - trans.load(QString("/usr/share/dde-session-ui/translations/dde-session-ui_%1").arg(QLocale::system().name())); + tsFilePath = QString("/usr/share/dde-session-ui/translations/dde-session-ui_%1").arg(QLocale::system().name()); } - qApp->installTranslator(&trans); + + if (m_translator->load(tsFilePath)) { + qApp->installTranslator(m_translator); + } + m_cancelBtn->setText(tr("Cancel")); m_acceptBtn->setText(tr("Confirm")); m_acceptBtn->setEnabled(m_allow.isEmpty() || (!m_allow.isEmpty() && m_acceptCheck->isChecked())); diff --git a/dde-license-dialog/src/content.h b/dde-license-dialog/src/content.h index 223632e30..cad542371 100644 --- a/dde-license-dialog/src/content.h +++ b/dde-license-dialog/src/content.h @@ -62,6 +62,7 @@ public slots: QString m_enallow; QWidget *m_bottom; + QTranslator *m_translator = nullptr; }; #endif // CONTENT_H diff --git a/dde-license-dialog/src/main.cpp b/dde-license-dialog/src/main.cpp index bedf3432e..7c66bc23d 100644 --- a/dde-license-dialog/src/main.cpp +++ b/dde-license-dialog/src/main.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include DWIDGET_USE_NAMESPACE @@ -23,8 +22,9 @@ int main(int argc, char *argv[]) DApplication a(argc, argv); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - a.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + a.installTranslator(&translator); + } QCommandLineOption title(QStringList() << "t" << "title", "Parm:string type \n Action:Show Chinese title name"); QCommandLineOption entitle(QStringList() << "u" << "english title", "Parm:string type \n Action:Show English title name"); diff --git a/dde-license-dialog/src/mainwindow.cpp b/dde-license-dialog/src/mainwindow.cpp index bafacb93e..55544f71e 100644 --- a/dde-license-dialog/src/mainwindow.cpp +++ b/dde-license-dialog/src/mainwindow.cpp @@ -44,7 +44,7 @@ MainWindow::MainWindow(QWidget *parent) btnclose->setPalette(pa); QHBoxLayout *titlelayout = new QHBoxLayout; - titlelayout->setMargin(0); + titlelayout->setContentsMargins(0, 0, 0, 0); titlelayout->addWidget(m_title); titlelayout->addWidget(btnclose, Qt::AlignRight); widget->setLayout(titlelayout); @@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) m_title->setStyleSheet(QString("qproperty-alignment: 'AlignBottom | AlignCenter'")); QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); //layout->addSpacing(10); diff --git a/dde-lowpower/CMakeLists.txt b/dde-lowpower/CMakeLists.txt index c9c6a1f7d..23e5de15b 100644 --- a/dde-lowpower/CMakeLists.txt +++ b/dde-lowpower/CMakeLists.txt @@ -5,21 +5,21 @@ file(GLOB_RECURSE Lowpower_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Lowpower_SRCS "${CMAKE_SOURCE_DIR}/dde-lowpower/src/main.cpp") set(Lowpower_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) set(Lowpower_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-lowpower/src/main.cpp b/dde-lowpower/src/main.cpp index 11d9733ae..351d26edc 100644 --- a/dde-lowpower/src/main.cpp +++ b/dde-lowpower/src/main.cpp @@ -30,8 +30,9 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - a.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + a.installTranslator(&translator); + } QCommandLineOption raiseOption("raise", "raise the main window."); QCommandLineOption quitOption("quit", "quit all dde-lowpower instances."); diff --git a/dde-lowpower/tests/CMakeLists.txt b/dde-lowpower/tests/CMakeLists.txt index 24f5a6a23..7ddb03843 100644 --- a/dde-lowpower/tests/CMakeLists.txt +++ b/dde-lowpower/tests/CMakeLists.txt @@ -26,5 +26,5 @@ target_include_directories(${UT_Lowpower_Name} PUBLIC target_link_libraries(${UT_Lowpower_Name} PRIVATE ${Lowpower_Libraries} ${Test_Libraries} - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test ) diff --git a/dde-pixmix/CMakeLists.txt b/dde-pixmix/CMakeLists.txt index b03673b16..509a037cd 100644 --- a/dde-pixmix/CMakeLists.txt +++ b/dde-pixmix/CMakeLists.txt @@ -5,17 +5,17 @@ file(GLOB_RECURSE Pixmix_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Pixmix_SRCS "${CMAKE_SOURCE_DIR}/dde-pixmix/srcmain.cpp") set(Pixmix_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets +) set(Pixmix_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets +) add_subdirectory("src") #add_subdirectory("tests") diff --git a/dde-pixmix/src/CMakeLists.txt b/dde-pixmix/src/CMakeLists.txt index 3ebb61f92..fbf21ac80 100644 --- a/dde-pixmix/src/CMakeLists.txt +++ b/dde-pixmix/src/CMakeLists.txt @@ -7,15 +7,15 @@ set(Pixmix_Name dde-pixmix) add_executable(${Pixmix_Name} ${Pixmix_SRCS} main.cpp - ) +) target_include_directories(${Pixmix_Name} PUBLIC ${Pixmix_Includes} - ) +) target_link_libraries(${Pixmix_Name} PRIVATE ${Pixmix_Libraries} - ) +) ## bin install(TARGETS ${Pixmix_Name} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dde-suspend-dialog/CMakeLists.txt b/dde-suspend-dialog/CMakeLists.txt index 77b9871c5..ed808f6e1 100644 --- a/dde-suspend-dialog/CMakeLists.txt +++ b/dde-suspend-dialog/CMakeLists.txt @@ -9,15 +9,15 @@ file(GLOB_RECURSE Suspend_Dialog_SRCS list(REMOVE_ITEM Suspend_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-suspend-dialog/src/main.cpp") set(Suspend_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) set(Suspend_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-suspend-dialog/src/CMakeLists.txt b/dde-suspend-dialog/src/CMakeLists.txt index 0c2ce3a49..048e9a873 100644 --- a/dde-suspend-dialog/src/CMakeLists.txt +++ b/dde-suspend-dialog/src/CMakeLists.txt @@ -7,16 +7,16 @@ set(Suspend_Dialog_Name dde-suspend-dialog) add_executable(${Suspend_Dialog_Name} ${Suspend_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Suspend_Dialog_Name} PUBLIC ${Suspend_Dialog_Includes} - ) +) target_link_libraries(${Suspend_Dialog_Name} PRIVATE session-ui-dbus-shared ${Suspend_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Suspend_Dialog_Name} DESTINATION ${DAEMON_LIB_PATH}) diff --git a/dde-suspend-dialog/src/main.cpp b/dde-suspend-dialog/src/main.cpp index 95d8568e8..f60a591e4 100644 --- a/dde-suspend-dialog/src/main.cpp +++ b/dde-suspend-dialog/src/main.cpp @@ -18,8 +18,9 @@ int main(int argc, char *argv[]) app.setApplicationName("dde-suspend-dialog"); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - app.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + app.installTranslator(&translator); + } if (!app.setSingleInstance(app.applicationName(), DApplication::UserScope)) { return -1; diff --git a/dde-suspend-dialog/tests/CMakeLists.txt b/dde-suspend-dialog/tests/CMakeLists.txt index fc9faf0ad..8641135f4 100644 --- a/dde-suspend-dialog/tests/CMakeLists.txt +++ b/dde-suspend-dialog/tests/CMakeLists.txt @@ -27,5 +27,5 @@ target_link_libraries(${UT_Suspend_Dialog_Name} PRIVATE session-ui-dbus-shared ${Suspend_Dialog_Libraries} ${Test_Libraries} - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test ) diff --git a/dde-switchtogreeter/CMakeLists.txt b/dde-switchtogreeter/CMakeLists.txt index 289d05ea4..65f89ca76 100644 --- a/dde-switchtogreeter/CMakeLists.txt +++ b/dde-switchtogreeter/CMakeLists.txt @@ -5,18 +5,18 @@ file(GLOB_RECURSE Switchtogreeter_SRCS "*.h" "*.c" - ) +) set(Switchtogreeter_Includes ${SYSTEMD_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} - ) +) set(Switchtogreeter_Libraries ${SYSTEMD_LIBRARIES} ${GLIB_LIBRARIES} ${GIO_LIBRARIES} - ) +) add_subdirectory("src") #add_subdirectory("tests") diff --git a/dde-switchtogreeter/src/CMakeLists.txt b/dde-switchtogreeter/src/CMakeLists.txt index 2b061f0a5..de4b56d6f 100644 --- a/dde-switchtogreeter/src/CMakeLists.txt +++ b/dde-switchtogreeter/src/CMakeLists.txt @@ -6,15 +6,15 @@ set(Switchtogreeter_Name dde-switchtogreeter) add_executable(${Switchtogreeter_Name} ${Switchtogreeter_SRCS} - ) +) target_include_directories(${Switchtogreeter_Name} PUBLIC ${Switchtogreeter_Includes} - ) +) target_link_libraries(${Switchtogreeter_Name} PRIVATE ${Switchtogreeter_Libraries} - ) +) ## bin install(TARGETS ${Switchtogreeter_Name} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dde-touchscreen-dialog/CMakeLists.txt b/dde-touchscreen-dialog/CMakeLists.txt index 30f6a75bc..5da8c70ee 100644 --- a/dde-touchscreen-dialog/CMakeLists.txt +++ b/dde-touchscreen-dialog/CMakeLists.txt @@ -2,26 +2,27 @@ # # SPDX-License-Identifier: GPL-3.0-or-later +find_package(X11 REQUIRED) + file(GLOB_RECURSE Touchscreen_Dialog_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Touchscreen_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-touchscreen-dialog/src/main.cpp") set(Touchscreen_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::X11Extras - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) set(Touchscreen_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::X11Extras - Qt5::Widgets - Qt5::DBus + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus + ${X11_LIBRARIES} -lXext - ) +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-touchscreen-dialog/src/CMakeLists.txt b/dde-touchscreen-dialog/src/CMakeLists.txt index 37befdd1d..ea1601791 100644 --- a/dde-touchscreen-dialog/src/CMakeLists.txt +++ b/dde-touchscreen-dialog/src/CMakeLists.txt @@ -7,16 +7,16 @@ set(Touchscreen_Dialog_Name dde-touchscreen-dialog) add_executable(${Touchscreen_Dialog_Name} ${Touchscreen_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Touchscreen_Dialog_Name} PUBLIC ${Touchscreen_Dialog_Includes} - ) +) target_link_libraries(${Touchscreen_Dialog_Name} PRIVATE session-ui-dbus-shared ${Touchscreen_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Touchscreen_Dialog_Name} DESTINATION ${DAEMON_LIB_PATH}) diff --git a/dde-touchscreen-dialog/src/main.cpp b/dde-touchscreen-dialog/src/main.cpp index 366ff572a..314130c4c 100644 --- a/dde-touchscreen-dialog/src/main.cpp +++ b/dde-touchscreen-dialog/src/main.cpp @@ -22,13 +22,13 @@ int main(int argc, char *argv[]) { DApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); app.setQuitOnLastWindowClosed(true); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + - QLocale::system().name()); - app.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + + QLocale::system().name())) { + app.installTranslator(&translator); + } QCommandLineParser parser; parser.addHelpOption(); diff --git a/dde-touchscreen-dialog/src/monitorindicator.cpp b/dde-touchscreen-dialog/src/monitorindicator.cpp index 74f5ca256..c0ceb7b1c 100644 --- a/dde-touchscreen-dialog/src/monitorindicator.cpp +++ b/dde-touchscreen-dialog/src/monitorindicator.cpp @@ -7,10 +7,8 @@ #include #include #include -#include #include -#include MonitorIndicator::MonitorIndicator(QWidget *parent) : QFrame(parent) @@ -24,6 +22,12 @@ void MonitorIndicator::resizeEvent(QResizeEvent *e) { QFrame::resizeEvent(e); + Display* display = XOpenDisplay(nullptr); + if (!display) { + qWarning() << "XOpenDisplay failed"; + return; + } + XRectangle rectangle; rectangle.x = 0; rectangle.y = 0; @@ -31,12 +35,12 @@ void MonitorIndicator::resizeEvent(QResizeEvent *e) rectangle.height = static_cast(e->size().height()); // need to restore the cut area, if not,cut out will be repeated. - XShapeCombineRectangles(QX11Info::display(), winId(), ShapeBounding, 0, 0, &rectangle, 1, ShapeSet, YXBanded); + XShapeCombineRectangles(display, winId(), ShapeBounding, 0, 0, &rectangle, 1, ShapeSet, YXBanded); rectangle.x = 10; rectangle.y = 10; rectangle.width = static_cast(e->size().width()) - 20; rectangle.height = static_cast(e->size().height()) - 20; - XShapeCombineRectangles(QX11Info::display(), winId(), ShapeBounding, 0, 0, &rectangle, 1, ShapeSubtract, YXBanded); + XShapeCombineRectangles(display, winId(), ShapeBounding, 0, 0, &rectangle, 1, ShapeSubtract, YXBanded); } diff --git a/dde-touchscreen-dialog/tests/CMakeLists.txt b/dde-touchscreen-dialog/tests/CMakeLists.txt index a46d630c0..670e3f580 100644 --- a/dde-touchscreen-dialog/tests/CMakeLists.txt +++ b/dde-touchscreen-dialog/tests/CMakeLists.txt @@ -7,11 +7,11 @@ set(UT_Touchscreen_Dialog_Name ut-dde-touchscreen-dialog) file(GLOB_RECURSE UT_Touchscreen_Dialog_SRCS "*.h" "*.cpp" - ) +) add_executable(${UT_Touchscreen_Dialog_Name} ${Touchscreen_Dialog_SRCS} ${UT_Touchscreen_Dialog_SRCS} - ) +) # 用于测试覆盖率的编译条件 target_compile_options(${UT_Touchscreen_Dialog_Name} PRIVATE -fprofile-arcs -ftest-coverage) @@ -20,10 +20,10 @@ target_include_directories(${UT_Touchscreen_Dialog_Name} PUBLIC ${Touchscreen_Dialog_Includes} dde-touchscreen-dialog/ ../src/ - ) +) target_link_libraries(${UT_Touchscreen_Dialog_Name} PRIVATE session-ui-dbus-shared ${Touchscreen_Dialog_Libraries} ${Test_Libraries} - ) +) diff --git a/dde-warning-dialog/CMakeLists.txt b/dde-warning-dialog/CMakeLists.txt index d5fb001b7..1ea3587b8 100644 --- a/dde-warning-dialog/CMakeLists.txt +++ b/dde-warning-dialog/CMakeLists.txt @@ -5,20 +5,20 @@ file(GLOB_RECURSE Warning_Dialog_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Warning_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dde-warning-dialog/src/main.cpp") set(Warning_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) set(Warning_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-warning-dialog/src/CMakeLists.txt b/dde-warning-dialog/src/CMakeLists.txt index 204b48dfa..3dd1842a2 100644 --- a/dde-warning-dialog/src/CMakeLists.txt +++ b/dde-warning-dialog/src/CMakeLists.txt @@ -7,15 +7,15 @@ set(Warning_Dialog_Name dde-warning-dialog) add_executable(${Warning_Dialog_Name} ${Warning_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Warning_Dialog_Name} PUBLIC ${Warning_Dialog_Includes} - ) +) target_link_libraries(${Warning_Dialog_Name} PRIVATE ${Warning_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Warning_Dialog_Name} DESTINATION ${DAEMON_LIB_PATH}) diff --git a/dde-warning-dialog/src/main.cpp b/dde-warning-dialog/src/main.cpp index 46b17ee99..5980dbf96 100644 --- a/dde-warning-dialog/src/main.cpp +++ b/dde-warning-dialog/src/main.cpp @@ -34,8 +34,9 @@ int main(int argc, char *argv[]) a.setQuitOnLastWindowClosed(true); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - a.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + a.installTranslator(&translator); + } DGuiApplicationHelper::setSingleInstanceInterval(-1); if (!a.setSingleInstance(a.applicationName(), DApplication::UserScope)) { diff --git a/dde-welcome/CMakeLists.txt b/dde-welcome/CMakeLists.txt index 6cb07506b..e0564869a 100644 --- a/dde-welcome/CMakeLists.txt +++ b/dde-welcome/CMakeLists.txt @@ -14,11 +14,10 @@ add_library(dde-welcome-shared OBJECT target_link_libraries(dde-welcome-shared session-ui-widgets-shared session-ui-dbus-shared - Dtk::Widget - PkgConfig::GSETTINGS - Qt5::Widgets - Qt5::DBus - Qt5::Xml + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Xml ) add_subdirectory("src") diff --git a/dde-welcome/src/main.cpp b/dde-welcome/src/main.cpp index 86ca3bb91..7260d9b3e 100644 --- a/dde-welcome/src/main.cpp +++ b/dde-welcome/src/main.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include DWIDGET_USE_NAMESPACE DCORE_USE_NAMESPACE @@ -33,8 +33,9 @@ int main(int argc, char *argv[]) DLogManager::registerFileAppender(); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - app.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + app.installTranslator(&translator); + } PropertyGroup *property_group = new PropertyGroup(); diff --git a/dde-welcome/src/mainwidget.cpp b/dde-welcome/src/mainwidget.cpp index 5a9d1723f..3857997d9 100644 --- a/dde-welcome/src/mainwidget.cpp +++ b/dde-welcome/src/mainwidget.cpp @@ -5,12 +5,14 @@ #include "mainwidget.h" #include "updatecontent.h" #include "utils.h" +#include "org_deepin_dde_imageblur1.h" -#include #include #include #include +#include + #include "dtkcore_global.h" #if (DTK_VERSION >= DTK_VERSION_CHECK(2, 0, 8, 0)) #include @@ -18,14 +20,16 @@ #include #endif +using ImageBlur = org::deepin::dde::ImageBlur1; + MainWidget::MainWidget(QWidget *parent) : FullscreenBackground(parent) - , m_blurImageInter(new ImageBlur("org.deepin.dde.ImageBlur1", - "/org/deepin/dde/ImageBlur1", - QDBusConnection::systemBus(), this)) { + auto blurImageInter = new ImageBlur("org.deepin.dde.ImageBlur1", + "/org/deepin/dde/ImageBlur1", + QDBusConnection::systemBus(), this); setAccessibleName("MainWidget"); - connect(m_blurImageInter, &ImageBlur::BlurDone, this, &MainWidget::onBlurWallpaperFinished); + connect(blurImageInter, &ImageBlur::BlurDone, this, &MainWidget::onBlurWallpaperFinished); connect(qApp, &QApplication::aboutToQuit, this, [=] { DDBusSender() .service("org.deepin.dde.Zone1") @@ -37,8 +41,13 @@ MainWidget::MainWidget(QWidget *parent) }); - QGSettings gsettings("com.deepin.dde.appearance", "", this); - const QStringList list = gsettings.get("background-uris").toStringList(); + auto dConfig = Dtk::Core::DConfig::create("org.deepin.dde.appearance", "org.deepin.dde.appearance", QString(), this); + if (!dConfig) { + qWarning() << "Failed to create org.deepin.dde.appearance DConfig"; + return; + } + + const QStringList list = dConfig->value("Background-Uris").toStringList(); m_wallpaper = list.first(); const QUrl url(m_wallpaper); @@ -50,7 +59,7 @@ MainWidget::MainWidget(QWidget *parent) content->hide(); // blur wallpaper - const QString &w = m_blurImageInter->Get(m_wallpaper); + const QString &w = blurImageInter->Get(m_wallpaper); updateBackground(w.isEmpty() ? m_wallpaper : w); diff --git a/dde-welcome/src/mainwidget.h b/dde-welcome/src/mainwidget.h index 012b9b31d..98ae38837 100644 --- a/dde-welcome/src/mainwidget.h +++ b/dde-welcome/src/mainwidget.h @@ -7,12 +7,6 @@ #include "fullscreenbackground.h" -#include "org_deepin_dde_imageblur1.h" - -#include - -using ImageBlur = org::deepin::dde::ImageBlur1; - class MainWidget : public FullscreenBackground { Q_OBJECT @@ -26,7 +20,6 @@ class MainWidget : public FullscreenBackground void onBlurWallpaperFinished(const QString &source, const QString &blur, bool status); private: - ImageBlur *m_blurImageInter; QString m_wallpaper; }; diff --git a/dde-welcome/src/updatecontent.cpp b/dde-welcome/src/updatecontent.cpp index 9e4e97542..b551e4448 100644 --- a/dde-welcome/src/updatecontent.cpp +++ b/dde-welcome/src/updatecontent.cpp @@ -14,7 +14,7 @@ DGUI_USE_NAMESPACE UpdateContent::UpdateContent(const std::pair &version, QWidget *parent) : QWidget(parent) { QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setMargin(0); + mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); QLabel *successIcon = new QLabel; diff --git a/dde-welcome/src/utils.cpp b/dde-welcome/src/utils.cpp index 66a9c5f12..547bf80c3 100644 --- a/dde-welcome/src/utils.cpp +++ b/dde-welcome/src/utils.cpp @@ -7,7 +7,6 @@ const std::pair GetSystemVersion() { QSettings lsbSetting("/etc/os-version", QSettings::IniFormat); - lsbSetting.setIniCodec("utf-8"); lsbSetting.beginGroup("Version"); QLocale locale; diff --git a/dde-welcome/tests/CMakeLists.txt b/dde-welcome/tests/CMakeLists.txt index 019023f71..846d8f9d5 100644 --- a/dde-welcome/tests/CMakeLists.txt +++ b/dde-welcome/tests/CMakeLists.txt @@ -28,5 +28,5 @@ target_link_libraries(${UT_Welcome_Name} PRIVATE session-ui-util-shared session-ui-dbus-shared ${Test_Libraries} - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test ) diff --git a/dde-welcome/tests/ut_mainwidget.cpp b/dde-welcome/tests/ut_mainwidget.cpp index 58454cbcb..503412d11 100644 --- a/dde-welcome/tests/ut_mainwidget.cpp +++ b/dde-welcome/tests/ut_mainwidget.cpp @@ -3,10 +3,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later #define private public -#include "fullscreenbackground.h" #include "mainwidget.h" -#include "updatecontent.h" #undef private + #include "utils.h" #include @@ -33,9 +32,6 @@ class UT_MainWidget : public testing::Test TEST_F(UT_MainWidget, coverageTest) { - const QString &w = mainWidget->m_blurImageInter->Get(mainWidget->m_wallpaper); - Q_EMIT mainWidget->m_blurImageInter->BlurDone(mainWidget->m_wallpaper, w, true); - QTest::keyClick(mainWidget, Qt::Key_Enter); QTest::keyClick(mainWidget, Qt::Key_Escape); } diff --git a/dde-welcome/tests/widgets/ut_fullscreenbackground.cpp b/dde-welcome/tests/widgets/ut_fullscreenbackground.cpp index a85b981c7..ec93b8532 100644 --- a/dde-welcome/tests/widgets/ut_fullscreenbackground.cpp +++ b/dde-welcome/tests/widgets/ut_fullscreenbackground.cpp @@ -60,7 +60,7 @@ TEST_F(TstFullscreenBackground, coverageTest) QPaintEvent paintEvent(QRect(0, 0, 100, 100)); fullscreenBackground->paintEvent(&paintEvent); - event = QEvent(QEvent::Leave); - qApp->sendEvent(fullscreenBackground, &event); + QEvent event1(QEvent::Leave); + qApp->sendEvent(fullscreenBackground, &event1); } } diff --git a/dde-wm-chooser/CMakeLists.txt b/dde-wm-chooser/CMakeLists.txt index 37930dc97..719d8324c 100644 --- a/dde-wm-chooser/CMakeLists.txt +++ b/dde-wm-chooser/CMakeLists.txt @@ -10,19 +10,17 @@ file(GLOB_RECURSE Wm_Chooser_SRCS list(REMOVE_ITEM Wm_Chooser_SRCS "${CMAKE_SOURCE_DIR}/dde-wm-chooser/src/main.cpp") set(Wm_Chooser_Includes - ${DtkWidget_INCLUDE_DIRS} - ${GSETTINGS_INCLUDE_DIRS} - Qt5::Widgets - Qt5::DBus - Qt5::Xml - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Xml +) set(Wm_Chooser_Libraries - ${DtkWidget_LIBRARIES} - ${GSETTINGS_LIBRARIES} - Qt5::Widgets - Qt5::DBus - Qt5::Xml - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Xml +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dde-wm-chooser/src/CMakeLists.txt b/dde-wm-chooser/src/CMakeLists.txt index 52d43c31b..e08d84bce 100644 --- a/dde-wm-chooser/src/CMakeLists.txt +++ b/dde-wm-chooser/src/CMakeLists.txt @@ -7,18 +7,18 @@ set(Wm_Chooser_Name dde-wm-chooser) add_executable(${Wm_Chooser_Name} ${Wm_Chooser_SRCS} main.cpp - ) +) target_include_directories(${Wm_Chooser_Name} PUBLIC ${Wm_Chooser_Includes} - ) +) target_link_libraries(${Wm_Chooser_Name} PRIVATE session-ui-widgets-shared session-ui-util-shared session-ui-dbus-shared ${Wm_Chooser_Libraries} - ) +) ## bin install(TARGETS ${Wm_Chooser_Name} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dde-wm-chooser/src/main.cpp b/dde-wm-chooser/src/main.cpp index 4cdfe7c39..44686f1ce 100644 --- a/dde-wm-chooser/src/main.cpp +++ b/dde-wm-chooser/src/main.cpp @@ -13,7 +13,6 @@ #include #endif -#include #include #include #include @@ -51,8 +50,9 @@ int main(int argc, char *argv[]) a.setApplicationName("deepin-wm-chooser"); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - a.installTranslator(&translator); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + a.installTranslator(&translator); + } QCommandLineOption config(QStringList() << "c" << "config", ""); config.setValueName("ConfigPath"); diff --git a/dde-wm-chooser/src/wmframe.cpp b/dde-wm-chooser/src/wmframe.cpp index f0129fd61..95e46b0c6 100644 --- a/dde-wm-chooser/src/wmframe.cpp +++ b/dde-wm-chooser/src/wmframe.cpp @@ -5,7 +5,8 @@ #include "wmframe.h" #include -#include + +#include WMFrame::WMFrame(QWidget *parent) : FullscreenBackground(parent) @@ -18,8 +19,12 @@ WMFrame::WMFrame(QWidget *parent) m_wmchooser->setAccessibleName("WMChooser"); setContent(m_wmchooser); - QGSettings gsettings("com.deepin.dde.appearance", "", this); - const QStringList list = gsettings.get("background-uris").toStringList(); + auto dConfig = Dtk::Core::DConfig::create("org.deepin.dde.appearance", "org.deepin.dde.appearance", QString(), this); + if (!dConfig) { + qWarning() << "Failed to create DConfig: org.deepin.dde.appearance"; + return; + } + const QStringList list = dConfig->value("Background-Uris").toStringList(); QString wallpaper = list.first(); const QUrl url(wallpaper); diff --git a/dde-wm-chooser/tests/CMakeLists.txt b/dde-wm-chooser/tests/CMakeLists.txt index 20e04cfc8..6e6df10ec 100644 --- a/dde-wm-chooser/tests/CMakeLists.txt +++ b/dde-wm-chooser/tests/CMakeLists.txt @@ -29,5 +29,5 @@ target_link_libraries(${UT_Wm_Chooser_Name} PRIVATE session-ui-dbus-shared ${Wm_Chooser_Libraries} ${Test_Libraries} - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test ) diff --git a/debian/control b/debian/control index 01ef778f9..4a5325a95 100644 --- a/debian/control +++ b/debian/control @@ -4,22 +4,20 @@ Priority: optional Maintainer: Deepin Sysdev Build-Depends: debhelper (>= 8.0.0), pkg-config, cmake, - qtbase5-dev, + qt6-base-dev, + qt6-svg-dev, + qt6-tools-dev, libxcb-ewmh-dev, libxcb1-dev, - libqt5x11extras5-dev, - libgsettings-qt-dev, - libqt5svg5-dev, - libglib2.0-dev, - libdtkwidget-dev, - qttools5-dev-tools, + libx11-dev, + libdtk6widget-dev, + libdtk6core-bin, libsystemd-dev, - libdtkcore5-bin, - dde-dock-dev, libgtest-dev, libgmock-dev, libdeepin-pw-check-dev, - libgio-qt-dev + libgio-qt-dev, + libxext-dev Standards-Version: 3.9.4 Homepage: http://www.deepin.org/ diff --git a/dnetwork-secret-dialog/CMakeLists.txt b/dnetwork-secret-dialog/CMakeLists.txt index e32269d91..c04bc3e12 100644 --- a/dnetwork-secret-dialog/CMakeLists.txt +++ b/dnetwork-secret-dialog/CMakeLists.txt @@ -5,22 +5,22 @@ file(GLOB_RECURSE Dnetwork_Secret_Dialog_SRCS "src/*.h" "src/*.cpp" - ) +) list(REMOVE_ITEM Dnetwork_Secret_Dialog_SRCS "${CMAKE_SOURCE_DIR}/dnetwork-secret-dialog/src/main.cpp") set(Dmemory_Warning_Dialog_Includes - ${DtkWidget_INCLUDE_DIRS} - Qt5::Widgets - Qt5::Network - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::DBus +) set(Dnetwork_Secret_Dialog_Libraries - ${DtkWidget_LIBRARIES} - Qt5::Widgets - Qt5::Network - Qt5::DBus - ) + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::DBus +) add_subdirectory("src") add_subdirectory("tests") diff --git a/dnetwork-secret-dialog/src/CMakeLists.txt b/dnetwork-secret-dialog/src/CMakeLists.txt index 55d4699e8..cb50470ba 100644 --- a/dnetwork-secret-dialog/src/CMakeLists.txt +++ b/dnetwork-secret-dialog/src/CMakeLists.txt @@ -7,15 +7,15 @@ set(Dnetwork_Secret_Dialog_Name dnetwork-secret-dialog) add_executable(${Dnetwork_Secret_Dialog_Name} ${Dnetwork_Secret_Dialog_SRCS} main.cpp - ) +) target_include_directories(${Dnetwork_Secret_Dialog_Name} PUBLIC ${Dnetwork_Secret_Dialog_Includes} - ) +) target_link_libraries(${Dnetwork_Secret_Dialog_Name} PRIVATE ${Dnetwork_Secret_Dialog_Libraries} - ) +) ## bin install(TARGETS ${Dnetwork_Secret_Dialog_Name} DESTINATION ${DAEMON_LIB_PATH}) diff --git a/dnetwork-secret-dialog/src/main.cpp b/dnetwork-secret-dialog/src/main.cpp index 19563c8ee..83ef1d2f6 100644 --- a/dnetwork-secret-dialog/src/main.cpp +++ b/dnetwork-secret-dialog/src/main.cpp @@ -24,14 +24,14 @@ int main(int argc, char *argv[]) DApplication app(argc, argv); app.setOrganizationName("deepin"); app.setApplicationName("dnetwork-secret-dialog"); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); DLogManager::registerFileAppender(); QTranslator translator; - translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name()); - app.installTranslator(&translator); - app.loadTranslator(); + if (translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name())) { + app.installTranslator(&translator); + app.loadTranslator(); + } QCommandLineParser parser; parser.addHelpOption(); diff --git a/dnetwork-secret-dialog/tests/CMakeLists.txt b/dnetwork-secret-dialog/tests/CMakeLists.txt index 3c1b461a1..186b5899c 100644 --- a/dnetwork-secret-dialog/tests/CMakeLists.txt +++ b/dnetwork-secret-dialog/tests/CMakeLists.txt @@ -7,12 +7,12 @@ set(UT_Dnetwork_Secret_Dialog_Name ut-dnetwork-secret-dialog) file(GLOB_RECURSE UT_Dnetwork_Secret_Dialog_SRCS "*.h" "*.cpp" - ) +) add_executable(${UT_Dnetwork_Secret_Dialog_Name} ${Dnetwork_Secret_Dialog_SRCS} ${UT_Dnetwork_Secret_Dialog_SRCS} - ) +) # 用于测试覆盖率的编译条件 target_compile_options(${UT_Dnetwork_Secret_Dialog_Name} PRIVATE -fprofile-arcs -ftest-coverage) @@ -20,9 +20,9 @@ target_compile_options(${UT_Dnetwork_Secret_Dialog_Name} PRIVATE -fprofile-arcs target_include_directories(${UT_Dnetwork_Secret_Dialog_Name} PUBLIC ${Dnetwork_Secret_Dialog_Includes} ../src/ - ) +) target_link_libraries(${UT_Dnetwork_Secret_Dialog_Name} PRIVATE ${Dnetwork_Secret_Dialog_Libraries} ${Test_Libraries} - ) +) diff --git a/global_util/CMakeLists.txt b/global_util/CMakeLists.txt index 827a84f1f..0036c5aa6 100644 --- a/global_util/CMakeLists.txt +++ b/global_util/CMakeLists.txt @@ -22,6 +22,6 @@ PUBLIC target_link_libraries(session-ui-util-shared PRIVATE - Qt5::Widgets - Dtk::Core + Qt${QT_VERSION_MAJOR}::Widgets + Dtk${DTK_VERSION_MAJOR}::Core ) diff --git a/global_util/dbus/CMakeLists.txt b/global_util/dbus/CMakeLists.txt index 4435fed02..0f5d80eca 100644 --- a/global_util/dbus/CMakeLists.txt +++ b/global_util/dbus/CMakeLists.txt @@ -4,8 +4,6 @@ set(DBUS_SOURCE) -set(QT_VERSION_MAJOR 5) - set_source_files_properties( ${CMAKE_CURRENT_LIST_DIR}/../../xml/org.desktopspec.ObjectManager1.xml PROPERTIES @@ -15,7 +13,7 @@ set_source_files_properties( ApplicationObjectManager1 ) -qt5_add_dbus_interface( +qt_add_dbus_interface( DBUS_SOURCE ${CMAKE_CURRENT_LIST_DIR}/../../xml/org.desktopspec.ObjectManager1.xml objectmanager_interface @@ -100,12 +98,6 @@ dtk_add_dbus_interface( org_deepin_dde_inputdevice1_keyboard ) -dtk_add_dbus_interface( - DBUS_SOURCE - ../../xml/org.deepin.dde.Notification1.xml - org_deepin_dde_notification1 -) - dtk_add_dbus_interface( DBUS_SOURCE ../../xml/org.deepin.dde.SessionManager1.xml @@ -118,43 +110,14 @@ dtk_add_dbus_interface( org_deepin_dde_soundeffect1 ) +file(GLOB_RECURSE TYPES_SRCS + "types/*.h" + "types/*.cpp" +) + set(SESSION_UI_DBUS_INTERFACE_SRCS ${DBUS_SOURCE} - - types/appscgroupinfo.h - types/appscgroupinfolist.cpp - types/appscgroupinfolist.h - types/audioport.cpp - types/audioport.h - types/audioportlist.cpp - types/audioportlist.h - types/brightnessmap.cpp - types/brightnessmap.h - types/dockrect.cpp - types/dockrect.h - types/keyboardlayoutlist.cpp - types/keyboardlayoutlist.h - types/launcheriteminfo.cpp - types/launcheriteminfo.h - types/qrect.h - types/qvariantmap.cpp - types/qvariantmap.h - types/reflectlist.cpp - types/reflectlist.h - types/resolution.cpp - types/resolution.h - types/resolutionlist.cpp - types/resolutionlist.h - types/rotationlist.cpp - types/rotationlist.h - types/screenrect.cpp - types/screenrect.h - types/touchscreeninfolist.cpp - types/touchscreeninfolist.h - types/touchscreeninfolist_v2.cpp - types/touchscreeninfolist_v2.h - types/touchscreenmap.cpp - types/touchscreenmap.h + ${TYPES_SRCS} ) add_library(session-ui-dbus-shared OBJECT @@ -169,6 +132,6 @@ PUBLIC target_link_libraries(session-ui-dbus-shared PRIVATE - Qt5::DBus - Dtk::Core + Qt${QT_VERSION_MAJOR}::DBus + Dtk${DTK_VERSION_MAJOR}::Core ) diff --git a/global_util/dbus/types/screenrect.h b/global_util/dbus/types/screenrect.h index 08fa3a8d6..3d10eb9eb 100644 --- a/global_util/dbus/types/screenrect.h +++ b/global_util/dbus/types/screenrect.h @@ -41,6 +41,8 @@ struct ScreenRect friend const QDBusArgument &operator>>(const QDBusArgument &arg, ScreenRect &rect); friend QDBusArgument &operator<<(QDBusArgument &arg, const ScreenRect &rect); + bool operator !=(const ScreenRect &rect) const { return x != rect.x || y != rect.y || w != rect.w || h != rect.h; } + private: qint16 x; qint16 y; diff --git a/global_util/dbus/types/touchscreeninfolist.cpp b/global_util/dbus/types/touchscreeninfolist.cpp index 8b402d4a7..0864d095e 100644 --- a/global_util/dbus/types/touchscreeninfolist.cpp +++ b/global_util/dbus/types/touchscreeninfolist.cpp @@ -39,11 +39,16 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo &info) return arg; } -bool TouchscreenInfo::operator==(const TouchscreenInfo &info) +bool TouchscreenInfo::operator==(const TouchscreenInfo &info) const { return id == info.id && name == info.name && deviceNode == info.deviceNode && serialNumber == info.serialNumber; } +bool TouchscreenInfo::operator!=(const TouchscreenInfo &info) const +{ + return !(*this == info); +} + void registerTouchscreenInfoMetaType() { qRegisterMetaType("TouchscreenInfo"); diff --git a/global_util/dbus/types/touchscreeninfolist.h b/global_util/dbus/types/touchscreeninfolist.h index de4202082..916063af1 100644 --- a/global_util/dbus/types/touchscreeninfolist.h +++ b/global_util/dbus/types/touchscreeninfolist.h @@ -32,11 +32,25 @@ struct TouchscreenInfo { QString deviceNode; QString serialNumber; - bool operator ==(const TouchscreenInfo& info); + bool operator ==(const TouchscreenInfo& info) const; + bool operator !=(const TouchscreenInfo& info) const; }; typedef QList TouchscreenInfoList; +// 自定义 QList 的 != 操作符 +inline bool operator!=(const TouchscreenInfoList& list1, const TouchscreenInfoList& list2) { + if (list1.size() != list2.size()) + return true; + + for (int i = 0; i < list1.size(); ++i) { + if (list1[i] != list2[i]) { + return true; + } + } + return false; +} + Q_DECLARE_METATYPE(TouchscreenInfo) Q_DECLARE_METATYPE(TouchscreenInfoList) diff --git a/global_util/dbus/types/touchscreeninfolist_v2.cpp b/global_util/dbus/types/touchscreeninfolist_v2.cpp index cf9695c22..a17697e85 100644 --- a/global_util/dbus/types/touchscreeninfolist_v2.cpp +++ b/global_util/dbus/types/touchscreeninfolist_v2.cpp @@ -39,11 +39,16 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo_V2 &in return arg; } -bool TouchscreenInfo_V2::operator==(const TouchscreenInfo_V2 &info) +bool TouchscreenInfo_V2::operator==(const TouchscreenInfo_V2 &info) const { return id == info.id && name == info.name && deviceNode == info.deviceNode && serialNumber == info.serialNumber && UUID == info.UUID; } +bool TouchscreenInfo_V2::operator!=(const TouchscreenInfo_V2 &info) const +{ + return !(*this == info); +} + void registerTouchscreenInfoV2MetaType() { qRegisterMetaType("TouchscreenInfo_V2"); diff --git a/global_util/dbus/types/touchscreeninfolist_v2.h b/global_util/dbus/types/touchscreeninfolist_v2.h index 862319d76..a7c9efcb3 100644 --- a/global_util/dbus/types/touchscreeninfolist_v2.h +++ b/global_util/dbus/types/touchscreeninfolist_v2.h @@ -33,11 +33,24 @@ struct TouchscreenInfo_V2 { QString serialNumber; QString UUID; - bool operator ==(const TouchscreenInfo_V2& info); + bool operator ==(const TouchscreenInfo_V2& info) const; + bool operator !=(const TouchscreenInfo_V2& info) const; }; typedef QList TouchscreenInfoList_V2; +inline bool operator!=(const TouchscreenInfoList_V2 &list1, const TouchscreenInfoList_V2 &list2) { + if (list1.size() != list2.size()) + return true; + + for (int i = 0; i < list1.size(); ++i) { + if (list1[i] != list2[i]) { + return true; + } + } + return false; +} + Q_DECLARE_METATYPE(TouchscreenInfo_V2) Q_DECLARE_METATYPE(TouchscreenInfoList_V2) diff --git a/global_util/multiscreenmanager.cpp b/global_util/multiscreenmanager.cpp index 2572347b0..fe4b77a54 100644 --- a/global_util/multiscreenmanager.cpp +++ b/global_util/multiscreenmanager.cpp @@ -5,9 +5,7 @@ #include "multiscreenmanager.h" #include -#include #include -#include MultiScreenManager::MultiScreenManager(QObject *parent) : QObject(parent) diff --git a/reset-password-dialog/CMakeLists.txt b/reset-password-dialog/CMakeLists.txt index a0faa61fc..fec60d824 100644 --- a/reset-password-dialog/CMakeLists.txt +++ b/reset-password-dialog/CMakeLists.txt @@ -25,31 +25,26 @@ set(SRCS set(QRC resetpassworddialog.qrc) # Find the library find_package(PkgConfig REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5DBus REQUIRED) -find_package(Qt5Network REQUIRED) -find_package(Qt5Concurrent REQUIRED) - -find_package(DtkWidget REQUIRED) -find_package(DtkGui REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus Network Concurrent) +find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Widget Gui) pkg_check_modules(DeepinPwCheck REQUIRED IMPORTED_TARGET libdeepin_pw_check) add_executable(${BIN_NAME} ${SRCS} ${QRC}) target_include_directories(${BIN_NAME} PUBLIC - ${DtkWidget_INCLUDE_DIRS} - ${Qt5Gui_PRIVATE_INCLUDE_DIRS} + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Gui ${PROJECT_BINARY_DIR} ) target_link_libraries(${BIN_NAME} PRIVATE session-ui-dbus-shared - ${DtkWidget_LIBRARIES} - ${Qt5Widgets_LIBRARIES} - ${Qt5Network_LIBRARIES} - ${Qt5DBus_LIBRARIES} - ${Qt5Concurrent_LIBRARIES} + Dtk${DTK_VERSION_MAJOR}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::Concurrent PkgConfig::DeepinPwCheck crypt ${LIBS} diff --git a/reset-password-dialog/passwordwidget.cpp b/reset-password-dialog/passwordwidget.cpp index 14f9234ce..394f0520c 100644 --- a/reset-password-dialog/passwordwidget.cpp +++ b/reset-password-dialog/passwordwidget.cpp @@ -64,7 +64,7 @@ void PasswordWidget::initWidget(int margin) QVBoxLayout *resetPasswordVLayout = new QVBoxLayout(this); resetPasswordVLayout->setSpacing(0); - resetPasswordVLayout->setMargin(0); + resetPasswordVLayout->setContentsMargins(0, 0, 0, 0); QLabel *newPasswordLabel = new QLabel(tr("New Password") + ":"); QHBoxLayout *newPasswordLayout = new QHBoxLayout; diff --git a/reset-password-dialog/resetpassworddialog.cpp b/reset-password-dialog/resetpassworddialog.cpp index 5f9111bd8..6ffbabaa1 100644 --- a/reset-password-dialog/resetpassworddialog.cpp +++ b/reset-password-dialog/resetpassworddialog.cpp @@ -8,7 +8,6 @@ #include "resetpasswordworker.h" #include -#include #include #include #include @@ -64,7 +63,7 @@ void ResetPasswordDialog::mouseMoveEvent(QMouseEvent *event) void ResetPasswordDialog::mousePressEvent(QMouseEvent *event) { - if (this->geometry().contains(event->globalPos())) { + if (this->geometry().contains(event->globalPosition().toPoint())) { DDialog::mousePressEvent(event); } } @@ -98,7 +97,7 @@ void ResetPasswordDialog::initWidget(const QString &userName) QWidget *mainContentWidget = new QWidget; QVBoxLayout *mainContentLayout = new QVBoxLayout(mainContentWidget); mainContentLayout->setSpacing(0); - mainContentLayout->setMargin(0); + mainContentLayout->setContentsMargins(0, 0, 0, 0); m_buttonBox = new DButtonBox(this); m_buttonBox->setButtonList({new DButtonBoxButton(tr("Security Questions")), new DButtonBoxButton("Union ID")}, true); @@ -128,7 +127,7 @@ void ResetPasswordDialog::initWidget(const QString &userName) connect(m_resetPasswordWorker, &ResetPasswordWorker::requestVerifyVerficationCodeReplied, m_UnionIDWidget, &UnionIDWidget::onRequestVerifyVerficationCodeReplied); m_stackedLayout->setSpacing(0); - m_stackedLayout->setMargin(0); + m_stackedLayout->setContentsMargins(0, 0, 0, 0); m_stackedLayout->addWidget(m_SecurityQuestionsWidget); m_stackedLayout->addWidget(m_UnionIDWidget); mainContentLayout->addLayout(m_stackedLayout); diff --git a/reset-password-dialog/resetpasswordworker.cpp b/reset-password-dialog/resetpasswordworker.cpp index 9ed1227e1..141d3314e 100644 --- a/reset-password-dialog/resetpasswordworker.cpp +++ b/reset-password-dialog/resetpasswordworker.cpp @@ -66,7 +66,9 @@ void ResetPasswordWorker::asyncBindCheck() Q_EMIT requestBindCheckReplied(watcher->result()); watcher->deleteLater(); }); - QFuture future = QtConcurrent::run(this, &ResetPasswordWorker::bindCheck); + QFuture future = QtConcurrent::run([this] { + return bindCheck(); + }); watcher->setFuture(future); } @@ -77,7 +79,9 @@ void ResetPasswordWorker::asyncRequestVerficationCode(const QString &phoneEmail) Q_EMIT requestVerficationCodeReplied(watcher->result()); watcher->deleteLater(); }); - QFuture future = QtConcurrent::run(this, &ResetPasswordWorker::requestVerficationCode, phoneEmail); + QFuture future = QtConcurrent::run([this, phoneEmail] { + return requestVerficationCode(phoneEmail); + }); watcher->setFuture(future); } diff --git a/reset-password-dialog/securityquestionswidget.cpp b/reset-password-dialog/securityquestionswidget.cpp index 263826725..f70462d6e 100644 --- a/reset-password-dialog/securityquestionswidget.cpp +++ b/reset-password-dialog/securityquestionswidget.cpp @@ -6,7 +6,6 @@ #include "pwqualitymanager.h" #include -#include #include #include @@ -57,7 +56,7 @@ void SecurityQuestionsWidget::initWidget() QVBoxLayout *answerQuestionsVLayout = new QVBoxLayout(m_answerQuestionsWidget); answerQuestionsVLayout->setSpacing(0); - answerQuestionsVLayout->setMargin(0); + answerQuestionsVLayout->setContentsMargins(0, 0, 0, 0); m_questionEdit1->setClearButtonEnabled(false); m_questionEdit1->setFocusPolicy(Qt::NoFocus); @@ -91,12 +90,12 @@ void SecurityQuestionsWidget::initWidget() QVBoxLayout *mainContentLayout = new QVBoxLayout(this); mainContentLayout->setSpacing(0); - mainContentLayout->setMargin(0); + mainContentLayout->setContentsMargins(0, 0, 0, 0); mainContentLayout->addSpacing(20); mainContentLayout->addLayout(m_stackedLayout); m_stackedLayout->setSpacing(0); - m_stackedLayout->setMargin(0); + m_stackedLayout->setContentsMargins(0, 0, 0, 0); m_stackedLayout->addWidget(m_answerQuestionsWidget); m_stackedLayout->addWidget(m_passwordWidget); diff --git a/reset-password-dialog/unionidwidget.cpp b/reset-password-dialog/unionidwidget.cpp index c2e6280b8..fb40ad454 100644 --- a/reset-password-dialog/unionidwidget.cpp +++ b/reset-password-dialog/unionidwidget.cpp @@ -40,7 +40,7 @@ void UnionIDWidget::initWidget() QWidget *resetPasswordWidget = new QWidget; QVBoxLayout *resetPasswordVLayout = new QVBoxLayout(resetPasswordWidget); resetPasswordVLayout->setSpacing(0); - resetPasswordVLayout->setMargin(0); + resetPasswordVLayout->setContentsMargins(0, 0, 0, 0); resetPasswordVLayout->addSpacing(10); QLabel *phoneEmaillabel = new QLabel(tr("Phone/Email") + ":"); @@ -65,7 +65,7 @@ void UnionIDWidget::initWidget() QWidget *connectingWidget = new QWidget; QVBoxLayout *connectingVLayout = new QVBoxLayout(connectingWidget); connectingVLayout->setSpacing(0); - connectingVLayout->setMargin(0); + connectingVLayout->setContentsMargins(0, 0, 0, 0); DSpinner *connectingIcon = new DSpinner; connectingIcon->setFixedSize(48, 48); connectingIcon->start(); @@ -79,7 +79,7 @@ void UnionIDWidget::initWidget() QWidget *unBindWidget = new QWidget; QVBoxLayout *unBindVLayout = new QVBoxLayout(unBindWidget); unBindVLayout->setSpacing(0); - unBindVLayout->setMargin(0); + unBindVLayout->setContentsMargins(0, 0, 0, 0); m_unBindIcon->setPixmap(QIcon::fromTheme(m_iconPath).pixmap({128, 128})); QLabel *unBindLabel = new QLabel(tr("The user account is not linked to Union ID")); unBindVLayout->addSpacing(64); @@ -91,7 +91,7 @@ void UnionIDWidget::initWidget() QWidget *connectFailedWidget = new QWidget; QVBoxLayout *connectFailedVLayout = new QVBoxLayout(connectFailedWidget); connectFailedVLayout->setSpacing(0); - connectFailedVLayout->setMargin(0); + connectFailedVLayout->setContentsMargins(0, 0, 0, 0); QLabel *connectFailedIcon = new QLabel; connectFailedIcon->setPixmap(QIcon::fromTheme("dialog-error").pixmap({128, 128})); QLabel *connectFailedLabel = new QLabel(tr("Network disconnected, please retry after connected")); @@ -108,7 +108,7 @@ void UnionIDWidget::initWidget() QVBoxLayout *mainContentLayout = new QVBoxLayout(this); mainContentLayout->setSpacing(0); - mainContentLayout->setMargin(0); + mainContentLayout->setContentsMargins(0, 0, 0, 0); mainContentLayout->addLayout(m_stackedLayout); } @@ -245,9 +245,9 @@ bool UnionIDWidget::isContentEmpty(DLineEdit *edit) bool UnionIDWidget::checkPhoneEmailFormat(const QString &content) { - QRegExp phoneRegExp("^1\\d{10}$"); - QRegExp emailRegExp("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"); - return phoneRegExp.exactMatch(content) || emailRegExp.exactMatch(content); + QRegularExpression phoneRegExp("^1\\d{10}$"); + QRegularExpression emailRegExp("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"); + return phoneRegExp.match(content).hasMatch() || emailRegExp.match(content).hasMatch(); } void UnionIDWidget::setIconPath(DGuiApplicationHelper::ColorType themeType) diff --git a/widgets/CMakeLists.txt b/widgets/CMakeLists.txt index 0e84e82ed..d884547d6 100644 --- a/widgets/CMakeLists.txt +++ b/widgets/CMakeLists.txt @@ -20,5 +20,5 @@ PUBLIC target_link_libraries(session-ui-widgets-shared PRIVATE - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) diff --git a/widgets/fullscreenbackground.cpp b/widgets/fullscreenbackground.cpp index 921c2b616..04d8898d3 100644 --- a/widgets/fullscreenbackground.cpp +++ b/widgets/fullscreenbackground.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -128,7 +127,7 @@ void FullscreenBackground::paintEvent(QPaintEvent *e) } } -void FullscreenBackground::enterEvent(QEvent *event) +void FullscreenBackground::enterEvent(QEnterEvent *event) { m_content->show(); emit contentVisibleChanged(true); diff --git a/widgets/fullscreenbackground.h b/widgets/fullscreenbackground.h index fde6ecd56..04e34cbf4 100644 --- a/widgets/fullscreenbackground.h +++ b/widgets/fullscreenbackground.h @@ -38,7 +38,7 @@ public slots: private: void paintEvent(QPaintEvent *e) override; - void enterEvent(QEvent *event) override; + void enterEvent(QEnterEvent *event) override; void leaveEvent(QEvent *event) override; void resizeEvent(QResizeEvent *event) override;