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/>.
*/
#include <memory>
#include <QMessageBox>
#include "Lib/settings.h"
#include "localzleafstarter.h"
#include "Lib/settings.h"
#include "ui_localzleafstarter.h"
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} {
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<quint16>(ui->SBzLeafPort->value()));
}

@ -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();

@ -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;

@ -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

Loading…
Cancel
Save