mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 03:15:44 -05:00
[finished] Improve logging of restart mode
- Don't use weirdly-named mode, store named mode in page, - Log the actual mode name when setting up the restart button.
This commit is contained in:
parent
38c36e2439
commit
0c24a01eb9
4 changed files with 26 additions and 14 deletions
|
@ -39,7 +39,7 @@
|
||||||
FinishedPage::FinishedPage( QWidget* parent )
|
FinishedPage::FinishedPage( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::FinishedPage )
|
, ui( new Ui::FinishedPage )
|
||||||
, m_restartSetUp( false )
|
, m_mode( FinishedViewStep::RestartMode::UserUnchecked )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@ FinishedPage::setRestart( FinishedViewStep::RestartMode mode )
|
||||||
{
|
{
|
||||||
using Mode = FinishedViewStep::RestartMode;
|
using Mode = FinishedViewStep::RestartMode;
|
||||||
|
|
||||||
|
m_mode = mode;
|
||||||
|
|
||||||
ui->restartCheckBox->setVisible( mode != Mode::Never );
|
ui->restartCheckBox->setVisible( mode != Mode::Never );
|
||||||
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
||||||
ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserChecked ) );
|
ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserChecked ) );
|
||||||
|
@ -100,19 +102,21 @@ void
|
||||||
FinishedPage::setUpRestart()
|
FinishedPage::setUpRestart()
|
||||||
{
|
{
|
||||||
cDebug() << "FinishedPage::setUpRestart(), Quit button"
|
cDebug() << "FinishedPage::setUpRestart(), Quit button"
|
||||||
<< "setup=" << m_restartSetUp
|
<< "setup=" << FinishedViewStep::modeName( m_mode )
|
||||||
<< "command=" << m_restartNowCommand;
|
<< "command=" << m_restartNowCommand;
|
||||||
if ( !m_restartSetUp )
|
|
||||||
{
|
|
||||||
connect( qApp, &QApplication::aboutToQuit,
|
connect( qApp, &QApplication::aboutToQuit,
|
||||||
this, [this]
|
[this]()
|
||||||
{
|
{
|
||||||
if ( ui->restartCheckBox->isVisible() &&
|
if ( ui->restartCheckBox->isVisible() &&
|
||||||
ui->restartCheckBox->isChecked() )
|
ui->restartCheckBox->isChecked() )
|
||||||
|
{
|
||||||
|
cDebug() << "Running restart command" << m_restartNowCommand;
|
||||||
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -49,9 +49,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
Ui::FinishedPage* ui;
|
Ui::FinishedPage* ui;
|
||||||
|
|
||||||
|
FinishedViewStep::RestartMode m_mode;
|
||||||
QString m_restartNowCommand;
|
QString m_restartNowCommand;
|
||||||
|
|
||||||
bool m_restartSetUp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FINISHEDPAGE_H
|
#endif // FINISHEDPAGE_H
|
||||||
|
|
|
@ -210,4 +210,11 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false );
|
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FinishedViewStep::modeName(FinishedViewStep::RestartMode m)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
return modeNames().find( m, ok ); // May be QString()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
UserChecked, ///< @brief Show button, starts checked
|
UserChecked, ///< @brief Show button, starts checked
|
||||||
Always ///< @brief Show button, can't change, checked
|
Always ///< @brief Show button, can't change, checked
|
||||||
};
|
};
|
||||||
|
/// @brief Returns the config-name of the given restart-mode @p m
|
||||||
|
static QString modeName( RestartMode m );
|
||||||
|
|
||||||
explicit FinishedViewStep( QObject* parent = nullptr );
|
explicit FinishedViewStep( QObject* parent = nullptr );
|
||||||
virtual ~FinishedViewStep() override;
|
virtual ~FinishedViewStep() override;
|
||||||
|
|
Loading…
Add table
Reference in a new issue