mirror of
https://github.com/FAUSheppy/speech-server-client-qt
synced 2025-12-06 17:01:35 +01:00
Save settings before running check
https://github.com/FAUSheppy/speech-server-client-qt/issues/1
This commit is contained in:
11
settings.cpp
11
settings.cpp
@@ -97,6 +97,7 @@ void Settings::selectSettings(QSettings *selectedSettings){
|
||||
}
|
||||
|
||||
void Settings::checkConfig(){
|
||||
saveSetting();
|
||||
ServerConnection *sc = new ServerConnection(this, mySettings);
|
||||
connect(sc->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(handleTestConnectionResult(QNetworkReply*)));
|
||||
sc->queryServerVersion();
|
||||
@@ -134,6 +135,8 @@ void Settings::handleTestConnectionResult(QNetworkReply* reply){
|
||||
|
||||
auto cw = this->findChild<QWidget*>("centralwidget");
|
||||
QGridLayout *layout = static_cast<QGridLayout*>(cw->layout());
|
||||
delete currentConfigCheckDisplay; //this removes it from the layout
|
||||
currentConfigCheckDisplay = testResult;
|
||||
layout->addWidget(testResult, configOptions->length(), 1);
|
||||
}
|
||||
|
||||
@@ -144,14 +147,18 @@ void Settings::cancleClose(){
|
||||
this->close();
|
||||
}
|
||||
|
||||
void Settings::okClose(){
|
||||
void Settings::saveSetting(){
|
||||
QSettings mySettings;
|
||||
for(auto key : configLineEditMap->keys()){
|
||||
QString input = configLineEditMap->take(key)->text();
|
||||
QString input = configLineEditMap->value(key)->text();
|
||||
if(input.compare("") != 0){
|
||||
this->mySettings->setValue(key, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::okClose(){
|
||||
saveSetting();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QSettings>
|
||||
#include <QNetworkReply>
|
||||
#include <QLabel>
|
||||
|
||||
namespace Ui {
|
||||
class settings;
|
||||
@@ -30,6 +31,8 @@ private:
|
||||
QHash<QString, QLineEdit*> *configLineEditMap;
|
||||
QStringList *configOptionsKeys;
|
||||
QStringList *configOptions;
|
||||
void saveSetting();
|
||||
QLabel *currentConfigCheckDisplay;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
||||
Reference in New Issue
Block a user