Implemented advanced way of starting local z-Leaves
parent
b45254aa3b
commit
97a4ea3472
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2014-2016 Markus Prasser
|
||||
*
|
||||
* This file is part of Labcontrol.
|
||||
*
|
||||
* Labcontrol is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Labcontrol is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "localzleafstarter.h"
|
||||
#include "ui_localzleafstarter.h"
|
||||
#include "Lib/settings.h"
|
||||
|
||||
extern std::unique_ptr< lc::Settings > settings;
|
||||
|
||||
lc::LocalzLeafStarter::LocalzLeafStarter( QWidget *argParent ) :
|
||||
QWidget{ argParent },
|
||||
ui{ new Ui::LocalzLeafStarter }
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
if ( settings->GetChosenZTreePort() ) {
|
||||
ui->SBzLeafPort->setValue( settings->GetChosenZTreePort() );
|
||||
}
|
||||
|
||||
ui->CBzLeafVersion->addItem( tr( "Please choose a version" ) );
|
||||
if ( !settings->installedZTreeVersions.isEmpty() ) {
|
||||
ui->CBzLeafVersion->addItems( settings->installedZTreeVersions );
|
||||
}
|
||||
}
|
||||
|
||||
lc::LocalzLeafStarter::~LocalzLeafStarter() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void lc::LocalzLeafStarter::on_PBStartLocalzLeaf_clicked() {
|
||||
if ( ui->CBzLeafVersion->currentIndex() == 0 ) {
|
||||
QMessageBox::information( this, tr( "No z-Tree version chosen" ),
|
||||
tr( "The was not chosen a z-Tree version, yet. This is"
|
||||
" mandatory, so please set one" ) , QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
emit LocalzLeafRequested( ui->LEzLeafName->text(), ui->CBzLeafVersion->currentText(),
|
||||
ui->SBzLeafPort->value() );
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2014-2016 Markus Prasser
|
||||
*
|
||||
* This file is part of Labcontrol.
|
||||
*
|
||||
* Labcontrol is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Labcontrol is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOCALZLEAFSTARTER_H
|
||||
#define LOCALZLEAFSTARTER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace lc {
|
||||
|
||||
namespace Ui {
|
||||
class LocalzLeafStarter;
|
||||
}
|
||||
|
||||
class LocalzLeafStarter : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LocalzLeafStarter( QWidget *argParent = nullptr );
|
||||
~LocalzLeafStarter();
|
||||
|
||||
signals:
|
||||
void LocalzLeafRequested( QString argzLeafName, QString argzLeafVersion, int argzTreePort );
|
||||
|
||||
private:
|
||||
Ui::LocalzLeafStarter *ui = nullptr;
|
||||
|
||||
private slots:
|
||||
void on_PBStartLocalzLeaf_clicked();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // LOCALZLEAFSTARTER_H
|
||||
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>lc::LocalzLeafStarter</class>
|
||||
<widget class="QWidget" name="lc::LocalzLeafStarter">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>352</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Local z-Leaf Starter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="VLLocalzLeafStarter">
|
||||
<item>
|
||||
<widget class="QLabel" name="LzLeafName">
|
||||
<property name="toolTip">
|
||||
<string>This sets the name with which this local z-Leaf will connect to z-Tree.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set the name of the to be started z-Leaf:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="LEzLeafName">
|
||||
<property name="toolTip">
|
||||
<string>This sets the name with which this local z-Leaf will connect to z-Tree.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: cyan;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>local</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="LzLeafVersion">
|
||||
<property name="toolTip">
|
||||
<string>Choose of which version the started z-Leaf shall be.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose the version of the to be started z-Leaf:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="CBzLeafVersion">
|
||||
<property name="toolTip">
|
||||
<string>Choose of which version the started z-Leaf shall be.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: cyan;</string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="LzLeafPort">
|
||||
<property name="toolTip">
|
||||
<string>Set the port on which the z-Tree which shall be connected to listens.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose the port the to be started z-Leaf shall listen on:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="SBzLeafPort">
|
||||
<property name="toolTip">
|
||||
<string>Set the port on which the z-Tree which shall be connected to listens.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: cyan;</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>7000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="PBStartLocalzLeaf">
|
||||
<property name="toolTip">
|
||||
<string>Start a local z-Leaf with the set parameters.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start local z-Leaf</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="PBCancel">
|
||||
<property name="toolTip">
|
||||
<string>Cancel the start of a new local z-Leaf.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>PBCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>lc::LocalzLeafStarter</receiver>
|
||||
<slot>deleteLater()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>175</x>
|
||||
<y>328</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>175</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue