|
|
|
@ -1,12 +1,16 @@
|
|
|
|
|
#include "pageinstall.h"
|
|
|
|
|
|
|
|
|
|
#include <QtDebug>
|
|
|
|
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QTextEdit>
|
|
|
|
|
#include <QProgressBar>
|
|
|
|
|
|
|
|
|
|
PageInstall::PageInstall(const QString& title) :
|
|
|
|
|
InstallerPage(title)
|
|
|
|
|
PageInstall::PageInstall(const QString& title, InstallerSettings* settings) :
|
|
|
|
|
InstallerPage(title),
|
|
|
|
|
m_Settings(settings),
|
|
|
|
|
m_clProc(0)
|
|
|
|
|
{
|
|
|
|
|
//QLabel* label = new QLabel( tr("") )
|
|
|
|
|
|
|
|
|
@ -24,8 +28,32 @@ PageInstall::PageInstall(const QString& title) :
|
|
|
|
|
|
|
|
|
|
void PageInstall::show()
|
|
|
|
|
{
|
|
|
|
|
// emit changeNext(false);
|
|
|
|
|
// emit changePrev(false);
|
|
|
|
|
emit changeNext(false);
|
|
|
|
|
emit changePrev(false);
|
|
|
|
|
|
|
|
|
|
qDebug() << "install show()";
|
|
|
|
|
|
|
|
|
|
emit changeNext(false);
|
|
|
|
|
emit changePrev(false);
|
|
|
|
|
|
|
|
|
|
if ( !m_clProc )
|
|
|
|
|
{
|
|
|
|
|
m_clProc = new QProcess(this);
|
|
|
|
|
|
|
|
|
|
connect( m_clProc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)) );
|
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardOutput()), this, SLOT(showStdOut()) );
|
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardError()), this, SLOT(showStdErr()) );
|
|
|
|
|
connect( m_clProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(onFinish(int,QProcess::ExitStatus)) );
|
|
|
|
|
|
|
|
|
|
QStringList args;
|
|
|
|
|
args << QString("--disk=%1").arg(m_Settings->disk);
|
|
|
|
|
args << QString("--set-hostname=%1").arg(m_Settings->host);
|
|
|
|
|
args << QString("--set-format=%1").arg(m_Settings->fs);
|
|
|
|
|
args << QString("--set-lang=%1").arg(m_Settings->language);
|
|
|
|
|
args << QString("--set-timezone=%1").arg(m_Settings->timezone);
|
|
|
|
|
|
|
|
|
|
m_clProc->start("calculate");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PageInstall::validate()
|
|
|
|
@ -33,3 +61,36 @@ bool PageInstall::validate()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageInstall::onError(QProcess::ProcessError error)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "failed to run process 'calculate' error=" << error ;
|
|
|
|
|
onFinish(-error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageInstall::showStdOut()
|
|
|
|
|
{
|
|
|
|
|
// debug
|
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
|
qDebug() << "cl out: " << str;
|
|
|
|
|
if (m_clProc)
|
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageInstall::showStdErr()
|
|
|
|
|
{
|
|
|
|
|
if (m_clProc)
|
|
|
|
|
qDebug() << tr("Process Error: ") << m_clProc->readAllStandardError();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "install onFinish()";
|
|
|
|
|
|
|
|
|
|
emit changeNext(true);
|
|
|
|
|
emit changePrev(true);
|
|
|
|
|
|
|
|
|
|
delete m_clProc;
|
|
|
|
|
m_clProc = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|