[PC-BSD Commits] r15747 - pcbsd/current/src-qt4/warden/src
svn at pcbsd.org
svn at pcbsd.org
Wed Mar 7 13:08:02 PST 2012
Author: kris
Date: 2012-03-07 21:08:02 +0000 (Wed, 07 Mar 2012)
New Revision: 15747
Modified:
pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
pcbsd/current/src-qt4/warden/src/dialogwarden.h
pcbsd/current/src-qt4/warden/src/dialogwarden.ui
Log:
Keep jail list in memory, and use it when switching views. Also add slot to find
if we've selected new jail, and update group tab widget
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.cpp 2012-03-07 20:27:40 UTC (rev 15746)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.cpp 2012-03-07 21:08:02 UTC (rev 15747)
@@ -14,6 +14,7 @@
#include <qfiledialog.h>
#include <qsettings.h>
#include <QTextStream>
+#include <QDebug>
@@ -25,8 +26,8 @@
#include "dialogsetupuser.h"
#include "pcbsd-utils.h"
-/* Update interval in ms - Every 2 seconds */
-#define UPDATE_MSEC 1000 * 2
+/* Update interval in ms - Every 5 seconds */
+#define UPDATE_MSEC 1000 * 5
void dialogWarden::helpAbout()
{
@@ -36,31 +37,39 @@
void dialogWarden::programInit()
{
- // Setup our listview options
- listJails->setSelectionMode(QAbstractItemView::SingleSelection);
- listJails->setAllColumnsShowFocus(TRUE);
+ // Setup our listview options
+ listJails->setSelectionMode(QAbstractItemView::SingleSelection);
+ listJails->setAllColumnsShowFocus(TRUE);
+
+ // Hide the identifier column / host column
+ listJails->setColumnHidden(0, true);
+ listJails->setColumnHidden(2, true);
+
+ groupJailTab->setTitle(tr("<- Please select a jail"));
+ groupJailTab->setEnabled(false);
- // Read in our configuration data
- readConfig();
+ // Read in our configuration data
+ readConfig();
// Start by refreshing our jail list
- refreshJails();
+ refreshJails();
- // Start our monitor service to check if jails are running
- checkingStatus = false;
- currentStatusWorkingJail = "";
- statusTimer = new QTimer(this);
- connect( statusTimer, SIGNAL(timeout()), this, SLOT( slotMonitorJailStatus() ) );
- slotMonitorJailStatus();
+ // Start our monitor service to check if jails are running
+ checkingStatus = false;
+ currentStatusWorkingJail = "";
+ statusTimer = new QTimer(this);
+ connect( statusTimer, SIGNAL(timeout()), this, SLOT( slotMonitorJailStatus() ) );
+ slotMonitorJailStatus();
+
-
- // Connect the rightclick slot
- listJails->setContextMenuPolicy( Qt::CustomContextMenu);
- //connect( listJails, SIGNAL(customContextMenuRequested (const QPoint & ) ), this, SLOT(slotJailRightClicked() ) );
- connect( radioIPSort, SIGNAL(clicked()), this, SLOT(refreshJails() ) );
- connect( radioHostSort, SIGNAL(clicked()), this, SLOT(refreshJails() ) );
- connect( pushAdd, SIGNAL(clicked()), this, SLOT(slotClickedNewJail() ) );
- connect( pushRemove, SIGNAL(clicked()), this, SLOT(slotClickedNewJail() ) );
+ // Connect the rightclick slot
+ listJails->setContextMenuPolicy( Qt::CustomContextMenu);
+ //connect( listJails, SIGNAL(customContextMenuRequested (const QPoint & ) ), this, SLOT(slotJailRightClicked() ) );
+ connect( listJails, SIGNAL(itemSelectionChanged() ), this, SLOT(slotCurrentJailChanged() ) );
+ connect( radioIPSort, SIGNAL(clicked()), this, SLOT(slotJailViewChanged() ) );
+ connect( radioHostSort, SIGNAL(clicked()), this, SLOT(slotJailViewChanged() ) );
+ connect( pushAdd, SIGNAL(clicked()), this, SLOT(slotClickedNewJail() ) );
+ connect( pushRemove, SIGNAL(clicked()), this, SLOT(slotClickedNewJail() ) );
}
@@ -69,8 +78,6 @@
QString AutoStart;
listJails->clear();
- // Hide the identifier column
- listJails->setColumnHidden(0, true);
// Check our JailDir and see what we have
QDir d(JailDir);
@@ -101,9 +108,9 @@
}
QStringList cols;
if ( radioIPSort->isChecked() )
- cols << d[i] << d[i];
+ cols << d[i] << d[i] << host;
else
- cols << d[i] << host;
+ cols << d[i] << d[i] << host;
(void) new QTreeWidgetItem( listJails, cols );
}
}
@@ -175,21 +182,22 @@
}
- // If we have a jail to check status on, do it
+ // Are we ready to take a break?
if ( currentStatusWorkingJail == oldWorking ) {
checkingStatus = false;
currentStatusWorkingJail="";
return;
}
- // Run the getUpdatesDir.sh script to rsync with master server
- statusProc = new QProcess( this );
- QString program = ProgDir + "/scripts/backend/checkstatus.sh";
- QStringList args;
- args << currentStatusWorkingJail;
-
- // Connect the exited signal and start the process
- connect( statusProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCheckStatusReturn() ) );
- statusProc->start(program, args);
+
+ // Run the getUpdatesDir.sh script to rsync with master server
+ statusProc = new QProcess( this );
+ QString program = ProgDir + "/scripts/backend/checkstatus.sh";
+ QStringList args;
+ args << currentStatusWorkingJail;
+
+ // Connect the exited signal and start the process
+ connect( statusProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCheckStatusReturn() ) );
+ statusProc->start(program, args);
}
@@ -221,14 +229,13 @@
{
if ( exitStatus == 0) {
(*it)->setIcon(1, QIcon(":running.png"));
+ (*it)->setIcon(2, QIcon(":running.png"));
} else {
(*it)->setIcon(1, QIcon(":stopped.png"));
+ (*it)->setIcon(2, QIcon(":stopped.png"));
}
-
break;
}
-
-
++it;
}
@@ -773,3 +780,26 @@
toggleAutoProc->start(program, args);
}
+
+void dialogWarden::slotJailViewChanged()
+{
+ if ( radioIPSort->isChecked() ) {
+ listJails->setColumnHidden(1, false);
+ listJails->setColumnHidden(2, true);
+ } else {
+ listJails->setColumnHidden(1, true);
+ listJails->setColumnHidden(2, false);
+ }
+}
+
+void dialogWarden::slotCurrentJailChanged()
+{
+ qDebug() << "HERE";
+ if ( ! listJails->currentItem() )
+ return;
+
+ qDebug() << listJails->currentItem()->text(0);
+ groupJailTab->setTitle(tr("Working on jail:") + " " + listJails->currentItem()->text(0));
+ groupJailTab->setEnabled(true);
+
+}
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.h
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.h 2012-03-07 20:27:40 UTC (rev 15746)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.h 2012-03-07 21:08:02 UTC (rev 15747)
@@ -56,6 +56,8 @@
void slotFinishedInmateInstall();
void slotToggleAutostartClicked();
void slotImportConfigDone(const QString &IP, const QString &Host);
+ void slotJailViewChanged();
+ void slotCurrentJailChanged();
private:
void runCommand( QString command );
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.ui 2012-03-07 20:27:40 UTC (rev 15746)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.ui 2012-03-07 21:08:02 UTC (rev 15747)
@@ -76,6 +76,11 @@
<string>Jail</string>
</property>
</column>
+ <column>
+ <property name="text">
+ <string>Hostname</string>
+ </property>
+ </column>
</widget>
</item>
<item row="2" column="0">
@@ -170,7 +175,7 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QGroupBox" name="groupBox_2">
+ <widget class="QGroupBox" name="groupJailTab">
<property name="title">
<string>Working on Jail</string>
</property>
More information about the Commits
mailing list