|
|
@ -16,27 +16,27 @@
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
|
|
|
|
#include "CalamaresApplication.h"
|
|
|
|
#include "CalamaresApplication.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "CalamaresConfig.h"
|
|
|
|
#include "CalamaresConfig.h"
|
|
|
|
#include "CalamaresWindow.h"
|
|
|
|
|
|
|
|
#include "CalamaresVersion.h"
|
|
|
|
#include "CalamaresVersion.h"
|
|
|
|
#include "progresstree/ProgressTreeView.h"
|
|
|
|
#include "CalamaresWindow.h"
|
|
|
|
#include "progresstree/ProgressTreeModel.h"
|
|
|
|
#include "progresstree/ProgressTreeModel.h"
|
|
|
|
|
|
|
|
#include "progresstree/ProgressTreeView.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Branding.h"
|
|
|
|
|
|
|
|
#include "JobQueue.h"
|
|
|
|
|
|
|
|
#include "Settings.h"
|
|
|
|
|
|
|
|
#include "ViewManager.h"
|
|
|
|
#include "modulesystem/ModuleManager.h"
|
|
|
|
#include "modulesystem/ModuleManager.h"
|
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
|
|
|
#include "utils/CalamaresUtilsSystem.h"
|
|
|
|
#include "utils/CalamaresUtilsSystem.h"
|
|
|
|
#include "utils/Dirs.h"
|
|
|
|
#include "utils/Dirs.h"
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
#include "JobQueue.h"
|
|
|
|
|
|
|
|
#include "Branding.h"
|
|
|
|
|
|
|
|
#include "Settings.h"
|
|
|
|
|
|
|
|
#include "viewpages/ViewStep.h"
|
|
|
|
#include "viewpages/ViewStep.h"
|
|
|
|
#include "ViewManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
|
|
|
|
|
@ -77,8 +77,7 @@ CalamaresApplication::init()
|
|
|
|
initSettings();
|
|
|
|
initSettings();
|
|
|
|
initBranding();
|
|
|
|
initBranding();
|
|
|
|
|
|
|
|
|
|
|
|
setWindowIcon( QIcon( Calamares::Branding::instance()->
|
|
|
|
setWindowIcon( QIcon( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductIcon ) ) );
|
|
|
|
imagePath( Calamares::Branding::ProductIcon ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cDebug() << "STARTUP: initQmlPath, initSettings, initBranding done";
|
|
|
|
cDebug() << "STARTUP: initQmlPath, initSettings, initBranding done";
|
|
|
|
|
|
|
|
|
|
|
@ -91,15 +90,7 @@ CalamaresApplication::init()
|
|
|
|
CalamaresApplication::~CalamaresApplication()
|
|
|
|
CalamaresApplication::~CalamaresApplication()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares...";
|
|
|
|
cDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares...";
|
|
|
|
|
|
|
|
cDebug( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown.";
|
|
|
|
// if ( JobQueue::instance() )
|
|
|
|
|
|
|
|
// JobQueue::instance()->stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete m_mainwindow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete JobQueue::instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cDebug( Logger::LOGVERBOSE ) << "Finished shutdown.";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -138,14 +129,20 @@ qmlDirCandidates( bool assumeBuilddir )
|
|
|
|
|
|
|
|
|
|
|
|
QStringList qmlDirs;
|
|
|
|
QStringList qmlDirs;
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
|
|
|
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
|
|
|
|
{
|
|
|
|
qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir
|
|
|
|
qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraDataDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraDataDirs() )
|
|
|
|
|
|
|
|
{
|
|
|
|
qmlDirs << ( s + QML );
|
|
|
|
qmlDirs << ( s + QML );
|
|
|
|
|
|
|
|
}
|
|
|
|
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
|
|
|
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -160,14 +157,20 @@ settingsFileCandidates( bool assumeBuilddir )
|
|
|
|
|
|
|
|
|
|
|
|
QStringList settingsPaths;
|
|
|
|
QStringList settingsPaths;
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
|
|
|
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
|
|
|
|
{
|
|
|
|
settingsPaths << QDir::current().absoluteFilePath( settings );
|
|
|
|
settingsPaths << QDir::current().absoluteFilePath( settings );
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraConfigDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraConfigDirs() )
|
|
|
|
|
|
|
|
{
|
|
|
|
settingsPaths << ( s + settings );
|
|
|
|
settingsPaths << ( s + settings );
|
|
|
|
|
|
|
|
}
|
|
|
|
settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat
|
|
|
|
settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat
|
|
|
|
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
|
|
|
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -181,14 +184,20 @@ brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStringList brandingPaths;
|
|
|
|
QStringList brandingPaths;
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
|
|
|
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
if ( assumeBuilddir )
|
|
|
|
|
|
|
|
{
|
|
|
|
brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename );
|
|
|
|
brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename );
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
if ( CalamaresUtils::haveExtraDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraDataDirs() )
|
|
|
|
for ( auto s : CalamaresUtils::extraDataDirs() )
|
|
|
|
|
|
|
|
{
|
|
|
|
brandingPaths << ( s + brandingFilename );
|
|
|
|
brandingPaths << ( s + brandingFilename );
|
|
|
|
|
|
|
|
}
|
|
|
|
brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename );
|
|
|
|
brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename );
|
|
|
|
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
|
|
|
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -220,9 +229,13 @@ CalamaresApplication::initQmlPath()
|
|
|
|
cError() << "Cowardly refusing to continue startup without a QML directory."
|
|
|
|
cError() << "Cowardly refusing to continue startup without a QML directory."
|
|
|
|
<< Logger::DebugList( qmlDirCandidatesByPriority );
|
|
|
|
<< Logger::DebugList( qmlDirCandidatesByPriority );
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing qml/";
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing qml/";
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: none of the expected QML paths exist.";
|
|
|
|
cError() << "FATAL: none of the expected QML paths exist.";
|
|
|
|
|
|
|
|
}
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -255,9 +268,13 @@ CalamaresApplication::initSettings()
|
|
|
|
cError() << "Cowardly refusing to continue startup without settings."
|
|
|
|
cError() << "Cowardly refusing to continue startup without settings."
|
|
|
|
<< Logger::DebugList( settingsFileCandidatesByPriority );
|
|
|
|
<< Logger::DebugList( settingsFileCandidatesByPriority );
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing settings.conf";
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing settings.conf";
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: none of the expected configuration file paths exist.";
|
|
|
|
cError() << "FATAL: none of the expected configuration file paths exist.";
|
|
|
|
|
|
|
|
}
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -302,9 +319,13 @@ CalamaresApplication::initBranding()
|
|
|
|
cError() << "Cowardly refusing to continue startup without branding."
|
|
|
|
cError() << "Cowardly refusing to continue startup without branding."
|
|
|
|
<< Logger::DebugList( brandingFileCandidatesByPriority );
|
|
|
|
<< Logger::DebugList( brandingFileCandidatesByPriority );
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName;
|
|
|
|
cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
cError() << "FATAL: none of the expected branding descriptor file paths exist.";
|
|
|
|
cError() << "FATAL: none of the expected branding descriptor file paths exist.";
|
|
|
|
|
|
|
|
}
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
::exit( EXIT_FAILURE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -315,10 +336,8 @@ CalamaresApplication::initBranding()
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CalamaresApplication::initModuleManager()
|
|
|
|
CalamaresApplication::initModuleManager()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_moduleManager = new Calamares::ModuleManager(
|
|
|
|
m_moduleManager = new Calamares::ModuleManager( Calamares::Settings::instance()->modulesSearchPaths(), this );
|
|
|
|
Calamares::Settings::instance()->modulesSearchPaths(), this );
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::initDone, this, &CalamaresApplication::initView );
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::initDone,
|
|
|
|
|
|
|
|
this, &CalamaresApplication::initView );
|
|
|
|
|
|
|
|
m_moduleManager->init();
|
|
|
|
m_moduleManager->init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -332,16 +351,12 @@ CalamaresApplication::initView()
|
|
|
|
|
|
|
|
|
|
|
|
m_mainwindow = new CalamaresWindow(); //also creates ViewManager
|
|
|
|
m_mainwindow = new CalamaresWindow(); //also creates ViewManager
|
|
|
|
|
|
|
|
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded,
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, this, &CalamaresApplication::initViewSteps );
|
|
|
|
this, &CalamaresApplication::initViewSteps );
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed, this, &CalamaresApplication::initFailed );
|
|
|
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed,
|
|
|
|
|
|
|
|
this, &CalamaresApplication::initFailed );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_moduleManager->loadModules();
|
|
|
|
m_moduleManager->loadModules();
|
|
|
|
|
|
|
|
|
|
|
|
m_mainwindow->move(
|
|
|
|
m_mainwindow->move( this->desktop()->availableGeometry().center() - m_mainwindow->rect().center() );
|
|
|
|
this->desktop()->availableGeometry().center() -
|
|
|
|
|
|
|
|
m_mainwindow->rect().center() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
|
|
|
|
cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -358,7 +373,9 @@ CalamaresApplication::initViewSteps()
|
|
|
|
m_mainwindow->showMaximized();
|
|
|
|
m_mainwindow->showMaximized();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
m_mainwindow->show();
|
|
|
|
m_mainwindow->show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProgressTreeModel* m = new ProgressTreeModel( nullptr );
|
|
|
|
ProgressTreeModel* m = new ProgressTreeModel( nullptr );
|
|
|
|
ProgressTreeView::instance()->setModel( m );
|
|
|
|
ProgressTreeView::instance()->setModel( m );
|
|
|
@ -368,8 +385,10 @@ CalamaresApplication::initViewSteps()
|
|
|
|
cDebug() << Logger::SubEntry << steps.count() << "view steps loaded.";
|
|
|
|
cDebug() << Logger::SubEntry << steps.count() << "view steps loaded.";
|
|
|
|
// Tell the first view that it's been shown.
|
|
|
|
// Tell the first view that it's been shown.
|
|
|
|
if ( steps.count() > 0 )
|
|
|
|
if ( steps.count() > 0 )
|
|
|
|
|
|
|
|
{
|
|
|
|
steps[ 0 ]->onActivate();
|
|
|
|
steps[ 0 ]->onActivate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CalamaresApplication::initFailed( const QStringList& l )
|
|
|
|
CalamaresApplication::initFailed( const QStringList& l )
|
|
|
|