diff --git a/mainwindow.cpp b/mainwindow.cpp index 2012ee4..ee2ce7d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -23,6 +23,7 @@ #include #include #include +#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("pushButton"); connect(button, SIGNAL (released()), this, SLOT (importFile())); + flushCacheButton = ui->centralWidget->findChild("flushCacheButton"); + connect(flushCacheButton, SIGNAL (released()), this, SLOT (flushServerCacheRequest())); + /* table ui */ tw = ui->centralWidget->findChild("tableWidget"); @@ -390,11 +394,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); @@ -403,6 +415,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"); diff --git a/mainwindow.h b/mainwindow.h index fa7aad9..6a5ea1a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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; diff --git a/mainwindow.ui b/mainwindow.ui index 18a9b09..72a8743 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -25,6 +25,13 @@ + + + + Server Cache Leeren + + +