diff --git a/src/localzleafstarter.cpp b/src/localzleafstarter.cpp index f8e5e41..42c288f 100644 --- a/src/localzleafstarter.cpp +++ b/src/localzleafstarter.cpp @@ -17,17 +17,18 @@ * along with Labcontrol. If not, see . */ -#include - -#include - -#include "Lib/settings.h" #include "localzleafstarter.h" +#include "Lib/settings.h" #include "ui_localzleafstarter.h" extern std::unique_ptr settings; -lc::LocalzLeafStarter::LocalzLeafStarter(QWidget *argParent) +/*! + * \brief Create a new LocalzLeafStarter instance + * + * \param argParent The instance's parent QObject + */ +lc::LocalzLeafStarter::LocalzLeafStarter(QWidget *const argParent) : QWidget{argParent}, ui{new Ui::LocalzLeafStarter} { ui->setupUi(this); @@ -45,8 +46,15 @@ lc::LocalzLeafStarter::LocalzLeafStarter(QWidget *argParent) } } +/*! + * \brief Destroy the LocalzLeafStarter instance + */ lc::LocalzLeafStarter::~LocalzLeafStarter() { delete ui; } +/*! + * \brief Reacts on a button click and emits the signal carrying the parameters + * for a requested local z-Leaf + */ void lc::LocalzLeafStarter::on_PBStartLocalzLeaf_clicked() { if (ui->CBzLeafVersion->currentIndex() == 0) { QMessageBox::information( @@ -63,5 +71,5 @@ void lc::LocalzLeafStarter::on_PBStartLocalzLeaf_clicked() { // Emit start local z-Leaf request to main window emit LocalzLeafRequested(ui->LEzLeafName->text(), ui->CBzLeafVersion->currentText(), - ui->SBzLeafPort->value()); + static_cast(ui->SBzLeafPort->value())); } diff --git a/src/localzleafstarter.h b/src/localzleafstarter.h index bb0c5cc..67fbe20 100644 --- a/src/localzleafstarter.h +++ b/src/localzleafstarter.h @@ -26,21 +26,27 @@ namespace lc { namespace Ui { class LocalzLeafStarter; -} +} // namespace Ui +/*! + * \brief A configuration interface for the setup of local z-Leaf instances + * + * This class has no functionality to start a local z-Leaf but emits a signal + * containing the parameters for a to be started z-Leaf. + */ class LocalzLeafStarter : public QWidget { Q_OBJECT public: explicit LocalzLeafStarter(QWidget *argParent = nullptr); - ~LocalzLeafStarter(); + ~LocalzLeafStarter() override; signals: void LocalzLeafRequested(QString argzLeafName, QString argzLeafVersion, - int argzTreePort); + quint16 argzTreePort); private: - Ui::LocalzLeafStarter *ui = nullptr; + Ui::LocalzLeafStarter *const ui = nullptr; private slots: void on_PBStartLocalzLeaf_clicked(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8f7bf17..5b06e11 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -719,13 +719,13 @@ void lc::MainWindow::on_PBStartLocalzLeaf_clicked() { localzLeafStarter->show(); connect(localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested, this, &MainWindow::StartLocalzLeaf); - connect(localzLeafStarter, SIGNAL(LocalzLeafRequested(QString, QString, int)), - localzLeafStarter, SLOT(deleteLater())); + connect(localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested, + localzLeafStarter, &LocalzLeafStarter::deleteLater); } -void lc::MainWindow::StartLocalzLeaf(QString argzLeafName, - QString argzLeafVersion, - int argzTreePort) { +void lc::MainWindow::StartLocalzLeaf(const QString &argzLeafName, + const QString &argzLeafVersion, + const quint16 argzTreePort) { if (settings->tasksetCmd.isEmpty() || settings->wineCmd.isEmpty() || settings->zTreeInstDir.isEmpty()) { return; diff --git a/src/mainwindow.h b/src/mainwindow.h index 0f9c0af..bf188b7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -83,8 +83,8 @@ private slots: void on_PBViewDesktopViewOnly_clicked(); void on_PBViewDesktopFullControl_clicked(); void on_RBUseLocalUser_toggled(bool checked); - void StartLocalzLeaf(QString argzLeafName, QString argzLeafVersion, - int argzTreePort); + void StartLocalzLeaf(const QString &argzLeafName, + const QString &argzLeafVersion, quint16 argzTreePort); //! Updates the icons of the QTableView displaying the clients' states /*! * This function iterates over all valid items of the 'TVClients' and sets