#include #include #include #include #include #include "settings.h" #include "installsettings.h" #include "installdialog.h" #include "installationtype.h" #include #include #include #include #include "mv_common.h" int mythinstalltype (QString tmp_install_drive) { Mythinstalltype setting; setting.load(); setting.save(); //setting.exec(); int retc = 1 ; if ( setting.exec() == QDialog::Accepted ) { retc = 0; } return retc; }; static HostComboBox *HOSTinstallationtype() { HostComboBox *gc = new HostComboBox("HOSTinstallationtype"); gc->setLabel(QObject::tr("Upgrade or Full install")); gc->addSelection("Full/Auto") ; gc->addSelection("Upgrade"); gc->setHelpText(QObject::tr("A full install will erase the entire drive and repartition. An upgrade will only format or overlay the first parition of the drive.")); return gc; } static HostSpinBox *HOSTOSsize() { #ifdef __MVAPP__ HostSpinBox *gc = new HostSpinBox("HOSTOSsize", 2, 15, 1, true); #else HostSpinBox *gc = new HostSpinBox("HOSTOSsize", 3, 25, 1, true); #endif gc->setLabel(QObject::tr("OS size (GB)")); gc->setValue(2); gc->setHelpText(QObject::tr("" )); return gc; } static HostSpinBox *HOSTDATAsize() { HostSpinBox *gc = new HostSpinBox("HOSTDATAsize", 2, 1500, 1, true); gc->setLabel(QObject::tr("Data size (GB)")); gc->setValue(2); gc->setHelpText(QObject::tr("" )); return gc; } static HostSpinBox *HOSTSWAPsize() { QString currentitem; QString line; QFile file("/proc/meminfo"); if ( file.open(IO_ReadOnly | IO_Translate) ) { QTextStream t( &file ); // use a text stream line = t.readLine(); if ( line.startsWith("MemTotal:")) { currentitem = line.simplifyWhiteSpace(); currentitem = currentitem.section( " ", 1, 1 ); } } file.close(); bool ok; int mem = currentitem.toInt( &ok, 10 ); // dec == 0, ok == FALSE mem = mem/1024 ; if ( ! ok ) mem = 120 ; HostSpinBox *gc = new HostSpinBox("HOSTSWAPsize", 128, 128000, 128, true); gc->setLabel(QObject::tr("Swapspace size (MB)")); gc->setValue(mem); gc->setHelpText(QObject::tr("" )); return gc; } static HostCheckBox *HostUseSWAP() { HostCheckBox *gc = new HostCheckBox("HostUseSWAP"); gc->setLabel(QObject::tr("Use swap partition")); gc->setValue(true); gc->setHelpText(QObject::tr("Enable or disable the swap partition.")); return gc; }; static HostCheckBox *HostUseALLdata() { HostCheckBox *gc = new HostCheckBox("HostUseALLdata"); gc->setLabel(QObject::tr("Use all remaining space for data")); gc->setValue(true); gc->setHelpText(QObject::tr("If checked myth will use the rest of the drive for the data. Otherwise you will be able to set the size of the partition.")); return gc; }; static HostComboBox *HOSTdatafstype() { HostComboBox *gc = new HostComboBox("HOSTdatafstype"); gc->setLabel(QObject::tr("Data filesystem")); gc->addSelection("ext3") ; gc->addSelection("ext4") ; gc->addSelection("reiserfs"); gc->addSelection("jfs"); gc->addSelection("xfs"); gc->setHelpText(QObject::tr("Filesystem for data. ")); return gc; } static HostComboBox *HOSTuprootfstype() { HostComboBox *gc = new HostComboBox("HOSTuprootfstype"); gc->setLabel(QObject::tr("OS file system")); gc->addSelection("ext3") ; gc->addSelection("ext4") ; gc->addSelection("reiserfs"); gc->addSelection("jfs"); //gc->addSelection("xfs"); gc->addSelection("Do_not_format"); gc->setHelpText(QObject::tr("Filesystem for OS. ")); return gc; } static HostComboBox *HOSTrootfstype() { HostComboBox *gc = new HostComboBox("HOSTrootfstype"); gc->setLabel(QObject::tr("Root filesystem format")); gc->addSelection("ext3") ; gc->addSelection("ext4") ; gc->addSelection("reiserfs"); gc->addSelection("jfs"); //gc->addSelection("xfs"); gc->setHelpText(QObject::tr("Filesystem for OS. ")); return gc; } class USESwap: public TriggeredConfigurationGroup { public: USESwap(): //ConfigurationGroup(false, true, false, false), //VerticalConfigurationGroup(false, true, false, false), TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { //setLabel(QObject::tr("" )); // setUseLabel(false); Setting* useswap = HostUseSWAP(); addChild(useswap); setTrigger(useswap); ConfigurationGroup* swapyes = new VerticalConfigurationGroup(false); swapyes->addChild(HOSTSWAPsize()); addTarget("1", swapyes ); addTarget("0", new VerticalConfigurationGroup(true)); }; }; class DATAsize: public TriggeredConfigurationGroup { public: DATAsize(): //ConfigurationGroup(false, true, false, false), //VerticalConfigurationGroup(false, true, false, false), TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { //setLabel(QObject::tr("" )); // setUseLabel(false); Setting* datasize = HostUseALLdata(); addChild(datasize); setTrigger(datasize); ConfigurationGroup* alldatano = new VerticalConfigurationGroup(false); alldatano->addChild(HOSTDATAsize()); alldatano->addChild(HOSTdatafstype()); ConfigurationGroup* alldatayes = new VerticalConfigurationGroup(false); alldatayes->addChild(HOSTdatafstype()); addTarget("1", alldatayes); addTarget("0", alldatano); }; }; class Installationtype: public TriggeredConfigurationGroup { public: Installationtype(): //ConfigurationGroup(false, true, false, false), //VerticalConfigurationGroup(false, true, false, false), TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { // setLabel(QObject::tr("Upgrade or Full install" )); // setUseLabel(false); Setting* Mtemplate = HOSTinstallationtype(); addChild(Mtemplate); setTrigger(Mtemplate); ConfigurationGroup* tupgrade = new VerticalConfigurationGroup(false); tupgrade->addChild(HOSTuprootfstype()); ConfigurationGroup* tfull = new VerticalConfigurationGroup(false); tfull->addChild(HOSTOSsize()); tfull->addChild(HOSTrootfstype()); tfull->addChild(new USESwap); tfull->addChild(new DATAsize); addTarget("Upgrade",tupgrade ); addTarget("Full/Auto", tfull); }; }; Mythinstalltype::Mythinstalltype() { //Reseting the install type to remove "NET" if ( gContext->GetSetting("Hostinstallationtype") == "NET") gContext ->SaveSetting("HOSTinstallationtype","Full/Auto"); Installationtype *installationtype = new Installationtype(); addChild(installationtype); }