Ignore:
Timestamp:
05/22/13 08:20:32 (2 years ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, enter/10, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
c53b8ce
Parents:
48a6f8f
Message:

Add new UI code to walk the user through saving their installation config file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-installgui/installer.cpp

    r850f9fa r0de7e02  
    33#include <QTimer> 
    44#include <QTranslator> 
     5#include <QInputDialog> 
    56#include <QGraphicsPixmapItem> 
    67 
     
    2324    connect(pushChangeKeyLayout, SIGNAL(clicked()), this, SLOT(slotPushKeyLayout())); 
    2425    connect(pushHardware, SIGNAL(clicked()), this, SLOT(slotCheckHardware())); 
     26    connect(pushLoadConfig, SIGNAL(clicked()), this, SLOT(slotLoadConfigUSB())); 
     27    connect(pushSaveConfig, SIGNAL(clicked()), this, SLOT(slotSaveConfigUSB())); 
     28    connect(pushSaveConfig2, SIGNAL(clicked()), this, SLOT(slotSaveConfigUSB())); 
    2529 
    2630    abortButton->setText(tr("&Cancel")); 
     
    16971701  return; 
    16981702} 
     1703 
     1704void Installer::slotSaveConfigUSB() 
     1705{ 
     1706  int ret = QMessageBox::question(this, tr("PC-BSD Installer"), 
     1707           tr("This will save your installation configuration to a MSDOSFS/FAT32 formatted USB stick. Continue?"), 
     1708           QMessageBox::No | QMessageBox::Yes, 
     1709           QMessageBox::No); 
     1710  switch (ret) { 
     1711  case QMessageBox::Yes: 
     1712      break; 
     1713  case QMessageBox::No: // :) 
     1714      return; 
     1715      break; 
     1716  } 
     1717 
     1718  // Prompt to insert USB stick 
     1719  QMessageBox::information(this, tr("PC-BSD Installer"), 
     1720          tr("Please insert a USB stick now, and click OK to continue."), 
     1721          QMessageBox::Ok, 
     1722          QMessageBox::Ok); 
     1723 
     1724  // While USB is settling, this is a good time to ask for the config nickname 
     1725  bool ok; 
     1726  QString cfgName = QInputDialog::getText(this, tr("PC-BSD Installer"), 
     1727                 tr("Please enter the nickname you want to save this configuration as."),  
     1728                 QLineEdit::Normal, 
     1729                 QString("default"), &ok); 
     1730  if (!ok || cfgName.isEmpty()) 
     1731     return; 
     1732 
     1733  // Now lets try to save the media 
     1734  qDebug() << "Running: /root/save-to-usb.sh" << cfgName; 
     1735  QProcess m; 
     1736  m.start(QString("/root/save-to-usb.sh"), QStringList() << cfgName); 
     1737  while(m.state() == QProcess::Starting || m.state() == QProcess::Running) { 
     1738     m.waitForFinished(200); 
     1739     QCoreApplication::processEvents(); 
     1740  } 
     1741 
     1742  if ( m.exitCode() != 0 ) { 
     1743     QMessageBox::critical(this, tr("PC-BSD Installer"), 
     1744          tr("Failed saving config to USB media. Is the device working and formatted MSDOSFS/FAT32?"), 
     1745          QMessageBox::Ok, 
     1746          QMessageBox::Ok); 
     1747 
     1748  } else { 
     1749     QMessageBox::information(this, tr("PC-BSD Installer"), 
     1750          tr("Configuration saved! You may now safely remove the USB media."), 
     1751          QMessageBox::Ok, 
     1752          QMessageBox::Ok); 
     1753  } 
     1754   
     1755} 
     1756 
     1757void Installer::slotLoadConfigUSB() 
     1758{ 
     1759 
     1760} 
Note: See TracChangeset for help on using the changeset viewer.