mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Merge branch 'launcher_log' into 'master'
Setup launcher configuration manager and logging before initializing UI See merge request OpenMW/openmw!2851
This commit is contained in:
commit
1741a06cd1
@ -122,7 +122,7 @@ namespace Launcher
|
||||
}
|
||||
}
|
||||
|
||||
Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Launcher::DataFilesPage::DataFilesPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Config::LauncherSettings& launcherSettings, MainDialog* parent)
|
||||
: QWidget(parent)
|
||||
, mMainDialog(parent)
|
||||
|
@ -41,7 +41,7 @@ namespace Launcher
|
||||
Ui::DataFilesPage ui;
|
||||
|
||||
public:
|
||||
explicit DataFilesPage(Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
explicit DataFilesPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Config::LauncherSettings& launcherSettings, MainDialog* parent = nullptr);
|
||||
|
||||
QAbstractItemModel* profilesModel() const;
|
||||
@ -104,7 +104,7 @@ namespace Launcher
|
||||
TextInputDialog* mNewProfileDialog;
|
||||
TextInputDialog* mCloneProfileDialog;
|
||||
|
||||
Files::ConfigurationManager& mCfgMgr;
|
||||
const Files::ConfigurationManager& mCfgMgr;
|
||||
|
||||
Config::GameSettings& mGameSettings;
|
||||
Config::LauncherSettings& mLauncherSettings;
|
||||
|
@ -5,13 +5,14 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/files/qtconversion.hpp>
|
||||
|
||||
#include "utils/textinputdialog.hpp"
|
||||
|
||||
using namespace Process;
|
||||
|
||||
Launcher::ImportPage::ImportPage(Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Launcher::ImportPage::ImportPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Config::LauncherSettings& launcherSettings, MainDialog* parent)
|
||||
: QWidget(parent)
|
||||
, mCfgMgr(cfg)
|
||||
|
@ -26,7 +26,7 @@ namespace Launcher
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImportPage(Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
explicit ImportPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||
Config::LauncherSettings& launcherSettings, MainDialog* parent = nullptr);
|
||||
~ImportPage() override;
|
||||
|
||||
@ -52,7 +52,7 @@ namespace Launcher
|
||||
Process::ProcessInvoker* mWizardInvoker;
|
||||
Process::ProcessInvoker* mImporterInvoker;
|
||||
|
||||
Files::ConfigurationManager& mCfgMgr;
|
||||
const Files::ConfigurationManager& mCfgMgr;
|
||||
|
||||
Config::GameSettings& mGameSettings;
|
||||
Config::LauncherSettings& mLauncherSettings;
|
||||
|
@ -3,7 +3,11 @@
|
||||
#include <QDir>
|
||||
#include <QTranslator>
|
||||
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
@ -18,6 +22,14 @@ int runLauncher(int argc, char* argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
boost::program_options::variables_map variables;
|
||||
boost::program_options::options_description description;
|
||||
Files::ConfigurationManager configurationManager;
|
||||
configurationManager.addCommonOptions(description);
|
||||
configurationManager.readConfiguration(variables, description, true);
|
||||
|
||||
setupLogging(configurationManager.getLogPath(), "Launcher");
|
||||
|
||||
try
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
@ -34,7 +46,7 @@ int runLauncher(int argc, char* argv[])
|
||||
|
||||
QDir::setCurrent(dir.absolutePath());
|
||||
|
||||
Launcher::MainDialog mainWin;
|
||||
Launcher::MainDialog mainWin(configurationManager);
|
||||
|
||||
Launcher::FirstRunDialogResult result = mainWin.showFirstRunDialog();
|
||||
if (result == Launcher::FirstRunDialogResultFailure)
|
||||
@ -47,9 +59,9 @@ int runLauncher(int argc, char* argv[])
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||
Log(Debug::Error) << "Unexpected exception: " << e.what();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "maindialog.hpp"
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/files/conversion.hpp>
|
||||
#include <components/files/qtconversion.hpp>
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
@ -13,9 +14,6 @@
|
||||
#include <QStringList>
|
||||
#include <QTime>
|
||||
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/files/conversion.hpp>
|
||||
#include <components/files/qtconfigpath.hpp>
|
||||
@ -39,8 +37,9 @@ void cfgError(const QString& title, const QString& msg)
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
Launcher::MainDialog::MainDialog(QWidget* parent)
|
||||
Launcher::MainDialog::MainDialog(const Files::ConfigurationManager& configurationManager, QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
, mCfgMgr(configurationManager)
|
||||
, mGameSettings(mCfgMgr)
|
||||
{
|
||||
setupUi(this);
|
||||
@ -418,12 +417,7 @@ bool Launcher::MainDialog::setupGraphicsSettings()
|
||||
Settings::Manager::clear(); // Ensure to clear previous settings in case we had already loaded settings.
|
||||
try
|
||||
{
|
||||
boost::program_options::variables_map variables;
|
||||
boost::program_options::options_description desc;
|
||||
mCfgMgr.addCommonOptions(desc);
|
||||
mCfgMgr.readConfiguration(variables, desc, true);
|
||||
Settings::Manager::load(mCfgMgr);
|
||||
setupLogging(mCfgMgr.getLogPath(), "Launcher");
|
||||
return true;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define MAINDIALOG_H
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#include <components/process/processinvoker.hpp>
|
||||
|
||||
#include <components/config/gamesettings.hpp>
|
||||
@ -17,6 +15,11 @@ class QStackedWidget;
|
||||
class QStringListModel;
|
||||
class QString;
|
||||
|
||||
namespace Files
|
||||
{
|
||||
struct ConfigurationManager;
|
||||
}
|
||||
|
||||
namespace Launcher
|
||||
{
|
||||
class GraphicsPage;
|
||||
@ -41,7 +44,7 @@ namespace Launcher
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainDialog(QWidget* parent = nullptr);
|
||||
explicit MainDialog(const Files::ConfigurationManager& configurationManager, QWidget* parent = nullptr);
|
||||
~MainDialog() override;
|
||||
|
||||
FirstRunDialogResult showFirstRunDialog();
|
||||
@ -93,7 +96,7 @@ namespace Launcher
|
||||
Process::ProcessInvoker* mGameInvoker;
|
||||
Process::ProcessInvoker* mWizardInvoker;
|
||||
|
||||
Files::ConfigurationManager mCfgMgr;
|
||||
const Files::ConfigurationManager& mCfgMgr;
|
||||
|
||||
Config::GameSettings mGameSettings;
|
||||
Config::LauncherSettings mLauncherSettings;
|
||||
|
@ -21,7 +21,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Config::GameSettings::GameSettings(Files::ConfigurationManager& cfg)
|
||||
Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg)
|
||||
: mCfgMgr(cfg)
|
||||
{
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Config
|
||||
class GameSettings
|
||||
{
|
||||
public:
|
||||
GameSettings(Files::ConfigurationManager& cfg);
|
||||
explicit GameSettings(const Files::ConfigurationManager& cfg);
|
||||
|
||||
inline QString value(const QString& key, const QString& defaultValue = QString())
|
||||
{
|
||||
@ -85,7 +85,7 @@ namespace Config
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Files::ConfigurationManager& mCfgMgr;
|
||||
const Files::ConfigurationManager& mCfgMgr;
|
||||
|
||||
void validatePaths();
|
||||
QMultiMap<QString, QString> mSettings;
|
||||
|
Loading…
x
Reference in New Issue
Block a user