From bcdfd22667cf47abc3c566be759dda3444b51544 Mon Sep 17 00:00:00 2001 From: Odizinne Date: Fri, 16 Aug 2024 20:01:58 +0200 Subject: [PATCH] Reintroduced translations --- HeadsetControl-Qt.pro | 7 +- README.md | 1 - src/HeadsetControlQt/headsetcontrolqt.cpp | 2 +- src/HeadsetControlQt/headsetcontrolqt.ui | 10 +-- src/Resources/tr/HeadsetControl-Qt_en.qm | Bin 0 -> 873 bytes src/Resources/tr/HeadsetControl-Qt_en.ts | 77 ++++++++++++++++++++++ src/Resources/tr/HeadsetControl-Qt_fr.qm | Bin 0 -> 1277 bytes src/Resources/tr/HeadsetControl-Qt_fr.ts | 77 ++++++++++++++++++++++ src/Resources/translations.qrc | 6 ++ src/main.cpp | 8 +++ 10 files changed, 180 insertions(+), 8 deletions(-) create mode 100644 src/Resources/tr/HeadsetControl-Qt_en.qm create mode 100644 src/Resources/tr/HeadsetControl-Qt_en.ts create mode 100644 src/Resources/tr/HeadsetControl-Qt_fr.qm create mode 100644 src/Resources/tr/HeadsetControl-Qt_fr.ts create mode 100644 src/Resources/translations.qrc diff --git a/HeadsetControl-Qt.pro b/HeadsetControl-Qt.pro index d20f727..936f471 100644 --- a/HeadsetControl-Qt.pro +++ b/HeadsetControl-Qt.pro @@ -27,8 +27,13 @@ HEADERS += \ FORMS += \ src/HeadsetControlQt/headsetcontrolqt.ui +TRANSLATIONS += \ + src/Resources/tr/HeadsetControl-Qt_fr.ts \ + src/Resources/tr/HeadsetControl-Qt_en.ts + RESOURCES += \ - src/Resources/resources.qrc + src/Resources/resources.qrc \ + src/Resources/translations.qrc RC_FILE = src/Resources/appicon.rc diff --git a/README.md b/README.md index ef33d1c..4a2b308 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,3 @@ Precompiled windows binaries can be found in [release](https://github.com/odizin ## To-do - Add other headsetcontrol supported settings (My headset does not support them so i cannot test) - Bring back linux support -- Bring back translations diff --git a/src/HeadsetControlQt/headsetcontrolqt.cpp b/src/HeadsetControlQt/headsetcontrolqt.cpp index 9560fb2..4e33f7f 100644 --- a/src/HeadsetControlQt/headsetcontrolqt.cpp +++ b/src/HeadsetControlQt/headsetcontrolqt.cpp @@ -28,7 +28,6 @@ HeadsetControlQt::HeadsetControlQt(QWidget *parent) ui->setupUi(this); setWindowTitle("HeadsetControl-Qt"); setWindowIcon(QIcon(":/icons/icon.png")); - setFixedSize(size()); setFont(); loadSettings(); initUI(); @@ -329,6 +328,7 @@ void HeadsetControlQt::toggleUIElements(bool show) ui->notFoundLabel->setVisible(!show); this->setMinimumSize(0, 0); this->adjustSize(); + this->setFixedSize(this->size()); } void HeadsetControlQt::onLedBoxStateChanged() diff --git a/src/HeadsetControlQt/headsetcontrolqt.ui b/src/HeadsetControlQt/headsetcontrolqt.ui index 49e3d70..6b76a46 100644 --- a/src/HeadsetControlQt/headsetcontrolqt.ui +++ b/src/HeadsetControlQt/headsetcontrolqt.ui @@ -6,7 +6,7 @@ 0 0 - 433 + 381 351 @@ -180,7 +180,7 @@ - 100 + 0 25 @@ -207,7 +207,7 @@ - Send notification when battery goes below + Send notification when battery goes below: @@ -215,7 +215,7 @@ - 100 + 0 25 @@ -295,7 +295,7 @@ - 100 + 0 25 diff --git a/src/Resources/tr/HeadsetControl-Qt_en.qm b/src/Resources/tr/HeadsetControl-Qt_en.qm new file mode 100644 index 0000000000000000000000000000000000000000..cfaf71b0273b36468e150d6432d430c749820af3 GIT binary patch literal 873 zcmcE7ks@*G{hX<16=n7(EZlo{IRgU&YieG6Xs{EIRlvZqq8mu-Fa-Vm!oa|2%upv3 z3Zz+>gde5=#m_O#`H~Lg|7Jc_H4jL4u}#rz`(SaZJmSykbi=sd(BOt zdInDOk6J(~lrzV-14u9A+09rCROiXRX5&>LU6u(X&N2T70uGRJHXvqqN-QZ!EvjS( zvIRU+6H|&)OPurbN{aGx0!tWC)v~xG7G)EoP~9c7I58=9Ko3>sU`V&M1?n7aAk2x OYA$w1fYLb=BO?G(ybJmO literal 0 HcmV?d00001 diff --git a/src/Resources/tr/HeadsetControl-Qt_en.ts b/src/Resources/tr/HeadsetControl-Qt_en.ts new file mode 100644 index 0000000..d57719a --- /dev/null +++ b/src/Resources/tr/HeadsetControl-Qt_en.ts @@ -0,0 +1,77 @@ + + + + + HeadsetControlQt + + + HeadsetControl-Qt + + + + + GroupBox + + + + + Battery + + + + + Sidetone + + + + + Lights + + + + + Disable lights when battery goes below: + + + + + Send notification when battery goes below + + + + + Settings + + + + + Icon theme + + + + + Run at startup + + + + + No supported headset found. + + + + + System + + + + + Dark + + + + + Light + + + + diff --git a/src/Resources/tr/HeadsetControl-Qt_fr.qm b/src/Resources/tr/HeadsetControl-Qt_fr.qm new file mode 100644 index 0000000000000000000000000000000000000000..970d18de750f3caf7f1c7e5b7a10a8258048947d GIT binary patch literal 1277 zcmbtTO=uHA82yqo>9&;mi&X4kyjWT=9);42X{-uWY@#O z^xdt;YoDJIQNAADoT-#>YE$2{WyC3}{M;hSyr=tzuOr^e9{K7c&SY1%8bsO6-1^-| zh{gPwFRyX`BmeUG8d2YP;l&8U{X=JY^%LsQz}d|Sg!zHs@)Gin553K3qTG`MtFJyH zeiH!Ia>zJHC34B&%PAy5+_CTip8k?+3=cc~HtQmHea+3Zk|tEaoXJ@15LHQ0i)ujr z!S$8h@OC=r29>Ex8cjVk6?7+V%qT$A#AuezBg3BNDMFScALjrkhDLiv#m&xtfjmQ# z$?#)kq1{@*Ss)rsquD}}OIGVG#2SigR^x$Mm`s`T7d}ZX=R&BWc1bP%OY)(;Or4%H zDJbwaO4q1K8(@%Q6`#gHhX+Qbr6OrRc*#?enI>=X^iqQ~9djfoOn~`WyL&pu+2J}t z6k>!ZlKm9MD|cF}>3% z3}?mnw(a4fr{$;%wp{ov#BXDl>xL_lWUgV_xS@&K>4od?mxSvSb+${}W$XeHch-^h zSO)7X5sUGEP8_dt=`*Q}s0+_E0$Qe+F@5HvbTwYu#qt}N3$NQQgE&=gjF63ebUQ{B wKn&K20A}&}f)*2voT~7-QF0%L4dZ3+KyK4BYyvG*JKFHp--lm<%d@%6Z|5Q{yZ`_I literal 0 HcmV?d00001 diff --git a/src/Resources/tr/HeadsetControl-Qt_fr.ts b/src/Resources/tr/HeadsetControl-Qt_fr.ts new file mode 100644 index 0000000..a337099 --- /dev/null +++ b/src/Resources/tr/HeadsetControl-Qt_fr.ts @@ -0,0 +1,77 @@ + + + + + HeadsetControlQt + + + HeadsetControl-Qt + + + + + GroupBox + + + + + Battery + Batterie + + + + Sidetone + Retour voix + + + + Lights + LEDs + + + + Disable lights when battery goes below: + Désactiver les LEDs quand la batterie atteint: + + + + Send notification when battery goes below + Envoyer une notification quand la batterie atteint: + + + + Settings + Paramètres + + + + Icon theme + Thème d'icones + + + + Run at startup + Lancer au démarrage + + + + No supported headset found. + Aucun casque détecté. + + + + System + Système + + + + Dark + Sombre + + + + Light + Clair + + + diff --git a/src/Resources/translations.qrc b/src/Resources/translations.qrc new file mode 100644 index 0000000..baffa68 --- /dev/null +++ b/src/Resources/translations.qrc @@ -0,0 +1,6 @@ + + + tr/HeadsetControl-Qt_en.qm + tr/HeadsetControl-Qt_fr.qm + + \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index cc10573..a8735b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,11 +1,19 @@ #include "headsetcontrolqt.h" #include +#include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle("fusion"); + QLocale locale; + QString languageCode = locale.name().section('_', 0, 0); + QTranslator translator; + if (translator.load(":/translations/tr/HeadsetControl-Qt_" + languageCode + ".qm")) { + a.installTranslator(&translator); + } HeadsetControlQt w; return a.exec(); }