diff options
42 files changed, 2112 insertions, 495 deletions
@@ -1,6 +1,9 @@ Thumbs.db .kdev4 MultiMC5.kdev4 +MultiMC.pro.user +CMakeLists.txt.user +.user build resources/CMakeFiles resources/MultiMCLauncher.jar diff --git a/CMakeLists.txt b/CMakeLists.txt index 05513f2c..984bbd05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.9) -project(multimc5) +project(MultiMC) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -17,6 +17,7 @@ include_directories(hacks) #### Find the required Qt parts #### find_package(Qt5Widgets) +find_package(Qt5Network) #find_package(Qt5Declarative) include_directories(${Qt5Widgets_INCLUDE_DIRS}) @@ -24,16 +25,6 @@ include_directories(${Qt5Widgets_INCLUDE_DIRS}) # find ZLIB for quazip find_package(ZLIB REQUIRED) -# Find boost. -set(Boost_USE_STATIC_LIBS ON) -MESSAGE(STATUS "** Finding Boost...") -find_package(Boost 1.46.0 REQUIRED) -MESSAGE(STATUS "** Boost Include: ${Boost_INCLUDE_DIR}") -MESSAGE(STATUS "** Boost Libraries: ${Boost_LIBRARY_DIRS}") - -# Include boost. -include_directories("${Boost_INCLUDE_DIRS}") - # Add quazip add_subdirectory(quazip) @@ -104,34 +95,48 @@ data/appsettings.cpp data/inifile.cpp data/instancebase.cpp data/instancemodel.cpp -data/settingsbase.cpp data/stdinstance.cpp +data/version.cpp +data/userinfo.cpp +data/loginresponse.cpp gui/mainwindow.cpp gui/modeditwindow.cpp gui/settingsdialog.cpp +gui/newinstancedialog.cpp +gui/logindialog.cpp +gui/taskdialog.cpp util/pathutils.cpp +util/osutils.cpp java/javautils.cpp java/annotations.cpp + +tasks/task.cpp +tasks/logintask.cpp ) SET(MULTIMC_HEADERS gui/mainwindow.h gui/modeditwindow.h gui/settingsdialog.h +gui/newinstancedialog.h +gui/logindialog.h +gui/taskdialog.h data/appsettings.h data/inifile.h data/instancebase.h data/instancemodel.h -data/settingsbase.h -data/settingsmacros.h -data/settingsmacrosundef.h data/stdinstance.h +data/version.h +data/userinfo.h +data/loginresponse.h +util/apputils.h util/pathutils.h +util/osutils.h multimc_pragma.h @@ -142,21 +147,75 @@ java/endian.h java/errors.h java/javautils.h java/membuffer.h + +tasks/task.h +tasks/logintask.h ) SET(MULTIMC5_UIS gui/mainwindow.ui gui/modeditwindow.ui gui/settingsdialog.ui +gui/newinstancedialog.ui +gui/logindialog.ui +gui/taskdialog.ui ) +IF(WIN32) +SET(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} +Ws2_32) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(resources/MultiMCLauncher.jar GENERATED) QT5_WRAP_UI(MULTIMC_UI ${MULTIMC5_UIS}) QT5_ADD_RESOURCES(MULTIMC_QRC multimc.qrc) -add_executable(multimc5 ${MULTIMC_SOURCES} ${MULTIMC_HEADERS} ${MULTIMC_UI} ${MULTIMC_QRC}) -qt5_use_modules(multimc5 Widgets) -target_link_libraries(multimc5 quazip patchlib) -add_dependencies(multimc5 MultiMCLauncher) -install(TARGETS multimc5 RUNTIME DESTINATION bin) +add_executable(MultiMC ${MULTIMC_SOURCES} ${MULTIMC_HEADERS} ${MULTIMC_UI} ${MULTIMC_QRC}) +qt5_use_modules(MultiMC Widgets Network) +target_link_libraries(MultiMC quazip patchlib ${MultiMC_LINK_ADDITIONAL_LIBS}) +add_dependencies(MultiMC MultiMCLauncher) +install(TARGETS MultiMC RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + +IF(WIN32) +IF(CMAKE_BUILD_TYPE STREQUAL "Debug") +SET(D "d") +ELSE() +SET(D "") +ENDIF() + +install(FILES "${Qt5_DIR}/plugins/platforms/qwindows${D}.dll" DESTINATION platforms) +install(FILES "${Qt5_DIR}/plugins/platforms/qminimal${D}.dll" DESTINATION platforms) +install(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION ${CMAKE_INSTALL_PREFIX}) + +install(FILES "${Qt5_DIR}/plugins/imageformats/qsvg${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qico${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qgif${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qjpeg${D}.dll" DESTINATION imageformats) + +ELSEIF(UNIX) +ENDIF() + + +GET_TARGET_PROPERTY(BINARY_LOCATION MultiMC LOCATION) +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake" + @ONLY + ) +INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake") + + +# Package with CPack +IF(UNIX) + if(APPLE) + SET(CPACK_GENERATOR "ZIP") + else() + SET(CPACK_GENERATOR "TGZ") + endif() +ELSEIF(WIN32) + SET(CPACK_GENERATOR "ZIP") +ENDIF() +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) +set(CPACK_PACKAGE_FILE_NAME "MultiMC") +INCLUDE(CPack) diff --git a/MultiMC.pro b/MultiMC.pro index 0ca6daee..3f480529 100644 --- a/MultiMC.pro +++ b/MultiMC.pro @@ -20,7 +20,8 @@ SOURCES += main.cpp\ data/stdinstance.cpp \ data/inifile.cpp \ gui/settingsdialog.cpp \ - gui/modeditwindow.cpp + gui/modeditwindow.cpp \ + util/appsettings.cpp HEADERS += gui/mainwindow.h \ data/instancebase.h \ @@ -29,7 +30,9 @@ HEADERS += gui/mainwindow.h \ data/stdinstance.h \ data/inifile.h \ gui/settingsdialog.h \ - gui/modeditwindow.h + gui/modeditwindow.h \ + util/apputils.h \ + util/appsettings.h FORMS += gui/mainwindow.ui \ gui/settingsdialog.ui \ diff --git a/MultiMC.pro.user b/MultiMC.pro.user deleted file mode 100644 index 21852a10..00000000 --- a/MultiMC.pro.user +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE QtCreatorProject> -<!-- Written by Qt Creator 2.6.1, 2013-01-15T19:01:37. --> -<qtcreator> - <data> - <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="int">0</value> - </data> - <data> - <variable>ProjectExplorer.Project.EditorSettings</variable> - <valuemap type="QVariantMap"> - <value type="bool" key="EditorConfiguration.AutoIndent">true</value> - <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> - <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> - <value type="QString" key="language">Cpp</value> - <valuemap type="QVariantMap" key="value"> - <value type="QString" key="CurrentPreferences">CppGlobal</value> - </valuemap> - </valuemap> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> - <value type="QString" key="language">QmlJS</value> - <valuemap type="QVariantMap" key="value"> - <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> - </valuemap> - </valuemap> - <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> - <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> - <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> - <value type="int" key="EditorConfiguration.IndentSize">4</value> - <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> - <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> - <value type="int" key="EditorConfiguration.PaddingMode">1</value> - <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> - <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value> - <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> - <value type="int" key="EditorConfiguration.TabKeyBehavior">1</value> - <value type="int" key="EditorConfiguration.TabSize">8</value> - <value type="bool" key="EditorConfiguration.UseGlobal">true</value> - <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> - <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> - <value type="bool" key="EditorConfiguration.cleanIndentation">false</value> - <value type="bool" key="EditorConfiguration.cleanWhitespace">false</value> - <value type="bool" key="EditorConfiguration.inEntireDocument">true</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.PluginSettings</variable> - <valuemap type="QVariantMap"/> - </data> - <data> - <variable>ProjectExplorer.Project.Target.0</variable> - <valuemap type="QVariantMap"> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.0.0 MSVC2010 32bit (SDK)</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.0.0 MSVC2010 32bit (SDK)</value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">qt.500.win32_msvc2010.essentials_kit</value> - <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> - <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> - <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> - <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/Users/Andrew/Projects/MultiMC5/MultiMC-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/Users/Andrew/Projects/MultiMC5/MultiMC-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> - <value type="bool" key="Analyzer.Project.UseGlobal">true</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> - <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> - <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> - <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> - <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> - <value type="int">0</value> - <value type="int">1</value> - <value type="int">2</value> - <value type="int">3</value> - <value type="int">4</value> - <value type="int">5</value> - <value type="int">6</value> - <value type="int">7</value> - <value type="int">8</value> - <value type="int">9</value> - <value type="int">10</value> - <value type="int">11</value> - <value type="int">12</value> - <value type="int">13</value> - <value type="int">14</value> - </valuelist> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MultiMC</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Andrew/Projects/MultiMC5/MultiMC/MultiMC.pro</value> - <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value> - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MultiMC.pro</value> - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> - <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> - <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> - <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.TargetCount</variable> - <value type="int">1</value> - </data> - <data> - <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> - <value type="QString">{d833f846-3a8b-4e2a-9d77-5f93cddd0a0f}</value> - </data> - <data> - <variable>ProjectExplorer.Project.Updater.FileVersion</variable> - <value type="int">12</value> - </data> -</qtcreator> diff --git a/data/appsettings.cpp b/data/appsettings.cpp index 525def6e..1d9c4312 100644 --- a/data/appsettings.cpp +++ b/data/appsettings.cpp @@ -15,8 +15,26 @@ #include "appsettings.h" -AppSettings::AppSettings(QString fileName) : - SettingsBase(fileName) +AppSettings* settings; + +SettingsBase::SettingsBase(QObject *parent) : + QObject(parent) +{ + +} + +AppSettings::AppSettings(QObject *parent) : + SettingsBase(parent) { } + +QVariant AppSettings::getValue(const QString& name, QVariant defVal) const +{ + return config.value(name, defVal); +} + +void AppSettings::setValue(const QString& name, QVariant val) +{ + config.setValue(name, val); +} diff --git a/data/appsettings.h b/data/appsettings.h index f8c7ff73..a9068bfd 100644 --- a/data/appsettings.h +++ b/data/appsettings.h @@ -16,12 +16,104 @@ #ifndef APPSETTINGS_H #define APPSETTINGS_H -#include "settingsbase.h" +#include <QObject> +#include <QSettings> +#include <QColor> +#include <QPoint> + +#include "util/apputils.h" +#include "util/osutils.h" + +#if WINDOWS +#define JPATHKEY "JavaPathWindows" +#elif OSX +#define JPATHKEY "JavaPathOSX" +#else +#define JPATHKEY "JavaPathLinux" +#endif + +#define DEFINE_SETTING_ADVANCED(funcName, name, valType, defVal) \ + virtual valType get ## funcName() const { return getValue(name, defVal).value<valType>(); } \ + virtual void set ## funcName(valType value) { setValue(name, value); } + +#define DEFINE_SETTING(name, valType, defVal) \ + DEFINE_SETTING_ADVANCED(name, STR_VAL(name), valType, defVal) + +#define DEFINE_OVERRIDE_SETTING(overrideName) \ + + +class SettingsBase : public QObject +{ + Q_OBJECT +public: + explicit SettingsBase(QObject *parent = 0); + + // Updates + DEFINE_SETTING(UseDevBuilds, bool, false) + DEFINE_SETTING(AutoUpdate, bool, true) + + // Folders + DEFINE_SETTING(InstanceDir, QString, "instances") + DEFINE_SETTING(CentralModsDir, QString, "mods") + DEFINE_SETTING(LWJGLDir, QString, "lwjgl") + + // Console + DEFINE_SETTING(ShowConsole, bool, true) + DEFINE_SETTING(AutoCloseConsole, bool, true) + + // Toolbar settings + DEFINE_SETTING(InstanceToolbarVisible, bool, true) + DEFINE_SETTING(InstanceToolbarPosition, QPoint, QPoint()) + + // Console Colors + DEFINE_SETTING(SysMessageColor, QColor, QColor(Qt::blue)) + DEFINE_SETTING(StdOutColor, QColor, QColor(Qt::black)) + DEFINE_SETTING(StdErrColor, QColor, QColor(Qt::red)) + + // Window Size + DEFINE_SETTING(LaunchCompatMode, bool, false) + DEFINE_SETTING(LaunchMaximized, bool, false) + DEFINE_SETTING(MinecraftWinWidth, int, 854) + DEFINE_SETTING(MinecraftWinHeight, int, 480) + + // Auto login + DEFINE_SETTING(AutoLogin, bool, false) + + // Memory + DEFINE_SETTING(MinMemAlloc, int, 512) + DEFINE_SETTING(MaxMemAlloc, int, 1024) + + // Java Settings + DEFINE_SETTING_ADVANCED(JavaPath, JPATHKEY, QString, "java") + DEFINE_SETTING(JvmArgs, QString, "") + + // Custom Commands + DEFINE_SETTING(PreLaunchCommand, QString, "") + DEFINE_SETTING(PostExitCommand, QString, "") + +protected: + virtual QVariant getValue(const QString& name, QVariant defVal = QVariant()) const = 0; + virtual void setValue(const QString& name, QVariant val) = 0; +}; class AppSettings : public SettingsBase { + Q_OBJECT public: - AppSettings(QString fileName); + explicit AppSettings(QObject *parent = 0); + + QSettings& getConfig() { return config; } + +protected: + virtual QVariant getValue(const QString &name, QVariant defVal = QVariant()) const; + virtual void setValue(const QString& name, QVariant val); + + QSettings config; }; +#undef DEFINE_SETTING_ADVANCED +#undef DEFINE_SETTING + +extern AppSettings* settings; + #endif // APPSETTINGS_H diff --git a/data/instancemodel.cpp b/data/instancemodel.cpp index 44d2844b..0f1e59f6 100644 --- a/data/instancemodel.cpp +++ b/data/instancemodel.cpp @@ -16,15 +16,18 @@ #include "instancemodel.h" #include <QString> + #include <QDir> +#include <QFile> #include <QDirIterator> -#include "stdinstance.h" - -#include "../util/pathutils.h" +#include <QTextStream> |
