diff --git a/src/Resources/icons.qrc b/src/Resources/icons.qrc
index 8094897..739e665 100644
--- a/src/Resources/icons.qrc
+++ b/src/Resources/icons.qrc
@@ -1,14 +1,16 @@
- icons/battery-charging-dark.png
- icons/battery-level-full-dark.png
- icons/battery-low-dark.png
- icons/battery-medium-dark.png
- icons/headphones-dark.png
- icons/battery-charging-light.png
- icons/battery-level-full-light.png
- icons/battery-low-light.png
- icons/battery-medium-light.png
- icons/headphones-light.png
+ icons/dark/png/battery-charging.png
+ icons/dark/png/battery-level-full.png
+ icons/dark/png/battery-low.png
+ icons/dark/png/battery-medium.png
+ icons/dark/png/headphones.png
+ icons/dark/index.theme
+ icons/light/index.theme
+ icons/light/png/battery-charging.png
+ icons/light/png/battery-level-full.png
+ icons/light/png/battery-low.png
+ icons/light/png/battery-medium.png
+ icons/light/png/headphones.png
diff --git a/src/Resources/icons/dark/index.theme b/src/Resources/icons/dark/index.theme
new file mode 100644
index 0000000..dd9bd92
--- /dev/null
+++ b/src/Resources/icons/dark/index.theme
@@ -0,0 +1,13 @@
+[Icon Theme]
+Name=dark
+Comment=dark theme icons
+PanelDefault=22
+PanelSizes=22
+Directories=png
+
+[png]
+Size=512
+Context=Applications
+MinSize=16
+MaxSize=512
+Type=Fixed
\ No newline at end of file
diff --git a/src/Resources/icons/battery-charging-dark.png b/src/Resources/icons/dark/png/battery-charging.png
similarity index 100%
rename from src/Resources/icons/battery-charging-dark.png
rename to src/Resources/icons/dark/png/battery-charging.png
diff --git a/src/Resources/icons/battery-level-full-dark.png b/src/Resources/icons/dark/png/battery-level-full.png
similarity index 100%
rename from src/Resources/icons/battery-level-full-dark.png
rename to src/Resources/icons/dark/png/battery-level-full.png
diff --git a/src/Resources/icons/battery-low-dark.png b/src/Resources/icons/dark/png/battery-low.png
similarity index 100%
rename from src/Resources/icons/battery-low-dark.png
rename to src/Resources/icons/dark/png/battery-low.png
diff --git a/src/Resources/icons/battery-medium-dark.png b/src/Resources/icons/dark/png/battery-medium.png
similarity index 100%
rename from src/Resources/icons/battery-medium-dark.png
rename to src/Resources/icons/dark/png/battery-medium.png
diff --git a/src/Resources/icons/headphones-dark.png b/src/Resources/icons/dark/png/headphones.png
similarity index 100%
rename from src/Resources/icons/headphones-dark.png
rename to src/Resources/icons/dark/png/headphones.png
diff --git a/src/Resources/icons/light/index.theme b/src/Resources/icons/light/index.theme
new file mode 100644
index 0000000..d382cfe
--- /dev/null
+++ b/src/Resources/icons/light/index.theme
@@ -0,0 +1,13 @@
+[Icon Theme]
+Name=light
+Comment=light theme icons
+PanelDefault=22
+PanelSizes=22
+Directories=png
+
+[png]
+Size=512
+Context=Applications
+MinSize=16
+MaxSize=512
+Type=Fixed
\ No newline at end of file
diff --git a/src/Resources/icons/battery-charging-light.png b/src/Resources/icons/light/png/battery-charging.png
similarity index 100%
rename from src/Resources/icons/battery-charging-light.png
rename to src/Resources/icons/light/png/battery-charging.png
diff --git a/src/Resources/icons/battery-level-full-light.png b/src/Resources/icons/light/png/battery-level-full.png
similarity index 100%
rename from src/Resources/icons/battery-level-full-light.png
rename to src/Resources/icons/light/png/battery-level-full.png
diff --git a/src/Resources/icons/battery-low-light.png b/src/Resources/icons/light/png/battery-low.png
similarity index 100%
rename from src/Resources/icons/battery-low-light.png
rename to src/Resources/icons/light/png/battery-low.png
diff --git a/src/Resources/icons/battery-medium-light.png b/src/Resources/icons/light/png/battery-medium.png
similarity index 100%
rename from src/Resources/icons/battery-medium-light.png
rename to src/Resources/icons/light/png/battery-medium.png
diff --git a/src/Resources/icons/headphones-light.png b/src/Resources/icons/light/png/headphones.png
similarity index 100%
rename from src/Resources/icons/headphones-light.png
rename to src/Resources/icons/light/png/headphones.png
diff --git a/src/Resources/tr/HeadsetControl_GUI_en.ts b/src/Resources/tr/HeadsetControl_GUI_en.ts
index 8a0d69a..7bcbae3 100644
--- a/src/Resources/tr/HeadsetControl_GUI_en.ts
+++ b/src/Resources/tr/HeadsetControl_GUI_en.ts
@@ -133,6 +133,7 @@ Model:
+
@@ -278,7 +279,7 @@ Model:
-
+
@@ -293,112 +294,112 @@ Model:
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
diff --git a/src/Resources/tr/HeadsetControl_GUI_it.ts b/src/Resources/tr/HeadsetControl_GUI_it.ts
index a896587..34d8cb7 100644
--- a/src/Resources/tr/HeadsetControl_GUI_it.ts
+++ b/src/Resources/tr/HeadsetControl_GUI_it.ts
@@ -135,6 +135,7 @@ Modello:
+
Nessun valore
@@ -280,7 +281,7 @@ Modello:
-
+
Crediti
@@ -295,115 +296,115 @@ Modello:
Impostazioni
-
+
Nascondi/Mostra
-
+
Accendi le Luci
-
+
Spegni le Luci
-
+
Esci
-
+
Cuffie Spente
-
+
HeadsetControl
Cuffie Spente
-
+
% - In Carica
-
+
HeadsetControl
Batteria in Carica
-
+
% - Batteria in scarica
-
+
HeadsetControl
Batteria:
-
+
Attenzione Batteria!
-
+
La batteria delle tue cuffie รจ scarica
-
+
No informazioni sulla batteria
-
+
Gioco
-
+
Chat
-
+
Controlla Aggirnamenti
-
-
+
+
aggiornato v
-
-
+
+
Nuova versione
-
+
-
+
Puoi trovare il codice sorgente di HeadsetControl-GUI su <a href='https://github.com/LeoKlaus/HeadsetControl-GUI'>GitHub</a>.<br/>Fatto da:<br/> - <a href='https://github.com/LeoKlaus'>LeoKlaus</a><br/> - <a href='https://github.com/nicola02nb'>nicola02nb</a><br/>Versione:
-
+
Un grande riconoscimento va a:<br/> - <a href='https://github.com/Sapd'>Sapd</a> per <a href='https://github.com/Sapd/HeadsetControl'>HeadsetCoontrol
diff --git a/src/UI/mainwindow.cpp b/src/UI/mainwindow.cpp
index 49838e9..7a53d19 100644
--- a/src/UI/mainwindow.cpp
+++ b/src/UI/mainwindow.cpp
@@ -21,21 +21,29 @@ MainWindow::MainWindow(QWidget *parent)
, timerGUI(new QTimer(this))
, API(HeadsetControlAPI(HEADSETCONTROL_FILE_PATH))
{
- defaultStyle = styleSheet();
QDir().mkpath(PROGRAM_CONFIG_PATH);
settings = loadSettingsFromFile(PROGRAM_SETTINGS_FILEPATH);
+ defaultStyle = styleSheet();
+
+ setupTrayIcon();
ui->setupUi(this);
bindEvents();
- setupTrayIcon();
+
updateIconsTheme();
updateStyle();
+
resetGUI();
+
updateGUI();
connect(&API, &HeadsetControlAPI::actionSuccesful, this, &::MainWindow::saveDevicesSettings);
connect(timerGUI, &QTimer::timeout, this, &::MainWindow::updateGUI);
timerGUI->start(settings.msecUpdateIntervalTime);
+
+ //Small trick to make work theme style change (Won't work unless you show window once)
+ show();
+ hide();
}
MainWindow::~MainWindow()
@@ -149,20 +157,15 @@ void MainWindow::bindEvents()
}
//Tray Icon Section
-void MainWindow::changeTrayIconTo(QString iconPath)
+void MainWindow::changeTrayIconTo(QString iconName)
{
- trayIconPath = iconPath;
- if (isAppDarkMode()) {
- trayIconPath.replace("-dark", "-light");
- } else {
- trayIconPath.replace("-light", "-dark");
- }
- trayIcon->setIcon(QIcon(trayIconPath));
+ trayIconName = iconName;
+ trayIcon->setIcon(QIcon::fromTheme(iconName));
}
void MainWindow::setupTrayIcon()
{
- changeTrayIconTo(":/icons/headphones-light.png");
+ changeTrayIconTo("headphones");
trayIcon->setToolTip("HeadsetControl");
trayMenu = new QMenu(this);
@@ -187,14 +190,12 @@ void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if (reason == QSystemTrayIcon::ActivationReason::Trigger) {
toggleWindow();
- updateIconsTheme();
}
}
//Theme mode Section
bool MainWindow::isAppDarkMode()
{
- // Check if the application is using a dark palette
Qt::ColorScheme scheme = qApp->styleHints()->colorScheme();
if (scheme == Qt::ColorScheme::Dark)
return true;
@@ -203,16 +204,13 @@ bool MainWindow::isAppDarkMode()
void MainWindow::updateIconsTheme()
{
- QString t = "";
if (isAppDarkMode()) {
- //qApp->setWindowIcon(QIcon(":/icons/headphones-light.png"));
- t = "-light";
+ QIcon::setThemeName("light");
} else {
- //qApp->setWindowIcon(QIcon(":/icons/headphones-dark.png"));
- t = "-dark";
+ QIcon::setThemeName("dark");
}
-
- changeTrayIconTo(trayIconPath);
+ setWindowIcon(QIcon::fromTheme("headphones"));
+ changeTrayIconTo(trayIconName);
}
void MainWindow::updateStyle()
@@ -238,7 +236,6 @@ void MainWindow::toggleWindow()
show();
if (firstShow) {
checkForUpdates(firstShow);
- //QtConcurrent::run([this] { checkForUpdates(firstShow); });
firstShow = false;
}
minimizeWindowSize();
@@ -261,7 +258,6 @@ void MainWindow::moveToBottomRight()
int x = screenGeometry.width() - width();
int y = screenGeometry.height() - height() - ui->notSupportedFrame->height()
- ui->missingheadsetcontrolFrame->height();
-
move(x, y);
}
@@ -367,7 +363,7 @@ void MainWindow::loadDevice(int deviceIndex)
ui->tabWidget->setTabEnabled(0, true);
setChatmixStatus();
}
- // Eualizer Section
+ // Equalizer Section
if (capabilities.contains("CAP_EQUALIZER_PRESET") && !selectedDevice->presets_list.empty()) {
ui->equalizerpresetFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
@@ -520,7 +516,7 @@ void MainWindow::updateGUI()
void MainWindow::setBatteryStatus()
{
if (selectedDevice == nullptr) {
- changeTrayIconTo(":/icons/headphones-light.png");
+ changeTrayIconTo("headphones");
return;
}
@@ -538,50 +534,52 @@ void MainWindow::setBatteryStatus()
if (status == "BATTERY_UNAVAILABLE") {
ui->batteryPercentage->setText(tr("Headset Off"));
trayIcon->setToolTip(tr("HeadsetControl \r\nHeadset Off"));
- changeTrayIconTo(":/icons/headphones-light.png");
+ changeTrayIconTo("headphones-light");
} else if (status == "BATTERY_CHARGING") {
ui->batteryPercentage->setText(level + tr("% - Charging"));
trayIcon->setToolTip(tr("HeadsetControl \r\nBattery Charging"));
- changeTrayIconTo(":/icons/battery-charging-light.png");
+ changeTrayIconTo("battery-charging");
} else if (status == "BATTERY_AVAILABLE") {
ui->batteryPercentage->setText(level + tr("% - Descharging"));
trayIcon->setToolTip(tr("HeadsetControl \r\nBattery: ") + level + "%");
if (level.toInt() > 75) {
- changeTrayIconTo(":/icons/battery-level-full-light.png");
+ changeTrayIconTo("battery-level-full");
notified = false;
} else if (level.toInt() > settings.batteryLowThreshold) {
- changeTrayIconTo(":/icons/battery-medium-light.png");
+ changeTrayIconTo("battery-medium");
notified = false;
} else {
- changeTrayIconTo(":/icons/battery-low-light.png");
+ changeTrayIconTo("battery-low");
if (!notified) {
trayIcon->showMessage(tr("Battery Alert!"),
tr("The battery of your headset is running low"),
- QIcon(":/icons/battery-low-light.png"));
+ QIcon("battery-low"));
notified = true;
}
}
} else {
ui->batteryPercentage->setText(tr("No battery info"));
trayIcon->setToolTip("HeadsetControl");
- changeTrayIconTo(":/icons/headphones-light.png");
+ changeTrayIconTo("headphones");
}
}
void MainWindow::setChatmixStatus()
{
+ QString chatmixStatus = tr("None");
+
if (selectedDevice == nullptr) {
- ui->chatmixvalueLabel->setText(tr("None"));
+ ui->chatmixvalueLabel->setText(chatmixStatus);
return;
}
int chatmix = selectedDevice->chatmix;
QString chatmixValue = QString::number(chatmix);
- QString chatmixStatus;
if (chatmix < 65)
chatmixStatus = tr("Game");
else if (chatmix > 65)
chatmixStatus = tr("Chat");
+
ui->chatmixvalueLabel->setText(chatmixValue);
ui->chatmixstatusLabel->setText(chatmixStatus);
}
diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h
index 9561836..ae7fdf1 100644
--- a/src/UI/mainwindow.h
+++ b/src/UI/mainwindow.h
@@ -45,7 +45,7 @@ class MainWindow : public QMainWindow
Ui::MainWindow *ui;
QSystemTrayIcon *trayIcon;
QTimer *timerGUI;
- QString trayIconPath;
+ QString trayIconName;
QMenu *trayMenu;
QAction *ledOn;
QAction *ledOff;
@@ -63,7 +63,7 @@ class MainWindow : public QMainWindow
void bindEvents();
//Tray Icon Section
- void changeTrayIconTo(QString iconPath);
+ void changeTrayIconTo(QString iconName);
void setupTrayIcon();
//Theme mode Section
diff --git a/src/main.cpp b/src/main.cpp
index bc2fa93..15dcd85 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,7 +4,7 @@
#include
const QString APP_NAME = "HeadsetControl-GUI";
-const QString GUI_VERSION = "0.16.4";
+const QString GUI_VERSION = "0.16.5";
int main(int argc, char *argv[])
{