Added Kill z-Tree button, Added confirmation dialog for shutdown button, further minor UI changes

remotes/origin/HEAD
Tobias Weiss 8 years ago
parent f1cd123a79
commit af07c52979

1
.gitignore vendored

@ -30,3 +30,4 @@
# Qt Creator User Project Files
*.pro.user
*.eccba64

@ -471,17 +471,24 @@ void lc::MainWindow::on_PBShowSessions_clicked() {
}
void lc::MainWindow::on_PBShutdown_clicked() {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() );
// Do not shut down the server itself
if ( client->name == "self"){
QMessageBox::information(NULL, "Shutdown canceled", "It is not allowed to shutdown the server itself via labcontrol!");
} else {
client->Shutdown();
// Confirmation dialog
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm", "Really shutdown the selected clients?", QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes) {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() );
// Do not shut down the server itself
if ( client->name == "self"){
QMessageBox::information(NULL, "Shutdown canceled", "It is not allowed to shutdown the server itself via labcontrol!");
} else {
client->Shutdown();
}
}
}
} else {
qDebug() << "Canceled shutting down the selected clients";
}
}
@ -736,3 +743,24 @@ void lc::MainWindow::on_PBrestartCrashedSession_clicked() {
startProc.startDetached( settings->restartCrashedSessionScript);
}
}
void lc::MainWindow::on_PBKillzTree_clicked()
{
QString program{ settings->killallCmd };
QStringList arguments;
arguments << "-I" << "-q" << "ztree.exe";
// Confirmation dialog
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm", "Really kill all z-Tree instances?", QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes) {
// Kill all z-Tree processes
QProcess killLocalzLeafProc;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
killLocalzLeafProc.setProcessEnvironment( env );
killLocalzLeafProc.startDetached( program, arguments );
// Output message via the debug messages tab
qDebug() << program << arguments;
} else {
qDebug() << "Canceled killing all z-Tree processes";
}
}

@ -117,6 +117,7 @@ private slots:
QString argLatexHeaderName,
QString argDateString );
void on_PBrestartCrashedSession_clicked();
void on_PBKillzTree_clicked();
};
}

@ -40,15 +40,21 @@
<layout class="QHBoxLayout" name="HLExperimenterTab" stretch="1,1">
<item>
<layout class="QVBoxLayout" name="VLzTreeClientActions">
<item>
<item alignment="Qt::AlignTop">
<widget class="QGroupBox" name="GBzTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>z-Tree</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,0">
<item>
<widget class="QPushButton" name="PBStartSession">
<property name="toolTip">
@ -69,6 +75,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBKillzTree">
<property name="toolTip">
<string>Kill all local z-Tree instances</string>
</property>
<property name="text">
<string>Kill z-Tree</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBPrintPaymentFileManually">
<property name="toolTip">
@ -99,32 +115,32 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="PBStartzLeaf">
<widget class="QPushButton" name="PBShutdown">
<property name="toolTip">
<string>Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox.</string>
<string>Turns off the selected clients.</string>
</property>
<property name="text">
<string>Start z-Leaf</string>
<string>Shutdown</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBKillzLeaf">
<widget class="QPushButton" name="PBStartzLeaf">
<property name="toolTip">
<string>Kills zLeaf on all selected clients.</string>
<string>Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox.</string>
</property>
<property name="text">
<string>Kill z-Leaf</string>
<string>Start z-Leaf</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBShutdown">
<widget class="QPushButton" name="PBKillzLeaf">
<property name="toolTip">
<string>Turns off the selected clients.</string>
<string>Kills zLeaf on all selected clients.</string>
</property>
<property name="text">
<string>Shutdown</string>
<string>Kill z-Leaf</string>
</property>
</widget>
</item>
@ -218,6 +234,13 @@
</item>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBDeactivateScreensaver">
<property name="toolTip">
@ -228,6 +251,13 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LFakeName">
<property name="enabled">
@ -240,7 +270,7 @@
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run zLeaf with another name than the client's.&lt;br/&gt;Choose the name the zLeaf shall have:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run zLeaf with another name than the client's:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@ -258,12 +288,31 @@
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Choose the name the z-Leaf shall have</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBRunzLeaf">
<property name="text">
<string>Run z-Leaf</string>
<string>Run z-Leaf with chosen name</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LUploadFolder">
<property name="text">
<string>Upoad folder:</string>
</property>
</widget>
</item>

Loading…
Cancel
Save