23 Commits

Author SHA1 Message Date
Yannik Schmidt
326f395936 fix: indicate libqt5gui dependency 2024-07-14 22:04:36 +02:00
Yannik Schmidt
c372ca8478 update OS info 2021-11-22 15:11:25 +01:00
Yannik Schmidt
7e1aca3413 update ui picture 2021-11-07 13:55:34 +01:00
Yannik Schmidt
8f821d5d74 add window icon 2021-11-07 13:19:35 +01:00
Yannik Schmidt
79602900e6 remove spacer 2021-11-07 13:11:17 +01:00
Yannik Schmidt
ad07c80dc0 add reference to stylesheet author 2021-11-07 12:58:42 +01:00
Yannik Schmidt
414a6873b0 add dark orange stylesheet 2021-11-07 12:56:56 +01:00
Yannik Schmidt
ddc9f40186 Allow selection of multiple files 2021-11-06 15:09:33 +01:00
Yannik Schmidt
81950c1c99 fix meta info 2021-11-06 14:18:41 +01:00
Yannik Schmidt
4ada79c9a5 add offset to notification window 2021-11-06 14:17:49 +01:00
Yannik Schmidt
7cd3a4e36e update location of example picture 2021-03-22 16:35:44 +01:00
Yannik Schmidt
ab04997cff add flush cache on server button 2021-02-28 17:59:01 +01:00
Yannik Schmidt
c381a62e73 add buildfiles and results to gitignore 2021-02-25 19:49:25 +01:00
Yannik Schmidt
f7676f367a re-add accidentally deleted ui file 2021-02-25 19:48:28 +01:00
Yannik Schmidt
c05a38c45d remember most recently selected path/file 2020-09-17 20:26:15 +02:00
Yannik Schmidt
76b077a661 fix win explorer call 2020-09-17 20:17:21 +02:00
Yannik Schmidt
360e8a03d3 implement samedir transcript saving 2020-09-17 19:42:33 +02:00
Yannik Schmidt
31aec36202 initialize checkConfig with nullptr 2020-09-17 18:53:07 +02:00
Yannik Schmidt
529ff87c44 fix windows crash 2020-09-17 17:59:24 +02:00
Yannik Schmidt
7793499acc fix pp input 2020-09-07 20:12:13 +02:00
Yannik Schmidt
1839b4b28e implement server config remove button 2020-09-07 19:25:01 +02:00
Yannik Schmidt
29be79f278 remove forgotten debug msg 2020-09-07 18:32:22 +02:00
Yannik Schmidt
e21b1ac3ca implement clear cache option after context change 2020-09-07 16:00:58 +02:00
21 changed files with 3551 additions and 32 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,7 @@
*.user
*.stash
*.o
moc_*
ui_*
Makefile
speech-server-client-qt

View File

