[PC-BSD Commits] r15871 - pcbsd/current/src-qt4/warden/src
svn at pcbsd.org
svn at pcbsd.org
Wed Mar 21 03:15:34 PDT 2012
Author: kris
Date: 2012-03-21 10:15:34 +0000 (Wed, 21 Mar 2012)
New Revision: 15871
Added:
pcbsd/current/src-qt4/warden/src/wizardNewJail.cpp
pcbsd/current/src-qt4/warden/src/wizardNewJail.h
pcbsd/current/src-qt4/warden/src/wizardNewJail.ui
Removed:
pcbsd/current/src-qt4/warden/src/dialogcreatejail.cpp
pcbsd/current/src-qt4/warden/src/dialogcreatejail.h
pcbsd/current/src-qt4/warden/src/dialogcreatejail.ui
pcbsd/current/src-qt4/warden/src/dialogsetupuser.cpp
pcbsd/current/src-qt4/warden/src/dialogsetupuser.h
pcbsd/current/src-qt4/warden/src/dialogsetupuser.ui
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
pcbsd/current/src-qt4/warden/src/src.pro
Log:
Update warden GUI to use new create jail wizard, which is much nicer than
before
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.cpp
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.cpp 2012-03-21 09:15:18 UTC (rev 15870)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.cpp 2012-03-21 10:15:34 UTC (rev 15871)
@@ -20,10 +20,9 @@
#include "dialogworking.h"
#include "dialogconfig.h"
-#include "dialogcreatejail.h"
#include "dialogdisplayoutput.h"
#include "dialogimport.h"
-#include "dialogsetupuser.h"
+#include "wizardNewJail.h"
#include "pcbsd-utils.h"
/* Update interval in ms - Every 5 seconds */
@@ -491,114 +490,56 @@
}
-
void dialogWarden::slotClickedNewJail()
{
// Launch our working dialog to prevent further action until we are finished
- newJailDialog = new dialogCreateJail();
- newJailDialog->setModal(true);
- newJailDialog->programInit();
+ newJailWizard = new wizardNewJail();
+ newJailWizard->setModal(true);
+ newJailWizard->programInit();
- connect( newJailDialog, SIGNAL(create(const QString &, const QString &, bool, bool, bool)), this, SLOT(slotCreateNewJail(const QString &, const QString &, bool, bool, bool) ) );
- newJailDialog->show();
-
-
-
-
-
+ connect( newJailWizard, SIGNAL(create(const QString &, const QString &, bool, const QString &, bool, bool, bool)), this, SLOT(slotCreateNewJail(const QString &, const QString &, bool, const QString &, bool, bool, bool) ) );
+ newJailWizard->show();
}
-
-
-void dialogWarden::slotCreateNewJail( const QString &IP, const QString &host, bool src, bool ports, bool autostart )
+void dialogWarden::slotCreateNewJail( const QString &IP, const QString &host, bool tradjail, const QString &rootpw, bool src, bool ports, bool autostart )
{
- // Save the provided variables so we can use them at creation time
- newIP = IP;
- newHost = host;
- newSrc = src;
- newPorts = ports;
- newAutostart = autostart;
+ if ( tradjail )
+ newRootPW=rootpw;
+ else
+ newRootPW="";
-
- // First Prompt for the root password for this jail
- userDialog = new dialogSetupUser();
- userDialog->setModal(true);
- userDialog->programInit();
- connect( userDialog, SIGNAL(saved(const QString &, const QString &, const QString &)), this, SLOT(slotSavedUserSettings(const QString &, const QString &, const QString &) ) );
- userDialog->show();
-}
+ newIP=IP;
-
-void dialogWarden::slotReadCreateOutput()
-{
- while ( createJailProc->canReadLine() )
- {
- dialogOutput->appendDialogText(createJailProc->readLine());
- }
-}
-
-
-void dialogWarden::slotFinishedJailCreate()
-{
- // Jail is done creating, now add the username to it
- userAddProc = new QProcess( this );
- QString program = ProgDir + "/scripts/backend/setupusers.sh";
- QStringList args;
- args << newIP << newRootPW << newUser << newUserPW;
-
- // Connect the exited signal and start the process
- userAddProc->setProcessChannelMode(QProcess::MergedChannels);
- userAddProc->setReadChannel(QProcess::StandardOutput);
- connect( userAddProc, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReadUserAddOutput() ) );
- connect( userAddProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinishedUserAdd() ) );
- userAddProc->start(program, args);
-
-
-}
-
-
-void dialogWarden::slotSavedUserSettings( const QString &root, const QString &user, const QString &userpw )
-{
- // Save our variables
- newRootPW = root;
- newUser = user;
- newUserPW = userpw;
-
-
/***********************************************************************************************************************
Now create the jail here
*************************************************************************************************************************/
dialogOutput = new dialogDisplayOutput();
dialogOutput->setModal(true);
dialogOutput->programInit(FALSE);
- dialogOutput->setDialogCaption("Creating Jail: " + newIP);
+ dialogOutput->setDialogCaption("Creating Jail: " + IP);
dialogOutput->setDialogText("");
dialogOutput->show();
// Now start the script to stop this jail
createJailProc = new QProcess( this );
- QString program = ProgDir + "/scripts/backend/createjail.sh";
+ QString program = "warden";
QStringList args;
- args << newIP << newHost;
+ args << "create" << IP << host;
- // Set our flags if we want source / ports tree or not
- if ( newSrc )
- args << "YES";
- else
- args << "NO";
+ // Set our optional flags
+ if ( ! tradjail )
+ args << "--portjail";
- if ( newPorts )
- args << "YES";
- else
- args << "NO";
+ if ( src )
+ args << "--src";
- if ( newAutostart )
- args << "YES";
- else
- args << "NO";
+ if ( ports )
+ args << "--ports";
+ if ( autostart )
+ args << "--startauto";
// Connect the exited signal and start the process
createJailProc->setProcessChannelMode(QProcess::MergedChannels);
@@ -606,10 +547,43 @@
connect( createJailProc, SIGNAL(readyReadStandardOutput ()), this, SLOT(slotReadCreateOutput() ) );
connect( createJailProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinishedJailCreate() ) );
createJailProc->start(program, args);
+
+}
+
+void dialogWarden::slotReadCreateOutput()
+{
+ while ( createJailProc->canReadLine() )
+ {
+ dialogOutput->appendDialogText(createJailProc->readLine());
+ }
}
+void dialogWarden::slotFinishedJailCreate()
+{
+ // If this doesn't need a root pw, or doesn't have one
+ if ( newRootPW.isEmpty() ) {
+ slotFinishedUserAdd();
+ return;
+ }
+
+ // Jail is done creating, now set rootpw
+ userAddProc = new QProcess( this );
+ QString program = ProgDir + "/scripts/backend/setupusers.sh";
+ QStringList args;
+ args << newIP << newRootPW;
+
+ // Connect the exited signal and start the process
+ userAddProc->setProcessChannelMode(QProcess::MergedChannels);
+ userAddProc->setReadChannel(QProcess::StandardOutput);
+ connect( userAddProc, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReadUserAddOutput() ) );
+ connect( userAddProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinishedUserAdd() ) );
+ userAddProc->start(program, args);
+
+}
+
+
void dialogWarden::slotReadUserAddOutput()
{
while ( userAddProc->canReadLine() )
@@ -621,7 +595,7 @@
void dialogWarden::slotFinishedUserAdd()
{
- // All finished with creating a jail and adding a username to it
+ // All finished with creating a jail and adding a username to it
// Unhide the close button
dialogOutput->setCloseHide(FALSE);
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.h
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.h 2012-03-21 09:15:18 UTC (rev 15870)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.h 2012-03-21 10:15:34 UTC (rev 15871)
@@ -6,6 +6,7 @@
#include "ui_dialogwarden.h"
#include "dialogimport.h"
+#include "wizardNewJail.h"
#include <QMenu>
class dialogWarden : public QMainWindow, private Ui::dialogWarden
@@ -42,10 +43,9 @@
void slotFinishedOutput();
void slotReadPkgsOutput();
void slotClickedNewJail();
- void slotCreateNewJail( const QString &IP, const QString &host, bool src, bool ports, bool autostart );
+ void slotCreateNewJail( const QString &, const QString &, bool, const QString &, bool, bool, bool );
void slotReadCreateOutput();
void slotFinishedJailCreate();
- void slotSavedUserSettings( const QString &root, const QString &user, const QString &userpw );
void slotReadUserAddOutput();
void slotFinishedUserAdd();
void slotImportJailClicked();
@@ -82,9 +82,8 @@
dialogDisplayOutput *dialogOutput;
QProcess *listPackagesProc;
QProcess *deleteJailProc;
- dialogCreateJail *newJailDialog;
+ wizardNewJail *newJailWizard;
QProcess *createJailProc;
- dialogSetupUser *userDialog;
QString newIP;
QString newHost;
bool newSrc;
Modified: pcbsd/current/src-qt4/warden/src/dialogwarden.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/dialogwarden.ui 2012-03-21 09:15:18 UTC (rev 15870)
+++ pcbsd/current/src-qt4/warden/src/dialogwarden.ui 2012-03-21 10:15:34 UTC (rev 15871)
@@ -315,8 +315,6 @@
<include location="local">qprocess.h</include>
<include location="local">dialogworking.h</include>
<include location="local">dialogdisplayoutput.h</include>
- <include location="local">dialogcreatejail.h</include>
- <include location="local">dialogsetupuser.h</include>
</includes>
<resources>
<include location="warden.qrc"/>
Modified: pcbsd/current/src-qt4/warden/src/src.pro
===================================================================
--- pcbsd/current/src-qt4/warden/src/src.pro 2012-03-21 09:15:18 UTC (rev 15870)
+++ pcbsd/current/src-qt4/warden/src/src.pro 2012-03-21 10:15:34 UTC (rev 15871)
@@ -6,17 +6,16 @@
LIBS += -lpcbsd
INCLUDEPATH+= ../../../pcbsd/current/src-qt4/libpcbsd/
-HEADERS += dialogwarden.h dialogconfig.h dialogimport.h dialogworking.h dialogdisplayoutput.h dialogcreatejail.h dialogsetupuser.h
+HEADERS += dialogwarden.h dialogconfig.h dialogimport.h dialogworking.h dialogdisplayoutput.h wizardNewJail.h
-SOURCES += main.cpp dialogwarden.cpp dialogconfig.cpp dialogimport.cpp dialogworking.cpp dialogdisplayoutput.cpp dialogcreatejail.cpp dialogsetupuser.cpp
+SOURCES += main.cpp dialogwarden.cpp dialogconfig.cpp dialogimport.cpp dialogworking.cpp dialogdisplayoutput.cpp wizardNewJail.cpp
FORMS = dialogwarden.ui \
dialogconfig.ui \
- dialogcreatejail.ui \
dialogdisplayoutput.ui \
dialogimport.ui \
- dialogsetupuser.ui \
- dialogworking.ui
+ dialogworking.ui \
+ wizardNewJail.ui
TARGET = warden-gui
Index: pcbsd/current/src-qt4/warden/src/wizardNewJail.ui
===================================================================
--- pcbsd/current/src-qt4/warden/src/wizardNewJail.ui 2012-03-21 09:15:18 UTC (rev 15870)
+++ pcbsd/current/src-qt4/warden/src/wizardNewJail.ui 2012-03-21 10:15:34 UTC (rev 15871)
Property changes on: pcbsd/current/src-qt4/warden/src/wizardNewJail.ui
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/xml
More information about the Commits
mailing list