aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-27 22:31:07 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-02 00:14:06 +0200
commit791221e923586bb717396ecf18bd13e57034df99 (patch)
tree9f608af07375b38626c8964671620477158341ba
parent593111b14463e9d5d08256061b981b5ab1cfb710 (diff)
downloadPrismLauncher-791221e923586bb717396ecf18bd13e57034df99.tar.gz
PrismLauncher-791221e923586bb717396ecf18bd13e57034df99.tar.bz2
PrismLauncher-791221e923586bb717396ecf18bd13e57034df99.zip
NOISSUE Refactors and moving of things
-rw-r--r--CMakeLists.txt38
-rw-r--r--MultiMC.cpp21
-rw-r--r--MultiMC.h7
-rw-r--r--depends/util/include/modutils.h68
-rw-r--r--depends/util/src/modutils.cpp23
-rw-r--r--gui/ConsoleWindow.cpp18
-rw-r--r--gui/ConsoleWindow.h6
-rw-r--r--gui/MainWindow.cpp273
-rw-r--r--gui/MainWindow.h8
-rw-r--r--gui/dialogs/AboutDialog.cpp2
-rw-r--r--gui/pages/LogPage.cpp4
-rw-r--r--gui/pages/LogPage.h6
-rw-r--r--gui/pages/ModFolderPage.cpp4
-rw-r--r--gui/pages/OtherLogsPage.cpp14
-rw-r--r--gui/pages/OtherLogsPage.h6
-rw-r--r--gui/pages/ResourcePackPage.h2
-rw-r--r--gui/pages/ScreenshotsPage.cpp4
-rw-r--r--gui/pages/ScreenshotsPage.h2
-rw-r--r--gui/pages/TexturePackPage.h2
-rw-r--r--gui/pages/VersionPage.cpp70
-rw-r--r--gui/pages/VersionPage.h4
-rw-r--r--logic/BaseInstance.cpp24
-rw-r--r--logic/BaseInstance.h40
-rw-r--r--logic/BaseProcess.cpp (renamed from logic/MinecraftProcess.cpp)272
-rw-r--r--logic/BaseProcess.h (renamed from logic/MinecraftProcess.h)110
-rw-r--r--logic/InstanceFactory.cpp43
-rw-r--r--logic/InstanceFactory.h8
-rw-r--r--logic/InstanceList.cpp9
-rw-r--r--logic/InstanceList.h3
-rw-r--r--logic/JarUtils.cpp3
-rw-r--r--logic/LegacyInstance.cpp28
-rw-r--r--logic/LegacyInstance.h31
-rw-r--r--logic/LegacyUpdate.cpp8
-rw-r--r--logic/LegacyUpdate.h2
-rw-r--r--logic/OneSixInstance.cpp240
-rw-r--r--logic/OneSixInstance.h47
-rw-r--r--logic/OneSixUpdate.cpp28
-rw-r--r--logic/OneSixUpdate.h2
-rw-r--r--logic/assets/AssetsMigrateTask.cpp2
-rw-r--r--logic/assets/AssetsUtils.cpp62
-rw-r--r--logic/assets/AssetsUtils.h2
-rw-r--r--logic/forge/ForgeInstaller.cpp21
-rw-r--r--logic/forge/ForgeInstaller.h5
-rw-r--r--logic/forge/ForgeVersion.cpp2
-rw-r--r--logic/ftb/FTBVersion.h32
-rw-r--r--logic/ftb/LegacyFTBInstance.cpp (renamed from logic/LegacyFTBInstance.cpp)0
-rw-r--r--logic/ftb/LegacyFTBInstance.h (renamed from logic/LegacyFTBInstance.h)2
-rw-r--r--logic/ftb/OneSixFTBInstance.cpp (renamed from logic/OneSixFTBInstance.cpp)10
-rw-r--r--logic/ftb/OneSixFTBInstance.h (renamed from logic/OneSixFTBInstance.h)3
-rw-r--r--logic/liteloader/LiteLoaderInstaller.cpp4
-rw-r--r--logic/minecraft/JarMod.cpp34
-rw-r--r--logic/minecraft/JarMod.h4
-rw-r--r--logic/minecraft/MinecraftInstance.cpp58
-rw-r--r--logic/minecraft/MinecraftInstance.h30
-rw-r--r--logic/minecraft/MinecraftProcess.cpp216
-rw-r--r--logic/minecraft/MinecraftProcess.h77
-rw-r--r--logic/minecraft/MinecraftProfile.cpp (renamed from logic/minecraft/InstanceVersion.cpp)282
-rw-r--r--logic/minecraft/MinecraftProfile.h (renamed from logic/minecraft/InstanceVersion.h)113
-rw-r--r--logic/minecraft/MinecraftVersion.cpp18
-rw-r--r--logic/minecraft/MinecraftVersion.h20
-rw-r--r--logic/minecraft/MinecraftVersionList.cpp65
-rw-r--r--logic/minecraft/MinecraftVersionList.h40
-rw-r--r--logic/minecraft/NullProfileStrategy.h24
-rw-r--r--logic/minecraft/OneSixLibrary.cpp4
-rw-r--r--logic/minecraft/OneSixProfileStrategy.cpp270
-rw-r--r--logic/minecraft/OneSixProfileStrategy.h24
-rw-r--r--logic/minecraft/ProfilePatch.h (renamed from logic/minecraft/VersionPatch.h)16
-rw-r--r--logic/minecraft/ProfileStrategy.h30
-rw-r--r--logic/minecraft/ProfileUtils.cpp145
-rw-r--r--logic/minecraft/ProfileUtils.h25
-rw-r--r--logic/minecraft/VersionBuilder.cpp296
-rw-r--r--logic/minecraft/VersionBuilder.h27
-rw-r--r--logic/minecraft/VersionFile.cpp7
-rw-r--r--logic/minecraft/VersionFile.h8
-rw-r--r--logic/minecraft/VersionFilterData.cpp (renamed from logic/VersionFilterData.cpp)2
-rw-r--r--logic/minecraft/VersionFilterData.h (renamed from logic/VersionFilterData.h)0
-rw-r--r--logic/net/PasteUpload.cpp2
-rw-r--r--logic/tools/BaseExternalTool.cpp25
-rw-r--r--logic/tools/BaseExternalTool.h2
-rw-r--r--logic/tools/BaseProfiler.cpp2
-rw-r--r--logic/tools/BaseProfiler.h6
-rw-r--r--logic/tools/JProfiler.cpp4
-rw-r--r--logic/tools/JProfiler.h2
-rw-r--r--logic/tools/JVisualVM.cpp4
-rw-r--r--logic/tools/JVisualVM.h2
-rw-r--r--logic/tools/MCEditTool.cpp33
-rw-r--r--logic/tools/MCEditTool.h1
-rw-r--r--main.cpp1
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)
diff --git a/MultiMC.h b/MultiMC.h
index bce8a53b..02daed17 100644
--- a/MultiMC.h
+++ b/MultiMC.h
@@ -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 =