@@ -1,7 +1,11 @@
# Intro
This is the GUI Interface to a proprietary server that interfaces with speech recognition backends.
![GUI Main-Window](https://media.atlantishq.de/qt_client.png)
# Dependencies
apt-get install libqt5gui5
![GUI Main-Window](https://media.atlantishq.de/pictures/qt_client_dm.png)
# 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).
@@ -22,8 +26,8 @@ Setup the actual compilation enviroment:
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.
# Mac Support?
I do not own a Mac, so I haven't tried, but there is no reason why it wouldn't run on a Mac.
# Build for Mac
This project does not currently support Mac.
# Stylesheet
The stylesheet used is "Qt dark orange" by [LoneWolf](https://discourse.techart.online/t/release-qt-dark-orange-stylesheet/2287#post14381).

5
defaultres.qrc Normal file
View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/.">
<file>icon.png</file>
</qresource>
</RCC>

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -7,5 +7,8 @@ int main(int argc, char *argv[])
MainWindow w;
w.show();
a.setApplicationName("Speech-To-Text");
a.setOrganizationName("Potaris IT | Yannik Schmidt");
a.setOrganizationDomain("potaris.de");
return a.exec();
}

View File

@@ -23,6 +23,7 @@
#include <QString>
#include <settingkeys.h>
#include <serverconnection.h>
#include "urls.h"
#define FILENAME_COL 0
#define TRACKING_ID_COL 1
@@ -56,6 +57,9 @@ MainWindow::MainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::MainWind
button = ui->centralWidget->findChild<QPushButton*>("pushButton");
connect(button, SIGNAL (released()), this, SLOT (importFile()));
flushCacheButton = ui->centralWidget->findChild<QPushButton*>("flushCacheButton");
connect(flushCacheButton, SIGNAL (released()), this, SLOT (flushServerCacheRequest()));
/* table ui */
tw = ui->centralWidget->findChild<QTableWidget*>("tableWidget");
@@ -148,16 +152,33 @@ void MainWindow::handleInitialSettings(){
}
void MainWindow::importFile(){
QString filename = QFileDialog::getOpenFileName(
QString startDir = QDir::currentPath();
if(mySettings->contains(SETTING_MOST_RECENT_PATH)){
startDir = mySettings->value(SETTING_MOST_RECENT_PATH).toString();
}
QStringList filenames = QFileDialog::getOpenFileNames(
this,
"Open Document",
QDir::currentPath(),
startDir,
"All files (*.*) ;; Document files (*.doc *.rtf);; PNG files (*.png)");
if(filename.isNull()){
if(filenames.empty()){
return;
}else{
this->submitFileSlot(filename);
for(int i = 0; i<filenames.length(); i++){
if(i == 0){
/* set most recent path */
QFileInfo* fi = new QFileInfo(filenames[i]);
QDir dirInfo = fi->absoluteDir();
QString dirPath = dirInfo.absolutePath();
mySettings->setValue(SETTING_MOST_RECENT_PATH, dirPath);
}
this->submitFileSlot(filenames[i]);
}
}
}
@@ -165,7 +186,7 @@ void MainWindow::showNotification(QString str){
auto popUp = new NotificationWidget(this);
popUp->setPopupText(str);
popUp->setGeometry(0, 0, popUp->width(), popUp->height());
popUp->setGeometry(200, 100, popUp->width(), popUp->height());
popUp->show();
auto *timer = new QTimer();
connect(timer, SIGNAL(timeout()), popUp, SLOT(fadeOut()));
@@ -175,7 +196,17 @@ void MainWindow::showNotification(QString str){
void MainWindow::openContainingDir(){
QString filePath = mySettings->value(SETTING_SAVE_DIR).toString();
QString settingPath = mySettings->value(SETTING_SAVE_DIR).toString();
QString filePath;
if(QString::compare(settingPath, ".") == 0){
QPushButton* senderButton = static_cast<QPushButton*>(sender());
filePath = senderButton->toolTip();
QFileInfo* fi = new QFileInfo(filePath);
QDir dirInfo = fi->absoluteDir();
filePath = dirInfo.absolutePath();
}else{
filePath = settingPath;
}
QStringList args;
/* OS specific explorer call */
@@ -184,7 +215,7 @@ void MainWindow::openContainingDir(){
QProcess::startDetached(mySettings->value(SETTING_LINUX_EXPLORER).toString(), args);
#endif
#ifdef Q_OS_WIN
args << "/select," << QDir::toNativeSeparators(filePath);
args << QDir::toNativeSeparators(filePath);
QProcess::startDetached("explorer", args);
#endif
}
@@ -259,6 +290,13 @@ void MainWindow::saveTranscript(QNetworkReply* reply){
/* save return data */
QString fullpath = QDir(mySettings->value(SETTING_SAVE_DIR).toString()).filePath(targetName);
QString settingPath = mySettings->value(SETTING_SAVE_DIR).toString();
if(QString::compare(settingPath, ".") == 0){
fullpath = tw->item(rowId, FILENAME_COL)->text() + ".txt";
}else{
/* do nothing */
}
QFile file(fullpath);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Unable to open file"), file.errorString());
@@ -316,6 +354,7 @@ void MainWindow::addTrackingToList(QNetworkReply* reply){
auto *openDirCellContent = new QWidget();
openDirLayout->addWidget(dirButton);
dirButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
dirButton->setToolTip(filename);
openDirLayout->setContentsMargins(0,0,0,0);
openDirCellContent->setLayout(openDirLayout);
@@ -360,11 +399,19 @@ void MainWindow::submitFileSlot(QString filename){
qDebug("Request submission requested");
}
void MainWindow::flushServerCacheRequest(){
connect(serverConnection->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this,
SLOT(requestFinished(QNetworkReply*)), Qt::UniqueConnection);
qDebug("Req server flush");
serverConnection->flushCache();
}
void MainWindow::requestFinished(QNetworkReply *reply){
QString submitUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_SUBMIT));
QString statusRequestUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_STATE));
QString requestTranscriptUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_TRANSCRIPT));
QString flushCacheUrl = serverConnection->buildURLFromLocation(QString(FLUSH_SERVER_CACHE));
if(QString::compare(reply->url().toString(), submitUrl) == 0){
addTrackingToList(reply);
@@ -373,6 +420,9 @@ void MainWindow::requestFinished(QNetworkReply *reply){
}else if (reply->url().toString().startsWith(requestTranscriptUrl)) {
qDebug("Saving transcript");
saveTranscript(reply);
}else if (reply->url().toString().startsWith(flushCacheUrl)) {
showNotification("Server um Cache-Löschung gebeten.");
qDebug("CacheFlushed");
}else{
qDebug("URL-Response: %s", qUtf8Printable(reply->url().toString()));
qFatal("Unexpected responding URL");

View File

@@ -30,10 +30,12 @@ private slots:
void appyConfigChanges();
void openAboutWindow();
void openSpeechConfigWindow();
void flushServerCacheRequest();
private:
Ui::MainWindow *ui;
QTableWidget *tw;
QPushButton *button;
QPushButton *flushCacheButton;
QAction *standardsMenu;
QSettings *mySettings;
ServerConnection *serverConnection;

View File

@@ -6,13 +6,477 @@
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>504</height>
<width>827</width>
<height>670</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset theme="icon.png"/>
</property>
<property name="styleSheet">
<string notr="true">QToolTip
{
border: 1px solid black;
background-color: #ffa02f;
padding: 1px;
border-radius: 3px;
opacity: 100;
}
QWidget
{
color: #b1b1b1;
background-color: #323232;
}
QWidget:item:hover
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619);
color: #000000;
}
QWidget:item:selected
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QMenuBar::item
{
background: transparent;
}
QMenuBar::item:selected
{
background: transparent;
border: 1px solid #ffaa00;
}
QMenuBar::item:pressed
{
background: #444;
border: 1px solid #000;
background-color: QLinearGradient(
x1:0, y1:0,
x2:0, y2:1,
stop:1 #212121,
stop:0.4 #343434/*,
stop:0.2 #343434,
stop:0.1 #ffaa00*/
);
margin-bottom:-1px;
padding-bottom:1px;
}
QMenu
{
border: 1px solid #000;
}
QMenu::item
{
padding: 2px 20px 2px 20px;
}
QMenu::item:selected
{
color: #000000;
}
QWidget:disabled
{
color: #404040;
background-color: #323232;
}
QAbstractItemView
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0.1 #646464, stop: 1 #5d5d5d);
}
QWidget:focus
{
/*border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);*/
}
QLineEdit
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0 #646464, stop: 1 #5d5d5d);
padding: 1px;
border-style: solid;
border: 1px solid #1e1e1e;
border-radius: 5;
}
QPushButton
{
color: #b1b1b1;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646);
border-width: 1px;
border-color: #1e1e1e;
border-style: solid;
border-radius: 6;
padding: 3px;
font-size: 12px;
padding-left: 5px;
padding-right: 5px;
}
QPushButton:pressed
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525);
}
QComboBox
{
selection-background-color: #ffaa00;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646);
border-style: solid;
border: 1px solid #1e1e1e;
border-radius: 5;
}
QComboBox:hover,QPushButton:hover
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QComboBox:on
{
padding-top: 3px;
padding-left: 4px;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525);
selection-background-color: #ffaa00;
}
QComboBox QAbstractItemView
{
border: 2px solid darkgray;
selection-background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QComboBox::drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 0px;
border-left-color: darkgray;
border-left-style: solid; /* just a single line */
border-top-right-radius: 3px; /* same radius as the QComboBox */
border-bottom-right-radius: 3px;
}
QComboBox::down-arrow
{
image: url(:/down_arrow.png);
}
QGroupBox:focus
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QTextEdit:focus
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QScrollBar:horizontal {
border: 1px solid #222222;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848);
height: 7px;
margin: 0px 16px 0 16px;
}
QScrollBar::handle:horizontal
{
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f);
min-height: 20px;
border-radius: 2px;
}
QScrollBar::add-line:horizontal {
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a);
width: 14px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a);
width: 14px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal
{
border: 1px solid black;
width: 1px;
height: 1px;
background: white;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
{
background: none;
}
QScrollBar:vertical
{
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848);
width: 7px;
margin: 16px 0 16px 0;
border: 1px solid #222222;
}
QScrollBar::handle:vertical
{
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f);
min-height: 20px;
border-radius: 2px;
}
QScrollBar::add-line:vertical
{
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
height: 14px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical
{
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d7801a, stop: 1 #ffa02f);
height: 14px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical
{
border: 1px solid black;
width: 1px;
height: 1px;
background: white;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
{
background: none;
}
QTextEdit
{
background-color: #242424;
}
QPlainTextEdit
{
background-color: #242424;
}
QHeaderView::section
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565);
color: white;
padding-left: 4px;
border: 1px solid #6c6c6c;
}
QCheckBox:disabled
{
color: #414141;
}
QDockWidget::title
{
text-align: center;
spacing: 3px; /* spacing between items in the tool bar */
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232);
}
QDockWidget::close-button, QDockWidget::float-button
{
text-align: center;
spacing: 1px; /* spacing between items in the tool bar */
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232);
}
QDockWidget::close-button:hover, QDockWidget::float-button:hover
{
background: #242424;
}
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed
{
padding: 1px -1px -1px 1px;
}
QMainWindow::separator
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434);
color: white;
padding-left: 4px;
border: 1px solid #4c4c4c;
spacing: 3px; /* spacing between items in the tool bar */
}
QMainWindow::separator:hover
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d7801a, stop:0.5 #b56c17 stop:1 #ffa02f);
color: white;
padding-left: 4px;
border: 1px solid #6c6c6c;
spacing: 3px; /* spacing between items in the tool bar */
}
QToolBar::handle
{
spacing: 3px; /* spacing between items in the tool bar */
background: url(:/images/handle.png);
}
QMenu::separator
{
height: 2px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434);
color: white;
padding-left: 4px;
margin-left: 10px;
margin-right: 5px;
}
QProgressBar
{
border: 2px solid grey;
border-radius: 5px;
text-align: center;
}
QProgressBar::chunk
{
background-color: #d7801a;
width: 2.15px;
margin: 0.5px;
}
QTabBar::tab {
color: #b1b1b1;
border: 1px solid #444;
border-bottom-style: none;
background-color: #323232;
padding-left: 10px;
padding-right: 10px;
padding-top: 3px;
padding-bottom: 2px;
margin-right: -1px;
}
QTabWidget::pane {
border: 1px solid #444;
top: 1px;
}
QTabBar::tab:last
{
margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
border-top-right-radius: 3px;
}
QTabBar::tab:first:!selected
{
margin-left: 0px; /* the last selected tab has nothing to overlap with on the right */
border-top-left-radius: 3px;
}
QTabBar::tab:!selected
{
color: #b1b1b1;
border-bottom-style: solid;
margin-top: 3px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:.4 #343434);
}
QTabBar::tab:selected
{
border-top-left-radius: 3px;
border-top-right-radius: 3px;
margin-bottom: 0px;
}
QTabBar::tab:!selected:hover
{
/*border-top: 2px solid #ffaa00;
padding-bottom: 3px;*/
border-top-left-radius: 3px;
border-top-right-radius: 3px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:0.4 #343434, stop:0.2 #343434, stop:0.1 #ffaa00);
}
QRadioButton::indicator:checked, QRadioButton::indicator:unchecked{
color: #b1b1b1;
background-color: #323232;
border: 1px solid #b1b1b1;
border-radius: 6px;
}
QRadioButton::indicator:checked
{
background-color: qradialgradient(
cx: 0.5, cy: 0.5,
fx: 0.5, fy: 0.5,
radius: 1.0,
stop: 0.25 #ffaa00,
stop: 0.3 #323232
);
}
QCheckBox::indicator{
color: #b1b1b1;
background-color: #323232;
border: 1px solid #b1b1b1;
width: 9px;
height: 9px;
}
QRadioButton::indicator
{
border-radius: 6px;
}
QRadioButton::indicator:hover, QCheckBox::indicator:hover
{
border: 1px solid #ffaa00;
}
QCheckBox::indicator:checked
{
image:url(:/images/checkbox.png);
}
QCheckBox::indicator:disabled, QRadioButton::indicator:disabled
{
border: 1px solid #444;
}</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@@ -22,6 +486,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="flushCacheButton">
<property name="text">
<string>Server Cache Leeren</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTableWidget" name="tableWidget"/>
</item>
@@ -32,7 +503,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<width>827</width>
<height>20</height>
</rect>
</property>
@@ -43,14 +514,6 @@
</widget>
<addaction name="menuKonfiguration"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="actionServer">
<property name="text">
<string>&amp;Server</string>

