|
|
|
@ -39,7 +39,7 @@
|
|
|
|
|
FinishedPage::FinishedPage( QWidget* parent )
|
|
|
|
|
: QWidget( parent )
|
|
|
|
|
, ui( new Ui::FinishedPage )
|
|
|
|
|
, m_restartSetUp( false )
|
|
|
|
|
, m_mode( FinishedViewStep::RestartMode::UserUnchecked )
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi( this );
|
|
|
|
|
|
|
|
|
@ -83,6 +83,8 @@ FinishedPage::setRestart( FinishedViewStep::RestartMode mode )
|
|
|
|
|
{
|
|
|
|
|
using Mode = FinishedViewStep::RestartMode;
|
|
|
|
|
|
|
|
|
|
m_mode = mode;
|
|
|
|
|
|
|
|
|
|
ui->restartCheckBox->setVisible( mode != Mode::Never );
|
|
|
|
|
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
|
|
|
|
ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserChecked ) );
|
|
|
|
@ -100,18 +102,20 @@ void
|
|
|
|
|
FinishedPage::setUpRestart()
|
|
|
|
|
{
|
|
|
|
|
cDebug() << "FinishedPage::setUpRestart(), Quit button"
|
|
|
|
|
<< "setup=" << m_restartSetUp
|
|
|
|
|
<< "setup=" << FinishedViewStep::modeName( m_mode )
|
|
|
|
|
<< "command=" << m_restartNowCommand;
|
|
|
|
|
if ( !m_restartSetUp )
|
|
|
|
|
{
|
|
|
|
|
connect( qApp, &QApplication::aboutToQuit,
|
|
|
|
|
this, [this]
|
|
|
|
|
{
|
|
|
|
|
if ( ui->restartCheckBox->isVisible() &&
|
|
|
|
|
ui->restartCheckBox->isChecked() )
|
|
|
|
|
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect( qApp, &QApplication::aboutToQuit,
|
|
|
|
|
[this]()
|
|
|
|
|
{
|
|
|
|
|
if ( ui->restartCheckBox->isVisible() &&
|
|
|
|
|
ui->restartCheckBox->isChecked() )
|
|
|
|
|
{
|
|
|
|
|
cDebug() << "Running restart command" << m_restartNowCommand;
|
|
|
|
|
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|