mirror of
https://github.com/FAUSheppy/speech-server-client-qt
synced 2025-12-06 00:41:35 +01:00
implement server config remove button
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "multivalueinputdialog.h"
|
||||
#include "urls.h"
|
||||
#include "pushbuttonwithposition.h"
|
||||
|
||||
ServerConfig::ServerConfig(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
|
||||
|
||||
@@ -78,6 +79,19 @@ ServerConfig::ServerConfig(QWidget *parent, QSettings *settings) : QMainWindow(p
|
||||
this->setCentralWidget(mainWidget);
|
||||
}
|
||||
|
||||
void ServerConfig::removePP(){
|
||||
PushButtonWithPosition* pButton = static_cast<PushButtonWithPosition*>(sender());
|
||||
auto key = ppTable->item(pButton->row, 0);
|
||||
auto repl = ppTable->item(pButton->row, 1);
|
||||
sc->submitPostProcessorChange(key->text(), repl->text(), true);
|
||||
}
|
||||
|
||||
void ServerConfig::removeContext(){
|
||||
PushButtonWithPosition* pButton = static_cast<PushButtonWithPosition*>(sender());
|
||||
auto label = contextTable->item(pButton->row, 0);
|
||||
sc->submitSpeechContextPhraseChange(label->text(), true);
|
||||
}
|
||||
|
||||
void ServerConfig::addNewPP(){
|
||||
|
||||
QStringList *sl = new QStringList();
|
||||
@@ -185,7 +199,9 @@ void ServerConfig::finishedRequest(QNetworkReply *reply){
|
||||
contextTable->setItem(i, 0, new QTableWidgetItem(phrases.at(i).toString()));
|
||||
auto *deleteButtonLayout = new QGridLayout();
|
||||
auto *deleteCell = new QWidget();
|
||||
auto *deleteButton = new QPushButton("Entfernen");
|
||||
auto *deleteButton = new PushButtonWithPosition(i, "Entfernen");
|
||||
connect(deleteButton, SIGNAL (released()), this, SLOT (removeContext()));
|
||||
|
||||
deleteButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
deleteButtonLayout->addWidget(deleteButton);
|
||||
deleteButtonLayout->setContentsMargins(0,0,0,0);
|
||||
@@ -201,7 +217,9 @@ void ServerConfig::finishedRequest(QNetworkReply *reply){
|
||||
ppTable->setItem(i, 1, new QTableWidgetItem(keywordMap[key].toString()));
|
||||
auto *deleteButtonLayout = new QGridLayout();
|
||||
auto *deleteCell = new QWidget();
|
||||
auto *deleteButton = new QPushButton("Entfernen");
|
||||
auto *deleteButton = new PushButtonWithPosition(i, "Entfernen");
|
||||
connect(deleteButton, SIGNAL (released()), this, SLOT (removePP()));
|
||||
|
||||
deleteButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
deleteButtonLayout->addWidget(deleteButton);
|
||||
deleteButtonLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
Reference in New Issue
Block a user