View File

@@ -0,0 +1 @@
#include "pushbuttonwithposition.h"

17
pushbuttonwithposition.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef PUSHBUTTONWITHPOSITION_H
#define PUSHBUTTONWITHPOSITION_H
#include <QPushButton>
class PushButtonWithPosition : public QPushButton
{
public:
PushButtonWithPosition(int row, QString text) : QPushButton(text){
this->row = row;
}
int row;
};
#endif // PUSHBUTTONWITHPOSITION_H

2414
qrc_defaultres.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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();
@@ -91,7 +105,7 @@ void ServerConfig::addNewPP(){
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));
auto replace = static_cast<QLineEdit*>(wl->at(1));
if(!keyword->text().isEmpty() && !replace->text().isEmpty()){
sc->submitPostProcessorChange(keyword->text(), replace->text());
@@ -99,6 +113,16 @@ void ServerConfig::addNewPP(){
}
}
void ServerConfig::askFlushServerCache(){
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Server Cache",
"Sollen alte Transcripte auf dem Server, die ohne diese Konfiguration erstellt wurden gelöscht werden?",
QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes) {
sc->flushCache();
}
}
void ServerConfig::addNewContext()
{
QStringList *sl = new QStringList();
@@ -112,6 +136,7 @@ void ServerConfig::addNewContext()
auto lineEdit = static_cast<QLineEdit*>(wl->at(0));
if(!lineEdit->text().isEmpty()){
sc->submitSpeechContextPhraseChange(lineEdit->text());
askFlushServerCache();
}
}
}
@@ -137,10 +162,25 @@ void ServerConfig::finishedRequest(QNetworkReply *reply){
QString addPP = sc->buildURLFromLocation(PP_EDIT);
QString addContext = sc->buildURLFromLocation(CONTEXT_EDIT);
QString flushCache = sc->buildURLFromLocation(FLUSH_SERVER_CACHE);
if(QString::compare(reply->url().toString(), addPP) == 0){
sc->getUnifiedServerConfig();
}else if(QString::compare(reply->url().toString(), addContext) == 0){
sc->getUnifiedServerConfig();
}else if(QString::compare(reply->url().toString(), flushCache) == 0){
QMessageBox msgBox;
msgBox.setText("Server Cache Gelöscht");
QJsonObject jsonFlushCache = QJsonDocument::fromJson(reply->readAll()).object();
QJsonArray removals = jsonFlushCache["removals"].toArray();
QString display = "";
for(int i = 0; i < removals.size(); i++){
display += removals[i].toString();
display += "<br>";
}
msgBox.setInformativeText(display);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}else{
/* this is the unified server config query */
/* get filename and tracking id from replay */
@@ -159,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);
@@ -175,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);

