mirror of
https://github.com/FAUSheppy/speech-server-client-qt
synced 2025-12-06 00:41:35 +01:00
add flush cache on server button
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <settingkeys.h>
|
#include <settingkeys.h>
|
||||||
#include <serverconnection.h>
|
#include <serverconnection.h>
|
||||||
|
#include "urls.h"
|
||||||
|
|
||||||
#define FILENAME_COL 0
|
#define FILENAME_COL 0
|
||||||
#define TRACKING_ID_COL 1
|
#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");
|
button = ui->centralWidget->findChild<QPushButton*>("pushButton");
|
||||||
connect(button, SIGNAL (released()), this, SLOT (importFile()));
|
connect(button, SIGNAL (released()), this, SLOT (importFile()));
|
||||||
|
|
||||||
|
flushCacheButton = ui->centralWidget->findChild<QPushButton*>("flushCacheButton");
|
||||||
|
connect(flushCacheButton, SIGNAL (released()), this, SLOT (flushServerCacheRequest()));
|
||||||
|
|
||||||
/* table ui */
|
/* table ui */
|
||||||
tw = ui->centralWidget->findChild<QTableWidget*>("tableWidget");
|
tw = ui->centralWidget->findChild<QTableWidget*>("tableWidget");
|
||||||
|
|
||||||
@@ -390,11 +394,19 @@ void MainWindow::submitFileSlot(QString filename){
|
|||||||
qDebug("Request submission requested");
|
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){
|
void MainWindow::requestFinished(QNetworkReply *reply){
|
||||||
|
|
||||||
QString submitUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_SUBMIT));
|
QString submitUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_SUBMIT));
|
||||||
QString statusRequestUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_STATE));
|
QString statusRequestUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_STATE));
|
||||||
QString requestTranscriptUrl = serverConnection->buildURLFromLocation(mySettings->value(SETTING_LOC_TRANSCRIPT));
|
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){
|
if(QString::compare(reply->url().toString(), submitUrl) == 0){
|
||||||
addTrackingToList(reply);
|
addTrackingToList(reply);
|
||||||
@@ -403,6 +415,9 @@ void MainWindow::requestFinished(QNetworkReply *reply){
|
|||||||
}else if (reply->url().toString().startsWith(requestTranscriptUrl)) {
|
}else if (reply->url().toString().startsWith(requestTranscriptUrl)) {
|
||||||
qDebug("Saving transcript");
|
qDebug("Saving transcript");
|
||||||
saveTranscript(reply);
|
saveTranscript(reply);
|
||||||
|
}else if (reply->url().toString().startsWith(flushCacheUrl)) {
|
||||||
|
showNotification("Server um Cache-Löschung gebeten.");
|
||||||
|
qDebug("CacheFlushed");
|
||||||
}else{
|
}else{
|
||||||
qDebug("URL-Response: %s", qUtf8Printable(reply->url().toString()));
|
qDebug("URL-Response: %s", qUtf8Printable(reply->url().toString()));
|
||||||
qFatal("Unexpected responding URL");
|
qFatal("Unexpected responding URL");
|
||||||
|
|||||||
@@ -30,10 +30,12 @@ private slots:
|
|||||||
void appyConfigChanges();
|
void appyConfigChanges();
|
||||||
void openAboutWindow();
|
void openAboutWindow();
|
||||||
void openSpeechConfigWindow();
|
void openSpeechConfigWindow();
|
||||||
|
void flushServerCacheRequest();
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QTableWidget *tw;
|
QTableWidget *tw;
|
||||||
QPushButton *button;
|
QPushButton *button;
|
||||||
|
QPushButton *flushCacheButton;
|
||||||
QAction *standardsMenu;
|
QAction *standardsMenu;
|
||||||
QSettings *mySettings;
|
QSettings *mySettings;
|
||||||
ServerConnection *serverConnection;
|
ServerConnection *serverConnection;
|
||||||
|
|||||||
@@ -25,6 +25,13 @@
|
|||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QTableWidget" name="tableWidget"/>
|
<widget class="QTableWidget" name="tableWidget"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="flushCacheButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Server Cache Leeren</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
|||||||
Reference in New Issue
Block a user