Fixed PageMountpoints GUI.

Fixed PageConfiguration.
new_installer
Ivan Loskutov 14 years ago
parent a9e944761f
commit 81321038d2

@ -25,6 +25,8 @@ CalculateConfig* CalculateConfig::instance()
bool CalculateConfig::getDefaultConfig() bool CalculateConfig::getDefaultConfig()
{ {
m_Config.clear();
// start cl-install -v and parse out // start cl-install -v and parse out
QProcess cl_install; QProcess cl_install;
@ -55,6 +57,11 @@ bool CalculateConfig::getDefaultConfig()
} }
} }
// installer settings
// gui_partitioning - install type: auto, manual
m_Config["gui_install_language"] = m_Config["os_locale_lang"];
m_Config["gui_os_device_dev"] = m_Config["os_device_dev"].toStringList().at(0);
return true; return true;
} }

@ -6,9 +6,12 @@
#include <QLineEdit> #include <QLineEdit>
#include <QCheckBox> #include <QCheckBox>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QDebug> #include <QDebug>
#include "calculateconfig.h"
PageConfiguration::PageConfiguration() : PageConfiguration::PageConfiguration() :
InstallerPage() InstallerPage()
{ {
@ -142,28 +145,34 @@ void PageConfiguration::setupUi()
setLayout( vbox_pageconf ); setLayout( vbox_pageconf );
retranslateUi(); retranslateUi();
mapSignals();
} }
void PageConfiguration::mapSignals() void PageConfiguration::mapSignals()
{ {
/* connect(m_editHostName, SIGNAL(textChanged(QString)), this, SLOT(storeData()));
connect(m_chkboxBuilder, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); connect(m_editDomainName, SIGNAL(textChanged(QString)), this, SLOT(storeData()));
connect(m_editHostname, SIGNAL(textChanged(QString)), this, SLOT(generateCommand())); connect(m_cmbboxLanguage, SIGNAL(currentIndexChanged(int)), this, SLOT(storeData()));
connect(m_cmbboxLanguage, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand())); connect(m_cmbboxTimezone, SIGNAL(currentIndexChanged(int)), this, SLOT(storeData()));
connect(m_cmbboxTimezone, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand())); connect(m_cmbboxMbrDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(storeData()));
connect(m_chkboxErase, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); connect(m_cmbboxVideoDrv, SIGNAL(currentIndexChanged(int)), this, SLOT(storeData()));
connect(m_cmbboxFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand())); connect(m_chkboxComposite, SIGNAL(toggled(bool)), this, SLOT(storeData()));
connect(m_chkboxWriteMbr, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); connect(m_editMakeOpts, SIGNAL(textChanged(QString)), this, SLOT(storeData()));
connect(m_chkboxUseUUID, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); connect(m_editProxy, SIGNAL(textChanged(QString)), this, SLOT(storeData()));
connect(m_cmbboxDiskType, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand())); connect(m_editNtp, SIGNAL(textChanged(QString)), this, SLOT(storeData()));
connect(m_cmbboxVideoDrv, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand())); connect(m_cmbboxClockType, SIGNAL(currentIndexChanged(int)), this, SLOT(storeData()));
connect(m_editVideoRes, SIGNAL(textChanged(QString)), this, SLOT(generateCommand())); connect(m_chkboxExtParameters, SIGNAL(toggled(bool)), this, SLOT(storeData()));
connect(m_chkboxComposite, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); }
connect(m_cmbboxIOShed, SIGNAL(currentIndexChanged(int)), this, SLOT(generateCommand()));
connect(m_chkboxExtParameters, SIGNAL(toggled(bool)), this, SLOT(generateCommand())); void PageConfiguration::unmapSignals()
*/ {
disconnect(m_editHostName);
disconnect(m_editDomainName);
disconnect(m_cmbboxLanguage);
disconnect(m_cmbboxTimezone);
disconnect(m_cmbboxMbrDevice);
disconnect(m_cmbboxVideoDrv);
disconnect(m_chkboxComposite);
disconnect(m_editMakeOpts);
} }
void PageConfiguration::retranslateUi() void PageConfiguration::retranslateUi()
@ -172,12 +181,9 @@ void PageConfiguration::retranslateUi()
m_labelSelectParams->setText( tr("Select parameters: ") ); m_labelSelectParams->setText( tr("Select parameters: ") );
m_labelHostName->setText( tr("Hostname: ") ); m_labelHostName->setText( tr("Hostname: ") );
m_editHostName->setText( "calculate" );
m_labelDomainName->setText( tr("Domain: ") ); m_labelDomainName->setText( tr("Domain: ") );
m_editDomainName->setText( "" );
m_labelLanguage->setText( tr("Language:") ); m_labelLanguage->setText( tr("Language:") );
m_cmbboxLanguage->clear(); m_cmbboxLanguage->clear();
@ -191,12 +197,125 @@ void PageConfiguration::retranslateUi()
m_cmbboxLanguage->addItem( tr("Russian"), QVariant("ru_RU") ); m_cmbboxLanguage->addItem( tr("Russian"), QVariant("ru_RU") );
m_cmbboxLanguage->addItem( tr("English"), QVariant("uk_UA") ); m_cmbboxLanguage->addItem( tr("English"), QVariant("uk_UA") );
// TODO:
//int lang_index = m_cmbboxLanguage->findData(QVariant(*m_Lang));
//if (lang_index >= 0)
// m_cmbboxLanguage->setCurrentIndex( lang_index );
m_labelTimezone->setText( tr("Timezone:") ); m_labelTimezone->setText( tr("Timezone:") );
setupTimezones();
m_labelMbrDevice->setText( tr("Device for install Grub:") );
m_cmbboxMbrDevice->clear();
m_cmbboxMbrDevice->addItems( CalculateConfig::instance()->getValue("os_device_dev").toStringList() );
m_labelVideoDrv->setText( tr("Video driver:") );
m_cmbboxVideoDrv->clear();
m_cmbboxVideoDrv->addItem("fglrx");
m_cmbboxVideoDrv->addItem("intel");
m_cmbboxVideoDrv->addItem("nv");
m_cmbboxVideoDrv->addItem("nvidia");
m_cmbboxVideoDrv->addItem("radeon");
m_cmbboxVideoDrv->addItem("vesa");
m_cmbboxVideoDrv->addItem("vmware");
m_labelComposite->setText( tr("Use desktop effects") );
m_chkboxExtParameters->setText( tr("Expert settings") );
m_labelMakeOpts->setText( tr("Make options (MAKEOPTS):") );
m_labelProxy->setText( tr("Proxy server:") );
m_labelNtp->setText( tr("NTP server:") );
m_labelClockType->setText( tr("Clock type:") );
m_cmbboxClockType->clear();
m_cmbboxClockType->addItem( tr("Local") );
m_cmbboxClockType->addItem( tr("UTC") );
}
bool PageConfiguration::validate()
{
// check parameters
if ( m_editHostName->text().isEmpty() )
{
QMessageBox::warning(this, tr("Warning"), tr("Hostname is empty.") );
return false;
}
unmapSignals();
return true;
}
void PageConfiguration::show()
{
CalculateConfig* clConf = CalculateConfig::instance();
m_editHostName->setText( clConf->getValue("os_install_net_hostname").toString() );
m_editDomainName->setText( clConf->getValue("os_install_net_domain").toString() );
//qDebug() << "cfg language: " << clConf->getValue("gui_install_language");
int langIndex = m_cmbboxLanguage->findData( clConf->getValue("gui_install_language") );
if (langIndex >= 0)
m_cmbboxLanguage->setCurrentIndex( langIndex );
//qDebug() << "cfg timezone: " << clConf->getValue("os_install_clock_timezone");
int timezoneIndex = m_cmbboxTimezone->findText(
clConf->getValue("os_install_clock_timezone").toString()
);
if (timezoneIndex >= 0)
m_cmbboxTimezone->setCurrentIndex( timezoneIndex );
int bootdevIndex = m_cmbboxMbrDevice->findText(
clConf->getValue("gui_os_device_dev").toString()
);
if (bootdevIndex >= 0)
m_cmbboxMbrDevice->setCurrentIndex( bootdevIndex );
int videodrvIndex = m_cmbboxVideoDrv->findText(
clConf->getValue("os_install_x11_video_drv").toString()
);
if (videodrvIndex >= 0)
m_cmbboxVideoDrv->setCurrentIndex( videodrvIndex );
m_chkboxComposite->setChecked(
clConf->getValue("os_install_x11_composite").toString() == "on"
);
m_editMakeOpts->setText( clConf->getValue("os_install_makeopts").toString() );
m_editProxy->setText( clConf->getValue("os_install_proxy").toString() );
m_editNtp->setText( clConf->getValue("os_install_ntp").toString() );
int clocktypeIndex = m_cmbboxClockType->findText(
clConf->getValue("os_install_clock_type").toString()
);
if (clocktypeIndex >= 0)
m_cmbboxClockType->setCurrentIndex( clocktypeIndex );
mapSignals();
}
void PageConfiguration::storeData()
{
CalculateConfig* clConf = CalculateConfig::instance();
clConf->setValue("os_install_net_hostname", m_editHostName->text() );
clConf->setValue("os_install_net_domain", m_editDomainName->text() );
//qDebug() << "store cfg gui_install_language" << m_cmbboxLanguage->itemData( m_cmbboxLanguage->currentIndex() ) ;
clConf->setValue("gui_install_language", m_cmbboxLanguage->itemData( m_cmbboxLanguage->currentIndex() ) );
clConf->setValue("os_install_clock_timezone", m_cmbboxTimezone->currentText() );
clConf->setValue("gui_os_device_dev", m_cmbboxMbrDevice->currentText() );
clConf->setValue("os_install_x11_video_drv", m_cmbboxVideoDrv->currentText() );
clConf->setValue("os_install_x11_composite", m_chkboxComposite->isChecked() ? "on" : "off" );
clConf->setValue("os_install_makeopts", m_editMakeOpts->text() );
clConf->setValue("os_install_proxy", m_editProxy->text() );
clConf->setValue("os_install_ntp", m_editNtp->text() );
clConf->setValue("os_install_clock_type", m_cmbboxClockType->currentText() );
}
void PageConfiguration::setupTimezones()
{
m_cmbboxTimezone->clear(); m_cmbboxTimezone->clear();
m_cmbboxTimezone->addItem( "Africa/Abidjan" ); m_cmbboxTimezone->addItem( "Africa/Abidjan" );
m_cmbboxTimezone->addItem( "Africa/Accra" ); m_cmbboxTimezone->addItem( "Africa/Accra" );
@ -770,101 +889,4 @@ void PageConfiguration::retranslateUi()
m_cmbboxTimezone->addItem( "WET" ); m_cmbboxTimezone->addItem( "WET" );
m_cmbboxTimezone->addItem( "W-SU" ); m_cmbboxTimezone->addItem( "W-SU" );
m_cmbboxTimezone->addItem( "Zulu" ); m_cmbboxTimezone->addItem( "Zulu" );
m_labelMbrDevice->setText( tr("Device for install Grub:") );
m_labelVideoDrv->setText( tr("Video driver:") );
m_cmbboxVideoDrv->clear();
m_cmbboxVideoDrv->addItem("fglrx");
m_cmbboxVideoDrv->addItem("intel");
m_cmbboxVideoDrv->addItem("nv");
m_cmbboxVideoDrv->addItem("nvidia");
m_cmbboxVideoDrv->addItem("radeon");
m_cmbboxVideoDrv->addItem("vesa");
m_cmbboxVideoDrv->addItem("vmware");
m_labelComposite->setText( tr("Use desktop effects") );
m_chkboxExtParameters->setText( tr("Expert settings") );
m_labelMakeOpts->setText( tr("Make options (MAKEOPTS):") );
m_editMakeOpts->setText("-j3");
m_labelProxy->setText( tr("Proxy server:") );
m_labelNtp->setText( tr("NTP server:") );
m_editNtp->setText( "ntp0.zenon.net" );
m_labelClockType->setText( tr("Clock type:") );
m_cmbboxClockType->clear();
m_cmbboxClockType->addItem( tr("Local") );
m_cmbboxClockType->addItem( tr("UTC") );
}
bool PageConfiguration::validate()
{
/*
if ( !m_editHostname->text().isEmpty() )
{
InstallerSettings settings;
settings.builder = m_chkboxBuilder->isChecked();
settings.host = m_editHostname->text();
settings.language = m_cmbboxLanguage->itemData( m_cmbboxLanguage->currentIndex() ).toString();
settings.timezone = m_cmbboxTimezone->currentText();
settings.erase = m_chkboxErase->isChecked();
settings.fs = m_cmbboxFormat->currentText();
settings.mbr = m_chkboxWriteMbr->isChecked();
settings.uuid = m_chkboxUseUUID->isChecked();
settings.disktype = m_cmbboxDiskType->currentText();
settings.videodrv = m_cmbboxVideoDrv->currentText();
emit selectedSettings(settings);
return true;
} else {
return false;
}
*/
return true;
}
/*
void PageConfiguration::generateCommand()
{
if (!m_Active)
return;
QString cmd = "calculate ";
cmd += QString("--disk=%1 ").arg( *m_Disk );
cmd += QString("--set-hostname=%1 ").arg( m_editHostname->text() );
cmd += QString("--set-lang=%1 ").arg( m_cmbboxLanguage->itemData(m_cmbboxLanguage->currentIndex()).toString() );
cmd += QString("--set-timezone=%1 ").arg( m_cmbboxTimezone->currentText() );
cmd += QString("--set-format=%1 ").arg( m_cmbboxFormat->currentText() );
cmd += m_chkboxErase->isChecked() ? "--set-erase=yes " : "";
cmd += m_chkboxComposite->isChecked() ? "--set-composite=yes " : "";
if (m_chkboxExtParameters->isChecked())
{
cmd += m_chkboxBuilder->isChecked() ? "--build " : "";
cmd += m_chkboxWriteMbr->isChecked() ? "--set-mbr=yes " : "";
cmd += m_chkboxUseUUID->isChecked() ? "--set-uuid=yes " : "";
cmd += QString("--set-type=%1 ").arg( m_cmbboxDiskType->currentText() );
cmd += QString("--set-video_drv=%1 ").arg( m_cmbboxVideoDrv->currentText() );
cmd += QString("--set-video_resolution=%1 ").arg( m_editVideoRes->text() );
cmd += QString("--set-scheduler=%1 ").arg( m_cmbboxIOShed->currentText() );
}
emit updatedCommand(cmd);
}
*/
void PageConfiguration::show()
{
//generateCommand();
} }