View File

@@ -23,6 +23,8 @@ private slots:
void finishedRequest(QNetworkReply*);
void addNewPP();
void addNewContext();
void removePP();
void removeContext();
private:
QGridLayout* mainLayout;
QSettings* mySettings;
@@ -30,6 +32,7 @@ private:
QTableWidget* ppTable;
QTableWidget* contextTable;
ServerConnection* sc;
void askFlushServerCache();
};
#endif // SERVERCONFIG_H

View File

@@ -149,3 +149,10 @@ void ServerConnection::getUnifiedServerConfig(){
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
networkManager->get(request);
}
void ServerConnection::flushCache(){
QUrl serviceUrl = QUrl(buildURLFromLocation(QString(FLUSH_SERVER_CACHE)));
QNetworkRequest request(serviceUrl);
request.setRawHeader(AUTH_HEADER_NAME, authHeaderData);
networkManager->get(request);
}

View File

@@ -22,6 +22,7 @@ public:
void getSpeechContextPhrases();
void getUnifiedServerConfig();
QString buildURLFromLocation(const char *location);
void flushCache();
public slots:
void queryStatusAll();
private slots:

View File

@@ -11,5 +11,6 @@
#define SETTING_USER "user"
#define SETTING_PASS "pass"
#define SETTING_LINUX_EXPLORER "linux-explorer"
#define SETTING_MOST_RECENT_PATH "most-recent-path"
#endif // SETTINGKEYS_H

