|
|
|
@ -24,14 +24,15 @@ void PageInstall::setupUi()
|
|
|
|
|
m_Output->setReadOnly(true);
|
|
|
|
|
QFont font = m_Output->currentFont();
|
|
|
|
|
font.setFamily("Droid Sans Mono");
|
|
|
|
|
font.setPointSize(10);
|
|
|
|
|
m_Output->setFont( font );
|
|
|
|
|
m_Output->setLineWrapMode( QTextEdit::NoWrap );
|
|
|
|
|
|
|
|
|
|
m_LabelEta = new QLabel;
|
|
|
|
|
// m_LabelEta = new QLabel;
|
|
|
|
|
m_Progress = new QProgressBar(0);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* hbox = new QHBoxLayout;
|
|
|
|
|
hbox->addWidget(m_LabelEta);
|
|
|
|
|
// hbox->addWidget(m_LabelEta);
|
|
|
|
|
hbox->addWidget(m_Progress);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout* vbox = new QVBoxLayout;
|
|
|
|
@ -48,7 +49,7 @@ void PageInstall::retranslateUi()
|
|
|
|
|
{
|
|
|
|
|
setTitle( tr("Installing") );
|
|
|
|
|
|
|
|
|
|
m_LabelEta->setText( tr("Eta: unknown") );
|
|
|
|
|
// m_LabelEta->setText( tr("Eta: unknown") );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -65,7 +66,6 @@ void PageInstall::show()
|
|
|
|
|
|
|
|
|
|
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 = CalculateConfig::instance()->getInstallParameters();
|
|
|
|
@ -100,52 +100,19 @@ void PageInstall::showStdOut()
|
|
|
|
|
// debug
|
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
|
|
|
|
|
|
qDebug() << "stdout : " << str.toLocal8Bit().toHex();
|
|
|
|
|
//qDebug() << "stdout : " << str.toLocal8Bit().toHex();
|
|
|
|
|
|
|
|
|
|
QFile debug("/tmp/cl-install-gui_stdout.txt");
|
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered | QIODevice::Text) )
|
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
|
// skip fan (/|\-)
|
|
|
|
|
str.replace("\x08/", "");
|
|
|
|
|
str.replace("\x08\\", "");
|
|
|
|
|
str.replace("\x08-", "");
|
|
|
|
|
str.replace("\x08|", "");
|
|
|
|
|
|
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageInstall::showStdErr()
|
|
|
|
|
{
|
|
|
|
|
QString eta;
|
|
|
|
|
QString progress;
|
|
|
|
|
|
|
|
|
|
if (m_clProc)
|
|
|
|
|
{
|
|
|
|
|
QString str = m_clProc->readAllStandardError();
|
|
|
|
|
|
|
|
|
|
QFile debug("/tmp/cl-install-gui_stderr.txt");
|
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered | QIODevice::Text) )
|
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
|
/*
|
|
|
|
|
if ( str.contains("eta:") )
|
|
|
|
|
{
|
|
|
|
|
QRegExp eta_regexp("\\b(\\d{1,2}:\\d{1,2}:\\d{1,2})\\b");
|
|
|
|
|
QRegExp percent_regexp("\\d{1,2}.%");
|
|
|
|
|
|
|
|
|
|
if ( eta_regexp.indexIn(str) )
|
|
|
|
|
eta = eta_regexp.cap(0);
|
|
|
|
|
|
|
|
|
|
if ( percent_regexp.indexIn(str) )
|
|
|
|
|
progress = percent_regexp.cap(0).replace(QRegExp("[^0-9]"), " ");
|
|
|
|
|
|
|
|
|
|
if ( !eta.isEmpty() )
|
|
|
|
|
m_LabelEta->setText( tr("Eta: %1").arg(eta) );
|
|
|
|
|
|
|
|
|
|
if ( !progress.isEmpty() )
|
|
|
|
|
m_Progress->setValue( progress.toInt() );
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "install onFinish() " << exitCode;
|
|
|
|
@ -165,19 +132,13 @@ void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_Output->insertPlainText("Error: ");
|
|
|
|
|
|
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
|
QString strErr = m_clProc->readAllStandardError();
|
|
|
|
|
|
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
|
m_Output->insertPlainText( strErr );
|
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
|
m_Output->insertPlainText(
|
|
|
|
|
tr("Error. Additional information in /var/log/calculate/cl-install-gui-err.log")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_Progress->setValue(100);
|
|
|
|
|
m_LabelEta->setText( tr("Eta: 0:00:00") );
|
|
|
|
|
// m_LabelEta->setText( tr("Eta: 0:00:00") );
|
|
|
|
|
|
|
|
|
|
delete m_clProc;
|
|
|
|
|
m_clProc = 0;
|
|
|
|
|