Refactor CMake files
This commit is contained in:
@@ -70,27 +70,33 @@ GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog,
|
||||
QObject::connect(ui_->radio_custom, &QRadioButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
||||
QObject::connect(ui_->button_change, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
||||
QObject::connect(ui_->checkbox_kde, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
QObject::connect(ui_->checkbox_gnome, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
QObject::connect(ui_->checkbox_mate, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
QObject::connect(ui_->button_gnome_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties);
|
||||
QObject::connect(ui_->button_mate_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenMateKeybindingProperties);
|
||||
#else
|
||||
ui_->widget_kde->hide();
|
||||
#endif
|
||||
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
|
||||
QObject::connect(ui_->checkbox_gnome, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
QObject::connect(ui_->button_gnome_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties);
|
||||
#else
|
||||
ui_->widget_gnome->hide();
|
||||
#endif
|
||||
#ifdef HAVE_MATE_GLOBALSHORTCUTS
|
||||
QObject::connect(ui_->checkbox_mate, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
QObject::connect(ui_->button_mate_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenMateKeybindingProperties);
|
||||
#else
|
||||
ui_->widget_mate->hide();
|
||||
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||
QObject::connect(ui_->checkbox_x11, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||
#else
|
||||
ui_->widget_x11->hide();
|
||||
#endif // HAVE_X11_GLOBALSHORTCUTS
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
ui_->widget_macos_access->hide();
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -113,8 +119,7 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
QObject::connect(ui_->button_macos_preferences, &QPushButton::clicked, manager, &GlobalShortcutsManager::ShowMacAccessibilityDialog);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
|
||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
||||
if (GlobalShortcutsManager::IsKdeAvailable()) {
|
||||
qLog(Debug) << "KDE (KGlobalAccel) backend is available.";
|
||||
ui_->widget_kde->show();
|
||||
@@ -123,7 +128,9 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
qLog(Debug) << "KDE (KGlobalAccel) backend is unavailable.";
|
||||
ui_->widget_kde->hide();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
|
||||
if (GlobalShortcutsManager::IsGnomeAvailable()) {
|
||||
qLog(Debug) << "Gnome (GSD) backend is available.";
|
||||
ui_->widget_gnome->show();
|
||||
@@ -132,7 +139,9 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
qLog(Debug) << "Gnome (GSD) backend is unavailable.";
|
||||
ui_->widget_gnome->hide();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATE_GLOBALSHORTCUTS
|
||||
if (GlobalShortcutsManager::IsMateAvailable()) {
|
||||
qLog(Debug) << "MATE backend is available.";
|
||||
ui_->widget_mate->show();
|
||||
@@ -141,8 +150,7 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
qLog(Debug) << "MATE backend is unavailable.";
|
||||
ui_->widget_mate->hide();
|
||||
}
|
||||
|
||||
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||
if (GlobalShortcutsManager::IsX11Available()) {
|
||||
@@ -153,7 +161,7 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
qLog(Debug) << "X11 backend is unavailable.";
|
||||
ui_->widget_x11->hide();
|
||||
}
|
||||
#endif // HAVE_X11_GLOBALSHORTCUTS
|
||||
#endif
|
||||
|
||||
const QList<GlobalShortcutsManager::Shortcut> shortcuts = manager->shortcuts().values();
|
||||
for (const GlobalShortcutsManager::Shortcut &i : shortcuts) {
|
||||
@@ -174,29 +182,31 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
|
||||
}
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
|
||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
||||
if (ui_->widget_kde->isVisibleTo(this)) {
|
||||
ui_->checkbox_kde->setChecked(s.value("use_kde", true).toBool());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
|
||||
if (ui_->widget_gnome->isVisibleTo(this)) {
|
||||
ui_->checkbox_gnome->setChecked(s.value("use_gnome", true).toBool());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATE_GLOBALSHORTCUTS
|
||||
if (ui_->widget_mate->isVisibleTo(this)) {
|
||||
ui_->checkbox_mate->setChecked(s.value("use_mate", true).toBool());
|
||||
}
|
||||
|
||||
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||
if (ui_->widget_x11->isVisibleTo(this)) {
|
||||
ui_->checkbox_x11->setChecked(s.value("use_x11", false).toBool());
|
||||
}
|
||||
#endif // HAVE_X11_GLOBALSHORTCUTS
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && (defined(HAVE_DBUS) || defined(HAVE_X11_GLOBALSHORTCUTS))
|
||||
#if defined(HAVE_KDE_GLOBALSHORTCUTS) || defined(HAVE_GNOME_GLOBALSHORTCUTS) || defined(HAVE_MATE_GLOBALSHORTCUTS) || defined(HAVE_X11_GLOBALSHORTCUTS)
|
||||
ShortcutOptionsChanged();
|
||||
#endif
|
||||
|
||||
@@ -224,15 +234,21 @@ void GlobalShortcutsSettingsPage::Save() {
|
||||
s.setValue(shortcut.s.id, shortcut.key.toString());
|
||||
}
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
||||
s.setValue("use_kde", ui_->checkbox_kde->isChecked());
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
|
||||
s.setValue("use_gnome", ui_->checkbox_gnome->isChecked());
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATE_GLOBALSHORTCUTS
|
||||
s.setValue("use_mate", ui_->checkbox_mate->isChecked());
|
||||
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||
s.setValue("use_x11", ui_->checkbox_x11->isChecked());
|
||||
#endif // HAVE_X11_GLOBALSHORTCUTS
|
||||
#endif
|
||||
|
||||
s.endGroup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user