View File

@@ -53,10 +53,15 @@ Settings::Settings(QWidget *parent) :
#endif
this->setWindowTitle(SETTINGS_WINDOW_TITLE);
currentConfigCheckDisplay = nullptr;
}
void Settings::selectSettings(QSettings *selectedSettings){
this->mySettings = selectedSettings;
sc = new ServerConnection(this, mySettings);
connect(sc->getNetworkManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(handleTestConnectionResult(QNetworkReply*)));
/* config options layout */
auto cw = this->findChild<QWidget*>("centralwidget");
@@ -98,8 +103,6 @@ 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();
}
@@ -135,7 +138,9 @@ 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
if(currentConfigCheckDisplay != nullptr){
delete currentConfigCheckDisplay; //this removes it from the layout
}
currentConfigCheckDisplay = testResult;
layout->addWidget(testResult, configOptions->length(), 1);
}

View File

@@ -1,6 +1,8 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "serverconnection.h"
#include <QMainWindow>
#include <QLineEdit>
#include <QSettings>
@@ -26,6 +28,7 @@ private slots:
void checkConfig();
void handleTestConnectionResult(QNetworkReply *reply);
private:
ServerConnection *sc;
Ui::settings *ui;
QSettings *mySettings;
QHash<QString, QLineEdit*> *configLineEditMap;

