From 9bacddf36631572b610f042e17b5ee631dfebbca Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 30 Oct 2022 12:03:43 +0100 Subject: Modernize cmake file and project structure a bit --- src/server/mainwindow/mainwindow.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index f6ff566..b63545f 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -38,7 +38,6 @@ #include "../util/platform/screensaver.h" // Auto-generated ui class #include "ui_mainwindow.h" -#include "ui_reloadroom.h" #include #include @@ -711,20 +710,20 @@ void MainWindow::startVncServerIfNecessary(int from) void MainWindow::onButtonReloadRoomConfig() { - connect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); - connect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + connect(_reloadWindow->buttonBox(), SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + connect(_reloadWindow->buttonBox(), SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); QList keyList = serverApp->getRooms().keys(); for (QList::iterator it = keyList.begin(); it != keyList.end() ; it++) { - _reloadWindow->ui->roomList->addItem(*it); + _reloadWindow->addRoom(*it); } _reloadWindow->show(); } void MainWindow::onReloadRoomCancel() { - disconnect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); - disconnect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); - _reloadWindow->ui->roomList->clear(); + disconnect(_reloadWindow->buttonBox(), SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + disconnect(_reloadWindow->buttonBox(), SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + _reloadWindow->clearRoomList(); _reloadWindow->hide(); } @@ -785,7 +784,8 @@ void MainWindow::reloadCurrentRoom() void MainWindow::onReloadRoomOk() { - if (_reloadWindow->ui->roomList->currentItem() == nullptr) { + QString roomToReload = _reloadWindow->currentRoom(); + if (roomToReload.isEmpty()) { QMessageBox::critical(this, "Warning", tr("No item selected, please select room!"), 0, 1); return; } @@ -794,8 +794,8 @@ void MainWindow::onReloadRoomOk() "Note that all clients will be deleted."), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (ret == QMessageBox::Yes) { - disconnect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); - disconnect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + disconnect(_reloadWindow->buttonBox(), SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + disconnect(_reloadWindow->buttonBox(), SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); // Delete all clients. for (QList::iterator it = _clientFrames.begin(); it != _clientFrames.end(); it++) { (*it)->hide(); @@ -804,11 +804,10 @@ void MainWindow::onReloadRoomOk() _clientFrames.clear(); // Load new room configuration. - QString roomToReload = _reloadWindow->ui->roomList->currentItem()->data(0).toString(); serverApp->setCurrentRoom(roomToReload); reloadCurrentRoom(); - _reloadWindow->ui->roomList->clear(); + _reloadWindow->clearRoomList(); _reloadWindow->hide(); } -- cgit v1.2.3-55-g7522