From 60b03514e37a5cf21889aa1d8d422b4ea696cd25 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Fri, 7 Jun 2024 10:04:06 +0200
Subject: [PATCH 01/64] Forked version of HeadsetController-GUI
---
.gitignore | 3 +
HeadsetControl-GUI.pro.user | 268 ++++++++
mainwindow.cpp | 481 ++++++++++-----
mainwindow.h | 45 +-
mainwindow.ui | 1162 +++++++++++++++++++++++++----------
5 files changed, 1455 insertions(+), 504 deletions(-)
create mode 100644 HeadsetControl-GUI.pro.user
diff --git a/.gitignore b/.gitignore
index 259148f..f2c8bb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,6 @@
*.exe
*.out
*.app
+
+# Folders
+build/*
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
new file mode 100644
index 0000000..0c05186
--- /dev/null
+++ b/HeadsetControl-GUI.pro.user
@@ -0,0 +1,268 @@
+
+
+
+
+
+ EnvironmentId
+ {1eabfbbb-8689-4576-bded-e9daa00216f3}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 2
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 8
+ true
+
+
+
+ true
+
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop Qt 6.7.0 MinGW 64-bit
+ Desktop Qt 6.7.0 MinGW 64-bit
+ qt.qt6.670.win64_mingw_kit
+ 0
+ 0
+ 0
+
+ 0
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Release
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Profile
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ Qt4ProjectManager.Qt4RunConfiguration:C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/HeadsetControl-GUI.pro
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/HeadsetControl-GUI.pro
+ false
+ true
+ true
+ true
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 63c8394..b990a6b 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -4,21 +4,26 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
+ uix=ui;
tray->setIcon(QIcon(":/icons/headphones-inv.png"));
tray->show();
tray->setToolTip("HeadsetControl");
- QMenu *menu = new QMenu(nullptr);
+ menu = new QMenu(nullptr);
menu->addAction("Show", this, SLOT(show()));
- menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
- menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
menu->addAction("Exit", this, SLOT(close()));
tray->setContextMenu(menu);
@@ -26,66 +31,12 @@ MainWindow::MainWindow(QWidget *parent)
connect(tray, SIGNAL(DoubleClick), this, SLOT(show()));
tray->connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
- SLOT(RestoreWindowTrigger(QSystemTrayIcon::ActivationReason)));
+ SLOT(RestoreWindowTrigger(QSystemTrayIcon::ActivationReason)));
- QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList() << QString("-c?"));
-
- proc->waitForFinished();
- QByteArray strdata = proc->readAllStandardOutput();
- QString supportedParams = strdata;
- //supportedParams = "sbnlimvr"; //Uncomment this to enable all "modules"
-
- if (supportedParams == "") {
- ui->notSupportedFrame->setHidden(false);
- ui->sidetoneFrame->setHidden(true);
- ui->batteryFrame->setHidden(true);
- ui->lightFrame->setHidden(true);
- ui->inactivityFrame->setHidden(true);
- ui->voicepromptFrame->setHidden(true);
- ui->rotateFrame->setHidden(true);
- }
- else {
- ui->notSupportedFrame->setHidden(true);
-
- if (supportedParams.contains("s")){
- ui->sidetoneFrame->setHidden(false);
- qDebug() << "Sidetone supported";
- }
- else ui->sidetoneFrame->setHidden(true);
+ connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
+ connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
- if (supportedParams.contains("b")){
- ui->batteryFrame->setHidden(false);
-
- QTimer *timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(setBatteryStatus()));
- timer->start(300000);
- this->setBatteryStatus();
- qDebug() << "Battery percentage supported";
- }
- else ui->batteryFrame->setHidden(true);
-
- if (supportedParams.contains("l")){
- ui->lightFrame->setHidden(false);
- qDebug() << "Light control supported";
- }
- else ui->lightFrame->setHidden(true);
- if (supportedParams.contains("i")){
- ui->inactivityFrame->setHidden(false);
- qDebug() << "Inactivity timer supported";
- }
- else ui->inactivityFrame->setHidden(true);
- if (supportedParams.contains("v")){
- ui->voicepromptFrame->setHidden(false);
- qDebug() << "Voice prompt control supported";
- }
- else ui->voicepromptFrame->setHidden(true);
- if (supportedParams.contains("r")){
- ui->rotateFrame->setHidden(false);
- qDebug() << "Rotate to mute supported";
- }
- else ui->rotateFrame->setHidden(true);
- }
+ this->loadDevices();
}
MainWindow::~MainWindow()
@@ -93,145 +44,243 @@ MainWindow::~MainWindow()
delete ui;
}
-void MainWindow::on_onButton_clicked()
-{
- QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 1")
- << QString("-cl 1")
- );
- proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+void MainWindow::disableFrames(){
+ ui->notSupportedFrame->setHidden(false);
+ ui->deviceinfoFrame->setHidden(true);
+ ui->sidetoneFrame->setHidden(true);
+ ui->batteryFrame->setHidden(true);
+ ui->lightFrame->setHidden(true);
+ ui->inactivityFrame->setHidden(true);
+ ui->voicepromptFrame->setHidden(true);
+ ui->rotatetomuteFrame->setHidden(true);
+ ui->chatmixFrame->setHidden(true);
+ ui->equalizerFrame->setHidden(true);
+ ui->muteledbrightnessFrame->setHidden(true);
+ ui->micvolumeFrame->setHidden(true);
}
-void MainWindow::on_offButton_clicked()
-{
+void MainWindow::loadDevices(){
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 0")
- << QString("-cl 0")
- );
- proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
-}
+ QStringList args=QStringList() << QString("--output") << QString("JSON");
+ //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
-void MainWindow::on_voiceOnButton_clicked()
-{
- QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 1")
- << QString("-cv 1")
- );
+ proc->start("headsetcontrol.exe", args);
proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->arguments();
+
+ QString strdata = proc->readAllStandardOutput();
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(strdata.toUtf8());
+ QJsonObject jsonInfo=jsonDoc.object();
+
+ if(!jsonDoc.isNull()){
+ deviceList=jsonInfo["devices"].toArray();
+ this->loadFeatures();
+ }else {
+ this->disableFrames();
+ }
}
-void MainWindow::on_voiceOffButton_clicked()
-{
- QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 0")
- << QString("-cv 0")
- );
- proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+void MainWindow::loadFeatures(int deviceIndex){
+ if(deviceIndex<0) return;
+ Ui::MainWindow *ui=uix;
+
+ usingDevice=deviceList[deviceIndex].toObject();
+ QJsonArray caps=usingDevice["capabilities"].toArray();
+ for (const QJsonValue &value : caps) {
+ capabilities.insert(value.toString());
+ qDebug()<notSupportedFrame->setHidden(true);
+
+ QString device, vendor, product;
+ device=usingDevice["device"].toString();
+ vendor=usingDevice["vendor"].toString();
+ product=usingDevice["product"].toString();
+ ui->deviceinfovalueLabel->setText("Device: "+device+"\r\nVendor: "+vendor+"\r\nProduct: "+product);
+ ui->deviceinfoFrame->setHidden(false);
+ if (capabilities.contains("CAP_SIDETONE")){
+ ui->sidetoneFrame->setHidden(false);
+ qDebug() << "Sidetone supported";
+ }
+ else ui->sidetoneFrame->setHidden(true);
+ if (capabilities.contains("CAP_BATTERY_STATUS")){
+ ui->batteryFrame->setHidden(false);
+
+ QTimer *timerBattery = new QTimer(this);
+ connect(timerBattery, SIGNAL(timeout()), this, SLOT(setBatteryStatus()));
+ timerBattery->start(300000);
+ this->setBatteryStatus();
+ qDebug() << "Battery percentage supported";
+ }
+ else ui->batteryFrame->setHidden(true);
+ if (capabilities.contains("CAP_LIGHTS")){
+ ui->lightFrame->setHidden(false);
+ menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
+ menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
+ qDebug() << "Light control supported";
+ }
+ else ui->lightFrame->setHidden(true);
+ if (capabilities.contains("CAP_INACTIVE_TIME")){
+ ui->inactivityFrame->setHidden(false);
+ qDebug() << "Inactivity timer supported";
+ }
+ else ui->inactivityFrame->setHidden(true);
+ if (capabilities.contains("CAP_VOICE_PROMPTS")){
+ ui->voicepromptFrame->setHidden(false);
+ qDebug() << "Voice prompt control supported";
+ }
+ else ui->voicepromptFrame->setHidden(true);
+ if (capabilities.contains("CAP_ROTATE_TO_MUTE")){
+ ui->rotatetomuteFrame->setHidden(false);
+ qDebug() << "Rotate to mute supported";
+ }
+ else ui->rotatetomuteFrame->setHidden(true);
+ if (capabilities.contains("CAP_CHATMIX_STATUS")){
+ ui->chatmixFrame->setHidden(false);
+
+ QTimer *timerChatmix = new QTimer(this);
+ connect(timerChatmix, SIGNAL(timeout()), this, SLOT(setChatmixStatus()));
+ timerChatmix->start(300000);
+ this->setChatmixStatus();
+ qDebug() << "Chatmix supported";
+ }
+ else ui->chatmixFrame->setHidden(true);
+ if (capabilities.contains("CAP_EQUALIZER")){
+ ui->equalizerFrame->setHidden(false);
+ int n=10;
+ int max=10;
+ int min=-10;
+ QHBoxLayout *mainLayout = ui->equalizerLayout;
+
+ for (int var = 0; var < n; ++var) {
+ QVBoxLayout *lb = new QVBoxLayout();
+ QSlider *s = new QSlider(Qt::Vertical);
+ s->setMaximum(max);
+ s->setMinimum(min);
+ s->setValue((max+min)/2);
+ s->setTickInterval(max/2);
+ s->setTickPosition(QSlider::TicksBothSides);
+ QLabel *l = new QLabel(QString::number(var));
+ l->setFixedSize(30, 20);
+ l->setStyleSheet("QLabel {\nmin-width: 30px;\nmax-width: 30px;\n}");
+ l->setAlignment(Qt::AlignHCenter);
+
+ lb->addWidget(l);
+ lb->addWidget(s);
+
+ slidersEq.append(s);
+ mainLayout->addLayout(lb);
+ }
+ qDebug() << "Equalizer supported";
+ }
+ else ui->equalizerFrame->setHidden(true);
+ if (capabilities.contains("CAP_MICROPHONE_MUTE_LED_BRIGHTNESS")){
+ ui->muteledbrightnessFrame->setHidden(false);
+ qDebug() << "Muted led brightness supported";
+ }
+ else ui->muteledbrightnessFrame->setHidden(true);
+ if (capabilities.contains("CAP_MICROPHONE_VOLUME")){
+ ui->micvolumeFrame->setHidden(false);
+ qDebug() << "Microphone volume supported";
+ }
+ else ui->micvolumeFrame->setHidden(true);
}
-void MainWindow::on_sideToneApply_clicked()
+void MainWindow::on_onButton_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 1")
- << QString("-s" + QString::number(ui->sidetoneSlider->sliderPosition()))
- );
+ QStringList args=QStringList() << QString("--light") << QString("1");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
-void MainWindow::on_sideToneOff_clicked()
+void MainWindow::on_offButton_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 0")
- << QString("-s 0")
- );
+ QStringList args=QStringList() << QString("--light") << QString("0");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- ui->sidetoneSlider->setValue(0);
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
-void MainWindow::on_inactivityOffButton_clicked()
+void MainWindow::on_voiceOnButton_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 0")
- << QString("-i 0")
- );
+ QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- ui->sidetoneSlider->setValue(0);
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
-void MainWindow::on_inactivityApplyButton_clicked()
+void MainWindow::on_voiceOffButton_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 1")
- << QString("-i" + QString::number(ui->inactivitySlider->sliderPosition()))
- );
+ QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
void MainWindow::on_rotateOn_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 1")
- << QString("-r 1")
- );
+ QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
void MainWindow::on_rotateOff_clicked()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-n 0")
- << QString("-r 0")
- );
+ QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
}
void MainWindow::setBatteryStatus()
{
QProcess *proc = new QProcess();
- proc->start("headsetcontrol", QStringList()
- << QString("-cb")
- );
+ QStringList args=QStringList() << QString("--battery");
+ proc->start("headsetcontrol", args);
proc->waitForFinished();
QString batteryStatus = proc->readAllStandardOutput();
- //qDebug() << proc->readAllStandardError();
+ qDebug() << proc->readAllStandardError();
+
+ QStringList lines = batteryStatus.split("\n");
+
+ // Extract the status value
+ QString statusLine = lines[3];
+ QStringList statusParts = statusLine.split(": ");
+ QString status = statusParts[1].trimmed();
- if (batteryStatus == "-2"){
+ // Extract the level value
+ QString levelLine = lines[4];
+ QStringList levelParts = levelLine.split(": ");
+ QString level = levelParts[1].trimmed();
+ level.remove("%");
+
+ if (status == "BATTERY_UNAVAILABLE"){
ui->batteryPercentage->setText("Headset Off");
tray->setToolTip("HeadsetControl \r\nHeadset Off");
+ tray->setIcon(QIcon(":/icons/headphones-inv.png"));
}
- else if (batteryStatus == "-1") {
- ui->batteryPercentage->setText("Headset Charging");
+ else if (status == "BATTERY_CHARGING") {
+ ui->batteryPercentage->setText("Headset Charging "+level+"%");
tray->setToolTip("HeadsetControl \r\nBattery Charging");
tray->setIcon(QIcon(":/icons/battery-charging-inv.png"));
}
else {
- ui->batteryPercentage->setText(batteryStatus);
- tray->setToolTip("HeadsetControl \r\nBattery: " + batteryStatus + "%");
- if (batteryStatus.toInt() >= 70){
+ ui->batteryPercentage->setText(level + "%");
+ tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
+ if (level.toInt() >= 70){
tray->setIcon(QIcon(":/icons/battery-level-full-inv.png"));
notified = false;
}
- else if (batteryStatus.toInt() >= 30) {
+ else if (level.toInt() >= 30) {
tray->setIcon(QIcon(":/icons/battery-medium-inv.png"));
notified = false;
}
@@ -245,24 +294,142 @@ void MainWindow::setBatteryStatus()
}
}
+void MainWindow::on_sidetoneSlider_valueChanged(){
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::on_inactivitySlider_valueChanged(){
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::setChatmixStatus(){
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--chatmix");
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ QString chatmixStatus = proc->readAllStandardOutput();
+ int value=chatmixStatus.mid(chatmixStatus.indexOf(':')+1).toInt();
+ ui->chatmixvalueLabel->setText(QString::number(value));
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
+ int preset=ui->equalizerPresetcomboBox->currentIndex()-1;
+ if(preset>=0 && preset<=3){
+ int flat[]={0,0,0,0,0,0,0,0,0,0};
+ this->setSliders(flat);
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--equalizer-preset") << QString::number(preset);
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+ }
+}
+
+void MainWindow::on_applyEqualizer_clicked(){
+ uix->equalizerPresetcomboBox->setCurrentIndex(0);
+ QString s="";
+ for (QSlider* slider : slidersEq) {
+ s+= QString::number(slider->value())+",";
+ }
+ s.removeLast();
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--equalizer") << s;
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::on_muteledbrightnessSlider_valueChanged(){
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::on_micvolumeSlider_valueChanged(){
+
+ QProcess *proc = new QProcess();
+ QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ qDebug() << proc->readAllStandardError();
+}
+
+void MainWindow::setSliders(int values[]){
+ int i=0;
+ for (QSlider* slider : slidersEq) {
+ slider->setValue(values[i++]);
+ }
+}
+
+void MainWindow::showAbout(){
+
+}
+
+void MainWindow::showCredits(){
+ QDialog dialog;
+ dialog.setWindowTitle("Program Credits");
+ dialog.setWindowIcon(QIcon(":/icons/headphones-inv.png"));
+
+ // Create a layout for the dialog
+ QVBoxLayout *layout = new QVBoxLayout;
+
+ // Add a label to display information
+ QLabel *infoLabel = new QLabel("Big shout-out to:");
+ QLabel *l1=new QLabel(" - Sapd for HeadsetCoontrol");
+ l1->setTextFormat(Qt::RichText);
+ l1->setOpenExternalLinks(true);
+ l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ QLabel *l2=new QLabel(" - LeoKlaus for HeadsetControl-GUI");
+ l2->setTextFormat(Qt::RichText);
+ l2->setOpenExternalLinks(true);
+ l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
+
+ layout->addWidget(infoLabel);
+ layout->addWidget(l1);
+ layout->addWidget(l2);
+
+ // Add a button to close the dialog
+ QPushButton *closeButton = new QPushButton("Close");
+ QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
+ layout->addWidget(closeButton);
+
+ // Set the layout for the dialog
+ dialog.setLayout(layout);
+
+ // Show the dialog
+ dialog.exec();
+
+}
+
void MainWindow::changeEvent(QEvent* e)
{
switch (e->type())
{
- case QEvent::LanguageChange:
- this->ui->retranslateUi(this);
- break;
- case QEvent::WindowStateChange:
- {
- if (this->windowState() & Qt::WindowMinimized)
- {
- QTimer::singleShot(0, this, SLOT(hide()));
- }
-
- break;
- }
- default:
- break;
+ case QEvent::LanguageChange:
+ this->ui->retranslateUi(this);
+ break;
+ case QEvent::WindowStateChange:
+ {
+ if (this->windowState() & Qt::WindowMinimized)
+ {
+ QTimer::singleShot(0, this, SLOT(hide()));
+ }
+
+ break;
+ }
+ default:
+ break;
}
QMainWindow::changeEvent(e);
diff --git a/mainwindow.h b/mainwindow.h
index 8570f53..cb14773 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -3,6 +3,9 @@
#include
#include
+#include
+#include
+#include
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@@ -19,11 +22,27 @@ class MainWindow : public QMainWindow
bool notified = false;
QSystemTrayIcon *tray = new QSystemTrayIcon(this);
+private:
+ QMenu *menu;
+ Ui::MainWindow *uix;
+
+ QJsonArray deviceList;
+ QVector actionList;
+ QJsonObject usingDevice;
+ QSet capabilities;
+ QVector slidersEq;
+
private slots:
void changeEvent(QEvent *e);
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
+ void loadDevices();
+
+ void disableFrames();
+
+ void loadFeatures(int deviceIndex=0);
+
void on_onButton_clicked();
void on_offButton_clicked();
@@ -32,19 +51,31 @@ private slots:
void on_voiceOffButton_clicked();
- void on_sideToneApply_clicked();
+ void on_rotateOn_clicked();
+
+ void on_rotateOff_clicked();
+
+ void setBatteryStatus();
- void on_sideToneOff_clicked();
+ void on_sidetoneSlider_valueChanged();
- void on_inactivityOffButton_clicked();
+ void on_inactivitySlider_valueChanged();
- void on_inactivityApplyButton_clicked();
+ void setChatmixStatus();
- void on_rotateOn_clicked();
+ void on_equalizerPresetcomboBox_currentIndexChanged();
- void on_rotateOff_clicked();
+ void on_applyEqualizer_clicked();
- void setBatteryStatus();
+ void setSliders(int values[]);
+
+ void on_muteledbrightnessSlider_valueChanged();
+
+ void on_micvolumeSlider_valueChanged();
+
+ void showAbout();
+
+ void showCredits();
private:
Ui::MainWindow *ui;
diff --git a/mainwindow.ui b/mainwindow.ui
index 2224440..0d90fec 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,16 +6,22 @@
0
0
- 510
- 647
+ 529
+ 508
-
+
0
0
+
+
+ 0
+ 450
+
+
HeadsetControl - GUI
@@ -86,6 +92,12 @@ max-width: 400px;
-
+
+
+ 0
+ 0
+
+
400
@@ -110,93 +122,78 @@ max-width: 400px;
-
-
-
- true
-
+
-
+
0
0
-
-
+
+
+ 16777215
+ 150
+
-
-
- 6
-
-
- 9
-
-
- 9
-
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
-
-
+
-
+
0
0
-
-
- 120
- 0
-
-
-
-
- 120
- 16777215
-
-
- Battery:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+ Device info:
-
-
-
- true
-
+
0
0
+
+
+ 300
+ 0
+
+
- 200
+ 300
16777215
QLabel {
-min-width: 200px;
-max-width: 200px;
+min-width: 300px;
+max-width: 300px;
}
- No compatible Device found!
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+ No info of the device
-
-
+
Qt::Horizontal
+
+ QSizePolicy::Expanding
+
40
@@ -209,16 +206,49 @@ max-width: 200px;
-
-
+
+
+ true
+
-
+
0
0
-
+
+
+ 16777215
+ 50
+
+
+
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ 6
+
+
+ 9
+
+
+ 9
+
-
-
+
+
+
+ 0
+ 0
+
+
120
@@ -232,28 +262,46 @@ max-width: 200px;
- Lights:
+ Battery:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
- 120
- 0
+ 200
+ 16777215
+
+ QLabel {
+min-width: 200px;
+max-width: 200px;
+}
+
- RGB ON
+ No compatible Device found!
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
+
Qt::Horizontal
@@ -265,118 +313,76 @@ max-width: 200px;
- -
-
-
-
- 120
- 0
-
-
-
- RGB OFF
-
-
-
-
-
+
-
+
0
0
-
-
-
-
-
-
- 120
- 0
-
-
-
- Sidetone Level:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
- QLayout::SetDefaultConstraint
-
-
-
-
-
- false
-
-
- Drag to adjust Sidetone Level
-
-
- 128
-
-
- 16
-
-
- Qt::Horizontal
-
-
- QSlider::TicksBelow
-
-
- 16
-
-
-
- -
-
+
+ QTabWidget::North
+
+
+ 0
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ Other
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
-
-
-
- Quiet
+
+
+
+ 0
+ 0
+
-
-
- -
-
-
- Qt::Horizontal
-
-
+
- 40
- 20
+ 120
+ 0
-
-
- -
-
-
- Qt::LeftToRight
+
+
+ 120
+ 16777215
+
- Loud
+ Lights:
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
- -
-
-
-
+
120
@@ -384,12 +390,12 @@ max-width: 200px;
- Off
+ RGB OFF
-
-
+
Qt::Horizontal
@@ -402,7 +408,7 @@ max-width: 200px;
-
-
+
120
@@ -410,54 +416,30 @@ max-width: 200px;
- Apply
+ RGB ON
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
- 120
- 10
-
-
-
-
- 120
- 16777215
-
-
-
- Voice Prompts:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
-
+
+
+
+ 0
+ 0
+
+
120
@@ -465,25 +447,185 @@ max-width: 200px;
- Voice On
+ Sidetone Level:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- Qt::Horizontal
+
+
+ QLayout::SetDefaultConstraint
-
+
-
+
+
+ false
+
+
+ Drag to adjust Sidetone Level
+
+
+ 128
+
+
+ 16
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 16
+
+
+
+ -
+
+
-
+
+
+ Quiet (Off)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ Loud
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
- 40
- 20
+ 120
+ 10
-
+
+
+ 120
+ 16777215
+
+
+
+ Voice Prompts:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
-
-
+
+
-
+
+
+
+ 120
+ 0
+
+
+
+ Voice Off
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 120
+ 0
+
+
+
+ Voice On
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
-
+
+
+
+ 0
+ 0
+
+
120
@@ -491,114 +633,273 @@ max-width: 200px;
- Voice Off
+ Inactivity Timer:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ -
+
+
-
+
+
+ 1
+
+
+ 90
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
+ 0 Minute (Off)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ 90 Minutes
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
- 120
- 0
-
-
-
- Inactivity Timer:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
-
-
-
- 1
-
-
- 90
-
-
- Qt::Horizontal
-
-
- QSlider::TicksBelow
-
-
- 10
-
-
-
- -
-
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
-
-
+
+
+
+ 0
+ 0
+
+
- 1 Minute
+ Chatmix:
-
-
+
+
+
+ 0
+ 0
+
+
+
+ None
+
+
+
+ -
+
Qt::Horizontal
- 40
+ 217
20
+
+
+
+
+
+
+
+ Equalizer
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
-
-
+
- 90 Minutes
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Equalizer preset:
-
-
- -
-
-
-
-
+
+
-
+
+ -
+
+
+ -
+
+ Flat
+
+
+ -
+
+ Bass
+
+
+ -
+
+ Smiley
+
+
+ -
+
+ Focus
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+ Equalizer:
+
+
+
+ -
+
+
+ -
+
+
120
- 0
+ 30
- Off
+ Apply Equalizer
+
+
+
+
+
+
+
+ Microphone
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Rotate to mute:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Rotate-to-Mute Off
+
+
+
+ -
+
Qt::Horizontal
@@ -611,77 +912,258 @@ max-width: 200px;
-
-
-
-
- 120
- 0
-
+
+
+ Rotate-to-Mute On
+
+
+
+
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
- Apply
+ Muted led brightness:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ true
+ -
+
+
-
+
+
+ 3
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 1
+
+
+
+ -
+
+
-
+
+
+ Low (Off)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- Rotate to mute:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
- Rotate-to-Mute On
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Rotate-to-Mute Off
-
-
-
-
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Microphone volume:
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ 128
+
+
+ 16
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 16
+
+
+
+ -
+
+
-
+
+
+ Quiet
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Loud
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ Auto Startup
+
+
+
+
+ Check Updates
+
+
+
+
+ About
+
+
+
+
+ Credits
+
+
+
+ offButton
+ onButton
+ sidetoneSlider
+ voiceOffButton
+ inactivitySlider
+ equalizerPresetcomboBox
+ applyEqualizer
+ rotateOff
+ rotateOn
+ muteledbrightnessSlider
+ micvolumeSlider
+
From 0a0cf836e0974f3a157c681c8095c174081fc991 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 13:28:30 +0200
Subject: [PATCH 02/64] Done some stuff
---
HeadsetControl-GUI.pro | 9 +-
HeadsetControl-GUI.pro.user | 24 ++---
ghTools.cpp | 33 ++++++
ghTools.h | 8 ++
headphones-exe.ico | Bin 0 -> 255038 bytes
mainwindow.cpp | 201 +++++++++++++++++++-----------------
mainwindow.h | 18 +++-
mainwindow.ui | 26 +++--
myapp.rc | 1 +
9 files changed, 197 insertions(+), 123 deletions(-)
create mode 100644 ghTools.cpp
create mode 100644 ghTools.h
create mode 100644 headphones-exe.ico
create mode 100644 myapp.rc
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 3c39a7e..d3d5da8 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -1,4 +1,5 @@
-QT += core gui
+QT += core gui
+QT += core network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -9,10 +10,12 @@ CONFIG += c++11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
+ ghTools.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
+ ghTools.h \
mainwindow.h
FORMS += \
@@ -28,3 +31,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
RESOURCES += \
icons.qrc
+
+DISTFILES += \
+ headphones-exe.ico \
+ myapp.rc
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index 0c05186..f0137b9 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -92,7 +92,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 0
+ 2
0
0
@@ -136,13 +136,14 @@
2
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Release
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
+ 0
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Profile
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Profile
true
QtProjectManager.QMakeBuildStep
- false
+ true
@@ -170,15 +171,15 @@
false
- Release
+ Profile
Qt4ProjectManager.Qt4BuildConfiguration
0
0
+ 0
- 0
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Profile
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Profile
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Release
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
true
@@ -211,11 +212,10 @@
false
- Profile
+ Release
Qt4ProjectManager.Qt4BuildConfiguration
0
0
- 0
3
@@ -248,7 +248,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
1
diff --git a/ghTools.cpp b/ghTools.cpp
new file mode 100644
index 0000000..901c5f1
--- /dev/null
+++ b/ghTools.cpp
@@ -0,0 +1,33 @@
+#include "ghTools.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo)
+{
+ QEventLoop loop;
+ QNetworkAccessManager manager;
+ QNetworkRequest request(QUrl(QString("https://api.github.com/repos/%1/%2/releases/latest").arg(owner, repo)));
+ request.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0");
+
+ QNetworkReply *reply = manager.get(request);
+ QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
+ loop.exec();
+
+ if (reply->error() == QNetworkReply::NoError) {
+ QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
+ QJsonObject jsonObj = doc.object();
+ QString latestVersion = jsonObj.value("tag_name").toString();
+ reply->deleteLater();
+ return latestVersion;
+ } else {
+ qDebug() << "Error:" << reply->errorString();
+ reply->deleteLater();
+ return QString();
+ }
+}
diff --git a/ghTools.h b/ghTools.h
new file mode 100644
index 0000000..6eb1596
--- /dev/null
+++ b/ghTools.h
@@ -0,0 +1,8 @@
+#ifndef GHTOOLS_H
+#define GHTOOLS_H
+
+#include
+
+QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo);
+
+#endif // GHTOOLS_H
diff --git a/headphones-exe.ico b/headphones-exe.ico
new file mode 100644
index 0000000000000000000000000000000000000000..1b7b6229789e5efad02e47b82dcc1c410fe46098
GIT binary patch
literal 255038
zcmeI5d$24;eaFw`65jHDqq!&$5VR`cSt(;3MXa&}sY;cC<_|$6r3ID-CB6{P2^E0?
z#DEb6BvBM&N`qP$5Rl465FsSu1A>a-9(fByUh+^t^7+no&zaqw+1)*7tVr
zbWiuMzy15pqi1%{+}tYuJvKMT|GUoZbdcTFzK|-1mIDbQ98}!4=>E@COjf6hG}DremIpdr+2!
zeT>{s=I_B4z;s+u40*0eUk3gOJPyh*({M#|n%4~zT7`xcH_w7o!3Mx|oHrQ}w|S09
zUka`QWtwR?;@pKc#l%*nVa1Tn14p<%LtVA{0Sq{f*C#y}lx?QrfVqiXmC3DA!-}PA
z!8YpGtULz9FW3j%3(7XraD=I3l9KDwymVCauD<4=D*Fu`X^m@?TUIs&1LD@Bb~Owkqo#wZK8%hjBk0SU_$?^1Nso`F;gPCnS0TZmSZSh$CyBFPh5U9v&siS^
zsOG`npdlIob{Ky)~)UWp=KJ6
zq>DB+Ly&Y$!;1SGfUZMZq2sKd19bXmjFgWe6%_pvn2M$LuyiF9|MFQl7;uYwq68Xm)Y7mEp;S*<`pnFS3?A9~N}P&eLs$acMYA4p#Z^sZSfGY!`|v-NaN@XU&arIVY%Zf?xA5bpaX
z)jjZyAf}myYnj!0J0*Z-NyF01g&=(=vr6_I*W!BvP{wbjn1-vI(1!Ho;;M_!hZ$O~
z>3cs%0%@tzS@3<5>N)TuAhwx?E1l71bVd-(+Id*I(KWTMWh>LM?~8P6pyyp>m}$5f
zvZ~Yz0%;aCEd87Vbp26@j$J=m7e4{$cU#La({QEgX+~!R(yVG&>(u&Qed!wZeUR#V
z&OZZXnQ6EgvZ~Yzf@xMYEFE16Hgg=5#=C2OeNvtK%QVw)X|veeh6$)y)^O?TTaI6G
zd?1MVESTno%rx9wsg>p#Q83FImI(BovVQMIJVfW&wX1WmexIOhGYvFb%guc2T`_aW+fu
zcqrBfE&92b4w7qg(yGqE8k1=_syf=yn2WVp*RbM0>bcnQs&nvX)p$i_8g7T|qIyYe
z*|l^}VEX=_e&04Ze@;WPZ-eyZ;8&n3GYwBOaV_1K;4%#_E9^UD_4iPwnoY;4-pM){
zO#0i
zWTxSMrRo0lqmGxL3HJMt9ta);RhwxzXvVrxnIJO_4=YW-k+ZG12{Ff|*0N3qb(m>5
zWWqX9mq0TO536lOYg>-X9Y}vX++-zNOv4?~WymmG+}S%G!xB56O%tzeIUaR9)Vj8g
z0d<&ZI3)NxQkOup^Kib}me@S;-+9UKSmk?JgPxm)JEF^wVPs-Y=bb97iE)-UZoRja
z{H-t2K1%hu0NbuJZ6*Y4~2{7xW^dmK&v
z6QHi^Xu7uVJVX;liyC6yO~Z=*eAC|%{TuKOAgxNb((k{5=YY;JSv=3@I?c|*Ez({r
zR|z=N@MzWPdx>7B(yjFSwb8rOR%#lKC5#reL$sNO!z3sDnuaIm%777*iqZWFmR4NouAku4Atrr|Nd7$}aV;jh!~
zF5s&J?N9U3G(0leyIDxUn1;ht6HCKa(e0*SH*iy!3x%~!!`+nW$Wajurr|D=2&AI9vSW3EOar{)$_2{
z+NBM}b}Wmf;dMB)Gw>Q#x;eNAtkg`y-IVFbQ4uU%Jr7^T*tU1$TOf^Pu{5mv-xq^q
zev~@wN_q`giJ68+Mte6436w5sSnIrdy0K||3m}%2qG3fB4to44`Ttsh!=~YG%5>zY
zT-$Ff)&z6XcafOLM8&tRUs#u8$t;grqU$q*olo33d15ytXX
zHzu!#_4s@qh-I-f{16W93;KdhpEEd&{JmgOGY$8#IU64cj;?4}&t;AW>$@>|EyO-P
z#nkWt@^#P#{6Cz}lj_(sJV@pYe0K2?JI-mg(8`FjC+Y2DKx@#6b~SY_FHK(vVp-`L
z&iL-fp!4x0*VSckJ1uX&r-5U@45+D|A&OhjW(`ZfCxeaLSW+V0=S@iUZgMP(rQwHh
z=pc~#JD5>f1_zVB4U96=@F0mZ@R@*Uvxc9-|6KiQ>fG3*;Y&d*i=|<`KlTPNGRjn*
z!G7eg1b+Z|W*Q#JW;Y87gtlr}=dt&LjolcACdh5yl=NF5mc`Pr?%xjuLw*l#P@N36
zBd_L5PvspO|xOj;D
z9t6!6+NAevdQK$$30jx(v6`flu;KREiS!N-%VKHxSsXeROfrT#A#W22gPbEfFukqzs}^GvF1o_B%!Kv`C`
zh7VvMP1W!z_*RF8^PbzqnD3`)MAtl@0egUCY)Z|_XCTA3bo?5i_Xl)NE_$zzq7|9q
zr~CoYgZcq_Cpqt(CN{6gVxEW3!vj4NsDux7qQ1bZz+z;4g!YaEdx7gbZLIw
zSPmtPx!xXA!=J;qN;TX!+4jL0XgC8-!+IyVsT#fz-;(RjhEr+o83VO2;52+RsoqVF
zWiijgdWST52dx%@tW#s4;S8V;-TNH_^lox2i>cvn;MAs|;Y^x)#y~v`NE@IG4eR_F
z!?gBq=iz$7!+LE21L&g+4NJcl#Sk!Un1)*rN9JOE3^)zz*;veH+|uu-Kn&CGi`cbv
zeIa5!H=F_Vq4RL;_X?%ovq22Ijz;u5BMoQL+%pF1VL;jdCxMtI{p$CuV%Uu|vJI$*
zAnVl_XfOlPg~I}AOp|^;3Z9G5=+9|mN6=s<%{6179tNZfhqFjynRF}tz5_fNq0zf&
zV;4{lN!F_|&|n6n3!wKH^-gjulWwKozXXp)XjH%Pr|$?fm`QWZ7^sH<=>lvBz64^K
zbSwSpdmH*r*R=L94d{DS^^jz}8UqbxK)L{%gR4L+lWwKomw~$@G^+Qw4+RZo(p)nJ
z>R~{-0NaC@ze_9KO27Jzw>!YJrguQ~9$7skS+B-GgBg%6z|LSDh-K2P^s8sOS4V0z
z`Ar1cYA~DTnlVs41JVT0dXd(RVwrR+{cZ#GayZXw*mc5TP%}qlXE7iu7P9NH8ipXsGcP2(HLkb
z1JZ-TM@VB@dhbf3M}VgyH2%M|u@h)0o931=P(1_EgG0=Bw4_(**0;Ss`G>%?_5cm+
z1F9#=dNc+a%7F9$bl>_F5X+=j>DFsle*@;u2#wn_;)ceNxm6znPG{SZ-V#A$z6t47
zy7d~4_5R57w0WFww?5XaXJeo_3^+aPMH=(DlHT`{ZoP(;>bt}-?2|N-wA&mO%@bpw
zJ_ei~4knH9y#%jO={2ig<=+cp{6)9A+1_K$L#nKl|COTDn>ABM7=Sd#{
z(^`6+-V7Ga3uB-@1`v}!SDrnsurm8gr}H2knDQXjy4FzpX-AeZ24;)_r>)INW4+Hz
zQ_1>svYzGX%=Dw{;Au_kTE~O*Jn#Fl)EJmG2AmFFPI@nhWkdI?H0;m!XGZG8*0p9W
zSZ%yR3}kercQHzN$I^G2=}UjFGe%#!ZqW6E@4`}JVCERe=;|c$u}u1uPKT~@-L_cg
zd|fxFt(luQ8?Z6p8E~4?cYtEPpH-+W*I%rA@4{n+AD^YhK-U>?n%af*4iL)rYokyp&>u6w0V3TSL%p3!Xdxz6W
zW7*j2TRKv|dxCXfTGQ`b9sulIJaZ9j19ow*d(-cNShkLaq|ZWvRR&_-gP-8qEbP+?
zjDfB(;A5Wj72rM)%d|EoeHK!tGKcq)#&~ynY@dbBSb;InQU*%U5ls%iBb`T2rf(fT
z?$?e}+B)`6&i$l$UD`HdpmPi;)`8BK{{mu}&gatQ*n3k~XA{zIf@$sdG?4t}G->DN
z$_8W%3^JfNchL8RWBly}nn~~iR{>Nv!@p1y?kbW9rR%QhGTU1K1lpT8#m
zEQn#cubp^piMn3Hv970=XmfAhZrA3_#$ya*8E|nP>pGU^61$)OC%TUIzEEE}mLJ~&
z)0&PUI;SVc2H%IJ#z5B?@G(xR->UmHh-K2D^f)nPs_PKzdO-KqK|W0EtW`7y8p1$E
zHz$*i@mz;ylIwBlFz6iU>yz#Y)`4m5K^iy^1o_dBsWCTr~qr22k<
z){tYFbSM3-c<9>KLC>aQ+@pVwcDC~EuGlf#(HLkD11_Fdk)8o!ne-;zO?A%m`;+Q7
zIqn40n*PqyTfkI)HE8AH+Py=vmihuHC78
zvz?8Bx*70sOd9if63r#&bm?yDA*u}rUF$yprnSdt;7!2J#Z%9YHBcu5K88vE1l$f{
znRF(-Mbn6DOY7SgfEacujo7)k&H%K&r)Gc{_UE_Q=V0kC_q
zlP)Iuj$tTiwCj&Mx|fY{F4ns&NBVX{{jvJSKwS*@m?hmCtOK#E)az56^cvQEY^-zf
z4YakLZ@aEJv3`w#Ng435O1c`H17cd~*QPk@bsXzltl#-K0Yq6tpL8Cqo-wde1~MAZ
z-voac#IjP)!G63r>ovSF`HLet|1;Xr^YNr@-xB|qquhCd?A52>6
z(AB;aL
zerj3MrC&d;9m)Ry#4xS%9ReypCe2n<+Gr8S!Op{(}f5!zVD|mEp76w;hAG#
zOsu`1@@GIy)3aIWCW+}f3HLsb{u#If#IPr6*T=t
zZYKlT_;GnXYtegye+>2oT5Eb6xEI7U=|p;|UB7k)_&)d<_z}1Y
zd=colxIfqgq&imK%orHQz(CAsJxTX&M*;nYVZWvm{r3D3U<;7?F>Vg6e0CYg#tC_SZ&2&P{{v#3duVE;NgvWlqcp6D@IH|q
z1nve^*;90M8Bo8;8a?Uk2C0p_kO9SogYL(4jr>y(^Lv9dH`1gF#cAX8E7H7Qq|#9t
zYXCGm(!|fZf$nJ<$x&f&SwZOx_?RHonu^{-cpOw|S`(8l8hxI@Kdt&jI?a^Q!F&bSPak{`}&7B;6g{45~Ki_yeF3>-LQg@Qyo3
z9QgA}o%)pyq=&}q*N21ml~n6ZRbR8v=jSjM@8U>FhAT{5L_riht>#HTqSA
zcz;Q?c5oWdd!bdEo-wO$9e-1wW+#GYccj_*Cch;(7u0e6thiSUrtdVgX;$#t>t-AB
zS~sr4G;bGx9f0?zO*ERXfed8lnf$Kc5>UrEgl?0#SNtcj7dVtgRQJAoUFfpT=A{BQC#H#*k`;{Of_f>tC1Y7;-RZ^xA&;v(n8T
znAdEq9l+-sKwYMF)i;3Dr#7>m8OL7a?+10-eRQs8bma^d``Kv+VR~IJ9jYZr(4eB;MYyUjh4fwh50?jiwhV1;2*KzqoQ0KKC-6y8|@8dxy
zH0;Mg`Z3TX)BVcpKzeOWe&%%0)&Xm-GSIWvF902%n_{QnNY^xcR#V8$_@VDjd>rWe
zW@${cHLhpD@9aF0*E1VEd(}G>O|$cGXg$#SY0(&f?o;%=t|pq^dH*iZdRO|6Ci&KL
z-?af~PBPH*!qY$-0@LSW~obVy7nd
z;&-dDfR_V3pKX)rc>g(|cLwZUIeusiwFu8y?P|^HFmMH^>UTEiYHIr>E$jk@#@E&j
z8Vk^GUwsp_(eB0RPlNq|X}N?zgx9Qg*XQ$rKZ8yc2
zz7KUM==(iBJ~w_o>UK~Z4M5ju2Z1(g7xxqUI{znsgS2j*WB1Rv{Jb4OzNydjl1T{o
z?+NN&3623f0YAnxjm=|Q+sosIZTeoG;z9RVZCGo@&5?FDr8*WR^WWCFD)QTpi&X0r
zdN$wWXM4C8WV%222{;pIJ#uT1>e%OtxasnCKlV(zA^Cm43E=ynEzc@&b)@M%&-a7$
z-Q6zEE93KVt>f=ypo^yG3fF=U0Ih+gf7_kBAAc98HyKlQjG4UF4t54w5BUnvx`Lj?
zcg6Hu6aN6xcM3W?!3>OXdh9{|YS3lV``EhH*7s@jd}>SJ$KRK>dCm*Qr1R}dz?*^A
z0dEDr16?!eSMQyqzxmYWxtzpz#+r@Y-T8bK=(_2g^Dwv$=z9A|pzl-Xo}<~Ga5M>@
zRoC&p6{I>wy%HP`E&+N@`V{D@&76LHyfL9!9q-C#U0=J)Q$yx0%(ik3A+hjZ5-c1Jbh^@iL1h
zP3t|9tAU=cXuao9Abm(Dn}RG~LHPpCL)uXP+XMNdQUOX0!ClK40cJPBsqbnX2F&~xY?f^UFNfe!;c$CAGH2Y(E91Ud#vXL`=6_at;K
zUk`Y02UC@+p6Y8q?XPy!-o8L<>*`1SsbBT~6QFZ!m#>W(-dNMToD9TU!fRe!&)PQ6
z1?fgW>$#5tvwQ~h97}QZ5V#xs9OxO%w}9R+xDcEV&I6}_1+eI#{8>Qds;BzePy4GK
zwf7(p|LVuAp8@f5Jkaw|)9=86%5y@h^TXSL;>pYyXbJ=O;mEsz;?wjypkM#dbK}z2
zlHLT&jDfltxD5wh4?6w+hS%Y=DLf^|IG658dKu`_J6#ONtVIl5gRlF6G%lx&@mbhE
z%NO}=fY!Pm2WG}VRSY~sN1q2T1*YE>9C)(4k=Gi++raI>%or$}fk)`zM3AmMlV3p;
z+b&{2+-0C^ntum&Z4C)#r7)oL#9M)_T}3|L0I?jI==$-KOf$6t2g-+IRb`HqvdT4)eG59SoGX}B@+{FhS=eGl<
z-N__YS*`4xklz>_32p$-0<+m>K*w`^zvCca_q~;=a%CMcN9pmEypFf;0=ELYSB8Wc
zGd(ZTaa_mq%|IF(D~m4Mt11SvbLH~8lP-dFz^wZW=y-iQ&~GX9T{rW&sxY*EA~2x&
z%0Smp`+(EII$+jK2G%hw9k2HQcHJC7M@?vgxh&H1os{XAZPtDU)-ePfpLLuz?KVMp
zCHTPH4r+NXwrQPGzcXXMTLB3zGaY|*95(HipqC~$$(#>rc_+3V3%&=Q0A|f*K*w7h
zcXj;LaoEngO%_~=X|gP?7kTiDlq+q
zq|Ui|KBRT3^?_-(TnTil^}%>?F|;S?G2kme?`4~wAt9padgsUBOmHx;b8e?pRo`HU
zrM}}opLMORwG`?360i-I#
zrZsMjUp#2N|9#*UU`sH>VLN8uyzC+adGW}$4S>GaJP)L4#qcfQe$drxZ;eai(>OI=
zje8!52k~LL?VFr@>djcfj@F
z$KY4saqtuvb^onrVydV5(&i7qwct{45zyM)N#Gse4d9jF#b7J25g6(FLnQ6iw_FkD?3uj%rzl^Pf0_LsRr`wz^p^Pd++1$C29%UP
znqRI4lk%nfat%ExUo0qJaOHCaPdat5Gs*vKzm)hl0G
zX*q4H{k28=&n+b7i-qO$Nja01?;kOy_KVBcs9gIN?7xM|6^tt^-%$H2SPS-FJxRHO
zv0(pI+J9X6Qt|$C+J9X6+7bINu>ZL7#S#0@v;Vkqb}t$~BArXFzzX=8TeFz#TDbqX
z@-4>fPr1UQu>Eo68;;qZa)nP}`>V&7YxlzalR_&ueu#mg^Pdk6iw}zrix1NWm#fZt
z*T;5zNEs-){_quQE#GL&`G2!1%Qqjh{}x5%yY}dD7g@vSpQBy*+JfWnk}F@zFJI-$
zi|)^S`7`fVlT{U{5k(iD_`vKSJ-}}a+W#r&9%Sc^2Ghcxx)P^U*zAoa+Wyq&Fx=QE)}c&(dBDL
zm9JWyqkJL1d)gma&QWH9@+H4iIMfOIbN^dh&QWf%@-;(ECmVYEbFEWQP6_wt6O?C;
zoY|gw`_oH7IV0oLI6-;A0g{>Ntv?i(v;H9#vtBLd*}u0wQc%9AMN*ym3IcRo`CPKU
z)^C>k%;qRq=&kQ$x2Ac8ugVt-0#M}?7MANIr}DK00jBUARnElt@-?YbnGDmLlrI$o
z5ar4GALY3L!1knEVUlS!%~I~y7jw(kE|=#{;G+6v{K+`eR+lrBC+nj{<#Vn);dyyC
zpVQ`K{Z*Nq2wCgPlLfqaznf3B*Yf)BFhj7<^vQpa!w{_b^0nlK7+7K>UTJ@o4>{;I
zs(guZl73rc8;z1v_BI2jbvqVmMm`Tp``cuad*J`e)QKCWDWIv4^;pKE&iCv6Q3
za7p{nr`k`-2L`w{Q=a%ba1dWq`9g1h8o_96*^(yHauxT_P~vibd0&hs?)R7XIk=QG
zx#0RwKB#tTi#g@UCaM4wlKmFy&9Hg}s
zl1aJqm)+Rp2PgHraz|&9r}ql6ha=3$Wz^ms?277l+EUf#P2Oi9&~}B+e%Oy|6S?
z$cBWCUU@pCY`tVUdgaRl%v4Ae*(=WuFs-p>*}vQYE@a9V)4i56Dt6<`8(>clz5aWL
znB`rS>rJ*R&ly1CzHfhd($YrOWc$w
#include
#include
+#include
+#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@@ -36,6 +38,8 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
+ connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
+
this->loadDevices();
}
@@ -44,8 +48,45 @@ MainWindow::~MainWindow()
delete ui;
}
+void MainWindow::checkForUpdates(){
+ if(!jsonInfo.isEmpty()){
+ QVersionNumber local_hc=QVersionNumber::fromString(jsonInfo["version"].toString());
+ const QVersionNumber& local_gui=GUI_VERSION;
+ QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
+ QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
+ QVersionNumber remote_hc =QVersionNumber::fromString(v1);
+ QVersionNumber remote_gui =QVersionNumber::fromString(v2);
+ QString s1 = "up-to date";
+ QString s2 = "up-to date";
+ if(!(v1=="") && remote_hc>local_hc){
+ s1="Newer version ->"+remote_hc.toString();
+ }
+
+ if(!(v2=="") && remote_gui>local_gui){
+ s2="Newer version ->"+remote_hc.toString();
+ }
+ QVBoxLayout *layout = new QVBoxLayout;
+ QLabel *l1=new QLabel("HeadsetControl:\t\t"+s1);
+ QLabel *l2=new QLabel("HeadsetControl-GUI:\t"+s2);
+ layout->addWidget(l1);
+ layout->addWidget(l2);
+ showDialog("Check for updates",layout);
+ }
+}
+
+QString MainWindow::sendCommand(QStringList args){
+ QProcess *proc = new QProcess();
+ proc->start("headsetcontrol", args);
+ proc->waitForFinished();
+ QString output=proc->readAllStandardOutput();
+ //qDebug() << args;
+ //qDebug() << output;
+ return output;
+}
+
void MainWindow::disableFrames(){
ui->notSupportedFrame->setHidden(false);
+ ui->tabWidget->hide();
ui->deviceinfoFrame->setHidden(true);
ui->sidetoneFrame->setHidden(true);
ui->batteryFrame->setHidden(true);
@@ -60,17 +101,12 @@ void MainWindow::disableFrames(){
}
void MainWindow::loadDevices(){
- QProcess *proc = new QProcess();
- QStringList args=QStringList() << QString("--output") << QString("JSON");
- //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
- proc->start("headsetcontrol.exe", args);
- proc->waitForFinished();
- qDebug() << proc->arguments();
+ QStringList args=QStringList() << QString("--output") << QString("JSON");
+ args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
- QString strdata = proc->readAllStandardOutput();
- QJsonDocument jsonDoc = QJsonDocument::fromJson(strdata.toUtf8());
- QJsonObject jsonInfo=jsonDoc.object();
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
+ jsonInfo=jsonDoc.object();
if(!jsonDoc.isNull()){
deviceList=jsonInfo["devices"].toArray();
@@ -83,6 +119,7 @@ void MainWindow::loadDevices(){
void MainWindow::loadFeatures(int deviceIndex){
if(deviceIndex<0) return;
Ui::MainWindow *ui=uix;
+ ui->tabWidget->show();
usingDevice=deviceList[deviceIndex].toObject();
QJsonArray caps=usingDevice["capabilities"].toArray();
@@ -99,6 +136,7 @@ void MainWindow::loadFeatures(int deviceIndex){
product=usingDevice["product"].toString();
ui->deviceinfovalueLabel->setText("Device: "+device+"\r\nVendor: "+vendor+"\r\nProduct: "+product);
ui->deviceinfoFrame->setHidden(false);
+
if (capabilities.contains("CAP_SIDETONE")){
ui->sidetoneFrame->setHidden(false);
qDebug() << "Sidetone supported";
@@ -152,7 +190,6 @@ void MainWindow::loadFeatures(int deviceIndex){
int max=10;
int min=-10;
QHBoxLayout *mainLayout = ui->equalizerLayout;
-
for (int var = 0; var < n; ++var) {
QVBoxLayout *lb = new QVBoxLayout();
QSlider *s = new QSlider(Qt::Vertical);
@@ -189,66 +226,44 @@ void MainWindow::loadFeatures(int deviceIndex){
void MainWindow::on_onButton_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--light") << QString("1");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_offButton_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--light") << QString("0");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_voiceOnButton_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_voiceOffButton_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_rotateOn_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_rotateOff_clicked()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::setBatteryStatus()
{
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--battery");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- QString batteryStatus = proc->readAllStandardOutput();
- qDebug() << proc->readAllStandardError();
+ QString batteryStatus = sendCommand(args);
QStringList lines = batteryStatus.split("\n");
@@ -257,11 +272,14 @@ void MainWindow::setBatteryStatus()
QStringList statusParts = statusLine.split(": ");
QString status = statusParts[1].trimmed();
- // Extract the level value
- QString levelLine = lines[4];
- QStringList levelParts = levelLine.split(": ");
- QString level = levelParts[1].trimmed();
- level.remove("%");
+ QString level="none";
+ if(status != "BATTERY_UNAVAILABLE"){
+ // Extract the level value
+ QString levelLine = lines[4];
+ QStringList levelParts = levelLine.split(": ");
+ level = levelParts[1].trimmed();
+ level.remove("%");
+ }
if (status == "BATTERY_UNAVAILABLE"){
ui->batteryPercentage->setText("Headset Off");
@@ -295,42 +313,28 @@ void MainWindow::setBatteryStatus()
}
void MainWindow::on_sidetoneSlider_valueChanged(){
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_inactivitySlider_valueChanged(){
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::setChatmixStatus(){
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--chatmix");
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- QString chatmixStatus = proc->readAllStandardOutput();
+ QString chatmixStatus = sendCommand(args);
int value=chatmixStatus.mid(chatmixStatus.indexOf(':')+1).toInt();
ui->chatmixvalueLabel->setText(QString::number(value));
- qDebug() << proc->readAllStandardError();
}
void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
int preset=ui->equalizerPresetcomboBox->currentIndex()-1;
if(preset>=0 && preset<=3){
- int flat[]={0,0,0,0,0,0,0,0,0,0};
this->setSliders(flat);
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--equalizer-preset") << QString::number(preset);
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
}
@@ -341,50 +345,65 @@ void MainWindow::on_applyEqualizer_clicked(){
s+= QString::number(slider->value())+",";
}
s.removeLast();
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--equalizer") << s;
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_muteledbrightnessSlider_valueChanged(){
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
void MainWindow::on_micvolumeSlider_valueChanged(){
-
- QProcess *proc = new QProcess();
QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- qDebug() << proc->readAllStandardError();
+ sendCommand(args);
}
-void MainWindow::setSliders(int values[]){
+void MainWindow::setSliders(QVector values){
int i=0;
- for (QSlider* slider : slidersEq) {
- slider->setValue(values[i++]);
+ if(values.length()<=slidersEq.length()){
+ for (QSlider* slider : slidersEq) {
+ slider->setValue(values[i++]);
+ }
}
+ else{
+ qDebug() << "ERROR: Longer Equalizer Preset";
+ }
+}
+
+void MainWindow::showDialog(QString title, QLayout* layout){
+ QDialog dialog;
+ dialog.setWindowTitle(title);
+ dialog.setWindowIcon(QIcon(":/icons/headphones.png"));
+ dialog.setLayout(layout);
+ QPushButton *closeButton = new QPushButton("Close");
+ QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
+ layout->addWidget(closeButton);
+ dialog.exec();
}
void MainWindow::showAbout(){
+ QVBoxLayout *layout = new QVBoxLayout;
+ QLabel *l1 = new QLabel("This is a forked version of HeadsetControl-GUI.");
+ l1->setTextFormat(Qt::RichText);
+ l1->setOpenExternalLinks(true);
+ l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
+
+ QLabel *l2=new QLabel("Made by nicola02nb");
+ l2->setTextFormat(Qt::RichText);
+ l2->setOpenExternalLinks(true);
+ l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ QLabel *version=new QLabel("Version: "+GUI_VERSION.toString());
+
+ layout->addWidget(l1);
+ layout->addWidget(l2);
+ layout->addWidget(version);
+ showDialog("About this program",layout);
}
void MainWindow::showCredits(){
- QDialog dialog;
- dialog.setWindowTitle("Program Credits");
- dialog.setWindowIcon(QIcon(":/icons/headphones-inv.png"));
-
- // Create a layout for the dialog
QVBoxLayout *layout = new QVBoxLayout;
-
- // Add a label to display information
QLabel *infoLabel = new QLabel("Big shout-out to:");
QLabel *l1=new QLabel(" - Sapd for HeadsetCoontrol");
l1->setTextFormat(Qt::RichText);
@@ -399,17 +418,7 @@ void MainWindow::showCredits(){
layout->addWidget(l1);
layout->addWidget(l2);
- // Add a button to close the dialog
- QPushButton *closeButton = new QPushButton("Close");
- QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
- layout->addWidget(closeButton);
-
- // Set the layout for the dialog
- dialog.setLayout(layout);
-
- // Show the dialog
- dialog.exec();
-
+ showDialog("Credit to",layout);
}
void MainWindow::changeEvent(QEvent* e)
diff --git a/mainwindow.h b/mainwindow.h
index cb14773..e33c1d7 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -1,11 +1,15 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
+#include "ghTools.h"
#include
#include
#include
#include
#include
+#include
+
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.2.0");
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@@ -18,7 +22,6 @@ class MainWindow : public QMainWindow
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
-
bool notified = false;
QSystemTrayIcon *tray = new QSystemTrayIcon(this);
@@ -26,17 +29,24 @@ class MainWindow : public QMainWindow
QMenu *menu;
Ui::MainWindow *uix;
+ QJsonObject jsonInfo;
QJsonArray deviceList;
- QVector actionList;
QJsonObject usingDevice;
+
QSet capabilities;
QVector slidersEq;
+ QVector flat={0,0,0,0,0,0,0,0,0,0};
+
private slots:
void changeEvent(QEvent *e);
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
+ void checkForUpdates();
+
+ QString sendCommand(QStringList args);
+
void loadDevices();
void disableFrames();
@@ -67,12 +77,14 @@ private slots:
void on_applyEqualizer_clicked();
- void setSliders(int values[]);
+ void setSliders(QVector values);
void on_muteledbrightnessSlider_valueChanged();
void on_micvolumeSlider_valueChanged();
+ void showDialog(QString title, QLayout* layout);
+
void showAbout();
void showCredits();
diff --git a/mainwindow.ui b/mainwindow.ui
index 0d90fec..150b4c5 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -19,7 +19,7 @@
0
- 450
+ 0
@@ -318,6 +318,9 @@ max-width: 200px;
-
+
+ true
+
0
@@ -1113,8 +1116,6 @@ max-width: 200px;
File
-
-
-
-
- true
-
-
- Auto Startup
-
-
Check Updates
@@ -1150,6 +1143,17 @@ max-width: 200px;
Credits
+
+
+ true
+
+
+ false
+
+
+ Auto Startup
+
+
offButton
diff --git a/myapp.rc b/myapp.rc
new file mode 100644
index 0000000..5b07a4d
--- /dev/null
+++ b/myapp.rc
@@ -0,0 +1 @@
+IDI_ICON1 ICON DISCARDABLE "headphones-exe.ico"
\ No newline at end of file
From 1321582c1645212853f7f74772ac1e462917cf11 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 13:34:33 +0200
Subject: [PATCH 03/64] Update HeadsetControl-GUI.pro
---
HeadsetControl-GUI.pro | 2 ++
1 file changed, 2 insertions(+)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index d3d5da8..4a820a3 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -32,6 +32,8 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
RESOURCES += \
icons.qrc
+RC_FILE = myapp.rc
+
DISTFILES += \
headphones-exe.ico \
myapp.rc
From ca38107bf7d3cb26cdeccb5563e4332bc4654a49 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 13:36:36 +0200
Subject: [PATCH 04/64] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6c54379..75e3819 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Only if both these requirements are met, the GUI can work.
Start HeadsetControl-GUI by double-clicking "HeadsetControl-GUI.exe".
If your headset is supported and everything was set up correctly, you will be greeted by the only screen HeadsetControl-GUI has.
-![Screenshot of the GUI with a Corsair Void Pro Wireless](https://i.imgur.com/xALkNjr.jpg)
+![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/f0d3b4d3-ea55-42b7-9bf9-fe039fbcd104)
Here you can adjust all settings supported by your headset.
In my experience, these changes persist even after rebooting the system or turning the headset off.
From 19e08b57eebf5eb3556d3d8991c08a9a88611ecf Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 13:52:01 +0200
Subject: [PATCH 05/64] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 75e3819..74cd6ab 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+A simply remake of [HeadsetControl-GUI](https://github.com/LeoKlaus/HeadsetControl-GUI) by LeoKlaus
# HeadsetControl-GUI
This is a GUI for [Sapds great HeadsetControl](https://github.com/Sapd/HeadsetControl/). It's just a frontend to graphically interact with the original HeadsetControl and has no functionality by itself.
From 8dfd2b25766db97f32367ccaa8abdc6b700e1d51 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 13:53:08 +0200
Subject: [PATCH 06/64] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 74cd6ab..894ffff 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ This program is in no way affiliated with Sapd or HeadsetControl.
All issues regarding the functionality of HeadsetControl (like compatiblity with devices) are beyond the scope of this project.
## Installation (Windows only for now)
-Download the [latest release](https://github.com/LeoKlaus/HeadsetControl-GUI/releases/latest/) of HeadsetControl-GUI from the [releases section](https://github.com/LeoKlaus/HeadsetControl-GUI/releases) of this page.
+Download the [latest release](https://github.com/LeoKlaus/HeadsetControl-GUI/releases/latest/) of HeadsetControl-GUI from the [releases section](https://github.com/nicola02nb/HeadsetControl-GUI/releases) of this page.
Download the corresponding version of [Sapds HeadsetControl from their GitHub page](https://github.com/Sapd/HeadsetControl/releases/).
Extract HeadsetControl-GUI to any folder of your choice and drop HeadsetControl into the same folder.
From 1f8b14d2604f01eddc142c0fa74d6a79a56467e9 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 8 Jun 2024 14:40:21 +0200
Subject: [PATCH 07/64] Stuff
---
HeadsetControl-GUI.pro | 2 +-
HeadsetControl-GUI.pro.user | 2 +-
mainwindow.cpp | 2 +-
mainwindow.ui | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 4a820a3..f4b1f38 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -1,7 +1,7 @@
QT += core gui
QT += core network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
CONFIG += c++11
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index f0137b9..ebc5fc4 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 8b50dfa..202c4a3 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -103,7 +103,7 @@ void MainWindow::disableFrames(){
void MainWindow::loadDevices(){
QStringList args=QStringList() << QString("--output") << QString("JSON");
- args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
+ //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
jsonInfo=jsonDoc.object();
diff --git a/mainwindow.ui b/mainwindow.ui
index 150b4c5..59355a7 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -7,7 +7,7 @@
0
0
529
- 508
+ 512
From 8c9aa8d9a14948b8879f3b7b3e7376a794d6459a Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 9 Jun 2024 11:47:44 +0200
Subject: [PATCH 08/64] Restyle and tiny optimization
---
HeadsetControl-GUI.pro.user | 6 +-
mainwindow.cpp | 100 +++++++++++++++------------
mainwindow.h | 12 ++--
mainwindow.ui | 132 +++++++++++++++++++++---------------
myapp.rc | 2 +-
5 files changed, 144 insertions(+), 108 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index ebc5fc4..c6fe4f1 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -92,7 +92,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 2
+ 0
0
0
@@ -248,7 +248,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
1
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 202c4a3..7b6b329 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -40,7 +40,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
+ this->disableFrames();
this->loadDevices();
+ this->loadFeatures();
}
MainWindow::~MainWindow()
@@ -59,15 +61,20 @@ void MainWindow::checkForUpdates(){
QString s1 = "up-to date";
QString s2 = "up-to date";
if(!(v1=="") && remote_hc>local_hc){
- s1="Newer version ->"+remote_hc.toString();
+ s1="Newer version ->"+remote_hc.toString()+"";
}
-
if(!(v2=="") && remote_gui>local_gui){
- s2="Newer version ->"+remote_hc.toString();
+ s2="Newer version ->"+remote_gui.toString()+"";
}
QVBoxLayout *layout = new QVBoxLayout;
QLabel *l1=new QLabel("HeadsetControl:\t\t"+s1);
+ l1->setTextFormat(Qt::RichText);
+ l1->setOpenExternalLinks(true);
+ l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
QLabel *l2=new QLabel("HeadsetControl-GUI:\t"+s2);
+ l2->setTextFormat(Qt::RichText);
+ l2->setOpenExternalLinks(true);
+ l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
layout->addWidget(l1);
layout->addWidget(l2);
showDialog("Check for updates",layout);
@@ -86,16 +93,24 @@ QString MainWindow::sendCommand(QStringList args){
void MainWindow::disableFrames(){
ui->notSupportedFrame->setHidden(false);
- ui->tabWidget->hide();
ui->deviceinfoFrame->setHidden(true);
- ui->sidetoneFrame->setHidden(true);
ui->batteryFrame->setHidden(true);
+
+ ui->tabWidget->hide();
+ ui->tabWidget->setTabEnabled(2, false);
+ ui->tabWidget->setTabEnabled(1, false);
+ ui->tabWidget->setTabEnabled(0, false);
+
ui->lightFrame->setHidden(true);
- ui->inactivityFrame->setHidden(true);
ui->voicepromptFrame->setHidden(true);
- ui->rotatetomuteFrame->setHidden(true);
+ ui->sidetoneFrame->setHidden(true);
+ ui->inactivityFrame->setHidden(true);
ui->chatmixFrame->setHidden(true);
+
+ ui->equalizerpresetFrame->setHidden(true);
ui->equalizerFrame->setHidden(true);
+
+ ui->rotatetomuteFrame->setHidden(true);
ui->muteledbrightnessFrame->setHidden(true);
ui->micvolumeFrame->setHidden(true);
}
@@ -103,16 +118,13 @@ void MainWindow::disableFrames(){
void MainWindow::loadDevices(){
QStringList args=QStringList() << QString("--output") << QString("JSON");
- //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
+ args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
jsonInfo=jsonDoc.object();
if(!jsonDoc.isNull()){
deviceList=jsonInfo["devices"].toArray();
- this->loadFeatures();
- }else {
- this->disableFrames();
}
}
@@ -125,7 +137,7 @@ void MainWindow::loadFeatures(int deviceIndex){
QJsonArray caps=usingDevice["capabilities"].toArray();
for (const QJsonValue &value : caps) {
capabilities.insert(value.toString());
- qDebug()<notSupportedFrame->setHidden(true);
@@ -136,56 +148,55 @@ void MainWindow::loadFeatures(int deviceIndex){
product=usingDevice["product"].toString();
ui->deviceinfovalueLabel->setText("Device: "+device+"\r\nVendor: "+vendor+"\r\nProduct: "+product);
ui->deviceinfoFrame->setHidden(false);
-
- if (capabilities.contains("CAP_SIDETONE")){
- ui->sidetoneFrame->setHidden(false);
- qDebug() << "Sidetone supported";
- }
- else ui->sidetoneFrame->setHidden(true);
if (capabilities.contains("CAP_BATTERY_STATUS")){
ui->batteryFrame->setHidden(false);
-
QTimer *timerBattery = new QTimer(this);
connect(timerBattery, SIGNAL(timeout()), this, SLOT(setBatteryStatus()));
timerBattery->start(300000);
this->setBatteryStatus();
qDebug() << "Battery percentage supported";
}
- else ui->batteryFrame->setHidden(true);
+
if (capabilities.contains("CAP_LIGHTS")){
ui->lightFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(0, true);
menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
qDebug() << "Light control supported";
}
- else ui->lightFrame->setHidden(true);
- if (capabilities.contains("CAP_INACTIVE_TIME")){
- ui->inactivityFrame->setHidden(false);
- qDebug() << "Inactivity timer supported";
+ if (capabilities.contains("CAP_SIDETONE")){
+ ui->sidetoneFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(0, true);
+ qDebug() << "Sidetone supported";
}
- else ui->inactivityFrame->setHidden(true);
if (capabilities.contains("CAP_VOICE_PROMPTS")){
ui->voicepromptFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(0, true);
qDebug() << "Voice prompt control supported";
}
- else ui->voicepromptFrame->setHidden(true);
- if (capabilities.contains("CAP_ROTATE_TO_MUTE")){
- ui->rotatetomuteFrame->setHidden(false);
- qDebug() << "Rotate to mute supported";
+ if (capabilities.contains("CAP_INACTIVE_TIME")){
+ ui->inactivityFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(0, true);
+ qDebug() << "Inactivity timer supported";
}
- else ui->rotatetomuteFrame->setHidden(true);
if (capabilities.contains("CAP_CHATMIX_STATUS")){
ui->chatmixFrame->setHidden(false);
-
+ ui->tabWidget->setTabEnabled(0, true);
QTimer *timerChatmix = new QTimer(this);
connect(timerChatmix, SIGNAL(timeout()), this, SLOT(setChatmixStatus()));
timerChatmix->start(300000);
this->setChatmixStatus();
qDebug() << "Chatmix supported";
}
- else ui->chatmixFrame->setHidden(true);
+
+ if (capabilities.contains("CAP_EQUALIZER_PRESET")){
+ ui->equalizerpresetFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(1, true);
+ qDebug() << "Eqaulizer preset supported";
+ }
if (capabilities.contains("CAP_EQUALIZER")){
- ui->equalizerFrame->setHidden(false);
+ ui->equalizerFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(1, true);
int n=10;
int max=10;
int min=-10;
@@ -211,26 +222,31 @@ void MainWindow::loadFeatures(int deviceIndex){
}
qDebug() << "Equalizer supported";
}
- else ui->equalizerFrame->setHidden(true);
+
+ if (capabilities.contains("CAP_ROTATE_TO_MUTE")){
+ ui->rotatetomuteFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(2, true);
+ qDebug() << "Rotate to mute supported";
+ }
if (capabilities.contains("CAP_MICROPHONE_MUTE_LED_BRIGHTNESS")){
ui->muteledbrightnessFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(2, true);
qDebug() << "Muted led brightness supported";
}
- else ui->muteledbrightnessFrame->setHidden(true);
if (capabilities.contains("CAP_MICROPHONE_VOLUME")){
ui->micvolumeFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(2, true);
qDebug() << "Microphone volume supported";
}
- else ui->micvolumeFrame->setHidden(true);
}
-void MainWindow::on_onButton_clicked()
+void MainWindow::on_onlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("1");
sendCommand(args);
}
-void MainWindow::on_offButton_clicked()
+void MainWindow::on_offlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("0");
sendCommand(args);
@@ -312,12 +328,12 @@ void MainWindow::setBatteryStatus()
}
}
-void MainWindow::on_sidetoneSlider_valueChanged(){
+void MainWindow::on_sidetoneSlider_sliderReleased(){
QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
sendCommand(args);
}
-void MainWindow::on_inactivitySlider_valueChanged(){
+void MainWindow::on_inactivitySlider_sliderReleased(){
QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
sendCommand(args);
}
@@ -349,12 +365,12 @@ void MainWindow::on_applyEqualizer_clicked(){
sendCommand(args);
}
-void MainWindow::on_muteledbrightnessSlider_valueChanged(){
+void MainWindow::on_muteledbrightnessSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
sendCommand(args);
}
-void MainWindow::on_micvolumeSlider_valueChanged(){
+void MainWindow::on_micvolumeSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
sendCommand(args);
}
diff --git a/mainwindow.h b/mainwindow.h
index e33c1d7..4826007 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -53,9 +53,9 @@ private slots:
void loadFeatures(int deviceIndex=0);
- void on_onButton_clicked();
+ void on_onlightButton_clicked();
- void on_offButton_clicked();
+ void on_offlightButton_clicked();
void on_voiceOnButton_clicked();
@@ -67,9 +67,9 @@ private slots:
void setBatteryStatus();
- void on_sidetoneSlider_valueChanged();
+ void on_sidetoneSlider_sliderReleased();
- void on_inactivitySlider_valueChanged();
+ void on_inactivitySlider_sliderReleased();
void setChatmixStatus();
@@ -79,9 +79,9 @@ private slots:
void setSliders(QVector values);
- void on_muteledbrightnessSlider_valueChanged();
+ void on_muteledbrightnessSlider_sliderReleased();
- void on_micvolumeSlider_valueChanged();
+ void on_micvolumeSlider_sliderReleased();
void showDialog(QString title, QLayout* layout);
diff --git a/mainwindow.ui b/mainwindow.ui
index 59355a7..81eaaaf 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -7,7 +7,7 @@
0
0
529
- 512
+ 522
@@ -22,19 +22,20 @@
0
+
+
+ 11
+
+
HeadsetControl - GUI
- :/icons/headphones.png:/icons/headphones.png
+ :/icons/headphones-inv.png:/icons/headphones-inv.png
- background-color: rgb(44, 44, 44);
-color: rgb(208, 208, 208);
-font: 87 10pt "Segoe UI Black";
-
-
+
@@ -56,23 +57,7 @@ font: 87 10pt "Segoe UI Black";
- QLabel {
- min-width: 120px;
- max-width: 120px;
-}
-
-QPushButton {
- border-width: 1px;
- border-color: rgb(200, 200, 200);
- border-style: inset;
- border-radius: 5px;
-}
-.QFrame {
- border-radius: 5px;
- border-width: 1px;
- border-style: solid;
- border-color: rgb(200, 200, 200);
-}
+
-
@@ -84,10 +69,13 @@ QPushButton {
- QLabel {
-min-width: 400px;
-max-width: 400px;
-}
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
-
@@ -100,13 +88,13 @@ max-width: 400px;
- 400
+ 0
0
- 400
+ 16777215
16777215
@@ -176,10 +164,7 @@ max-width: 400px;
- QLabel {
-min-width: 300px;
-max-width: 300px;
-}
+
No info of the device
@@ -287,10 +272,7 @@ max-width: 300px;
- QLabel {
-min-width: 200px;
-max-width: 200px;
-}
+
No compatible Device found!
@@ -355,6 +337,12 @@ max-width: 200px;
0
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
-
@@ -385,7 +373,7 @@ max-width: 200px;
-
-
+
120
@@ -411,7 +399,7 @@ max-width: 200px;
-
-
+
120
@@ -434,6 +422,12 @@ max-width: 200px;
0
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
-
@@ -537,6 +531,12 @@ max-width: 200px;
0
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
-
@@ -620,6 +620,12 @@ max-width: 200px;
0
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
-
@@ -768,7 +774,7 @@ max-width: 200px;
-
-
+
0
@@ -783,7 +789,7 @@ max-width: 200px;
-
-
+
Equalizer preset:
@@ -791,6 +797,12 @@ max-width: 200px;
-
+
+
+ 150
+ 0
+
+
-
-
@@ -818,6 +830,19 @@ max-width: 200px;
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
@@ -877,6 +902,12 @@ max-width: 200px;
0
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
-
@@ -1109,7 +1140,7 @@ max-width: 200px;
0
0
529
- 22
+ 25
- offButton
- onButton
+ offlightButton
+ onlightButton
sidetoneSlider
voiceOffButton
inactivitySlider
diff --git a/myapp.rc b/myapp.rc
index 5b07a4d..d2559c1 100644
--- a/myapp.rc
+++ b/myapp.rc
@@ -1 +1 @@
-IDI_ICON1 ICON DISCARDABLE "headphones-exe.ico"
\ No newline at end of file
+IDI_ICON1 ICON DISCARDABLE "headphones-exe.ico"
From 36d0d67fbe4469925987e071a1262563e57cb7a7 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 9 Jun 2024 12:56:56 +0200
Subject: [PATCH 09/64] Added option to select to display another device
(Untested)
---
mainwindow.cpp | 67 ++++++++++++++++++++++---
mainwindow.h | 10 ++--
mainwindow.ui | 133 ++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 199 insertions(+), 11 deletions(-)
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 7b6b329..9d0dc88 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@@ -39,10 +40,11 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
+ connect(ui->actionLoad_Device, &QAction::triggered, this, &MainWindow::selectDevice);
this->disableFrames();
this->loadDevices();
- this->loadFeatures();
+ this->loadDevice();
}
MainWindow::~MainWindow()
@@ -118,7 +120,7 @@ void MainWindow::disableFrames(){
void MainWindow::loadDevices(){
QStringList args=QStringList() << QString("--output") << QString("JSON");
- args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
+ //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
jsonInfo=jsonDoc.object();
@@ -128,7 +130,7 @@ void MainWindow::loadDevices(){
}
}
-void MainWindow::loadFeatures(int deviceIndex){
+void MainWindow::loadDevice(int deviceIndex){
if(deviceIndex<0) return;
Ui::MainWindow *ui=uix;
ui->tabWidget->show();
@@ -146,7 +148,7 @@ void MainWindow::loadFeatures(int deviceIndex){
device=usingDevice["device"].toString();
vendor=usingDevice["vendor"].toString();
product=usingDevice["product"].toString();
- ui->deviceinfovalueLabel->setText("Device: "+device+"\r\nVendor: "+vendor+"\r\nProduct: "+product);
+ ui->deviceinfovalueLabel->setText(device+"\n"+vendor+"\n"+product);
ui->deviceinfoFrame->setHidden(false);
if (capabilities.contains("CAP_BATTERY_STATUS")){
ui->batteryFrame->setHidden(false);
@@ -200,7 +202,8 @@ void MainWindow::loadFeatures(int deviceIndex){
int n=10;
int max=10;
int min=-10;
- QHBoxLayout *mainLayout = ui->equalizerLayout;
+ QHBoxLayout *equalizerLayout = ui->equalizerLayout;
+ clearLayout(equalizerLayout);
for (int var = 0; var < n; ++var) {
QVBoxLayout *lb = new QVBoxLayout();
QSlider *s = new QSlider(Qt::Vertical);
@@ -218,7 +221,7 @@ void MainWindow::loadFeatures(int deviceIndex){
lb->addWidget(s);
slidersEq.append(s);
- mainLayout->addLayout(lb);
+ equalizerLayout->addLayout(lb);
}
qDebug() << "Equalizer supported";
}
@@ -398,6 +401,58 @@ void MainWindow::showDialog(QString title, QLayout* layout){
dialog.exec();
}
+void MainWindow::selectDevice()
+{
+ QDialog dialog;
+ dialog.setWindowTitle("Select device to load");
+
+ QVBoxLayout layout(&dialog);
+
+ QLabel labelWidget("Select device:");
+ layout.addWidget(&labelWidget);
+
+ QStringList devices=QStringList();
+ foreach (const QJsonValue &d, deviceList) {
+ devices<=0) {
+ this->disableFrames();
+ this->loadDevice(result);
+ }
+ }
+}
+
+void MainWindow::clearLayout(QLayout* layout){
+ if (!layout) {
+ return;
+ }
+
+ QLayoutItem* item;
+ while ((item = layout->takeAt(0))) {
+ if (item->layout()) {
+ clearLayout(item->layout()); // Delete the layout if it exists
+ }
+ if (item->widget()) {
+ delete item->widget(); // Delete the widget
+ }
+ delete item; // Delete the layout item
+ }
+}
+
void MainWindow::showAbout(){
QVBoxLayout *layout = new QVBoxLayout;
QLabel *l1 = new QLabel("This is a forked version of HeadsetControl-GUI.");
diff --git a/mainwindow.h b/mainwindow.h
index 4826007..3111ad6 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -47,11 +47,11 @@ private slots:
QString sendCommand(QStringList args);
- void loadDevices();
-
void disableFrames();
- void loadFeatures(int deviceIndex=0);
+ void loadDevices();
+
+ void loadDevice(int deviceIndex=0);
void on_onlightButton_clicked();
@@ -89,6 +89,10 @@ private slots:
void showCredits();
+ void clearLayout(QLayout* layout);
+
+ void selectDevice();
+
private:
Ui::MainWindow *ui;
};
diff --git a/mainwindow.ui b/mainwindow.ui
index 81eaaaf..8b6ed40 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -7,7 +7,7 @@
0
0
529
- 522
+ 537
@@ -138,8 +138,22 @@
0
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
- Device info:
+ Device:
+Vendor:
+Model:
@@ -246,6 +260,12 @@
16777215
+
+
+ 11
+ true
+
+
Battery:
@@ -364,6 +384,12 @@
16777215
+
+
+ 11
+ true
+
+
Lights:
@@ -443,6 +469,12 @@
0
+
+
+ 11
+ true
+
+
Sidetone Level:
@@ -558,6 +590,12 @@
16777215
+
+
+ 11
+ true
+
+
Voice Prompts:
@@ -641,6 +679,12 @@
0
+
+
+ 11
+ true
+
+
Inactivity Timer:
@@ -732,6 +776,18 @@
0
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
Chatmix:
@@ -790,6 +846,18 @@
-
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
Equalizer preset:
@@ -863,6 +931,18 @@
-
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
Equalizer:
@@ -917,6 +997,18 @@
0
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
Rotate to mute:
@@ -972,9 +1064,27 @@
0
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
+
+ false
+
Muted led brightness:
+
+ false
+
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -1060,6 +1170,18 @@
0
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
Microphone volume:
@@ -1147,6 +1269,8 @@
File
+
+
offlightButton
From 818881ee0d26daf46d5366aae0e2c9a648fef697 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 9 Jun 2024 15:20:46 +0200
Subject: [PATCH 10/64] Done some stuff
---
mainwindow.cpp | 57 ++++++++++++++++++++++++++++++++++----------------
mainwindow.h | 8 +++++--
mainwindow.ui | 16 ++++++++++++++
3 files changed, 61 insertions(+), 20 deletions(-)
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 9d0dc88..d3d86bd 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -44,7 +44,9 @@ MainWindow::MainWindow(QWidget *parent)
this->disableFrames();
this->loadDevices();
- this->loadDevice();
+ if(deviceQuantity>0){
+ this->loadDevice();
+ }
}
MainWindow::~MainWindow()
@@ -60,8 +62,8 @@ void MainWindow::checkForUpdates(){
QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
QVersionNumber remote_hc =QVersionNumber::fromString(v1);
QVersionNumber remote_gui =QVersionNumber::fromString(v2);
- QString s1 = "up-to date";
- QString s2 = "up-to date";
+ QString s1 = "up-to date v"+local_hc.toString();
+ QString s2 = "up-to date v"+local_gui.toString();
if(!(v1=="") && remote_hc>local_hc){
s1="Newer version ->"+remote_hc.toString()+"";
}
@@ -122,26 +124,40 @@ void MainWindow::loadDevices(){
QStringList args=QStringList() << QString("--output") << QString("JSON");
//args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
+ //QString test="{\"name\":\"HeadsetControl\",\"version\":\"3.0.0\",\"api_version\":\"1.0\",\"hidapi_version\":\"0.14.0\",\"device_count\":2,\"devices\":[{\"status\":\"success\",\"device\":\"Dev1\",\"vendor\":\"Dev1\",\"product\":\"Dev1\",\"id_vendor\":\"0x1038\",\"id_product\":\"0x2202\",\"capabilities\":[\"CAP_SIDETONE\",\"CAP_BATTERY_STATUS\",\"CAP_INACTIVE_TIME\"],\"capabilities_str\":[\"sidetone\",\"battery\",\"inactive time\",\"chatmix\",\"equalizer preset\",\"equalizer\"],\"battery\":{\"status\":\"BATTERY_AVAILABLE\",\"level\":75},\"chatmix\":65},{\"status\":\"success\",\"device\":\"Dev2\",\"vendor\":\"Dev2\",\"product\":\"Dev2\",\"id_vendor\":\"0x1038\",\"id_product\":\"0x2202\",\"capabilities\":[\"CAP_SIDETONE\",\"CAP_BATTERY_STATUS\",\"CAP_INACTIVE_TIME\",\"CAP_CHATMIX_STATUS\",\"CAP_EQUALIZER_PRESET\",\"CAP_EQUALIZER\"],\"capabilities_str\":[\"sidetone\",\"battery\",\"inactive time\",\"chatmix\",\"equalizer preset\",\"equalizer\"],\"battery\":{\"status\":\"BATTERY_AVAILABLE\",\"level\":75},\"chatmix\":65}]}";
+
QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
+ //jsonDoc=QJsonDocument::fromJson(test.toUtf8()); //test fort multiple devices
jsonInfo=jsonDoc.object();
if(!jsonDoc.isNull()){
+ deviceQuantity=jsonInfo["device_count"].toInt();
deviceList=jsonInfo["devices"].toArray();
}
}
void MainWindow::loadDevice(int deviceIndex){
if(deviceIndex<0) return;
+
Ui::MainWindow *ui=uix;
- ui->tabWidget->show();
usingDevice=deviceList[deviceIndex].toObject();
QJsonArray caps=usingDevice["capabilities"].toArray();
+ QSet capabilities;
for (const QJsonValue &value : caps) {
capabilities.insert(value.toString());
//qDebug()<stop();
+ timerBattery=nullptr;
+ }
+ if(timerChatmix!=nullptr){
+ timerChatmix->stop();
+ timerChatmix=nullptr;
+ }
+
ui->notSupportedFrame->setHidden(true);
QString device, vendor, product;
@@ -152,13 +168,15 @@ void MainWindow::loadDevice(int deviceIndex){
ui->deviceinfoFrame->setHidden(false);
if (capabilities.contains("CAP_BATTERY_STATUS")){
ui->batteryFrame->setHidden(false);
- QTimer *timerBattery = new QTimer(this);
+ timerBattery = new QTimer(this);
connect(timerBattery, SIGNAL(timeout()), this, SLOT(setBatteryStatus()));
- timerBattery->start(300000);
+ timerBattery->start(UPDATE_TIME);
this->setBatteryStatus();
qDebug() << "Battery percentage supported";
}
+ ui->tabWidget->show();
+
if (capabilities.contains("CAP_LIGHTS")){
ui->lightFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
@@ -184,9 +202,9 @@ void MainWindow::loadDevice(int deviceIndex){
if (capabilities.contains("CAP_CHATMIX_STATUS")){
ui->chatmixFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
- QTimer *timerChatmix = new QTimer(this);
+ timerChatmix = new QTimer(this);
connect(timerChatmix, SIGNAL(timeout()), this, SLOT(setChatmixStatus()));
- timerChatmix->start(300000);
+ timerChatmix->start(UPDATE_TIME);
this->setChatmixStatus();
qDebug() << "Chatmix supported";
}
@@ -342,10 +360,15 @@ void MainWindow::on_inactivitySlider_sliderReleased(){
}
void MainWindow::setChatmixStatus(){
+ Ui::MainWindow *ui=uix;
QStringList args=QStringList() << QString("--chatmix");
- QString chatmixStatus = sendCommand(args);
- int value=chatmixStatus.mid(chatmixStatus.indexOf(':')+1).toInt();
+ QString chatmixValue= sendCommand(args);
+ int value=chatmixValue.mid(chatmixValue.indexOf(':')+1).toInt();
ui->chatmixvalueLabel->setText(QString::number(value));
+ QString chatmixStatus="";
+ if(value<65)chatmixStatus="Game";
+ else if(value>65)chatmixStatus="Chat";
+ ui->chatmixstatusLabel->setText(chatmixStatus);
}
void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
@@ -401,8 +424,7 @@ void MainWindow::showDialog(QString title, QLayout* layout){
dialog.exec();
}
-void MainWindow::selectDevice()
-{
+void MainWindow::selectDevice(){
QDialog dialog;
dialog.setWindowTitle("Select device to load");
@@ -412,8 +434,8 @@ void MainWindow::selectDevice()
layout.addWidget(&labelWidget);
QStringList devices=QStringList();
- foreach (const QJsonValue &d, deviceList) {
- devices<=0) {
+ selectedDevice = comboBox.currentIndex();
+ if (selectedDevice>=0 && selectedDevicedisableFrames();
- this->loadDevice(result);
+ this->loadDevice(selectedDevice);
}
}
}
diff --git a/mainwindow.h b/mainwindow.h
index 3111ad6..eb5ddee 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -26,16 +26,20 @@ class MainWindow : public QMainWindow
QSystemTrayIcon *tray = new QSystemTrayIcon(this);
private:
+ const int UPDATE_TIME=300000;
QMenu *menu;
Ui::MainWindow *uix;
+ int deviceQuantity=0;
+ int selectedDevice=-1;
QJsonObject jsonInfo;
QJsonArray deviceList;
QJsonObject usingDevice;
-
- QSet capabilities;
QVector slidersEq;
+ QTimer *timerBattery;
+ QTimer *timerChatmix;
+
QVector flat={0,0,0,0,0,0,0,0,0,0};
private slots:
diff --git a/mainwindow.ui b/mainwindow.ui
index 8b6ed40..6887a01 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -806,6 +806,19 @@ Model:
+ -
+
+
+
+ 30
+ 0
+
+
+
+
+
+
+
-
@@ -1299,6 +1312,9 @@ Model:
+
+ false
+
Load Device
From 3df685e47d4d890d9469729d69a5067b9e8b493b Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:45:19 +0200
Subject: [PATCH 11/64] Fixed some stuff
---
HeadsetControl-GUI.pro.user | 2 +-
mainwindow.cpp | 279 +++++++++++++++++++++++-------------
mainwindow.h | 50 +++++--
mainwindow.ui | 275 ++++++++++++++++++++++++++++++++++-
4 files changed, 483 insertions(+), 123 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index c6fe4f1..cb02f90 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/mainwindow.cpp b/mainwindow.cpp
index d3d86bd..db6d98c 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@@ -27,6 +28,8 @@ MainWindow::MainWindow(QWidget *parent)
menu = new QMenu(nullptr);
menu->addAction("Show", this, SLOT(show()));
+ ledOn = menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
+ ledOff = menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
menu->addAction("Exit", this, SLOT(close()));
tray->setContextMenu(menu);
@@ -47,6 +50,9 @@ MainWindow::MainWindow(QWidget *parent)
if(deviceQuantity>0){
this->loadDevice();
}
+
+ ui->equalizerFrame->setDisabled(true);
+ ui->equalizerpresetFrame->setDisabled(true);
}
MainWindow::~MainWindow()
@@ -54,37 +60,6 @@ MainWindow::~MainWindow()
delete ui;
}
-void MainWindow::checkForUpdates(){
- if(!jsonInfo.isEmpty()){
- QVersionNumber local_hc=QVersionNumber::fromString(jsonInfo["version"].toString());
- const QVersionNumber& local_gui=GUI_VERSION;
- QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
- QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
- QVersionNumber remote_hc =QVersionNumber::fromString(v1);
- QVersionNumber remote_gui =QVersionNumber::fromString(v2);
- QString s1 = "up-to date v"+local_hc.toString();
- QString s2 = "up-to date v"+local_gui.toString();
- if(!(v1=="") && remote_hc>local_hc){
- s1="Newer version ->"+remote_hc.toString()+"";
- }
- if(!(v2=="") && remote_gui>local_gui){
- s2="Newer version ->"+remote_gui.toString()+"";
- }
- QVBoxLayout *layout = new QVBoxLayout;
- QLabel *l1=new QLabel("HeadsetControl:\t\t"+s1);
- l1->setTextFormat(Qt::RichText);
- l1->setOpenExternalLinks(true);
- l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
- QLabel *l2=new QLabel("HeadsetControl-GUI:\t"+s2);
- l2->setTextFormat(Qt::RichText);
- l2->setOpenExternalLinks(true);
- l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
- layout->addWidget(l1);
- layout->addWidget(l2);
- showDialog("Check for updates",layout);
- }
-}
-
QString MainWindow::sendCommand(QStringList args){
QProcess *proc = new QProcess();
proc->start("headsetcontrol", args);
@@ -96,11 +71,15 @@ QString MainWindow::sendCommand(QStringList args){
}
void MainWindow::disableFrames(){
+ ledOn->setEnabled(false);
+ ledOff->setEnabled(false);
+
ui->notSupportedFrame->setHidden(false);
ui->deviceinfoFrame->setHidden(true);
ui->batteryFrame->setHidden(true);
ui->tabWidget->hide();
+ ui->tabWidget->setTabEnabled(3, false);
ui->tabWidget->setTabEnabled(2, false);
ui->tabWidget->setTabEnabled(1, false);
ui->tabWidget->setTabEnabled(0, false);
@@ -110,6 +89,7 @@ void MainWindow::disableFrames(){
ui->sidetoneFrame->setHidden(true);
ui->inactivityFrame->setHidden(true);
ui->chatmixFrame->setHidden(true);
+ ui->volumelimiterFrame->setHidden(true);
ui->equalizerpresetFrame->setHidden(true);
ui->equalizerFrame->setHidden(true);
@@ -117,6 +97,9 @@ void MainWindow::disableFrames(){
ui->rotatetomuteFrame->setHidden(true);
ui->muteledbrightnessFrame->setHidden(true);
ui->micvolumeFrame->setHidden(true);
+
+ ui->btwhenonFrame->setHidden(true);
+ ui->btcallvolumeFrame->setHidden(true);
}
void MainWindow::loadDevices(){
@@ -124,10 +107,7 @@ void MainWindow::loadDevices(){
QStringList args=QStringList() << QString("--output") << QString("JSON");
//args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
- //QString test="{\"name\":\"HeadsetControl\",\"version\":\"3.0.0\",\"api_version\":\"1.0\",\"hidapi_version\":\"0.14.0\",\"device_count\":2,\"devices\":[{\"status\":\"success\",\"device\":\"Dev1\",\"vendor\":\"Dev1\",\"product\":\"Dev1\",\"id_vendor\":\"0x1038\",\"id_product\":\"0x2202\",\"capabilities\":[\"CAP_SIDETONE\",\"CAP_BATTERY_STATUS\",\"CAP_INACTIVE_TIME\"],\"capabilities_str\":[\"sidetone\",\"battery\",\"inactive time\",\"chatmix\",\"equalizer preset\",\"equalizer\"],\"battery\":{\"status\":\"BATTERY_AVAILABLE\",\"level\":75},\"chatmix\":65},{\"status\":\"success\",\"device\":\"Dev2\",\"vendor\":\"Dev2\",\"product\":\"Dev2\",\"id_vendor\":\"0x1038\",\"id_product\":\"0x2202\",\"capabilities\":[\"CAP_SIDETONE\",\"CAP_BATTERY_STATUS\",\"CAP_INACTIVE_TIME\",\"CAP_CHATMIX_STATUS\",\"CAP_EQUALIZER_PRESET\",\"CAP_EQUALIZER\"],\"capabilities_str\":[\"sidetone\",\"battery\",\"inactive time\",\"chatmix\",\"equalizer preset\",\"equalizer\"],\"battery\":{\"status\":\"BATTERY_AVAILABLE\",\"level\":75},\"chatmix\":65}]}";
-
QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
- //jsonDoc=QJsonDocument::fromJson(test.toUtf8()); //test fort multiple devices
jsonInfo=jsonDoc.object();
if(!jsonDoc.isNull()){
@@ -180,8 +160,8 @@ void MainWindow::loadDevice(int deviceIndex){
if (capabilities.contains("CAP_LIGHTS")){
ui->lightFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
- menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
- menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
+ ledOn->setEnabled(true);
+ ledOff->setEnabled(true);
qDebug() << "Light control supported";
}
if (capabilities.contains("CAP_SIDETONE")){
@@ -243,6 +223,11 @@ void MainWindow::loadDevice(int deviceIndex){
}
qDebug() << "Equalizer supported";
}
+ if (capabilities.contains("CAP_VOLUME_LIMITER")){
+ ui->volumelimiterFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(1, true);
+ qDebug() << "Volume limiter preset supported";
+ }
if (capabilities.contains("CAP_ROTATE_TO_MUTE")){
ui->rotatetomuteFrame->setHidden(false);
@@ -259,44 +244,20 @@ void MainWindow::loadDevice(int deviceIndex){
ui->tabWidget->setTabEnabled(2, true);
qDebug() << "Microphone volume supported";
}
-}
-
-void MainWindow::on_onlightButton_clicked()
-{
- QStringList args=QStringList() << QString("--light") << QString("1");
- sendCommand(args);
-}
-
-void MainWindow::on_offlightButton_clicked()
-{
- QStringList args=QStringList() << QString("--light") << QString("0");
- sendCommand(args);
-}
-void MainWindow::on_voiceOnButton_clicked()
-{
- QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
- sendCommand(args);
-}
-
-void MainWindow::on_voiceOffButton_clicked()
-{
- QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
- sendCommand(args);
-}
-
-void MainWindow::on_rotateOn_clicked()
-{
- QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
- sendCommand(args);
-}
-
-void MainWindow::on_rotateOff_clicked()
-{
- QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
- sendCommand(args);
+ if (capabilities.contains("CAP_BT_WHEN_POWERED_ON")){
+ ui->btwhenonFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(3, true);
+ qDebug() << "Bluetooth when powered on volume supported";
+ }
+ if (capabilities.contains("CAP_BT_CALL_VOLUME")){
+ ui->btcallvolumeFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(3, true);
+ qDebug() << "Bluetooth call volume volume supported";
+ }
}
+//Info Section Events
void MainWindow::setBatteryStatus()
{
QStringList args=QStringList() << QString("--battery");
@@ -328,7 +289,7 @@ void MainWindow::setBatteryStatus()
tray->setToolTip("HeadsetControl \r\nBattery Charging");
tray->setIcon(QIcon(":/icons/battery-charging-inv.png"));
}
- else {
+ else if(status == "BATTERY_AVAILABLE"){
ui->batteryPercentage->setText(level + "%");
tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
if (level.toInt() >= 70){
@@ -346,14 +307,55 @@ void MainWindow::setBatteryStatus()
notified = true;
}
}
+ } else{
+ ui->batteryPercentage->setText(status);
+ tray->setToolTip("HeadsetControl");
+ tray->setIcon(QIcon(":/icons/headphones-inv.png"));
}
}
+//Other Section Events
+void MainWindow::on_onlightButton_clicked()
+{
+ QStringList args=QStringList() << QString("--light") << QString("1");
+ sendCommand(args);
+}
+
+void MainWindow::on_offlightButton_clicked()
+{
+ QStringList args=QStringList() << QString("--light") << QString("0");
+ sendCommand(args);
+}
+
void MainWindow::on_sidetoneSlider_sliderReleased(){
QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
sendCommand(args);
}
+void MainWindow::on_voiceOnButton_clicked()
+{
+ QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
+ sendCommand(args);
+}
+
+void MainWindow::on_voiceOffButton_clicked()
+{
+ QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
+ sendCommand(args);
+}
+
+void MainWindow::on_rotateOn_clicked()
+{
+ QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
+ sendCommand(args);
+}
+
+void MainWindow::on_rotateOff_clicked()
+{
+ QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
+ sendCommand(args);
+}
+
void MainWindow::on_inactivitySlider_sliderReleased(){
QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
sendCommand(args);
@@ -371,6 +373,7 @@ void MainWindow::setChatmixStatus(){
ui->chatmixstatusLabel->setText(chatmixStatus);
}
+//Equalizer Section Events
void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
int preset=ui->equalizerPresetcomboBox->currentIndex()-1;
if(preset>=0 && preset<=3){
@@ -391,16 +394,6 @@ void MainWindow::on_applyEqualizer_clicked(){
sendCommand(args);
}
-void MainWindow::on_muteledbrightnessSlider_sliderReleased(){
- QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
- sendCommand(args);
-}
-
-void MainWindow::on_micvolumeSlider_sliderReleased(){
- QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
- sendCommand(args);
-}
-
void MainWindow::setSliders(QVector values){
int i=0;
if(values.length()<=slidersEq.length()){
@@ -413,17 +406,71 @@ void MainWindow::setSliders(QVector values){
}
}
-void MainWindow::showDialog(QString title, QLayout* layout){
- QDialog dialog;
- dialog.setWindowTitle(title);
- dialog.setWindowIcon(QIcon(":/icons/headphones.png"));
- dialog.setLayout(layout);
- QPushButton *closeButton = new QPushButton("Close");
- QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
- layout->addWidget(closeButton);
- dialog.exec();
+void MainWindow::clearLayout(QLayout* layout){
+ if (!layout) {
+ return;
+ }
+
+ QLayoutItem* item;
+ while ((item = layout->takeAt(0))) {
+ if (item->layout()) {
+ clearLayout(item->layout()); // Delete the layout if it exists
+ }
+ if (item->widget()) {
+ delete item->widget(); // Delete the widget
+ }
+ delete item; // Delete the layout item
+ }
+}
+
+void MainWindow::on_volumelimiterOffButton_clicked(){
+ QStringList args=QStringList() << QString("--volume-limiter") << QString("0");
+ sendCommand(args);
+}
+
+void MainWindow::on_volumelimiterOnButton_clicked(){
+ QStringList args=QStringList() << QString("--volume-limiter") << QString("1");
+ sendCommand(args);
+}
+
+//Microphone Section Events
+void MainWindow::on_muteledbrightnessSlider_sliderReleased(){
+ QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
+ sendCommand(args);
+}
+
+void MainWindow::on_micvolumeSlider_sliderReleased(){
+ QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
+ sendCommand(args);
+}
+
+//Bluetooth Section Events
+void MainWindow::on_btwhenonOffButton_clicked(){
+ QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("0");
+ sendCommand(args);
+}
+
+void MainWindow::on_btwhenonOnButton_clicked(){
+ QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("1");
+ sendCommand(args);
+}
+
+void MainWindow::on_btbothRadioButton_clicked(){
+ QStringList args=QStringList() << QString("--bt-call-volume") << QString("0");
+ sendCommand(args);
}
+void MainWindow::btpcdbRadioButton(){
+ QStringList args=QStringList() << QString("--bt-call-volume") << QString("1");
+ sendCommand(args);
+}
+
+void MainWindow::btonlyRadioButton(){
+ QStringList args=QStringList() << QString("--bt-call-volume") << QString("2");
+ sendCommand(args);
+}
+
+//Tool Bar Events
void MainWindow::selectDevice(){
QDialog dialog;
dialog.setWindowTitle("Select device to load");
@@ -457,23 +504,48 @@ void MainWindow::selectDevice(){
}
}
-void MainWindow::clearLayout(QLayout* layout){
- if (!layout) {
- return;
- }
-
- QLayoutItem* item;
- while ((item = layout->takeAt(0))) {
- if (item->layout()) {
- clearLayout(item->layout()); // Delete the layout if it exists
+void MainWindow::checkForUpdates(){
+ if(!jsonInfo.isEmpty()){
+ QVersionNumber local_hc=QVersionNumber::fromString(jsonInfo["version"].toString());
+ const QVersionNumber& local_gui=GUI_VERSION;
+ QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
+ QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
+ QVersionNumber remote_hc =QVersionNumber::fromString(v1);
+ QVersionNumber remote_gui =QVersionNumber::fromString(v2);
+ QString s1 = "up-to date v"+local_hc.toString();
+ QString s2 = "up-to date v"+local_gui.toString();
+ if(!(v1=="") && remote_hc>local_hc){
+ s1="Newer version ->"+remote_hc.toString()+"";
}
- if (item->widget()) {
- delete item->widget(); // Delete the widget
+ if(!(v2=="") && remote_gui>local_gui){
+ s2="Newer version ->"+remote_gui.toString()+"";
}
- delete item; // Delete the layout item
+ QVBoxLayout *layout = new QVBoxLayout;
+ QLabel *l1=new QLabel("HeadsetControl:\t\t"+s1);
+ l1->setTextFormat(Qt::RichText);
+ l1->setOpenExternalLinks(true);
+ l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ QLabel *l2=new QLabel("HeadsetControl-GUI:\t"+s2);
+ l2->setTextFormat(Qt::RichText);
+ l2->setOpenExternalLinks(true);
+ l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ layout->addWidget(l1);
+ layout->addWidget(l2);
+ showDialog("Check for updates",layout);
}
}
+void MainWindow::showDialog(QString title, QLayout* layout){
+ QDialog dialog;
+ dialog.setWindowTitle(title);
+ dialog.setWindowIcon(QIcon(":/icons/headphones.png"));
+ dialog.setLayout(layout);
+ QPushButton *closeButton = new QPushButton("Close");
+ QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
+ layout->addWidget(closeButton);
+ dialog.exec();
+}
+
void MainWindow::showAbout(){
QVBoxLayout *layout = new QVBoxLayout;
QLabel *l1 = new QLabel("This is a forked version of HeadsetControl-GUI.");
@@ -513,6 +585,7 @@ void MainWindow::showCredits(){
showDialog("Credit to",layout);
}
+
void MainWindow::changeEvent(QEvent* e)
{
switch (e->type())
diff --git a/mainwindow.h b/mainwindow.h
index eb5ddee..6fad250 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -9,7 +9,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.2.0");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.9.1");
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@@ -26,10 +26,13 @@ class MainWindow : public QMainWindow
QSystemTrayIcon *tray = new QSystemTrayIcon(this);
private:
- const int UPDATE_TIME=300000;
+ const int UPDATE_TIME=60000;
QMenu *menu;
Ui::MainWindow *uix;
+ QAction *ledOn;
+ QAction *ledOff;
+
int deviceQuantity=0;
int selectedDevice=-1;
QJsonObject jsonInfo;
@@ -47,8 +50,6 @@ private slots:
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
- void checkForUpdates();
-
QString sendCommand(QStringList args);
void disableFrames();
@@ -57,46 +58,67 @@ private slots:
void loadDevice(int deviceIndex=0);
+ void setBatteryStatus();
+
+ //Other Section Events
void on_onlightButton_clicked();
void on_offlightButton_clicked();
+ void on_sidetoneSlider_sliderReleased();
+
void on_voiceOnButton_clicked();
void on_voiceOffButton_clicked();
+ void on_inactivitySlider_sliderReleased();
+
void on_rotateOn_clicked();
void on_rotateOff_clicked();
- void setBatteryStatus();
-
- void on_sidetoneSlider_sliderReleased();
-
- void on_inactivitySlider_sliderReleased();
-
void setChatmixStatus();
+ //Equalizer Section Events
void on_equalizerPresetcomboBox_currentIndexChanged();
void on_applyEqualizer_clicked();
void setSliders(QVector values);
+ void clearLayout(QLayout* layout);
+
+ void on_volumelimiterOffButton_clicked();
+
+ void on_volumelimiterOnButton_clicked();
+
+ //Microphone Section Events
void on_muteledbrightnessSlider_sliderReleased();
void on_micvolumeSlider_sliderReleased();
- void showDialog(QString title, QLayout* layout);
+ //Bluetooth Section Events
+ void on_btwhenonOffButton_clicked();
- void showAbout();
+ void on_btwhenonOnButton_clicked();
- void showCredits();
+ void on_btbothRadioButton_clicked();
- void clearLayout(QLayout* layout);
+ void btpcdbRadioButton();
+
+ void btonlyRadioButton();
+
+ //Tool Bar Events
+ void checkForUpdates();
void selectDevice();
+ void showDialog(QString title, QLayout* layout);
+
+ void showAbout();
+
+ void showCredits();
+
private:
Ui::MainWindow *ui;
};
diff --git a/mainwindow.ui b/mainwindow.ui
index 6887a01..6f7495c 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,8 +6,8 @@
0
0
- 529
- 537
+ 512
+ 597
@@ -333,7 +333,7 @@ Model:
QTabWidget::North
- 0
+ 1
false
@@ -980,6 +980,80 @@ Model:
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
+
+ Volume Limiter:
+
+
+
+ -
+
+
-
+
+
+ Limiter Off
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Limiter On
+
+
+
+
+
+
+
+
@@ -1152,7 +1226,7 @@ Model:
-
- TextLabel
+ High
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -1263,6 +1337,197 @@ Model:
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ Bluetooth
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
+
+ Bluetooth when powered on:
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Bluetooth Off
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Bluetooth On
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 120
+ 16777215
+
+
+
+
+ 11
+ true
+
+
+
+ Bluetooth call volume:
+
+
+ true
+
+
+
+ -
+
+
-
+
+
-
+
+
+ BT and PC
+
+
+
+ -
+
+
+ PC -12dB
+
+
+
+ -
+
+
+ BT only
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
@@ -1274,7 +1539,7 @@ Model:
0
0
- 529
+ 512
25
From 09c5d7cf4d7bb312bb69db267a1ae392c5864f6d Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:47:29 +0200
Subject: [PATCH 12/64] Update README.md
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 894ffff..7787def 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Only if both these requirements are met, the GUI can work.
Start HeadsetControl-GUI by double-clicking "HeadsetControl-GUI.exe".
If your headset is supported and everything was set up correctly, you will be greeted by the only screen HeadsetControl-GUI has.
-![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/f0d3b4d3-ea55-42b7-9bf9-fe039fbcd104)
+![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/ce6a9628-4705-4a79-a262-8c43db2c92b0)
Here you can adjust all settings supported by your headset.
In my experience, these changes persist even after rebooting the system or turning the headset off.
@@ -33,12 +33,12 @@ If you have a wired headset and are finished changing settings, you can close th
If you have a wireless headset with support for battery levels, you can also minimize HeadsetControl-GUI to the system tray.
-![HeadsetControl-GUI in the system tray](https://i.imgur.com/83Apn66.jpg)
+![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/ea327c0a-e39a-4035-aa99-bc6325724571)
That way, you will be able to see the battery status at a glance and get a reminder when the batteries of your headset run low (below 30%).
Hovering over the tray icon will show you the current battery percentage. You can also right-click the tray icon to bring up a context menu with quick access to the light control. You can also open or completely close the GUI through the context menu.
-![The tray icon context menu](https://i.imgur.com/2IWhbfa.jpg)
+![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/0213a37c-806c-44d5-b8d7-5cc6b5d69407)
## Performance
While the concept of calling another app for every single interaction has some inherit overhead, HeadsetControl-GUI is very light on ressources.
@@ -49,7 +49,7 @@ Being open in the background, HeadsetControl-GUI consists of a single process th
## Building from source
To build HeadsetControl-GUI from source, you have to have a proper QT-ready development environment.
-I developed, built and tested the program with Qt 6.0.3, though there's no apparent reason why it wouldn't work with older or newer versions of Qt.
+I developed, built and tested the program with Qt 6.7.0, though there's no apparent reason why it wouldn't work with older or newer versions of Qt.
Clone the source code, import the project into Qt creator or your favourite IDE and build it.
## Support for other platforms
From 4ec8c3478570a4c007c6f72253ef21e3844d00e7 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:51:42 +0200
Subject: [PATCH 13/64] Update README.md
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 7787def..2ecc81d 100644
--- a/README.md
+++ b/README.md
@@ -44,8 +44,7 @@ Hovering over the tray icon will show you the current battery percentage. You ca
While the concept of calling another app for every single interaction has some inherit overhead, HeadsetControl-GUI is very light on ressources.
Being open in the background, HeadsetControl-GUI consists of a single process that uses virtually no CPU time and less than 8MB of system memory.
-![Screenshot of the background task in task manager](https://i.imgur.com/3PaxKF6.jpg)
-
+![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/f429ddf9-69be-42f0-a3f0-5ce9bd118d59)
## Building from source
To build HeadsetControl-GUI from source, you have to have a proper QT-ready development environment.
From c3487c0c36e42b6dda020c5bf22102f117cbd366 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 10 Jun 2024 21:37:18 +0200
Subject: [PATCH 14/64] Update HeadsetControl-GUI.pro.user
---
HeadsetControl-GUI.pro.user | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index cb02f90..ce56faf 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -83,6 +83,9 @@
true
+
+ true
+
From c6280f13e54752ea698255703dcc0284ca26375e Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 24 Jun 2024 12:22:39 +0200
Subject: [PATCH 15/64] Added device settings load and save; added loading
presets and equalizer
---
HeadsetControl-GUI.pro | 3 +
HeadsetControl-GUI.pro.user | 2 +-
device.cpp | 306 ++++++++++++++++++
device.h | 108 +++++++
mainwindow.cpp | 400 ++++++++++++++---------
mainwindow.h | 53 +--
mainwindow.ui | 623 ++++++++++++++++++++----------------
7 files changed, 1056 insertions(+), 439 deletions(-)
create mode 100644 device.cpp
create mode 100644 device.h
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index f4b1f38..378a5e8 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -10,11 +10,13 @@ CONFIG += c++11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
+ Device.cpp \
ghTools.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
+ Device.h \
ghTools.h \
mainwindow.h
@@ -35,5 +37,6 @@ RESOURCES += \
RC_FILE = myapp.rc
DISTFILES += \
+ .gitignore \
headphones-exe.ico \
myapp.rc
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index ce56faf..959d32b 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/device.cpp b/device.cpp
new file mode 100644
index 0000000..2562cd4
--- /dev/null
+++ b/device.cpp
@@ -0,0 +1,306 @@
+#include "Device.h"
+#include
+#include
+#include
+
+Battery::Battery(){
+
+}
+
+Battery::Battery(QString stat, int lev){
+ status=stat;
+ level=lev;
+}
+
+Equalizer::Equalizer(){
+
+}
+
+Equalizer::Equalizer(int bands, int baseline, double step, int min, int max){
+ bands_number=bands;
+ band_baseline=baseline;
+ band_min=min;
+ band_step=step;
+ band_max=max;
+}
+
+Device::Device(){
+
+}
+
+Device::Device(const QJsonObject& jsonObj, QString jsonData){
+ connected=jsonObj["status"].toString()=="succes";
+
+ device=jsonObj["device"].toString();
+ vendor=jsonObj["vendor"].toString();
+ product=jsonObj["product"].toString();
+ id_vendor=jsonObj["id_vendor"].toString();
+ id_product=jsonObj["id_product"].toString();
+
+ QJsonArray caps=jsonObj["capabilities"].toArray();
+ for (const QJsonValue &value : caps) {
+ capabilities.insert(value.toString());
+ }
+ if (capabilities.contains("CAP_BATTERY_STATUS")){
+ QJsonObject jEq=jsonObj["battery"].toObject();
+ battery=Battery(jEq["status"].toString(), jEq["level"].toInt());
+ }
+ if (capabilities.contains("CAP_CHATMIX_STATUS")){
+ chatmix=jsonObj["chatmix"].toInt();
+ }
+
+ if (capabilities.contains("CAP_EQUALIZER_PRESET")){
+ equalizer_preset=-1;QStringList presets;
+ if (jsonObj.contains("equalizer_presets") && jsonObj["equalizer_presets"].isObject()) {
+ QJsonObject equalizerPresets = jsonObj["equalizer_presets"].toObject();
+
+ // Parse the original JSON string to find the order of keys
+ QRegularExpression re("\"(\\w+)\":\\s*\\[");
+ QRegularExpressionMatchIterator i = re.globalMatch(jsonData);
+ while (i.hasNext()) {
+ QRegularExpressionMatch match = i.next();
+ QString presetName = match.captured(1);
+ if (equalizerPresets.contains(presetName)) {
+ EqualizerPreset preset;
+ preset.name = presetName;
+
+ QJsonArray valuesArray = equalizerPresets[presetName].toArray();
+ for (const QJsonValue& value : valuesArray) {
+ preset.values.append(value.toDouble());
+ }
+
+ presets_list.append(preset);
+ }
+ }
+ }
+ }
+ if (capabilities.contains("CAP_EQUALIZER")){
+ QJsonObject jEq=jsonObj["equalizer"].toObject();
+ if(!jEq.isEmpty()){
+ equalizer=Equalizer(jEq["bands"].toInt(), jEq["baseline"].toInt(), jEq["step"].toDouble(), jEq["min"].toInt(), jEq["max"].toInt());
+ equalizer_curve=QVector(equalizer.bands_number, equalizer.band_baseline);
+ }
+ }
+}
+
+//Helper functions
+bool Device::operator!=(const Device &d) const {
+ return this->id_vendor!=d.id_vendor || this->id_product!=d.id_product;
+}
+
+bool Device::operator==(const Device &d) const {
+ return this->id_vendor==d.id_vendor && this->id_product==d.id_product;
+}
+
+bool Device::operator==(const Device* d) const {
+ return this->id_vendor==d->id_vendor && this->id_product==d->id_product;
+}
+
+void Device::updateDevice(const Device* new_device){
+ this->battery=new_device->battery;
+ this->chatmix=new_device->chatmix;
+}
+
+void Device::updateDevice(const QList& new_device_list){
+ for (int i = 0; i < new_device_list.length(); ++i) {
+ if(this!=new_device_list.at(i)){
+ this->battery=new_device_list.at(i)->battery;
+ this->chatmix=new_device_list.at(i)->chatmix;
+ break;
+ }
+ }
+}
+
+QJsonObject Device::toJson() const {
+ QJsonObject json;
+ json["device"] = device;
+ json["vendor"] = vendor;
+ json["product"] = product;
+ json["id_vendor"] = id_vendor;
+ json["id_product"] = id_product;
+
+ json["lights"] = lights;
+ json["sidetone"] = sidetone;
+ json["voice_prompts"] = voice_prompts;
+ json["inactive_time"] = inactive_time;
+ json["equalizer_preset"] = equalizer_preset;
+ json["equalizer_curve"] = QJsonArray::fromVariantList(QVariantList(equalizer_curve.begin(), equalizer_curve.end()));
+ json["volume_limiter"] = volume_limiter;
+ json["rotate_to_mute"] = rotate_to_mute;
+ json["mic_mute_led_brightness"] = mic_mute_led_brightness;
+ json["mic_volume"] = mic_volume;
+ json["bt_when_powered_on"] = bt_when_powered_on;
+ json["bt_call_volume"] = bt_call_volume;
+
+ return json;
+}
+
+Device Device::fromJson(const QJsonObject& json) {
+ Device device;
+ device.device = json["device"].toString();
+ device.vendor = json["vendor"].toString();
+ device.product = json["product"].toString();
+ device.id_vendor = json["id_vendor"].toString();
+ device.id_product = json["id_product"].toString();
+
+ device.lights = json["lights"].toInt();
+ device.sidetone = json["sidetone"].toInt();
+ device.voice_prompts = json["voice_prompts"].toInt();
+ device.inactive_time = json["inactive_time"].toInt();
+ device.equalizer_preset = json["equalizer_preset"].toInt();
+
+ QJsonArray curveArray = json["equalizer_curve"].toArray();
+ for (const auto& value : curveArray) {
+ device.equalizer_curve.append(value.toInt());
+ }
+
+ device.volume_limiter = json["volume_limiter"].toInt();
+ device.rotate_to_mute = json["rotate_to_mute"].toInt();
+ device.mic_mute_led_brightness = json["mic_mute_led_brightness"].toInt();
+ device.mic_volume = json["mic_volume"].toInt();
+ device.bt_when_powered_on = json["bt_when_powered_on"].toInt();
+ device.bt_call_volume = json["bt_call_volume"].toInt();
+
+ return device;
+}
+
+//HC rleated functions
+QString 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("headsetcontrol", args);
+ proc->waitForFinished();
+ QString output=proc->readAllStandardOutput();
+ //qDebug() << args;
+ //qDebug() << output;
+ return output;
+}
+
+Action 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();
+ }
+
+ return action;
+}
+
+QVersionNumber getHCVersion(){
+ QStringList args=QStringList() << QString("--output") << QString("JSON");
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
+ QJsonObject jsonInfo=jsonDoc.object();
+ return QVersionNumber::fromString(jsonInfo["version"].toString());
+}
+
+QList getDevices(){
+ QList devices;
+
+ return devices;
+}
+
+QList mergeDevices(QList savedDevices, const QList connectedDevices) {
+ for (Device* connectedDevice : connectedDevices)
+ {
+ bool deviceFound = false;
+ for (Device* savedDevice : savedDevices)
+ {
+ bool uno=savedDevice->id_vendor==connectedDevice->id_vendor;
+ bool due=savedDevice->id_product==connectedDevice->id_product;
+ if (uno && due)
+ {
+ // Update the saved device with connected device's information
+ savedDevice->updateDevice(connectedDevice);
+ savedDevice->capabilities=connectedDevice->capabilities;
+ savedDevice->presets_list=connectedDevice->presets_list;
+ deviceFound = true;
+ break;
+ }
+ }
+
+ if (!deviceFound)
+ {
+ // If the device wasn't found in saved devices, add it
+ savedDevices.append(new Device(*connectedDevice));
+ }
+ }
+ // Sort the devices, connected devices first
+ std::sort(savedDevices.begin(), savedDevices.end(),
+ [](const Device* a, const Device* b) {
+ if (a->connected != b->connected) {
+ return a->connected > b->connected; // Connected devices first
+ }
+ // If connection status is the same, sort by vendor and product
+ if (a->vendor != b->vendor) {
+ return a->vendor < b->vendor;
+ }
+ return a->product < b->product;
+ });
+
+ return savedDevices;
+}
+
+QList getSavedDevices(){
+ return deserializeDevices("devices.json");
+}
+
+QList getConnectedDevices(){
+ QStringList args=QStringList() << QString("--output") << QString("JSON");
+ QString output = sendCommand(args);
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(output.toUtf8());
+ QJsonObject jsonInfo = jsonDoc.object();
+
+ int device_number = jsonInfo["device_count"].toInt();
+ QList devices;
+ QJsonArray jsonDevices = jsonInfo["devices"].toArray();
+ if(!jsonDoc.isNull()){
+ for (int i = 0; i < device_number; ++i) {
+ devices.append(new Device(jsonDevices[i].toObject(), output));
+ }
+ }
+
+ return devices;
+}
+
+void serializeDevices(const QList& devices, const QString& filename) {
+ QJsonArray jsonArray;
+ for (const auto* device : devices) {
+ jsonArray.append(device->toJson());
+ }
+
+ QJsonDocument doc(jsonArray);
+ QFile file(filename);
+ if (file.open(QIODevice::WriteOnly)) {
+ file.write(doc.toJson());
+ file.close();
+ }
+}
+
+QList deserializeDevices(const QString& filename) {
+ QList devices;
+ QFile file(filename);
+ if (file.open(QIODevice::ReadOnly)) {
+ QByteArray data = file.readAll();
+ QJsonDocument doc = QJsonDocument::fromJson(data);
+ QJsonArray jsonArray = doc.array();
+
+ for (const auto& value : jsonArray) {
+ Device* device = new Device(Device::fromJson(value.toObject()));
+ devices.append(device);
+ }
+
+ file.close();
+ }
+ return devices;
+}
diff --git a/device.h b/device.h
new file mode 100644
index 0000000..e1ba233
--- /dev/null
+++ b/device.h
@@ -0,0 +1,108 @@
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class Action{
+public:
+ QString capability;
+ QString device;
+ QString status;
+ QString error_message;
+};
+
+class Battery{
+public:
+ Battery();
+ Battery(QString stat, int lev);
+ QString status;
+ int level;
+};
+
+class EqualizerPreset{
+public:
+ QString name;
+ QList values;
+};
+
+class Equalizer{
+public:
+ Equalizer();
+ Equalizer(int bands, int baseline, double step, int min, int max);
+
+ int bands_number=10;
+ int band_baseline=0;
+ double band_step=0.5;
+ int band_min=-10;
+ int band_max=10;
+};
+
+class Device
+{
+public:
+ Device();
+ Device(const QJsonObject& jsonObj, QString jsonData);
+
+ //Status
+ bool connected;
+
+ //Basic info
+ QString device;
+ QString vendor;
+ QString product;
+ QString id_vendor;
+ QString id_product;
+ QSet capabilities;
+
+ //Info to get from json and display
+ Battery battery;
+ int chatmix;
+ QList presets_list;
+ Equalizer equalizer;
+ bool notification_sound=false;
+
+ //Info to set with gui and to save
+ int lights=-1;
+ int sidetone=-1;
+ int voice_prompts=-1;
+ int inactive_time=-1;
+ int equalizer_preset=-1;
+ QList equalizer_curve;
+ int volume_limiter=-1;
+ int rotate_to_mute=-1;
+ int mic_mute_led_brightness=-1;
+ int mic_volume=-1;
+ int bt_when_powered_on=-1;
+ int bt_call_volume=-1;
+
+ bool operator!=(const Device& d) const;
+ bool operator==(const Device &d) const;
+ bool operator==(const Device* d) const;
+
+ void updateDevice(const Device* new_device);
+ void updateDevice(const QList& new_device_list);
+
+ QJsonObject toJson() const;
+ static Device fromJson(const QJsonObject& json);
+};
+
+QString sendCommand(const QStringList& args_list);
+Action sendAction(const QStringList& args_list);
+
+QVersionNumber getHCVersion();
+
+
+QList getDevices();
+QList mergeDevices(QList savedDevices, const QList connectedDevices);
+QList getSavedDevices();
+QList getConnectedDevices();
+
+void serializeDevices(const QList& devices, const QString& filename);
+QList deserializeDevices(const QString& filename);
+
+#endif // DEVICE_H
diff --git a/mainwindow.cpp b/mainwindow.cpp
index db6d98c..3e091d7 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,5 +1,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
+#include "Device.h"
#include
#include
#include
@@ -20,7 +21,6 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
- uix=ui;
tray->setIcon(QIcon(":/icons/headphones-inv.png"));
tray->show();
@@ -47,12 +47,11 @@ MainWindow::MainWindow(QWidget *parent)
this->disableFrames();
this->loadDevices();
- if(deviceQuantity>0){
+ if(deviceList.length()){
this->loadDevice();
}
- ui->equalizerFrame->setDisabled(true);
- ui->equalizerpresetFrame->setDisabled(true);
+ ui->actionLoad_Device->setVisible(false);
}
MainWindow::~MainWindow()
@@ -60,16 +59,6 @@ MainWindow::~MainWindow()
delete ui;
}
-QString MainWindow::sendCommand(QStringList args){
- QProcess *proc = new QProcess();
- proc->start("headsetcontrol", args);
- proc->waitForFinished();
- QString output=proc->readAllStandardOutput();
- //qDebug() << args;
- //qDebug() << output;
- return output;
-}
-
void MainWindow::disableFrames(){
ledOn->setEnabled(false);
ledOff->setEnabled(false);
@@ -77,8 +66,9 @@ void MainWindow::disableFrames(){
ui->notSupportedFrame->setHidden(false);
ui->deviceinfoFrame->setHidden(true);
ui->batteryFrame->setHidden(true);
+ ui->savesettingsButton->setHidden(true);
- ui->tabWidget->hide();
+ //ui->tabWidget->hide();
ui->tabWidget->setTabEnabled(3, false);
ui->tabWidget->setTabEnabled(2, false);
ui->tabWidget->setTabEnabled(1, false);
@@ -86,6 +76,7 @@ void MainWindow::disableFrames(){
ui->lightFrame->setHidden(true);
ui->voicepromptFrame->setHidden(true);
+ ui->notificationFrame->setHidden(true);
ui->sidetoneFrame->setHidden(true);
ui->inactivityFrame->setHidden(true);
ui->chatmixFrame->setHidden(true);
@@ -93,6 +84,7 @@ void MainWindow::disableFrames(){
ui->equalizerpresetFrame->setHidden(true);
ui->equalizerFrame->setHidden(true);
+ ui->applyEqualizer->setEnabled(false);
ui->rotatetomuteFrame->setHidden(true);
ui->muteledbrightnessFrame->setHidden(true);
@@ -103,60 +95,49 @@ void MainWindow::disableFrames(){
}
void MainWindow::loadDevices(){
+ deviceList=mergeDevices(getSavedDevices(), getConnectedDevices());
+}
- QStringList args=QStringList() << QString("--output") << QString("JSON");
- //args=QStringList() << QString("--test-device") << QString("0") << QString("--output") << QString("JSON"); //Uncomment this to enable all "modules"
-
- QJsonDocument jsonDoc = QJsonDocument::fromJson(sendCommand(args).toUtf8());
- jsonInfo=jsonDoc.object();
+void MainWindow::updateDevice(){
+ //serializeDevices(deviceList, "devices.json");
+ QList newDl=getConnectedDevices();
+ selectedDevice->updateDevice(newDl);
+}
- if(!jsonDoc.isNull()){
- deviceQuantity=jsonInfo["device_count"].toInt();
- deviceList=jsonInfo["devices"].toArray();
- }
+void MainWindow::updateGUI(){
+ setBatteryStatus();
+ setChatmixStatus();
}
void MainWindow::loadDevice(int deviceIndex){
if(deviceIndex<0) return;
- Ui::MainWindow *ui=uix;
-
- usingDevice=deviceList[deviceIndex].toObject();
- QJsonArray caps=usingDevice["capabilities"].toArray();
- QSet capabilities;
- for (const QJsonValue &value : caps) {
- capabilities.insert(value.toString());
- //qDebug()<& capabilities=selectedDevice->capabilities;
- if(timerBattery!=nullptr){
- timerBattery->stop();
- timerBattery=nullptr;
- }
- if(timerChatmix!=nullptr){
- timerChatmix->stop();
- timerChatmix=nullptr;
+ if(timerGUI!=nullptr){
+ timerGUI->stop();
+ timerGUI=nullptr;
}
+ timerGUI = new QTimer(this);
+ connect(timerGUI, SIGNAL(timeout()), this, SLOT(updateDevice()));
+ connect(timerGUI, SIGNAL(timeout()), this, SLOT(updateGUI()));
+ timerGUI->start(UPDATE_TIME);
ui->notSupportedFrame->setHidden(true);
- QString device, vendor, product;
- device=usingDevice["device"].toString();
- vendor=usingDevice["vendor"].toString();
- product=usingDevice["product"].toString();
- ui->deviceinfovalueLabel->setText(device+"\n"+vendor+"\n"+product);
+ //Inffo section
+ ui->deviceinfovalueLabel->setText(selectedDevice->device+"\n"+selectedDevice->vendor+"\n"+selectedDevice->product);
ui->deviceinfoFrame->setHidden(false);
+ ui->savesettingsButton->setHidden(false);
if (capabilities.contains("CAP_BATTERY_STATUS")){
ui->batteryFrame->setHidden(false);
- timerBattery = new QTimer(this);
- connect(timerBattery, SIGNAL(timeout()), this, SLOT(setBatteryStatus()));
- timerBattery->start(UPDATE_TIME);
this->setBatteryStatus();
qDebug() << "Battery percentage supported";
}
- ui->tabWidget->show();
-
+ //ui->tabWidget->show();
+ //Other Section
if (capabilities.contains("CAP_LIGHTS")){
ui->lightFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
@@ -172,7 +153,12 @@ void MainWindow::loadDevice(int deviceIndex){
if (capabilities.contains("CAP_VOICE_PROMPTS")){
ui->voicepromptFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
- qDebug() << "Voice prompt control supported";
+ qDebug() << "Voice prompt supported";
+ }
+ if (capabilities.contains("CAP_NOTIFICATION_SOUND")){
+ ui->notificationFrame->setHidden(false);
+ ui->tabWidget->setTabEnabled(0, true);
+ qDebug() << "Notification sound supported";
}
if (capabilities.contains("CAP_INACTIVE_TIME")){
ui->inactivityFrame->setHidden(false);
@@ -182,13 +168,10 @@ void MainWindow::loadDevice(int deviceIndex){
if (capabilities.contains("CAP_CHATMIX_STATUS")){
ui->chatmixFrame->setHidden(false);
ui->tabWidget->setTabEnabled(0, true);
- timerChatmix = new QTimer(this);
- connect(timerChatmix, SIGNAL(timeout()), this, SLOT(setChatmixStatus()));
- timerChatmix->start(UPDATE_TIME);
this->setChatmixStatus();
qDebug() << "Chatmix supported";
}
-
+ //Eualizer Section
if (capabilities.contains("CAP_EQUALIZER_PRESET")){
ui->equalizerpresetFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
@@ -197,30 +180,6 @@ void MainWindow::loadDevice(int deviceIndex){
if (capabilities.contains("CAP_EQUALIZER")){
ui->equalizerFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
- int n=10;
- int max=10;
- int min=-10;
- QHBoxLayout *equalizerLayout = ui->equalizerLayout;
- clearLayout(equalizerLayout);
- for (int var = 0; var < n; ++var) {
- QVBoxLayout *lb = new QVBoxLayout();
- QSlider *s = new QSlider(Qt::Vertical);
- s->setMaximum(max);
- s->setMinimum(min);
- s->setValue((max+min)/2);
- s->setTickInterval(max/2);
- s->setTickPosition(QSlider::TicksBothSides);
- QLabel *l = new QLabel(QString::number(var));
- l->setFixedSize(30, 20);
- l->setStyleSheet("QLabel {\nmin-width: 30px;\nmax-width: 30px;\n}");
- l->setAlignment(Qt::AlignHCenter);
-
- lb->addWidget(l);
- lb->addWidget(s);
-
- slidersEq.append(s);
- equalizerLayout->addLayout(lb);
- }
qDebug() << "Equalizer supported";
}
if (capabilities.contains("CAP_VOLUME_LIMITER")){
@@ -228,7 +187,7 @@ void MainWindow::loadDevice(int deviceIndex){
ui->tabWidget->setTabEnabled(1, true);
qDebug() << "Volume limiter preset supported";
}
-
+ //Microphone Section
if (capabilities.contains("CAP_ROTATE_TO_MUTE")){
ui->rotatetomuteFrame->setHidden(false);
ui->tabWidget->setTabEnabled(2, true);
@@ -244,7 +203,7 @@ void MainWindow::loadDevice(int deviceIndex){
ui->tabWidget->setTabEnabled(2, true);
qDebug() << "Microphone volume supported";
}
-
+ //Bluetooth Section
if (capabilities.contains("CAP_BT_WHEN_POWERED_ON")){
ui->btwhenonFrame->setHidden(false);
ui->tabWidget->setTabEnabled(3, true);
@@ -255,30 +214,109 @@ void MainWindow::loadDevice(int deviceIndex){
ui->tabWidget->setTabEnabled(3, true);
qDebug() << "Bluetooth call volume volume supported";
}
+
+ loadGUIValues();
}
-//Info Section Events
-void MainWindow::setBatteryStatus()
-{
- QStringList args=QStringList() << QString("--battery");
- QString batteryStatus = sendCommand(args);
+void MainWindow::loadGUIValues(){
+ if(selectedDevice->lights>=0){
+ ui->onlightButton->setChecked(selectedDevice->lights);
+ ui->offlightButton->setChecked(!selectedDevice->lights);
+ }
+ if(selectedDevice->sidetone>=0){
+ ui->sidetoneSlider->setSliderPosition(selectedDevice->sidetone);
+ }
+ if(selectedDevice->voice_prompts>=0){
+ ui->voiceOnButton->setChecked(selectedDevice->voice_prompts);
+ ui->voiceOffButton->setChecked(!selectedDevice->voice_prompts);
+ }
+ if(selectedDevice->inactive_time>=0){
+ ui->inactivitySlider->setSliderPosition(selectedDevice->inactive_time);
+ }
- QStringList lines = batteryStatus.split("\n");
+ ui->equalizerPresetcomboBox->clear();
+ ui->equalizerPresetcomboBox->addItem("-");
+ ui->equalizerPresetcomboBox->setCurrentIndex(0);
+ for (int i = 0; i < selectedDevice->presets_list.size(); ++i) {
+ ui->equalizerPresetcomboBox->addItem(selectedDevice->presets_list.at(i).name);
+ }
+ if(selectedDevice->equalizer_preset>=0){
+ ui->equalizerPresetcomboBox->setCurrentIndex(selectedDevice->equalizer_preset);
+ }
+
+ QHBoxLayout *equalizerLayout = ui->equalizerLayout;
+ clearLayout(equalizerLayout);
+ int i;
+ for (i = 0; i < selectedDevice->equalizer.bands_number; ++i) {
+ QVBoxLayout *lb = new QVBoxLayout();
+ QSlider *s = new QSlider(Qt::Vertical);
+ s->setMaximum(selectedDevice->equalizer.band_max);
+ s->setMinimum(selectedDevice->equalizer.band_min);
+ s->setSingleStep(selectedDevice->equalizer.band_step);
+ s->setTickInterval(selectedDevice->equalizer.band_step);
+ s->setTickPosition(QSlider::TicksBothSides);
+ if(selectedDevice->equalizer_curve.size()==selectedDevice->equalizer.bands_number){
+ s->setValue(selectedDevice->equalizer_curve.value(i));
+ } else{
+ s->setValue(selectedDevice->equalizer.band_baseline);
+ }
- // Extract the status value
- QString statusLine = lines[3];
- QStringList statusParts = statusLine.split(": ");
- QString status = statusParts[1].trimmed();
+ QLabel *l = new QLabel(QString::number(i));
+ l->setAlignment(Qt::AlignHCenter);
+
+ lb->addWidget(l);
+ lb->addWidget(s);
+
+ slidersEq.append(s);
+ equalizerLayout->addLayout(lb);
+ }
+ if(i!=0){
+ ui->applyEqualizer->setEnabled(true);
+ }
- QString level="none";
- if(status != "BATTERY_UNAVAILABLE"){
- // Extract the level value
- QString levelLine = lines[4];
- QStringList levelParts = levelLine.split(": ");
- level = levelParts[1].trimmed();
- level.remove("%");
+ if(selectedDevice->volume_limiter>=0){
+ ui->volumelimiterOnButton->setChecked(selectedDevice->volume_limiter);
+ ui->volumelimiterOffButton->setChecked(!selectedDevice->volume_limiter);
}
+ if(selectedDevice->rotate_to_mute>=0){
+ ui->rotateOn->setChecked(selectedDevice->rotate_to_mute);
+ ui->rotateOff->setChecked(!selectedDevice->rotate_to_mute);
+ }
+ if(selectedDevice->mic_mute_led_brightness>=0){
+ ui->muteledbrightnessSlider->setSliderPosition(selectedDevice->mic_mute_led_brightness);
+ }
+ if(selectedDevice->mic_volume>=0){
+ ui->micvolumeSlider->setSliderPosition(selectedDevice->mic_volume);
+ }
+
+ if(selectedDevice->bt_call_volume>=0){
+ switch (selectedDevice->bt_call_volume) {
+ case 0:
+ ui->btbothRadioButton->setChecked(true);
+ break;
+ case 1:
+ ui->btpcdbRadioButton->setChecked(true);
+ break;
+ case 2:
+ ui->btonlyRadioButton->setChecked(true);
+ break;
+ default:
+ break;
+ }
+ }
+ if(selectedDevice->bt_when_powered_on>=0){
+ ui->btwhenonOnButton->setChecked(selectedDevice->bt_when_powered_on);
+ ui->btwhenonOffButton->setChecked(!selectedDevice->bt_when_powered_on);
+ }
+}
+
+//Info Section Events
+void MainWindow::setBatteryStatus()
+{
+ QString status=selectedDevice->battery.status;
+ QString level=QString::number(selectedDevice->battery.level);
+
if (status == "BATTERY_UNAVAILABLE"){
ui->batteryPercentage->setText("Headset Off");
tray->setToolTip("HeadsetControl \r\nHeadset Off");
@@ -292,11 +330,10 @@ void MainWindow::setBatteryStatus()
else if(status == "BATTERY_AVAILABLE"){
ui->batteryPercentage->setText(level + "%");
tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
- if (level.toInt() >= 70){
+ if (level.toInt() >= 75){
tray->setIcon(QIcon(":/icons/battery-level-full-inv.png"));
- notified = false;
}
- else if (level.toInt() >= 30) {
+ else if (level.toInt() >= 25) {
tray->setIcon(QIcon(":/icons/battery-medium-inv.png"));
notified = false;
}
@@ -314,87 +351,136 @@ void MainWindow::setBatteryStatus()
}
}
+void MainWindow::on_savesettingsButton_clicked(){
+ serializeDevices(deviceList, "devices.json");
+}
+
//Other Section Events
void MainWindow::on_onlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->lights=1;
}
void MainWindow::on_offlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->lights=0;
}
void MainWindow::on_sidetoneSlider_sliderReleased(){
QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->sidetone=ui->sidetoneSlider->value();
}
void MainWindow::on_voiceOnButton_clicked()
{
QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->voice_prompts=1;
}
void MainWindow::on_voiceOffButton_clicked()
{
QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->voice_prompts=0;
+}
+
+void MainWindow::on_notification0ButtonButton_clicked()
+{
+ QStringList args=QStringList() << QString("--notificate") << QString("0");
+ Action s=sendAction(args);
+ if(s.status!="success"){
+
+ }
+}
+
+void MainWindow::on_notification1ButtonButton_clicked()
+{
+ QStringList args=QStringList() << QString("--notificate") << QString("1");
+ Action s=sendAction(args);
+ if(s.status!="success"){
+
+ }
}
void MainWindow::on_rotateOn_clicked()
{
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->rotate_to_mute=1;
}
void MainWindow::on_rotateOff_clicked()
{
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->rotate_to_mute=0;
}
void MainWindow::on_inactivitySlider_sliderReleased(){
QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->inactive_time=ui->inactivitySlider->value();
}
void MainWindow::setChatmixStatus(){
- Ui::MainWindow *ui=uix;
- QStringList args=QStringList() << QString("--chatmix");
- QString chatmixValue= sendCommand(args);
- int value=chatmixValue.mid(chatmixValue.indexOf(':')+1).toInt();
- ui->chatmixvalueLabel->setText(QString::number(value));
- QString chatmixStatus="";
- if(value<65)chatmixStatus="Game";
- else if(value>65)chatmixStatus="Chat";
- ui->chatmixstatusLabel->setText(chatmixStatus);
+ int chatmix = selectedDevice->chatmix;
+ QString chatmixValue = QString::number(chatmix);
+ QString chatmixStatus;
+ if(chatmix<65)chatmixStatus="Game";
+ else if(chatmix>65)chatmixStatus="Chat";
+ ui->chatmixstatusLabel->setText(chatmixValue+" "+chatmixStatus);
}
//Equalizer Section Events
void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
- int preset=ui->equalizerPresetcomboBox->currentIndex()-1;
- if(preset>=0 && preset<=3){
- this->setSliders(flat);
- QStringList args=QStringList() << QString("--equalizer-preset") << QString::number(preset);
- sendCommand(args);
+ int preset=ui->equalizerPresetcomboBox->currentIndex();
+ if(preset==0){
+ //setSliders(selectedDevice->equalizer.band_baseline);
+ } else if(preset>=1 && preset<=selectedDevice->presets_list.length()){
+ this->setSliders(selectedDevice->presets_list.value(preset-1).values);
+ QStringList args=QStringList() << QString("--equalizer-preset") << QString::number(preset-1);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->equalizer_preset=ui->equalizerPresetcomboBox->currentIndex();
}
}
void MainWindow::on_applyEqualizer_clicked(){
- uix->equalizerPresetcomboBox->setCurrentIndex(0);
- QString s="";
+ ui->equalizerPresetcomboBox->setCurrentIndex(0);
+ QString eq_string="";
+ QList values;
for (QSlider* slider : slidersEq) {
- s+= QString::number(slider->value())+",";
+ eq_string+= QString::number(slider->value())+",";
+ values.append(slider->value());
}
- s.removeLast();
- QStringList args=QStringList() << QString("--equalizer") << s;
- sendCommand(args);
+ eq_string.removeLast();
+ QStringList args=QStringList() << QString("--equalizer") << eq_string;
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->equalizer_curve=values;
}
-void MainWindow::setSliders(QVector values){
+void MainWindow::setSliders(int value){
+ for (QSlider* slider : slidersEq) {
+ slider->setValue(value);
+ }
+}
+
+void MainWindow::setSliders(QList values){
int i=0;
if(values.length()<=slidersEq.length()){
for (QSlider* slider : slidersEq) {
@@ -425,49 +511,67 @@ void MainWindow::clearLayout(QLayout* layout){
void MainWindow::on_volumelimiterOffButton_clicked(){
QStringList args=QStringList() << QString("--volume-limiter") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->volume_limiter=0;
}
void MainWindow::on_volumelimiterOnButton_clicked(){
QStringList args=QStringList() << QString("--volume-limiter") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->volume_limiter=1;
}
//Microphone Section Events
void MainWindow::on_muteledbrightnessSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->mic_mute_led_brightness=ui->muteledbrightnessSlider->value();
}
void MainWindow::on_micvolumeSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->mic_volume=ui->micvolumeSlider->value();
}
//Bluetooth Section Events
void MainWindow::on_btwhenonOffButton_clicked(){
QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->bt_when_powered_on=0;
}
void MainWindow::on_btwhenonOnButton_clicked(){
QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->bt_when_powered_on=1;
}
void MainWindow::on_btbothRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("0");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->bt_call_volume=0;
}
-void MainWindow::btpcdbRadioButton(){
+void MainWindow::on_btpcdbRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("1");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->bt_call_volume=1;
}
-void MainWindow::btonlyRadioButton(){
+void MainWindow::on_btonlyRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("2");
- sendCommand(args);
+ Action s=sendAction(args);
+ if(s.status=="success")
+ selectedDevice->bt_call_volume=2;
}
//Tool Bar Events
@@ -481,8 +585,8 @@ void MainWindow::selectDevice(){
layout.addWidget(&labelWidget);
QStringList devices=QStringList();
- for (int i = 0; i < deviceQuantity; ++i){
- devices<device;
}
QComboBox comboBox;
@@ -496,17 +600,16 @@ void MainWindow::selectDevice(){
QObject::connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
if (dialog.exec() == QDialog::Accepted) {
- selectedDevice = comboBox.currentIndex();
- if (selectedDevice>=0 && selectedDevice=0) {
this->disableFrames();
- this->loadDevice(selectedDevice);
+ this->loadDevice(index);
}
}
}
void MainWindow::checkForUpdates(){
- if(!jsonInfo.isEmpty()){
- QVersionNumber local_hc=QVersionNumber::fromString(jsonInfo["version"].toString());
+ const QVersionNumber& local_hc=getHCVersion();
const QVersionNumber& local_gui=GUI_VERSION;
QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
@@ -532,7 +635,6 @@ void MainWindow::checkForUpdates(){
layout->addWidget(l1);
layout->addWidget(l2);
showDialog("Check for updates",layout);
- }
}
void MainWindow::showDialog(QString title, QLayout* layout){
diff --git a/mainwindow.h b/mainwindow.h
index 6fad250..497a9f0 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -2,6 +2,7 @@
#define MAINWINDOW_H
#include "ghTools.h"
+#include "Device.h"
#include
#include
#include
@@ -12,7 +13,9 @@
const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.9.1");
QT_BEGIN_NAMESPACE
-namespace Ui { class MainWindow; }
+namespace Ui {
+ class MainWindow;
+}
QT_END_NAMESPACE
class MainWindow : public QMainWindow
@@ -23,43 +26,45 @@ class MainWindow : public QMainWindow
MainWindow(QWidget *parent = nullptr);
~MainWindow();
bool notified = false;
- QSystemTrayIcon *tray = new QSystemTrayIcon(this);
+ QSystemTrayIcon* tray = new QSystemTrayIcon(this);
private:
- const int UPDATE_TIME=60000;
+ const int UPDATE_TIME=30000;
+
QMenu *menu;
- Ui::MainWindow *uix;
- QAction *ledOn;
- QAction *ledOff;
+ QAction* ledOn;
+ QAction* ledOff;
- int deviceQuantity=0;
- int selectedDevice=-1;
- QJsonObject jsonInfo;
- QJsonArray deviceList;
- QJsonObject usingDevice;
- QVector slidersEq;
+ Device* selectedDevice;
+ QList deviceList;
+ QList slidersEq;
- QTimer *timerBattery;
- QTimer *timerChatmix;
+ QTimer* timerGUI;
- QVector flat={0,0,0,0,0,0,0,0,0,0};
+ QList flat={0,0,0,0,0,0,0,0,0,0};
private slots:
void changeEvent(QEvent *e);
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
- QString sendCommand(QStringList args);
-
void disableFrames();
void loadDevices();
+ void loadGUIValues();
+
+ void updateDevice();
+
+ void updateGUI();
+
void loadDevice(int deviceIndex=0);
void setBatteryStatus();
+ void on_savesettingsButton_clicked();
+
//Other Section Events
void on_onlightButton_clicked();
@@ -71,6 +76,10 @@ private slots:
void on_voiceOffButton_clicked();
+ void on_notification0ButtonButton_clicked();
+
+ void on_notification1ButtonButton_clicked();
+
void on_inactivitySlider_sliderReleased();
void on_rotateOn_clicked();
@@ -84,7 +93,9 @@ private slots:
void on_applyEqualizer_clicked();
- void setSliders(QVector values);
+ void setSliders(int value);
+
+ void setSliders(QList values);
void clearLayout(QLayout* layout);
@@ -104,9 +115,9 @@ private slots:
void on_btbothRadioButton_clicked();
- void btpcdbRadioButton();
+ void on_btpcdbRadioButton_clicked();
- void btonlyRadioButton();
+ void on_btonlyRadioButton_clicked();
//Tool Bar Events
void checkForUpdates();
@@ -120,6 +131,6 @@ private slots:
void showCredits();
private:
- Ui::MainWindow *ui;
+ Ui::MainWindow* ui;
};
#endif // MAINWINDOW_H
diff --git a/mainwindow.ui b/mainwindow.ui
index 6f7495c..486f85a 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,8 +6,8 @@
0
0
- 512
- 597
+ 616
+ 659
@@ -99,7 +99,7 @@
- HeadsetControl couldn't find any compatible headsets. :(
+ HeadsetControl couldn't find any compatible or working headsets. :(
Qt::AlignCenter
@@ -110,213 +110,234 @@
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 150
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 120
- 0
-
-
-
-
- 11
- true
-
-
-
- Device:
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 150
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
+
+ Device:
Vendor:
Model:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 300
- 0
-
-
-
-
- 300
- 16777215
-
-
-
-
-
-
- No info of the device
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 50
-
-
-
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
- 6
-
-
- 9
-
-
- 9
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 120
- 0
-
-
-
-
- 120
- 16777215
-
-
-
-
- 11
- true
-
-
-
- Battery:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 200
- 16777215
-
-
-
-
-
-
- No compatible Device found!
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 300
+ 0
+
+
+
+
+ 300
+ 16777215
+
+
+
+
+
+
+ No info of the device
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 50
+
+
+
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ 6
+
+
+ 9
+
+
+ 9
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 120
+ 16777215
+
+
+
+
+ 11
+ true
+
+
+
+ Battery:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 16777215
+
+
+
+
+
+
+ No compatible Device found!
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Save Settings
+
+
+
+
-
@@ -324,7 +345,7 @@ Model:
true
-
+
0
0
@@ -333,7 +354,7 @@ Model:
QTabWidget::North
- 1
+ 0
false
@@ -345,6 +366,12 @@ Model:
false
+
+
+ 0
+ 0
+
+
Other
@@ -399,7 +426,7 @@ Model:
-
-
+
120
@@ -425,7 +452,7 @@ Model:
-
-
+
120
@@ -607,7 +634,7 @@ Model:
-
-
-
+
120
@@ -633,7 +660,7 @@ Model:
-
-
+
120
@@ -650,6 +677,77 @@ Model:
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 0
+
+
+
+
+ 11
+ true
+
+
+
+ Notification Sound:
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Test 0
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Test 1
+
+
+
+
+
+
+
+
-
@@ -838,6 +936,12 @@ Model:
+
+
+ 0
+ 0
+
+
Equalizer
@@ -884,31 +988,6 @@ Model:
0
-
-
-
- -
-
-
- -
-
- Flat
-
-
- -
-
- Bass
-
-
- -
-
- Smiley
-
-
- -
-
- Focus
-
-
-
@@ -983,7 +1062,7 @@ Model:
-
-
+
0
0
@@ -1023,7 +1102,7 @@ Model:
-
-
-
+
Limiter Off
@@ -1043,7 +1122,7 @@ Model:
-
-
+
Limiter On
@@ -1057,6 +1136,12 @@ Model:
+
+
+ 0
+ 0
+
+
Microphone
@@ -1105,9 +1190,9 @@ Model:
-
-
+
- Rotate-to-Mute Off
+ Rotate to Mute Off
@@ -1125,9 +1210,9 @@ Model:
-
-
+
- Rotate-to-Mute On
+ Rotate to Mute On
@@ -1136,6 +1221,12 @@ Model:
-
+
+
+ 0
+ 0
+
+
QFrame::StyledPanel
@@ -1196,9 +1287,6 @@ Model:
QSlider::TicksBelow
-
- 1
-
-
@@ -1242,6 +1330,12 @@ Model:
-
+
+
+ 0
+ 0
+
+
QFrame::StyledPanel
@@ -1337,22 +1431,15 @@ Model:
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
+
+
+ 0
+ 0
+
+
Bluetooth
@@ -1360,7 +1447,7 @@ Model:
-
-
+
0
0
@@ -1403,7 +1490,7 @@ Model:
-
-
-
+
Bluetooth Off
@@ -1423,7 +1510,7 @@ Model:
-
-
+
Bluetooth On
@@ -1437,7 +1524,7 @@ Model:
-
-
+
0
0
@@ -1539,7 +1626,7 @@ Model:
0
0
- 512
+ 616
25
@@ -1578,7 +1665,7 @@ Model:
- false
+ true
Load Device
From 7108380921ece1b68bb3605e596b660af74bf1f8 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 24 Jun 2024 12:39:37 +0200
Subject: [PATCH 16/64] Small error fix
---
HeadsetControl-GUI.pro.user | 2 +-
mainwindow.cpp | 2 +-
mainwindow.ui | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index 959d32b..a4180c6 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 3e091d7..bfb6131 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -482,7 +482,7 @@ void MainWindow::setSliders(int value){
void MainWindow::setSliders(QList values){
int i=0;
- if(values.length()<=slidersEq.length()){
+ if(values.length()<=selectedDevice->equalizer.bands_number){
for (QSlider* slider : slidersEq) {
slider->setValue(values[i++]);
}
diff --git a/mainwindow.ui b/mainwindow.ui
index 486f85a..d523efd 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -988,6 +988,9 @@ Model:
0
+
+ -1
+
-
From 33461166b3691750f698eaa5cb17cae8dbdb8e71 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Mon, 24 Jun 2024 12:46:15 +0200
Subject: [PATCH 17/64] Update version number
---
mainwindow.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mainwindow.h b/mainwindow.h
index 497a9f0..f904604 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -10,7 +10,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.9.1");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.10.0");
QT_BEGIN_NAMESPACE
namespace Ui {
From 2638359f48baf72bc21b565f154ccf2b7484daba Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Thu, 27 Jun 2024 14:28:17 +0200
Subject: [PATCH 18/64] Preset fix
---
HeadsetControl-GUI.pro | 21 +++++--------
HeadsetControl-GUI.pro.user | 60 +++++++------------------------------
main.cpp | 9 ------
mainwindow.cpp | 4 ++-
4 files changed, 21 insertions(+), 73 deletions(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 378a5e8..c15c453 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -1,13 +1,8 @@
-QT += core gui
-QT += core network
-
+QT += core gui network
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
-CONFIG += c++11
-
-# You can make your code fail to compile if it uses deprecated APIs.
-# In order to do so, uncomment the following line.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+CONFIG += static c++11
+QMAKE_LFLAGS += -static
SOURCES += \
Device.cpp \
@@ -26,11 +21,6 @@ FORMS += \
TRANSLATIONS += \
HeadsetControl-GUI_en_US.ts
-# Default rules for deployment.
-qnx: target.path = /tmp/$${TARGET}/bin
-else: unix:!android: target.path = /opt/$${TARGET}/bin
-!isEmpty(target.path): INSTALLS += target
-
RESOURCES += \
icons.qrc
@@ -40,3 +30,8 @@ DISTFILES += \
.gitignore \
headphones-exe.ico \
myapp.rc
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index a4180c6..e25f911 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 0
+ 1
0
0
@@ -139,50 +139,9 @@
2
- 0
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Profile
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Profile
-
-
- true
- QtProjectManager.QMakeBuildStep
- true
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- false
-
- Profile
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
- 0
-
-
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Release
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Release
+ 1
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
true
@@ -217,10 +176,11 @@
Release
Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
+ 2
+ 1
+ 1
- 3
+ 2
0
@@ -251,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
1
diff --git a/main.cpp b/main.cpp
index fd2c98e..546a05a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,15 +1,6 @@
#include "mainwindow.h"
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
int main(int argc, char *argv[])
{
diff --git a/mainwindow.cpp b/mainwindow.cpp
index bfb6131..a1f5519 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -470,8 +470,10 @@ void MainWindow::on_applyEqualizer_clicked(){
eq_string.removeLast();
QStringList args=QStringList() << QString("--equalizer") << eq_string;
Action s=sendAction(args);
- if(s.status=="success")
+ if(s.status=="success"){
selectedDevice->equalizer_curve=values;
+ selectedDevice->equalizer_preset=-1;
+ }
}
void MainWindow::setSliders(int value){
From 75cdefbdc76b46c67dc260190b5d4e24dcd17208 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Wed, 10 Jul 2024 14:45:51 +0200
Subject: [PATCH 19/64] Reorganized code and added support for light/dark mode
---
HeadsetControl-GUI.pro | 3 +
dialoginfo.cpp | 25 +++++
dialoginfo.h | 26 +++++
dialoginfo.ui | 122 ++++++++++++++++++++++
mainwindow.cpp | 174 +++++++++++++++++--------------
mainwindow.h | 9 +-
mainwindow.ui | 231 +++++++++++++++++++++++------------------
7 files changed, 410 insertions(+), 180 deletions(-)
create mode 100644 dialoginfo.cpp
create mode 100644 dialoginfo.h
create mode 100644 dialoginfo.ui
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index c15c453..e113388 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -6,16 +6,19 @@ QMAKE_LFLAGS += -static
SOURCES += \
Device.cpp \
+ dialoginfo.cpp \
ghTools.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
Device.h \
+ dialoginfo.h \
ghTools.h \
mainwindow.h
FORMS += \
+ dialoginfo.ui \
mainwindow.ui
TRANSLATIONS += \
diff --git a/dialoginfo.cpp b/dialoginfo.cpp
new file mode 100644
index 0000000..f994d24
--- /dev/null
+++ b/dialoginfo.cpp
@@ -0,0 +1,25 @@
+#include "dialoginfo.h"
+#include "ui_dialoginfo.h"
+
+dialogInfo::dialogInfo(QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::dialogInfo)
+{
+ setModal(true);
+ ui->setupUi(this);
+}
+
+dialogInfo::~dialogInfo()
+{
+ delete ui;
+}
+
+void dialogInfo::setTitle(const QString& title)
+{
+ this->setWindowTitle(title);
+}
+
+void dialogInfo::setLabel(const QString& text)
+{
+ ui->label->setText(text);
+}
diff --git a/dialoginfo.h b/dialoginfo.h
new file mode 100644
index 0000000..067dad3
--- /dev/null
+++ b/dialoginfo.h
@@ -0,0 +1,26 @@
+#ifndef DIALOGINFO_H
+#define DIALOGINFO_H
+
+#include
+
+namespace Ui {
+class dialogInfo;
+}
+
+class dialogInfo : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit dialogInfo(QWidget *parent = nullptr);
+ ~dialogInfo();
+
+ void setTitle(const QString& title);
+
+ void setLabel(const QString& text);
+
+private:
+ Ui::dialogInfo *ui;
+};
+
+#endif // DIALOGINFO_H
diff --git a/dialoginfo.ui b/dialoginfo.ui
new file mode 100644
index 0000000..1e45cc8
--- /dev/null
+++ b/dialoginfo.ui
@@ -0,0 +1,122 @@
+
+
+ dialogInfo
+
+
+
+ 0
+ 0
+ 305
+ 66
+
+
+
+
+ 0
+ 0
+
+
+
+ Dialog
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ Qt::TextBrowserInteraction
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Close
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ dialogInfo
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ dialogInfo
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
index a1f5519..c433777 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,6 +1,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "Device.h"
+#include "dialoginfo.h"
#include
#include
#include
@@ -22,7 +23,18 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
- tray->setIcon(QIcon(":/icons/headphones-inv.png"));
+ darkMode = isOsDarkMode();
+
+ if(darkMode){
+ this->setWindowIcon(QIcon(":/icons/headphones-inv.png"));
+ trayIconPath = ":/icons/headphones-inv.png";
+ }
+ else{
+ this->setWindowIcon(QIcon(":/icons/headphones.png"));
+ trayIconPath = ":/icons/headphones.png";
+ }
+ tray->setIcon(QIcon(trayIconPath));
+
tray->show();
tray->setToolTip("HeadsetControl");
@@ -59,6 +71,16 @@ MainWindow::~MainWindow()
delete ui;
}
+bool MainWindow::isOsDarkMode(){
+ // Check if the application is using a dark palette
+ QPalette palette = QApplication::palette();
+ QColor textColor = palette.color(QPalette::WindowText);
+ QColor backgroundColor = palette.color(QPalette::Window);
+
+ // If text is brighter than background, it's likely a dark theme
+ return textColor.lightness() > backgroundColor.lightness();
+}
+
void MainWindow::disableFrames(){
ledOn->setEnabled(false);
ledOff->setEnabled(false);
@@ -104,6 +126,20 @@ void MainWindow::updateDevice(){
selectedDevice->updateDevice(newDl);
}
+void MainWindow::updateIcons(){
+ QString inv = "";
+ if(darkMode){
+ inv = "-inv";
+ trayIconPath.replace(".png", "-inv.png");
+ }
+ else{
+ trayIconPath.replace("-inv.png", ".png");
+ }
+
+ this->setWindowIcon(QIcon(":/icons/headphones"+inv+".png"));
+ tray->setIcon(QIcon(trayIconPath));
+}
+
void MainWindow::updateGUI(){
setBatteryStatus();
setChatmixStatus();
@@ -314,31 +350,36 @@ void MainWindow::loadGUIValues(){
//Info Section Events
void MainWindow::setBatteryStatus()
{
- QString status=selectedDevice->battery.status;
- QString level=QString::number(selectedDevice->battery.level);
+ QString status = selectedDevice->battery.status;
+ int batteryLevel = selectedDevice->battery.level;
+ QString level=QString::number(batteryLevel);
+
+ if(batteryLevel>=0){
+ ui->batteryProgressBar->setValue(batteryLevel);
+ }
if (status == "BATTERY_UNAVAILABLE"){
ui->batteryPercentage->setText("Headset Off");
tray->setToolTip("HeadsetControl \r\nHeadset Off");
- tray->setIcon(QIcon(":/icons/headphones-inv.png"));
+ trayIconPath =":/icons/headphones-inv.png";
}
else if (status == "BATTERY_CHARGING") {
ui->batteryPercentage->setText("Headset Charging "+level+"%");
tray->setToolTip("HeadsetControl \r\nBattery Charging");
- tray->setIcon(QIcon(":/icons/battery-charging-inv.png"));
+ trayIconPath = ":/icons/battery-charging-inv.png";
}
else if(status == "BATTERY_AVAILABLE"){
ui->batteryPercentage->setText(level + "%");
tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
if (level.toInt() >= 75){
- tray->setIcon(QIcon(":/icons/battery-level-full-inv.png"));
+ trayIconPath = ":/icons/battery-level-full-inv.png";
}
else if (level.toInt() >= 25) {
- tray->setIcon(QIcon(":/icons/battery-medium-inv.png"));
+ trayIconPath = ":/icons/battery-medium-inv.png";
notified = false;
}
else {
- tray->setIcon(QIcon(":/icons/battery-low-inv.png"));
+ trayIconPath = ":/icons/battery-low-inv.png";
if (!notified){
tray->showMessage("Battery Alert!", "The battery of your headset is running low", QIcon(":/icons/battery-low-inv.png"));
notified = true;
@@ -347,8 +388,13 @@ void MainWindow::setBatteryStatus()
} else{
ui->batteryPercentage->setText(status);
tray->setToolTip("HeadsetControl");
- tray->setIcon(QIcon(":/icons/headphones-inv.png"));
+ trayIconPath = ":/icons/headphones-inv.png";
}
+
+ if(!darkMode){
+ trayIconPath.replace("-inv", "");
+ }
+ tray->setIcon(QIcon(trayIconPath));
}
void MainWindow::on_savesettingsButton_clicked(){
@@ -611,82 +657,50 @@ void MainWindow::selectDevice(){
}
void MainWindow::checkForUpdates(){
- const QVersionNumber& local_hc=getHCVersion();
- const QVersionNumber& local_gui=GUI_VERSION;
- QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
- QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
- QVersionNumber remote_hc =QVersionNumber::fromString(v1);
- QVersionNumber remote_gui =QVersionNumber::fromString(v2);
- QString s1 = "up-to date v"+local_hc.toString();
- QString s2 = "up-to date v"+local_gui.toString();
- if(!(v1=="") && remote_hc>local_hc){
- s1="Newer version ->"+remote_hc.toString()+"";
- }
- if(!(v2=="") && remote_gui>local_gui){
- s2="Newer version ->"+remote_gui.toString()+"";
- }
- QVBoxLayout *layout = new QVBoxLayout;
- QLabel *l1=new QLabel("HeadsetControl:\t\t"+s1);
- l1->setTextFormat(Qt::RichText);
- l1->setOpenExternalLinks(true);
- l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
- QLabel *l2=new QLabel("HeadsetControl-GUI:\t"+s2);
- l2->setTextFormat(Qt::RichText);
- l2->setOpenExternalLinks(true);
- l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
- layout->addWidget(l1);
- layout->addWidget(l2);
- showDialog("Check for updates",layout);
-}
-
-void MainWindow::showDialog(QString title, QLayout* layout){
- QDialog dialog;
- dialog.setWindowTitle(title);
- dialog.setWindowIcon(QIcon(":/icons/headphones.png"));
- dialog.setLayout(layout);
- QPushButton *closeButton = new QPushButton("Close");
- QObject::connect(closeButton, &QPushButton::clicked, &dialog, &QDialog::accept);
- layout->addWidget(closeButton);
- dialog.exec();
-}
+ dialogInfo* dialog=new dialogInfo(this);
+ dialog->setTitle("Check for updates");
-void MainWindow::showAbout(){
- QVBoxLayout *layout = new QVBoxLayout;
- QLabel *l1 = new QLabel("This is a forked version of HeadsetControl-GUI.");
- l1->setTextFormat(Qt::RichText);
- l1->setOpenExternalLinks(true);
- l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ const QVersionNumber& local_hc=getHCVersion();
+ const QVersionNumber& local_gui=GUI_VERSION;
+ QString v1 = getLatestGitHubReleaseVersion("Sapd","HeadsetControl");
+ QString v2 = getLatestGitHubReleaseVersion("nicola02nb","HeadsetControl-GUI");
+ QVersionNumber remote_hc =QVersionNumber::fromString(v1);
+ QVersionNumber remote_gui =QVersionNumber::fromString(v2);
+ QString s1 = "up-to date v"+local_hc.toString();
+ QString s2 = "up-to date v"+local_gui.toString();
+ if(!(v1=="") && remote_hc>local_hc){
+ s1="Newer version ->"+remote_hc.toString()+"";
+ }
+ if(!(v2=="") && remote_gui>local_gui){
+ s2="Newer version ->"+remote_gui.toString()+"";
+ }
+
+ QString text = "HeadesetControl: "+s1+"
HeadesetControl-GUI: "+s2;
+ dialog->setLabel(text);
- QLabel *l2=new QLabel("Made by nicola02nb");
- l2->setTextFormat(Qt::RichText);
- l2->setOpenExternalLinks(true);
- l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
- QLabel *version=new QLabel("Version: "+GUI_VERSION.toString());
+ dialog->show();
+}
- layout->addWidget(l1);
- layout->addWidget(l2);
- layout->addWidget(version);
+void MainWindow::showAbout(){
+ dialogInfo* dialog=new dialogInfo(this);
+ dialog->setTitle("About this program");
+ QString text = "This is a forked version of HeadsetControl-GUI."
+ "
Made by nicola02nb"
+ "
Version: "+GUI_VERSION.toString();
+ dialog->setLabel(text);
- showDialog("About this program",layout);
+ dialog->show();
}
void MainWindow::showCredits(){
- QVBoxLayout *layout = new QVBoxLayout;
- QLabel *infoLabel = new QLabel("Big shout-out to:");
- QLabel *l1=new QLabel(" - Sapd for HeadsetCoontrol");
- l1->setTextFormat(Qt::RichText);
- l1->setOpenExternalLinks(true);
- l1->setTextInteractionFlags(Qt::TextBrowserInteraction);
- QLabel *l2=new QLabel(" - LeoKlaus for HeadsetControl-GUI");
- l2->setTextFormat(Qt::RichText);
- l2->setOpenExternalLinks(true);
- l2->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ dialogInfo* dialog=new dialogInfo(this);
+ dialog->setTitle("Credits");
+ QString text = "Big shout-out to:"
+ "
- Sapd for HeadsetCoontrol"
+ "
- LeoKlaus for HeadsetControl-GUI";
+ dialog->setLabel(text);
- layout->addWidget(infoLabel);
- layout->addWidget(l1);
- layout->addWidget(l2);
-
- showDialog("Credit to",layout);
+ dialog->show();
}
@@ -706,6 +720,12 @@ void MainWindow::changeEvent(QEvent* e)
break;
}
+ case QEvent::PaletteChange:
+ {
+ darkMode = isOsDarkMode();
+ updateIcons();
+ break;
+ }
default:
break;
}
diff --git a/mainwindow.h b/mainwindow.h
index f904604..5563c1a 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -31,6 +31,9 @@ class MainWindow : public QMainWindow
private:
const int UPDATE_TIME=30000;
+ bool darkMode;
+ QString trayIconPath;
+
QMenu *menu;
QAction* ledOn;
@@ -49,6 +52,8 @@ private slots:
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
+ bool isOsDarkMode();
+
void disableFrames();
void loadDevices();
@@ -57,6 +62,8 @@ private slots:
void updateDevice();
+ void updateIcons();
+
void updateGUI();
void loadDevice(int deviceIndex=0);
@@ -124,8 +131,6 @@ private slots:
void selectDevice();
- void showDialog(QString title, QLayout* layout);
-
void showAbout();
void showCredits();
diff --git a/mainwindow.ui b/mainwindow.ui
index d523efd..1788657 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -7,7 +7,7 @@
0
0
616
- 659
+ 669
@@ -37,6 +37,9 @@
+
+
+
@@ -72,10 +75,10 @@
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -102,7 +105,7 @@
HeadsetControl couldn't find any compatible or working headsets. :(
- Qt::AlignCenter
+ Qt::AlignmentFlag::AlignCenter
@@ -128,10 +131,10 @@
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -192,10 +195,10 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSizePolicy::Expanding
+ QSizePolicy::Policy::Expanding
@@ -229,10 +232,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
@@ -274,42 +277,56 @@ Model:
Battery:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 200
- 16777215
-
-
-
-
-
-
- No compatible Device found!
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
+
+
-
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 16777215
+
+
+
+
+
+
+ No compatible Device found!
+
+
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+
+
+
+ -
+
+
+ 0
+
+
+ false
+
+
+
+
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -351,7 +368,7 @@ Model:
- QTabWidget::North
+ QTabWidget::TabPosition::North
0
@@ -385,10 +402,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -421,7 +438,7 @@ Model:
Lights:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -441,7 +458,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -476,10 +493,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -506,14 +523,14 @@ Model:
Sidetone Level:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
- QLayout::SetDefaultConstraint
+ QLayout::SizeConstraint::SetDefaultConstraint
-
@@ -530,10 +547,10 @@ Model:
16
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
16
@@ -552,7 +569,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -565,13 +582,13 @@ Model:
-
- Qt::LeftToRight
+ Qt::LayoutDirection::LeftToRight
Loud
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -591,10 +608,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -627,7 +644,7 @@ Model:
Voice Prompts:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -649,7 +666,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -680,10 +697,10 @@ Model:
-
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -726,7 +743,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -757,10 +774,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -787,7 +804,7 @@ Model:
Inactivity Timer:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -802,10 +819,10 @@ Model:
90
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
10
@@ -824,7 +841,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -840,7 +857,7 @@ Model:
90 Minutes
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -860,10 +877,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -920,7 +937,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -955,10 +972,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -996,7 +1013,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1018,10 +1035,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1071,10 +1088,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1114,7 +1131,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1158,10 +1175,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1188,7 +1205,7 @@ Model:
Rotate to mute:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -1202,7 +1219,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1231,10 +1248,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1267,7 +1284,7 @@ Model:
false
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
true
@@ -1285,10 +1302,10 @@ Model:
1
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
@@ -1304,7 +1321,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1320,7 +1337,7 @@ Model:
High
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -1340,10 +1357,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1385,10 +1402,10 @@ Model:
16
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
16
@@ -1407,7 +1424,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1423,7 +1440,7 @@ Model:
Loud
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -1456,10 +1473,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1502,7 +1519,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1533,10 +1550,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1608,7 +1625,7 @@ Model:
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1630,7 +1647,7 @@ Model:
0
0
616
- 25
+ 33
+
+
+
Check Updates
+
+
+
About
+
+
+
Credits
@@ -1670,6 +1696,9 @@ Model:
true
+
+
+
Load Device
From b0b5bc820e462183d775602e1f8b7971e8a75888 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Thu, 11 Jul 2024 10:09:30 +0200
Subject: [PATCH 20/64] Small fix
---
HeadsetControl-GUI.pro.user | 6 +-
device.h | 10 +--
mainwindow.cpp | 4 +-
mainwindow.ui | 152 ++++++++++++++++++------------------
4 files changed, 86 insertions(+), 86 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index e25f911..a060f81 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 1
+ 0
0
0
@@ -211,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
1
diff --git a/device.h b/device.h
index e1ba233..fdf84a1 100644
--- a/device.h
+++ b/device.h
@@ -35,11 +35,11 @@ class Equalizer{
Equalizer();
Equalizer(int bands, int baseline, double step, int min, int max);
- int bands_number=10;
- int band_baseline=0;
- double band_step=0.5;
- int band_min=-10;
- int band_max=10;
+ int bands_number;
+ int band_baseline;
+ double band_step;
+ int band_min;
+ int band_max;
};
class Device
diff --git a/mainwindow.cpp b/mainwindow.cpp
index c433777..c68cc96 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -208,12 +208,12 @@ void MainWindow::loadDevice(int deviceIndex){
qDebug() << "Chatmix supported";
}
//Eualizer Section
- if (capabilities.contains("CAP_EQUALIZER_PRESET")){
+ if (capabilities.contains("CAP_EQUALIZER_PRESET") && !selectedDevice->presets_list.empty()){
ui->equalizerpresetFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
qDebug() << "Eqaulizer preset supported";
}
- if (capabilities.contains("CAP_EQUALIZER")){
+ if (capabilities.contains("CAP_EQUALIZER") && selectedDevice->equalizer.bands_number!=0){
ui->equalizerFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
qDebug() << "Equalizer supported";
diff --git a/mainwindow.ui b/mainwindow.ui
index 1788657..4e303c5 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -75,10 +75,10 @@
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -105,7 +105,7 @@
HeadsetControl couldn't find any compatible or working headsets. :(
- Qt::AlignmentFlag::AlignCenter
+ Qt::AlignCenter
@@ -131,10 +131,10 @@
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -195,10 +195,10 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSizePolicy::Policy::Expanding
+ QSizePolicy::Expanding
@@ -232,10 +232,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
@@ -277,7 +277,7 @@ Model:
Battery:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -307,7 +307,7 @@ Model:
No compatible Device found!
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -317,7 +317,7 @@ Model:
0
- false
+ true
@@ -326,7 +326,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -368,7 +368,7 @@ Model:
- QTabWidget::TabPosition::North
+ QTabWidget::North
0
@@ -402,10 +402,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -438,7 +438,7 @@ Model:
Lights:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -458,7 +458,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -493,10 +493,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -523,14 +523,14 @@ Model:
Sidetone Level:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
- QLayout::SizeConstraint::SetDefaultConstraint
+ QLayout::SetDefaultConstraint
-
@@ -547,10 +547,10 @@ Model:
16
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
16
@@ -569,7 +569,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -582,13 +582,13 @@ Model:
-
- Qt::LayoutDirection::LeftToRight
+ Qt::LeftToRight
Loud
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -608,10 +608,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -644,7 +644,7 @@ Model:
Voice Prompts:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -666,7 +666,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -697,10 +697,10 @@ Model:
-
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -743,7 +743,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -774,10 +774,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -804,7 +804,7 @@ Model:
Inactivity Timer:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -819,10 +819,10 @@ Model:
90
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
10
@@ -841,7 +841,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -857,7 +857,7 @@ Model:
90 Minutes
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -877,10 +877,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -937,7 +937,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -972,10 +972,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1013,7 +1013,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1035,10 +1035,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1088,10 +1088,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1131,7 +1131,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1175,10 +1175,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1205,7 +1205,7 @@ Model:
Rotate to mute:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -1219,7 +1219,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1248,10 +1248,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1284,7 +1284,7 @@ Model:
false
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
true
@@ -1302,10 +1302,10 @@ Model:
1
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
@@ -1321,7 +1321,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1337,7 +1337,7 @@ Model:
High
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -1357,10 +1357,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1402,10 +1402,10 @@ Model:
16
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
16
@@ -1424,7 +1424,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1440,7 +1440,7 @@ Model:
Loud
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -1473,10 +1473,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1519,7 +1519,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1550,10 +1550,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1625,7 +1625,7 @@ Model:
-
- Qt::Orientation::Vertical
+ Qt::Vertical
@@ -1647,7 +1647,7 @@ Model:
0
0
616
- 33
+ 25
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
@@ -1029,7 +1048,7 @@ Model:
-
-
+
0
0
@@ -1451,6 +1470,19 @@ Model:
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
From b0e716a73e4c1035464a647a165b005adba8e5a1 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 16 Jul 2024 15:25:39 +0200
Subject: [PATCH 22/64] Added check for headsetcontrol.exe on startup,
---
HeadsetControl-GUI.pro | 10 +-
HeadsetControl-GUI.pro.user | 2 +-
...UI_en_US.ts => HeadsetControl_GUI_en_US.ts | 0
dialoginfo.ui | 43 ++++---
ghTools.cpp | 33 ------
ghTools.h | 8 --
mainwindow.cpp | 45 +++++---
mainwindow.h | 8 +-
mainwindow.ui | 41 +++++--
tools.cpp | 108 ++++++++++++++++++
tools.h | 14 +++
11 files changed, 220 insertions(+), 92 deletions(-)
rename HeadsetControl-GUI_en_US.ts => HeadsetControl_GUI_en_US.ts (100%)
delete mode 100644 ghTools.cpp
delete mode 100644 ghTools.h
create mode 100644 tools.cpp
create mode 100644 tools.h
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index e113388..e4bffe5 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -7,22 +7,22 @@ QMAKE_LFLAGS += -static
SOURCES += \
Device.cpp \
dialoginfo.cpp \
- ghTools.cpp \
main.cpp \
- mainwindow.cpp
+ mainwindow.cpp \
+ tools.cpp
HEADERS += \
Device.h \
dialoginfo.h \
- ghTools.h \
- mainwindow.h
+ mainwindow.h \
+ tools.h
FORMS += \
dialoginfo.ui \
mainwindow.ui
TRANSLATIONS += \
- HeadsetControl-GUI_en_US.ts
+ HeadsetControl_GUI_en_US.ts
RESOURCES += \
icons.qrc
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index a060f81..b42792f 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/HeadsetControl-GUI_en_US.ts b/HeadsetControl_GUI_en_US.ts
similarity index 100%
rename from HeadsetControl-GUI_en_US.ts
rename to HeadsetControl_GUI_en_US.ts
diff --git a/dialoginfo.ui b/dialoginfo.ui
index 1e45cc8..28ad3f6 100644
--- a/dialoginfo.ui
+++ b/dialoginfo.ui
@@ -21,26 +21,33 @@
-
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- Qt::TextBrowserInteraction
-
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ Qt::TextBrowserInteraction
+
+
+
+
-
-
+
-
diff --git a/ghTools.cpp b/ghTools.cpp
deleted file mode 100644
index 901c5f1..0000000
--- a/ghTools.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "ghTools.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo)
-{
- QEventLoop loop;
- QNetworkAccessManager manager;
- QNetworkRequest request(QUrl(QString("https://api.github.com/repos/%1/%2/releases/latest").arg(owner, repo)));
- request.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0");
-
- QNetworkReply *reply = manager.get(request);
- QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
- loop.exec();
-
- if (reply->error() == QNetworkReply::NoError) {
- QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
- QJsonObject jsonObj = doc.object();
- QString latestVersion = jsonObj.value("tag_name").toString();
- reply->deleteLater();
- return latestVersion;
- } else {
- qDebug() << "Error:" << reply->errorString();
- reply->deleteLater();
- return QString();
- }
-}
diff --git a/ghTools.h b/ghTools.h
deleted file mode 100644
index 6eb1596..0000000
--- a/ghTools.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef GHTOOLS_H
-#define GHTOOLS_H
-
-#include
-
-QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo);
-
-#endif // GHTOOLS_H
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 464a2d4..3d31eec 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -40,16 +40,12 @@ MainWindow::MainWindow(QWidget *parent)
menu = new QMenu(nullptr);
menu->addAction("Show", this, SLOT(show()));
- ledOn = menu->addAction("Turn Lights On", this, SLOT(on_onButton_clicked()));
- ledOff = menu->addAction("Turn Lights Off", this, SLOT(on_offButton_clicked()));
+ ledOn = menu->addAction("Turn Lights On", this, &MainWindow::on_onlightButton_clicked);
+ ledOff = menu->addAction("Turn Lights Off", this, &MainWindow::on_offlightButton_clicked);
menu->addAction("Exit", this, SLOT(close()));
tray->setContextMenu(menu);
-
- connect(tray, SIGNAL(DoubleClick), this, SLOT(show()));
-
- tray->connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
- SLOT(RestoreWindowTrigger(QSystemTrayIcon::ActivationReason)));
+ tray->connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
@@ -58,6 +54,16 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionLoad_Device, &QAction::triggered, this, &MainWindow::selectDevice);
this->disableFrames();
+
+ if(!fileExists("headsetcontrol.exe")){
+ openFileExplorer(".");
+ dialogInfo* dialog=new dialogInfo(this);
+ dialog->setTitle("Missing headsetcontrol.exe");
+ dialog->setLabel("Missing headsetcontrol.exe
"
+ "Download headsetcontrol in the opened folder.");
+ dialog->exec();
+ }
+
this->loadDevices();
if(deviceList.length()){
this->loadDevice();
@@ -71,6 +77,13 @@ MainWindow::~MainWindow()
delete ui;
}
+void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ if (reason == QSystemTrayIcon::DoubleClick) {
+ show();
+ }
+}
+
bool MainWindow::isOsDarkMode(){
// Check if the application is using a dark palette
QPalette palette = QApplication::palette();
@@ -355,8 +368,12 @@ void MainWindow::setBatteryStatus()
QString level=QString::number(batteryLevel);
if(batteryLevel>=0){
+ ui->batteryProgressBar->show();
ui->batteryProgressBar->setValue(batteryLevel);
}
+ else{
+ ui->batteryProgressBar->hide();
+ }
if (status == "BATTERY_UNAVAILABLE"){
ui->batteryPercentage->setText("Headset Off");
@@ -364,17 +381,17 @@ void MainWindow::setBatteryStatus()
trayIconPath =":/icons/headphones-inv.png";
}
else if (status == "BATTERY_CHARGING") {
- ui->batteryPercentage->setText("Headset Charging "+level+"%");
+ ui->batteryPercentage->setText(level+"% - Charging");
tray->setToolTip("HeadsetControl \r\nBattery Charging");
trayIconPath = ":/icons/battery-charging-inv.png";
}
else if(status == "BATTERY_AVAILABLE"){
- ui->batteryPercentage->setText(level + "%");
+ ui->batteryPercentage->setText(level+"% - Descharging");
tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
- if (level.toInt() >= 75){
+ if (level.toInt() > 75){
trayIconPath = ":/icons/battery-level-full-inv.png";
}
- else if (level.toInt() >= 25) {
+ else if (level.toInt() > 15) {
trayIconPath = ":/icons/battery-medium-inv.png";
notified = false;
}
@@ -386,7 +403,7 @@ void MainWindow::setBatteryStatus()
}
}
} else{
- ui->batteryPercentage->setText(status);
+ ui->batteryPercentage->setText("No battery info");
tray->setToolTip("HeadsetControl");
trayIconPath = ":/icons/headphones-inv.png";
}
@@ -441,7 +458,7 @@ void MainWindow::on_voiceOffButton_clicked()
selectedDevice->voice_prompts=0;
}
-void MainWindow::on_notification0ButtonButton_clicked()
+void MainWindow::on_notification0Button_clicked()
{
QStringList args=QStringList() << QString("--notificate") << QString("0");
Action s=sendAction(args);
@@ -450,7 +467,7 @@ void MainWindow::on_notification0ButtonButton_clicked()
}
}
-void MainWindow::on_notification1ButtonButton_clicked()
+void MainWindow::on_notification1Button_clicked()
{
QStringList args=QStringList() << QString("--notificate") << QString("1");
Action s=sendAction(args);
diff --git a/mainwindow.h b/mainwindow.h
index 5563c1a..9848c94 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -1,7 +1,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include "ghTools.h"
+#include "tools.h"
#include "Device.h"
#include
#include
@@ -52,6 +52,8 @@ private slots:
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
+ void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
+
bool isOsDarkMode();
void disableFrames();
@@ -83,9 +85,9 @@ private slots:
void on_voiceOffButton_clicked();
- void on_notification0ButtonButton_clicked();
+ void on_notification0Button_clicked();
- void on_notification1ButtonButton_clicked();
+ void on_notification1Button_clicked();
void on_inactivitySlider_sliderReleased();
diff --git a/mainwindow.ui b/mainwindow.ui
index a5691d3..fbd9fbb 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -2,16 +2,19 @@
MainWindow
+
+ Qt::NonModal
+
0
0
616
- 669
+ 699
-
+
0
0
@@ -34,6 +37,9 @@
:/icons/headphones-inv.png:/icons/headphones-inv.png
+
+ Qt::LeftToRight
+
@@ -119,7 +125,7 @@
-
-
+
0
0
@@ -127,7 +133,7 @@
16777215
- 150
+ 16777215
@@ -167,14 +173,14 @@ Model:
-
-
+
0
0
- 300
+ 0
0
@@ -217,7 +223,7 @@ Model:
true
-
+
0
0
@@ -225,7 +231,7 @@ Model:
16777215
- 50
+ 16777215
@@ -289,7 +295,7 @@ Model:
true
-
+
0
0
@@ -300,24 +306,39 @@ Model:
16777215
+
+ false
+
No compatible Device found!
+
+ false
+
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+ false
+
-
+
+
+ 0
+ 0
+
+
0
- true
+ false
diff --git a/tools.cpp b/tools.cpp
new file mode 100644
index 0000000..2d741c1
--- /dev/null
+++ b/tools.cpp
@@ -0,0 +1,108 @@
+#include "tools.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo)
+{
+ QEventLoop loop;
+ QNetworkAccessManager manager;
+ QNetworkRequest request(QUrl(QString("https://api.github.com/repos/%1/%2/releases/latest").arg(owner, repo)));
+ request.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0");
+
+ QNetworkReply *reply = manager.get(request);
+ QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
+ loop.exec();
+
+ if (reply->error() == QNetworkReply::NoError) {
+ QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
+ QJsonObject jsonObj = doc.object();
+ QString latestVersion = jsonObj.value("tag_name").toString();
+ reply->deleteLater();
+ return latestVersion;
+ } else {
+ qDebug() << "Error:" << reply->errorString();
+ reply->deleteLater();
+ return QString();
+ }
+}
+
+bool fileExists(const QString& filepath)
+{
+ QFileInfo checkFile(filepath);
+ return checkFile.exists();
+}
+
+bool downloadAndUnzipGithubRepo(const QString& user, const QString& repo, const QString& savePath)
+{
+ // Step 1: Download the zip file
+ QString url = QString("https://github.com/%1/%2/archive/refs/heads/headsetcontrol-windows.zip").arg(user, repo);
+ QString zipFilePath = savePath + "/headsetcontrol-windows.zip";
+
+ url= "https://github.com/Sapd/HeadsetControl/releases/download/3.0.0/headsetcontrol-windows.zip";
+ QNetworkAccessManager manager;
+ QEventLoop loop;
+ QNetworkReply *reply = manager.get(QNetworkRequest(QUrl(url)));
+ QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
+ loop.exec();
+
+ if (reply->error() != QNetworkReply::NoError) {
+ qDebug() << "Download Error:" << reply->errorString();
+ reply->deleteLater();
+ return false;
+ }
+
+ QFile file(zipFilePath);
+ if (!file.open(QIODevice::WriteOnly)) {
+ qDebug() << "Could not open file for writing:" << file.errorString();
+ reply->deleteLater();
+ return false;
+ }
+
+ file.write(reply->readAll());
+ file.close();
+ reply->deleteLater();
+
+ // Step 2: Unzip the file
+ QDir().mkpath(savePath);
+ QProcess unzip;
+ unzip.setWorkingDirectory(savePath);
+ unzip.start("unzip", QStringList() << "-o" << zipFilePath << "-d" << savePath);
+ if (!unzip.waitForFinished()) {
+ qDebug() << "Unzip Error:" << unzip.errorString();
+ return false;
+ }
+
+ // Optional: Remove the zip file after extraction
+ QFile::remove(zipFilePath);
+
+ return true;
+}
+
+bool openFileExplorer(const QString& path)
+{
+ QDir dir(path);
+ if (!dir.exists())
+ {
+ qDebug() << "Path does not exist:" << path;
+ return false;
+ }
+
+ QUrl url = QUrl::fromLocalFile(dir.absolutePath());
+ return QDesktopServices::openUrl(url);
+}
+
diff --git a/tools.h b/tools.h
new file mode 100644
index 0000000..989ae29
--- /dev/null
+++ b/tools.h
@@ -0,0 +1,14 @@
+#ifndef TOOLS_H
+#define TOOLS_H
+
+#include
+
+QString getLatestGitHubReleaseVersion(const QString& owner, const QString& repo);
+
+bool downloadAndUnzipGithubRepo(const QString& user, const QString& repo, const QString& savePath);
+
+bool fileExists(const QString& filepath);
+
+bool openFileExplorer(const QString& path);
+
+#endif // TOOLS_H
From 9c6a0424328c27ef8a69af70403837ccfa7b9da2 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 16 Jul 2024 15:27:00 +0200
Subject: [PATCH 23/64] Updated version
---
mainwindow.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mainwindow.h b/mainwindow.h
index 9848c94..a262c12 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -10,7 +10,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.10.0");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.0");
QT_BEGIN_NAMESPACE
namespace Ui {
From 064cb162e5556ea613d9e8a40cdbef9360b58246 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 16 Jul 2024 16:24:50 +0200
Subject: [PATCH 24/64] Bug fix
---
HeadsetControl-GUI.pro.user | 6 +++---
device.cpp | 2 +-
mainwindow.cpp | 7 ++++---
mainwindow.h | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index b42792f..2fc0d3b 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 0
+ 1
0
0
@@ -211,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
1
diff --git a/device.cpp b/device.cpp
index 2562cd4..ba325f6 100644
--- a/device.cpp
+++ b/device.cpp
@@ -50,7 +50,6 @@ Device::Device(const QJsonObject& jsonObj, QString jsonData){
}
if (capabilities.contains("CAP_EQUALIZER_PRESET")){
- equalizer_preset=-1;QStringList presets;
if (jsonObj.contains("equalizer_presets") && jsonObj["equalizer_presets"].isObject()) {
QJsonObject equalizerPresets = jsonObj["equalizer_presets"].toObject();
@@ -223,6 +222,7 @@ QList mergeDevices(QList savedDevices, const QList co
// Update the saved device with connected device's information
savedDevice->updateDevice(connectedDevice);
savedDevice->capabilities=connectedDevice->capabilities;
+ savedDevice->equalizer=connectedDevice->equalizer;
savedDevice->presets_list=connectedDevice->presets_list;
deviceFound = true;
break;
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 3d31eec..bbd46fa 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -505,7 +505,8 @@ void MainWindow::setChatmixStatus(){
QString chatmixStatus;
if(chatmix<65)chatmixStatus="Game";
else if(chatmix>65)chatmixStatus="Chat";
- ui->chatmixstatusLabel->setText(chatmixValue+" "+chatmixStatus);
+ ui->chatmixvalueLabel->setText(chatmixValue);
+ ui->chatmixstatusLabel->setText(chatmixStatus);
}
//Equalizer Section Events
@@ -547,13 +548,13 @@ void MainWindow::setSliders(int value){
void MainWindow::setSliders(QList values){
int i=0;
- if(values.length()<=selectedDevice->equalizer.bands_number){
+ if(values.length()==selectedDevice->equalizer.bands_number){
for (QSlider* slider : slidersEq) {
slider->setValue(values[i++]/selectedDevice->equalizer.band_step);
}
}
else{
- qDebug() << "ERROR: Longer Equalizer Preset";
+ qDebug() << "ERROR: Bad Equalizer Preset";
}
}
diff --git a/mainwindow.h b/mainwindow.h
index a262c12..6377372 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -10,7 +10,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.0");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.1");
QT_BEGIN_NAMESPACE
namespace Ui {
From 2575d0ee9f33a50610dc495b5e8c327d19ce4ae7 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 16 Jul 2024 16:53:48 +0200
Subject: [PATCH 25/64] Update README.md
---
README.md | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 2ecc81d..1672b64 100644
--- a/README.md
+++ b/README.md
@@ -22,8 +22,11 @@ The executable of headsetcontrol has to be called "HeadsetControl".
Only if both these requirements are met, the GUI can work.
## Usage
-Start HeadsetControl-GUI by double-clicking "HeadsetControl-GUI.exe".
-If your headset is supported and everything was set up correctly, you will be greeted by the only screen HeadsetControl-GUI has.
+Start HeadsetControl-GUI by double-clicking "HeadsetControl-GUI.exe", and if your headset is supported and everything was set up correctly, you will be greeted by the following screen HeadsetControl-GUI has.
+
+It updates ui values every ⁓30s, including the trayIcon.
+
+If you don't find some features in you ui, probably it's not supported by your headset or it has not been implemented by [HeadsetControl](https://github.com/Sapd/HeadsetControl/).
![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/ce6a9628-4705-4a79-a262-8c43db2c92b0)
@@ -35,16 +38,16 @@ If you have a wireless headset with support for battery levels, you can also min
![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/ea327c0a-e39a-4035-aa99-bc6325724571)
-That way, you will be able to see the battery status at a glance and get a reminder when the batteries of your headset run low (below 30%).
+That way, you will be able to see the battery status at a glance and get a reminder when the batteries of your headset run low (below 15%).
Hovering over the tray icon will show you the current battery percentage. You can also right-click the tray icon to bring up a context menu with quick access to the light control. You can also open or completely close the GUI through the context menu.
![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/0213a37c-806c-44d5-b8d7-5cc6b5d69407)
## Performance
While the concept of calling another app for every single interaction has some inherit overhead, HeadsetControl-GUI is very light on ressources.
-Being open in the background, HeadsetControl-GUI consists of a single process that uses virtually no CPU time and less than 8MB of system memory.
+Being open in the background, HeadsetControl-GUI consists of a single process that uses virtually no CPU time and about 8-10MB of system memory.
-![image](https://github.com/nicola02nb/HeadsetControl-GUI/assets/61830443/f429ddf9-69be-42f0-a3f0-5ce9bd118d59)
+![image](https://github.com/user-attachments/assets/3171e62d-8a0c-49b6-88bd-e5b03393c7fe)
## Building from source
To build HeadsetControl-GUI from source, you have to have a proper QT-ready development environment.
@@ -57,6 +60,4 @@ I haven't taken the time to build and test on neither Linux nor MacOS (yet), so
If you are on Linux or Mac and try to build the app, I'd be happy to hear if it did or didn't work.
## Additional information
-This was written in a day and I'm aware the code is pretty ugly. I plan to fix this and add some additional functionality like persistent settings later down the road.
-
This software comes with no warranty whatsoever. It's not properly tested for memory leakage and may or may not work with configurations other than those I've tested.
From 70417c09068f3cebc14e2bd2b15d9224b30e3eee Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 23 Jul 2024 12:55:06 +0200
Subject: [PATCH 26/64] Added Load different devices Feture, refactor, bug fix
---
HeadsetControl-GUI.pro.user | 6 +-
device.cpp | 55 +++++----
device.h | 23 ++--
mainwindow.cpp | 223 ++++++++++++++++++++++--------------
mainwindow.h | 78 +++++--------
mainwindow.ui | 12 +-
6 files changed, 212 insertions(+), 185 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index 2fc0d3b..c7e6f91 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 1
+ 0
0
0
@@ -211,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
1
diff --git a/device.cpp b/device.cpp
index ba325f6..c054c9c 100644
--- a/device.cpp
+++ b/device.cpp
@@ -29,7 +29,7 @@ Device::Device(){
}
Device::Device(const QJsonObject& jsonObj, QString jsonData){
- connected=jsonObj["status"].toString()=="succes";
+ connected=jsonObj["status"].toString()=="success";
device=jsonObj["device"].toString();
vendor=jsonObj["vendor"].toString();
@@ -209,21 +209,31 @@ QList getDevices(){
return devices;
}
-QList mergeDevices(QList savedDevices, const QList connectedDevices) {
- for (Device* connectedDevice : connectedDevices)
+QList mergeDevices(QList connectedDevices, const QList& savedDevices) {
+ for (Device* savedDevice : savedDevices)
{
bool deviceFound = false;
- for (Device* savedDevice : savedDevices)
+ for (Device* connectedDevice : connectedDevices)
{
- bool uno=savedDevice->id_vendor==connectedDevice->id_vendor;
- bool due=savedDevice->id_product==connectedDevice->id_product;
- if (uno && due)
+ if (connectedDevice->id_vendor==savedDevice->id_vendor && connectedDevice->id_product==savedDevice->id_product)
{
- // Update the saved device with connected device's information
- savedDevice->updateDevice(connectedDevice);
- savedDevice->capabilities=connectedDevice->capabilities;
- savedDevice->equalizer=connectedDevice->equalizer;
- savedDevice->presets_list=connectedDevice->presets_list;
+ // Update the connected device with saved device's information
+ connectedDevice->lights = savedDevice->lights;
+ connectedDevice->sidetone = savedDevice->sidetone;
+ connectedDevice->voice_prompts = savedDevice->voice_prompts;
+ connectedDevice->inactive_time = savedDevice->inactive_time;
+
+ connectedDevice->equalizer_preset = savedDevice->equalizer_preset;
+ connectedDevice->equalizer_curve = savedDevice->equalizer_curve;
+ connectedDevice->volume_limiter = savedDevice->volume_limiter;
+
+ connectedDevice->rotate_to_mute = savedDevice->rotate_to_mute;
+ connectedDevice->mic_mute_led_brightness = savedDevice->mic_mute_led_brightness;
+ connectedDevice->mic_volume = savedDevice->mic_volume;
+
+ connectedDevice->bt_when_powered_on = savedDevice->bt_when_powered_on;
+ connectedDevice->bt_call_volume = savedDevice->bt_call_volume;
+
deviceFound = true;
break;
}
@@ -232,27 +242,14 @@ QList mergeDevices(QList savedDevices, const QList co
if (!deviceFound)
{
// If the device wasn't found in saved devices, add it
- savedDevices.append(new Device(*connectedDevice));
+ connectedDevices.append(new Device(*savedDevice));
}
}
- // Sort the devices, connected devices first
- std::sort(savedDevices.begin(), savedDevices.end(),
- [](const Device* a, const Device* b) {
- if (a->connected != b->connected) {
- return a->connected > b->connected; // Connected devices first
- }
- // If connection status is the same, sort by vendor and product
- if (a->vendor != b->vendor) {
- return a->vendor < b->vendor;
- }
- return a->product < b->product;
- });
-
- return savedDevices;
+ return connectedDevices;
}
-QList getSavedDevices(){
- return deserializeDevices("devices.json");
+QList getSavedDevices(const QString& file_name){
+ return deserializeDevices(file_name);
}
QList getConnectedDevices(){
diff --git a/device.h b/device.h
index fdf84a1..bcc54d6 100644
--- a/device.h
+++ b/device.h
@@ -20,8 +20,8 @@ class Battery{
public:
Battery();
Battery(QString stat, int lev);
- QString status;
- int level;
+ QString status = "BATTERY_UNAVAILABLE";
+ int level = 0;
};
class EqualizerPreset{
@@ -35,11 +35,11 @@ class Equalizer{
Equalizer();
Equalizer(int bands, int baseline, double step, int min, int max);
- int bands_number;
- int band_baseline;
- double band_step;
- int band_min;
- int band_max;
+ int bands_number = 0;
+ int band_baseline = 0;
+ double band_step = 0;
+ int band_min = 0;
+ int band_max = 0;
};
class Device
@@ -49,7 +49,7 @@ class Device
Device(const QJsonObject& jsonObj, QString jsonData);
//Status
- bool connected;
+ bool connected = false;
//Basic info
QString device;
@@ -61,7 +61,7 @@ class Device
//Info to get from json and display
Battery battery;
- int chatmix;
+ int chatmix = 65;
QList presets_list;
Equalizer equalizer;
bool notification_sound=false;
@@ -96,10 +96,9 @@ Action sendAction(const QStringList& args_list);
QVersionNumber getHCVersion();
-
QList getDevices();
-QList mergeDevices(QList savedDevices, const QList connectedDevices);
-QList getSavedDevices();
+QList mergeDevices(QList connectedDevices, const QList& savedDevices);
+QList getSavedDevices(const QString& file_name);
QList getConnectedDevices();
void serializeDevices(const QList& devices, const QString& filename);
diff --git a/mainwindow.cpp b/mainwindow.cpp
index bbd46fa..c3f997f 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -22,6 +22,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
+ this->bindEvents();
darkMode = isOsDarkMode();
@@ -40,18 +41,14 @@ MainWindow::MainWindow(QWidget *parent)
menu = new QMenu(nullptr);
menu->addAction("Show", this, SLOT(show()));
- ledOn = menu->addAction("Turn Lights On", this, &MainWindow::on_onlightButton_clicked);
- ledOff = menu->addAction("Turn Lights Off", this, &MainWindow::on_offlightButton_clicked);
+ ledOn = menu->addAction("Turn Lights On", this, &MainWindow::onlightButton_clicked);
+ ledOff = menu->addAction("Turn Lights Off", this, &MainWindow::offlightButton_clicked);
menu->addAction("Exit", this, SLOT(close()));
tray->setContextMenu(menu);
tray->connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
- connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
- connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
- connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
- connect(ui->actionLoad_Device, &QAction::triggered, this, &MainWindow::selectDevice);
this->disableFrames();
@@ -65,11 +62,9 @@ MainWindow::MainWindow(QWidget *parent)
}
this->loadDevices();
- if(deviceList.length()){
+ if(deviceList.length() && n_connected>0){
this->loadDevice();
}
-
- ui->actionLoad_Device->setVisible(false);
}
MainWindow::~MainWindow()
@@ -77,6 +72,47 @@ MainWindow::~MainWindow()
delete ui;
}
+void MainWindow::bindEvents(){
+ // Tool Bar
+ connect(ui->actionLoad_Device, &QAction::triggered, this, &MainWindow::selectDevice);
+ connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
+
+ connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
+ connect(ui->actionCredits, &QAction::triggered, this, &MainWindow::showCredits);
+
+ // Settings
+ connect(ui->savesettingsButton, &QPushButton::clicked, this, &MainWindow::savesettingsButton_clicked);
+
+ // Other Section
+ connect(ui->onlightButton, &QPushButton::clicked, this, &MainWindow::onlightButton_clicked);
+ connect(ui->offlightButton, &QPushButton::clicked, this, &MainWindow::offlightButton_clicked);
+ connect(ui->sidetoneSlider, &QSlider::sliderReleased, this, &MainWindow::sidetoneSlider_sliderReleased);
+ connect(ui->voiceOnButton, &QPushButton::clicked, this, &MainWindow::voiceOnButton_clicked);
+ connect(ui->voiceOffButton, &QPushButton::clicked, this, &MainWindow::voiceOffButton_clicked);
+ connect(ui->notification0Button, &QPushButton::clicked, this, &MainWindow::notification0Button_clicked);
+ connect(ui->notification1Button, &QPushButton::clicked, this, &MainWindow::notification1Button_clicked);
+ connect(ui->inactivitySlider, &QSlider::sliderReleased, this, &MainWindow::inactivitySlider_sliderReleased);
+
+ // Equalizer Section
+ connect(ui->equalizerPresetcomboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::equalizerPresetcomboBox_currentIndexChanged);
+ connect(ui->applyEqualizer, &QPushButton::clicked, this, &MainWindow::applyEqualizer_clicked);
+ connect(ui->volumelimiterOffButton, &QPushButton::clicked, this, &MainWindow::volumelimiterOffButton_clicked);
+ connect(ui->volumelimiterOnButton, &QPushButton::clicked, this, &MainWindow::volumelimiterOnButton_clicked);
+
+ // Microphone Section
+ connect(ui->muteledbrightnessSlider, &QSlider::sliderReleased, this, &MainWindow::muteledbrightnessSlider_sliderReleased);
+ connect(ui->micvolumeSlider, &QSlider::sliderReleased, this, &MainWindow::micvolumeSlider_sliderReleased);
+ connect(ui->rotateOn, &QPushButton::clicked, this, &MainWindow::rotateOn_clicked);
+ connect(ui->rotateOff, &QPushButton::clicked, this, &MainWindow::rotateOff_clicked);
+
+ // Bluetooth Section
+ connect(ui->btwhenonOffButton, &QPushButton::clicked, this, &MainWindow::btwhenonOffButton_clicked);
+ connect(ui->btwhenonOnButton, &QPushButton::clicked, this, &MainWindow::btwhenonOnButton_clicked);
+ connect(ui->btbothRadioButton, &QRadioButton::clicked, this, &MainWindow::btbothRadioButton_clicked);
+ connect(ui->btpcdbRadioButton, &QRadioButton::clicked, this, &MainWindow::btpcdbRadioButton_clicked);
+ connect(ui->btonlyRadioButton, &QRadioButton::clicked, this, &MainWindow::btonlyRadioButton_clicked);
+}
+
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if (reason == QSystemTrayIcon::DoubleClick) {
@@ -94,16 +130,31 @@ bool MainWindow::isOsDarkMode(){
return textColor.lightness() > backgroundColor.lightness();
}
+void MainWindow::updateIcons(){
+ QString inv = "";
+ if(darkMode){
+ inv = "-inv";
+ trayIconPath.replace(".png", "-inv.png");
+ }
+ else{
+ trayIconPath.replace("-inv.png", ".png");
+ }
+
+ this->setWindowIcon(QIcon(":/icons/headphones"+inv+".png"));
+ tray->setIcon(QIcon(trayIconPath));
+}
+
void MainWindow::disableFrames(){
ledOn->setEnabled(false);
ledOff->setEnabled(false);
ui->notSupportedFrame->setHidden(false);
+
ui->deviceinfoFrame->setHidden(true);
ui->batteryFrame->setHidden(true);
ui->savesettingsButton->setHidden(true);
- //ui->tabWidget->hide();
+ ui->tabWidget->hide();
ui->tabWidget->setTabEnabled(3, false);
ui->tabWidget->setTabEnabled(2, false);
ui->tabWidget->setTabEnabled(1, false);
@@ -130,32 +181,9 @@ void MainWindow::disableFrames(){
}
void MainWindow::loadDevices(){
- deviceList=mergeDevices(getSavedDevices(), getConnectedDevices());
-}
-
-void MainWindow::updateDevice(){
- //serializeDevices(deviceList, "devices.json");
- QList newDl=getConnectedDevices();
- selectedDevice->updateDevice(newDl);
-}
-
-void MainWindow::updateIcons(){
- QString inv = "";
- if(darkMode){
- inv = "-inv";
- trayIconPath.replace(".png", "-inv.png");
- }
- else{
- trayIconPath.replace("-inv.png", ".png");
- }
-
- this->setWindowIcon(QIcon(":/icons/headphones"+inv+".png"));
- tray->setIcon(QIcon(trayIconPath));
-}
-
-void MainWindow::updateGUI(){
- setBatteryStatus();
- setChatmixStatus();
+ QList c=getConnectedDevices(), s=deserializeDevices(FILE_DEVICES_SETTINGS);
+ n_connected=c.length(); n_saved=s.length();
+ deviceList = mergeDevices(c, s);
}
void MainWindow::loadDevice(int deviceIndex){
@@ -185,7 +213,7 @@ void MainWindow::loadDevice(int deviceIndex){
qDebug() << "Battery percentage supported";
}
- //ui->tabWidget->show();
+ ui->tabWidget->show();
//Other Section
if (capabilities.contains("CAP_LIGHTS")){
ui->lightFrame->setHidden(false);
@@ -226,7 +254,7 @@ void MainWindow::loadDevice(int deviceIndex){
ui->tabWidget->setTabEnabled(1, true);
qDebug() << "Eqaulizer preset supported";
}
- if (capabilities.contains("CAP_EQUALIZER") && selectedDevice->equalizer.bands_number!=0){
+ if (capabilities.contains("CAP_EQUALIZER") && selectedDevice->equalizer.bands_number>0){
ui->equalizerFrame->setHidden(false);
ui->tabWidget->setTabEnabled(1, true);
qDebug() << "Equalizer supported";
@@ -295,31 +323,31 @@ void MainWindow::loadGUIValues(){
QHBoxLayout *equalizerLayout = ui->equalizerLayout;
clearLayout(equalizerLayout);
- int i;
- for (i = 0; i < selectedDevice->equalizer.bands_number; ++i) {
- QVBoxLayout *lb = new QVBoxLayout();
- QSlider *s = new QSlider(Qt::Vertical);
- s->setMaximum(selectedDevice->equalizer.band_max/selectedDevice->equalizer.band_step);
- s->setMinimum(selectedDevice->equalizer.band_min/selectedDevice->equalizer.band_step);
- s->setSingleStep(1);
- s->setTickInterval(1/selectedDevice->equalizer.band_step);
- s->setTickPosition(QSlider::TicksBothSides);
- if(selectedDevice->equalizer_curve.size()==selectedDevice->equalizer.bands_number){
- s->setValue(selectedDevice->equalizer_curve.value(i));
- } else{
- s->setValue(selectedDevice->equalizer.band_baseline);
- }
-
- QLabel *l = new QLabel(QString::number(i));
- l->setAlignment(Qt::AlignHCenter);
+ if(selectedDevice->equalizer.bands_number>0){
+ int i;
+ for (i = 0; i < selectedDevice->equalizer.bands_number; ++i) {
+ QLabel *l = new QLabel(QString::number(i));
+ l->setAlignment(Qt::AlignHCenter);
+
+ QSlider *s = new QSlider(Qt::Vertical);
+ s->setMaximum(selectedDevice->equalizer.band_max/selectedDevice->equalizer.band_step);
+ s->setMinimum(selectedDevice->equalizer.band_min/selectedDevice->equalizer.band_step);
+ s->setSingleStep(1);
+ s->setTickInterval(1/selectedDevice->equalizer.band_step);
+ s->setTickPosition(QSlider::TicksBothSides);
+ if(selectedDevice->equalizer_curve.size()==selectedDevice->equalizer.bands_number){
+ s->setValue(selectedDevice->equalizer_curve.value(i));
+ } else{
+ s->setValue(selectedDevice->equalizer.band_baseline);
+ }
- lb->addWidget(l);
- lb->addWidget(s);
+ QVBoxLayout *lb = new QVBoxLayout();
+ lb->addWidget(l);
+ lb->addWidget(s);
- slidersEq.append(s);
- equalizerLayout->addLayout(lb);
- }
- if(i!=0){
+ slidersEq.append(s);
+ equalizerLayout->addLayout(lb);
+ }
ui->applyEqualizer->setEnabled(true);
}
@@ -360,6 +388,17 @@ void MainWindow::loadGUIValues(){
}
}
+void MainWindow::updateDevice(){
+ //serializeDevices(deviceList, "devices.json");
+ QList newDl=getConnectedDevices();
+ selectedDevice->updateDevice(newDl);
+}
+
+void MainWindow::updateGUI(){
+ setBatteryStatus();
+ setChatmixStatus();
+}
+
//Info Section Events
void MainWindow::setBatteryStatus()
{
@@ -414,12 +453,12 @@ void MainWindow::setBatteryStatus()
tray->setIcon(QIcon(trayIconPath));
}
-void MainWindow::on_savesettingsButton_clicked(){
- serializeDevices(deviceList, "devices.json");
+void MainWindow::savesettingsButton_clicked(){
+ serializeDevices(deviceList, FILE_DEVICES_SETTINGS);
}
//Other Section Events
-void MainWindow::on_onlightButton_clicked()
+void MainWindow::onlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("1");
Action s=sendAction(args);
@@ -427,7 +466,7 @@ void MainWindow::on_onlightButton_clicked()
selectedDevice->lights=1;
}
-void MainWindow::on_offlightButton_clicked()
+void MainWindow::offlightButton_clicked()
{
QStringList args=QStringList() << QString("--light") << QString("0");
Action s=sendAction(args);
@@ -435,14 +474,14 @@ void MainWindow::on_offlightButton_clicked()
selectedDevice->lights=0;
}
-void MainWindow::on_sidetoneSlider_sliderReleased(){
+void MainWindow::sidetoneSlider_sliderReleased(){
QStringList args=QStringList() << QString("--sidetone") << QString::number(ui->sidetoneSlider->sliderPosition());
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->sidetone=ui->sidetoneSlider->value();
}
-void MainWindow::on_voiceOnButton_clicked()
+void MainWindow::voiceOnButton_clicked()
{
QStringList args=QStringList() << QString("--voice-prompt") << QString("1");
Action s=sendAction(args);
@@ -450,7 +489,7 @@ void MainWindow::on_voiceOnButton_clicked()
selectedDevice->voice_prompts=1;
}
-void MainWindow::on_voiceOffButton_clicked()
+void MainWindow::voiceOffButton_clicked()
{
QStringList args=QStringList() << QString("--voice-prompt") << QString("0");
Action s=sendAction(args);
@@ -458,7 +497,7 @@ void MainWindow::on_voiceOffButton_clicked()
selectedDevice->voice_prompts=0;
}
-void MainWindow::on_notification0Button_clicked()
+void MainWindow::notification0Button_clicked()
{
QStringList args=QStringList() << QString("--notificate") << QString("0");
Action s=sendAction(args);
@@ -467,7 +506,7 @@ void MainWindow::on_notification0Button_clicked()
}
}
-void MainWindow::on_notification1Button_clicked()
+void MainWindow::notification1Button_clicked()
{
QStringList args=QStringList() << QString("--notificate") << QString("1");
Action s=sendAction(args);
@@ -476,7 +515,7 @@ void MainWindow::on_notification1Button_clicked()
}
}
-void MainWindow::on_rotateOn_clicked()
+void MainWindow::rotateOn_clicked()
{
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("1");
Action s=sendAction(args);
@@ -484,7 +523,7 @@ void MainWindow::on_rotateOn_clicked()
selectedDevice->rotate_to_mute=1;
}
-void MainWindow::on_rotateOff_clicked()
+void MainWindow::rotateOff_clicked()
{
QStringList args=QStringList() << QString("--rotate-to-mute") << QString("0");
Action s=sendAction(args);
@@ -492,7 +531,7 @@ void MainWindow::on_rotateOff_clicked()
selectedDevice->rotate_to_mute=0;
}
-void MainWindow::on_inactivitySlider_sliderReleased(){
+void MainWindow::inactivitySlider_sliderReleased(){
QStringList args=QStringList() << QString("--inactive-time") << QString::number(ui->inactivitySlider->sliderPosition());
Action s=sendAction(args);
if(s.status=="success")
@@ -510,7 +549,7 @@ void MainWindow::setChatmixStatus(){
}
//Equalizer Section Events
-void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
+void MainWindow::equalizerPresetcomboBox_currentIndexChanged(){
int preset=ui->equalizerPresetcomboBox->currentIndex();
if(preset==0){
//setSliders(selectedDevice->equalizer.band_baseline);
@@ -523,7 +562,7 @@ void MainWindow::on_equalizerPresetcomboBox_currentIndexChanged(){
}
}
-void MainWindow::on_applyEqualizer_clicked(){
+void MainWindow::applyEqualizer_clicked(){
ui->equalizerPresetcomboBox->setCurrentIndex(0);
QString eq_string="";
QList values;
@@ -575,14 +614,14 @@ void MainWindow::clearLayout(QLayout* layout){
}
}
-void MainWindow::on_volumelimiterOffButton_clicked(){
+void MainWindow::volumelimiterOffButton_clicked(){
QStringList args=QStringList() << QString("--volume-limiter") << QString("0");
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->volume_limiter=0;
}
-void MainWindow::on_volumelimiterOnButton_clicked(){
+void MainWindow::volumelimiterOnButton_clicked(){
QStringList args=QStringList() << QString("--volume-limiter") << QString("1");
Action s=sendAction(args);
if(s.status=="success")
@@ -590,14 +629,14 @@ void MainWindow::on_volumelimiterOnButton_clicked(){
}
//Microphone Section Events
-void MainWindow::on_muteledbrightnessSlider_sliderReleased(){
+void MainWindow::muteledbrightnessSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-mute-led-brightness") << QString::number(ui->muteledbrightnessSlider->sliderPosition());
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->mic_mute_led_brightness=ui->muteledbrightnessSlider->value();
}
-void MainWindow::on_micvolumeSlider_sliderReleased(){
+void MainWindow::micvolumeSlider_sliderReleased(){
QStringList args=QStringList() << QString("--microphone-volume") << QString::number(ui->micvolumeSlider->sliderPosition());
Action s=sendAction(args);
if(s.status=="success")
@@ -605,35 +644,35 @@ void MainWindow::on_micvolumeSlider_sliderReleased(){
}
//Bluetooth Section Events
-void MainWindow::on_btwhenonOffButton_clicked(){
+void MainWindow::btwhenonOffButton_clicked(){
QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("0");
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->bt_when_powered_on=0;
}
-void MainWindow::on_btwhenonOnButton_clicked(){
+void MainWindow::btwhenonOnButton_clicked(){
QStringList args=QStringList() << QString("--bt-when-powered-on") << QString("1");
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->bt_when_powered_on=1;
}
-void MainWindow::on_btbothRadioButton_clicked(){
+void MainWindow::btbothRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("0");
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->bt_call_volume=0;
}
-void MainWindow::on_btpcdbRadioButton_clicked(){
+void MainWindow::btpcdbRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("1");
Action s=sendAction(args);
if(s.status=="success")
selectedDevice->bt_call_volume=1;
}
-void MainWindow::on_btonlyRadioButton_clicked(){
+void MainWindow::btonlyRadioButton_clicked(){
QStringList args=QStringList() << QString("--bt-call-volume") << QString("2");
Action s=sendAction(args);
if(s.status=="success")
@@ -642,6 +681,8 @@ void MainWindow::on_btonlyRadioButton_clicked(){
//Tool Bar Events
void MainWindow::selectDevice(){
+ this->loadDevices();
+
QDialog dialog;
dialog.setWindowTitle("Select device to load");
@@ -651,8 +692,10 @@ void MainWindow::selectDevice(){
layout.addWidget(&labelWidget);
QStringList devices=QStringList();
- for (int i = 0; i < deviceList.length(); ++i){
- devices<device;
+ for (Device* device : deviceList){
+ if(device->connected){
+ devices<device;
+ }
}
QComboBox comboBox;
@@ -667,8 +710,14 @@ void MainWindow::selectDevice(){
if (dialog.exec() == QDialog::Accepted) {
int index = comboBox.currentIndex();
+ this->disableFrames();
if (index>=0) {
- this->disableFrames();
+ if(index==0){
+ ui->tabWidget->setDisabled(false);
+ }
+ else {
+ ui->tabWidget->setDisabled(true);
+ }
this->loadDevice(index);
}
}
diff --git a/mainwindow.h b/mainwindow.h
index 6377372..8f042ac 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -10,7 +10,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.1");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.2");
QT_BEGIN_NAMESPACE
namespace Ui {
@@ -30,6 +30,9 @@ class MainWindow : public QMainWindow
private:
const int UPDATE_TIME=30000;
+ const QString FILE_DEVICES_SETTINGS = "devices.json";
+
+ int n_connected = 0, n_saved = 0;
bool darkMode;
QString trayIconPath;
@@ -43,98 +46,77 @@ class MainWindow : public QMainWindow
QList deviceList;
QList slidersEq;
- QTimer* timerGUI;
-
- QList flat={0,0,0,0,0,0,0,0,0,0};
+ QTimer* timerGUI = nullptr;
private slots:
void changeEvent(QEvent *e);
+ void bindEvents();
void RestoreWindowTrigger(QSystemTrayIcon::ActivationReason RW);
-
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
bool isOsDarkMode();
+ void updateIcons();
void disableFrames();
void loadDevices();
-
+ void loadDevice(int deviceIndex=0);
void loadGUIValues();
void updateDevice();
-
- void updateIcons();
-
void updateGUI();
- void loadDevice(int deviceIndex=0);
-
void setBatteryStatus();
- void on_savesettingsButton_clicked();
+ void savesettingsButton_clicked();
//Other Section Events
- void on_onlightButton_clicked();
-
- void on_offlightButton_clicked();
-
- void on_sidetoneSlider_sliderReleased();
+ void onlightButton_clicked();
+ void offlightButton_clicked();
- void on_voiceOnButton_clicked();
+ void sidetoneSlider_sliderReleased();
- void on_voiceOffButton_clicked();
+ void voiceOnButton_clicked();
+ void voiceOffButton_clicked();
- void on_notification0Button_clicked();
+ void notification0Button_clicked();
+ void notification1Button_clicked();
- void on_notification1Button_clicked();
+ void inactivitySlider_sliderReleased();
- void on_inactivitySlider_sliderReleased();
-
- void on_rotateOn_clicked();
-
- void on_rotateOff_clicked();
+ void rotateOn_clicked();
+ void rotateOff_clicked();
void setChatmixStatus();
//Equalizer Section Events
- void on_equalizerPresetcomboBox_currentIndexChanged();
-
- void on_applyEqualizer_clicked();
+ void equalizerPresetcomboBox_currentIndexChanged();
+ void applyEqualizer_clicked();
void setSliders(int value);
-
void setSliders(QList values);
-
void clearLayout(QLayout* layout);
- void on_volumelimiterOffButton_clicked();
-
- void on_volumelimiterOnButton_clicked();
+ void volumelimiterOffButton_clicked();
+ void volumelimiterOnButton_clicked();
//Microphone Section Events
- void on_muteledbrightnessSlider_sliderReleased();
-
- void on_micvolumeSlider_sliderReleased();
+ void muteledbrightnessSlider_sliderReleased();
+ void micvolumeSlider_sliderReleased();
//Bluetooth Section Events
- void on_btwhenonOffButton_clicked();
+ void btwhenonOffButton_clicked();
+ void btwhenonOnButton_clicked();
- void on_btwhenonOnButton_clicked();
-
- void on_btbothRadioButton_clicked();
-
- void on_btpcdbRadioButton_clicked();
-
- void on_btonlyRadioButton_clicked();
+ void btbothRadioButton_clicked();
+ void btpcdbRadioButton_clicked();
+ void btonlyRadioButton_clicked();
//Tool Bar Events
void checkForUpdates();
-
void selectDevice();
-
void showAbout();
-
void showCredits();
private:
diff --git a/mainwindow.ui b/mainwindow.ui
index fbd9fbb..b19986f 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -9,8 +9,8 @@
0
0
- 616
- 699
+ 536
+ 725
@@ -295,7 +295,7 @@ Model:
true
-
+
0
0
@@ -365,7 +365,7 @@ Model:
-
-
+
0
0
@@ -383,7 +383,7 @@ Model:
true
-
+
0
0
@@ -1699,7 +1699,7 @@ Model:
0
0
- 616
+ 536
25
From f9b8941e1c3b7a49d490fd130bdef0a504fd9ceb Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 23 Jul 2024 18:04:31 +0200
Subject: [PATCH 27/64] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1672b64..ac22d6d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-A simply remake of [HeadsetControl-GUI](https://github.com/LeoKlaus/HeadsetControl-GUI) by LeoKlaus
+A simply remake of [HeadsetControl-GUI](https://github.com/LeoKlaus/HeadsetControl-GUI) by @LeoKlaus
# HeadsetControl-GUI
This is a GUI for [Sapds great HeadsetControl](https://github.com/Sapd/HeadsetControl/). It's just a frontend to graphically interact with the original HeadsetControl and has no functionality by itself.
From 6aa5bba777e5b1aa6e10798cdb3a61f2d8c8a310 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 23 Jul 2024 18:19:15 +0200
Subject: [PATCH 28/64] Update README.md
---
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index ac22d6d..e42bcc9 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,12 @@ You HAVE to download a version of the [original headsetcontrol](https://github.c
The executable of headsetcontrol has to be called "HeadsetControl".
Only if both these requirements are met, the GUI can work.
+### Auto startup
+
+1. Press on your keyboard `win` + `R` and write on prompt `shell:common startup`; after pressing `ok` button your file explorer will open on the startup folder.
+2. There you can create a link to the HeadsetControl-GUI.exe executable.
+3. If you want it to startup as minimized, you can press `right click` on the file `link` and you can set `Run:` as `Minimized`.
+
## Usage
Start HeadsetControl-GUI by double-clicking "HeadsetControl-GUI.exe", and if your headset is supported and everything was set up correctly, you will be greeted by the following screen HeadsetControl-GUI has.
From 3f33e76249e341300c12c2edbc61480ff99fc8c0 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 20 Aug 2024 14:21:20 +0200
Subject: [PATCH 29/64] Update HeadsetControl-GUI.pro.user
---
HeadsetControl-GUI.pro.user | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index c7e6f91..a2134d4 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 0
+ 1
0
0
@@ -211,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
1
From cebfe735b23721743694650ca243454a61dae46b Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:02:47 +0200
Subject: [PATCH 30/64] Added Setting window to GUI
---
HeadsetControl-GUI.pro | 11 +-
HeadsetControl-GUI.pro.user | 6 +-
dialoginfo.ui | 58 ++++++-----
mainwindow.cpp | 43 +++++---
mainwindow.h | 9 +-
mainwindow.ui | 173 ++++++++++++++++---------------
settings.cpp | 52 ++++++++++
settings.h | 19 ++++
settingswindow.cpp | 34 ++++++
settingswindow.h | 28 +++++
settingswindow.ui | 201 ++++++++++++++++++++++++++++++++++++
tools.cpp => utils.cpp | 6 +-
tools.h => utils.h | 8 +-
13 files changed, 514 insertions(+), 134 deletions(-)
create mode 100644 settings.cpp
create mode 100644 settings.h
create mode 100644 settingswindow.cpp
create mode 100644 settingswindow.h
create mode 100644 settingswindow.ui
rename tools.cpp => utils.cpp (97%)
rename tools.h => utils.h (76%)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index e4bffe5..e732741 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -9,17 +9,22 @@ SOURCES += \
dialoginfo.cpp \
main.cpp \
mainwindow.cpp \
- tools.cpp
+ settings.cpp \
+ settingswindow.cpp \
+ utils.cpp
HEADERS += \
Device.h \
dialoginfo.h \
mainwindow.h \
- tools.h
+ settings.h \
+ settingswindow.h \
+ utils.h
FORMS += \
dialoginfo.ui \
- mainwindow.ui
+ mainwindow.ui \
+ settingswindow.ui
TRANSLATIONS += \
HeadsetControl_GUI_en_US.ts
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index a2134d4..41166fc 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 1
+ 0
0
0
@@ -211,7 +211,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
1
diff --git a/dialoginfo.ui b/dialoginfo.ui
index 28ad3f6..f3dd90d 100644
--- a/dialoginfo.ui
+++ b/dialoginfo.ui
@@ -7,7 +7,7 @@
0
0
305
- 66
+ 86
@@ -21,30 +21,38 @@
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- true
-
-
- Qt::TextBrowserInteraction
-
-
-
-
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ Qt::TextBrowserInteraction
+
+
+
+
+
-
diff --git a/mainwindow.cpp b/mainwindow.cpp
index c3f997f..14291fd 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,7 +1,9 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "Device.h"
+#include "settings.h"
#include "dialoginfo.h"
+#include "settingswindow.h"
#include
#include
#include
@@ -24,6 +26,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
this->bindEvents();
+ settings=loadSettingsFromFile(PROGRAM_SETTINGS_FILENAME);
+
darkMode = isOsDarkMode();
if(darkMode){
@@ -74,6 +78,7 @@ MainWindow::~MainWindow()
void MainWindow::bindEvents(){
// Tool Bar
+ connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::editProgramSetting);
connect(ui->actionLoad_Device, &QAction::triggered, this, &MainWindow::selectDevice);
connect(ui->actionCheck_Updates, &QAction::triggered, this, &MainWindow::checkForUpdates);
@@ -199,7 +204,7 @@ void MainWindow::loadDevice(int deviceIndex){
timerGUI = new QTimer(this);
connect(timerGUI, SIGNAL(timeout()), this, SLOT(updateDevice()));
connect(timerGUI, SIGNAL(timeout()), this, SLOT(updateGUI()));
- timerGUI->start(UPDATE_TIME);
+ timerGUI->start(settings.msecUpdateIntervalTime);
ui->notSupportedFrame->setHidden(true);
@@ -429,8 +434,9 @@ void MainWindow::setBatteryStatus()
tray->setToolTip("HeadsetControl \r\nBattery: " + level + "%");
if (level.toInt() > 75){
trayIconPath = ":/icons/battery-level-full-inv.png";
+ notified = false;
}
- else if (level.toInt() > 15) {
+ else if (level.toInt() >= settings.batteryLowThreshold) {
trayIconPath = ":/icons/battery-medium-inv.png";
notified = false;
}
@@ -680,6 +686,15 @@ void MainWindow::btonlyRadioButton_clicked(){
}
//Tool Bar Events
+void MainWindow::editProgramSetting(){
+ settingsWindow* settingsW=new settingsWindow(settings, this);
+ if (settingsW->exec() == QDialog::Accepted) {
+ settings=settingsW->temporarySettings;
+ saveSettingstoFile(settings, PROGRAM_SETTINGS_FILENAME);
+ timerGUI->setInterval(settings.msecUpdateIntervalTime);
+ }
+}
+
void MainWindow::selectDevice(){
this->loadDevices();
@@ -724,8 +739,8 @@ void MainWindow::selectDevice(){
}
void MainWindow::checkForUpdates(){
- dialogInfo* dialog=new dialogInfo(this);
- dialog->setTitle("Check for updates");
+ dialogInfo* dialogWindow=new dialogInfo(this);
+ dialogWindow->setTitle("Check for updates");
const QVersionNumber& local_hc=getHCVersion();
const QVersionNumber& local_gui=GUI_VERSION;
@@ -743,31 +758,31 @@ void MainWindow::checkForUpdates(){
}
QString text = "HeadesetControl: "+s1+"
HeadesetControl-GUI: "+s2;
- dialog->setLabel(text);
+ dialogWindow->setLabel(text);
- dialog->show();
+ dialogWindow->show();
}
void MainWindow::showAbout(){
- dialogInfo* dialog=new dialogInfo(this);
- dialog->setTitle("About this program");
+ dialogInfo* dialogWindow=new dialogInfo(this);
+ dialogWindow->setTitle("About this program");
QString text = "This is a forked version of HeadsetControl-GUI."
"
Made by nicola02nb"
"
Version: "+GUI_VERSION.toString();
- dialog->setLabel(text);
+ dialogWindow->setLabel(text);
- dialog->show();
+ dialogWindow->show();
}
void MainWindow::showCredits(){
- dialogInfo* dialog=new dialogInfo(this);
- dialog->setTitle("Credits");
+ dialogInfo* dialogWindow=new dialogInfo(this);
+ dialogWindow->setTitle("Credits");
QString text = "Big shout-out to:"
"
- Sapd for HeadsetCoontrol"
"
- LeoKlaus for HeadsetControl-GUI";
- dialog->setLabel(text);
+ dialogWindow->setLabel(text);
- dialog->show();
+ dialogWindow->show();
}
diff --git a/mainwindow.h b/mainwindow.h
index 8f042ac..3be0507 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -1,8 +1,9 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include "tools.h"
+#include "utils.h"
#include "Device.h"
+#include "settings.h"
#include
#include
#include
@@ -10,7 +11,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.11.2");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.0");
QT_BEGIN_NAMESPACE
namespace Ui {
@@ -29,11 +30,12 @@ class MainWindow : public QMainWindow
QSystemTrayIcon* tray = new QSystemTrayIcon(this);
private:
- const int UPDATE_TIME=30000;
const QString FILE_DEVICES_SETTINGS = "devices.json";
+ const QString PROGRAM_SETTINGS_FILENAME = "settings.json";
int n_connected = 0, n_saved = 0;
+ Settings settings;
bool darkMode;
QString trayIconPath;
@@ -114,6 +116,7 @@ private slots:
void btonlyRadioButton_clicked();
//Tool Bar Events
+ void editProgramSetting();
void checkForUpdates();
void selectDevice();
void showAbout();
diff --git a/mainwindow.ui b/mainwindow.ui
index b19986f..a8491e4 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -3,14 +3,14 @@
MainWindow
- Qt::NonModal
+ Qt::WindowModality::NonModal
0
0
- 536
- 725
+ 540
+ 741
@@ -38,7 +38,7 @@
:/icons/headphones-inv.png:/icons/headphones-inv.png
- Qt::LeftToRight
+ Qt::LayoutDirection::LeftToRight
@@ -81,10 +81,10 @@
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -111,7 +111,7 @@
HeadsetControl couldn't find any compatible or working headsets. :(
- Qt::AlignCenter
+ Qt::AlignmentFlag::AlignCenter
@@ -137,10 +137,10 @@
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -201,10 +201,10 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSizePolicy::Expanding
+ QSizePolicy::Policy::Expanding
@@ -238,10 +238,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
@@ -283,7 +283,7 @@ Model:
Battery:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -319,7 +319,7 @@ Model:
false
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
false
@@ -347,7 +347,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -389,7 +389,7 @@ Model:
- QTabWidget::North
+ QTabWidget::TabPosition::North
0
@@ -423,10 +423,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -459,7 +459,7 @@ Model:
Lights:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -479,7 +479,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -514,10 +514,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -544,14 +544,14 @@ Model:
Sidetone Level:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
- QLayout::SetDefaultConstraint
+ QLayout::SizeConstraint::SetDefaultConstraint
-
@@ -568,10 +568,10 @@ Model:
16
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
16
@@ -590,7 +590,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -603,13 +603,13 @@ Model:
-
- Qt::LeftToRight
+ Qt::LayoutDirection::LeftToRight
Loud
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -629,10 +629,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -665,7 +665,7 @@ Model:
Voice Prompts:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -687,7 +687,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -724,10 +724,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -770,7 +770,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -801,10 +801,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -831,7 +831,7 @@ Model:
Inactivity Timer:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -846,10 +846,10 @@ Model:
90
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
10
@@ -868,7 +868,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -884,7 +884,7 @@ Model:
90 Minutes
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -904,10 +904,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -964,7 +964,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -980,7 +980,7 @@ Model:
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1012,10 +1012,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1053,7 +1053,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1075,10 +1075,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1128,10 +1128,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1171,7 +1171,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1215,10 +1215,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1245,7 +1245,7 @@ Model:
Rotate to mute:
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
@@ -1259,7 +1259,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1288,10 +1288,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1324,7 +1324,7 @@ Model:
false
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
true
@@ -1342,10 +1342,10 @@ Model:
1
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
@@ -1361,7 +1361,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1377,7 +1377,7 @@ Model:
High
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -1397,10 +1397,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1442,10 +1442,10 @@ Model:
16
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSlider::TicksBelow
+ QSlider::TickPosition::TicksBelow
16
@@ -1464,7 +1464,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1480,7 +1480,7 @@ Model:
Loud
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
@@ -1494,7 +1494,7 @@ Model:
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1526,10 +1526,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1572,7 +1572,7 @@ Model:
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1603,10 +1603,10 @@ Model:
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -1678,7 +1678,7 @@ Model:
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1699,8 +1699,8 @@ Model:
0
0
- 536
- 25
+ 540
+ 33
+
offlightButton
diff --git a/settings.cpp b/settings.cpp
new file mode 100644
index 0000000..871af4e
--- /dev/null
+++ b/settings.cpp
@@ -0,0 +1,52 @@
+#include "settings.h"
+#include
+#include
+#include
+
+Settings::Settings() {}
+
+Settings loadSettingsFromFile(const QString& filename){
+ Settings s;
+
+ QFile file(filename);
+
+ if (!file.open(QIODevice::ReadOnly)) {
+ qWarning("Couldn't open save file.");
+ return s;
+ }
+
+ QByteArray saveData = file.readAll();
+ file.close();
+
+ QJsonDocument doc(QJsonDocument::fromJson(saveData));
+ QJsonObject json = doc.object();
+
+ if (json.contains("runOnStartup")) {
+ s.runOnstartup = json["runOnStartup"].toBool();
+ }
+ if (json.contains("batteryLowThreshold")) {
+ s.batteryLowThreshold = json["batteryLowThreshold"].toInt();
+ }
+ if (json.contains("msecUpdateIntervalTime")) {
+ s.msecUpdateIntervalTime = json["msecUpdateIntervalTime"].toInt();
+ }
+
+ return s;
+}
+
+void saveSettingstoFile(const Settings& settings, const QString& filename){
+ QJsonObject json;
+ json["runOnStartup"] = settings.runOnstartup;
+ json["batteryLowThreshold"] = settings.batteryLowThreshold;
+ json["msecUpdateIntervalTime"] = settings.msecUpdateIntervalTime;
+
+ QJsonDocument doc(json);
+ QFile file(filename);
+
+ if (!file.open(QIODevice::WriteOnly)) {
+ qWarning("Couldn't open save file.");
+ }
+
+ file.write(doc.toJson());
+ file.close();
+}
diff --git a/settings.h b/settings.h
new file mode 100644
index 0000000..5554512
--- /dev/null
+++ b/settings.h
@@ -0,0 +1,19 @@
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+#include
+
+class Settings
+{
+public:
+ Settings();
+
+ bool runOnstartup=false;
+ int batteryLowThreshold=15;
+ int msecUpdateIntervalTime=30000;
+};
+
+Settings loadSettingsFromFile(const QString& filename);
+void saveSettingstoFile(const Settings& settings, const QString& filename);
+
+#endif // SETTINGS_H
diff --git a/settingswindow.cpp b/settingswindow.cpp
new file mode 100644
index 0000000..8db2b89
--- /dev/null
+++ b/settingswindow.cpp
@@ -0,0 +1,34 @@
+#include "settingswindow.h"
+#include "ui_settingswindow.h"
+#include "settings.h"
+#include "utils.h"
+
+settingsWindow::settingsWindow(const Settings& programSettings, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::settings)
+{
+ setModal(true);
+ ui->setupUi(this);
+
+ ui->runonstartupCheckBox->setChecked(programSettings.runOnstartup);
+ ui->batterylowtresholdSpinBox->setValue(programSettings.batteryLowThreshold);
+ ui->updateintervaltimeDoubleSpinBox->setValue((double)programSettings.msecUpdateIntervalTime/1000);
+
+ connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &settingsWindow::updateSettings);
+ connect(ui->runonstartupCheckBox, &QCheckBox::checkStateChanged, this, &settingsWindow::setRunOnStartup);
+}
+
+void settingsWindow::updateSettings(){
+ temporarySettings.runOnstartup=ui->runonstartupCheckBox->isChecked();
+ temporarySettings.batteryLowThreshold=ui->batterylowtresholdSpinBox->value();
+ temporarySettings.msecUpdateIntervalTime=ui->updateintervaltimeDoubleSpinBox->value()*1000;
+}
+
+void settingsWindow::setRunOnStartup(){
+ setOSRunOnStartup(ui->runonstartupCheckBox->isChecked());
+}
+
+settingsWindow::~settingsWindow()
+{
+ delete ui;
+}
diff --git a/settingswindow.h b/settingswindow.h
new file mode 100644
index 0000000..ce20510
--- /dev/null
+++ b/settingswindow.h
@@ -0,0 +1,28 @@
+#ifndef SETTINGSWINDOW_H
+#define SETTINGSWINDOW_H
+
+#include "settings.h"
+#include
+
+namespace Ui {
+class settings;
+}
+
+class settingsWindow : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit settingsWindow(const Settings& programSettings, QWidget *parent = nullptr);
+ ~settingsWindow();
+
+ Settings temporarySettings;
+
+private:
+ Ui::settings *ui;
+
+ void updateSettings();
+ void setRunOnStartup();
+};
+
+#endif // SETTINGSWINDOW_H
diff --git a/settingswindow.ui b/settingswindow.ui
new file mode 100644
index 0000000..ba7d2a3
--- /dev/null
+++ b/settingswindow.ui
@@ -0,0 +1,201 @@
+
+
+ settings
+
+
+
+ 0
+ 0
+ 349
+ 210
+
+
+
+
+ 0
+ 0
+
+
+
+ Dialog
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+ Run on Startup (NOT IMPLEMENTED)
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 120
+ 0
+
+
+
+
+ 120
+ 16777215
+
+
+
+ 100
+
+
+ 15
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Battery low threshold
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+
+ 120
+ 0
+
+
+
+
+ 120
+ 16777215
+
+
+
+ 1
+
+
+ 1000.000000000000000
+
+
+ 30.000000000000000
+
+
+
+ -
+
+
+ <html><head/><body><p>Update Info interval time (seconds)<br/>Default: 30,0 seconds<br/>DON'T PUT TOO LOW VALUES</p></body></html>
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ settings
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ settings
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/tools.cpp b/utils.cpp
similarity index 97%
rename from tools.cpp
rename to utils.cpp
index 2d741c1..3167756 100644
--- a/tools.cpp
+++ b/utils.cpp
@@ -1,4 +1,4 @@
-#include "tools.h"
+#include "utils.h"
#include
#include
#include
@@ -106,3 +106,7 @@ bool openFileExplorer(const QString& path)
return QDesktopServices::openUrl(url);
}
+void setOSRunOnStartup(bool enable){
+ //TO BE IMPLEMENTED
+}
+
diff --git a/tools.h b/utils.h
similarity index 76%
rename from tools.h
rename to utils.h
index 989ae29..16c187b 100644
--- a/tools.h
+++ b/utils.h
@@ -1,5 +1,5 @@
-#ifndef TOOLS_H
-#define TOOLS_H
+#ifndef UTILS_H
+#define UTILS_H
#include
@@ -11,4 +11,6 @@ bool fileExists(const QString& filepath);
bool openFileExplorer(const QString& path);
-#endif // TOOLS_H
+void setOSRunOnStartup(bool enable);
+
+#endif // UTILS_H
From 0edda0f3d14728c714fc2fc64370823adbd4e0a1 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:36:08 +0200
Subject: [PATCH 31/64] Reorganized file structure
---
HeadsetControl-GUI.pro | 49 ++++++++++--------
HeadsetControl-GUI.pro.user | 2 +-
device.cpp => src/DataTypes/Device.cpp | 0
device.h => src/DataTypes/Device.h | 0
settings.cpp => src/DataTypes/settings.cpp | 0
settings.h => src/DataTypes/settings.h | 0
.../Translations/HeadsetControl_GUI_en_US.ts | 0
.../Resources/headphones-exe.ico | Bin
icons.qrc => src/Resources/icons.qrc | 0
.../Resources/icons}/battery-charging-inv.png | Bin
.../Resources/icons}/battery-charging.png | Bin
.../icons}/battery-level-full-inv.png | Bin
.../Resources/icons}/battery-level-full.png | Bin
.../Resources/icons}/battery-low-inv.png | Bin
.../Resources/icons}/battery-low.png | Bin
.../Resources/icons}/battery-medium-inv.png | Bin
.../Resources/icons}/battery-medium.png | Bin
.../Resources/icons}/headphones-inv.png | Bin
{icons => src/Resources/icons}/headphones.png | Bin
myapp.rc => src/Resources/myapp.rc | 0
dialoginfo.cpp => src/UI/dialoginfo.cpp | 0
dialoginfo.h => src/UI/dialoginfo.h | 0
dialoginfo.ui => src/UI/dialoginfo.ui | 0
mainwindow.cpp => src/UI/mainwindow.cpp | 0
mainwindow.h => src/UI/mainwindow.h | 0
mainwindow.ui => src/UI/mainwindow.ui | 0
.../UI/settingswindow.cpp | 0
settingswindow.h => src/UI/settingswindow.h | 0
settingswindow.ui => src/UI/settingswindow.ui | 0
utils.cpp => src/Utils/utils.cpp | 0
utils.h => src/Utils/utils.h | 0
main.cpp => src/main.cpp | 0
32 files changed, 27 insertions(+), 24 deletions(-)
rename device.cpp => src/DataTypes/Device.cpp (100%)
rename device.h => src/DataTypes/Device.h (100%)
rename settings.cpp => src/DataTypes/settings.cpp (100%)
rename settings.h => src/DataTypes/settings.h (100%)
rename HeadsetControl_GUI_en_US.ts => src/Resources/Translations/HeadsetControl_GUI_en_US.ts (100%)
rename headphones-exe.ico => src/Resources/headphones-exe.ico (100%)
rename icons.qrc => src/Resources/icons.qrc (100%)
rename {icons => src/Resources/icons}/battery-charging-inv.png (100%)
rename {icons => src/Resources/icons}/battery-charging.png (100%)
rename {icons => src/Resources/icons}/battery-level-full-inv.png (100%)
rename {icons => src/Resources/icons}/battery-level-full.png (100%)
rename {icons => src/Resources/icons}/battery-low-inv.png (100%)
rename {icons => src/Resources/icons}/battery-low.png (100%)
rename {icons => src/Resources/icons}/battery-medium-inv.png (100%)
rename {icons => src/Resources/icons}/battery-medium.png (100%)
rename {icons => src/Resources/icons}/headphones-inv.png (100%)
rename {icons => src/Resources/icons}/headphones.png (100%)
rename myapp.rc => src/Resources/myapp.rc (100%)
rename dialoginfo.cpp => src/UI/dialoginfo.cpp (100%)
rename dialoginfo.h => src/UI/dialoginfo.h (100%)
rename dialoginfo.ui => src/UI/dialoginfo.ui (100%)
rename mainwindow.cpp => src/UI/mainwindow.cpp (100%)
rename mainwindow.h => src/UI/mainwindow.h (100%)
rename mainwindow.ui => src/UI/mainwindow.ui (100%)
rename settingswindow.cpp => src/UI/settingswindow.cpp (100%)
rename settingswindow.h => src/UI/settingswindow.h (100%)
rename settingswindow.ui => src/UI/settingswindow.ui (100%)
rename utils.cpp => src/Utils/utils.cpp (100%)
rename utils.h => src/Utils/utils.h (100%)
rename main.cpp => src/main.cpp (100%)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index e732741..e5a9bd1 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -1,43 +1,46 @@
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
-CONFIG += static c++11
+CONFIG += static c++17
QMAKE_LFLAGS += -static
+INCLUDEPATH += \
+ src/DataTypes \
+ src/UI \
+ src/Utils
+
SOURCES += \
- Device.cpp \
- dialoginfo.cpp \
- main.cpp \
- mainwindow.cpp \
- settings.cpp \
- settingswindow.cpp \
- utils.cpp
+ src/main.cpp \
+ src/DataTypes/Device.cpp \
+ src/DataTypes/settings.cpp \
+ src/UI/dialoginfo.cpp \
+ src/UI/mainwindow.cpp \
+ src/UI/settingswindow.cpp \
+ src/Utils/utils.cpp
HEADERS += \
- Device.h \
- dialoginfo.h \
- mainwindow.h \
- settings.h \
- settingswindow.h \
- utils.h
+ src/DataTypes/Device.h \
+ src/DataTypes/settings.h \
+ src/UI/dialoginfo.h \
+ src/UI/mainwindow.h \
+ src/UI/settingswindow.h \
+ src/Utils/utils.h
FORMS += \
- dialoginfo.ui \
- mainwindow.ui \
- settingswindow.ui
+ src/UI/dialoginfo.ui \
+ src/UI/mainwindow.ui \
+ src/UI/settingswindow.ui
TRANSLATIONS += \
- HeadsetControl_GUI_en_US.ts
+ src/Resources/Translations/HeadsetControl_GUI_en_US.ts
RESOURCES += \
- icons.qrc
+ src/Resources/icons.qrc
-RC_FILE = myapp.rc
+RC_FILE = src/Resources/myapp.rc
DISTFILES += \
- .gitignore \
- headphones-exe.ico \
- myapp.rc
+ .gitignore
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index 41166fc..008d763 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/device.cpp b/src/DataTypes/Device.cpp
similarity index 100%
rename from device.cpp
rename to src/DataTypes/Device.cpp
diff --git a/device.h b/src/DataTypes/Device.h
similarity index 100%
rename from device.h
rename to src/DataTypes/Device.h
diff --git a/settings.cpp b/src/DataTypes/settings.cpp
similarity index 100%
rename from settings.cpp
rename to src/DataTypes/settings.cpp
diff --git a/settings.h b/src/DataTypes/settings.h
similarity index 100%
rename from settings.h
rename to src/DataTypes/settings.h
diff --git a/HeadsetControl_GUI_en_US.ts b/src/Resources/Translations/HeadsetControl_GUI_en_US.ts
similarity index 100%
rename from HeadsetControl_GUI_en_US.ts
rename to src/Resources/Translations/HeadsetControl_GUI_en_US.ts
diff --git a/headphones-exe.ico b/src/Resources/headphones-exe.ico
similarity index 100%
rename from headphones-exe.ico
rename to src/Resources/headphones-exe.ico
diff --git a/icons.qrc b/src/Resources/icons.qrc
similarity index 100%
rename from icons.qrc
rename to src/Resources/icons.qrc
diff --git a/icons/battery-charging-inv.png b/src/Resources/icons/battery-charging-inv.png
similarity index 100%
rename from icons/battery-charging-inv.png
rename to src/Resources/icons/battery-charging-inv.png
diff --git a/icons/battery-charging.png b/src/Resources/icons/battery-charging.png
similarity index 100%
rename from icons/battery-charging.png
rename to src/Resources/icons/battery-charging.png
diff --git a/icons/battery-level-full-inv.png b/src/Resources/icons/battery-level-full-inv.png
similarity index 100%
rename from icons/battery-level-full-inv.png
rename to src/Resources/icons/battery-level-full-inv.png
diff --git a/icons/battery-level-full.png b/src/Resources/icons/battery-level-full.png
similarity index 100%
rename from icons/battery-level-full.png
rename to src/Resources/icons/battery-level-full.png
diff --git a/icons/battery-low-inv.png b/src/Resources/icons/battery-low-inv.png
similarity index 100%
rename from icons/battery-low-inv.png
rename to src/Resources/icons/battery-low-inv.png
diff --git a/icons/battery-low.png b/src/Resources/icons/battery-low.png
similarity index 100%
rename from icons/battery-low.png
rename to src/Resources/icons/battery-low.png
diff --git a/icons/battery-medium-inv.png b/src/Resources/icons/battery-medium-inv.png
similarity index 100%
rename from icons/battery-medium-inv.png
rename to src/Resources/icons/battery-medium-inv.png
diff --git a/icons/battery-medium.png b/src/Resources/icons/battery-medium.png
similarity index 100%
rename from icons/battery-medium.png
rename to src/Resources/icons/battery-medium.png
diff --git a/icons/headphones-inv.png b/src/Resources/icons/headphones-inv.png
similarity index 100%
rename from icons/headphones-inv.png
rename to src/Resources/icons/headphones-inv.png
diff --git a/icons/headphones.png b/src/Resources/icons/headphones.png
similarity index 100%
rename from icons/headphones.png
rename to src/Resources/icons/headphones.png
diff --git a/myapp.rc b/src/Resources/myapp.rc
similarity index 100%
rename from myapp.rc
rename to src/Resources/myapp.rc
diff --git a/dialoginfo.cpp b/src/UI/dialoginfo.cpp
similarity index 100%
rename from dialoginfo.cpp
rename to src/UI/dialoginfo.cpp
diff --git a/dialoginfo.h b/src/UI/dialoginfo.h
similarity index 100%
rename from dialoginfo.h
rename to src/UI/dialoginfo.h
diff --git a/dialoginfo.ui b/src/UI/dialoginfo.ui
similarity index 100%
rename from dialoginfo.ui
rename to src/UI/dialoginfo.ui
diff --git a/mainwindow.cpp b/src/UI/mainwindow.cpp
similarity index 100%
rename from mainwindow.cpp
rename to src/UI/mainwindow.cpp
diff --git a/mainwindow.h b/src/UI/mainwindow.h
similarity index 100%
rename from mainwindow.h
rename to src/UI/mainwindow.h
diff --git a/mainwindow.ui b/src/UI/mainwindow.ui
similarity index 100%
rename from mainwindow.ui
rename to src/UI/mainwindow.ui
diff --git a/settingswindow.cpp b/src/UI/settingswindow.cpp
similarity index 100%
rename from settingswindow.cpp
rename to src/UI/settingswindow.cpp
diff --git a/settingswindow.h b/src/UI/settingswindow.h
similarity index 100%
rename from settingswindow.h
rename to src/UI/settingswindow.h
diff --git a/settingswindow.ui b/src/UI/settingswindow.ui
similarity index 100%
rename from settingswindow.ui
rename to src/UI/settingswindow.ui
diff --git a/utils.cpp b/src/Utils/utils.cpp
similarity index 100%
rename from utils.cpp
rename to src/Utils/utils.cpp
diff --git a/utils.h b/src/Utils/utils.h
similarity index 100%
rename from utils.h
rename to src/Utils/utils.h
diff --git a/main.cpp b/src/main.cpp
similarity index 100%
rename from main.cpp
rename to src/main.cpp
From d45f67f170599e4a24572884f48a48bbe5974568 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:45:49 +0200
Subject: [PATCH 32/64] Reorganized files
---
HeadsetControl-GUI.pro | 5 +++--
src/Resources/{myapp.rc => appicon.rc} | 0
src/Resources/translations.qrc | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
rename src/Resources/{myapp.rc => appicon.rc} (100%)
create mode 100644 src/Resources/translations.qrc
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index e5a9bd1..975e8fc 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -32,12 +32,13 @@ FORMS += \
src/UI/settingswindow.ui
TRANSLATIONS += \
- src/Resources/Translations/HeadsetControl_GUI_en_US.ts
+ src/Resources/translations/HeadsetControl_GUI_en_US.ts
RESOURCES += \
src/Resources/icons.qrc
+ src/Resources/translations.qrc
-RC_FILE = src/Resources/myapp.rc
+RC_FILE = src/Resources/appicon.rc
DISTFILES += \
.gitignore
diff --git a/src/Resources/myapp.rc b/src/Resources/appicon.rc
similarity index 100%
rename from src/Resources/myapp.rc
rename to src/Resources/appicon.rc
diff --git a/src/Resources/translations.qrc b/src/Resources/translations.qrc
new file mode 100644
index 0000000..a60ea37
--- /dev/null
+++ b/src/Resources/translations.qrc
@@ -0,0 +1,5 @@
+
+
+ translations/HeadsetControl-Qt_GUI_en_US.qm
+
+
\ No newline at end of file
From 1a85ab882117d0fa3e2f218b0b4071e267536e1d Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:55:50 +0200
Subject: [PATCH 33/64] Some path fixes
---
HeadsetControl-GUI.pro | 4 +-
HeadsetControl-GUI.pro.user | 2 +-
src/Resources/translations.qrc | 4 +-
src/UI/dialoginfo.ui | 8 +-
src/UI/mainwindow.ui | 162 ++++++++++++++++-----------------
src/UI/settingswindow.ui | 10 +-
6 files changed, 101 insertions(+), 89 deletions(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 975e8fc..0ffe026 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -35,8 +35,8 @@ TRANSLATIONS += \
src/Resources/translations/HeadsetControl_GUI_en_US.ts
RESOURCES += \
- src/Resources/icons.qrc
- src/Resources/translations.qrc
+ src/Resources/icons.qrc #\
+ #src/Resources/translations.qrc
RC_FILE = src/Resources/appicon.rc
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index 008d763..b1928f5 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/src/Resources/translations.qrc b/src/Resources/translations.qrc
index a60ea37..83e8958 100644
--- a/src/Resources/translations.qrc
+++ b/src/Resources/translations.qrc
@@ -1,5 +1,5 @@
-
- translations/HeadsetControl-Qt_GUI_en_US.qm
+
+ translations/HeadsetControl_GUI_en_US.ts/file>
\ No newline at end of file
diff --git a/src/UI/dialoginfo.ui b/src/UI/dialoginfo.ui
index f3dd90d..dbb9a85 100644
--- a/src/UI/dialoginfo.ui
+++ b/src/UI/dialoginfo.ui
@@ -19,6 +19,10 @@
Dialog
+
+
+ :/icons/headphones-inv.png:/icons/headphones-inv.png
+
-
@@ -99,7 +103,9 @@
-
+
+
+
buttonBox
diff --git a/src/UI/mainwindow.ui b/src/UI/mainwindow.ui
index a8491e4..716595d 100644
--- a/src/UI/mainwindow.ui
+++ b/src/UI/mainwindow.ui
@@ -3,7 +3,7 @@
MainWindow
- Qt::WindowModality::NonModal
+ Qt::NonModal
@@ -34,11 +34,11 @@
HeadsetControl - GUI
-
+
:/icons/headphones-inv.png:/icons/headphones-inv.png
- Qt::LayoutDirection::LeftToRight
+ Qt::LeftToRight
@@ -81,10 +81,10 @@
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -111,7 +111,7 @@
HeadsetControl couldn't find any compatible or working headsets. :(
- Qt::AlignmentFlag::AlignCenter
+ Qt::AlignCenter
@@ -137,10 +137,10 @@
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -201,10 +201,10 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSizePolicy::Policy::Expanding
+ QSizePolicy::Expanding
@@ -238,10 +238,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
@@ -283,7 +283,7 @@ Model:
Battery:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -319,7 +319,7 @@ Model:
false
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
false
@@ -347,7 +347,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -389,7 +389,7 @@ Model:
- QTabWidget::TabPosition::North
+ QTabWidget::North
0
@@ -423,10 +423,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -459,7 +459,7 @@ Model:
Lights:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -479,7 +479,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -514,10 +514,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -544,14 +544,14 @@ Model:
Sidetone Level:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
- QLayout::SizeConstraint::SetDefaultConstraint
+ QLayout::SetDefaultConstraint
-
@@ -568,10 +568,10 @@ Model:
16
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
16
@@ -590,7 +590,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -603,13 +603,13 @@ Model:
-
- Qt::LayoutDirection::LeftToRight
+ Qt::LeftToRight
Loud
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -629,10 +629,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -665,7 +665,7 @@ Model:
Voice Prompts:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -687,7 +687,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -724,10 +724,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -770,7 +770,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -801,10 +801,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -831,7 +831,7 @@ Model:
Inactivity Timer:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -846,10 +846,10 @@ Model:
90
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
10
@@ -868,7 +868,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -884,7 +884,7 @@ Model:
90 Minutes
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -904,10 +904,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -964,7 +964,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -980,7 +980,7 @@ Model:
-
- Qt::Orientation::Vertical
+ Qt::Vertical
@@ -1012,10 +1012,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1053,7 +1053,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1075,10 +1075,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1128,10 +1128,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1171,7 +1171,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1215,10 +1215,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1245,7 +1245,7 @@ Model:
Rotate to mute:
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -1259,7 +1259,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1288,10 +1288,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1324,7 +1324,7 @@ Model:
false
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
true
@@ -1342,10 +1342,10 @@ Model:
1
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
@@ -1361,7 +1361,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1377,7 +1377,7 @@ Model:
High
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -1397,10 +1397,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1442,10 +1442,10 @@ Model:
16
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QSlider::TickPosition::TicksBelow
+ QSlider::TicksBelow
16
@@ -1464,7 +1464,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1480,7 +1480,7 @@ Model:
Loud
- Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -1494,7 +1494,7 @@ Model:
-
- Qt::Orientation::Vertical
+ Qt::Vertical
@@ -1526,10 +1526,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1572,7 +1572,7 @@ Model:
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
@@ -1603,10 +1603,10 @@ Model:
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -1678,7 +1678,7 @@ Model:
-
- Qt::Orientation::Vertical
+ Qt::Vertical
@@ -1700,7 +1700,7 @@ Model:
0
0
540
- 33
+ 25
@@ -19,6 +19,10 @@
Dialog
+
+
+ :/icons/headphones-inv.png:/icons/headphones-inv.png
+
-
@@ -163,7 +167,9 @@
-
+
+
+
buttonBox
From 50c2b0e4bc4f6a850f99317c913c6f7b92999522 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 16:06:46 +0200
Subject: [PATCH 34/64] Updated gitignore
---
.gitignore | 3 +++
HeadsetControl-GUI.pro.user | 18 ++++++++----------
src/UI/mainwindow.ui | 4 ++--
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/.gitignore b/.gitignore
index f2c8bb5..bf96c2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,6 @@
# Folders
build/*
+
+# User files
+HeadsetControl-GUI.pro.user
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
index b1928f5..180cdc6 100644
--- a/HeadsetControl-GUI.pro.user
+++ b/HeadsetControl-GUI.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
@@ -95,7 +95,7 @@
Desktop Qt 6.7.0 MinGW 64-bit
Desktop Qt 6.7.0 MinGW 64-bit
qt.qt6.670.win64_mingw_kit
- 0
+ 1
0
0
@@ -139,9 +139,8 @@
2
- 1
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug3
+ C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-release
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-release
true
@@ -174,11 +173,10 @@
false
- Release
+ release
Qt4ProjectManager.Qt4BuildConfiguration
- 2
- 1
- 1
+ 0
+ 0
2
@@ -211,7 +209,7 @@
true
true
true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
+ C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-release
1
diff --git a/src/UI/mainwindow.ui b/src/UI/mainwindow.ui
index 716595d..9182388 100644
--- a/src/UI/mainwindow.ui
+++ b/src/UI/mainwindow.ui
@@ -10,7 +10,7 @@
0
0
540
- 741
+ 685
@@ -985,7 +985,7 @@ Model:
20
- 40
+ 0
From c619eb3fadcd5af0f4017c3ef0ecaf25ec8b4b61 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sat, 24 Aug 2024 16:07:30 +0200
Subject: [PATCH 35/64] Removed useless file
---
HeadsetControl-GUI.pro.user | 229 ------------------------------------
1 file changed, 229 deletions(-)
delete mode 100644 HeadsetControl-GUI.pro.user
diff --git a/HeadsetControl-GUI.pro.user b/HeadsetControl-GUI.pro.user
deleted file mode 100644
index 180cdc6..0000000
--- a/HeadsetControl-GUI.pro.user
+++ /dev/null
@@ -1,229 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {1eabfbbb-8689-4576-bded-e9daa00216f3}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- 0
- false
- true
- false
- 2
- true
- true
- 0
- 8
- true
- false
- 1
- true
- true
- true
- *.md, *.MD, Makefile
- false
- true
- true
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
- false
- true
- true
- true
- true
-
-
- 0
- true
-
- true
- true
- Builtin.DefaultTidyAndClazy
- 8
- true
-
-
-
- true
-
-
- true
-
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop
- Desktop Qt 6.7.0 MinGW 64-bit
- Desktop Qt 6.7.0 MinGW 64-bit
- qt.qt6.670.win64_mingw_kit
- 1
- 0
- 0
-
- 0
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-Debug
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-Debug
-
-
- true
- QtProjectManager.QMakeBuildStep
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- false
-
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
-
-
- C:\Users\nicol\Documents\GitHub\HeadsetControl-GUI\build\Desktop_Qt_6_7_0_MinGW_64_bit-release
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-release
-
-
- true
- QtProjectManager.QMakeBuildStep
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- false
-
- release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
-
- 2
-
-
- 0
- Deploy
- Deploy
- ProjectExplorer.BuildSteps.Deploy
-
- 1
-
- false
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
- true
- true
- 0
- true
-
- 2
-
- false
- -e cpu-cycles --call-graph "dwarf,4096" -F 250
-
- Qt4ProjectManager.Qt4RunConfiguration:C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/HeadsetControl-GUI.pro
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/HeadsetControl-GUI.pro
- false
- true
- true
- true
- C:/Users/nicol/Documents/GitHub/HeadsetControl-GUI/build/Desktop_Qt_6_7_0_MinGW_64_bit-release
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 22
-
-
- Version
- 22
-
-
From e1c8ac82e2e15b9fd0928049827b46cd86952584 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 25 Aug 2024 16:20:37 +0200
Subject: [PATCH 36/64] Added CI for build and release
---
.github/VERSION.txt | 1 +
.github/workflows/build-and-release.yml | 166 ++++++++++++++++++++++++
2 files changed, 167 insertions(+)
create mode 100644 .github/VERSION.txt
create mode 100644 .github/workflows/build-and-release.yml
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
new file mode 100644
index 0000000..d33c3a2
--- /dev/null
+++ b/.github/VERSION.txt
@@ -0,0 +1 @@
+0.12.0
\ No newline at end of file
diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml
new file mode 100644
index 0000000..4f89fbc
--- /dev/null
+++ b/.github/workflows/build-and-release.yml
@@ -0,0 +1,166 @@
+name: Build and Release
+
+on:
+ push:
+ branches:
+ - CI-test
+ paths:
+ - '.github/VERSION.txt'
+
+jobs:
+ check-version:
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.get_version.outputs.version }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: Get version
+ id: get_version
+ run: echo "version=$(cat .github/VERSION.txt)" >> $GITHUB_OUTPUT
+
+ build-windows:
+ needs: check-version
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: '6.7.2'
+ add-tools-to-path: true
+
+ - name: Setup MSVC
+ uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Build
+ run: |
+ mkdir build
+ cd build
+ qmake ../
+ nmake
+
+ - name: Remove source and object files
+ shell: pwsh
+ run: |
+ $buildDir = "build/release"
+ if (Test-Path $buildDir) {
+ Get-ChildItem -Path $buildDir -Include *.cpp, *.h, *.obj, *.res -Recurse | Remove-Item -Force
+ } else {
+ Write-Host "Directory not found: $buildDir"
+ }
+
+ - name: Deploy Qt
+ shell: pwsh
+ run: |
+ cd build
+ $windeployqtPath = "D:\a\HeadsetControl-GUI\Qt\6.7.2\msvc2019_64\bin\windeployqt6.exe"
+ if (Test-Path $windeployqtPath) {
+ & $windeployqtPath `
+ --exclude-plugins qsvgicon,qsvg,qico,qjpeg,qgif,qnetworklistmanager,qtuiotouchplugin `
+ --no-opengl-sw `
+ --no-system-dxc-compiler `
+ --no-compiler-runtime `
+ --no-translations `
+ --no-system-d3d-compiler `
+ D:\a\HeadsetControl-GUI\HeadsetControl-GUI\build\release\HeadsetControl-GUI.exe
+ } else {
+ Write-Error "windeploygui not found at the expected path!"
+ exit 1
+ }
+
+ - name: Zip binaries folder
+ run: |
+ $zipFile = "HeadsetControl-GUI_windows_64.zip"
+ $folder = "build/release/"
+ Compress-Archive -Path $folder -DestinationPath $zipFile
+ shell: pwsh
+
+ - name: Upload Windows artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: HeadsetControl-GUI_windows_64
+ path: HeadsetControl-GUI_windows_64.zip
+
+ build-linux:
+ needs: check-version
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: '6.7.2'
+ host: 'linux'
+ add-tools-to-path: true
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y build-essential libgl1-mesa-dev
+
+ - name: Build with qmake
+ run: |
+ mkdir build
+ cd build
+ qmake ../HeadsetControl-GUI.pro CONFIG+=release
+ make -j$(nproc)
+
+ - name: Zip binaries folder
+ run: |
+ zip build/HeadsetControl-GUI_linux_64.zip build/HeadsetControl-GUI
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: HeadsetControl-GUI_linux_64
+ path: build/HeadsetControl-GUI_linux_64.zip
+
+ create-release:
+ needs: [check-version, build-linux, build-windows]
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Download Linux artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: HeadsetControl-GUI_linux_64
+
+ - name: Download Windows artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: HeadsetControl-GUI_windows_64
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ needs.check-version.outputs.version }}
+ release_name: Release v${{ needs.check-version.outputs.version }}
+ draft: false
+ prerelease: false
+
+ - name: Upload Linux Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: ./HeadsetControl-GUI_linux_64.zip
+ asset_name: HeadsetControl-GUI_linux_64_${{ needs.check-version.outputs.version }}.zip
+ asset_content_type: application/octet-stream
+
+ - name: Upload Windows Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: ./HeadsetControl-GUI_windows_64.zip
+ asset_name: HeadsetControl-GUI_windows_64_${{ needs.check-version.outputs.version }}.zip
+ asset_content_type: application/octet-stream
From 762f26785eb3421328777daece9d869be16d9971 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 25 Aug 2024 16:22:17 +0200
Subject: [PATCH 37/64] Update HeadsetControl-GUI.pro
---
HeadsetControl-GUI.pro | 1 -
1 file changed, 1 deletion(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 0ffe026..8524e92 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -2,7 +2,6 @@ QT += core gui network
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
CONFIG += static c++17
-QMAKE_LFLAGS += -static
INCLUDEPATH += \
src/DataTypes \
From 2126b59e2200eeb33ef07e87884482418e644673 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 25 Aug 2024 16:22:32 +0200
Subject: [PATCH 38/64] Update VERSION.txt
---
.github/VERSION.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index d33c3a2..aac2dac 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.0
\ No newline at end of file
+0.12.1
\ No newline at end of file
From 970c7ea5fc604d1c00e6316471f5f21d94db2ead Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 25 Aug 2024 16:32:09 +0200
Subject: [PATCH 39/64] Added build check on push or on PR
---
.github/workflows/build-and-release.yml | 210 ++++++++++++------------
.github/workflows/build.yaml | 56 +++++++
2 files changed, 161 insertions(+), 105 deletions(-)
create mode 100644 .github/workflows/build.yaml
diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml
index 4f89fbc..c3531db 100644
--- a/.github/workflows/build-and-release.yml
+++ b/.github/workflows/build-and-release.yml
@@ -3,9 +3,9 @@ name: Build and Release
on:
push:
branches:
- - CI-test
+ - main
paths:
- - '.github/VERSION.txt'
+ - ".github/VERSION.txt"
jobs:
check-version:
@@ -21,39 +21,39 @@ jobs:
build-windows:
needs: check-version
runs-on: windows-latest
-
+
steps:
- - uses: actions/checkout@v4
-
- - name: Install Qt
- uses: jurplel/install-qt-action@v4
- with:
- version: '6.7.2'
- add-tools-to-path: true
-
- - name: Setup MSVC
- uses: ilammy/msvc-dev-cmd@v1
-
- - name: Build
- run: |
- mkdir build
- cd build
- qmake ../
- nmake
-
- - name: Remove source and object files
- shell: pwsh
- run: |
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: "6.7.2"
+ add-tools-to-path: true
+
+ - name: Setup MSVC
+ uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Build
+ run: |
+ mkdir build
+ cd build
+ qmake ../
+ nmake
+
+ - name: Remove source and object files
+ shell: pwsh
+ run: |
$buildDir = "build/release"
if (Test-Path $buildDir) {
Get-ChildItem -Path $buildDir -Include *.cpp, *.h, *.obj, *.res -Recurse | Remove-Item -Force
} else {
Write-Host "Directory not found: $buildDir"
}
-
- - name: Deploy Qt
- shell: pwsh
- run: |
+
+ - name: Deploy Qt
+ shell: pwsh
+ run: |
cd build
$windeployqtPath = "D:\a\HeadsetControl-GUI\Qt\6.7.2\msvc2019_64\bin\windeployqt6.exe"
if (Test-Path $windeployqtPath) {
@@ -70,97 +70,97 @@ jobs:
exit 1
}
- - name: Zip binaries folder
- run: |
- $zipFile = "HeadsetControl-GUI_windows_64.zip"
- $folder = "build/release/"
- Compress-Archive -Path $folder -DestinationPath $zipFile
- shell: pwsh
-
- - name: Upload Windows artifact
- uses: actions/upload-artifact@v4
- with:
- name: HeadsetControl-GUI_windows_64
- path: HeadsetControl-GUI_windows_64.zip
+ - name: Zip binaries folder
+ run: |
+ $zipFile = "HeadsetControl-GUI_windows_64.zip"
+ $folder = "build/release/"
+ Compress-Archive -Path $folder -DestinationPath $zipFile
+ shell: pwsh
+
+ - name: Upload Windows artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: HeadsetControl-GUI_windows_64
+ path: HeadsetControl-GUI_windows_64.zip
build-linux:
needs: check-version
runs-on: ubuntu-latest
-
+
steps:
- - uses: actions/checkout@v4
-
- - name: Install Qt
- uses: jurplel/install-qt-action@v4
- with:
- version: '6.7.2'
- host: 'linux'
- add-tools-to-path: true
-
- - name: Install dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y build-essential libgl1-mesa-dev
-
- - name: Build with qmake
- run: |
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: "6.7.2"
+ host: "linux"
+ add-tools-to-path: true
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y build-essential libgl1-mesa-dev
+
+ - name: Build with qmake
+ run: |
mkdir build
cd build
qmake ../HeadsetControl-GUI.pro CONFIG+=release
make -j$(nproc)
- - name: Zip binaries folder
- run: |
+ - name: Zip binaries folder
+ run: |
zip build/HeadsetControl-GUI_linux_64.zip build/HeadsetControl-GUI
-
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
name: HeadsetControl-GUI_linux_64
path: build/HeadsetControl-GUI_linux_64.zip
-
+
create-release:
needs: [check-version, build-linux, build-windows]
runs-on: ubuntu-latest
-
+
steps:
- - name: Download Linux artifact
- uses: actions/download-artifact@v4
- with:
- name: HeadsetControl-GUI_linux_64
-
- - name: Download Windows artifact
- uses: actions/download-artifact@v4
- with:
- name: HeadsetControl-GUI_windows_64
-
- - name: Create Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ needs.check-version.outputs.version }}
- release_name: Release v${{ needs.check-version.outputs.version }}
- draft: false
- prerelease: false
-
- - name: Upload Linux Release Asset
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./HeadsetControl-GUI_linux_64.zip
- asset_name: HeadsetControl-GUI_linux_64_${{ needs.check-version.outputs.version }}.zip
- asset_content_type: application/octet-stream
-
- - name: Upload Windows Release Asset
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./HeadsetControl-GUI_windows_64.zip
- asset_name: HeadsetControl-GUI_windows_64_${{ needs.check-version.outputs.version }}.zip
- asset_content_type: application/octet-stream
+ - name: Download Linux artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: HeadsetControl-GUI_linux_64
+
+ - name: Download Windows artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: HeadsetControl-GUI_windows_64
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ needs.check-version.outputs.version }}
+ release_name: Release v${{ needs.check-version.outputs.version }}
+ draft: false
+ prerelease: false
+
+ - name: Upload Linux Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: ./HeadsetControl-GUI_linux_64.zip
+ asset_name: HeadsetControl-GUI_linux_64_${{ needs.check-version.outputs.version }}.zip
+ asset_content_type: application/octet-stream
+
+ - name: Upload Windows Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: ./HeadsetControl-GUI_windows_64.zip
+ asset_name: HeadsetControl-GUI_windows_64_${{ needs.check-version.outputs.version }}.zip
+ asset_content_type: application/octet-stream
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..baa401e
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,56 @@
+name: Build
+
+on:
+ push:
+ branches: [main]
+
+ pull_request:
+ branches: [main]
+
+jobs:
+ build-windows:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: "6.7.2"
+ add-tools-to-path: true
+
+ - name: Setup MSVC
+ uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Build
+ run: |
+ mkdir build
+ cd build
+ qmake ../
+ nmake
+
+ build-linux:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v4
+ with:
+ version: "6.7.2"
+ host: "linux"
+ add-tools-to-path: true
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y build-essential libgl1-mesa-dev
+
+ - name: Build with qmake
+ run: |
+ mkdir build
+ cd build
+ qmake ../HeadsetControl-GUI.pro CONFIG+=release
+ make -j$(nproc)
From 6d35c39cd6f491e953ce4f36e9be665e21033c97 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 25 Aug 2024 16:42:52 +0200
Subject: [PATCH 40/64] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e42bcc9..8197a2c 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Download the corresponding version of [Sapds HeadsetControl from their GitHub pa
Extract HeadsetControl-GUI to any folder of your choice and drop HeadsetControl into the same folder.
The finished folder should look something like this:
-![Screenshot of the folder structure](https://i.imgur.com/bbymxL6.jpg "Screenshot of the folder structure")
+![image](https://github.com/user-attachments/assets/0145ca37-6e59-4170-ba26-804e8856dbc8)
You HAVE to download a version of the [original headsetcontrol](https://github.com/Sapd/HeadsetControl/releases/) and put it in the same folder.
The executable of headsetcontrol has to be called "HeadsetControl".
From 0ffe19a2881de269126e30e3507d3cbfd4becad3 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 10:43:39 +0200
Subject: [PATCH 41/64] Refactored and reorganized code for settingswindow,
removed useless import
---
HeadsetControl-GUI.pro | 7 ++-
src/DataTypes/Device.cpp | 2 +-
src/UI/loaddevicewindow.cpp | 21 ++++++++
src/UI/loaddevicewindow.h | 24 +++++++++
src/UI/loaddevicewindow.ui | 105 ++++++++++++++++++++++++++++++++++++
src/UI/mainwindow.cpp | 43 +++------------
src/UI/mainwindow.h | 2 +-
src/UI/settingswindow.cpp | 14 ++---
src/UI/settingswindow.h | 3 +-
9 files changed, 172 insertions(+), 49 deletions(-)
create mode 100644 src/UI/loaddevicewindow.cpp
create mode 100644 src/UI/loaddevicewindow.h
create mode 100644 src/UI/loaddevicewindow.ui
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 8524e92..336f48e 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -10,23 +10,26 @@ INCLUDEPATH += \
SOURCES += \
src/main.cpp \
- src/DataTypes/Device.cpp \
+ src/DataTypes/device.cpp \
src/DataTypes/settings.cpp \
src/UI/dialoginfo.cpp \
+ src/UI/loaddevicewindow.cpp \
src/UI/mainwindow.cpp \
src/UI/settingswindow.cpp \
src/Utils/utils.cpp
HEADERS += \
- src/DataTypes/Device.h \
+ src/DataTypes/device.h \
src/DataTypes/settings.h \
src/UI/dialoginfo.h \
+ src/UI/loaddevicewindow.h \
src/UI/mainwindow.h \
src/UI/settingswindow.h \
src/Utils/utils.h
FORMS += \
src/UI/dialoginfo.ui \
+ src/UI/loaddevicewindow.ui \
src/UI/mainwindow.ui \
src/UI/settingswindow.ui
diff --git a/src/DataTypes/Device.cpp b/src/DataTypes/Device.cpp
index c054c9c..20f6f3f 100644
--- a/src/DataTypes/Device.cpp
+++ b/src/DataTypes/Device.cpp
@@ -1,4 +1,4 @@
-#include "Device.h"
+#include "device.h"
#include
#include
#include
diff --git a/src/UI/loaddevicewindow.cpp b/src/UI/loaddevicewindow.cpp
new file mode 100644
index 0000000..38d3c1d
--- /dev/null
+++ b/src/UI/loaddevicewindow.cpp
@@ -0,0 +1,21 @@
+#include "loaddevicewindow.h"
+#include "ui_loaddevicewindow.h"
+
+loaddeviceWindow::loaddeviceWindow(const QStringList& devices, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::loaddevicewindow)
+{
+ setModal(true);
+ ui->setupUi(this);
+
+ ui->devicelistComboBox->addItems(devices);
+}
+
+int loaddeviceWindow::getDeviceIndex(){
+ ui->devicelistComboBox->currentIndex();
+}
+
+loaddeviceWindow::~loaddeviceWindow()
+{
+ delete ui;
+}
diff --git a/src/UI/loaddevicewindow.h b/src/UI/loaddevicewindow.h
new file mode 100644
index 0000000..1fc0688
--- /dev/null
+++ b/src/UI/loaddevicewindow.h
@@ -0,0 +1,24 @@
+#ifndef LOADDEVICEWINDOW_H
+#define LOADDEVICEWINDOW_H
+
+#include
+
+namespace Ui {
+class loaddevicewindow;
+}
+
+class loaddeviceWindow : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit loaddeviceWindow(const QStringList& devices, QWidget *parent = nullptr);
+ ~loaddeviceWindow();
+
+ int getDeviceIndex();
+
+private:
+ Ui::loaddevicewindow *ui;
+};
+
+#endif // LOADDEVICEWINDOW_H
diff --git a/src/UI/loaddevicewindow.ui b/src/UI/loaddevicewindow.ui
new file mode 100644
index 0000000..bac630d
--- /dev/null
+++ b/src/UI/loaddevicewindow.ui
@@ -0,0 +1,105 @@
+
+
+ loaddevicewindow
+
+
+
+ 0
+ 0
+ 174
+ 112
+
+
+
+
+ 0
+ 0
+
+
+
+ Select device to load
+
+
+ -
+
+
+ QFrame::Shape::StyledPanel
+
+
+ QFrame::Shadow::Raised
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Select device:
+
+
+
+ -
+
+
+
+
+
+ 99
+
+
+
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+ QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ loaddevicewindow
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ loaddevicewindow
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/UI/mainwindow.cpp b/src/UI/mainwindow.cpp
index 14291fd..77ce8f7 100644
--- a/src/UI/mainwindow.cpp
+++ b/src/UI/mainwindow.cpp
@@ -1,23 +1,11 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include "Device.h"
+#include "device.h"
#include "settings.h"
#include "dialoginfo.h"
#include "settingswindow.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include "loaddevicewindow.h"
+
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@@ -689,7 +677,7 @@ void MainWindow::btonlyRadioButton_clicked(){
void MainWindow::editProgramSetting(){
settingsWindow* settingsW=new settingsWindow(settings, this);
if (settingsW->exec() == QDialog::Accepted) {
- settings=settingsW->temporarySettings;
+ settings=settingsW->getSettings();
saveSettingstoFile(settings, PROGRAM_SETTINGS_FILENAME);
timerGUI->setInterval(settings.msecUpdateIntervalTime);
}
@@ -698,14 +686,6 @@ void MainWindow::editProgramSetting(){
void MainWindow::selectDevice(){
this->loadDevices();
- QDialog dialog;
- dialog.setWindowTitle("Select device to load");
-
- QVBoxLayout layout(&dialog);
-
- QLabel labelWidget("Select device:");
- layout.addWidget(&labelWidget);
-
QStringList devices=QStringList();
for (Device* device : deviceList){
if(device->connected){
@@ -713,18 +693,9 @@ void MainWindow::selectDevice(){
}
}
- QComboBox comboBox;
- comboBox.addItems(devices);
- layout.addWidget(&comboBox);
-
- QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
- layout.addWidget(&buttonBox);
-
- QObject::connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
- QObject::connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
-
- if (dialog.exec() == QDialog::Accepted) {
- int index = comboBox.currentIndex();
+ loaddeviceWindow* loadDevWindow=new loaddeviceWindow(devices, this);
+ if (loadDevWindow->exec() == QDialog::Accepted) {
+ int index = loadDevWindow->getDeviceIndex();
this->disableFrames();
if (index>=0) {
if(index==0){
diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h
index 3be0507..bc163a5 100644
--- a/src/UI/mainwindow.h
+++ b/src/UI/mainwindow.h
@@ -2,7 +2,7 @@
#define MAINWINDOW_H
#include "utils.h"
-#include "Device.h"
+#include "device.h"
#include "settings.h"
#include
#include
diff --git a/src/UI/settingswindow.cpp b/src/UI/settingswindow.cpp
index 8db2b89..49e05de 100644
--- a/src/UI/settingswindow.cpp
+++ b/src/UI/settingswindow.cpp
@@ -13,15 +13,15 @@ settingsWindow::settingsWindow(const Settings& programSettings, QWidget *parent)
ui->runonstartupCheckBox->setChecked(programSettings.runOnstartup);
ui->batterylowtresholdSpinBox->setValue(programSettings.batteryLowThreshold);
ui->updateintervaltimeDoubleSpinBox->setValue((double)programSettings.msecUpdateIntervalTime/1000);
-
- connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &settingsWindow::updateSettings);
- connect(ui->runonstartupCheckBox, &QCheckBox::checkStateChanged, this, &settingsWindow::setRunOnStartup);
}
-void settingsWindow::updateSettings(){
- temporarySettings.runOnstartup=ui->runonstartupCheckBox->isChecked();
- temporarySettings.batteryLowThreshold=ui->batterylowtresholdSpinBox->value();
- temporarySettings.msecUpdateIntervalTime=ui->updateintervaltimeDoubleSpinBox->value()*1000;
+Settings settingsWindow::getSettings(){
+ Settings settings;
+ settings.runOnstartup=ui->runonstartupCheckBox->isChecked();
+ settings.batteryLowThreshold=ui->batterylowtresholdSpinBox->value();
+ settings.msecUpdateIntervalTime=ui->updateintervaltimeDoubleSpinBox->value()*1000;
+
+ return settings;
}
void settingsWindow::setRunOnStartup(){
diff --git a/src/UI/settingswindow.h b/src/UI/settingswindow.h
index ce20510..fa950ca 100644
--- a/src/UI/settingswindow.h
+++ b/src/UI/settingswindow.h
@@ -16,12 +16,11 @@ class settingsWindow : public QDialog
explicit settingsWindow(const Settings& programSettings, QWidget *parent = nullptr);
~settingsWindow();
- Settings temporarySettings;
+ Settings getSettings();
private:
Ui::settings *ui;
- void updateSettings();
void setRunOnStartup();
};
From ffeafdde798f5cd3a9be381950834c26f9623bd2 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 10:43:47 +0200
Subject: [PATCH 42/64] Update utils.cpp
---
src/Utils/utils.cpp | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/Utils/utils.cpp b/src/Utils/utils.cpp
index 3167756..e83af70 100644
--- a/src/Utils/utils.cpp
+++ b/src/Utils/utils.cpp
@@ -1,18 +1,8 @@
#include "utils.h"
#include
-#include
-#include
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
#include
#include
From 2e76094aa749475f248fffbf9557e9a1269a2f1c Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 10:56:49 +0200
Subject: [PATCH 43/64] Fix some import
---
src/DataTypes/Device.cpp | 2 ++
src/DataTypes/Device.h | 3 ---
src/UI/mainwindow.h | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/DataTypes/Device.cpp b/src/DataTypes/Device.cpp
index 20f6f3f..68449f8 100644
--- a/src/DataTypes/Device.cpp
+++ b/src/DataTypes/Device.cpp
@@ -1,6 +1,8 @@
#include "device.h"
#include
#include
+#include
+#include
#include
Battery::Battery(){
diff --git a/src/DataTypes/Device.h b/src/DataTypes/Device.h
index bcc54d6..bb00a61 100644
--- a/src/DataTypes/Device.h
+++ b/src/DataTypes/Device.h
@@ -3,10 +3,7 @@
#include
#include
-#include
-#include
#include
-#include
class Action{
public:
diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h
index bc163a5..278587d 100644
--- a/src/UI/mainwindow.h
+++ b/src/UI/mainwindow.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.0");
From 62be96960d80e0e27db153674b6845bc63ef8c25 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 10:59:44 +0200
Subject: [PATCH 44/64] Update HeadsetControl-GUI.pro
---
HeadsetControl-GUI.pro | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index 336f48e..da8ebe0 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -43,7 +43,8 @@ RESOURCES += \
RC_FILE = src/Resources/appicon.rc
DISTFILES += \
- .gitignore
+ .gitignore \
+ .github/VERSION.txt
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
From ed917d1765470fb079bf90d6a63c546b3c33a482 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:16:10 +0200
Subject: [PATCH 45/64] Updated Version to release new version
---
.github/VERSION.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index aac2dac..26acbf0 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.1
\ No newline at end of file
+0.12.2
From 449c475c8d6bb2306dfea4d91338c6819e1a8b5d Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:23:32 +0200
Subject: [PATCH 46/64] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 8197a2c..a57736e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
A simply remake of [HeadsetControl-GUI](https://github.com/LeoKlaus/HeadsetControl-GUI) by @LeoKlaus
-# HeadsetControl-GUI
+# HeadsetControl-GUI [![Github All Releases](https://img.shields.io/github/downloads/nicola02nb/headsetcontrol-gui/total.svg)]() [![license](https://img.shields.io/github/license/nicola02nb/HeadsetControl-GUI)]()
+
This is a GUI for [Sapds great HeadsetControl](https://github.com/Sapd/HeadsetControl/). It's just a frontend to graphically interact with the original HeadsetControl and has no functionality by itself.
I have to give a huge thank you to Sapd for doing all the heavy lifting and developing the command line tool HeadsetControl without which this project wouldn't be possible.
From f038c029b111fdc5aed8eb03e0efd484a0fd324e Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:35:56 +0200
Subject: [PATCH 47/64] Small fix
---
HeadsetControl-GUI.pro | 2 +-
src/UI/loaddevicewindow.cpp | 2 +-
src/UI/loaddevicewindow.ui | 16 +++++++++++-----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index da8ebe0..a4b61e3 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -1,7 +1,7 @@
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
-CONFIG += static c++17
+CONFIG += c++17
INCLUDEPATH += \
src/DataTypes \
diff --git a/src/UI/loaddevicewindow.cpp b/src/UI/loaddevicewindow.cpp
index 38d3c1d..6887f97 100644
--- a/src/UI/loaddevicewindow.cpp
+++ b/src/UI/loaddevicewindow.cpp
@@ -12,7 +12,7 @@ loaddeviceWindow::loaddeviceWindow(const QStringList& devices, QWidget *parent)
}
int loaddeviceWindow::getDeviceIndex(){
- ui->devicelistComboBox->currentIndex();
+ return ui->devicelistComboBox->currentIndex();
}
loaddeviceWindow::~loaddeviceWindow()
diff --git a/src/UI/loaddevicewindow.ui b/src/UI/loaddevicewindow.ui
index bac630d..cd34f27 100644
--- a/src/UI/loaddevicewindow.ui
+++ b/src/UI/loaddevicewindow.ui
@@ -19,14 +19,18 @@
Select device to load
+
+
+ :/icons/headphones-inv.png:/icons/headphones-inv.png
+
-
- QFrame::Shape::StyledPanel
+ QFrame::StyledPanel
- QFrame::Shadow::Raised
+ QFrame::Raised
-
@@ -58,16 +62,18 @@
-
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
+
+
+
buttonBox
From 5296ddc64f3684fc9fee7f370aa6637ed3b63966 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:41:43 +0200
Subject: [PATCH 48/64] Rename Device.cpp to device.cpp
---
src/DataTypes/{Device.cpp => device.cpp} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename src/DataTypes/{Device.cpp => device.cpp} (100%)
diff --git a/src/DataTypes/Device.cpp b/src/DataTypes/device.cpp
similarity index 100%
rename from src/DataTypes/Device.cpp
rename to src/DataTypes/device.cpp
From 3e0f798df8f614b187318e51270cd3bda20fe598 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:41:55 +0200
Subject: [PATCH 49/64] Rename Device.h to device.h
---
src/DataTypes/{Device.h => device.h} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename src/DataTypes/{Device.h => device.h} (100%)
diff --git a/src/DataTypes/Device.h b/src/DataTypes/device.h
similarity index 100%
rename from src/DataTypes/Device.h
rename to src/DataTypes/device.h
From f1a7bfd768471cd23b8c8214fa3e66515affe255 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:42:44 +0200
Subject: [PATCH 50/64] Update mainwindow.h
---
src/UI/mainwindow.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h
index 278587d..3cc99ab 100644
--- a/src/UI/mainwindow.h
+++ b/src/UI/mainwindow.h
@@ -12,7 +12,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.0");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.2");
QT_BEGIN_NAMESPACE
namespace Ui {
From 123fa4c6681175dd3b0bfb5fe5ddb7b268363656 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 11:43:42 +0200
Subject: [PATCH 51/64] Updated version
---
.github/VERSION.txt | 2 +-
src/UI/mainwindow.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index 26acbf0..aa22d3c 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.2
+0.12.3
diff --git a/src/UI/mainwindow.h b/src/UI/mainwindow.h
index 3cc99ab..1cbd24d 100644
--- a/src/UI/mainwindow.h
+++ b/src/UI/mainwindow.h
@@ -12,7 +12,7 @@
#include
#include
-const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.2");
+const QVersionNumber GUI_VERSION = QVersionNumber::fromString("0.12.3");
QT_BEGIN_NAMESPACE
namespace Ui {
From cbb40d1ceefdc940c807ed3f53ef2cd3c5f4ee46 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 12:19:27 +0200
Subject: [PATCH 52/64] Update build-and-release.yml
---
.github/workflows/build-and-release.yml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml
index c3531db..3e61edb 100644
--- a/.github/workflows/build-and-release.yml
+++ b/.github/workflows/build-and-release.yml
@@ -69,6 +69,11 @@ jobs:
Write-Error "windeploygui not found at the expected path!"
exit 1
}
+ - name: Download ZIP from other repo
+ shell: pwsh
+ run: |
+ Invoke-WebRequest -Uri "https://github.com/Sapd/HeadsetControl/releases/latest/download/headsetcontrol-windows.zip" -OutFile headsetcontrol-windows.zip
+ Expand-Archive -Path headsetcontrol-windows.zip -DestinationPath build/release/
- name: Zip binaries folder
run: |
From eac324aa63697fce6731488bd909db42d0f9df1d Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 12:19:55 +0200
Subject: [PATCH 53/64] Update VERSION.txt
---
.github/VERSION.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index aa22d3c..c5e7738 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.3
+0.12.3 test
From 20891969293a5a342efb871499e8ebfcc6ae20d4 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 12:24:28 +0200
Subject: [PATCH 54/64] Update VERSION.txt
---
.github/VERSION.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index c5e7738..b907321 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.3 test
+v0.12.3
From cded936a4732ca7f2e98e350c8dabf425d219613 Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Tue, 27 Aug 2024 12:28:32 +0200
Subject: [PATCH 55/64] Update VERSION.txt
---
.github/VERSION.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index b907321..e01e0dd 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-v0.12.3
+0.12.4
From 71ffd5e523a77bee543a8760453d48514f3eea6a Mon Sep 17 00:00:00 2001
From: nicola02nb <61830443+nicola02nb@users.noreply.github.com>
Date: Sun, 1 Sep 2024 22:23:27 +0200
Subject: [PATCH 56/64] Added transaltions, removed save settings button
---
.github/VERSION.txt | 2 +-
HeadsetControl-GUI.pro | 9 +-
.../Translations/HeadsetControl_GUI_en_US.ts | 3 -
src/Resources/tr/HeadsetControl_GUI_en_US.qm | Bin 0 -> 5364 bytes
src/Resources/tr/HeadsetControl_GUI_en_US.ts | 452 +++++++++++++++
src/Resources/tr/HeadsetControl_GUI_it_IT.qm | Bin 0 -> 9610 bytes
src/Resources/tr/HeadsetControl_GUI_it_IT.ts | 460 ++++++++++++++++
src/Resources/translations.qrc | 7 +-
src/UI/dialoginfo.cpp | 8 +-
src/UI/dialoginfo.h | 7 +-
src/UI/dialoginfo.ui | 2 +-
src/UI/loaddevicewindow.cpp | 6 +-
src/UI/loaddevicewindow.h | 6 +-
src/UI/mainwindow.cpp | 227 ++++----
src/UI/mainwindow.h | 8 +-
src/UI/mainwindow.ui | 515 ++++++++----------
src/UI/settingswindow.cpp | 12 +-
src/UI/settingswindow.h | 10 +-
src/UI/settingswindow.ui | 80 +--
src/main.cpp | 19 +-
20 files changed, 1374 insertions(+), 459 deletions(-)
delete mode 100644 src/Resources/Translations/HeadsetControl_GUI_en_US.ts
create mode 100644 src/Resources/tr/HeadsetControl_GUI_en_US.qm
create mode 100644 src/Resources/tr/HeadsetControl_GUI_en_US.ts
create mode 100644 src/Resources/tr/HeadsetControl_GUI_it_IT.qm
create mode 100644 src/Resources/tr/HeadsetControl_GUI_it_IT.ts
diff --git a/.github/VERSION.txt b/.github/VERSION.txt
index e01e0dd..43c2417 100644
--- a/.github/VERSION.txt
+++ b/.github/VERSION.txt
@@ -1 +1 @@
-0.12.4
+0.12.5
diff --git a/HeadsetControl-GUI.pro b/HeadsetControl-GUI.pro
index a4b61e3..0a7f15c 100644
--- a/HeadsetControl-GUI.pro
+++ b/HeadsetControl-GUI.pro
@@ -9,13 +9,13 @@ INCLUDEPATH += \
src/Utils
SOURCES += \
+ src/UI/settingswindow.cpp \
src/main.cpp \
src/DataTypes/device.cpp \
src/DataTypes/settings.cpp \
src/UI/dialoginfo.cpp \
src/UI/loaddevicewindow.cpp \
src/UI/mainwindow.cpp \
- src/UI/settingswindow.cpp \
src/Utils/utils.cpp
HEADERS += \
@@ -34,11 +34,12 @@ FORMS += \
src/UI/settingswindow.ui
TRANSLATIONS += \
- src/Resources/translations/HeadsetControl_GUI_en_US.ts
+ src/Resources/tr/HeadsetControl_GUI_en_US.ts \
+ src/Resources/tr/HeadsetControl_GUI_it_IT.ts
RESOURCES += \
- src/Resources/icons.qrc #\
- #src/Resources/translations.qrc
+ src/Resources/icons.qrc \
+ src/Resources/translations.qrc
RC_FILE = src/Resources/appicon.rc
diff --git a/src/Resources/Translations/HeadsetControl_GUI_en_US.ts b/src/Resources/Translations/HeadsetControl_GUI_en_US.ts
deleted file mode 100644
index edd0d34..0000000
--- a/src/Resources/Translations/HeadsetControl_GUI_en_US.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/src/Resources/tr/HeadsetControl_GUI_en_US.qm b/src/Resources/tr/HeadsetControl_GUI_en_US.qm
new file mode 100644
index 0000000000000000000000000000000000000000..d3f19e8aa659c3b442d739a98a7b8d2f73d56334
GIT binary patch
literal 5364
zcma)AdyE@L9Uj~3_bZn+fuf>0WXNc2Ies9LB}RTPTa6BVLTDHQ~zKvhtKLipBuzT_^~
z9pA}X&+a$h{C+dv@3GE3u6+31J3suvOIvPw=F5*h{l}ApkRa2)G*cWV#D4~ZFA|bi
zAY|rOxGF??_-@>b5a~A(A)$MT^zv3*&k||zR$N~r(%%ONiPVYo&LXZSNO1RALZS;K
zI6H>T9%HE85w~*(5caV^t
zKJr5S#~5EE=kJ0&zSn)5*Xx9=``^I;{Z-&OUp2qr0$bNGV@Eb#S
ze+)eS?}Z+jX%G@tLT83v1^yqQv&Dbo`E8-M4;}@7DV*93zXG2OS6K`AC&OR+=g)xu
zMEIN5-{9|q5$VvK@M9u!>vI@~YLO>j`YiCtXkYrTu>VxFeEuz5e;Zx+#UEh*VDujU
zJa89d(LarY=b_l~Gw;Ig)3N*aK?l)j?D8AVx%@nS>=1MkS{HvY^8nVlG5)_l<9_mZ
z;^6gzutP~a`fi}bO&vE0)5GxOltg|nAy{tFV$2tmyz>SHK|N1+&Ih>I?oJKP1~({0>dF%{7UyUCddgKR0LO
zCuN1vxt1rl!0aoJ9ae{Q*0niHJ@<-?=W146%jas?iwq`mrIpV$@}q2CEwe0$GGM|v
z8}9c>t}rc|%QW)2jEl{*=X);_9Gc^{<&8-XH5yurj(ydZHT5VnywTC&5|wp@?j7;Q
zg@NO`=437p(WZuF%VI{04r$D=ws?ahOW>?G?1f>qO3fPl?!$*#+}Xf9f}tNmsE<#=$G@OCpgtl7-s+^TuwlFK-XNcYAj
zuEOfx(2ZB1Wm(hcJlE_x6CBN^E0dZvrqc#*G6P}Gb-_dlIZz
zrZWviwwQN1BRwwGk&N99K0E?vR7=46kx@ggLY7okzG9meEvgF6QD@N7Jkz{)J=$fI
z_AKLQ!(d3Yf?bI%;{`xz?1(Bj2x(l^n713!gj^Ru;!80h7VVam(LiDW(X7&E`ZW91*mvIt*fXMVmZW?
zk%9~sFK}5w$K=#of!76YE8dW3fj7Hqr6$#~!5cNiyEozbE5I&u>!fO$R~>lStyTT(
zh+w4?A3V`1oTI#{YtBx2HDGI0&5Xe`CY#L6XilcJdh<(4Tr$k5a8%W)RfAj`Oh*~0
za7|%GzxT#$m_*mAPz|3s!;y~8Op$t$Qw)Ws(@lEwr>8ibTk1+wy~4fGHv)ZC+_`Fk
zBet#xx|t1_>F_(ft+NM8H$t2e>gKvBZmAWuj6{IGx#$=o2(5syE$~kZLMb>64+M>4
zWbX*=+cl^Rdv9oPpRF=Mg^9N@-Gp0s|HLqz9v}B!Gt@>+d4tmXxdkCRg}V*~3N|%a
zl;>Hj$SeyXDQE~H-NB?{jW-20uIwcQHik+FOFH09>4J87gSM9-;7-s$&n<2noxx{OzS91>2YF)E>;8r!(rejTN*j(Uoh0oX(>mvin@yT){ZNovF|%!pXv(p*
z-&NfvnmX1Ym7zM%%Nn&%^XWE|AY5t8VyvW7GR>{BVIBY{`aYH@aY7
PkqB0ke;dB~eZKz#_^U7#
literal 0
HcmV?d00001
diff --git a/src/Resources/tr/HeadsetControl_GUI_en_US.ts b/src/Resources/tr/HeadsetControl_GUI_en_US.ts
new file mode 100644
index 0000000..09e5eb1
--- /dev/null
+++ b/src/Resources/tr/HeadsetControl_GUI_en_US.ts
@@ -0,0 +1,452 @@
+
+
+
+
+ MainWindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dialogInfo
+
+
+
+
+
+
+
+ loaddevicewindow
+
+
+
+
+
+
+
+
+
+
+
+
+ settingswindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Battery low treshold:
+
+
+
+
+
+
+
+
diff --git a/src/Resources/tr/HeadsetControl_GUI_it_IT.qm b/src/Resources/tr/HeadsetControl_GUI_it_IT.qm
new file mode 100644
index 0000000000000000000000000000000000000000..fad5b640494745a8fdff377a95cf6a92fcfcc881
GIT binary patch
literal 9610
zcmbtZ3v3(p8ULKvc{qvFmbR2Mlz+Q+NlO!_WmF>ymhvoFousYPfDmH4_%8OXmpfyh
zlcs1}Hy#>8nm`keNgD`F>I9pBO-N;%7#e~J6*16|pqe%fX%E;s!8Wu_Y-8Q;yYt=I
z&fo5XR*vt^|L^ht{@?fe9yj!?y6N=$-+JKHt=-Rm?y={7^Ial}==NtPXGe${p2p3s
zL{|(E9r-!FV-$YmPNKGb6n-sC)Nz)=ukRp=ZKUv-Yw^S1oR2t9@?_bB)aNUC>i+#^!a<}Xc+6SoDRLP_g~n-c<4;=
zYedmk8x|W|asODuk5-zAx~+x}uXqp7H#dCrpF!|%Y>a<|pF>wS-rIPZXybv#XA2vM
z)?XfOYWW6!_-i=+k_Np);ivAnk!Z`Q@au1YZ$~nGHXemu?}pDk{15Os9ocaL`(1M&
zGBCyac_^~)e(1G16j8seg6`LmqvHvpt`m_jU;YO4eK_*{ldw~FE57&Odnoc@{_D{H
zt)}rEPeT5QrsD4=!RNnCcWwipruL>skK~9t_cc8|{3h0go1RJi6a11*@7#PGcDSiI
zwh#Mi4mW4C6|5g={=(l*;XHoWe3$)a?02Che9ITHzfOzKHvdlPy1f^)p!aN^4)|
zpJ3PV*7Vsw;QOA|yMOvC?DyH$dm5HNZ$?{xI{~@hiQfD42Sn}D(T5Jf57u21J@+=w
zWm|XK9k;+wI-+f_#2+SVeW2}szsK{gAGF`RelO1Vnf9NA3b4Z=_j_Bu{Y>}}nS$6l=V@3wF|C_m1s?eU#X9ZKrX+KK9;6yCL^0u@7?4ckTB&6IWk_
zeVpsO|B*jJ-fNu?^*#uDe6#bNH;+Tk^E#Azsu7I4Xa@=E!)KCA{2e8Q@}yImlol4;
zgirep(I-Z;Nm(ChjfT=_?u=5L3EYv^CK?v#_vJrs_Jnu9~4w9=*<^
zFGxrmw$l*yASjD{XtY4rQxC3rw>c`%AjR=N1O03~Ez&%!l7@DRcxvJ)UmKtwpuM=C
z$I~0YMIjZm8fZrGJMSm&tm~uwbOcAzLkT(rZW>nESUm(f1kLPVpe0=AL8UuB(YOD|WKUu?s~3jiN;XAz#2aIW2Wh&y-l
z@Hv%Moa-F^j=_@)h&0RbX~uyiTo0DKhH2at96>rfiLrv?LaSIa<#2VQ#HEgdCrgim
zCXg5pH1kfBCWf;1qLCQN;>60MRlLQkMt};;*i9iY&cn;!`MQoWc`h|ju=JF
zwk$g