diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ConsoleWindow.cpp | 15 | ||||
-rw-r--r-- | gui/ConsoleWindow.ui | 5 | ||||
-rw-r--r-- | gui/MainWindow.cpp | 139 | ||||
-rw-r--r-- | gui/MainWindow.h | 6 | ||||
-rw-r--r-- | gui/dialogs/AboutDialog.ui | 79 | ||||
-rw-r--r-- | gui/dialogs/AccountListDialog.cpp | 9 | ||||
-rw-r--r-- | gui/dialogs/CopyInstanceDialog.cpp | 2 | ||||
-rw-r--r-- | gui/dialogs/EditAccountDialog.cpp | 7 | ||||
-rw-r--r-- | gui/dialogs/EditAccountDialog.h | 3 | ||||
-rw-r--r-- | gui/dialogs/EditAccountDialog.ui | 6 | ||||
-rw-r--r-- | gui/dialogs/IconPickerDialog.cpp | 4 | ||||
-rw-r--r-- | gui/dialogs/InstanceSettings.cpp | 33 | ||||
-rw-r--r-- | gui/dialogs/InstanceSettings.h | 1 | ||||
-rw-r--r-- | gui/dialogs/InstanceSettings.ui | 26 | ||||
-rw-r--r-- | gui/dialogs/NewInstanceDialog.cpp | 2 | ||||
-rw-r--r-- | gui/dialogs/OneSixModEditDialog.cpp | 42 | ||||
-rw-r--r-- | gui/dialogs/OneSixModEditDialog.h | 2 | ||||
-rw-r--r-- | gui/dialogs/OneSixModEditDialog.ui | 21 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.cpp | 122 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.h | 14 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.ui | 216 | ||||
-rw-r--r-- | gui/widgets/MCModInfoFrame.cpp | 2 | ||||
-rw-r--r-- | gui/widgets/ModListView.cpp | 5 |
23 files changed, 594 insertions, 167 deletions
diff --git a/gui/ConsoleWindow.cpp b/gui/ConsoleWindow.cpp index 24afbc0a..e640d261 100644 --- a/gui/ConsoleWindow.cpp +++ b/gui/ConsoleWindow.cpp @@ -58,10 +58,17 @@ ConsoleWindow::~ConsoleWindow() void ConsoleWindow::writeColor(QString text, const char *color) { // append a paragraph - if (color != nullptr) - ui->text->appendHtml(QString("<font color=\"%1\">%2</font>").arg(color).arg(text)); - else - ui->text->appendPlainText(text); + QString newtext; + newtext += "<span style=\""; + { + if(color) + newtext += QString("color:") + color + ";"; + newtext += "font-family: monospace;"; + } + newtext += "\">"; + newtext += text.toHtmlEscaped(); + newtext += "</span>"; + ui->text->appendHtml(newtext); } void ConsoleWindow::write(QString data, MessageLevel::Enum mode) diff --git a/gui/ConsoleWindow.ui b/gui/ConsoleWindow.ui index 62cc89ac..c2307ecc 100644 --- a/gui/ConsoleWindow.ui +++ b/gui/ConsoleWindow.ui @@ -17,11 +17,6 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QPlainTextEdit" name="text"> - <property name="font"> - <font> - <pointsize>10</pointsize> - </font> - </property> <property name="undoRedoEnabled"> <bool>false</bool> </property> diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 85ad319b..42823fa5 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -66,7 +66,7 @@ #include "logic/lists/InstanceList.h" #include "logic/lists/MinecraftVersionList.h" #include "logic/lists/LwjglVersionList.h" -#include "logic/lists/IconList.h" +#include "logic/icons/IconList.h" #include "logic/lists/JavaVersionList.h" #include "logic/auth/flows/AuthenticateTask.h" @@ -90,7 +90,9 @@ #include "logic/LegacyInstance.h" #include "logic/assets/AssetsUtils.h" +#include "logic/assets/AssetsMigrateTask.h" #include <logic/updater/UpdateChecker.h> +#include <logic/tasks/ThreadTask.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { @@ -99,7 +101,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); // OSX magic. - setUnifiedTitleAndToolBarOnMac(true); + // setUnifiedTitleAndToolBarOnMac(true); // The instance action toolbar customizations { @@ -178,6 +180,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi connect(view->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(instanceChanged(const QModelIndex &, const QModelIndex &))); + + // track icon changes and update the toolbar! + connect(MMC->icons().get(), SIGNAL(iconUpdated(QString)), SLOT(iconUpdated(QString))); + // model reset -> selection is invalid. All the instance pointers are wrong. // FIXME: stop using POINTERS everywhere connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad())); @@ -264,8 +270,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi // set up the updater object. auto updater = MMC->updateChecker(); - QObject::connect(updater.get(), &UpdateChecker::updateAvailable, this, - &MainWindow::updateAvailable); + connect(updater.get(), &UpdateChecker::updateAvailable, this, + &MainWindow::updateAvailable); + connect(updater.get(), &UpdateChecker::noUpdateFound, [this]() + { + CustomMessageBox::selectable( + this, tr("No update found."), + tr("No MultiMC update was found!\nYou are using the latest version."))->exec(); + }); // if automatic update checks are allowed, start one. if (MMC->settings()->get("AutoUpdate").toBool()) on_actionCheckUpdate_triggered(); @@ -292,8 +304,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi // removing this looks stupid view->setFocus(); - - AssetsUtils::migrateOldAssets(); } MainWindow::~MainWindow() @@ -502,7 +512,7 @@ void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit if (installOnExit) MMC->setUpdateOnExit(updateTask.updateFilesDir()); else - MMC->installUpdates(updateTask.updateFilesDir()); + MMC->installUpdates(updateTask.updateFilesDir(), true); } } @@ -674,6 +684,20 @@ void MainWindow::on_actionChangeInstIcon_triggered() } } +void MainWindow::iconUpdated(QString icon) +{ + if(icon == m_currentInstIcon) + { + ui->actionChangeInstIcon->setIcon(MMC->icons()->getIcon(m_currentInstIcon)); + } +} + +void MainWindow::updateInstanceToolIcon(QString new_icon) +{ + m_currentInstIcon = new_icon; + ui->actionChangeInstIcon->setIcon(MMC->icons()->getIcon(m_currentInstIcon)); +} + void MainWindow::on_actionChangeInstGroup_triggered() { if (!m_selectedInstance) @@ -721,7 +745,8 @@ void MainWindow::on_actionConfig_Folder_triggered() void MainWindow::on_actionCheckUpdate_triggered() { auto updater = MMC->updateChecker(); - updater->checkForUpdate(); + + updater->checkForUpdate(true); } void MainWindow::on_actionSettings_triggered() @@ -905,6 +930,8 @@ void MainWindow::doLaunch() if (!account.get()) return; + QString failReason = tr("Your account is currently not logged in. Please enter " + "your password to log in again."); // do the login. if the account has an access token, try to refresh it first. if (account->accountStatus() != NotVerified) { @@ -919,13 +946,28 @@ void MainWindow::doLaunch() { updateInstance(m_selectedInstance, account); } - // revert from online to verified. + else + { + if (!task->successful()) + { + failReason = task->failReason(); + } + if (loginWithPassword(account, failReason)) + updateInstance(m_selectedInstance, account); + } + // in any case, revert from online to verified. + account->downgrade(); + } + else + { + if (loginWithPassword(account, failReason)) + { + updateInstance(m_selectedInstance, account); + account->downgrade(); + } + // in any case, revert from online to verified. account->downgrade(); - return; } - if (loginWithPassword(account, tr("Your account is currently not logged in. Please enter " - "your password to log in again."))) - updateInstance(m_selectedInstance, account); } bool MainWindow::loginWithPassword(MojangAccountPtr account, const QString &errorMsg) @@ -1042,22 +1084,9 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() VersionSelectDialog vselect(m_selectedInstance->versionList().get(), tr("Change Minecraft version"), this); vselect.setFilter(1, "OneSix"); - if (vselect.exec() && vselect.selectedVersion()) - { - if (m_selectedInstance->versionIsCustom()) - { - auto result = CustomMessageBox::selectable( - this, tr("Are you sure?"), - tr("This will remove any library/version customization you did previously. " - "This includes things like Forge install and similar."), - QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, - QMessageBox::Abort)->exec(); - - if (result != QMessageBox::Ok) - return; - } - m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); - } + if(!vselect.exec() || !vselect.selectedVersion()) + return; + if (!MMC->accounts()->anyAccountIsValid()) { CustomMessageBox::selectable( @@ -1067,7 +1096,22 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() QMessageBox::Warning)->show(); return; } - auto updateTask = m_selectedInstance->doUpdate(false /*only_prepare*/); + + if (m_selectedInstance->versionIsCustom()) + { + auto result = CustomMessageBox::selectable( + this, tr("Are you sure?"), + tr("This will remove any library/version customization you did previously. " + "This includes things like Forge install and similar."), + QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, + QMessageBox::Abort)->exec(); + + if (result != QMessageBox::Ok) + return; + } + m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); + + auto updateTask = m_selectedInstance->doUpdate(false); if (!updateTask) { return; @@ -1109,7 +1153,6 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & .value<void *>())) { ui->instanceToolBar->setEnabled(true); - QString iconKey = m_selectedInstance->iconKey(); renameButton->setText(m_selectedInstance->name()); ui->actionChangeInstLWJGLVersion->setEnabled( m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion")); @@ -1118,8 +1161,7 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & ui->actionChangeInstMCVersion->setEnabled( m_selectedInstance->menuActionEnabled("actionChangeInstMCVersion")); m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); - auto ico = MMC->icons()->getIcon(iconKey); - ui->actionChangeInstIcon->setIcon(ico); + updateInstanceToolIcon(m_selectedInstance->iconKey()); MMC->settings()->set("SelectedInstance", m_selectedInstance->id()); } @@ -1134,12 +1176,11 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & void MainWindow::selectionBad() { m_selectedInstance = nullptr; - QString iconKey = "infinity"; + statusBar()->clearMessage(); ui->instanceToolBar->setEnabled(false); renameButton->setText(tr("Rename Instance")); - auto ico = MMC->icons()->getIcon(iconKey); - ui->actionChangeInstIcon->setIcon(ico); + updateInstanceToolIcon("infinity"); } void MainWindow::on_actionEditInstNotes_triggered() @@ -1162,6 +1203,32 @@ void MainWindow::instanceEnded() this->show(); } +void MainWindow::checkMigrateLegacyAssets() +{ + int legacyAssets = AssetsUtils::findLegacyAssets(); + if(legacyAssets > 0) + { + ProgressDialog migrateDlg(this); + AssetsMigrateTask migrateTask(legacyAssets, &migrateDlg); + { + ThreadTask threadTask(&migrateTask); + + if (migrateDlg.exec(&threadTask)) + { + QLOG_INFO() << "Assets migration task completed successfully"; + } + else + { + QLOG_INFO() << "Assets migration task reported failure"; + } + } + } + else + { + QLOG_INFO() << "Didn't find any legacy assets to migrate"; + } +} + void MainWindow::checkSetDefaultJava() { bool askForJava = false; diff --git a/gui/MainWindow.h b/gui/MainWindow.h index 60fde281..f5b25006 100644 --- a/gui/MainWindow.h +++ b/gui/MainWindow.h @@ -51,6 +51,7 @@ public: void openWebPage(QUrl url); void checkSetDefaultJava(); + void checkMigrateLegacyAssets(); private slots: @@ -145,6 +146,9 @@ slots: void assetsFailed(); void assetsFinished(); + // called when an icon is changed in the icon model. + void iconUpdated(QString); + public slots: void instanceActivated(QModelIndex); @@ -173,6 +177,7 @@ slots: protected: bool eventFilter(QObject *obj, QEvent *ev); void setCatBackground(bool enabled); + void updateInstanceToolIcon(QString new_icon); private: Ui::MainWindow *ui; @@ -186,6 +191,7 @@ private: QToolButton* newsLabel; BaseInstance *m_selectedInstance; + QString m_currentInstIcon; Task *m_versionLoadTask; diff --git a/gui/dialogs/AboutDialog.ui b/gui/dialogs/AboutDialog.ui index 7b91ebc8..df9b1a53 100644 --- a/gui/dialogs/AboutDialog.ui +++ b/gui/dialogs/AboutDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>706</width> - <height>579</height> + <width>707</width> + <height>593</height> </rect> </property> <property name="minimumSize"> @@ -103,8 +103,8 @@ <rect> <x>0</x> <y>0</y> - <width>688</width> - <height>313</height> + <width>685</width> + <height>304</height> </rect> </property> <attribute name="label"> @@ -113,6 +113,9 @@ <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QLabel" name="aboutLabel"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="text"> <string><html><head/><body><p>MultiMC is a custom launcher that makes managing Minecraft easier by allowing you to have multiple instances of Minecraft at once.</p></body></html></string> </property> @@ -162,8 +165,8 @@ <rect> <x>0</x> <y>0</y> - <width>688</width> - <height>313</height> + <width>685</width> + <height>304</height> </rect> </property> <attribute name="label"> @@ -179,13 +182,22 @@ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">TakSuyu &lt;</span><a href="mailto:taksuyu@gmail.com"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">taksuyu@gmail.com</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Sky (Drayshak) &lt;</span><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-family:'Ubuntu';">&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Kilobyte &lt;</span><a href="mailto:stiepen22@gmx.de"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">stiepen22@gmx.de</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p></body></html></string> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">MultiMC</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Sky &lt;</span><a href="https://www.twitter.com/drayshak"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">@drayshak</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt; font-weight:600;">With thanks to</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">TakSuyu &lt;</span><a href="mailto:taksuyu@gmail.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">taksuyu@gmail.com</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Kilobyte &lt;</span><a href="mailto:stiepen22@gmx.de"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">stiepen22@gmx.de</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Jan (02JanDal) &lt;</span><a href="mailto:02jandal@gmail.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">02jandal@gmail.com</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Robotbrain &lt;</span><a href="https://twitter.com/skylordelros"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">@skylordelros</span></a><span style=" font-size:10pt;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Rootbear75 &lt;</span><a href="https://twitter.com/rootbear75"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">@rootbear75</span></a><span style=" font-size:10pt;">&gt; (build server)</span></p></body></html></string> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> </property> </widget> </item> @@ -206,8 +218,8 @@ p, li { white-space: pre-wrap; } <rect> <x>0</x> <y>0</y> - <width>688</width> - <height>313</height> + <width>684</width> + <height>290</height> </rect> </property> <attribute name="label"> @@ -234,9 +246,9 @@ p, li { white-space: pre-wrap; } <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:7.8pt; font-weight:400; font-style:normal;"> <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">MultiMC</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2012 MultiMC Contributors</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2012-2014 MultiMC Contributors</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">you may not use this file except in compliance with the License.</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">You may obtain a copy of the License at</span></p> @@ -361,6 +373,39 @@ p, li { white-space: pre-wrap; } </item> </layout> </widget> + <widget class="QWidget" name="forkPage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>684</width> + <height>290</height> + </rect> + </property> + <attribute name="label"> + <string>Forking/Redistribution</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_33"> + <item> + <widget class="QTextEdit" name="textEdit"> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:11pt;">We keep MultiMC open source because we think it's important to be able to see the source code for a project like this, and we do so using the Apache license.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans'; font-size:11pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:11pt;">Part of the reason for using the Apache license is we don't want people using the &quot;MultiMC&quot; name when redistributing the project. This means people must take the time to go through the source code and remove all references to &quot;MultiMC&quot;, including but not limited to the project icon and the title of windows, (no *MultiMC-fork* in the title).</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans'; font-size:11pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:11pt;">The Apache license covers reasonable use for the name - a mention of the project's origins in the About dialog and the license is acceptable. However, it should be abundantly clear that the project is a fork </span><span style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:600;">without</span><span style=" font-family:'Bitstream Vera Sans'; font-size:11pt;"> implying that you have our blessing.</span></p></body></html></string> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + </layout> + </widget> </widget> </item> <item> diff --git a/gui/dialogs/AccountListDialog.cpp b/gui/dialogs/AccountListDialog.cpp index 242590fb..1712e352 100644 --- a/gui/dialogs/AccountListDialog.cpp +++ b/gui/dialogs/AccountListDialog.cpp @@ -26,7 +26,9 @@ #include <gui/dialogs/EditAccountDialog.h> #include <gui/dialogs/ProgressDialog.h> #include <gui/dialogs/AccountSelectDialog.h> +#include "CustomMessageBox.h" #include <logic/tasks/Task.h> +#include <logic/auth/YggdrasilTask.h> #include <MultiMC.h> @@ -147,5 +149,12 @@ void AccountListDialog::addAccount(const QString& errMsg) job->start(); } + else + { + auto reason = task->failReason(); + auto dlg = CustomMessageBox::selectable(this, tr("Login error."), reason, QMessageBox::Critical); + dlg->exec(); + delete dlg; + } } } diff --git a/gui/dialogs/CopyInstanceDialog.cpp b/gui/dialogs/CopyInstanceDialog.cpp index 9d7ac30c..4095408b 100644 --- a/gui/dialogs/CopyInstanceDialog.cpp +++ b/gui/dialogs/CopyInstanceDialog.cpp @@ -27,7 +27,7 @@ #include "logic/InstanceFactory.h" #include "logic/BaseVersion.h" -#include "logic/lists/IconList.h" +#include "logic/icons/IconList.h" #include "logic/lists/MinecraftVersionList.h" #include "logic/tasks/Task.h" #include "logic/BaseInstance.h" diff --git a/gui/dialogs/EditAccountDialog.cpp b/gui/dialogs/EditAccountDialog.cpp index dd3f0523..a1bd5591 100644 --- a/gui/dialogs/EditAccountDialog.cpp +++ b/gui/dialogs/EditAccountDialog.cpp @@ -15,6 +15,8 @@ #include "EditAccountDialog.h" #include "ui_EditAccountDialog.h" +#include <QDesktopServices> +#include <QUrl> EditAccountDialog::EditAccountDialog(const QString &text, QWidget *parent, int flags) : QDialog(parent), ui(new Ui::EditAccountDialog) @@ -33,6 +35,11 @@ EditAccountDialog::~EditAccountDialog() delete ui; } +void EditAccountDialog::on_label_linkActivated(const QString &link) +{ + QDesktopServices::openUrl(QUrl(link)); +} + QString EditAccountDialog::username() const { return ui->userTextBox->text(); diff --git a/gui/dialogs/EditAccountDialog.h b/gui/dialogs/EditAccountDialog.h index be3a88d8..83f25124 100644 --- a/gui/dialogs/EditAccountDialog.h +++ b/gui/dialogs/EditAccountDialog.h @@ -52,6 +52,9 @@ public: PasswordField, }; +private slots: + void on_label_linkActivated(const QString &link); + private: Ui::EditAccountDialog *ui; }; diff --git a/gui/dialogs/EditAccountDialog.ui b/gui/dialogs/EditAccountDialog.ui index 1a8f9dba..5f727bd4 100644 --- a/gui/dialogs/EditAccountDialog.ui +++ b/gui/dialogs/EditAccountDialog.ui @@ -19,6 +19,12 @@ <property name="text"> <string>Message label placeholder.</string> </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> </widget> </item> <item> diff --git a/gui/dialogs/IconPickerDialog.cpp b/gui/dialogs/IconPickerDialog.cpp index 99d6dc9a..f7970b37 100644 --- a/gui/dialogs/IconPickerDialog.cpp +++ b/gui/dialogs/IconPickerDialog.cpp @@ -25,7 +25,7 @@ #include "gui/Platform.h" #include "gui/widgets/InstanceDelegate.h" -#include "logic/lists/IconList.h" +#include "logic/icons/IconList.h" IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IconPickerDialog) @@ -103,7 +103,7 @@ void IconPickerDialog::addNewIcon() QString selectIcons = tr("Select Icons"); //: The type of icon files QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), - tr("Icons") + "(*.png *.jpg *.jpeg)"); + tr("Icons") + "(*.png *.jpg *.jpeg *.ico)"); MMC->icons()->installIcons(fileNames); } diff --git a/gui/dialogs/InstanceSettings.cpp b/gui/dialogs/InstanceSettings.cpp index 641c7fab..edb4a921 100644 --- a/gui/dialogs/InstanceSettings.cpp +++ b/gui/dialogs/InstanceSettings.cpp @@ -36,6 +36,9 @@ InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent) { MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); + + restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray())); + loadSettings(); } @@ -47,7 +50,13 @@ InstanceSettings::~InstanceSettings() void InstanceSettings::showEvent(QShowEvent *ev) { QDialog::showEvent(ev); - adjustSize(); +} + +void InstanceSettings::closeEvent(QCloseEvent *ev) +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + + QDialog::closeEvent(ev); } void InstanceSettings::on_customCommandsGroupBox_toggled(bool state) @@ -57,12 +66,16 @@ void InstanceSettings::on_customCommandsGroupBox_toggled(bool state) void InstanceSettings::on_buttonBox_accepted() { + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + applySettings(); accept(); } void InstanceSettings::on_buttonBox_rejected() { + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + reject(); } @@ -98,18 +111,6 @@ void InstanceSettings::applySettings() m_obj->reset("MinecraftWinHeight"); } - // Auto Login - bool login = ui->accountSettingsBox->isChecked(); - m_obj->set("OverrideLogin", login); - if (login) - { - m_obj->set("AutoLogin", ui->autoLoginCheckBox->isChecked()); - } - else - { - m_obj->reset("AutoLogin"); - } - // Memory bool memory = ui->memoryGroupBox->isChecked(); m_obj->set("OverrideMemory", memory); @@ -170,10 +171,6 @@ void InstanceSettings::loadSettings() ui->windowWidthSpinBox->setValue(m_obj->get("MinecraftWinWidth").toInt()); ui->windowHeightSpinBox->setValue(m_obj->get("MinecraftWinHeight").toInt()); - // Auto Login - ui->accountSettingsBox->setChecked(m_obj->get("OverrideLogin").toBool()); - ui->autoLoginCheckBox->setChecked(m_obj->get("AutoLogin").toBool()); - // Memory ui->memoryGroupBox->setChecked(m_obj->get("OverrideMemory").toBool()); ui->minMemSpinBox->setValue(m_obj->get("MinMemAlloc").toInt()); @@ -243,4 +240,4 @@ void InstanceSettings::checkFinished(JavaCheckResult result) tr("The specified java binary didn't work. You should use the auto-detect feature, " "or set the path to the java executable.")); } -}
\ No newline at end of file +} diff --git a/gui/dialogs/InstanceSettings.h b/gui/dialogs/InstanceSettings.h index 1e7b9f6e..e296db4c 100644 --- a/gui/dialogs/InstanceSettings.h +++ b/gui/dialogs/InstanceSettings.h @@ -39,6 +39,7 @@ public: protected: virtual void showEvent(QShowEvent *); + virtual void closeEvent(QCloseEvent *); private slots: void on_customCommandsGroupBox_toggled(bool arg1); diff --git a/gui/dialogs/InstanceSettings.ui b/gui/dialogs/InstanceSettings.ui index c4a7d6ed..9260caea 100644 --- a/gui/dialogs/InstanceSettings.ui +++ b/gui/dialogs/InstanceSettings.ui @@ -132,31 +132,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="accountSettingsBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="title"> - <string>Account Settings</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <item> - <widget class="QCheckBox" name="autoLoginCheckBox"> - <property name="text"> - <string>Login automatically when an instance icon is double clicked?</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacerMinecraft"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -411,7 +386,6 @@ <tabstop>consoleSettingsBox</tabstop> <tabstop>showConsoleCheck</tabstop> <tabstop>autoCloseConsoleCheck</tabstop> - <tabstop>accountSettingsBox</tabstop> <tabstop>memoryGroupBox</tabstop> <tabstop>minMemSpinBox</tabstop> <tabstop>maxMemSpinBox</tabstop> diff --git a/gui/dialogs/NewInstanceDialog.cpp b/gui/dialogs/NewInstanceDialog.cpp index 5b2cd086..c7b273af 100644 --- a/gui/dialogs/NewInstanceDialog.cpp +++ b/gui/dialogs/NewInstanceDialog.cpp @@ -19,7 +19,7 @@ #include "logic/InstanceFactory.h" #include "logic/BaseVersion.h" -#include "logic/lists/IconList.h" +#include "logic/icons/IconList.h" #include "logic/lists/MinecraftVersionList.h" #include "logic/tasks/Task.h" diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp index 51ea2d19..3982f17d 100644 --- a/gui/dialogs/OneSixModEditDialog.cpp +++ b/gui/dialogs/OneSixModEditDialog.cpp @@ -38,6 +38,7 @@ #include "logic/EnabledItemFilter.h" #include "logic/lists/ForgeVersionList.h" #include "logic/ForgeInstaller.h" +#include "logic/LiteLoaderInstaller.h" OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) : QDialog(parent), ui(new Ui::OneSixModEditDialog), m_inst(inst) @@ -95,6 +96,8 @@ void OneSixModEditDialog::updateVersionControls() ui->customizeBtn->setEnabled(!customVersion); ui->revertBtn->setEnabled(customVersion); ui->forgeBtn->setEnabled(true); + ui->liteloaderBtn->setEnabled(LiteLoaderInstaller(m_inst->intendedVersionId()).canApply()); + ui->customEditorBtn->setEnabled(customVersion); } void OneSixModEditDialog::disableVersionControls() @@ -102,6 +105,8 @@ void OneSixModEditDialog::disableVersionControls() ui->customizeBtn->setEnabled(false); ui->revertBtn->setEnabled(false); ui->forgeBtn->setEnabled(false); + ui->liteloaderBtn->setEnabled(false); + ui->customEditorBtn->setEnabled(false); } void OneSixModEditDialog::on_customizeBtn_clicked() @@ -131,6 +136,17 @@ void OneSixModEditDialog::on_revertBtn_clicked() } } +void OneSixModEditDialog::on_customEditorBtn_clicked() +{ + if (m_inst->versionIsCustom()) + { + if (!MMC->openJsonEditor(m_inst->instanceRoot() + "/custom.json")) + { + QMessageBox::warning(this, tr("Error"), tr("Unable to open custom.json, check the settings")); + } + } +} + void OneSixModEditDialog::on_forgeBtn_clicked() { VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); @@ -204,6 +220,32 @@ void OneSixModEditDialog::on_forgeBtn_clicked() } } +void OneSixModEditDialog::on_liteloaderBtn_clicked() +{ + LiteLoaderInstaller liteloader(m_inst->intendedVersionId()); + if (!liteloader.canApply()) + { + QMessageBox::critical( + this, tr("LiteLoader"), + tr("There is no information available on how to install LiteLoader " + "into this version of Minecraft")); + return; + } + if (!m_inst->versionIsCustom()) + { + m_inst->customizeVersion(); + m_version = m_inst->getFullVersion(); + main_model->setSourceModel(m_version.get()); + updateVersionControls(); + } + if (!liteloader.apply(m_version)) + { + QMessageBox::critical( + this, tr("LiteLoader"), + tr("For reasons unknown, the LiteLoader installation failed. Check your MultiMC log files for details.")); + } +} + bool OneSixModEditDialog::loaderListFilter(QKeyEvent *keyEvent) { switch (keyEvent->key()) diff --git a/gui/dialogs/OneSixModEditDialog.h b/gui/dialogs/OneSixModEditDialog.h index 5376e526..2510c59c 100644 --- a/gui/dialogs/OneSixModEditDialog.h +++ b/gui/dialogs/OneSixModEditDialog.h @@ -44,8 +44,10 @@ slots: // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); void on_forgeBtn_clicked(); + void on_liteloaderBtn_clicked(); void on_customizeBtn_clicked(); void on_revertBtn_clicked(); + void on_customEditorBtn_clicked(); void updateVersionControls(); void disableVersionControls(); diff --git a/gui/dialogs/OneSixModEditDialog.ui b/gui/dialogs/OneSixModEditDialog.ui index 48aa87ee..899e0cbf 100644 --- a/gui/dialogs/OneSixModEditDialog.ui +++ b/gui/dialogs/OneSixModEditDialog.ui @@ -78,6 +78,13 @@ </widget> </item> <item> + <widget class="QPushButton" name="liteloaderBtn"> + <property name="text"> + <string>Install LiteLoader</string> + </property> + </widget> + </item> + <item> <widget class="QPushButton" name="customizeBtn"> <property name="toolTip"> <string>Create an customized copy of the base version</string> @@ -137,6 +144,20 @@ </widget> </item> <item> + <widget class="Line" name="line_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="customEditorBtn"> + <property name="text"> + <string>Open custom.json</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_7"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index e7f537e3..9362075e 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -40,6 +40,12 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name); ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch); +#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) + ui->jsonEditorTextBox->setClearButtonEnabled(true); +#endif + + restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray())); + loadSettings(MMC->settings().get()); updateCheckboxStuff(); } @@ -51,7 +57,13 @@ SettingsDialog::~SettingsDialog() void SettingsDialog::showEvent(QShowEvent *ev) { QDialog::showEvent(ev); - adjustSize(); +} + +void SettingsDialog::closeEvent(QCloseEvent *ev) +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + + QDialog::closeEvent(ev); } void SettingsDialog::updateCheckboxStuff() @@ -60,6 +72,32 @@ void SettingsDialog::updateCheckboxStuff() ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); } +void SettingsDialog::on_ftbLauncherBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"), + ui->ftbLauncherBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->ftbLauncherBox->setText(cooked_dir); + } +} + +void SettingsDialog::on_ftbBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Directory"), + ui->ftbBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->ftbBox->setText(cooked_dir); + } +} + void SettingsDialog::on_instDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"), @@ -72,6 +110,18 @@ void SettingsDialog::on_instDirBrowseBtn_clicked() ui->instDirTextBox->setText(cooked_dir); } } +void SettingsDialog::on_iconsDirBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"), + ui->iconsDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->iconsDirTextBox->setText(cooked_dir); + } +} void SettingsDialog::on_modsDirBrowseBtn_clicked() { @@ -99,6 +149,36 @@ void SettingsDialog::on_lwjglDirBrowseBtn_clicked() } } +void SettingsDialog::on_jsonEditorBrowseBtn_clicked() +{ + QString raw_file = QFileDialog::getOpenFileName( + this, tr("JSON Editor"), + ui->jsonEditorTextBox->text().isEmpty() + #if defined(Q_OS_LINUX) + ? QString("/usr/bin") + #else + ? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first() + #endif + : ui->jsonEditorTextBox->text()); + QString cooked_file = NormalizePath(raw_file); + + if (cooked_file.isEmpty()) + { + return; + } + + // it has to exist and be an executable + if (QFileInfo(cooked_file).exists() && + QFileInfo(cooked_file).isExecutable()) + { + ui->jsonEditorTextBox->setText(cooked_file); + } + else + { + QMessageBox::warning(this, tr("Invalid"), tr("The file chosen does not seem to be an executable")); + } +} + void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) { Q_UNUSED(checked); @@ -108,6 +188,13 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) void SettingsDialog::on_buttonBox_accepted() { applySettings(MMC->settings().get()); + + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); +} + +void SettingsDialog::on_buttonBox_rejected() +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); } void SettingsDialog::applySettings(SettingsObject *s) @@ -135,11 +222,29 @@ void SettingsDialog::applySettings(SettingsObject *s) // Updates s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked()); + // FTB + s->set("TrackFTBInstances", ui->trackFtbBox->isChecked()); + s->set("FTBLauncherRoot", ui->ftbLauncherBox->text()); + s->set("FTBRoot", ui->ftbBox->text()); + // Folders // TODO: Offer to move instances to new instance folder. s->set("InstanceDir", ui->instDirTextBox->text()); s->set("CentralModsDir", ui->modsDirTextBox->text()); s->set("LWJGLDir", ui->lwjglDirTextBox->text()); + s->set("IconsDir", ui->iconsDirTextBox->text()); + + // Editors + QString jsonEditor = ui->jsonEditorTextBox->text(); + if (!jsonEditor.isEmpty() && (!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable())) + { + QString found = QStandardPaths::findExecutable(jsonEditor); + if (!found.isEmpty()) + { + jsonEditor = found; + } + } + s->set("JsonEditor", jsonEditor); // Console s->set("ShowConsole", ui->showConsoleCheck->isChecked()); @@ -150,9 +255,6 @@ void SettingsDialog::applySettings(SettingsObject *s) s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); - // Auto Login - s->set("AutoLogin", ui->autoLoginCheckBox->isChecked()); - // Memory s->set("MinMemAlloc", ui->minMemSpinBox->value()); s->set("MaxMemAlloc", ui->maxMemSpinBox->value()); @@ -188,10 +290,19 @@ void SettingsDialog::loadSettings(SettingsObject *s) ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); ui->devBuildsCheckBox->setChecked(s->get("UseDevBuilds").toBool()); + // FTB + ui->trackFtbBox->setChecked(s->get("TrackFTBInstances").toBool()); + ui->ftbLauncherBox->setText(s->get("FTBLauncherRoot").toString()); + ui->ftbBox->setText(s->get("FTBRoot").toString()); + // Folders ui->instDirTextBox->setText(s->get("InstanceDir").toString()); ui->modsDirTextBox->setText(s->get("CentralModsDir").toString()); ui->lwjglDirTextBox->setText(s->get("LWJGLDir").toString()); + ui->iconsDirTextBox->setText(s->get("IconsDir").toString()); + + // Editors + ui->jsonEditorTextBox->setText(s->get("JsonEditor").toString()); // Console ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); @@ -202,9 +313,6 @@ void SettingsDialog::loadSettings(SettingsObject *s) ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt()); ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt()); - // Auto Login - ui->autoLoginCheckBox->setChecked(s->get("AutoLogin").toBool()); - // Memory ui->minMemSpinBox->setValue(s->get("MinMemAlloc").toInt()); ui->maxMemSpinBox->setValue(s->get("MaxMemAlloc").toInt()); diff --git a/gui/dialogs/SettingsDialog.h b/gui/dialogs/SettingsDialog.h index 0cb8fa38..11fdb696 100644 --- a/gui/dialogs/SettingsDialog.h +++ b/gui/dialogs/SettingsDialog.h @@ -41,20 +41,32 @@ public: void loadSettings(SettingsObject *s); protected: - virtual void showEvent(QShowEvent *); + virtual void showEvent(QShowEvent *ev); + virtual void closeEvent(QCloseEvent *ev); private slots: + void on_ftbLauncherBrowseBtn_clicked(); + + void on_ftbBrowseBtn_clicked(); + void on_instDirBrowseBtn_clicked(); void on_modsDirBrowseBtn_clicked(); void on_lwjglDirBrowseBtn_clicked(); + + void on_jsonEditorBrowseBtn_clicked(); + + void on_iconsDirBrowseBtn_clicked(); + void on_maximizedCheckBox_clicked(bool checked); void on_buttonBox_accepted(); + void on_buttonBox_rejected(); + void on_javaDetectBtn_clicked(); void on_javaTestBtn_clicked(); diff --git a/gui/dialogs/SettingsDialog.ui b/gui/dialogs/SettingsDialog.ui index 0dbc8def..dbc8ca88 100644 --- a/gui/dialogs/SettingsDialog.ui +++ b/gui/dialogs/SettingsDialog.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>526</width> - <height>599</height> + <height>628</height> </rect> </property> <property name="sizePolicy"> @@ -39,7 +39,7 @@ <attribute name="title"> <string>General</string> </attribute> - <layout class="QVBoxLayout" name="generalTabLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QGroupBox" name="sortingModeBox"> <property name="enabled"> @@ -96,6 +96,93 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>FTB</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="2"> + <widget class="QPushButton" name="ftbLauncherBrowseBtn"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>28</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::TabFocus</enum> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Launcher:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="ftbLauncherBox"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="trackFtbBox"> + <property name="text"> + <string>Track FTB instances</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="ftbBox"/> + </item> + <item row="3" column="2"> + <widget class="QPushButton" name="ftbBrowseBtn"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>28</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Files:</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="foldersBox"> <property name="title"> <string>Folders</string> @@ -128,6 +215,9 @@ <item row="1" column="1"> <widget class="QLineEdit" name="modsDirTextBox"/> </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lwjglDirTextBox"/> + </item> <item row="1" column="2"> <widget class="QToolButton" name="modsDirBrowseBtn"> <property name="text"> @@ -142,9 +232,6 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="lwjglDirTextBox"/> - </item> <item row="2" column="2"> <widget class="QToolButton" name="lwjglDirBrowseBtn"> <property name="text"> @@ -152,6 +239,49 @@ </property> </widget> </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="iconsDirTextBox"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="labelIconsDir"> + <property name="text"> + <string>Icons:</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QToolButton" name="iconsDirBrowseBtn"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="editorsBox"> + <property name="title"> + <string>External Editors (leave empty for system default)</string> + </property> + <layout class="QGridLayout" name="foldersBoxLayout_2"> + <item row="0" column="1"> + <widget class="QLineEdit" name="jsonEditorTextBox"/> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="labelJsonEditor"> + <property name="text"> + <string>JSON Editor:</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QToolButton" name="jsonEditorBrowseBtn"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -262,22 +392,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="accountSettingsBox"> - <property name="title"> - <string>Account Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QCheckBox" name="autoLoginCheckBox"> - <property name="text"> - <string>Login automatically when an instance icon is double clicked?</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacerMinecraft"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -394,25 +508,6 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="labelJVMArgs"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>JVM arguments:</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="5"> - <widget class="QLineEdit" name="javaPathTextBox"/> - </item> - <item row="3" column="1" colspan="5"> - <widget class="QLineEdit" name="jvmArgsTextBox"/> - </item> <item row="1" column="1"> <widget class="QPushButton" name="javaDetectBtn"> <property name="sizePolicy"> @@ -426,7 +521,7 @@ </property> </widget> </item> - <item row="1" column="4" colspan="2"> + <item row="1" column="2"> <widget class="QPushButton" name="javaTestBtn"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -439,19 +534,48 @@ </property> </widget> </item> - <item row="1" column="2" colspan="2"> - <widget class="QPushButton" name="javaBrowseBtn"> + <item row="2" column="0"> + <widget class="QLabel" name="labelJVMArgs"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Browse...</string> + <string>JVM arguments:</string> </property> </widget> </item> + <item row="0" column="1" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLineEdit" name="javaPathTextBox"/> + </item> + <item> + <widget class="QPushButton" name="javaBrowseBtn"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>28</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="1" colspan="2"> + <widget class="QLineEdit" name="jvmArgsTextBox"/> + </item> </layout> </widget> </item> @@ -520,7 +644,7 @@ </layout> </widget> <tabstops> - <tabstop>settingsTabs</tabstop> + <tabstop>settingsTab</tabstop> <tabstop>buttonBox</tabstop> <tabstop>sortLastLaunchedBtn</tabstop> <tabstop>sortByNameBtn</tabstop> diff --git a/gui/widgets/MCModInfoFrame.cpp b/gui/widgets/MCModInfoFrame.cpp index ad167bc9..abcea6c6 100644 --- a/gui/widgets/MCModInfoFrame.cpp +++ b/gui/widgets/MCModInfoFrame.cpp @@ -30,7 +30,7 @@ void MCModInfoFrame::updateWithMod(Mod &m) QString text = ""; QString name = ""; - if(m.name().isEmpty()) name = m.id(); + if(m.name().isEmpty()) name = m.mmc_id(); else name = m.name(); if(m.homeurl().isEmpty()) text = name; diff --git a/gui/widgets/ModListView.cpp b/gui/widgets/ModListView.cpp index 838af75e..9d5950c3 100644 --- a/gui/widgets/ModListView.cpp +++ b/gui/widgets/ModListView.cpp @@ -44,8 +44,9 @@ void ModListView::setModel ( QAbstractItemModel* model ) QTreeView::setModel ( model ); auto head = header(); head->setStretchLastSection(false); - head->setSectionResizeMode(0, QHeaderView::Stretch); - for(int i = 1; i < head->count(); i++) + head->setSectionResizeMode(0, QHeaderView::ResizeToContents); + head->setSectionResizeMode(1, QHeaderView::Stretch); + for(int i = 2; i < head->count(); i++) head->setSectionResizeMode(i, QHeaderView::ResizeToContents); dropIndicatorPosition(); } |