diff options
-rw-r--r-- | CMakeLists.txt | 21 | ||||
-rw-r--r-- | changelog.yaml | 17 | ||||
-rw-r--r-- | generated.qrc.in | 8 | ||||
-rw-r--r-- | gui/MainWindow.cpp | 17 | ||||
-rw-r--r-- | gui/dialogs/AboutDialog.cpp | 2 | ||||
-rw-r--r-- | gui/dialogs/InstanceSettings.ui | 18 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.ui | 21 | ||||
-rw-r--r-- | logic/MinecraftProcess.cpp | 8 | ||||
-rw-r--r-- | logic/net/CacheDownload.cpp | 100 | ||||
-rw-r--r-- | logic/net/CacheDownload.h | 8 | ||||
-rw-r--r-- | main.cpp | 1 |
11 files changed, 149 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c5c23235..dcb4cbaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,8 @@ IF(UNIX) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) ENDIF() +set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/jars) + ######## Set compiler flags ######## IF(APPLE) message(STATUS "Using APPLE CMAKE_CXX_FLAGS") @@ -90,8 +92,8 @@ 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_HOTFIX 0) +SET(MultiMC_VERSION_MINOR 1) +SET(MultiMC_VERSION_HOTFIX 1) # Build number SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") @@ -120,17 +122,23 @@ IF (MultiMC_VERSION_HOTFIX GREATER 0) ENDIF() # Build a version string to display in the configure logs. -IF (MultiMC_VERSION_TYPE STREQUAL "Custom" OR MultiMC_VERSION_TYPE STREQUAL "Release") +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) @@ -551,12 +559,10 @@ ENDIF(MultiMC_CODE_COVERAGE) # Qt 5 stuff QT5_WRAP_UI(MULTIMC_UI ${MULTIMC_UIS}) -CONFIGURE_FILE(generated.qrc.in generated.qrc) -QT5_ADD_RESOURCES(GENERATED_QRC ${CMAKE_CURRENT_BINARY_DIR}/generated.qrc) QT5_ADD_RESOURCES(GRAPHICS_QRC graphics.qrc) # Add common library -ADD_LIBRARY(MultiMC_common STATIC ${MULTIMC_SOURCES} ${MULTIMC_UI} ${GENERATED_QRC} ${GRAPHICS_QRC}) +ADD_LIBRARY(MultiMC_common STATIC ${MULTIMC_SOURCES} ${MULTIMC_UI} ${GRAPHICS_QRC}) # Add executable ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32 main.cpp ${MULTIMC_RCS}) @@ -566,7 +572,6 @@ TARGET_LINK_LIBRARIES(MultiMC MultiMC_common) TARGET_LINK_LIBRARIES(MultiMC_common xz-embedded unpack200 quazip libUtil libSettings libGroupView ${MultiMC_LINK_ADDITIONAL_LIBS}) QT5_USE_MODULES(MultiMC Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) QT5_USE_MODULES(MultiMC_common Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) -ADD_DEPENDENCIES(MultiMC_common MultiMCLauncher JavaCheck) ################################ INSTALLATION AND PACKAGING ################################ diff --git a/changelog.yaml b/changelog.yaml index 63c4b4b1..82dccd69 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -1,2 +1,19 @@ +# +# 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. +0.1.1: + - Hotfix - Changed the issue tracker URL to [GitHub issues](https://github.com/MultiMC/MultiMC5/issues). + diff --git a/generated.qrc.in b/generated.qrc.in deleted file mode 100644 index 794943eb..00000000 --- a/generated.qrc.in +++ /dev/null @@ -1,8 +0,0 @@ -<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/MainWindow.cpp b/gui/MainWindow.cpp index 905d14cf..dba15e98 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -99,7 +99,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi { MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); - setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); + + QString winTitle = QString("MultiMC 5 - Version %1").arg(MMC->version().toString()); + if (!MMC->version().platform.isEmpty()) + winTitle += " on " + MMC->version().platform; + setWindowTitle(winTitle); // OSX magic. // setUnifiedTitleAndToolBarOnMac(true); @@ -231,17 +235,20 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi connect(MMC->accounts().get(), &MojangAccountList::listChanged, [this] { repopulateAccountsMenu(); }); - std::shared_ptr<MojangAccountList> accounts = MMC->accounts(); + // Show initial account + activeAccountChanged(); + + auto accounts = MMC->accounts(); // TODO: Nicer way to iterate? for (int i = 0; i < accounts->count(); i++) { - MojangAccountPtr account = accounts->at(i); + auto account = accounts->at(i); if (account != nullptr) { auto job = new NetJob("Startup player skins: " + account->username()); - for (AccountProfile profile : account->profiles()) + for (auto profile : account->profiles()) { auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png"); auto action = CacheDownload::make( @@ -853,7 +860,7 @@ void MainWindow::on_actionManageAccounts_triggered() void MainWindow::on_actionReportBug_triggered() { - openWebPage(QUrl("http://multimc.myjetbrains.com/youtrack/dashboard#newissue=yes")); + openWebPage(QUrl("https://github.com/MultiMC/MultiMC5/issues")); } void MainWindow::on_actionMoreNews_triggered() diff --git a/gui/dialogs/AboutDialog.cpp b/gui/dialogs/AboutDialog.cpp index efeea6f2..35c85815 100644 --- a/gui/dialogs/AboutDialog.cpp +++ b/gui/dialogs/AboutDialog.cpp @@ -24,6 +24,8 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); + ui->urlLabel->setOpenExternalLinks(true); + ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64)); ui->title->setText("MultiMC 5 " + MMC->version().toString()); diff --git a/gui/dialogs/InstanceSettings.ui b/gui/dialogs/InstanceSettings.ui index 9260caea..9c7e1757 100644 --- a/gui/dialogs/InstanceSettings.ui +++ b/gui/dialogs/InstanceSettings.ui @@ -168,6 +168,12 @@ <layout class="QGridLayout" name="gridLayout_2"> <item row="1" column="1"> <widget class="QSpinBox" name="maxMemSpinBox"> + <property name="toolTip"> + <string>The maximum amount of memory Minecraft is allowed to use.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>512</number> </property> @@ -198,6 +204,12 @@ </item> <item row="0" column="1"> <widget class="QSpinBox" name="minMemSpinBox"> + <property name="toolTip"> + <string>The amount of memory Minecraft is started with.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>256</number> </property> @@ -214,6 +226,12 @@ </item> <item row="2" column="1"> <widget class="QSpinBox" name="permGenSpinBox"> + <property name="toolTip"> + <string>The amount of memory available to store loaded Java classes.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>64</number> </property> diff --git a/gui/dialogs/SettingsDialog.ui b/gui/dialogs/SettingsDialog.ui index e7671cce..b95b3c8c 100644 --- a/gui/dialogs/SettingsDialog.ui +++ b/gui/dialogs/SettingsDialog.ui @@ -106,6 +106,9 @@ <property name="text"> <string>No channel selected.</string> </property> + <property name="wordWrap"> + <bool>true</bool> + </property> </widget> </item> </layout> @@ -596,6 +599,12 @@ <layout class="QGridLayout" name="gridLayout_2"> <item row="1" column="1"> <widget class="QSpinBox" name="maxMemSpinBox"> + <property name="toolTip"> + <string>The maximum amount of memory Minecraft is allowed to use.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>512</number> </property> @@ -626,6 +635,12 @@ </item> <item row="0" column="1"> <widget class="QSpinBox" name="minMemSpinBox"> + <property name="toolTip"> + <string>The amount of memory Minecraft is started with.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>256</number> </property> @@ -649,6 +664,12 @@ </item> <item row="2" column="1"> <widget class="QSpinBox" name="permGenSpinBox"> + <property name="toolTip"> + <string>The amount of memory available to store loaded Java classes.</string> + </property> + <property name="suffix"> + <string> MB</string> + </property> <property name="minimum"> <number>64</number> </property> diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index 153b462c..9c69f1a7 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -85,6 +85,14 @@ QString MinecraftProcess::censorPrivateInfo(QString in) in.replace(profileId, "<PROFILE ID>"); in.replace(profileName, "<PROFILE NAME>"); } + + auto i = m_account->user().properties.begin(); + while (i != m_account->user().properties.end()) + { + in.replace(i.value(), "<" + i.key().toUpper() + ">"); + ++i; + } + return in; } diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp index 6eadae39..8a8d00f0 100644 --- a/logic/net/CacheDownload.cpp +++ b/logic/net/CacheDownload.cpp @@ -33,8 +33,10 @@ CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry) void CacheDownload::start() { + m_status = Job_InProgress; if (!m_entry->stale) { + m_status = Job_Finished; emit succeeded(m_index_within_job); return; } @@ -42,6 +44,15 @@ void CacheDownload::start() // if there already is a file and md5 checking is in effect and it can be opened if (!ensureFilePathExists(m_target_path)) { + QLOG_ERROR() << "Could not create folder for " + m_target_path; + m_status = Job_Failed; + emit failed(m_index_within_job); + return; + } + if (!m_output_file.open(QIODevice::WriteOnly)) + { + QLOG_ERROR() << "Could not open " + m_target_path + " for writing"; + m_status = Job_Failed; emit failed(m_index_within_job); return; } @@ -83,70 +94,65 @@ void CacheDownload::downloadError(QNetworkReply::NetworkError error) void CacheDownload::downloadFinished() { // if the download succeeded - if (m_status != Job_Failed) + if (m_status == Job_Failed) { + m_output_file.cancelWriting(); + m_reply.reset(); + m_status = Job_Failed; + emit failed(m_index_within_job); + return; + } + if (wroteAnyData) + { // nothing went wrong... - m_status = Job_Finished; - if (m_output_file.isOpen()) + if (m_output_file.commit()) { - // save the data to the downloadable if we aren't saving to file - m_output_file.close(); + m_status = Job_Finished; m_entry->md5sum = md5sum.result().toHex().constData(); } else { - if (m_output_file.open(QIODevice::ReadOnly)) - { - m_entry->md5sum = - QCryptographicHash::hash(m_output_file.readAll(), QCryptographicHash::Md5) - .toHex() - .constData(); - m_output_file.close(); - } - } - QFileInfo output_file_info(m_target_path); - - m_entry->etag = m_reply->rawHeader("ETag").constData(); - if (m_reply->hasRawHeader("Last-Modified")) - { - m_entry->remote_changed_timestamp = m_reply->rawHeader("Last-Modified").constData(); + QLOG_ERROR() << "Failed to commit changes to " << m_target_path; + m_output_file.cancelWriting(); + m_reply.reset(); + m_status = Job_Failed; + emit failed(m_index_within_job); + return; } - m_entry->local_changed_timestamp = - output_file_info.lastModified().toUTC().toMSecsSinceEpoch(); - m_entry->stale = false; - MMC->metacache()->updateEntry(m_entry); - - m_reply.reset(); - emit succeeded(m_index_within_job); - return; } - // else the download failed else { - m_output_file.close(); - m_output_file.remove(); - m_reply.reset(); - emit failed(m_index_within_job); - return; + m_status = Job_Finished; } + + QFileInfo output_file_info(m_target_path); + + m_entry->etag = m_reply->rawHeader("ETag").constData(); + if (m_reply->hasRawHeader("Last-Modified")) + { + m_entry->remote_changed_timestamp = m_reply->rawHeader("Last-Modified").constData(); + } + m_entry->local_changed_timestamp = + output_file_info.lastModified().toUTC().toMSecsSinceEpoch(); + m_entry->stale = false; + MMC->metacache()->updateEntry(m_entry); + + m_reply.reset(); + emit succeeded(m_index_within_job); + return; } void CacheDownload::downloadReadyRead() { - if (!m_output_file.isOpen()) - { - if (!m_output_file.open(QIODevice::WriteOnly)) - { - /* - * Can't open the file... the job failed - */ - m_reply->abort(); - emit failed(m_index_within_job); - return; - } - } QByteArray ba = m_reply->readAll(); md5sum.addData(ba); - m_output_file.write(ba); + if (m_output_file.write(ba) != ba.size()) + { + QLOG_ERROR() << "Failed writing into " + m_target_path; + m_status = Job_Failed; + m_reply->abort(); + emit failed(m_index_within_job); + } + wroteAnyData = true; } diff --git a/logic/net/CacheDownload.h b/logic/net/CacheDownload.h index e25aecd2..48be1dae 100644 --- a/logic/net/CacheDownload.h +++ b/logic/net/CacheDownload.h @@ -17,8 +17,8 @@ #include "NetAction.h" #include "HttpMetaCache.h" -#include <QFile> -#include <qcryptographichash.h> +#include <QCryptographicHash> +#include <QSaveFile> typedef std::shared_ptr<class CacheDownload> CacheDownloadPtr; class CacheDownload : public NetAction @@ -29,10 +29,12 @@ public: /// if saving to file, use the one specified in this string QString m_target_path; /// this is the output file, if any - QFile m_output_file; + QSaveFile m_output_file; /// the hash-as-you-download QCryptographicHash md5sum; + bool wroteAnyData = false; + public: explicit CacheDownload(QUrl url, MetaEntryPtr entry); static CacheDownloadPtr make(QUrl url, MetaEntryPtr entry) @@ -19,7 +19,6 @@ int main(int argc, char *argv[]) MultiMC app(argc, argv); Q_INIT_RESOURCE(graphics); - Q_INIT_RESOURCE(generated); switch (app.status()) { |