@ -22,12 +22,15 @@ protected:
private: private:
void mapSignals(); void mapSignals();
void unmapSignals();
void setupTimezones();
public slots: public slots:
void show(); void show();
private slots: private slots:
//void generateCommand(); void storeData();
signals: signals:
//void selectedSettings(InstallerSettings); //void selectedSettings(InstallerSettings);
@ -63,13 +66,6 @@ private:
QCheckBox* m_chkboxExtParameters; QCheckBox* m_chkboxExtParameters;
QWidget* m_widgetExtParameters; QWidget* m_widgetExtParameters;
// QLabel* m_labelUseUUID; // ???
// QCheckBox* m_chkboxUseUUID;
/* ???
QLabel* m_labelDiskType;
QComboBox* m_cmbboxDiskType;
*/
QLabel* m_labelMakeOpts; QLabel* m_labelMakeOpts;
QLineEdit* m_editMakeOpts; QLineEdit* m_editMakeOpts;

@ -3,6 +3,7 @@
#include <QLabel> #include <QLabel>
#include <QTreeWidget> #include <QTreeWidget>
#include <QLayout> #include <QLayout>
#include <QMessageBox>
#include <QtDebug> #include <QtDebug>
@ -26,6 +27,10 @@ void PageMountPoints::setupUi()
setLayout(vbox_0); setLayout(vbox_0);
connect( m_trwMountPoints, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(partitionDoubleClicked(QTreeWidgetItem*,int))
);
retranslateUi(); retranslateUi();
} }
@ -38,31 +43,55 @@ void PageMountPoints::retranslateUi()
trwHeader->setText(1, tr("Label") ); trwHeader->setText(1, tr("Label") );
trwHeader->setText(2, tr("Size") ); trwHeader->setText(2, tr("Size") );
trwHeader->setText(3, tr("Mount point") ); trwHeader->setText(3, tr("Mount point") );
trwHeader->setText(4, tr("Bind") ); trwHeader->setText(4, tr("File system") );
trwHeader->setText(5, tr("File system") ); trwHeader->setText(5, tr("Format") );
trwHeader->setText(6, tr("Format") );
// TODO: set fix sizes
m_labMountPoints->setText( tr("Select mount points:") ); m_labMountPoints->setText( tr("Select mount points:") );
} }
void PageMountPoints::show() void PageMountPoints::show()
{ {
emit changeNext(false);
// get tree from CalculateConfig // get tree from CalculateConfig
getTree(); getTree();
showTree(); showTree();
m_trwMountPoints->setColumnWidth(0, 120);
m_trwMountPoints->setColumnWidth(1, 100);
m_trwMountPoints->setColumnWidth(2, 80);
m_trwMountPoints->setColumnWidth(3, 110);
m_trwMountPoints->setColumnWidth(4, 80);
m_trwMountPoints->expandAll();
if ( CalculateConfig::instance()->getValue("gui_partitioning") == "auto" ) if ( CalculateConfig::instance()->getValue("gui_partitioning") == "auto" )
{ {
qDebug() << "Skip Mount points"; qDebug() << "Skip Mount points";
QMessageBox::information(
this,
tr("Information"),
tr("You select auto partitioning. Press \"Next\" to continue.")
);
m_trwMountPoints->setEnabled(false); m_trwMountPoints->setEnabled(false);
emit changeNext(true); emit changeNext(true);
} }
} }
bool PageMountPoints::validate()
{
if ( CalculateConfig::instance()->getValue("gui_partitioning") != "auto" )
{
// check parameters
}
return true;
}
void PageMountPoints::partitionDoubleClicked ( QTreeWidgetItem* item, int index )
{
qDebug() << "selected :" << item->text(0);
}
void PageMountPoints::getTree() void PageMountPoints::getTree()
{ {
QStringList os_disk_dev = CalculateConfig::instance()->getValue("os_disk_dev").toStringList(); QStringList os_disk_dev = CalculateConfig::instance()->getValue("os_disk_dev").toStringList();
@ -73,6 +102,7 @@ void PageMountPoints::getTree()
QStringList os_dev_dev = CalculateConfig::instance()->getValue("os_device_dev").toStringList(); QStringList os_dev_dev = CalculateConfig::instance()->getValue("os_device_dev").toStringList();
// TODO
// if ( !( os_disk_dev.size() == os_disk_format.size() == os_disk_name.size() == os_disk_part.size() == // if ( !( os_disk_dev.size() == os_disk_format.size() == os_disk_name.size() == os_disk_part.size() ==
// os_disk_size.size() ) // os_disk_size.size() )
// ) // )
@ -111,7 +141,6 @@ void PageMountPoints::getTree()
} }
} }
} }
} }
void PageMountPoints::showTree() void PageMountPoints::showTree()
@ -136,7 +165,7 @@ void PageMountPoints::showBranch(const QString& dev, const MountPointsList& list
trwItem_0->setText(3, "" ); trwItem_0->setText(3, "" );
trwItem_0->setText(4, "" ); trwItem_0->setText(4, "" );
trwItem_0->setText(5, "" ); trwItem_0->setText(5, "" );
trwItem_0->setText(6, "" ); // trwItem_0->setText(6, "" );
foreach(const MountPoint& mp, list) foreach(const MountPoint& mp, list)
{ {
@ -146,9 +175,9 @@ void PageMountPoints::showBranch(const QString& dev, const MountPointsList& list
trwItem_0_0->setText(2, mp.size ); // Size trwItem_0_0->setText(2, mp.size ); // Size
bool modified = !mp.mountpoint.isEmpty(); bool modified = !mp.mountpoint.isEmpty();
trwItem_0_0->setText(3, mp.mountpoint ); // Mount point trwItem_0_0->setText(3, mp.mountpoint ); // Mount point
trwItem_0_0->setText(4, modified ? (mp.bind ? tr("YES") : tr("no")) : "" ); // Bind // trwItem_0_0->setText(4, modified ? (mp.bind ? tr("YES") : tr("no")) : "" ); // Bind
trwItem_0_0->setText(5, modified ? mp.fs_new : mp.fs ); // File system trwItem_0_0->setText(4, modified ? mp.fs_new : mp.fs ); // File system
trwItem_0_0->setText(6, modified ? (mp.format ? tr("YES") : tr("no")) : "" ); // Format trwItem_0_0->setText(5, modified ? (mp.format ? tr("YES") : tr("no")) : "" ); // Format
} }
m_trwMountPoints->insertTopLevelItem(m_trwMountPoints->topLevelItemCount(), trwItem_0); m_trwMountPoints->insertTopLevelItem(m_trwMountPoints->topLevelItemCount(), trwItem_0);

@ -15,27 +15,33 @@ struct MountPoint {
QString fs; QString fs;
// from gui to installer // from gui to installer
QString mountpoint; QString mountpoint;
bool bind; // bool bind;
QString fs_new; QString fs_new;
bool format; bool format;
MountPoint() : bind(false), format(false) {}; MountPoint() : /*bind(false),*/ format(false) {};
}; };
typedef QList<MountPoint> MountPointsList; typedef QList<MountPoint> MountPointsList;
typedef QMap<QString, MountPointsList> MountPointsTree; typedef QMap<QString, MountPointsList> MountPointsTree;
class QTreeWidgetItem;
class PageMountPoints : public InstallerPage class PageMountPoints : public InstallerPage
{ {
Q_OBJECT Q_OBJECT
public: public:
PageMountPoints(); PageMountPoints();
bool validate();
void retranslateUi(); void retranslateUi();
public slots: public slots:
void show(); void show();
private slots:
void partitionDoubleClicked(QTreeWidgetItem* item, int index);
protected: protected:
void setupUi(); void setupUi();

@ -56,6 +56,10 @@ void PageUsers::setupUi()
gbox_0->addWidget(m_labRootPswRep, 1, 0); gbox_0->addWidget(m_labRootPswRep, 1, 0);
gbox_0->addWidget(m_edRootPswRep, 1, 1); gbox_0->addWidget(m_edRootPswRep, 1, 1);
QFrame* hline = new QFrame;
hline->setFrameShape(QFrame::HLine);
hline->setFrameShadow(QFrame::Sunken);
m_labMatch = new QLabel; m_labMatch = new QLabel;
QHBoxLayout* hbox_1 = new QHBoxLayout; QHBoxLayout* hbox_1 = new QHBoxLayout;
hbox_1->addStretch(); hbox_1->addStretch();
@ -84,6 +88,7 @@ void PageUsers::setupUi()
vbox_0->addLayout(hbox_0); vbox_0->addLayout(hbox_0);
vbox_0->addLayout(gbox_0); vbox_0->addLayout(gbox_0);
vbox_0->addLayout(hbox_1); vbox_0->addLayout(hbox_1);
vbox_0->addWidget(hline);
vbox_0->addLayout(hbox_users); vbox_0->addLayout(hbox_users);
vbox_0->addLayout(hbox_but); vbox_0->addLayout(hbox_but);
vbox_0->addWidget(m_lstUsers); vbox_0->addWidget(m_lstUsers);

Loading…
Cancel
Save