diff options
author | Christian Klinger | 2016-04-27 17:54:11 +0200 |
---|---|---|
committer | Christian Klinger | 2016-04-27 17:54:11 +0200 |
commit | b00f462eb861873feb78cae9a72ceb1fa796992a (patch) | |
tree | d21a0809bd41e0b666de2efb07a576fd4bc5a38b /src/server/mainwindow | |
parent | removed trashbin. (diff) | |
download | pvs2-b00f462eb861873feb78cae9a72ceb1fa796992a.tar.gz pvs2-b00f462eb861873feb78cae9a72ceb1fa796992a.tar.xz pvs2-b00f462eb861873feb78cae9a72ceb1fa796992a.zip |
delete button in the toolbar.
Diffstat (limited to 'src/server/mainwindow')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 30 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.h | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 7d27434..3719d2a 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -110,6 +110,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool))); connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(onButtonHelp())); connect(ui->actionReload_Room_Configuration, SIGNAL(triggered()), this, SLOT(onButtonReloadRoomConfig())); + connect(ui->action_DeleteClient, SIGNAL(triggered()), this, SLOT(onDeleteClient())); /* Stuff for the button lock */ //Setup a timeout @@ -1320,3 +1321,32 @@ void MainWindow::EnableButtons() foreach (QAction* a, _lockingButtons) a->setEnabled(true); } + + +void MainWindow::onDeleteClient() { + // If no frame is selected, warning. + ConnectionFrame* frame = getSelectedFrame(); + if (frame == NULL) { + QMessageBox::critical(this, tr("Selection"), tr("No client is selected.")); + return; + } + if (frame->client() != NULL) { + QMessageBox::critical(this, tr("Selection"), tr("This client is still connected.")); + return; + } else { + qDebug() << "Now delete the client"; + int ret = QMessageBox::question(this, "Warning", tr("Sure, You want to delete selected client?"), 0, 1, 2); + if (ret == 1) { + frame->hide(); + frame->deleteLater(); + _clientFrames.removeOne(frame); + return; + } else { + frame->move(frame->getPreviousPosition()); + return; + } + } + + + +} diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index effc8f1..fae0c7d 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -95,6 +95,8 @@ protected slots: void onSessionNameClick(); void onSessionNameUpdate(); + void onDeleteClient(); + void onButtonLock(bool checked); void onButtonStudentToTutor(); void onButtonStudentToTutorExclusive(); |