mirror of
https://github.com/FAUSheppy/speech-server-client-qt
synced 2025-12-07 17:31:34 +01:00
Compare commits
9 Commits
v1.0-maste
...
v1.1-maste
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f6862e26b | ||
|
|
4bee34fbd6 | ||
|
|
5a4620191c | ||
|
|
b7023d348b | ||
|
|
30291ef72d | ||
|
|
758babcaf8 | ||
|
|
205f591dad | ||
|
|
916005ddea | ||
|
|
41c29d43ce |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
*.user
|
*.user
|
||||||
|
*.stash
|
||||||
|
Makefile
|
||||||
|
|||||||
29
README.md
Normal file
29
README.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Intro
|
||||||
|
This is the GUI Interface to a proprietary server that interfaces with speech recognition backends.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Build on Linux
|
||||||
|
This is a qt-creator project and can be imported as such. To build for Windows (on Linux) you need [MXE](https://github.com/mxe/mxe.git).
|
||||||
|
|
||||||
|
To download and compile MXE and dependencies:
|
||||||
|
|
||||||
|
git clone https://github.com/mxe/mxe.git
|
||||||
|
cd mxe && make qtbase
|
||||||
|
make -j 4 qt qt5 MXE_TARGETS='x86_64-w64-mingw32.shared i686-w64-mingw32.shared x86_64-w64-mingw32.static i686-w64-mingw32.static'
|
||||||
|
make qtbase
|
||||||
|
|
||||||
|
Setup the actual compilation enviroment:
|
||||||
|
|
||||||
|
MXE_ROOT=/path/to/mxe/root/
|
||||||
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$MXE_ROOT/usr/bin
|
||||||
|
$MXE_ROOT/usr/bin/i686-w64-mingw32.static-qmake-qt5
|
||||||
|
make
|
||||||
|
|
||||||
|
Also check the ``cross_compile.sh`` file in this project.
|
||||||
|
|
||||||
|
# Build on Windows
|
||||||
|
If you want to build this project on windows, you need change the way this project determines some of it's defines in the project file.
|
||||||
|
|
||||||
|
# Build for Mac
|
||||||
|
This project does not currently support Mac.
|
||||||
74
about.cpp
74
about.cpp
@@ -1,49 +1,89 @@
|
|||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "ui_about.h"
|
#include "serverconnection.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
#include <QJsonDocument>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
About::About(QWidget *parent) : QMainWindow(parent) {
|
#define Y_POS_VERSION 0
|
||||||
|
#define Y_POS_SERVER_INFO 1
|
||||||
|
#define Y_POS_BUILD_DATE 2
|
||||||
|
#define Y_POS_BUILD_HOST 3
|
||||||
|
|
||||||
QGridLayout *mainLayout = new QGridLayout();
|
About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
|
||||||
|
|
||||||
|
mySettings = settings;
|
||||||
|
mainLayout = new QGridLayout();
|
||||||
|
|
||||||
/* config options layout */
|
|
||||||
QGridLayout *layoutLegal = new QGridLayout();
|
|
||||||
QGridLayout *layoutSoftwareinfo = new QGridLayout();
|
|
||||||
|
|
||||||
/* create legal box */
|
/* create legal box */
|
||||||
|
QGridLayout *layoutLegal = new QGridLayout();
|
||||||
QGroupBox *legalGroup = new QGroupBox();
|
QGroupBox *legalGroup = new QGroupBox();
|
||||||
|
legalGroup->setTitle("Rechtliches");
|
||||||
|
QLabel *licenseLabel = new QLabel("Diese Software wird unter der <a href=\"https://www.gnu.org/licenses/gpl-3.0-standalone.html\">GPLv3</a> verbreitet."
|
||||||
|
"<br>Code und Kompelierungsinstruktionen sind konform zur Lizenz <a href=\"https://github.com/FAUSheppy/speech-server-client-qt\">hier</a> "
|
||||||
|
"zugänglich.");
|
||||||
|
licenseLabel->setOpenExternalLinks(true);
|
||||||
|
layoutLegal->addWidget(licenseLabel, 0, 0);
|
||||||
|
layoutLegal->addWidget(new QLabel("Author: Yannik Schmidt"), 1, 0);
|
||||||
|
legalGroup->setLayout(layoutLegal);
|
||||||
|
|
||||||
/* create software infor group */
|
/* create software infor group */
|
||||||
QGroupBox *softwareInfoGroup = new QGroupBox();
|
layoutSoftwareinfo = new QGridLayout();
|
||||||
|
softwareInfoGroup = new QGroupBox();
|
||||||
QString *version = getCurrentVersion();
|
QString *version = getCurrentVersion();
|
||||||
QLabel *richText = new QLabel();
|
QLabel *versionLabelIdent = new QLabel("GUI Version:");
|
||||||
richText->setText(*version);
|
QLabel *versionLabel = new QLabel();
|
||||||
softwareInfoGroup->setTitle("Software Information");
|
serverInfo = new QLabel("Wird ermittelt..");
|
||||||
|
versionLabel->setText(*version);
|
||||||
|
|
||||||
layoutSoftwareinfo->addWidget(richText);
|
QLabel *buildDateLabelIdent = new QLabel("Version gebaut:");
|
||||||
|
QLabel *buildDateLabel = new QLabel(BUILD_DATE);
|
||||||
|
layoutSoftwareinfo->addWidget(buildDateLabelIdent, Y_POS_BUILD_DATE, 0);
|
||||||
|
layoutSoftwareinfo->addWidget(buildDateLabel, Y_POS_BUILD_DATE, 1);
|
||||||
|
|
||||||
|
QLabel *buildHostLabelIdent = new QLabel("Kompilations Host:");
|
||||||
|
QLabel *buildHostLabel = new QLabel(BUILD_HOST);
|
||||||
|
layoutSoftwareinfo->addWidget(buildHostLabelIdent, Y_POS_BUILD_HOST, 0);
|
||||||
|
layoutSoftwareinfo->addWidget(buildHostLabel, Y_POS_BUILD_HOST, 1);
|
||||||
|
|
||||||
|
softwareInfoGroup->setTitle("Software Information");
|
||||||
|
layoutSoftwareinfo->addWidget(versionLabelIdent, Y_POS_VERSION, 0);
|
||||||
|
layoutSoftwareinfo->addWidget(versionLabel, Y_POS_VERSION, 1);
|
||||||
|
layoutSoftwareinfo->addWidget(new QLabel("Server Version:"), Y_POS_SERVER_INFO, 0);
|
||||||
|
layoutSoftwareinfo->addWidget(serverInfo, Y_POS_SERVER_INFO, 1);
|
||||||
softwareInfoGroup->setLayout(layoutSoftwareinfo);
|
softwareInfoGroup->setLayout(layoutSoftwareinfo);
|
||||||
|
|
||||||
/* add groups to main layout */
|
/* add groups to main layout */
|
||||||
mainLayout->addWidget(softwareInfoGroup);
|
mainLayout->addWidget(softwareInfoGroup);
|
||||||
|
mainLayout->addWidget(legalGroup);
|
||||||
|
|
||||||
/* setup main window */
|
/* setup main window */
|
||||||
QWidget *mainWidget = new QWidget(this);
|
QWidget *mainWidget = new QWidget(this);
|
||||||
mainWidget->setLayout(mainLayout);
|
mainWidget->setLayout(mainLayout);
|
||||||
this->setCentralWidget(mainWidget);
|
this->setCentralWidget(mainWidget);
|
||||||
|
|
||||||
|
/* get server info and set as soon as possible*/
|
||||||
|
ServerConnection *sc = new ServerConnection(this, mySettings);
|
||||||
|
connect(sc->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(handleServerVersion(QNetworkReply*)));
|
||||||
|
sc->queryServerVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
About::~About()
|
About::~About()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString* About::getCurrentVersion(){
|
void About::handleServerVersion(QNetworkReply* reply){
|
||||||
return new QString("<p>LOLOLOL</p>");
|
if(reply->error() != QNetworkReply::NoError){
|
||||||
|
serverInfo->setText(reply->errorString());
|
||||||
|
}else {
|
||||||
|
QJsonDocument json = QJsonDocument::fromJson(reply->readAll());
|
||||||
|
auto serverInfoValue = json["server-version"].toString();
|
||||||
|
serverInfo->setText(serverInfoValue + " (kompatibel)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString* About::getServerVersion(){
|
QString* About::getCurrentVersion(){
|
||||||
return new QString("<p>LOLOLOL</p>");
|
QString *string = new QString(GIT_VERSION);
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
|
|||||||
16
about.h
16
about.h
@@ -1,19 +1,31 @@
|
|||||||
#ifndef ABOUT_H
|
#ifndef ABOUT_H
|
||||||
#define ABOUT_H
|
#define ABOUT_H
|
||||||
|
|
||||||
|
#include <QBoxLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
class About : public QMainWindow
|
class About : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit About(QWidget *parent = nullptr);
|
explicit About(QWidget *parent = nullptr, QSettings *settings = nullptr);
|
||||||
~About();
|
~About();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleServerVersion(QNetworkReply*);
|
||||||
private:
|
private:
|
||||||
|
QGridLayout* mainLayout;
|
||||||
|
QGridLayout* layoutSoftwareinfo;
|
||||||
|
QLabel* serverInfo;
|
||||||
|
QGroupBox* softwareInfoGroup;
|
||||||
|
QSettings* mySettings;
|
||||||
QString* getCurrentVersion();
|
QString* getCurrentVersion();
|
||||||
QString *getServerVersion();
|
QString* getServerVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ABOUT_H
|
#endif // ABOUT_H
|
||||||
|
|||||||
37
listItemServeConfig.ui
Normal file
37
listItemServeConfig.ui
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "notificationwidget.h"
|
#include "notificationwidget.h"
|
||||||
|
#include "serverconfig.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -80,13 +81,20 @@ MainWindow::MainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::MainWind
|
|||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
|
|
||||||
/* add handler for menu configuration */
|
/* add handler for menu configuration */
|
||||||
ui->menuKonfiguration->addAction("Standards", this, SLOT(openConfigurationWindow()) );
|
ui->menuKonfiguration->addAction("Spracherkennung", this, SLOT(openSpeechConfigWindow()) );
|
||||||
|
ui->menuKonfiguration->addAction("Konfiguration", this, SLOT(openConfigurationWindow()) );
|
||||||
ui->menuKonfiguration->addAction("Über diese Software", this, SLOT(openAboutWindow()) );
|
ui->menuKonfiguration->addAction("Über diese Software", this, SLOT(openAboutWindow()) );
|
||||||
|
|
||||||
/* set window options */
|
/* set window options */
|
||||||
this->setWindowTitle(WINDOW_TITLE);
|
this->setWindowTitle(WINDOW_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::openSpeechConfigWindow(){
|
||||||
|
ServerConfig *serverConfig = new ServerConfig(this, mySettings);
|
||||||
|
serverConfig->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
serverConfig->show();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::openConfigurationWindow(){
|
void MainWindow::openConfigurationWindow(){
|
||||||
Settings *settingsWindow = new Settings();
|
Settings *settingsWindow = new Settings();
|
||||||
settingsWindow->selectSettings(this->mySettings);
|
settingsWindow->selectSettings(this->mySettings);
|
||||||
@@ -96,7 +104,7 @@ void MainWindow::openConfigurationWindow(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openAboutWindow(){
|
void MainWindow::openAboutWindow(){
|
||||||
About *aboutWindow = new About();
|
About *aboutWindow = new About(this, mySettings);
|
||||||
aboutWindow->setAttribute(Qt::WA_DeleteOnClose);
|
aboutWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
aboutWindow->show();
|
aboutWindow->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ private slots:
|
|||||||
void openConfigurationWindow();
|
void openConfigurationWindow();
|
||||||
void appyConfigChanges();
|
void appyConfigChanges();
|
||||||
void openAboutWindow();
|
void openAboutWindow();
|
||||||
|
void openSpeechConfigWindow();
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QTableWidget *tw;
|
QTableWidget *tw;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuKonfiguration">
|
<widget class="QMenu" name="menuKonfiguration">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Konfiguration</string>
|
<string>&Weitere Optionen</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuKonfiguration"/>
|
<addaction name="menuKonfiguration"/>
|
||||||
|
|||||||
24
multivalueinputdialog.cpp
Normal file
24
multivalueinputdialog.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "multivalueinputdialog.h"
|
||||||
|
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
MultiValueInputDialog::MultiValueInputDialog(QStringList *inputValueLabels, QWidgetList *inputWidgets){
|
||||||
|
|
||||||
|
QFormLayout *form = new QFormLayout();
|
||||||
|
for(int i = 0; i<inputValueLabels->size(); i++){
|
||||||
|
form->addRow(new QLabel(inputValueLabels->at(i)));
|
||||||
|
form->addRow(inputWidgets->at(i));
|
||||||
|
}
|
||||||
|
// Add some text above the fields
|
||||||
|
|
||||||
|
// Add some standard buttons (Cancel/Ok) at the bottom of the dialog
|
||||||
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||||
|
form->addRow(buttonBox);
|
||||||
|
|
||||||
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
|
this->setLayout(form);
|
||||||
|
}
|
||||||
13
multivalueinputdialog.h
Normal file
13
multivalueinputdialog.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef MULTIVALUEINPUTDIALOG_H
|
||||||
|
#define MULTIVALUEINPUTDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
class MultiValueInputDialog : public QDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MultiValueInputDialog(QStringList *inputValueLabels, QWidgetList *inputWidgets);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MULTIVALUEINPUTDIALOG_H
|
||||||
194
serverconfig.cpp
Normal file
194
serverconfig.cpp
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
#include "serverconfig.h"
|
||||||
|
#include "serverconnection.h"
|
||||||
|
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QtUiTools>
|
||||||
|
|
||||||
|
#include "multivalueinputdialog.h"
|
||||||
|
#include "urls.h"
|
||||||
|
|
||||||
|
ServerConfig::ServerConfig(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
|
||||||
|
|
||||||
|
mySettings = settings;
|
||||||
|
|
||||||
|
sc = new ServerConnection(this, mySettings);
|
||||||
|
connect(sc->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(finishedRequest(QNetworkReply*)), Qt::UniqueConnection);
|
||||||
|
sc->getUnifiedServerConfig();
|
||||||
|
|
||||||
|
/* post processing group */
|
||||||
|
QGroupBox *pp = new QGroupBox();
|
||||||
|
pp->setTitle("Post Processing");
|
||||||
|
ppTable = new QTableWidget();
|
||||||
|
|
||||||
|
/* table ui */
|
||||||
|
ppTable->verticalHeader()->setVisible(false);
|
||||||
|
ppTable->horizontalHeader()->setVisible(false);
|
||||||
|
ppTable->setRowCount(0);
|
||||||
|
|
||||||
|
QStringList *headerList = new QStringList();
|
||||||
|
headerList->append("Suchwort");
|
||||||
|
headerList->append("Ersetzen durch");
|
||||||
|
headerList->append("Entfernen");
|
||||||
|
|
||||||
|
ppTable->setColumnCount(headerList->length());
|
||||||
|
ppTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
|
|
||||||
|
QGridLayout *innerLayoutPP = new QGridLayout();
|
||||||
|
QPushButton *addNew = new QPushButton("Neue Regel");
|
||||||
|
innerLayoutPP->addWidget(ppTable);
|
||||||
|
innerLayoutPP->addWidget(addNew);
|
||||||
|
pp->setLayout(innerLayoutPP);
|
||||||
|
|
||||||
|
/* context phrases group */
|
||||||
|
QGridLayout *innerLayoutContext = new QGridLayout();
|
||||||
|
QGroupBox *context = new QGroupBox();
|
||||||
|
context->setTitle("Spracherkennungs Wörter");
|
||||||
|
contextTable = new QTableWidget();
|
||||||
|
|
||||||
|
/* table ui */
|
||||||
|
contextTable->verticalHeader()->setVisible(false);
|
||||||
|
contextTable->horizontalHeader()->setVisible(false);
|
||||||
|
contextTable->setRowCount(0);
|
||||||
|
|
||||||
|
QStringList *headerListContext = new QStringList();
|
||||||
|
headerListContext->append("Ausdruck/Wort");
|
||||||
|
headerListContext->append("Entfernen");
|
||||||
|
|
||||||
|
contextTable->setColumnCount(headerListContext->length());
|
||||||
|
contextTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
|
|
||||||
|
QPushButton *addNewContext = new QPushButton("Neuer Ausdruck");
|
||||||
|
innerLayoutContext->addWidget(contextTable);
|
||||||
|
innerLayoutContext->addWidget(addNewContext);
|
||||||
|
context->setLayout(innerLayoutContext);
|
||||||
|
|
||||||
|
/* connect buttons */
|
||||||
|
connect(addNew, SIGNAL (released()), this, SLOT (addNewPP()));
|
||||||
|
connect(addNewContext, SIGNAL (released()), this, SLOT (addNewContext()));
|
||||||
|
|
||||||
|
/* setup main window */
|
||||||
|
mainLayout = new QGridLayout();
|
||||||
|
mainLayout->addWidget(pp);
|
||||||
|
mainLayout->addWidget(context);
|
||||||
|
QWidget *mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(mainLayout);
|
||||||
|
this->setCentralWidget(mainWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConfig::addNewPP(){
|
||||||
|
|
||||||
|
QStringList *sl = new QStringList();
|
||||||
|
sl->append("Schlüsselword");
|
||||||
|
sl->append("Ersetzung");
|
||||||
|
|
||||||
|
QWidgetList *wl = new QWidgetList();
|
||||||
|
wl->append(new QLineEdit());
|
||||||
|
wl->append(new QLineEdit());
|
||||||
|
|
||||||
|
MultiValueInputDialog *dialog = new MultiValueInputDialog(sl, wl);
|
||||||
|
if (dialog->exec() == QDialog::Accepted) {
|
||||||
|
auto keyword = static_cast<QLineEdit*>(wl->at(0));
|
||||||
|
auto replace = static_cast<QLineEdit*>(wl->at(0));
|
||||||
|
|
||||||
|
if(!keyword->text().isEmpty() && !replace->text().isEmpty()){
|
||||||
|
sc->submitPostProcessorChange(keyword->text(), replace->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConfig::addNewContext()
|
||||||
|
{
|
||||||
|
QStringList *sl = new QStringList();
|
||||||
|
sl->append("Ausdruck");
|
||||||
|
|
||||||
|
QWidgetList *wl = new QWidgetList();
|
||||||
|
wl->append(new QLineEdit());
|
||||||
|
|
||||||
|
MultiValueInputDialog *dialog = new MultiValueInputDialog(sl, wl);
|
||||||
|
if (dialog->exec() == QDialog::Accepted) {
|
||||||
|
auto lineEdit = static_cast<QLineEdit*>(wl->at(0));
|
||||||
|
if(!lineEdit->text().isEmpty()){
|
||||||
|
sc->submitSpeechContextPhraseChange(lineEdit->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* ServerConfig::loatListItemUiForm()
|
||||||
|
{
|
||||||
|
QUiLoader loader;
|
||||||
|
|
||||||
|
QFile file(":/forms/serverconfigitem.ui");
|
||||||
|
file.open(QFile::ReadOnly);
|
||||||
|
|
||||||
|
QWidget *formWidget = loader.load(&file, this);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
return formWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConfig::finishedRequest(QNetworkReply *reply){
|
||||||
|
if(reply->error() != QNetworkReply::NoError){
|
||||||
|
qDebug("unified sc fail..");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString addPP = sc->buildURLFromLocation(PP_EDIT);
|
||||||
|
QString addContext = sc->buildURLFromLocation(CONTEXT_EDIT);
|
||||||
|
if(QString::compare(reply->url().toString(), addPP) == 0){
|
||||||
|
sc->getUnifiedServerConfig();
|
||||||
|
}else if(QString::compare(reply->url().toString(), addContext) == 0){
|
||||||
|
sc->getUnifiedServerConfig();
|
||||||
|
}else{
|
||||||
|
/* this is the unified server config query */
|
||||||
|
/* get filename and tracking id from replay */
|
||||||
|
QJsonObject json = QJsonDocument::fromJson(reply->readAll()).object();
|
||||||
|
|
||||||
|
auto keywordMap = json["keyword-map"].toObject();
|
||||||
|
auto phrases = json["phrases"].toArray();
|
||||||
|
|
||||||
|
contextTable->clear();
|
||||||
|
contextTable->setRowCount(0);
|
||||||
|
ppTable->clear();
|
||||||
|
ppTable->setRowCount(0);
|
||||||
|
|
||||||
|
for(int i = 0; i < phrases.size(); i++){
|
||||||
|
contextTable->insertRow(i);
|
||||||
|
contextTable->setItem(i, 0, new QTableWidgetItem(phrases.at(i).toString()));
|
||||||
|
auto *deleteButtonLayout = new QGridLayout();
|
||||||
|
auto *deleteCell = new QWidget();
|
||||||
|
auto *deleteButton = new QPushButton("Entfernen");
|
||||||
|
deleteButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
deleteButtonLayout->addWidget(deleteButton);
|
||||||
|
deleteButtonLayout->setContentsMargins(0,0,0,0);
|
||||||
|
deleteCell->setLayout(deleteButtonLayout);
|
||||||
|
|
||||||
|
contextTable->setCellWidget(i, 1, deleteCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < keywordMap.keys().size(); i++){
|
||||||
|
auto key = keywordMap.keys().at(i);
|
||||||
|
ppTable->insertRow(i);
|
||||||
|
ppTable->setItem(i, 0, new QTableWidgetItem(key));
|
||||||
|
ppTable->setItem(i, 1, new QTableWidgetItem(keywordMap[key].toString()));
|
||||||
|
auto *deleteButtonLayout = new QGridLayout();
|
||||||
|
auto *deleteCell = new QWidget();
|
||||||
|
auto *deleteButton = new QPushButton("Entfernen");
|
||||||
|
deleteButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
deleteButtonLayout->addWidget(deleteButton);
|
||||||
|
deleteButtonLayout->setContentsMargins(0,0,0,0);
|
||||||
|
deleteCell->setLayout(deleteButtonLayout);
|
||||||
|
|
||||||
|
ppTable->setCellWidget(i, 2, deleteCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerConfig::~ServerConfig()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
35
serverconfig.h
Normal file
35
serverconfig.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef SERVERCONFIG_H
|
||||||
|
#define SERVERCONFIG_H
|
||||||
|
|
||||||
|
#include "serverconnection.h"
|
||||||
|
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ServerConfig : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ServerConfig(QWidget *parent = nullptr, QSettings *settings = nullptr);
|
||||||
|
virtual ~ServerConfig();
|
||||||
|
private slots:
|
||||||
|
void finishedRequest(QNetworkReply*);
|
||||||
|
void addNewPP();
|
||||||
|
void addNewContext();
|
||||||
|
private:
|
||||||
|
QGridLayout* mainLayout;
|
||||||
|
QSettings* mySettings;
|
||||||
|
QWidget *loatListItemUiForm();
|
||||||
|
QTableWidget* ppTable;
|
||||||
|
QTableWidget* contextTable;
|
||||||
|
ServerConnection* sc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SERVERCONFIG_H
|
||||||
34
serverconfigitem.ui
Normal file
34
serverconfigitem.ui
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonDelete">
|
||||||
|
<property name="text">
|
||||||
|
<string>Löschen</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -5,10 +5,13 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <urls.h>
|
||||||
|
|
||||||
|
#define AUTH_HEADER_NAME "Authorization"
|
||||||
|
#define MIME_JSON "application/json"
|
||||||
|
|
||||||
ServerConnection::ServerConnection(QObject *parent, QSettings *settings)
|
ServerConnection::ServerConnection(QObject *parent, QSettings *settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
setAuthHeader(settings->value(SETTING_USER).toString(), settings->value(SETTING_PASS).toString());
|
setAuthHeader(settings->value(SETTING_USER).toString(), settings->value(SETTING_PASS).toString());
|
||||||
networkManager = new QNetworkAccessManager(parent);
|
networkManager = new QNetworkAccessManager(parent);
|
||||||
mySettings = settings;
|
mySettings = settings;
|
||||||
@@ -19,6 +22,10 @@ QString ServerConnection::buildURLFromLocation(QVariant location){
|
|||||||
return buildURLFromLocation(location.toString());
|
return buildURLFromLocation(location.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ServerConnection::buildURLFromLocation(const char *location){
|
||||||
|
return buildURLFromLocation(QString(location));
|
||||||
|
}
|
||||||
|
|
||||||
QString ServerConnection::buildURLFromLocation(QString location){
|
QString ServerConnection::buildURLFromLocation(QString location){
|
||||||
QString proto = mySettings->value(SETTING_PROTO).toString();
|
QString proto = mySettings->value(SETTING_PROTO).toString();
|
||||||
QString host = mySettings->value(SETTING_HOST).toString();
|
QString host = mySettings->value(SETTING_HOST).toString();
|
||||||
@@ -48,7 +55,7 @@ void ServerConnection::queryStatusAll(){
|
|||||||
QString statusRequestUrl = buildURLFromLocation(mySettings->value(SETTING_LOC_STATE));
|
QString statusRequestUrl = buildURLFromLocation(mySettings->value(SETTING_LOC_STATE));
|
||||||
QUrl trackingUrl = QUrl(statusRequestUrl);
|
QUrl trackingUrl = QUrl(statusRequestUrl);
|
||||||
QNetworkRequest request(trackingUrl);
|
QNetworkRequest request(trackingUrl);
|
||||||
request.setRawHeader("Authorization", authHeaderData);
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
networkManager->get(request);
|
networkManager->get(request);
|
||||||
//qDebug("Status query sent");
|
//qDebug("Status query sent");
|
||||||
}
|
}
|
||||||
@@ -58,7 +65,7 @@ void ServerConnection::queryTransscript(QString trackingId){
|
|||||||
QString paramUrl = QString("%1?id=%2").arg(url, trackingId);
|
QString paramUrl = QString("%1?id=%2").arg(url, trackingId);
|
||||||
QUrl transcriptUrl = QUrl(paramUrl);
|
QUrl transcriptUrl = QUrl(paramUrl);
|
||||||
QNetworkRequest request(transcriptUrl);
|
QNetworkRequest request(transcriptUrl);
|
||||||
request.setRawHeader("Authorization", authHeaderData);
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
networkManager->get(request);
|
networkManager->get(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +74,8 @@ void ServerConnection::submitFile(QJsonDocument jsonDocument){
|
|||||||
/* prepare request */
|
/* prepare request */
|
||||||
QUrl serviceUrl = QUrl(buildURLFromLocation(mySettings->value(SETTING_LOC_SUBMIT)));
|
QUrl serviceUrl = QUrl(buildURLFromLocation(mySettings->value(SETTING_LOC_SUBMIT)));
|
||||||
QNetworkRequest request(serviceUrl);
|
QNetworkRequest request(serviceUrl);
|
||||||
request.setRawHeader("Authorization", authHeaderData);
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, MIME_JSON);
|
||||||
|
|
||||||
/* make request */
|
/* make request */
|
||||||
networkManager->post(request, jsonDocument.toJson());
|
networkManager->post(request, jsonDocument.toJson());
|
||||||
@@ -76,6 +83,69 @@ void ServerConnection::submitFile(QJsonDocument jsonDocument){
|
|||||||
qDebug("Request submitted");
|
qDebug("Request submitted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerConnection::queryServerVersion(){
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(SERVER_INFO)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
networkManager->get(request);
|
||||||
|
}
|
||||||
|
|
||||||
QNetworkAccessManager *ServerConnection::getNetworkManager(){
|
QNetworkAccessManager *ServerConnection::getNetworkManager(){
|
||||||
return networkManager;
|
return networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerConnection::submitPostProcessorChange(QString keyword, QString repl, bool remove){
|
||||||
|
|
||||||
|
QJsonObject json = QJsonObject();
|
||||||
|
json["keyword-regex"] = keyword;
|
||||||
|
json["replacement"] = repl;
|
||||||
|
if(remove){
|
||||||
|
json["action"] = "delete";
|
||||||
|
}else{
|
||||||
|
json["action"] = "add";
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(PP_EDIT)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
request.setHeader(QNetworkRequest::ContentTypeHeader, MIME_JSON);
|
||||||
|
networkManager->post(request, QJsonDocument(json).toJson());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConnection::submitSpeechContextPhraseChange(QString phrase, bool remove){
|
||||||
|
|
||||||
|
QJsonObject json = QJsonObject();
|
||||||
|
json["phrase"] = phrase;
|
||||||
|
if(remove){
|
||||||
|
json["action"] = "delete";
|
||||||
|
}else{
|
||||||
|
json["action"] = "add";
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(CONTEXT_EDIT)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
request.setHeader(QNetworkRequest::ContentTypeHeader, MIME_JSON);
|
||||||
|
networkManager->post(request, QJsonDocument(json).toJson());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConnection::getSpeechContextPhrases(){
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(CONTEXT_GET)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
networkManager->get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConnection::getPostProcessorMap(){
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(PP_GET)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
networkManager->get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConnection::getUnifiedServerConfig(){
|
||||||
|
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(UNIFIED_GET)));
|
||||||
|
QNetworkRequest request(serviceUrl);
|
||||||
|
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
|
||||||
|
networkManager->get(request);
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ public:
|
|||||||
QString buildURLFromLocation(QVariant location);
|
QString buildURLFromLocation(QVariant location);
|
||||||
QString buildURLFromLocation(QString location);
|
QString buildURLFromLocation(QString location);
|
||||||
QNetworkAccessManager *getNetworkManager();
|
QNetworkAccessManager *getNetworkManager();
|
||||||
|
void queryServerVersion();
|
||||||
|
void getPostProcessorMap();
|
||||||
|
void submitPostProcessorChange(QString keyword, QString repl, bool remove = false);
|
||||||
|
void submitSpeechContextPhraseChange(QString phrase, bool remove = false);
|
||||||
|
void getSpeechContextPhrases();
|
||||||
|
void getUnifiedServerConfig();
|
||||||
|
QString buildURLFromLocation(const char *location);
|
||||||
public slots:
|
public slots:
|
||||||
void queryStatusAll();
|
void queryStatusAll();
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
68
settings.cpp
68
settings.cpp
@@ -1,13 +1,22 @@
|
|||||||
|
#include "serverconnection.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui_settings.h"
|
#include "ui_settings.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <settingkeys.h>
|
#include <settingkeys.h>
|
||||||
|
|
||||||
#define SETTINGS_WINDOW_TITLE "Konfiguration"
|
#define SETTINGS_WINDOW_TITLE "Konfiguration"
|
||||||
|
#define BUTTON_TEXT_CHECK "Konfiguration Testen"
|
||||||
#define BUTTON_TEXT_ABORT "Abbrechen"
|
#define BUTTON_TEXT_ABORT "Abbrechen"
|
||||||
#define BUTTON_TEXT_OK "OK"
|
#define BUTTON_TEXT_OK "OK"
|
||||||
|
|
||||||
@@ -74,16 +83,63 @@ void Settings::selectSettings(QSettings *selectedSettings){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* buttons */
|
/* buttons */
|
||||||
|
auto check = new QPushButton(BUTTON_TEXT_CHECK);
|
||||||
auto ok = new QPushButton(BUTTON_TEXT_OK);
|
auto ok = new QPushButton(BUTTON_TEXT_OK);
|
||||||
auto cancle = new QPushButton(BUTTON_TEXT_ABORT);
|
auto cancle = new QPushButton(BUTTON_TEXT_ABORT);
|
||||||
|
|
||||||
layout->addWidget(ok, configOptions->length(), 0);
|
layout->addWidget(check, configOptions->length(), 0);
|
||||||
layout->addWidget(cancle, configOptions->length(), 1);
|
layout->addWidget(ok, configOptions->length()+1, 0);
|
||||||
|
layout->addWidget(cancle, configOptions->length()+1, 1);
|
||||||
|
|
||||||
|
connect(check, SIGNAL(released()), this, SLOT(checkConfig()));
|
||||||
connect(ok, SIGNAL(released()), this, SLOT(okClose()));
|
connect(ok, SIGNAL(released()), this, SLOT(okClose()));
|
||||||
connect(cancle, SIGNAL(released()), this, SLOT(cancleClose()));
|
connect(cancle, SIGNAL(released()), this, SLOT(cancleClose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::checkConfig(){
|
||||||
|
saveSetting();
|
||||||
|
ServerConnection *sc = new ServerConnection(this, mySettings);
|
||||||
|
connect(sc->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(handleTestConnectionResult(QNetworkReply*)));
|
||||||
|
sc->queryServerVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::handleTestConnectionResult(QNetworkReply* reply){
|
||||||
|
QString *dialogText;
|
||||||
|
bool error = false;
|
||||||
|
|
||||||
|
if(reply->error() != QNetworkReply::NoError){
|
||||||
|
dialogText = new QString(reply->errorString());
|
||||||
|
error = true;
|
||||||
|
}else {
|
||||||
|
dialogText = new QString("Verbinndung Ok");
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
auto *fi = new QFileInfo(mySettings->value(SETTING_LINUX_EXPLORER).toString());
|
||||||
|
if(!fi->isExecutable()){
|
||||||
|
dialogText->append("\nExplorer nicht ausführbar!");
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QLabel *testResult = new QLabel("Ok!");
|
||||||
|
testResult->setStyleSheet("QLabel { color : green; }");
|
||||||
|
if(error){
|
||||||
|
QMessageBox *info = new QMessageBox();
|
||||||
|
info->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
info->setWindowTitle("Konfiguration - Fehler!");
|
||||||
|
info->setText(*dialogText);
|
||||||
|
info->show();
|
||||||
|
testResult = new QLabel("Konfigurationsfehler.");
|
||||||
|
testResult->setStyleSheet("QLabel { color : red; }");
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::cancleClose(){
|
void Settings::cancleClose(){
|
||||||
if(false){
|
if(false){
|
||||||
// TODO warning
|
// TODO warning
|
||||||
@@ -91,14 +147,18 @@ void Settings::cancleClose(){
|
|||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::okClose(){
|
void Settings::saveSetting(){
|
||||||
QSettings mySettings;
|
QSettings mySettings;
|
||||||
for(auto key : configLineEditMap->keys()){
|
for(auto key : configLineEditMap->keys()){
|
||||||
QString input = configLineEditMap->take(key)->text();
|
QString input = configLineEditMap->value(key)->text();
|
||||||
if(input.compare("") != 0){
|
if(input.compare("") != 0){
|
||||||
this->mySettings->setValue(key, input);
|
this->mySettings->setValue(key, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::okClose(){
|
||||||
|
saveSetting();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class settings;
|
class settings;
|
||||||
@@ -21,12 +23,16 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void okClose();
|
void okClose();
|
||||||
void cancleClose();
|
void cancleClose();
|
||||||
|
void checkConfig();
|
||||||
|
void handleTestConnectionResult(QNetworkReply *reply);
|
||||||
private:
|
private:
|
||||||
Ui::settings *ui;
|
Ui::settings *ui;
|
||||||
QSettings *mySettings;
|
QSettings *mySettings;
|
||||||
QHash<QString, QLineEdit*> *configLineEditMap;
|
QHash<QString, QLineEdit*> *configLineEditMap;
|
||||||
QStringList *configOptionsKeys;
|
QStringList *configOptionsKeys;
|
||||||
QStringList *configOptions;
|
QStringList *configOptions;
|
||||||
|
void saveSetting();
|
||||||
|
QLabel *currentConfigCheckDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
|||||||
23
settings.ui
23
settings.ui
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>settings</class>
|
|
||||||
<widget class="QMainWindow" name="settings">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>281</width>
|
|
||||||
<height>245</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>MainWindow</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<layout class="QGridLayout" name="gridLayout"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@@ -4,11 +4,15 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui network
|
GIT_STR_VERSION = $$system(git describe)
|
||||||
|
DATE_STR = $$system(date)
|
||||||
|
HOSTNAME_STR = $$system(hostname)
|
||||||
|
|
||||||
|
QT += core gui network uitools
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = untitled
|
TARGET = speech-server-client-qt
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
@@ -16,6 +20,9 @@ TEMPLATE = app
|
|||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
DEFINES += "GIT_VERSION=\"\\\"$$GIT_STR_VERSION\\\"\""
|
||||||
|
DEFINES += "BUILD_DATE=\"\\\"$$DATE_STR\\\"\""
|
||||||
|
DEFINES += "BUILD_HOST=\"\\\"$$HOSTNAME_STR\\\"\""
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
@@ -30,7 +37,9 @@ SOURCES += \
|
|||||||
notificationwidget.cpp \
|
notificationwidget.cpp \
|
||||||
settings.cpp \
|
settings.cpp \
|
||||||
about.cpp \
|
about.cpp \
|
||||||
serverconnection.cpp
|
serverconnection.cpp \
|
||||||
|
serverconfig.cpp \
|
||||||
|
multivalueinputdialog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
@@ -38,11 +47,15 @@ HEADERS += \
|
|||||||
settings.h \
|
settings.h \
|
||||||
settingkeys.h \
|
settingkeys.h \
|
||||||
about.h \
|
about.h \
|
||||||
serverconnection.h
|
serverconnection.h \
|
||||||
|
serverconfig.h \
|
||||||
|
urls.h \
|
||||||
|
multivalueinputdialog.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
settings.ui
|
listItemServeConfig.ui \
|
||||||
|
serverconfigitem.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
13
urls.h
Normal file
13
urls.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef URLS_H
|
||||||
|
#define URLS_H
|
||||||
|
|
||||||
|
#define PP_GET "/keyword-map"
|
||||||
|
#define PP_EDIT "/add-pp-keyword"
|
||||||
|
|
||||||
|
#define CONTEXT_GET "/context-phrases"
|
||||||
|
#define CONTEXT_EDIT "/add-context-phrase"
|
||||||
|
|
||||||
|
#define UNIFIED_GET "/unified-server-settings"
|
||||||
|
#define SERVER_INFO "/server-info"
|
||||||
|
|
||||||
|
#endif // URLS_H
|
||||||
Reference in New Issue
Block a user