diff options
| author | Petr Mrázek <peterix@gmail.com> | 2015-01-27 22:31:07 +0100 |
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2015-04-02 00:14:06 +0200 |
| commit | 791221e923586bb717396ecf18bd13e57034df99 (patch) | |
| tree | 9f608af07375b38626c8964671620477158341ba | |
| parent | 593111b14463e9d5d08256061b981b5ab1cfb710 (diff) | |
| download | PrismLauncher-791221e923586bb717396ecf18bd13e57034df99.tar.gz PrismLauncher-791221e923586bb717396ecf18bd13e57034df99.tar.bz2 PrismLauncher-791221e923586bb717396ecf18bd13e57034df99.zip | |
NOISSUE Refactors and moving of things
88 files changed, 1885 insertions, 1659 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 32bf31b5..e4cd6387 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,6 +394,8 @@ SET(MULTIMC_SOURCES # LOGIC - Base classes and infrastructure logic/BaseVersion.h + logic/BaseProcess.h + logic/BaseProcess.cpp logic/InstanceFactory.h logic/InstanceFactory.cpp logic/BaseInstance.h @@ -404,12 +406,8 @@ SET(MULTIMC_SOURCES logic/ModList.cpp # sets and maps for deciding based on versions - logic/VersionFilterData.h - logic/VersionFilterData.cpp - - # Instance launch - logic/MinecraftProcess.h - logic/MinecraftProcess.cpp + logic/minecraft/VersionFilterData.h + logic/minecraft/VersionFilterData.cpp # Annoying nag screen logic logic/NagUtils.h @@ -503,24 +501,34 @@ SET(MULTIMC_SOURCES logic/JarUtils.h logic/JarUtils.cpp - # OneSix version json infrastructure + # Minecraft support logic/minecraft/GradleSpecifier.h - logic/minecraft/InstanceVersion.cpp - logic/minecraft/InstanceVersion.h + logic/minecraft/MinecraftProfile.cpp + logic/minecraft/MinecraftProfile.h logic/minecraft/JarMod.cpp logic/minecraft/JarMod.h + logic/minecraft/MinecraftInstance.cpp + logic/minecraft/MinecraftInstance.h + logic/minecraft/MinecraftProcess.cpp + logic/minecraft/MinecraftProcess.h logic/minecraft/MinecraftVersion.cpp logic/minecraft/MinecraftVersion.h logic/minecraft/MinecraftVersionList.cpp logic/minecraft/MinecraftVersionList.h + logic/minecraft/NullProfileStrategy.h logic/minecraft/OneSixLibrary.cpp logic/minecraft/OneSixLibrary.h + logic/minecraft/OneSixProfileStrategy.cpp + logic/minecraft/OneSixProfileStrategy.h logic/minecraft/OneSixRule.cpp logic/minecraft/OneSixRule.h logic/minecraft/OpSys.cpp logic/minecraft/OpSys.h logic/minecraft/ParseUtils.cpp logic/minecraft/ParseUtils.h + logic/minecraft/ProfileUtils.cpp + logic/minecraft/ProfileUtils.h + logic/minecraft/ProfileStrategy.h logic/minecraft/RawLibrary.cpp logic/minecraft/RawLibrary.h logic/minecraft/VersionBuilder.cpp @@ -528,7 +536,7 @@ SET(MULTIMC_SOURCES logic/minecraft/VersionBuildError.h logic/minecraft/VersionFile.cpp logic/minecraft/VersionFile.h - logic/minecraft/VersionPatch.h + logic/minecraft/ProfilePatch.h logic/minecraft/VersionSource.h # A Recursive file system watcher @@ -547,10 +555,10 @@ SET(MULTIMC_SOURCES logic/LwjglVersionList.cpp # FTB - logic/OneSixFTBInstance.h - logic/OneSixFTBInstance.cpp - logic/LegacyFTBInstance.h - logic/LegacyFTBInstance.cpp + logic/ftb/OneSixFTBInstance.h + logic/ftb/OneSixFTBInstance.cpp + logic/ftb/LegacyFTBInstance.h + logic/ftb/LegacyFTBInstance.cpp # the screenshots feature logic/screenshots/Screenshot.h @@ -597,8 +605,6 @@ SET(MULTIMC_SOURCES logic/java/JavaCheckerJob.cpp # Assets - logic/assets/AssetsMigrateTask.h - logic/assets/AssetsMigrateTask.cpp logic/assets/AssetsUtils.h logic/assets/AssetsUtils.cpp diff --git a/MultiMC.cpp b/MultiMC.cpp index abb30225..ae6070a3 100644 --- a/MultiMC.cpp +++ b/MultiMC.cpp @@ -21,8 +21,6 @@ #include "logic/forge/ForgeVersionList.h" -#include "logic/news/NewsChecker.h" - #include "logic/status/StatusChecker.h" #include "logic/net/HttpMetaCache.h" @@ -201,9 +199,6 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar // initialize the notification checker m_notificationChecker.reset(new NotificationChecker()); - // initialize the news checker - m_newsChecker.reset(new NewsChecker(BuildConfig.NEWS_RSS_URL)); - // initialize the status checker m_statusChecker.reset(new StatusChecker()); @@ -213,7 +208,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar auto InstDirSetting = m_settings->getSetting("InstanceDir"); // instance path: check for problems with '!' in instance path and warn the user in the log // and rememer that we have to show him a dialog when the gui starts (if it does so) - QString instDir = MMC->settings()->get("InstanceDir").toString(); + QString instDir = m_settings->get("InstanceDir").toString(); QLOG_INFO() << "Instance path : " << instDir; if (checkProblemticPathJava(QDir(instDir))) { @@ -243,6 +238,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar // init proxy settings updateProxySettings(); + //FIXME: what to do with these? m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory())); m_profilers.insert("jvisualvm", @@ -251,6 +247,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar { profiler->registerSettings(m_settings); } + + //FIXME: what to do with these? m_tools.insert("mcedit", std::shared_ptr<BaseDetachedToolFactory>(new MCEditFactory())); for (auto tool : m_tools.values()) { @@ -296,8 +294,7 @@ void MultiMC::initTranslations() } m_mmc_translator.reset(new QTranslator()); - if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), - MMC->staticData() + "/translations")) + if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), staticData() + "/translations")) { QLOG_DEBUG() << "Loading MMC Language File for" << locale.bcp47Name().toLocal8Bit().constData() << "..."; @@ -701,13 +698,13 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) } QLOG_INFO() << "Installing updates."; #ifdef WINDOWS - QString finishCmd = MMC->applicationFilePath(); + QString finishCmd = applicationFilePath(); QString updaterBinary = PathCombine(bin(), "updater.exe"); #elif LINUX QString finishCmd = PathCombine(root(), "MultiMC"); QString updaterBinary = PathCombine(bin(), "updater"); #elif OSX - QString finishCmd = MMC->applicationFilePath(); + QString finishCmd = applicationFilePath(); QString updaterBinary = PathCombine(bin(), "updater"); #else #error Unsupported operating system. @@ -719,7 +716,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) args << "--install-dir" << root(); args << "--package-dir" << updateFilesDir; args << "--script" << PathCombine(updateFilesDir, "file_list.xml"); - args << "--wait" << QString::number(MMC->applicationPid()); + args << "--wait" << QString::number(applicationPid()); if (flags & DryRun) args << "--dry-run"; if (flags & RestartOnFinish) @@ -737,7 +734,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) } // Now that we've started the updater, quit MultiMC. - MMC->quit(); + quit(); } void MultiMC::setIconTheme(const QString& name) @@ -20,7 +20,6 @@ class LiteLoaderVersionList; class JavaVersionList; class UpdateChecker; class NotificationChecker; -class NewsChecker; class StatusChecker; class BaseProfilerFactory; class BaseDetachedToolFactory; @@ -102,11 +101,6 @@ public: return m_notificationChecker; } - std::shared_ptr<NewsChecker> newsChecker() - { - return m_newsChecker; - } - std::shared_ptr<StatusChecker> statusChecker() { return m_statusChecker; @@ -197,7 +191,6 @@ private: std::shared_ptr<InstanceList> m_instances; std::shared_ptr<UpdateChecker> m_updateChecker; std::shared_ptr<NotificationChecker> m_notificationChecker; - std::shared_ptr<NewsChecker> m_newsChecker; std::shared_ptr<StatusChecker> m_statusChecker; std::shared_ptr<MojangAccountList> m_accounts; std::shared_ptr<IconList> m_icons; diff --git a/depends/util/include/modutils.h b/depends/util/include/modutils.h index 1fecd4d5..bc608f96 100644 --- a/depends/util/include/modutils.h +++ b/depends/util/include/modutils.h @@ -30,24 +30,76 @@ private: QString m_string; struct Section { - explicit Section(const QString &str, const int num) : numValid(true), number(num), string(str) {} - explicit Section(const QString &str) : numValid(false), string(str) {} + explicit Section(const QString &fullString) + { + m_fullString = fullString; + int cutoff = m_fullString.size(); + for(int i = 0; i < m_fullString.size(); i++) + { + if(!m_fullString[i].isDigit()) + { + cutoff = i; + break; + } + } + auto numPart = m_fullString.leftRef(cutoff); + if(numPart.size()) + { + numValid = true; + m_numPart = numPart.toInt(); + } + auto stringPart = m_fullString.midRef(cutoff); + if(stringPart.size()) + { + m_stringPart = stringPart.toString(); + } + } explicit Section() {} - bool numValid; - int number; - QString string; + bool numValid = false; + int m_numPart = 0; + QString m_stringPart; + QString m_fullString; inline bool operator!=(const Section &other) const { - return (numValid && other.numValid) ? (number != other.number) : (string != other.string); + if(numValid && other.numValid) + { + return m_numPart != other.m_numPart || m_stringPart != other.m_stringPart; + } + else + { + return m_fullString != other.m_fullString; + } } inline bool operator<(const Section &other) const { - return (numValid && other.numValid) ? (number < other.number) : (string < other.string); + if(numValid && other.numValid) + { + if(m_numPart < other.m_numPart) + return true; + if(m_numPart == other.m_numPart && m_stringPart < other.m_stringPart) + return true; + return false; + } + else + { + return m_fullString < other.m_fullString; + } } inline bool operator>(const Section &other) const { - return (numValid && other.numValid) ? (number > other.number) : (string > other.string); + if(numValid && other.numValid) + { + if(m_numPart > other.m_numPart) + return true; + if(m_numPart == other.m_numPart && m_stringPart > other.m_stringPart) + return true; + return false; + } + else + { + return m_fullString > other.m_fullString; + } } }; QList<Section> m_sections; diff --git a/depends/util/src/modutils.cpp b/depends/util/src/modutils.cpp index 67c09dec..5f89eacd 100644 --- a/depends/util/src/modutils.cpp +++ b/depends/util/src/modutils.cpp @@ -15,9 +15,9 @@ bool Util::Version::operator<(const Version &other) const const int size = qMax(m_sections.size(), other.m_sections.size()); for (int i = 0; i < size; ++i) { - const Section sec1 = (i >= m_sections.size()) ? Section("0", 0) : m_sections.at(i); + const Section sec1 = (i >= m_sections.size()) ? Section("0") : m_sections.at(i); const Section sec2 = - (i >= other.m_sections.size()) ? Section("0", 0) : other.m_sections.at(i); + (i >= other.m_sections.size()) ? Section("0") : other.m_sections.at(i); if (sec1 != sec2) { return sec1 < sec2; @@ -35,9 +35,9 @@ bool Util::Version::operator>(const Version &other) const const int size = qMax(m_sections.size(), other.m_sections.size()); for (int i = 0; i < size; ++i) { - const Section sec1 = (i >= m_sections.size()) ? Section("0", 0) : m_sections.at(i); + const Section sec1 = (i >= m_sections.size()) ? Section("0") : m_sections.at(i); const Section sec2 = - (i >= other.m_sections.size()) ? Section("0", 0) : other.m_sections.at(i); + (i >= other.m_sections.size()) ? Section("0") : other.m_sections.at(i); if (sec1 != sec2) { return sec1 > sec2; @@ -55,9 +55,9 @@ bool Util::Version::operator==(const Version &other) const const int size = qMax(m_sections.size(), other.m_sections.size()); for (int i = 0; i < size; ++i) { - const Section sec1 = (i >= m_sections.size()) ? Section("0", 0) : m_sections.at(i); + const Section sec1 = (i >= m_sections.size()) ? Section("0") : m_sections.at(i); const Section sec2 = - (i >= other.m_sections.size()) ? Section("0", 0) : other.m_sections.at(i); + (i >= other.m_sections.size()) ? Section("0") : other.m_sections.at(i); if (sec1 != sec2) { return false; @@ -79,16 +79,7 @@ void Util::Version::parse() for (const auto part : parts) { - bool ok = |
