You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
3.8 KiB
149 lines
3.8 KiB
#include "systeminstaller.h"
|
|
|
|
#include <QtGui>
|
|
#include <QStackedWidget>
|
|
#include <QPushButton>
|
|
#include <QGroupBox>
|
|
|
|
#include "pagemanager.h"
|
|
|
|
#include "pagelanguage.h"
|
|
#include "pagelicense.h"
|
|
#include "pagepartitioning.h"
|
|
#include "pageconfiguration.h"
|
|
#include "pageinstall.h"
|
|
#include "pagefinish.h"
|
|
|
|
#include "pagecfdisk.h"
|
|
|
|
SystemInstaller::SystemInstaller(QWidget *parent) :
|
|
QMainWindow(parent)
|
|
{
|
|
// need for QMainWindow
|
|
QWidget* centralWidget = new QWidget(this);
|
|
|
|
// buttons
|
|
QHBoxLayout* hbox_buttons = new QHBoxLayout;
|
|
|
|
m_butPrev = new QPushButton( tr("Prevoius") );
|
|
m_butNext = new QPushButton( tr("Next") );
|
|
|
|
hbox_buttons->addStretch();
|
|
hbox_buttons->addWidget( m_butPrev );
|
|
hbox_buttons->addWidget( m_butNext );
|
|
|
|
// right pannel = widget for pages + buttons
|
|
QStackedWidget* stackPages = new QStackedWidget;
|
|
|
|
QVBoxLayout* vbox_1 = new QVBoxLayout;
|
|
|
|
QGroupBox* group_box_page = new QGroupBox;
|
|
|
|
QVBoxLayout* group_box_page_l = new QVBoxLayout;
|
|
group_box_page_l->addWidget( stackPages );
|
|
|
|
group_box_page->setLayout( group_box_page_l );
|
|
|
|
vbox_1->addWidget( group_box_page );
|
|
vbox_1->addLayout( hbox_buttons );
|
|
|
|
// left pannel
|
|
QLabel* labelPages = new QLabel;
|
|
QGroupBox* group_box_list = new QGroupBox;
|
|
|
|
QVBoxLayout* group_box_list_l = new QVBoxLayout;
|
|
group_box_list_l->addWidget( labelPages );
|
|
|
|
group_box_list->setLayout( group_box_list_l );
|
|
|
|
// left + right pannels
|
|
QHBoxLayout* hbox_2 = new QHBoxLayout;
|
|
|
|
hbox_2->addWidget( group_box_list, 2 );
|
|
hbox_2->addLayout( vbox_1, 8 );
|
|
|
|
// all window
|
|
QVBoxLayout* vbox_2 = new QVBoxLayout(centralWidget);
|
|
|
|
m_labelImage = new QLabel("");
|
|
m_labelImage->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
|
|
|
// logo
|
|
QImage logo( ":/img/calculate-logo.png" );
|
|
m_labelImage->setPixmap( QPixmap::fromImage(logo) );
|
|
|
|
vbox_2->addWidget( m_labelImage );
|
|
vbox_2->addLayout( hbox_2 );
|
|
|
|
setCentralWidget( centralWidget );
|
|
|
|
// minimum size for window
|
|
setMinimumSize(640, 480);
|
|
QRect scr = QApplication::desktop()->screenGeometry();
|
|
move( scr.width() - scr.width()/2 - 640/2, scr.height() - scr.height()/2 - 480/2 );
|
|
|
|
// create PageManager and pages
|
|
m_PageManager = new PageManager(stackPages, labelPages, this);
|
|
|
|
PageLanguage* pageLanguage = new PageLanguage( tr("Language") );
|
|
connect( pageLanguage, SIGNAL(changeLanguage(int)), this, SLOT(changedLanguage(int)) );
|
|
|
|
m_PageManager->addPage(pageLanguage);
|
|
|
|
PageLicense* pageLicense = new PageLicense( tr("License") );
|
|
connect( pageLicense, SIGNAL(changeNext(bool)), this, SLOT(changedNext(bool)) );
|
|
m_PageManager->addPage(pageLicense);
|
|
|
|
PagePartitioning* pagePartitoning = new PagePartitioning( tr("Partitioning") );
|
|
connect(pagePartitoning, SIGNAL(manualyPartitioning()), this, SLOT(doPartitioning()));
|
|
m_PageManager->addPage(pagePartitoning);
|
|
|
|
PageConfiguration* pageConfiguration = new PageConfiguration( tr("Configuring") );
|
|
m_PageManager->addPage(pageConfiguration);
|
|
|
|
PageInstall* pageInstall = new PageInstall( tr("Installing") );
|
|
m_PageManager->addPage(pageInstall);
|
|
|
|
PageFinish* pageFinish = new PageFinish( tr("Complete") );
|
|
m_PageManager->addPage(pageFinish);
|
|
|
|
m_PageManager->showFirst();
|
|
|
|
connect( m_butNext, SIGNAL(clicked()), m_PageManager, SLOT(showNext()) );
|
|
connect( m_butPrev, SIGNAL(clicked()), m_PageManager, SLOT(showPrevious()) );
|
|
}
|
|
|
|
SystemInstaller::~SystemInstaller()
|
|
{
|
|
delete m_PageManager;
|
|
}
|
|
|
|
|
|
void SystemInstaller::changedNext(bool state)
|
|
{
|
|
m_butNext->setEnabled(state);
|
|
}
|
|
|
|
void SystemInstaller::changedPrev(bool state)
|
|
{
|
|
m_butPrev->setEnabled(state);
|
|
}
|
|
|
|
void SystemInstaller::changedLanguage(int lang)
|
|
{
|
|
Q_UNUSED(lang);
|
|
}
|
|
|
|
void SystemInstaller::doPartitioning()
|
|
{
|
|
m_PageCfdisk = new PageCfdisk("Partitioning");
|
|
m_PageManager->showOnce(m_PageCfdisk);
|
|
connect( m_PageCfdisk, SIGNAL(completed()), this, SLOT(completePartitioning()) );
|
|
}
|
|
|
|
void SystemInstaller::completePartitioning()
|
|
{
|
|
delete m_PageCfdisk;
|
|
m_PageManager->showPrevious();
|
|
}
|