From 55feaa3d3da615e9327ac0316a11bcd222239830 Mon Sep 17 00:00:00 2001 From: nicola02nb <61830443+nicola02nb@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:09:23 +0200 Subject: [PATCH] Added automatic update and release of translations, reorganize code for icons theme and names, small bug fixes --- .gitignore | 3 + HeadsetControl-GUI.pro | 11 +- src/Resources/icons.qrc | 20 +- ...charging.png => battery-charging-dark.png} | Bin ...ing-inv.png => battery-charging-light.png} | Bin ...l-full.png => battery-level-full-dark.png} | Bin ...l-inv.png => battery-level-full-light.png} | Bin .../{battery-low.png => battery-low-dark.png} | Bin ...tery-low-inv.png => battery-low-light.png} | Bin ...ery-medium.png => battery-medium-dark.png} | Bin ...edium-inv.png => battery-medium-light.png} | Bin .../{headphones.png => headphones-dark.png} | Bin ...eadphones-inv.png => headphones-light.png} | Bin ..._GUI_en_US.ts => HeadsetControl_GUI_en.ts} | 176 +++++++++--------- src/Resources/tr/HeadsetControl_GUI_en_US.qm | Bin 5293 -> 0 bytes ..._GUI_it_IT.ts => HeadsetControl_GUI_it.ts} | 176 +++++++++--------- src/Resources/tr/HeadsetControl_GUI_it_IT.qm | Bin 9261 -> 0 bytes src/Resources/translations.qrc | 6 - src/UI/mainwindow.cpp | 107 ++++++----- src/UI/mainwindow.h | 3 +- src/UI/mainwindow.ui | 87 ++++++++- src/Utils/headsetcontrolapi.cpp | 93 ++++----- src/Utils/headsetcontrolapi.h | 2 + src/main.cpp | 2 +- 24 files changed, 391 insertions(+), 295 deletions(-) rename src/Resources/icons/{battery-charging.png => battery-charging-dark.png} (100%) rename src/Resources/icons/{battery-charging-inv.png => battery-charging-light.png} (100%) rename src/Resources/icons/{battery-level-full.png => battery-level-full-dark.png} (100%) rename src/Resources/icons/{battery-level-full-inv.png => battery-level-full-light.png} (100%) rename src/Resources/icons/{battery-low.png => battery-low-dark.png} (100%) rename src/Resources/icons/{battery-low-inv.png => battery-low-light.png} (100%) rename src/Resources/icons/{battery-medium.png => battery-medium-dark.png} (100%) rename src/Resources/icons/{battery-medium-inv.png => battery-medium-light.png} (100%) rename src/Resources/icons/{headphones.png => headphones-dark.png} (100%) rename src/Resources/icons/{headphones-inv.png => headphones-light.png} (100%) rename src/Resources/tr/{HeadsetControl_GUI_en_US.ts => HeadsetControl_GUI_en.ts} (69%) delete mode 100644 src/Resources/tr/HeadsetControl_GUI_en_US.qm rename src/Resources/tr/{HeadsetControl_GUI_it_IT.ts => HeadsetControl_GUI_it.ts} (71%) delete mode 100644 src/Resources/tr/HeadsetControl_GUI_it_IT.qm delete mode 100644 src/Resources/translations.qrc diff --git a/.gitignore b/.gitignore index bf96c2c..bb665dd 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,9 @@ *.out *.app +#Translations +*.qm + # Folders build/* diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro index 5f781aa..5b3f98a 100644 --- a/HeadsetControl-GUI.pro +++ b/HeadsetControl-GUI.pro @@ -36,18 +36,21 @@ FORMS += \ src/UI/settingswindow.ui TRANSLATIONS += \ - src/Resources/tr/HeadsetControl_GUI_en_US.ts \ - src/Resources/tr/HeadsetControl_GUI_it_IT.ts + src/Resources/tr/HeadsetControl_GUI_en.ts \ + src/Resources/tr/HeadsetControl_GUI_it.ts RESOURCES += \ - src/Resources/icons.qrc \ - src/Resources/translations.qrc + src/Resources/icons.qrc RC_FILE = src/Resources/appicon.rc DISTFILES += \ .gitignore +CONFIG += lrelease +QM_FILES_RESOURCE_PREFIX=/translations/tr +CONFIG += embed_translations + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin diff --git a/src/Resources/icons.qrc b/src/Resources/icons.qrc index 1151afb..8094897 100644 --- a/src/Resources/icons.qrc +++ b/src/Resources/icons.qrc @@ -1,14 +1,14 @@ - icons/battery-charging.png - icons/battery-level-full.png - icons/battery-low.png - icons/battery-medium.png - icons/headphones.png - icons/battery-charging-inv.png - icons/battery-level-full-inv.png - icons/battery-low-inv.png - icons/battery-medium-inv.png - icons/headphones-inv.png + 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 diff --git a/src/Resources/icons/battery-charging.png b/src/Resources/icons/battery-charging-dark.png similarity index 100% rename from src/Resources/icons/battery-charging.png rename to src/Resources/icons/battery-charging-dark.png diff --git a/src/Resources/icons/battery-charging-inv.png b/src/Resources/icons/battery-charging-light.png similarity index 100% rename from src/Resources/icons/battery-charging-inv.png rename to src/Resources/icons/battery-charging-light.png diff --git a/src/Resources/icons/battery-level-full.png b/src/Resources/icons/battery-level-full-dark.png similarity index 100% rename from src/Resources/icons/battery-level-full.png rename to src/Resources/icons/battery-level-full-dark.png diff --git a/src/Resources/icons/battery-level-full-inv.png b/src/Resources/icons/battery-level-full-light.png similarity index 100% rename from src/Resources/icons/battery-level-full-inv.png rename to src/Resources/icons/battery-level-full-light.png diff --git a/src/Resources/icons/battery-low.png b/src/Resources/icons/battery-low-dark.png similarity index 100% rename from src/Resources/icons/battery-low.png rename to src/Resources/icons/battery-low-dark.png diff --git a/src/Resources/icons/battery-low-inv.png b/src/Resources/icons/battery-low-light.png similarity index 100% rename from src/Resources/icons/battery-low-inv.png rename to src/Resources/icons/battery-low-light.png diff --git a/src/Resources/icons/battery-medium.png b/src/Resources/icons/battery-medium-dark.png similarity index 100% rename from src/Resources/icons/battery-medium.png rename to src/Resources/icons/battery-medium-dark.png diff --git a/src/Resources/icons/battery-medium-inv.png b/src/Resources/icons/battery-medium-light.png similarity index 100% rename from src/Resources/icons/battery-medium-inv.png rename to src/Resources/icons/battery-medium-light.png diff --git a/src/Resources/icons/headphones.png b/src/Resources/icons/headphones-dark.png similarity index 100% rename from src/Resources/icons/headphones.png rename to src/Resources/icons/headphones-dark.png diff --git a/src/Resources/icons/headphones-inv.png b/src/Resources/icons/headphones-light.png similarity index 100% rename from src/Resources/icons/headphones-inv.png rename to src/Resources/icons/headphones-light.png diff --git a/src/Resources/tr/HeadsetControl_GUI_en_US.ts b/src/Resources/tr/HeadsetControl_GUI_en.ts similarity index 69% rename from src/Resources/tr/HeadsetControl_GUI_en_US.ts rename to src/Resources/tr/HeadsetControl_GUI_en.ts index 327e35f..8a0d69a 100644 --- a/src/Resources/tr/HeadsetControl_GUI_en_US.ts +++ b/src/Resources/tr/HeadsetControl_GUI_en.ts @@ -9,396 +9,396 @@ - + + Missing headsetcontrol!<br/>Download <a href="https://github.com/Sapd/HeadsetControl/releases/latest">headsetcontrol</a> in the program folder. + + + + + Open Program Folder + + + + HeadsetControl couldn't find any compatible or working headsets. :( - + Device: Vendor: Model: - + No info of the device - + Battery: - + No compatible Device found! - + Other - + Lights: - + RGB OFF - + RGB ON - + Sidetone Level: - + Quiet (Off) - - + + Loud - + Voice Prompts: - + Voice Off - + Voice On - + Notification Sound: - + Test 0 - + Test 1 - + Inactivity Timer: - + 0 Minute (Off) - + 90 Minutes - + Chatmix: - + None - + Equalizer - + Equalizer preset: - + Equalizer: - + Apply Equalizer - + Volume Limiter: - + Limiter Off - + Limiter On - + Microphone - + Rotate to mute: - + Off - + On - + Muted led brightness: - + Low (Off) - + High - + Microphone volume: - + Quiet - + Bluetooth - + Bluetooth when powered on: - + Bluetooth Off - + Bluetooth On - + Bluetooth call volume: - + BT and PC - + PC -12dB - + BT only - + File - + Help - + Check Updates - + About - - + + Credits - + Load Device - + Settings - + Hide/Show - + Turn Lights On - + Turn Lights Off - + Exit - - Missing headsetcontrol - - - - - Missing headsetcontrol<br/>Download <a href='https://github.com/Sapd/HeadsetControl/releases/latest'>headsetcontrol</a> in the opened folder. - - - - + Headset Off - + HeadsetControl Headset Off - + % - Charging - + HeadsetControl Battery Charging - + % - Descharging - + HeadsetControl Battery: - + Battery Alert! - + The battery of your headset is running low - + No battery info - + Game - + Chat - + Check for updates - - + + up-to date v - + Newer version - + About this program - + You can find HeadsetControl-GUI source code on <a href='https://github.com/LeoKlaus/HeadsetControl-GUI'>GitHub</a>.<br/>Made by:<br/> - <a href='https://github.com/LeoKlaus'>LeoKlaus</a><br/> - <a href='https://github.com/nicola02nb'>nicola02nb</a><br/>Version: - + Big shout-out to:<br/> - <a href='https://github.com/Sapd'>Sapd</a> for <a href='https://github.com/Sapd/HeadsetControl'>HeadsetCoontrol diff --git a/src/Resources/tr/HeadsetControl_GUI_en_US.qm b/src/Resources/tr/HeadsetControl_GUI_en_US.qm deleted file mode 100644 index 022d21851908222b88bb65d03a5c64f0d4bb1907..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5293 zcma)Adu&@*9X?L3-;TW$T4<@ZlcCC4x5P=HNLa-vab5-I(K<=DYJy$+9>kCWQEz`Pte05Fu?p#^y7GMBXK2 z_GPTUBgzx|2x%`9;*zXe&U}S0iQ3E^-pdjBw>=VM^8ZFvt;g>^M4q6z2;j`fbSUdExcI*|E%x$z`w!& zR^K`2D|nx3tF(u)zoYG?dXSLVnYOn#{tb4%()Qo~q#>u!zSMq-knoZc2t5MaekFC1 zL65vrxxa$_S>?=G@KGLCEZ0t?duxk9`Y}YWUznDfBy&0 zLhkeaua2IC-Y@%~`WE~X+mE#$>v#QcTMt3s#{9E242X&h4(K8&hOa^{=W{+vpR5lg7^O8d%)cr{F1l;JKhN?cYXo-9}R6gfxU7p z^!?MH0`BQ>PvWoeS9kc6mwt%#aJcx!pRrDd_y6cOu{xb3K6Mumo-%K3reiV3- zIRENi$iH1j&>U~SjGvGzE`U#L3+l4fl$}CvkylcAwW=jE?%(YxHA73>lEPEt zOx0{AvfLCFHf3cX-3inyzBYXPl=mYb!*?xpE&Z{^lqE1_p>c852CGR};uHzYi+Yb=#7 z^O`qK8Q13}<*0LqsTPI4sEazC(JRc7#9c54mco{xqB*^yqY=o1CbEi@6u4-Ps~Q@% zo2wG5bKKFqA>kaawbaQc^rFS9Wo}AjuDb$kt@Lh~&~5vwNGi6{V;)?asL>CHdCfFj z7sX(i8syT*p-)aaM*=?zNk;sSw;IgwTnffA>N@=OS%p=3r#kP7PCCU+ib?#Uzy@%pLU^%Ag77;_%2@*4oWzuHt zmKWvtHE2mth37a*vYcsX87E;EZ^EW6^j&G6Nz66ITo~49H{OTs3*5mST2#$ubANAN zrZ(IQQ;HY>F#~&6(j4QTHdM#Hu9~{-J((HP#kf;&D`#(`HczNvSg5yjaam!U%&dHK z`LuH7G4&!h)V=|;kjz~9zDhmUtg5nMD&|yskUQ=;P8YqSGrlt~>X?hVxAxv`+l@$VQQS5Y?3c?}XU+De9qN(6oxu}Gaz zVh~PhSOxZs*rbfTK{S$H{jb4>l{pn@gc^@Iy^Idm5E948-lz|2YSoc-Y{4tE;f5CQ ziaW!&=6bUY>|zzZ*qAuHfr(v?=>}?EsFrZ5Eog8}z4KHeadsetControl-GUI - + + Missing headsetcontrol!<br/>Download <a href="https://github.com/Sapd/HeadsetControl/releases/latest">headsetcontrol</a> in the program folder. + Manca headsetcontrol!<br/>Scarica <a href="https://github.com/Sapd/HeadsetControl/releases/latest">headsetcontrol</a> nella cartella del programma. + + + + Open Program Folder + Apri Cartella del Programma + + + HeadsetControl couldn't find any compatible or working headsets. :( HeadsetControl non è riuscito a trovare delle cuffie funizionanti o compatibili. :( - + Device: Vendor: Model: @@ -23,387 +33,377 @@ Distributore: Modello: - + No info of the device Nessuna informazione sul dipositivo - + Battery: Batteria: - + No compatible Device found! Nessun dispositivo compatibile è stato trovato! - + Other Altro - + Lights: Luci: - + RGB OFF RGB OFF - + RGB ON RGB ON - + Sidetone Level: Tono Laterale: - + Quiet (Off) Silenzioso (Spento) - - + + Loud Forte - + Voice Prompts: Istruzioni Vocali: - + Voice Off Voce Accesa - + Voice On Voce Spenta - + Notification Sound: Suono di Notifica: - + Test 0 Prova 0 - + Test 1 Prova 1 - + Inactivity Timer: Tempo di Inattività: - + 0 Minute (Off) 0 Minuti (Spento) - + 90 Minutes 90 Minuti - + Chatmix: Chatmix: - + None Nessun valore - + Equalizer Equalizzatore - + Equalizer preset: Preset Equalizzatore: - + Equalizer: Equalizzatore: - + Apply Equalizer Applica Equalizzatore - + Volume Limiter: Limitatore Volume: - + Limiter Off Limitatore Spento - + Limiter On Limitatore Acceso - + Microphone Microfono - + Rotate to mute: Ruota per mutare: - + Off Spento - + On Acceso - + Muted led brightness: Luminosità microfono mutato: - + Low (Off) Basso (Spento) - + High Alto - + Microphone volume: Volume microfono: - + Quiet Basso - + Bluetooth Bluetooth - + Bluetooth when powered on: Bluetooth quando accese: - + Bluetooth Off Bluetooth Spento - + Bluetooth On Bluetooth Acceso - + Bluetooth call volume: Bluetoot volume chiamata: - + BT and PC BT e PC - + PC -12dB PC -12dB - + BT only Solo BT - + File File - + Help Aiuto - + Check Updates Controlla Aggiornamenti - + About About - - + + Credits Crediti - + Load Device Carica Dispositivo - + Settings Impostazioni - + Hide/Show Nascondi/Mostra - + Turn Lights On Accendi le Luci - + Turn Lights Off Spegni le Luci - + Exit Esci - - Missing headsetcontrol - Manca headsetcontrol.exe - - - - Missing headsetcontrol<br/>Download <a href='https://github.com/Sapd/HeadsetControl/releases/latest'>headsetcontrol</a> in the opened folder. - Manca headsetcontrol<br/>Scarica <a href='https://github.com/Sapd/HeadsetControl/releases/latest'>headsetcontrol</a> nella cartella aperta. - - - + Headset Off Cuffie Spente - + HeadsetControl Headset Off HeadsetControl Cuffie Spente - + % - Charging % - In Carica - + HeadsetControl Battery Charging HeadsetControl Batteria in Carica - + % - Descharging % - Batteria in scarica - + HeadsetControl Battery: HeadsetControl Batteria: - + Battery Alert! Attenzione Batteria! - + The battery of your headset is running low La batteria delle tue cuffie è scarica - + No battery info No informazioni sulla batteria - + Game Gioco - + Chat Chat - + Check for updates Controlla Aggirnamenti - - + + up-to date v aggiornato v - + Newer version Nuova versione - + About this program - + You can find HeadsetControl-GUI source code on <a href='https://github.com/LeoKlaus/HeadsetControl-GUI'>GitHub</a>.<br/>Made by:<br/> - <a href='https://github.com/LeoKlaus'>LeoKlaus</a><br/> - <a href='https://github.com/nicola02nb'>nicola02nb</a><br/>Version: 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: - + Big shout-out to:<br/> - <a href='https://github.com/Sapd'>Sapd</a> for <a href='https://github.com/Sapd/HeadsetControl'>HeadsetCoontrol 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/Resources/tr/HeadsetControl_GUI_it_IT.qm b/src/Resources/tr/HeadsetControl_GUI_it_IT.qm deleted file mode 100644 index 6f0725582fd3628ae905650b3bb574d51a2528b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9261 zcmb_heQX@n5g$8u_W5kzkw8r1n&c%-uw!DM6G~N1#+5(f#N})!Iol}+0qeW9Z zV{g}vBU%-eQa&qHRRQ&b3jUx#3*rx?7AU14s45UGEfS58P!W{U0)iGqDXj|q&8~0v zKHfQ@5NmU{d+*JgH*e-QznLBUd3MuNZ~x%C&ur^@^zz#udGW_Y6xQs^CT2#68h?eG zONq|7jcE4Q_$*N9wyTMnQWW}Kh$!+7g`V9>)N&SuPMn9&0~C65fT-UED1 zZFrjQcD4|;zeSJTl_A>tAwBtriy?0>{U(18QT*J7q3sW1o$iKI__IXKk%projNi1U z;pm$SL|v~mJihmR>}X%Z3Fmt3<(0<#x)$8u-uU23Gtrrc8$a0m7M|~E{O^B~SjSp- z!@8%4*54ayihKv-{vJv^sY2gOD1TKRdR`QI_BqIjq(dLw`X2Uket75Cu+P@5;ekok z|ATP$hgt0FNciZ!A?)Mj@Kt9%2YcNYzH$6X=-(6m>7B4o$D8=vgY~zDKd`<9eIIIa zUYWr7OPj9Vj(s$|-1MW_0#W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BX!= zGtd!RQgmUXCntJ}Dr)a+aaS@rrYhtK>^i=nZI5;~aW~Qe_YWj$n U8&1vcOLM?g+wfXEYiwxvA5g=onE(I) diff --git a/src/Resources/translations.qrc b/src/Resources/translations.qrc deleted file mode 100644 index c246505..0000000 --- a/src/Resources/translations.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - tr/HeadsetControl_GUI_en_US.qm - tr/HeadsetControl_GUI_it_IT.qm - - diff --git a/src/UI/mainwindow.cpp b/src/UI/mainwindow.cpp index c2d3f9d..49838e9 100644 --- a/src/UI/mainwindow.cpp +++ b/src/UI/mainwindow.cpp @@ -30,22 +30,7 @@ MainWindow::MainWindow(QWidget *parent) updateIconsTheme(); updateStyle(); resetGUI(); - - if (!fileExists(HEADSETCONTROL_FILE_PATH)) { - openFileExplorer(PROGRAM_APP_PATH); - DialogInfo *dialog = new DialogInfo(this); - dialog->setTitle(tr("Missing headsetcontrol")); - dialog->setLabel(tr("Missing headsetcontrol
" - "Download headsetcontrol in the opened folder.")); - dialog->exec(); - } else { - loadDevices(); - if (!deviceList.isEmpty() && n_connected > 0) { - loadDevice(); - } - } + updateGUI(); connect(&API, &HeadsetControlAPI::actionSuccesful, this, &::MainWindow::saveDevicesSettings); @@ -87,6 +72,11 @@ void MainWindow::bindEvents() connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout); connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits); + //Error frames + connect(ui->openfolderPushButton, &QPushButton::clicked, this, [=]() { + openFileExplorer(PROGRAM_APP_PATH); + }); + // Other Section connect(ui->onlightButton, &QPushButton::clicked, &API, [=]() { API.setLights(selectedDevice, true); @@ -159,10 +149,20 @@ void MainWindow::bindEvents() } //Tray Icon Section -void MainWindow::setupTrayIcon() +void MainWindow::changeTrayIconTo(QString iconPath) { - trayIconPath = ":/icons/headphones-inv.png"; + trayIconPath = iconPath; + if (isAppDarkMode()) { + trayIconPath.replace("-dark", "-light"); + } else { + trayIconPath.replace("-light", "-dark"); + } trayIcon->setIcon(QIcon(trayIconPath)); +} + +void MainWindow::setupTrayIcon() +{ + changeTrayIconTo(":/icons/headphones-light.png"); trayIcon->setToolTip("HeadsetControl"); trayMenu = new QMenu(this); @@ -203,17 +203,16 @@ bool MainWindow::isAppDarkMode() void MainWindow::updateIconsTheme() { - QString inv = ""; + QString t = ""; if (isAppDarkMode()) { - inv = "-inv"; - trayIconPath.replace(".png", "-inv.png"); + //qApp->setWindowIcon(QIcon(":/icons/headphones-light.png")); + t = "-light"; } else { - trayIconPath.replace("-inv.png", ".png"); + //qApp->setWindowIcon(QIcon(":/icons/headphones-dark.png")); + t = "-dark"; } - setWindowIcon(QIcon(":/icons/headphones" + inv + ".png")); - qApp->setWindowIcon(QIcon(":/icons/headphones" + inv + ".png")); - trayIcon->setIcon(QIcon(trayIconPath)); + changeTrayIconTo(trayIconPath); } void MainWindow::updateStyle() @@ -260,7 +259,8 @@ void MainWindow::moveToBottomRight() QRect screenGeometry = screen->availableGeometry(); int x = screenGeometry.width() - width(); - int y = screenGeometry.height() - height() - ui->notSupportedFrame->height(); + int y = screenGeometry.height() - height() - ui->notSupportedFrame->height() + - ui->missingheadsetcontrolFrame->height(); move(x, y); } @@ -270,6 +270,7 @@ void MainWindow::resetGUI() ledOn->setEnabled(false); ledOff->setEnabled(false); + ui->missingheadsetcontrolFrame->setHidden(false); ui->notSupportedFrame->setHidden(false); ui->deviceinfoFrame->setHidden(true); @@ -292,6 +293,7 @@ void MainWindow::resetGUI() ui->equalizerpresetFrame->setHidden(true); ui->equalizerFrame->setHidden(true); ui->applyEqualizer->setEnabled(false); + clearEqualizerSliders(ui->equalizerLayout); ui->rotatetomuteFrame->setHidden(true); ui->muteledbrightnessFrame->setHidden(true); @@ -322,6 +324,7 @@ void MainWindow::loadDevice(int deviceIndex) selectedDevice = deviceList.value(deviceIndex); QSet &capabilities = selectedDevice->capabilities; + ui->missingheadsetcontrolFrame->setHidden(true); ui->notSupportedFrame->setHidden(true); qDebug() << selectedDevice->capabilities; @@ -486,16 +489,29 @@ QList MainWindow::getSavedDevices() void MainWindow::updateDevice() { - if (selectedDevice != nullptr) { - QList newDl = API.getConnectedDevices(); - selectedDevice->updateDevice(newDl); - } + QList newDl = API.getConnectedDevices(); + selectedDevice->updateDevice(newDl); } //Update GUI Section void MainWindow::updateGUI() { - updateDevice(); + if (!fileExists(HEADSETCONTROL_FILE_PATH)) { + resetGUI(); + ui->notSupportedFrame->setHidden(true); + selectedDevice = nullptr; + } else { + if (selectedDevice == nullptr) { + loadDevices(); + if (!deviceList.isEmpty() && n_connected > 0) { + loadDevice(); + } else { + ui->missingheadsetcontrolFrame->setHidden(true); + } + } else { + updateDevice(); + } + } setBatteryStatus(); setChatmixStatus(); } @@ -503,6 +519,11 @@ void MainWindow::updateGUI() // Info Section Events void MainWindow::setBatteryStatus() { + if (selectedDevice == nullptr) { + changeTrayIconTo(":/icons/headphones-light.png"); + return; + } + QString status = selectedDevice->battery.status; int batteryLevel = selectedDevice->battery.level; QString level = QString::number(batteryLevel); @@ -517,43 +538,43 @@ void MainWindow::setBatteryStatus() if (status == "BATTERY_UNAVAILABLE") { ui->batteryPercentage->setText(tr("Headset Off")); trayIcon->setToolTip(tr("HeadsetControl \r\nHeadset Off")); - trayIconPath = ":/icons/headphones-inv.png"; + changeTrayIconTo(":/icons/headphones-light.png"); } else if (status == "BATTERY_CHARGING") { ui->batteryPercentage->setText(level + tr("% - Charging")); trayIcon->setToolTip(tr("HeadsetControl \r\nBattery Charging")); - trayIconPath = ":/icons/battery-charging-inv.png"; + changeTrayIconTo(":/icons/battery-charging-light.png"); } else if (status == "BATTERY_AVAILABLE") { ui->batteryPercentage->setText(level + tr("% - Descharging")); trayIcon->setToolTip(tr("HeadsetControl \r\nBattery: ") + level + "%"); if (level.toInt() > 75) { - trayIconPath = ":/icons/battery-level-full-inv.png"; + changeTrayIconTo(":/icons/battery-level-full-light.png"); notified = false; } else if (level.toInt() > settings.batteryLowThreshold) { - trayIconPath = ":/icons/battery-medium-inv.png"; + changeTrayIconTo(":/icons/battery-medium-light.png"); notified = false; } else { - trayIconPath = ":/icons/battery-low-inv.png"; + changeTrayIconTo(":/icons/battery-low-light.png"); if (!notified) { trayIcon->showMessage(tr("Battery Alert!"), tr("The battery of your headset is running low"), - QIcon(":/icons/battery-low-inv.png")); + QIcon(":/icons/battery-low-light.png")); notified = true; } } } else { ui->batteryPercentage->setText(tr("No battery info")); trayIcon->setToolTip("HeadsetControl"); - trayIconPath = ":/icons/headphones-inv.png"; - } - - if (!isAppDarkMode()) { - trayIconPath.replace("-inv", ""); + changeTrayIconTo(":/icons/headphones-light.png"); } - trayIcon->setIcon(QIcon(trayIconPath)); } void MainWindow::setChatmixStatus() { + if (selectedDevice == nullptr) { + ui->chatmixvalueLabel->setText(tr("None")); + return; + } + int chatmix = selectedDevice->chatmix; QString chatmixValue = QString::number(chatmix); QString chatmixStatus; diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h index 45765cf..9561836 100644 --- a/src/UI/mainwindow.h +++ b/src/UI/mainwindow.h @@ -55,7 +55,7 @@ class MainWindow : public QMainWindow int n_connected = 0, n_saved = 0; HeadsetControlAPI API; - Device *selectedDevice; + Device *selectedDevice = nullptr; QList deviceList; QList slidersEq; @@ -63,6 +63,7 @@ class MainWindow : public QMainWindow void bindEvents(); //Tray Icon Section + void changeTrayIconTo(QString iconPath); void setupTrayIcon(); //Theme mode Section diff --git a/src/UI/mainwindow.ui b/src/UI/mainwindow.ui index b5786c9..373baf9 100644 --- a/src/UI/mainwindow.ui +++ b/src/UI/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 488 - 690 + 792 @@ -24,10 +24,6 @@ HeadsetControl-GUI - - - :/icons/headphones-inv.png:/icons/headphones-inv.png - @@ -54,6 +50,83 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::LeftToRight + + + Missing headsetcontrol!<br/>Download <a href="https://github.com/Sapd/HeadsetControl/releases/latest">headsetcontrol</a> in the program folder. + + + Qt::AutoText + + + Qt::AlignCenter + + + false + + + Qt::TextBrowserInteraction + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Open Program Folder + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + @@ -1781,8 +1854,6 @@ Model: muteledbrightnessSlider micvolumeSlider - - - + diff --git a/src/Utils/headsetcontrolapi.cpp b/src/Utils/headsetcontrolapi.cpp index 368d9ec..f3447e0 100644 --- a/src/Utils/headsetcontrolapi.cpp +++ b/src/Utils/headsetcontrolapi.cpp @@ -10,52 +10,6 @@ HeadsetControlAPI::HeadsetControlAPI(QString headsetcontrolFilePath) sendCommand(QStringList()); } -// HC rleated functions -QString HeadsetControlAPI::sendCommand(const QStringList &args_list) -{ - QProcess *proc = new QProcess(); - QStringList args = QStringList() << QString("--output") << QString("JSON"); - //args << QString("--test-device"); //Uncomment this to enable all "modules" - args << args_list; - - proc->start(headsetcontrolFilePath, args); - proc->waitForFinished(); - QString output = proc->readAllStandardOutput(); - qDebug() << "Command: \t" << headsetcontrolFilePath; - qDebug() << "\tArgs: \theadsetcontrol " << args; - // qDebug() << output; - - return output; -} - -Action HeadsetControlAPI::sendAction(const QStringList &args_list) -{ - QString output = sendCommand(args_list); - QJsonDocument jsonDoc = QJsonDocument::fromJson(output.toUtf8()); - QJsonObject jsonInfo = jsonDoc.object(); - QJsonArray actions = jsonInfo["actions"].toArray(); - Action action; - if (!actions.isEmpty()) { - QJsonObject jaction = actions[0].toObject(); - - action.device = jaction["device"].toString(); - action.capability = jaction["capability"].toString(); - action.status = jaction["status"].toString(); - action.error_message = jaction["error_message"].toString(); - - action.success = action.status == "success"; - - qDebug() << "Device:\t" << action.device; - qDebug() << "Capability:" << action.capability; - qDebug() << "Status:\t" << action.status; - if (!action.success) { - qDebug() << "Error:\t" << action.error_message; - } - } - - return action; -} - QString HeadsetControlAPI::getName() { return name; @@ -104,6 +58,53 @@ QList HeadsetControlAPI::getConnectedDevices() return devices; } +// HC rleated functions +QString HeadsetControlAPI::sendCommand(const QStringList &args_list) +{ + QProcess *proc = new QProcess(); + QStringList args = QStringList() << QString("--output") << QString("JSON"); + //args << QString("--test-device"); //Uncomment this to enable all "modules" + args << args_list; + + proc->start(headsetcontrolFilePath, args); + proc->waitForFinished(); + QString output = proc->readAllStandardOutput(); + qDebug() << "Command: \t" << headsetcontrolFilePath; + qDebug() << "\tArgs: \theadsetcontrol " << args; + // qDebug() << output; + qDebug() << "Error: \t" << proc->error(); + + return output; +} + +Action HeadsetControlAPI::sendAction(const QStringList &args_list) +{ + QString output = sendCommand(args_list); + QJsonDocument jsonDoc = QJsonDocument::fromJson(output.toUtf8()); + QJsonObject jsonInfo = jsonDoc.object(); + QJsonArray actions = jsonInfo["actions"].toArray(); + Action action; + if (!actions.isEmpty()) { + QJsonObject jaction = actions[0].toObject(); + + action.device = jaction["device"].toString(); + action.capability = jaction["capability"].toString(); + action.status = jaction["status"].toString(); + action.error_message = jaction["error_message"].toString(); + + action.success = action.status == "success"; + + qDebug() << "Device:\t" << action.device; + qDebug() << "Capability:" << action.capability; + qDebug() << "Status:\t" << action.status; + if (!action.success) { + qDebug() << "Error:\t" << action.error_message; + } + } + + return action; +} + void HeadsetControlAPI::setSidetone(Device *device, int level) { QStringList args = QStringList() << QString("--sidetone") << QString::number(level); diff --git a/src/Utils/headsetcontrolapi.h b/src/Utils/headsetcontrolapi.h index 1636bd1..e7a9b55 100644 --- a/src/Utils/headsetcontrolapi.h +++ b/src/Utils/headsetcontrolapi.h @@ -3,6 +3,7 @@ #include "device.h" +#include #include #include @@ -32,6 +33,7 @@ class HeadsetControlAPI : public QObject private: QString headsetcontrolFilePath; + QFile headsetcontrol; QString name; QVersionNumber version; diff --git a/src/main.cpp b/src/main.cpp index afe6131..bc2fa93 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.3"; +const QString GUI_VERSION = "0.16.4"; int main(int argc, char *argv[]) {