[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:
parent
50b6801d35
commit
db80a34aca
@ -42,12 +42,17 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QTimer>
|
#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[] )
|
CalamaresApplication::CalamaresApplication( int& argc, char* argv[] )
|
||||||
: QApplication( argc, argv )
|
: QApplication( argc, argv )
|
||||||
, m_mainwindow( nullptr )
|
, m_mainwindow( nullptr )
|
||||||
, m_moduleManager( nullptr )
|
, m_moduleManager( nullptr )
|
||||||
, m_debugMode( false )
|
|
||||||
{
|
{
|
||||||
// Setting the organization name makes the default cache
|
// Setting the organization name makes the default cache
|
||||||
// directory -- where Calamares stores logs, for instance --
|
// 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*
|
CalamaresWindow*
|
||||||
CalamaresApplication::mainWindow()
|
CalamaresApplication::mainWindow()
|
||||||
{
|
{
|
||||||
|
@ -49,16 +49,6 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
static CalamaresApplication* instance();
|
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.
|
* @brief mainWindow returns the Calamares application main window.
|
||||||
*/
|
*/
|
||||||
@ -78,8 +68,6 @@ private:
|
|||||||
|
|
||||||
CalamaresWindow* m_mainwindow;
|
CalamaresWindow* m_mainwindow;
|
||||||
Calamares::ModuleManager* m_moduleManager;
|
Calamares::ModuleManager* m_moduleManager;
|
||||||
|
|
||||||
bool m_debugMode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALAMARESAPPLICATION_H
|
#endif // CALAMARESAPPLICATION_H
|
||||||
|
@ -73,8 +73,7 @@ handle_args( CalamaresApplication& a )
|
|||||||
|
|
||||||
parser.process( a );
|
parser.process( a );
|
||||||
|
|
||||||
a.setDebug( parser.isSet( debugOption ) );
|
Logger::setupLogLevel( parser.isSet( debugOption ) ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
|
||||||
Logger::setupLogLevel( a.isDebug() ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
|
|
||||||
if ( parser.isSet( configOption ) )
|
if ( parser.isSet( configOption ) )
|
||||||
{
|
{
|
||||||
CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) );
|
CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) );
|
||||||
@ -83,6 +82,8 @@ handle_args( CalamaresApplication& a )
|
|||||||
{
|
{
|
||||||
CalamaresUtils::setXdgDirs();
|
CalamaresUtils::setXdgDirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -110,11 +111,10 @@ main( int argc, char* argv[] )
|
|||||||
// TODO: umount anything in /tmp/calamares-... as an emergency save function
|
// TODO: umount anything in /tmp/calamares-... as an emergency save function
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
handle_args( a );
|
|
||||||
KDSingleApplicationGuard guard( KDSingleApplicationGuard::AutoKillOtherInstances );
|
KDSingleApplicationGuard guard( KDSingleApplicationGuard::AutoKillOtherInstances );
|
||||||
if ( guard.isPrimaryInstance() )
|
if ( guard.isPrimaryInstance() )
|
||||||
{
|
{
|
||||||
a.init();
|
handle_args( a );
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user