484
settings.ui Normal file
View File

@@ -0,0 +1,484 @@
<?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>
<property name="styleSheet">
<string notr="true">QToolTip
{
border: 1px solid black;
background-color: #ffa02f;
padding: 1px;
border-radius: 3px;
opacity: 100;
}
QWidget
{
color: #b1b1b1;
background-color: #323232;
}
QWidget:item:hover
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619);
color: #000000;
}
QWidget:item:selected
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QMenuBar::item
{
background: transparent;
}
QMenuBar::item:selected
{
background: transparent;
border: 1px solid #ffaa00;
}
QMenuBar::item:pressed
{
background: #444;
border: 1px solid #000;
background-color: QLinearGradient(
x1:0, y1:0,
x2:0, y2:1,
stop:1 #212121,
stop:0.4 #343434/*,
stop:0.2 #343434,
stop:0.1 #ffaa00*/
);
margin-bottom:-1px;
padding-bottom:1px;
}
QMenu
{
border: 1px solid #000;
}
QMenu::item
{
padding: 2px 20px 2px 20px;
}
QMenu::item:selected
{
color: #000000;
}
QWidget:disabled
{
color: #404040;
background-color: #323232;
}
QAbstractItemView
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0.1 #646464, stop: 1 #5d5d5d);
}
QWidget:focus
{
/*border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);*/
}
QLineEdit
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0 #646464, stop: 1 #5d5d5d);
padding: 1px;
border-style: solid;
border: 1px solid #1e1e1e;
border-radius: 5;
}
QPushButton
{
color: #b1b1b1;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646);
border-width: 1px;
border-color: #1e1e1e;
border-style: solid;
border-radius: 6;
padding: 3px;
font-size: 12px;
padding-left: 5px;
padding-right: 5px;
}
QPushButton:pressed
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525);
}
QComboBox
{
selection-background-color: #ffaa00;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646);
border-style: solid;
border: 1px solid #1e1e1e;
border-radius: 5;
}
QComboBox:hover,QPushButton:hover
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QComboBox:on
{
padding-top: 3px;
padding-left: 4px;
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525);
selection-background-color: #ffaa00;
}
QComboBox QAbstractItemView
{
border: 2px solid darkgray;
selection-background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QComboBox::drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 0px;
border-left-color: darkgray;
border-left-style: solid; /* just a single line */
border-top-right-radius: 3px; /* same radius as the QComboBox */
border-bottom-right-radius: 3px;
}
QComboBox::down-arrow
{
image: url(:/down_arrow.png);
}
QGroupBox:focus
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QTextEdit:focus
{
border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
}
QScrollBar:horizontal {
border: 1px solid #222222;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848);
height: 7px;
margin: 0px 16px 0 16px;
}
QScrollBar::handle:horizontal
{
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f);
min-height: 20px;
border-radius: 2px;
}
QScrollBar::add-line:horizontal {
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a);
width: 14px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a);
width: 14px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal
{
border: 1px solid black;
width: 1px;
height: 1px;
background: white;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
{
background: none;
}
QScrollBar:vertical
{
background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848);
width: 7px;
margin: 16px 0 16px 0;
border: 1px solid #222222;
}
QScrollBar::handle:vertical
{
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f);
min-height: 20px;
border-radius: 2px;
}
QScrollBar::add-line:vertical
{
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);
height: 14px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical
{
border: 1px solid #1b1b19;
border-radius: 2px;
background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d7801a, stop: 1 #ffa02f);
height: 14px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical
{
border: 1px solid black;
width: 1px;
height: 1px;
background: white;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
{
background: none;
}
QTextEdit
{
background-color: #242424;
}
QPlainTextEdit
{
background-color: #242424;
}
QHeaderView::section
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565);
color: white;
padding-left: 4px;
border: 1px solid #6c6c6c;
}
QCheckBox:disabled
{
color: #414141;
}
QDockWidget::title
{
text-align: center;
spacing: 3px; /* spacing between items in the tool bar */
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232);
}
QDockWidget::close-button, QDockWidget::float-button
{
text-align: center;
spacing: 1px; /* spacing between items in the tool bar */
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232);
}
QDockWidget::close-button:hover, QDockWidget::float-button:hover
{
background: #242424;
}
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed
{
padding: 1px -1px -1px 1px;
}
QMainWindow::separator
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434);
color: white;
padding-left: 4px;
border: 1px solid #4c4c4c;
spacing: 3px; /* spacing between items in the tool bar */
}
QMainWindow::separator:hover
{
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d7801a, stop:0.5 #b56c17 stop:1 #ffa02f);
color: white;
padding-left: 4px;
border: 1px solid #6c6c6c;
spacing: 3px; /* spacing between items in the tool bar */
}
QToolBar::handle
{
spacing: 3px; /* spacing between items in the tool bar */
background: url(:/images/handle.png);
}
QMenu::separator
{
height: 2px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434);
color: white;
padding-left: 4px;
margin-left: 10px;
margin-right: 5px;
}
QProgressBar
{
border: 2px solid grey;
border-radius: 5px;
text-align: center;
}
QProgressBar::chunk
{
background-color: #d7801a;
width: 2.15px;
margin: 0.5px;
}
QTabBar::tab {
color: #b1b1b1;
border: 1px solid #444;
border-bottom-style: none;
background-color: #323232;
padding-left: 10px;
padding-right: 10px;
padding-top: 3px;
padding-bottom: 2px;
margin-right: -1px;
}
QTabWidget::pane {
border: 1px solid #444;
top: 1px;
}
QTabBar::tab:last
{
margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
border-top-right-radius: 3px;
}
QTabBar::tab:first:!selected
{
margin-left: 0px; /* the last selected tab has nothing to overlap with on the right */
border-top-left-radius: 3px;
}
QTabBar::tab:!selected
{
color: #b1b1b1;
border-bottom-style: solid;
margin-top: 3px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:.4 #343434);
}
QTabBar::tab:selected
{
border-top-left-radius: 3px;
border-top-right-radius: 3px;
margin-bottom: 0px;
}
QTabBar::tab:!selected:hover
{
/*border-top: 2px solid #ffaa00;
padding-bottom: 3px;*/
border-top-left-radius: 3px;
border-top-right-radius: 3px;
background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:0.4 #343434, stop:0.2 #343434, stop:0.1 #ffaa00);
}
QRadioButton::indicator:checked, QRadioButton::indicator:unchecked{
color: #b1b1b1;
background-color: #323232;
border: 1px solid #b1b1b1;
border-radius: 6px;
}
QRadioButton::indicator:checked
{
background-color: qradialgradient(
cx: 0.5, cy: 0.5,
fx: 0.5, fy: 0.5,
radius: 1.0,
stop: 0.25 #ffaa00,
stop: 0.3 #323232
);
}
QCheckBox::indicator{
color: #b1b1b1;
background-color: #323232;
border: 1px solid #b1b1b1;
width: 9px;
height: 9px;
}
QRadioButton::indicator
{
border-radius: 6px;
}
QRadioButton::indicator:hover, QCheckBox::indicator:hover
{
border: 1px solid #ffaa00;
}
QCheckBox::indicator:checked
{
image:url(:/images/checkbox.png);
}
QCheckBox::indicator:disabled, QRadioButton::indicator:disabled
{
border: 1px solid #444;
}</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -39,7 +39,8 @@ SOURCES += \
about.cpp \
serverconnection.cpp \
serverconfig.cpp \
multivalueinputdialog.cpp
multivalueinputdialog.cpp \
pushbuttonwithposition.cpp
HEADERS += \
mainwindow.h \
@@ -50,14 +51,19 @@ HEADERS += \
serverconnection.h \
serverconfig.h \
urls.h \
multivalueinputdialog.h
multivalueinputdialog.h \
pushbuttonwithposition.h
FORMS += \
mainwindow.ui \
listItemServeConfig.ui \
serverconfigitem.ui
serverconfigitem.ui \
settings.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
defaultres.qrc

2
urls.h
View File

@@ -10,4 +10,6 @@
#define UNIFIED_GET "/unified-server-settings"
#define SERVER_INFO "/server-info"
#define FLUSH_SERVER_CACHE "/flush-cache"
#endif // URLS_H