Do not use QFont without Xorg

This commit is contained in:
Petr Mrázek 2014-11-09 20:49:23 +01:00
parent 24a0635b62
commit 1dd8978f8c
2 changed files with 23 additions and 14 deletions

View File

@ -56,7 +56,7 @@ static const int APPDATA_BUFFER_SIZE = 1024;
using namespace Util::Commandline; using namespace Util::Commandline;
MultiMC::MultiMC(int &argc, char **argv, bool root_override) : QApplication(argc, argv) MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, argv)
{ {
setOrganizationName("MultiMC"); setOrganizationName("MultiMC");
setApplicationName("MultiMC5"); setApplicationName("MultiMC5");
@ -149,7 +149,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override) : QApplication(argc
return; return;
} }
if (root_override) // in test mode, root path is the same as the binary path.
if (test_mode)
{ {
rootPath = binPath; rootPath = binPath;
} }
@ -198,7 +199,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override) : QApplication(argc
QLOG_INFO() << "Static data path : " << staticDataPath; QLOG_INFO() << "Static data path : " << staticDataPath;
// load settings // load settings
initGlobalSettings(); initGlobalSettings(test_mode);
// load translations // load translations
initTranslations(); initTranslations();
@ -362,7 +363,7 @@ void MultiMC::initLogger()
bool loggerInitialized = false; bool loggerInitialized = false;
void MultiMC::initGlobalSettings() void MultiMC::initGlobalSettings(bool test_mode)
{ {
m_settings.reset(new INISettingsObject("multimc.cfg", this)); m_settings.reset(new INISettingsObject("multimc.cfg", this));
// Updates // Updates
@ -379,6 +380,9 @@ void MultiMC::initGlobalSettings()
// Remembered state // Remembered state
m_settings->registerSetting("LastUsedGroupForNewInstance", QString()); m_settings->registerSetting("LastUsedGroupForNewInstance", QString());
// in test mode, we don't have UI.
if(!test_mode)
{
// Console settings // Console settings
QFont consoleFont; QFont consoleFont;
consoleFont.setFamily(""); consoleFont.setFamily("");
@ -387,6 +391,11 @@ void MultiMC::initGlobalSettings()
QFontInfo consoleFontInfo(consoleFont); QFontInfo consoleFontInfo(consoleFont);
QString consoleFontFamily = consoleFontInfo.family(); QString consoleFontFamily = consoleFontInfo.family();
m_settings->registerSetting("ConsoleFont", consoleFontFamily); m_settings->registerSetting("ConsoleFont", consoleFontFamily);
}
else
{
m_settings->registerSetting("ConsoleFont", "Courier");
}
// FTB // FTB
m_settings->registerSetting("TrackFTBInstances", false); m_settings->registerSetting("TrackFTBInstances", false);

View File

@ -57,7 +57,7 @@ public:
}; };
public: public:
MultiMC(int &argc, char **argv, bool root_override = false); MultiMC(int &argc, char **argv, bool test_mode = false);
virtual ~MultiMC(); virtual ~MultiMC();
std::shared_ptr<SettingsObject> settings() std::shared_ptr<SettingsObject> settings()
@ -183,7 +183,7 @@ private slots:
private: private:
void initLogger(); void initLogger();
void initGlobalSettings(); void initGlobalSettings(bool test_mode);
void initHttpMetaCache(); void initHttpMetaCache();