diff --git a/app/SysTray-X/SysTray-X-app/SysTray-X-app.pro b/app/SysTray-X/SysTray-X-app/SysTray-X-app.pro index a600b96..f62ee35 100644 --- a/app/SysTray-X/SysTray-X-app/SysTray-X-app.pro +++ b/app/SysTray-X/SysTray-X-app/SysTray-X-app.pro @@ -22,9 +22,19 @@ include( ../SysTray-X.pri ) QT += core gui unix:!macx: { contains(DEFINES,KDE_INTEGRATION) { - QT += dbus KNotifications + lessThan(QT_MAJOR_VERSION, 6): { + QT += dbus KNotifications + } + else + { + INCLUDEPATH += /usr/include/KF6/KStatusNotifierItem + LIBS += -lKF6StatusNotifierItem + } + } + + lessThan(QT_MAJOR_VERSION, 6): { + QT += x11extras } - QT += x11extras } greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -152,8 +162,6 @@ win32: { SOURCES += \ main.cpp \ - nativeeventfilterbase.cpp \ - shortcut.cpp \ systrayxlink.cpp \ systrayxicon.cpp \ systrayx.cpp \ @@ -161,25 +169,39 @@ SOURCES += \ preferencesdialog.cpp \ preferences.cpp \ windowctrl.cpp + +lessThan(QT_MAJOR_VERSION, 6): { + SOURCES += \ + shortcut.cpp \ + nativeeventfilterbase.cpp +} + unix: { -SOURCES += \ - nativeeventfilter-x11.cpp \ - windowctrl-unix.cpp + SOURCES += \ + windowctrl-unix.cpp + contains(DEFINES,KDE_INTEGRATION) { SOURCES += \ systrayxstatusnotifier.cpp } + + lessThan(QT_MAJOR_VERSION, 6): { + SOURCES += \ + nativeeventfilter-x11.cpp + } } win32: { SOURCES += \ - nativeeventfilter-win.cpp \ windowctrl-win.cpp + + lessThan(QT_MAJOR_VERSION, 6): { + SOURCES += \ + nativeeventfilter-win.cpp + } } HEADERS += \ debug.h \ - nativeeventfilterbase.h \ - shortcut.h \ systrayxlink.h \ systrayxicon.h \ systrayx.h \ @@ -187,20 +209,35 @@ HEADERS += \ preferencesdialog.h \ preferences.h \ windowctrl.h + +lessThan(QT_MAJOR_VERSION, 6): { + HEADERS += \ + shortcut.h \ + nativeeventfilterbase.h +} + unix: { -HEADERS += \ - nativeeventfilter-x11.h \ + HEADERS += \ windowctrl-unix.h contains(DEFINES,KDE_INTEGRATION) { HEADERS += \ systrayxstatusnotifier.h } + + lessThan(QT_MAJOR_VERSION, 6): { + HEADERS += \ + nativeeventfilter-x11.h + } } win32: { -HEADERS += \ - nativeeventfilter-win.h \ + HEADERS += \ windowctrl-win.h + + lessThan(QT_MAJOR_VERSION, 6): { + HEADERS += \ + nativeeventfilter-win.h + } } FORMS += \ diff --git a/app/SysTray-X/SysTray-X-app/nativeeventfilter-x11.cpp b/app/SysTray-X/SysTray-X-app/nativeeventfilter-x11.cpp index 4e9c781..ce1554a 100644 --- a/app/SysTray-X/SysTray-X-app/nativeeventfilter-x11.cpp +++ b/app/SysTray-X/SysTray-X-app/nativeeventfilter-x11.cpp @@ -9,7 +9,9 @@ /* * Qt includes */ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include +#endif #include @@ -127,7 +129,11 @@ bool NativeEventFilterX11::connectShortcut( Qt::Key key_code, Qt::KeyboardModifi /* * Get the X11 display */ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Display *display = QX11Info::display(); +#else + Display *display = 0; +#endif /* * Get the final key code @@ -153,7 +159,11 @@ bool NativeEventFilterX11::connectShortcut( Qt::Key key_code, Qt::KeyboardModifi */ bool NativeEventFilterX11::disconnectShortcut() { - Display* display = QX11Info::display(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + Display *display = QX11Info::display(); +#else + Display *display = 0; +#endif /* * Ungrab the key diff --git a/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp b/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp index a6cded2..21b0eff 100644 --- a/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp +++ b/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp @@ -1105,6 +1105,7 @@ void PreferencesDialog::slotTruncateShowHideShortcut() { QKeySequence key_seq = m_ui->showHideKeySequenceEdit->keySequence(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) /* * Workaround for a Qt5 bug in QKeySequenceEdit object, Meta/Win key is not handled correctly. */ @@ -1119,6 +1120,13 @@ void PreferencesDialog::slotTruncateShowHideShortcut() } QKeySequence shortcut( value ); + +#else + + QKeySequence shortcut( key_seq[ 0 ] ); + +#endif + m_ui->showHideKeySequenceEdit->setKeySequence( shortcut ); } diff --git a/app/SysTray-X/SysTray-X-app/systrayx.cpp b/app/SysTray-X/SysTray-X-app/systrayx.cpp index 31caed9..a53b508 100644 --- a/app/SysTray-X/SysTray-X-app/systrayx.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayx.cpp @@ -9,7 +9,7 @@ #include "systrayxicon.h" #include "systrayxstatusnotifier.h" #include "windowctrl.h" -#include "shortcut.h" +//#include "shortcut.h" /* * Qt includes @@ -194,7 +194,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent ) m_preferences->displayDebug(); -/* + m_preferences->setBrowserVersion( "115.1.0" ); // m_preferences->setBrowserVersion( "102.2.3" ); @@ -215,7 +215,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent ) // m_preferences->setStartApp( "/home/maxime/test.sh" ); // m_preferences->setStartAppArgs( "/home/maxime/startup.txt StartupString" ); // slotStartApp(); -*/ + } @@ -735,7 +735,7 @@ void SysTrayX::slotLoadLanguage( QString locale ) } QString locale_path = "SysTray-X."+ locale; - m_translator.load( locale_path, ":/languages/" ); + (void)m_translator.load( locale_path, ":/languages/" ); // bool status = m_translator.load( locale_path, ":/languages/" ); // emit signalConsole( QString( "Language loaded %1").arg(status)); qApp->installTranslator( &m_translator ); @@ -784,6 +784,7 @@ void SysTrayX::slotCloseApp() void SysTrayX::slotShowHideShortcutChange() { +#ifdef ENABLE_SHORTCUT if( m_show_hide_shortcut != nullptr ) { disconnect( m_show_hide_shortcut, &Shortcut::activated, m_win_ctrl, &WindowCtrl::slotShowHide ); @@ -794,4 +795,5 @@ void SysTrayX::slotShowHideShortcutChange() m_show_hide_shortcut = new Shortcut( m_preferences->getShowHideShortcut(), this ); connect( m_show_hide_shortcut, &Shortcut::activated, m_win_ctrl, &WindowCtrl::slotShowHide ); +#endif }