diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index 7bf2c228..14dbacb5 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -331,7 +331,27 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_ReShow(QSystemTrayIcon::ActivationReason))); - trayIcon->setIcon(logo); + /*-------------------------------------------------*\ + | If Greyscale Tray Icon flag is not set in config | + | then set the default value to false | + \*-------------------------------------------------*/ + if(!ui_settings.contains("greyscale_tray_icon")) + { + ui_settings["greyscale_tray_icon"] = false; + + settings_manager->SetSettings(ui_string, ui_settings); + settings_manager->SaveSettings(); + } + + /*-----------------------------------------------------*\ + | If greyscale tray icon exists in settings, apply it | + | or else set the icon to the default window logo | + \*-----------------------------------------------------*/ + if(ui_settings.contains("greyscale_tray_icon")) + { + SetTrayIcon(ui_settings["greyscale_tray_icon"].get()); + } + trayIcon->setToolTip("OpenRGB"); trayIcon->setContextMenu(trayIconMenu); trayIcon->show(); @@ -396,7 +416,7 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op | Add the LIFX settings page | \*-----------------------------------------------------*/ AddLIFXSettingsPage(); - + /*-----------------------------------------------------*\ | Add the Serial settings page | \*-----------------------------------------------------*/ @@ -620,6 +640,11 @@ void OpenRGBDialog2::AddSettingsPage() TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, "General Settings"); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); + + /*-----------------------------------------------------*\ + | Connect signals to slots | + \*-----------------------------------------------------*/ + connect(SettingsPage, SIGNAL(TrayIconChanged(bool)), this, SLOT(SetTrayIcon(bool))); } void OpenRGBDialog2::AddE131SettingsPage() @@ -1668,6 +1693,18 @@ void Ui::OpenRGBDialog2::SetDetectionViewState(bool detection_showing) } } +void OpenRGBDialog2::SetTrayIcon(bool tray_icon) +{ + if(tray_icon) + { + trayIcon->setIcon(QIcon(":OpenRGBGreyscale.png")); + } + else + { + trayIcon->setIcon(QIcon(":OpenRGB.png")); + } +} + void OpenRGBDialog2::SaveProfile() { ProfileManager* profile_manager = ResourceManager::get()->GetProfileManager(); diff --git a/qt/OpenRGBDialog2.h b/qt/OpenRGBDialog2.h index 84cdc140..0d05f3e0 100644 --- a/qt/OpenRGBDialog2.h +++ b/qt/OpenRGBDialog2.h @@ -62,6 +62,9 @@ public: bool DontShowAgain; +public slots: + void SetTrayIcon(bool tray_icon); + private: /*-------------------------------------*\ | Page pointers | diff --git a/qt/OpenRGBGreyscale.png b/qt/OpenRGBGreyscale.png new file mode 100644 index 00000000..054dac17 Binary files /dev/null and b/qt/OpenRGBGreyscale.png differ diff --git a/qt/OpenRGBSettingsPage.cpp b/qt/OpenRGBSettingsPage.cpp index 4c499b62..99f7c4bf 100644 --- a/qt/OpenRGBSettingsPage.cpp +++ b/qt/OpenRGBSettingsPage.cpp @@ -37,6 +37,11 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) : \*---------------------------------------------------------*/ json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface"); + if(ui_settings.contains("greyscale_tray_icon")) + { + ui->CheckboxTrayIconGreyscale->setChecked(ui_settings["greyscale_tray_icon"]); + } + if(ui_settings.contains("minimize_on_close")) { ui->CheckboxMinimizeOnClose->setChecked(ui_settings["minimize_on_close"]); @@ -166,6 +171,18 @@ void OpenRGBSettingsPage::on_ComboBoxTheme_currentTextChanged(const QString them } } +void OpenRGBSettingsPage::on_CheckboxTrayIconGreyscale_clicked() +{ + json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface"); + bool tray_icon = ui->CheckboxTrayIconGreyscale->isChecked(); + + ui_settings["greyscale_tray_icon"] = tray_icon; + ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface", ui_settings); + SaveSettings(); + + emit TrayIconChanged(tray_icon); +} + void OpenRGBSettingsPage::on_CheckboxMinimizeOnClose_clicked() { json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface"); @@ -204,7 +221,7 @@ void Ui::OpenRGBSettingsPage::on_CheckboxAutoStart_clicked() { json autostart_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("AutoStart"); autostart_settings["enabled"] = ui->CheckboxAutoStart->isChecked(); - + if(autostart_settings["enabled"]) { RemediateAutoStartProfile(autostart_settings); @@ -502,13 +519,13 @@ void OpenRGBSettingsPage::RemediateAutoStartProfile(json &autostart_settings) ui->ComboBoxAutoStartProfile->findText(QString::fromStdString(autostart_settings["profile"])) == -1)) { autostart_settings["profile"] = ui->ComboBoxAutoStartProfile->itemText(0).toStdString(); - + if(autostart_settings["enabled"]) { autostart_settings["setprofile"] = false; - + ResourceManager::get()->GetSettingsManager()->SetSettings("AutoStart", autostart_settings); - + ConfigureAutoStart(); SaveSettings(); } diff --git a/qt/OpenRGBSettingsPage.h b/qt/OpenRGBSettingsPage.h index 63f3d682..c7da3844 100644 --- a/qt/OpenRGBSettingsPage.h +++ b/qt/OpenRGBSettingsPage.h @@ -17,6 +17,9 @@ public: explicit OpenRGBSettingsPage(QWidget *parent = nullptr); ~OpenRGBSettingsPage(); +signals: + void TrayIconChanged(bool tray_icon); + private: Ui::OpenRGBSettingsPageUi *ui; void SaveSettings(); @@ -34,6 +37,7 @@ private: private slots: void on_ComboBoxTheme_currentTextChanged(const QString); void on_CheckboxMinimizeOnClose_clicked(); + void on_CheckboxTrayIconGreyscale_clicked(); void on_CheckboxLoadGeometry_clicked(); void on_CheckboxSaveGeometry_clicked(); void on_CheckboxAutoStart_clicked(); diff --git a/qt/OpenRGBSettingsPage.ui b/qt/OpenRGBSettingsPage.ui index 3bceb6d8..b81cc279 100644 --- a/qt/OpenRGBSettingsPage.ui +++ b/qt/OpenRGBSettingsPage.ui @@ -24,12 +24,19 @@ 0 0 - 418 - 464 + 427 + 638 - + + + + Minimize On Close + + + + 90000 @@ -42,111 +49,38 @@ - - - - Start Client - - - - - - - Drivers Settings - - - - - - - Start at Login Status - - - - - - - - - Set Server Port - - - - - - - - - - User Interface Settings: - - - - - - - Minimize On Close - - - - - - - Save Geometry On Close - - - - - - - Start At Login - - - - - - - Load Profile - - - - Start Server - - + + + + + - Start At Login Settings: + Enable Log Console (restart required) - + Custom Arguments - - + + - Log Manager Settings: + Save Geometry On Close - - - - Start Minimized - - - - + Qt::Vertical @@ -162,20 +96,31 @@ - - - - - + + - Run zone checks on rescan + Load Window Geometry + + + + + + + Start Client + + + + + + + Start At Login Settings: - + - Enable Log Console (restart required) + Log Manager Settings: @@ -186,23 +131,85 @@ - - + + + + + - Load Window Geometry + Start at Login Status + + + + + + + Set Server Port + + + + + + + Load Profile + + + + + + + Drivers Settings + + + + + + + Run zone checks on rescan - + - + + + + User Interface Settings: + + + + + + + Start At Login + + + + + + + Start Minimized + + + + + + + AMD SMBus: Reduce CPU Usage (restart required) + + + + Greyscale Tray Icon + + + diff --git a/qt/resources.qrc b/qt/resources.qrc index 51eba994..41a2cd5e 100644 --- a/qt/resources.qrc +++ b/qt/resources.qrc @@ -49,5 +49,6 @@ storage_dark.png case.png case_dark.png + OpenRGBGreyscale.png