Ignore:
Timestamp:
Jun 12, 2013 10:13:21 AM (13 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
ed41975
Parents:
a071509
Message:

Add new template combobox to warden GUI, which will allow users to pick from other FreeBSD version/arch templates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/warden-gui/wizardNewJail.cpp

    r1620346 r5dbb9c2  
    1313#include "pcbsd-utils.h" 
    1414#include <QDebug> 
     15#include <QProcess> 
    1516#include <QFileDialog> 
    1617 
     
    2930    connect(pushLinuxScript, SIGNAL(clicked()), this, SLOT(slotSelectLinuxScript()) ); 
    3031    connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCheckComplete()) ); 
     32    loadTemplates(); 
     33} 
     34 
     35void wizardNewJail::loadTemplates() 
     36{ 
     37   comboTemplate->clear(); 
     38   comboTemplate->addItem(tr("Use host Version + Architecture (default)")); 
     39   // Load any available templates 
     40   QProcess m; 
     41   m.start(QString("warden"), QStringList() << "template" << "list"); 
     42   while(m.state() == QProcess::Starting || m.state() == QProcess::Running) { 
     43      m.waitForFinished(200); 
     44      QCoreApplication::processEvents(); 
     45   } 
     46   // Get output of mount now 
     47   int i = 0; 
     48   QString tmp; 
     49   while (m.canReadLine()) { 
     50     i++; 
     51     tmp = m.readLine().simplified(); 
     52     // Skip first two header lines 
     53     if ( i > 2) 
     54       comboTemplate->addItem(tmp); 
     55   } 
    3156} 
    3257 
     
    5479void wizardNewJail::accept() 
    5580{ 
    56     QString ip4, ip6; 
     81    QString ip4, ip6, tplate; 
    5782    if ( checkIPv4->isChecked() ) 
    5883       ip4 = lineIP->text(); 
    5984    if ( checkIPv6->isChecked() ) 
    6085       ip6 = lineIP6->text(); 
     86 
     87    if ( comboTemplate->currentIndex() != 0 ) 
     88    tplate = comboTemplate->currentText().section(" ", 0, 0); 
    6189     
    6290    emit create(ip4, ip6, lineHost->text(), radioTraditionalJail->isChecked(), checkPCBSDUtils->isChecked(), 
    6391                lineRoot->text(), checkSystemSource->isChecked(), checkPortsTree->isChecked(), 
    64                 checkAutostart->isChecked(), radioLinuxJail->isChecked(), lineLinuxScript->text()); 
     92                checkAutostart->isChecked(), radioLinuxJail->isChecked(), lineLinuxScript->text(), tplate); 
    6593    close(); 
    6694     
Note: See TracChangeset for help on using the changeset viewer.