Revise LocalzLeafStarter

remotes/origin/HEAD
markuspg 4 years ago
parent df18e075e4
commit f5d7d1af7e

@ -17,17 +17,18 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>. * along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <memory>
#include <QMessageBox>
#include "Lib/settings.h"
#include "localzleafstarter.h" #include "localzleafstarter.h"
#include "Lib/settings.h"
#include "ui_localzleafstarter.h" #include "ui_localzleafstarter.h"
extern std::unique_ptr<lc::Settings> settings; extern std::unique_ptr<lc::Settings> 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} { : QWidget{argParent}, ui{new Ui::LocalzLeafStarter} {
ui->setupUi(this); ui->setupUi(this);
@ -45,8 +46,15 @@ lc::LocalzLeafStarter::LocalzLeafStarter(QWidget *argParent)
} }
} }
/*!
* \brief Destroy the LocalzLeafStarter instance
*/
lc::LocalzLeafStarter::~LocalzLeafStarter() { delete ui; } 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() { void lc::LocalzLeafStarter::on_PBStartLocalzLeaf_clicked() {
if (ui->CBzLeafVersion->currentIndex() == 0) { if (ui->CBzLeafVersion->currentIndex() == 0) {
QMessageBox::information( QMessageBox::information(
@ -63,5 +71,5 @@ void lc::LocalzLeafStarter::on_PBStartLocalzLeaf_clicked() {
// Emit start local z-Leaf request to main window // Emit start local z-Leaf request to main window
emit LocalzLeafRequested(ui->LEzLeafName->text(), emit LocalzLeafRequested(ui->LEzLeafName->text(),
ui->CBzLeafVersion->currentText(), ui->CBzLeafVersion->currentText(),
ui->SBzLeafPort->value()); static_cast<quint16>(ui->SBzLeafPort->value()));
} }

@ -26,21 +26,27 @@ namespace lc {
namespace Ui { namespace Ui {
class LocalzLeafStarter; 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 { class LocalzLeafStarter : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit LocalzLeafStarter(QWidget *argParent = nullptr); explicit LocalzLeafStarter(QWidget *argParent = nullptr);
~LocalzLeafStarter(); ~LocalzLeafStarter() override;
signals: signals:
void LocalzLeafRequested(QString argzLeafName, QString argzLeafVersion, void LocalzLeafRequested(QString argzLeafName, QString argzLeafVersion,
int argzTreePort); quint16 argzTreePort);
private: private:
Ui::LocalzLeafStarter *ui = nullptr; Ui::LocalzLeafStarter *const ui = nullptr;
private slots: private slots:
void on_PBStartLocalzLeaf_clicked(); void on_PBStartLocalzLeaf_clicked();

@ -719,13 +719,13 @@ void lc::MainWindow::on_PBStartLocalzLeaf_clicked() {
localzLeafStarter->show(); localzLeafStarter->show();
connect(localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested, this, connect(localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested, this,
&MainWindow::StartLocalzLeaf); &MainWindow::StartLocalzLeaf);
connect(localzLeafStarter, SIGNAL(LocalzLeafRequested(QString, QString, int)), connect(localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested,
localzLeafStarter, SLOT(deleteLater())); localzLeafStarter, &LocalzLeafStarter::deleteLater);
} }
void lc::MainWindow::StartLocalzLeaf(QString argzLeafName, void lc::MainWindow::StartLocalzLeaf(const QString &argzLeafName,
QString argzLeafVersion, const QString &argzLeafVersion,
int argzTreePort) { const quint16 argzTreePort) {
if (settings->tasksetCmd.isEmpty() || settings->wineCmd.isEmpty() || if (settings->tasksetCmd.isEmpty() || settings->wineCmd.isEmpty() ||
settings->zTreeInstDir.isEmpty()) { settings->zTreeInstDir.isEmpty()) {
return; return;

@ -83,8 +83,8 @@ private slots:
void on_PBViewDesktopViewOnly_clicked(); void on_PBViewDesktopViewOnly_clicked();
void on_PBViewDesktopFullControl_clicked(); void on_PBViewDesktopFullControl_clicked();
void on_RBUseLocalUser_toggled(bool checked); void on_RBUseLocalUser_toggled(bool checked);
void StartLocalzLeaf(QString argzLeafName, QString argzLeafVersion, void StartLocalzLeaf(const QString &argzLeafName,
int argzTreePort); const QString &argzLeafVersion, quint16 argzTreePort);
//! Updates the icons of the QTableView displaying the clients' states //! Updates the icons of the QTableView displaying the clients' states
/*! /*!
* This function iterates over all valid items of the 'TVClients' and sets * This function iterates over all valid items of the 'TVClients' and sets

Loading…
Cancel
Save