[calamares] Remove intermediate debug-settings

- There's a multi-stage setup for debug-mode, where the application
   object also knows that debugging is set. Remove it.
 - Break debug mode (because now the settings don't get debug-mode set).
 - Refactor so that parameter handing is only done if this Calamares
   is the unique (first) Calamares.
This commit is contained in:
Adriaan de Groot 2020-02-05 16:09:35 +01:00
parent 50b6801d35
commit db80a34aca
3 changed files with 10 additions and 31 deletions

View File

@ -42,12 +42,17 @@
#include <QScreen>
#include <QTimer>
/// @brief Convenience for "are the settings in debug mode"
static bool
isDebug()
{
return Calamares::Settings::instance() && Calamares::Settings::instance()->debugMode();
}
CalamaresApplication::CalamaresApplication( int& argc, char* argv[] )
: QApplication( argc, argv )
, m_mainwindow( nullptr )
, m_moduleManager( nullptr )
, m_debugMode( false )
{
// Setting the organization name makes the default cache
// directory -- where Calamares stores logs, for instance --
@ -102,20 +107,6 @@ CalamaresApplication::instance()
}
void
CalamaresApplication::setDebug( bool enabled )
{
m_debugMode = enabled;
}
bool
CalamaresApplication::isDebug()
{
return m_debugMode;
}
CalamaresWindow*
CalamaresApplication::mainWindow()
{

View File

@ -49,16 +49,6 @@ public:
void init();
static CalamaresApplication* instance();
/**
* @brief setDebug controls whether debug mode is enabled
*/
void setDebug( bool enabled );
/**
* @brief isDebug returns true if running in debug mode, otherwise false.
*/
bool isDebug();
/**
* @brief mainWindow returns the Calamares application main window.
*/
@ -78,8 +68,6 @@ private:
CalamaresWindow* m_mainwindow;
Calamares::ModuleManager* m_moduleManager;
bool m_debugMode;
};
#endif // CALAMARESAPPLICATION_H

View File

@ -73,8 +73,7 @@ handle_args( CalamaresApplication& a )
parser.process( a );
a.setDebug( parser.isSet( debugOption ) );
Logger::setupLogLevel( a.isDebug() ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
Logger::setupLogLevel( parser.isSet( debugOption ) ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
if ( parser.isSet( configOption ) )
{
CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) );
@ -83,6 +82,8 @@ handle_args( CalamaresApplication& a )
{
CalamaresUtils::setXdgDirs();
}
a.init();
}
int
@ -110,11 +111,10 @@ main( int argc, char* argv[] )
// TODO: umount anything in /tmp/calamares-... as an emergency save function
#endif
handle_args( a );
KDSingleApplicationGuard guard( KDSingleApplicationGuard::AutoKillOtherInstances );
if ( guard.isPrimaryInstance() )
{
a.init();
handle_args( a );
return a.exec();
}
else