aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt177
-rw-r--r--MultiMC.cpp129
-rw-r--r--MultiMC.h5
-rw-r--r--MultiMCVersion.h79
-rw-r--r--changelog.yaml17
-rw-r--r--config.h.in12
-rw-r--r--depends/javacheck/CMakeLists.txt5
-rw-r--r--depends/launcher/CMakeLists.txt3
-rw-r--r--generated.qrc.in2
-rw-r--r--gui/ConsoleWindow.cpp118
-rw-r--r--gui/ConsoleWindow.h6
-rw-r--r--gui/MainWindow.cpp43
-rw-r--r--gui/MainWindow.h2
-rw-r--r--gui/dialogs/AboutDialog.cpp17
-rw-r--r--gui/dialogs/AboutDialog.ui109
-rw-r--r--gui/dialogs/SettingsDialog.cpp37
-rw-r--r--gui/dialogs/SettingsDialog.h1
-rw-r--r--gui/dialogs/SettingsDialog.ui165
-rw-r--r--logic/JavaChecker.cpp18
-rw-r--r--logic/JavaChecker.h4
-rw-r--r--logic/JavaCheckerJob.cpp6
-rw-r--r--logic/LegacyInstance.cpp6
-rw-r--r--logic/lists/JavaVersionList.cpp4
-rw-r--r--logic/updater/NotificationChecker.cpp11
-rw-r--r--logic/updater/NotificationChecker.h2
-rw-r--r--logic/updater/UpdateChecker.cpp4
26 files changed, 713 insertions, 269 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a9bd32c..274e4155 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,9 +38,7 @@ ELSEIF(MINGW)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
ENDIF()
-################################ INCLUDE LIBRARIES ################################
-
-######## 3rd Party Libs ########
+################################ 3rd Party Libs ################################
# Find the required Qt parts
find_package(Qt5Core REQUIRED)
@@ -75,41 +73,6 @@ query_qmake(QT_HOST_DATA QT_DATA_DIR)
set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs)
-######## Included Libs ########
-
-# Add quazip
-add_subdirectory(depends/quazip)
-include_directories(depends/quazip)
-
-# Add the java launcher and checker
-add_subdirectory(depends/launcher)
-add_subdirectory(depends/javacheck)
-
-# Add xz decompression
-add_subdirectory(depends/xz-embedded)
-include_directories(${XZ_INCLUDE_DIR})
-
-# Add pack200 decompression
-add_subdirectory(depends/pack200)
-include_directories(${PACK200_INCLUDE_DIR})
-
-######## MultiMC Libs ########
-
-# Add the util library.
-add_subdirectory(depends/util)
-include_directories(${LIBUTIL_INCLUDE_DIR})
-
-# Add the settings library.
-add_subdirectory(depends/settings)
-include_directories(${LIBSETTINGS_INCLUDE_DIR})
-
-# Add the group view library.
-add_subdirectory(depends/groupview)
-include_directories(${LIBGROUPVIEW_INCLUDE_DIR})
-
-# Add the updater
-add_subdirectory(mmc_updater)
-
################################ SET UP BUILD OPTIONS ################################
######## Check endianness ########
@@ -127,13 +90,17 @@ SET(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch
######## Set version numbers ########
SET(MultiMC_VERSION_MAJOR 0)
-SET(MultiMC_VERSION_MINOR 0)
+SET(MultiMC_VERSION_MINOR 1)
+SET(MultiMC_VERSION_HOTFIX 0)
# Build number
SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
-# Build type
-SET(MultiMC_VERSION_BUILD_TYPE "custombuild" CACHE STRING "Build type. If this is set, it is appended to the end of the version string with a dash (<version string>-<build type>. It is not used for anything other than indicating in the version string what type of build this is (eg 'lin64').")
+# Version type
+SET(MultiMC_VERSION_TYPE "Custom" CACHE STRING "MultiMC's version type. This should be one of 'Custom', 'Release', 'ReleaseCandidate', or 'Development', depending on what type of version this is.")
+
+# Build platform.
+SET(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.")
# Version channel
SET(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.")
@@ -147,19 +114,29 @@ SET(MultiMC_UPDATER false CACHE BOOL "Whether or not the update system is enable
# Notification URL
SET(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
+SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}")
+IF (MultiMC_VERSION_HOTFIX GREATER 0)
+ SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_RELEASE_VERSION_NAME}.${MultiMC_VERSION_HOTFIX}")
+ENDIF()
+
# Build a version string to display in the configure logs.
-SET(MultiMC_VERSION_STRING "5.${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}")
-IF (MultiMC_VERSION_BUILD GREATER -1)
- SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}.${MultiMC_VERSION_BUILD}")
-ENDIF ()
-IF (NOT MultiMC_VERSION_CHANNEL STREQUAL "")
- SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_CHANNEL}")
-ENDIF ()
-IF (NOT MultiMC_VERSION_BUILD_TYPE STREQUAL "")
- SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_BUILD_TYPE}")
+IF (MultiMC_VERSION_TYPE STREQUAL "Custom")
+ MESSAGE(STATUS "Version Type: Custom")
+ SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}")
+ELSEIF (MultiMC_VERSION_TYPE STREQUAL "Release")
+ MESSAGE(STATUS "Version Type: Stable Release")
+ SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}")
+ELSEIF (MultiMC_VERSION_TYPE STREQUAL "ReleaseCandidate")
+ MESSAGE(STATUS "Version Type: Release Candidate")
+ SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-rc${MultiMC_VERSION_BUILD}")
+ELSEIF (MultiMC_VERSION_TYPE STREQUAL "Development")
+ MESSAGE(STATUS "Version Type: Development")
+ SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-dev${MultiMC_VERSION_BUILD}")
+ELSE ()
+ MESSAGE(ERROR "Invalid build type.")
ENDIF ()
-MESSAGE(STATUS "MultiMC 5 version ${MultiMC_VERSION_STRING}")
+MESSAGE(STATUS "MultiMC 5 Version: ${MultiMC_VERSION_STRING}")
# If the update system is enabled, make sure MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL are set.
IF (MultiMC_UPDATER)
@@ -209,6 +186,72 @@ ADD_DEFINITIONS(-DLIBSETTINGS_STATIC)
ADD_DEFINITIONS(-DLIBUTIL_STATIC)
ADD_DEFINITIONS(-DLIBGROUPVIEW_STATIC)
+######## Packaging/install paths setup ########
+
+IF(UNIX AND APPLE)
+ SET(BINARY_DEST_DIR MultiMC.app/Contents/MacOS)
+ SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS)
+ SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
+
+ SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC")
+ SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.")
+ SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.multimc.MultiMC5")
+ SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns)
+ SET(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 MultiMC Contributors")
+ELSEIF(UNIX)
+ SET(BINARY_DEST_DIR bin)
+ SET(PLUGIN_DEST_DIR plugins)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
+ELSEIF(WIN32)
+ SET(BINARY_DEST_DIR .)
+ SET(PLUGIN_DEST_DIR .)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
+ENDIF()
+
+# directories to look for dependencies
+SET(DIRS "${QT_LIBS_DIR}")
+
+################################ Included Libs ################################
+
+# Add quazip
+add_subdirectory(depends/quazip)
+include_directories(depends/quazip)
+
+# Add the java launcher and checker
+add_subdirectory(depends/launcher)
+add_subdirectory(depends/javacheck)
+
+# Add xz decompression
+add_subdirectory(depends/xz-embedded)
+include_directories(${XZ_INCLUDE_DIR})
+
+# Add pack200 decompression
+add_subdirectory(depends/pack200)
+include_directories(${PACK200_INCLUDE_DIR})
+
+######## MultiMC Libs ########
+
+# Add the util library.
+add_subdirectory(depends/util)
+include_directories(${LIBUTIL_INCLUDE_DIR})
+
+# Add the settings library.
+add_subdirectory(depends/settings)
+include_directories(${LIBSETTINGS_INCLUDE_DIR})
+
+# Add the group view library.
+add_subdirectory(depends/groupview)
+include_directories(${LIBGROUPVIEW_INCLUDE_DIR})
+
+# Add the updater
+add_subdirectory(mmc_updater)
+
################################ FILES ################################
######## Sources and headers ########
@@ -516,8 +559,8 @@ IF(MultiMC_CODE_COVERAGE)
ENDIF(MultiMC_CODE_COVERAGE)
# Tell CMake that MultiMCLauncher.jar is generated.
-SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/launcher/MultiMCLauncher.jar GENERATED)
-SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/javacheck/JavaCheck.jar GENERATED)
+#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/launcher/MultiMCLauncher.jar GENERATED)
+#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/javacheck/JavaCheck.jar GENERATED)
# Qt 5 stuff
QT5_WRAP_UI(MULTIMC_UI ${MULTIMC_UIS})
@@ -540,34 +583,6 @@ ADD_DEPENDENCIES(MultiMC_common MultiMCLauncher JavaCheck)
################################ INSTALLATION AND PACKAGING ################################
-######## Packaging/install paths setup ########
-
-IF(UNIX AND APPLE)
- SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS)
- SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
-
- SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC")
- SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.")
- SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.multimc.MultiMC5")
- SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
- SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
- SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
- SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns)
- SET(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 MultiMC Contributors")
-ELSEIF(UNIX)
- SET(PLUGIN_DEST_DIR plugins)
- SET(QTCONF_DEST_DIR .)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
-ELSEIF(WIN32)
- SET(PLUGIN_DEST_DIR .)
- SET(QTCONF_DEST_DIR .)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
-ENDIF()
-
-# directories to look for dependencies
-SET(DIRS "${QT_LIBS_DIR}")
-
######## Install ########
#### Executable ####
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 297d08fd..17fc2e0a 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -38,8 +38,8 @@
using namespace Util::Commandline;
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
- : QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD,
- VERSION_CHANNEL, VERSION_BUILD_TYPE}
+ : QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX,
+ VERSION_BUILD, MultiMCVersion::VERSION_TYPE, VERSION_CHANNEL, BUILD_PLATFORM}
{
setOrganizationName("MultiMC");
setApplicationName("MultiMC5");
@@ -198,56 +198,12 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
// init the http meta cache
initHttpMetaCache();
- // set up a basic autodetected proxy (system default)
- QNetworkProxyFactory::setUseSystemConfiguration(true);
-
- QLOG_INFO() << "Detecting system proxy settings...";
- auto proxies = QNetworkProxyFactory::systemProxyForQuery();
- if (proxies.size() == 1 && proxies[0].type() == QNetworkProxy::NoProxy)
- {
- QLOG_INFO() << "No proxy found.";
- }
- else
- for (auto proxy : proxies)
- {
- QString proxyDesc;
- if (proxy.type() == QNetworkProxy::NoProxy)
- {
- QLOG_INFO() << "Using no proxy is an option!";
- continue;
- }
- switch (proxy.type())
- {
- case QNetworkProxy::DefaultProxy:
- proxyDesc = "Default proxy: ";
- break;
- case QNetworkProxy::Socks5Proxy:
- proxyDesc = "Socks5 proxy: ";
- break;
- case QNetworkProxy::HttpProxy:
- proxyDesc = "HTTP proxy: ";
- break;
- case QNetworkProxy::HttpCachingProxy:
- proxyDesc = "HTTP caching: ";
- break;
- case QNetworkProxy::FtpCachingProxy:
- proxyDesc = "FTP caching: ";
- break;
- default:
- proxyDesc = "DERP proxy: ";
- break;
- }
- proxyDesc += QString("%3@%1:%2 pass %4")
- .arg(proxy.hostName())
- .arg(proxy.port())
- .arg(proxy.user())
- .arg(proxy.password());
- QLOG_INFO() << proxyDesc;
- }
-
// create the global network manager
m_qnam.reset(new QNetworkAccessManager(this));
+ // init proxy settings
+ updateProxySettings();
+
// launch instance, if that's what should be done
// WARNING: disabled until further notice
/*
@@ -424,6 +380,13 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting({"MinecraftWinWidth", "MCWindowWidth"}, 854);
m_settings->registerSetting({"MinecraftWinHeight", "MCWindowHeight"}, 480);
+ // Proxy Settings
+ m_settings->registerSetting("ProxyType", "Default");
+ m_settings->registerSetting({"ProxyAddr", "ProxyHostName"}, "127.0.0.1");
+ m_settings->registerSetting("ProxyPort", 8080);
+ m_settings->registerSetting({"ProxyUser", "ProxyUsername"}, "");
+ m_settings->registerSetting({"ProxyPass", "ProxyPassword"}, "");
+
// Memory
m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512);
m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 1024);
@@ -467,6 +430,74 @@ void MultiMC::initHttpMetaCache()
m_metacache->Load();
}
+void MultiMC::updateProxySettings()
+{
+ QString proxyTypeStr = settings()->get("ProxyType").toString();
+
+ // Get the proxy settings from the settings object.
+ QString addr = settings()->get("ProxyAddr").toString();
+ int port = settings()->get("ProxyPort").value<qint16>();
+ QString user = settings()->get("ProxyUser").toString();
+ QString pass = settings()->get("ProxyPass").toString();
+
+ // Set the application proxy settings.
+ if (proxyTypeStr == "SOCKS5")
+ {
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, addr, port, user, pass));
+ }
+ else if (proxyTypeStr == "HTTP")
+ {
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, addr, port, user, pass));
+ }
+ else if (proxyTypeStr == "None")
+ {
+ // If we have no proxy set, set no proxy and return.
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
+ }
+ else
+ {
+ // If we have "Default" selected, set Qt to use the system proxy settings.
+ QNetworkProxyFactory::setUseSystemConfiguration(true);
+ }
+
+ QLOG_INFO() << "Detecting proxy settings...";
+ QNetworkProxy proxy = QNetworkProxy::applicationProxy();
+ if (m_qnam.get()) m_qnam->setProxy(proxy);
+ QString proxyDesc;
+ if (proxy.type() == QNetworkProxy::NoProxy)
+ {
+ QLOG_INFO() << "Using no proxy is an option!";
+ return;
+ }
+ switch (proxy.type())
+ {
+ case QNetworkProxy::DefaultProxy:
+ proxyDesc = "Default proxy: ";
+ break;
+ case QNetworkProxy::Socks5Proxy:
+ proxyDesc = "Socks5 proxy: ";
+ break;
+ case QNetworkProxy::HttpProxy:
+ proxyDesc = "HTTP proxy: ";
+ break;
+ case QNetworkProxy::HttpCachingProxy:
+ proxyDesc = "HTTP caching: ";
+ break;
+ case QNetworkProxy::FtpCachingProxy:
+ proxyDesc = "FTP caching: ";
+ break;
+ default:
+ proxyDesc = "DERP proxy: ";
+ break;
+ }
+ proxyDesc += QString("%3@%1:%2 pass %4")
+ .arg(proxy.hostName())
+ .arg(proxy.port())
+ .arg(proxy.user())
+ .arg(proxy.password());
+ QLOG_INFO() << proxyDesc;
+}
+
std::shared_ptr<IconList> MultiMC::icons()
{
if (!m_icons)
diff --git a/MultiMC.h b/MultiMC.h
index d02099f3..18c7aab7 100644
--- a/MultiMC.h
+++ b/MultiMC.h
@@ -124,6 +124,11 @@ public:
void installUpdates(const QString updateFilesDir, UpdateFlags flags = None);
/*!
+ * Updates the application proxy settings from the settings object.
+ */
+ void updateProxySettings();
+
+ /*!
* Opens a json file using either a system default editor, or, if note empty, the editor
* specified in the settings
*/
diff --git a/MultiMCVersion.h b/MultiMCVersion.h
index 75e017df..811b9076 100644
--- a/MultiMCVersion.h
+++ b/MultiMCVersion.h
@@ -18,58 +18,79 @@
#include <QString>
/*!
- * \brief The Version class represents a MultiMC version number.
+ * \brief The Version class represents a MultiMC version.
*/
struct MultiMCVersion
{
+ enum Type
+ {
+ //! Version type for stable release builds.
+ Release,
+
+ //! Version type for release candidates.
+ ReleaseCandidate,
+
+ //! Version type for development builds.
+ Development,
+
+ //! Version type for custom builds. This is the default when no version type is specified.
+ Custom
+ };
+
/*!
* \brief Converts the Version to a string.
* \return The version number in string format (major.minor.revision.build).
*/
QString toString() const
{
- QString vstr = QString("5.%1.%2").arg(
+ QString vstr = QString("%1.%2").arg(
QString::number(major),
QString::number(minor));
- if (build >= 0) vstr += "." + QString::number(build);
- if (!channel.isEmpty()) vstr += "-" + channel;
- if (!buildType.isEmpty()) vstr += "-" + buildType;
+ if (hotfix > 0) vstr += "." + QString::number(hotfix);
+
+ // If the build is a development build or release candidate, add that info to the end.
+ if (type == Development) vstr += "-dev" + QString::number(build);
+ else if (type == ReleaseCandidate) vstr += "-rc" + QString::number(build);
return vstr;
}
- /*!
- * \brief The major version number.
- * This is no longer going to always be 5 for MultiMC 5. Doing so is useless.
- * Instead, we'll be starting major off at 1 and incrementing it with every major feature.
- */
+ QString typeName() const
+ {
+ switch (type)
+ {
+ case Release:
+ return "Stable Release";
+ case ReleaseCandidate:
+ return "Release Candidate";
+ case Development:
+ return "Development";
+ case Custom:
+ default:
+ return "Custom";
+ }
+ }
+
+ //! The major version number.
int major;
- /*!
- * \brief The minor version number.
- * This number is incremented for major features and bug fixes.
- */
+ //! The minor version number.
int minor;
- /*!
- * \brief The build number.
- * This number is automatically set by Buildbot it is set to the build number of the buildbot
- * build that this build came from.
- * If this build didn't come from buildbot and no build number was given to CMake, this will default
- * to -1, causing it to not show in this version's string representation.
- */
+ //! The hotfix number.
+ int hotfix;
+
+ //! The build number.
int build;
- /*!
- * \brief This build's channel.
- */
+ //! The build type.
+ Type type;
+
+ //! The build channel.
QString channel;
- /*!
- * \brief The build type.
- * This indicates the type of build that this is. For example, lin64 or custombuild.
- */
- QString buildType;
+ //! A short string identifying the platform that this version is for. For example, lin64 or win32.
+ QString platform;
};
diff --git a/changelog.yaml b/changelog.yaml
new file mode 100644
index 00000000..0e41abdd
--- /dev/null
+++ b/changelog.yaml
@@ -0,0 +1,17 @@
+#
+# This is MultiMC's changelog. It is formatted in YAML.
+#
+# Each key below represents a release version name. Each release key has several string entries under it, each containing information about a single change. Each of these entries may contain Markdown for formatting.
+#
+
+0.0:
+ - Initial release.
+0.1:
+ - Reworked the version numbering system to support our [new Git workflow](http://nvie.com/posts/a-successful-git-branching-model/).
+ - Added a tray icon for the console window.
+ - Fixed instances getting deselected after FTB instances are loaded (or whenever the model is reset).
+ - Implemented proxy settings.
+ - Fixed sorting of Java installations in the Java list.
+ - Jar files are now distributed separately, rather than being extracted from the binary at runtime.
+ - Added additional information to the about dialog.
+
diff --git a/config.h.in b/config.h.in
index 8df1fc75..16e9f54e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,13 +1,17 @@
#pragma once
-// Minor and major version, used to communicate changes to users.
+// Version information
#define VERSION_MAJOR @MultiMC_VERSION_MAJOR@
#define VERSION_MINOR @MultiMC_VERSION_MINOR@
-
-// Build number, channel, and type -- number and channel are used by the updater, type is purely visual
+#define VERSION_HOTFIX @MultiMC_VERSION_HOTFIX@
#define VERSION_BUILD @MultiMC_VERSION_BUILD@
+#define VERSION_TYPE @MultiMC_VERSION_TYPE@
+
+// The version channel. This is used by the updater to determine what channel the current version came from.
#define VERSION_CHANNEL "@MultiMC_VERSION_CHANNEL@"
-#define VERSION_BUILD_TYPE "@MultiMC_VERSION_BUILD_TYPE@"
+
+// A short string identifying this build's platform. For example, "lin64" or "win32".
+#define BUILD_PLATFORM "@MultiMC_BUILD_PLATFORM@"
// URL for the updater's channel
#define CHANLIST_URL "@MultiMC_CHANLIST_URL@"
diff --git a/depends/javacheck/CMakeLists.txt b/depends/javacheck/CMakeLists.txt
index e72c9552..10b9a716 100644
--- a/depends/javacheck/CMakeLists.txt
+++ b/depends/javacheck/CMakeLists.txt
@@ -5,10 +5,11 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development)
include(UseJava)
set(CMAKE_JAVA_JAR_ENTRY_POINT JavaCheck)
set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked)
-#set(CMAKE_JAVA_TARGET_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/../../resources")
set(SRC
JavaCheck.java
)
-add_jar(JavaCheck ${SRC}) \ No newline at end of file
+add_jar(JavaCheck ${SRC})
+
+INSTALL_JAR(JavaCheck "${BINARY_DEST_DIR}/jars")
diff --git a/depends/launcher/CMakeLists.txt b/depends/launcher/CMakeLists.txt
index e91d5bd6..729ebb67 100644
--- a/depends/launcher/CMakeLists.txt
+++ b/depends/launcher/CMakeLists.txt
@@ -5,7 +5,6 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development)
include(UseJava)
set(CMAKE_JAVA_JAR_ENTRY_POINT MultiMCLauncher)
set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked)
-#set(CMAKE_JAVA_TARGET_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/../../resources")
set(SRC
MultiMCLauncher.java
@@ -19,3 +18,5 @@ set(SRC
)
add_jar(MultiMCLauncher ${SRC})
+
+INSTALL_JAR(MultiMCLauncher "${BINARY_DEST_DIR}/jars")
diff --git a/generated.qrc.in b/generated.qrc.in
index 82f4db99..794943eb 100644
--- a/generated.qrc.in
+++ b/generated.qrc.in
@@ -1,6 +1,8 @@
<RCC>
+<!--
<qresource prefix="/java">
<file alias="launcher.jar">@MMC_BIN@/depends/launcher/MultiMCLauncher.jar</file>
<file alias="checker.jar">@MMC_BIN@/depends/javacheck/JavaCheck.jar</file>
</qresource>
+-->
</RCC>
diff --git a/gui/ConsoleWindow.cpp b/gui/ConsoleWindow.cpp
index e640d261..84a141ce 100644
--- a/gui/ConsoleWindow.cpp
+++ b/gui/ConsoleWindow.cpp
@@ -19,12 +19,14 @@
#include <QScrollBar>
#include <QMessageBox>
+#include <QSystemTrayIcon>
#include <gui/Platform.h>
#include <gui/dialogs/CustomMessageBox.h>
#include <gui/dialogs/ProgressDialog.h>
#include "logic/net/PasteUpload.h"
+#include "logic/icons/IconList.h"
ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent)
: QMainWindow(parent), ui(new Ui::ConsoleWindow), proc(mcproc)
@@ -35,14 +37,28 @@ ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent)
SLOT(write(QString, MessageLevel::Enum)));
connect(mcproc, SIGNAL(ended(BaseInstance *, int, QProcess::ExitStatus)), this,
SLOT(onEnded(BaseInstance *, int, QProcess::ExitStatus)));
- connect(mcproc, SIGNAL(prelaunch_failed(BaseInstance*,int,QProcess::ExitStatus)), this,
+ connect(mcproc, SIGNAL(prelaunch_failed(BaseInstance *, int, QProcess::ExitStatus)), this,
SLOT(onEnded(BaseInstance *, int, QProcess::ExitStatus)));
- connect(mcproc, SIGNAL(launch_failed(BaseInstance*)), this,
- SLOT(onLaunchFailed(BaseInstance*)));
+ connect(mcproc, SIGNAL(launch_failed(BaseInstance *)), this,
+ SLOT(onLaunchFailed(BaseInstance *)));
- restoreState(QByteArray::fromBase64(MMC->settings()->get("ConsoleWindowState").toByteArray()));
- restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("ConsoleWindowGeometry").toByteArray()));
+ restoreState(
+ QByteArray::fromBase64(MMC->settings()->get("ConsoleWindowState").toByteArray()));
+ restoreGeometry(
+ QByteArray::fromBase64(MMC->settings()->get("ConsoleWindowGeometry").toByteArray()));
+ QString iconKey = proc->instance()->iconKey();
+ QString name = proc->instance()->name();
+ auto icon = MMC->icons()->getIcon(iconKey);
+ setWindowIcon(icon);
+ m_trayIcon = new QSystemTrayIcon(icon, this);
+ QString consoleTitle = tr("Console window for ") + name;
+ m_trayIcon->setToolTip(consoleTitle);
+ setWindowTitle(consoleTitle);
+
+ connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
+ m_trayIcon->show();
if (mcproc->instance()->settings().get("ShowConsole").toBool())
{
show();
@@ -55,13 +71,26 @@ ConsoleWindow::~ConsoleWindow()
delete ui;
}
+void ConsoleWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ switch (reason)
+ {
+ case QSystemTrayIcon::Trigger:
+ {
+ toggleConsole();
+ }
+ default:
+ return;
+ }
+}
+
void ConsoleWindow::writeColor(QString text, const char *color)
{
// append a paragraph
QString newtext;
newtext += "<span style=\"";
{
- if(color)
+ if (color)
newtext += QString("color:") + color + ";";
newtext += "font-family: monospace;";
}
@@ -76,16 +105,17 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode)
QScrollBar *bar = ui->text->verticalScrollBar();
int max_bar = bar->maximum();
int val_bar = bar->value();
- if(m_scroll_active)
- {
- if(m_last_scroll_value > val_bar)
- m_scroll_active = false;
- }
- else
+ if(isVisible())
{
- m_scroll_active = val_bar == max_bar;
+ if (m_scroll_active)
+ {
+ m_scroll_active = (max_bar - val_bar) <= 1;
+ }
+ else
+ {
+ m_scroll_active = val_bar == max_bar;
+ }
}
-
if (data.endsWith('\n'))
data = data.left(data.length() - 1);
QStringList paragraphs = data.split('\n');
@@ -114,11 +144,14 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode)
else
while (iter.hasNext())
writeColor(iter.next());
- if(m_scroll_active)
+ if(isVisible())
{
- bar->setValue(bar->maximum());
+ if (m_scroll_active)
+ {
+ bar->setValue(bar->maximum());
+ }
+ m_last_scroll_value = bar->value();
}
- m_last_scroll_value = bar->value();
}
void ConsoleWindow::clear()
@@ -134,22 +167,45 @@ void ConsoleWindow::on_closeButton_clicked()
void ConsoleWindow::setMayClose(bool mayclose)
{
m_mayclose = mayclose;
- if (mayclose)
- ui->closeButton->setEnabled(true);
+}
+
+void ConsoleWindow::toggleConsole()
+{
+ QScrollBar *bar = ui->text->verticalScrollBar();
+ if (isVisible())
+ {
+ int max_bar = bar->maximum();
+ int val_bar = m_last_scroll_value = bar->value();
+ m_scroll_active = (max_bar - val_bar) <= 1;
+ hide();
+ }
else
- ui->closeButton->setEnabled(false);
+ {
+ show();
+ if (m_scroll_active)
+ {
+ bar->setValue(bar->maximum());
+ }
+ else
+ {
+ bar->setValue(m_last_scroll_value);
+ }
+ }
}
void ConsoleWindow::closeEvent(QCloseEvent *event)
{
if (!m_mayclose)
- event->ignore();
+ {
+ toggleConsole();
+ }
else
{
MMC->settings()->set("ConsoleWindowState", saveState().toBase64());
MMC->settings()->set("ConsoleWindowGeometry", saveGeometry().toBase64());
emit isClosing();
+ m_trayIcon->hide();
QMainWindow::closeEvent(event);
}
}
@@ -170,19 +226,26 @@ void ConsoleWindow::on_btnKillMinecraft_clicked()
void ConsoleWindow::onEnded(BaseInstance *instance, int code, QProcess::ExitStatus status)
{
+ bool peacefulExit = code == 0 && status != QProcess::CrashExit;
ui->btnKillMinecraft->setEnabled(false);
setMayClose(true);
if (instance->settings().get("AutoCloseConsole").toBool())
{
- if (code == 0 && status != QProcess::CrashExit)
+ if (peacefulExit)
{
this->close();
return;
}
}
- if(!isVisible())
+ /*
+ if(!peacefulExit)
+ {
+ m_trayIcon->showMessage(tr("Oh no!"), tr("Minecraft crashed!"), QSystemTrayIcon::Critical);
+ }
+ */
+ if (!isVisible())
show();
}
@@ -192,7 +255,7 @@ void ConsoleWindow::onLaunchFailed(BaseInstance *instance)
setMayClose(true);
- if(!isVisible())
+ if (!isVisible())
show();
}
@@ -200,10 +263,11 @@ void ConsoleWindow::on_btnPaste_clicked()
{
auto text = ui->text->toPlainText();
ProgressDialog dialog(this);
- PasteUpload* paste=new PasteUpload(this, text);
+ PasteUpload *paste = new PasteUpload(this, text);
dialog.exec(paste);
- if(!paste->successful())
+ if (!paste->successful())
{
- CustomMessageBox::selectable(this, "Upload failed", paste->failReason(), QMessageBox::Critical)->exec();
+ CustomMessageB