From f897a200e2607fd99116a3ab4bb9ba757a52139b Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Fri, 6 Sep 2013 22:40:50 +0200 Subject: Made instace killing actually work --- gui/consolewindow.cpp | 24 ++++++++++++++++++++++-- gui/consolewindow.h | 4 +++- gui/consolewindow.ui | 7 +++++++ gui/mainwindow.cpp | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 811900a2..f2bc662a 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -2,11 +2,13 @@ #include "ui_consolewindow.h" #include +#include -ConsoleWindow::ConsoleWindow(QWidget *parent) : +ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : QDialog(parent), ui(new Ui::ConsoleWindow), - m_mayclose(true) + m_mayclose(true), + proc(mcproc) { ui->setupUi(this); } @@ -40,6 +42,9 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode) else if (mode == MessageLevel::Error) while(iter.hasNext()) writeColor(iter.next(), "red"); + else if (mode == MessageLevel::Warning) + while(iter.hasNext()) + writeColor(iter.next(), "orange"); // TODO: implement other MessageLevels else while(iter.hasNext()) @@ -72,3 +77,18 @@ void ConsoleWindow::closeEvent(QCloseEvent * event) else QDialog::closeEvent(event); } + +void ConsoleWindow::on_btnKillMinecraft_clicked() +{ + ui->btnKillMinecraft->setEnabled(false); + QMessageBox r_u_sure; + r_u_sure.setText("Kill Minecraft?"); + r_u_sure.setInformativeText("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"); + r_u_sure.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + r_u_sure.setDefaultButton(QMessageBox::Yes); + if (r_u_sure.exec() == QMessageBox::Yes) + proc->killMinecraft(); + else + ui->btnKillMinecraft->setEnabled(true); + r_u_sure.close(); +} \ No newline at end of file diff --git a/gui/consolewindow.h b/gui/consolewindow.h index 60bec69f..d4485a45 100644 --- a/gui/consolewindow.h +++ b/gui/consolewindow.h @@ -13,7 +13,7 @@ class ConsoleWindow : public QDialog Q_OBJECT public: - explicit ConsoleWindow(QWidget *parent = 0); + explicit ConsoleWindow(MinecraftProcess *proc, QWidget *parent = 0); ~ConsoleWindow(); /** @@ -48,12 +48,14 @@ public slots: private slots: void on_closeButton_clicked(); + void on_btnKillMinecraft_clicked(); protected: void closeEvent(QCloseEvent *); private: Ui::ConsoleWindow *ui; + MinecraftProcess *proc; bool m_mayclose; }; diff --git a/gui/consolewindow.ui b/gui/consolewindow.ui index 9a766543..8dc80015 100644 --- a/gui/consolewindow.ui +++ b/gui/consolewindow.ui @@ -62,6 +62,13 @@ + + + + Kill Minecraft + + + diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 4ccc12b6..75996c5d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -538,7 +538,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) if(!proc) return; - console = new ConsoleWindow(); + console = new ConsoleWindow(proc); console->show(); connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, SLOT(write(QString, MessageLevel::Enum))); -- cgit v1.2.3 From 0990a1103c7eafd099e3ef9650f542eb34a6a818 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Fri, 6 Sep 2013 23:01:40 +0200 Subject: Made Offline user name default to 'Offline' if the textbox is left empty --- gui/mainwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 75996c5d..7d1e1510 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -492,7 +492,10 @@ void MainWindow::doLogin(const QString& errorMsg) } else { - m_activeLogin = {loginDlg->getUsername(), QString("Offline"), qint64(-1)}; + QString user = loginDlg->getUsername(); + if (user.length() == 0) + user = QString("Offline"); + m_activeLogin = {user, QString("Offline"), qint64(-1)}; m_activeInst = m_selectedInstance; launchInstance(m_activeInst, m_activeLogin); } -- cgit v1.2.3 From 3fd2d025a1aa0bbc72ac69a34828ef5942255143 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Fri, 6 Sep 2013 23:52:17 +0200 Subject: Made main window hide on instace exit --- gui/consolewindow.cpp | 8 +++++++- gui/consolewindow.h | 1 + gui/mainwindow.cpp | 17 +++++++++++++++++ gui/mainwindow.h | 3 +++ 4 files changed, 28 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index f2bc662a..f95d2742 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -11,6 +11,7 @@ ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : proc(mcproc) { ui->setupUi(this); + connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded())); } ConsoleWindow::~ConsoleWindow() @@ -91,4 +92,9 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() else ui->btnKillMinecraft->setEnabled(true); r_u_sure.close(); -} \ No newline at end of file +} + +void ConsoleWindow::onEnded() +{ + ui->btnKillMinecraft->setEnabled(false); +} diff --git a/gui/consolewindow.h b/gui/consolewindow.h index d4485a45..6a6c9e50 100644 --- a/gui/consolewindow.h +++ b/gui/consolewindow.h @@ -49,6 +49,7 @@ public slots: private slots: void on_closeButton_clicked(); void on_btnKillMinecraft_clicked(); + void onEnded(); protected: void closeEvent(QCloseEvent *); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 7d1e1510..82ae41d9 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -541,10 +541,21 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) if(!proc) return; + // Prepare GUI: If it shall stay open disable the required parts + if (globalSettings->get("NoHide").toBool()) + { + ui->actionLaunchInstance->setEnabled(false); + } + else + { + this->hide(); + } + console = new ConsoleWindow(proc); console->show(); connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, SLOT(write(QString, MessageLevel::Enum))); + connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded())); proc->launch(); } @@ -673,3 +684,9 @@ void MainWindow::on_actionEditInstNotes_triggered() linst->setNotes(noteedit.getText()); } } + +void MainWindow::instanceEnded() +{ + this->show(); + ui->actionLaunchInstance->setEnabled(m_selectedInstance); +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 42f118b1..e8a6cbcf 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -111,6 +111,8 @@ private slots: void on_actionChangeInstLWJGLVersion_triggered(); + void instanceEnded(); + void on_actionInstanceSettings_triggered(); public slots: @@ -128,6 +130,7 @@ protected: bool eventFilter(QObject *obj, QEvent *ev); void setCatBackground(bool enabled); private: + Ui::MainWindow *ui; KCategoryDrawer * drawer; KCategorizedView * view; -- cgit v1.2.3 From c985f68b729454b9f3c7188e0b2f1af4530411be Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Fri, 6 Sep 2013 23:58:10 +0200 Subject: Made main window hide on instace exit --- gui/consolewindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index f95d2742..04b77285 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -97,4 +97,5 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() void ConsoleWindow::onEnded() { ui->btnKillMinecraft->setEnabled(false); + if (!proc->exitCode()) this->close(); } -- cgit v1.2.3 From 5cac21ca6387a3cbd5492b933c5ad6d7b76b8bc7 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Sat, 7 Sep 2013 00:02:05 +0200 Subject: Enough main window hiding magic for now --- gui/consolewindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 04b77285..aba876c8 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -97,5 +97,6 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() void ConsoleWindow::onEnded() { ui->btnKillMinecraft->setEnabled(false); - if (!proc->exitCode()) this->close(); + // TODO: Check why this doesn't work + if (!proc->exitCode()) this->close(); } -- cgit v1.2.3 From dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Sun, 8 Sep 2013 15:02:52 +0200 Subject: Added console coloring and made the log not contain any usernames/session ids --- gui/consolewindow.cpp | 8 +++++++- gui/mainwindow.cpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index aba876c8..8ea90d45 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -23,7 +23,7 @@ void ConsoleWindow::writeColor(QString text, const char *color) { // append a paragraph if (color != nullptr) - ui->text->appendHtml(QString("%2").arg(color).arg(text)); + ui->text->appendHtml(QString("%2").arg(color).arg(text)); else ui->text->appendPlainText(text); // scroll down @@ -46,6 +46,12 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode) else if (mode == MessageLevel::Warning) while(iter.hasNext()) writeColor(iter.next(), "orange"); + else if (mode == MessageLevel::Fatal) + while(iter.hasNext()) + writeColor(iter.next(), "pink"); + else if (mode == MessageLevel::Debug) + while(iter.hasNext()) + writeColor(iter.next(), "green"); // TODO: implement other MessageLevels else while(iter.hasNext()) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 82ae41d9..152773e7 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -556,6 +556,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, SLOT(write(QString, MessageLevel::Enum))); connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded())); + proc->setLogin(m_activeLogin.username, m_activeLogin.sessionID); proc->launch(); } -- cgit v1.2.3 From 7e1cf22ce61e8a5450e5dc74993e471c20b2742f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 8 Sep 2013 15:59:50 +0200 Subject: Use youtrack for bugs --- gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 82483bf2..c0b79108 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -361,7 +361,7 @@ void MainWindow::on_actionSettings_triggered() void MainWindow::on_actionReportBug_triggered() { - openWebPage ( QUrl ( "http://jira.forkk.net/browse/MMC" ) ); + openWebPage ( QUrl ( "http://multimc.myjetbrains.com/youtrack/dashboard#newissue=yes" ) ); } void MainWindow::on_actionNews_triggered() -- cgit v1.2.3 From 31e5a0fe6d75e124bc772faafcef2618e16c3dbf Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Sun, 8 Sep 2013 18:13:09 +0200 Subject: Changed all strings displayed to end user to use qts localization system --- gui/EditNotesDialog.cpp | 2 +- gui/IconPickerDialog.cpp | 9 ++++++--- gui/LegacyModEditDialog.cpp | 12 ++++++++---- gui/OneSixModEditDialog.cpp | 4 ++-- gui/consolewindow.cpp | 3 ++- gui/logindialog.cpp | 8 ++++---- gui/lwjglselectdialog.cpp | 2 +- gui/mainwindow.cpp | 4 ++-- gui/settingsdialog.cpp | 12 ++++++------ 9 files changed, 32 insertions(+), 24 deletions(-) (limited to 'gui') diff --git a/gui/EditNotesDialog.cpp b/gui/EditNotesDialog.cpp index 6cc389f6..5b90ef53 100644 --- a/gui/EditNotesDialog.cpp +++ b/gui/EditNotesDialog.cpp @@ -12,7 +12,7 @@ EditNotesDialog::EditNotesDialog( QString notes, QString name, QWidget* parent ) { ui->setupUi(this); ui->noteEditor->setText(notes); - setWindowTitle("Edit notes of " + m_instance_name); + setWindowTitle(tr("Edit notes of %1").arg(m_instance_name)); //connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); } diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index 2dd80292..f3947d21 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -41,8 +41,8 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : contentsWidget->setModel(MMC->icons()); - auto buttonAdd = ui->buttonBox->addButton("Add Icon",QDialogButtonBox::ResetRole); - auto buttonRemove = ui->buttonBox->addButton("Remove Icon",QDialogButtonBox::ResetRole); + auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"),QDialogButtonBox::ResetRole); + auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"),QDialogButtonBox::ResetRole); connect(buttonAdd,SIGNAL(clicked(bool)),SLOT(addNewIcon())); @@ -87,7 +87,10 @@ bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt) void IconPickerDialog::addNewIcon() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Icons", QString(), "Icons (*.png *.jpg *.jpeg)"); + //: The title of the select icons open file dialog + QString selectIcons = tr("Select Icons"); + //: The type of icon files + QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), tr("Icons") + "(*.png *.jpg *.jpeg)"); MMC->icons()->installIcons(fileNames); } diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 616fc050..c336f837 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -183,7 +183,8 @@ bool LegacyModEditDialog::eventFilter ( QObject* obj, QEvent* ev ) void LegacyModEditDialog::on_addCoreBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Core Mods"); + //: Title of core mod selection dialog + QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Core Mods")); for(auto filename:fileNames) { m_coremods->stopWatching(); @@ -197,7 +198,8 @@ void LegacyModEditDialog::on_addForgeBtn_clicked() } void LegacyModEditDialog::on_addJarBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Jar Mods"); + //: Title of jar mod selection dialog + QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Jar Mods")); for(auto filename:fileNames) { m_jarmods->stopWatching(); @@ -207,7 +209,8 @@ void LegacyModEditDialog::on_addJarBtn_clicked() } void LegacyModEditDialog::on_addModBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Loader Mods"); + //: Title of regular mod selection dialog + QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Loader Mods")); for(auto filename:fileNames) { m_mods->stopWatching(); @@ -217,7 +220,8 @@ void LegacyModEditDialog::on_addModBtn_clicked() } void LegacyModEditDialog::on_addTexPackBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Texture Packs"); + //: Title of texture pack selection dialog + QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Texture Packs")); for(auto filename:fileNames) { m_texturepacks->stopWatching(); diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 8e738fa1..15ff09a5 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -112,7 +112,7 @@ void OneSixModEditDialog::on_buttonBox_rejected() void OneSixModEditDialog::on_addModBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Loader Mods"); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Loader Mods"); for(auto filename:fileNames) { m_mods->stopWatching(); @@ -139,7 +139,7 @@ void OneSixModEditDialog::on_viewModBtn_clicked() void OneSixModEditDialog::on_addResPackBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Resource Packs"); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Resource Packs")); for(auto filename:fileNames) { m_resourcepacks->stopWatching(); diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 8ea90d45..392eb50d 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -89,7 +89,8 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() { ui->btnKillMinecraft->setEnabled(false); QMessageBox r_u_sure; - r_u_sure.setText("Kill Minecraft?"); + //: Main question of the kill confirmation dialog + r_u_sure.setText(tr("Kill Minecraft?")); r_u_sure.setInformativeText("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"); r_u_sure.setStandardButtons(QMessageBox::Yes | QMessageBox::No); r_u_sure.setDefaultButton(QMessageBox::Yes); diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index a4dad1c1..37e30c85 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -24,8 +24,8 @@ LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : { ui->setupUi(this); - //TODO: make translateable - offlineButton = new QPushButton("Offline Once"); + //: Use offline mode one time + offlineButton = new QPushButton(tr("Offline Once")); ui->loginButtonBox->addButton(offlineButton, QDialogButtonBox::ActionRole); @@ -33,8 +33,8 @@ LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : isOnline_ = true; onlineForced = false; - //FIXME: translateable? - ui->usernameTextBox->lineEdit()->setPlaceholderText(QApplication::translate("LoginDialog", "Name", 0)); + //: The username during login (placeholder) + ui->usernameTextBox->lineEdit()->setPlaceholderText(tr("Name")); connect(ui->usernameTextBox, SIGNAL(currentTextChanged(QString)), this, SLOT(userTextChanged(QString))); connect(ui->forgetButton, SIGNAL(clicked(bool)), this, SLOT(forgetCurrentUser())); diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index 9de92754..c3215b7b 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -54,7 +54,7 @@ void LWJGLSelectDialog::loadingStateUpdated(bool loading) setEnabled(!loading); if (loading) { - ui->labelStatus->setText("Loading LWJGL version list..."); + ui->labelStatus->setText(tr("Loading LWJGL version list...")); ui->labelStatus->setStyleSheet("QLabel { color: black; }"); } ui->labelStatus->setVisible(loading); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 7ddc66a9..747df047 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -587,7 +587,7 @@ void MainWindow::on_actionMakeDesktopShortcut_triggered() Util::createShortCut ( Util::getDesktopDir(), QApplication::instance()->applicationFilePath(), QStringList() << "-dl" << QDir::currentPath() << "test", name, "application-x-octet-stream" ); - QMessageBox::warning ( this, "Not useful", "A Dummy Shortcut was created. it will not do anything productive" ); + QMessageBox::warning ( this, tr("Not useful"), tr("A Dummy Shortcut was created. it will not do anything productive") ); } // BrowserDialog @@ -658,7 +658,7 @@ void MainWindow::selectionBad() QString iconKey = "infinity"; statusBar()->clearMessage(); ui->instanceToolBar->setEnabled(false); - renameButton->setText("Rename Instance"); + renameButton->setText(tr("Rename Instance")); auto ico = MMC->icons()->getIcon(iconKey); ui->actionChangeInstIcon->setIcon(ico); } diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index a1fbb8e7..a5283b36 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -49,7 +49,7 @@ void SettingsDialog::updateCheckboxStuff() void SettingsDialog::on_instDirBrowseBtn_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, "Instance Directory", + QString dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"), ui->instDirTextBox->text()); if (!dir.isEmpty()) ui->instDirTextBox->setText(dir); @@ -57,7 +57,7 @@ void SettingsDialog::on_instDirBrowseBtn_clicked() void SettingsDialog::on_modsDirBrowseBtn_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, "Mods Directory", + QString dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"), ui->modsDirTextBox->text()); if (!dir.isEmpty()) ui->modsDirTextBox->setText(dir); @@ -65,7 +65,7 @@ void SettingsDialog::on_modsDirBrowseBtn_clicked() void SettingsDialog::on_lwjglDirBrowseBtn_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, "LWJGL Directory", + QString dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"), ui->lwjglDirTextBox->text()); if (!dir.isEmpty()) ui->lwjglDirTextBox->setText(dir); @@ -99,9 +99,9 @@ void SettingsDialog::applySettings(SettingsObject *s) } else if (!s->get("UseDevBuilds").toBool()) { - int response = QMessageBox::question(this, "Development builds", - "Development builds contain experimental features " - "and may be unstable. Are you sure you want to enable them?"); + int response = QMessageBox::question(this, tr("Development builds"), + tr("Development builds contain experimental features " + "and may be unstable. Are you sure you want to enable them?")); if (response == QMessageBox::Yes) { s->set("UseDevBuilds", true); -- cgit v1.2.3 From 3a08f01509bb7671d199951b8000a3a854889d64 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Sun, 8 Sep 2013 20:18:55 +0200 Subject: Changed CMakeList.txt to support translations --- gui/OneSixModEditDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 15ff09a5..ab6ad5f0 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -112,7 +112,7 @@ void OneSixModEditDialog::on_buttonBox_rejected() void OneSixModEditDialog::on_addModBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Loader Mods"); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Loader Mods")); for(auto filename:fileNames) { m_mods->stopWatching(); -- cgit v1.2.3 From 3e1cb5798835917bd64f34dc52fa1ca44eb4c7b2 Mon Sep 17 00:00:00 2001 From: Stiepen22 Date: Sun, 8 Sep 2013 23:43:19 +0200 Subject: Filed attempt on making localization work --- gui/consolewindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 392eb50d..628c5f00 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -91,7 +91,7 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() QMessageBox r_u_sure; //: Main question of the kill confirmation dialog r_u_sure.setText(tr("Kill Minecraft?")); - r_u_sure.setInformativeText("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"); + r_u_sure.setInformativeText(tr("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason")); r_u_sure.setStandardButtons(QMessageBox::Yes | QMessageBox::No); r_u_sure.setDefaultButton(QMessageBox::Yes); if (r_u_sure.exec() == QMessageBox::Yes) -- cgit v1.2.3 From 5cd3420c46e0b54f1479ddf720a8c9131c460a5e Mon Sep 17 00:00:00 2001 From: TakSuyu Date: Sun, 15 Sep 2013 14:11:58 -0700 Subject: Changed about source code link to reflect the new organization --- gui/aboutdialog.ui | 100 +++++++++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 46 deletions(-) (limited to 'gui') diff --git a/gui/aboutdialog.ui b/gui/aboutdialog.ui index 6b8f906d..ac4952f9 100644 --- a/gui/aboutdialog.ui +++ b/gui/aboutdialog.ui @@ -101,7 +101,7 @@ 0 0 432 - 153 + 159 @@ -145,7 +145,7 @@ - <html><head/><body><p><a href="http://github.com/Forkk/MultiMC5"><span style=" text-decoration: underline; color:#0000ff;">http://github.com/Forkk/MultiMC5</span></a></p></body></html> + <html><head/><body><p><a href="http://github.com/Forkk/MultiMC5"><span style=" text-decoration: underline; color:#0000ff;">http://github.com/MultiMC/MultiMC5</span></a></p></body></html> Qt::AlignCenter @@ -159,8 +159,8 @@ 0 0 - 432 - 153 + 98 + 93 @@ -176,16 +176,24 @@ <!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:'Ubuntu'; 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;">Andrew Okin &lt;<a href="mailto:forkk@forkk.net"><span style=" text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a>&gt;</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Petr Mrázek &lt;<a href="mailto:peterix@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a>&gt;</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Orochimarufan &lt;<a href="mailto:orochimarufan.x3@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a>&gt;</p></body></html> +</style></head><body style=" font-family:'Sans'; font-size:10pt; 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'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html> + + + 0 + 0 + 98 + 93 + + License @@ -205,44 +213,44 @@ p, li { white-space: pre-wrap; } <!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:'Ubuntu'; 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-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;">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> -<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;"><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-size:10pt;"> http://www.apache.org/licenses/LICENSE-2.0</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;"><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-size:10pt;">Unless required by applicable law or agreed to in writing, software</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;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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;">See the License for the specific language governing permissions and</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;">limitations under the 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-size:10pt;"><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-size:10pt;">MultiMC uses bspatch, </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 2003-2005 Colin Percival</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;">All rights reserved</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;"><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-size:10pt;">Redistribution and use in source and binary forms, with or without</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;">modification, are permitted providing that the following conditions</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;">are met: </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;">1. Redistributions of source code must retain the above copyright</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;"> notice, this list of conditions and the following disclaimer.</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;">2. Redistributions in binary form must reproduce the above copyright</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;"> notice, this list of conditions and the following disclaimer in the</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;"> documentation and/or other materials provided with the distribution.</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;"><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-size:10pt;">THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR</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;">IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</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;">ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY</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;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</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;">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</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;">OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</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;">HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,</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;">STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING</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;">IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</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;">POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> +</style></head><body style=" font-family:'Sans'; font-size:10pt; 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';">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-family:'Ubuntu';">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-family:'Ubuntu';">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-family:'Ubuntu';">You may obtain a copy of the License at</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:'Ubuntu';"><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';"> http://www.apache.org/licenses/LICENSE-2.0</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:'Ubuntu';"><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';">Unless required by applicable law or agreed to in writing, software</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';">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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';">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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';">See the License for the specific language governing permissions and</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';">limitations under the 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:'Ubuntu';"><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';">MultiMC uses bspatch, </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';">Copyright 2003-2005 Colin Percival</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';">All rights reserved</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:'Ubuntu';"><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';">Redistribution and use in source and binary forms, with or without</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';">modification, are permitted providing that the following conditions</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';">are met: </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';">1. Redistributions of source code must retain the above copyright</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';"> notice, this list of conditions and the following disclaimer.</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';">2. Redistributions in binary form must reproduce the above copyright</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';"> notice, this list of conditions and the following disclaimer in the</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';"> documentation and/or other materials provided with the distribution.</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:'Ubuntu';"><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';">THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR</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';">IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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';">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</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';">ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY</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';">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</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';">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</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';">OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</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';">HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,</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';">STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING</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';">IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</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';">POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> -- cgit v1.2.3 From d38b90530b3ba3a49c4eb072eb344ae2b0836913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 16 Sep 2013 00:54:39 +0200 Subject: Forge version list implementation. Needs integration and testing. --- gui/ModListView.cpp | 3 +- gui/OneSixModEditDialog.cpp | 12 +++- gui/OneSixModEditDialog.h | 1 + gui/OneSixModEditDialog.ui | 135 +++++++++++++++++++++++++++++++++++++------- gui/lwjglselectdialog.cpp | 16 +++--- gui/mainwindow.cpp | 12 ++-- gui/newinstancedialog.cpp | 14 ++--- gui/newinstancedialog.h | 8 +-- gui/versionselectdialog.cpp | 14 ++--- gui/versionselectdialog.h | 10 ++-- 10 files changed, 166 insertions(+), 59 deletions(-) (limited to 'gui') diff --git a/gui/ModListView.cpp b/gui/ModListView.cpp index 34bd4af2..1d0e834c 100644 --- a/gui/ModListView.cpp +++ b/gui/ModListView.cpp @@ -30,6 +30,7 @@ void ModListView::setModel ( QAbstractItemModel* model ) auto head = header(); head->setStretchLastSection(false); head->setSectionResizeMode(0, QHeaderView::Stretch); - head->setSectionResizeMode(1, QHeaderView::ResizeToContents); + for(int i = 1; i < head->count(); i++) + head->setSectionResizeMode(i, QHeaderView::ResizeToContents); dropIndicatorPosition(); } diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index ab6ad5f0..f778127f 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -22,6 +22,8 @@ #include #include #include +#include "logic/OneSixVersion.h" +#include OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent): m_inst(inst), @@ -29,9 +31,15 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent) ui(new Ui::OneSixModEditDialog) { ui->setupUi(this); - //TODO: libraries! + //libraries! { - // yeah... here be the real dragons. + m_version = m_inst->getFullVersion(); + + auto filter = new EnabledItemFilter(this); + filter->setActive(true); + filter->setSourceModel(m_version.data()); + ui->libraryTreeView->setModel(filter); + ui->libraryTreeView->installEventFilter( this ); } // Loader mods { diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index 3430bd26..c637df01 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -46,6 +46,7 @@ protected: bool resourcePackListFilter( QKeyEvent* ev ); private: Ui::OneSixModEditDialog *ui; + QSharedPointer m_version; QSharedPointer m_mods; QSharedPointer m_resourcepacks; OneSixInstance * m_inst; diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index 3feca726..bffcaed0 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -6,15 +6,15 @@ 0 0 - 543 - 423 + 555 + 463 Dialog - - + + true @@ -28,26 +28,121 @@ 0 - - Qt::ElideNone - - - false - - Library + Version - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - + + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff + + + + + + + + + Main Class: + + + + + + + + + + + + + + + + Replace any current custom version with Minecraft Forge + + + Install Forge + + + + + + + Create an customized copy of the base version + + + Customize + + + + + + + Revert to original base version + + + Revert + + + + + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + + false + + + Add new libraries + + + &Add + + + + + + + false + + + Remove selected libraries + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -163,7 +258,7 @@ - + false diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index c3215b7b..7c424a6c 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include "MultiMC.h" #include "lwjglselectdialog.h" #include "ui_lwjglselectdialog.h" @@ -24,11 +25,12 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) : { ui->setupUi(this); ui->labelStatus->setVisible(false); - ui->lwjglListView->setModel(&LWJGLVersionList::get()); + auto lwjgllist = MMC->lwjgllist(); + ui->lwjglListView->setModel(lwjgllist); - connect(&LWJGLVersionList::get(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); - connect(&LWJGLVersionList::get(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); - loadingStateUpdated(LWJGLVersionList::get().isLoading()); + connect(lwjgllist, SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); + connect(lwjgllist, SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); + loadingStateUpdated(lwjgllist->isLoading()); } LWJGLSelectDialog::~LWJGLSelectDialog() @@ -38,15 +40,15 @@ LWJGLSelectDialog::~LWJGLSelectDialog() QString LWJGLSelectDialog::selectedVersion() const { - return LWJGLVersionList::get().data( + return MMC->lwjgllist()->data( ui->lwjglListView->selectionModel()->currentIndex(), Qt::DisplayRole).toString(); } void LWJGLSelectDialog::on_refreshButton_clicked() { - if (!LWJGLVersionList::get().isLoading()) - LWJGLVersionList::get().loadList(); + if (!MMC->lwjgllist()->isLoading()) + MMC->lwjgllist()->loadList(); } void LWJGLSelectDialog::loadingStateUpdated(bool loading) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 747df047..241df383 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -154,14 +154,14 @@ MainWindow::MainWindow ( QWidget *parent ) // run the things that load and download other things... FIXME: this is NOT the place // FIXME: invisible actions in the background = NOPE. { - if (!MinecraftVersionList::getMainList().isLoaded()) + if (!MMC->minecraftlist()->isLoaded()) { - m_versionLoadTask = MinecraftVersionList::getMainList().getLoadTask(); + m_versionLoadTask = MMC->minecraftlist()->getLoadTask(); startTask(m_versionLoadTask); } - if (!LWJGLVersionList::get().isLoaded()) + if (!MMC->lwjgllist()->isLoaded()) { - LWJGLVersionList::get().loadList(); + MMC->lwjgllist()->loadList(); } assets_downloader = new OneSixAssets(); assets_downloader->start(); @@ -245,7 +245,7 @@ void MainWindow::instanceActivated ( QModelIndex index ) void MainWindow::on_actionAddInstance_triggered() { - if (!MinecraftVersionList::getMainList().isLoaded() && + if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask && m_versionLoadTask->isRunning()) { QEventLoop waitLoop; @@ -604,7 +604,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() VersionSelectDialog vselect(m_selectedInstance->versionList(), this); if (vselect.exec() && vselect.selectedVersion()) { - m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor); + m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); } } diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index ac3bcd7d..af2b11c5 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -18,7 +18,7 @@ #include "ui_newinstancedialog.h" #include "logic/InstanceFactory.h" -#include "logic/InstanceVersion.h" +#include "logic/BaseVersion.h" #include "logic/lists/IconList.h" #include "logic/lists/MinecraftVersionList.h" #include "logic/tasks/Task.h" @@ -48,7 +48,7 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) : taskDlg->exec(loadTask); } */ - setSelectedVersion(MinecraftVersionList::getMainList().getLatestStable()); + setSelectedVersion(MMC->minecraftlist()->getLatestStable()); InstIconKey = "infinity"; ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); } @@ -63,13 +63,13 @@ void NewInstanceDialog::updateDialogState() ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty() && m_selectedVersion); } -void NewInstanceDialog::setSelectedVersion(InstVersionPtr version) +void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version) { m_selectedVersion = version; if (m_selectedVersion) { - ui->versionTextBox->setText(version->name); + ui->versionTextBox->setText(version->name()); } else { @@ -89,18 +89,18 @@ QString NewInstanceDialog::iconKey() const return InstIconKey; } -InstVersionPtr NewInstanceDialog::selectedVersion() const +BaseVersionPtr NewInstanceDialog::selectedVersion() const { return m_selectedVersion; } void NewInstanceDialog::on_btnChangeVersion_clicked() { - VersionSelectDialog vselect(&MinecraftVersionList::getMainList(), this); + VersionSelectDialog vselect(MMC->minecraftlist(), this); vselect.exec(); if (vselect.result() == QDialog::Accepted) { - InstVersionPtr version = vselect.selectedVersion(); + BaseVersionPtr version = vselect.selectedVersion(); if (version) setSelectedVersion(version); } diff --git a/gui/newinstancedialog.h b/gui/newinstancedialog.h index e8c57024..408cf757 100644 --- a/gui/newinstancedialog.h +++ b/gui/newinstancedialog.h @@ -17,7 +17,7 @@ #define NEWINSTANCEDIALOG_H #include -#include "logic/InstanceVersion.h" +#include "logic/BaseVersion.h" namespace Ui { class NewInstanceDialog; @@ -33,13 +33,13 @@ public: void updateDialogState(); - void setSelectedVersion(InstVersionPtr version); + void setSelectedVersion(BaseVersionPtr version); void loadVersionList(); QString instName() const; QString iconKey() const; - InstVersionPtr selectedVersion() const; + BaseVersionPtr selectedVersion() const; private slots: void on_btnChangeVersion_clicked(); @@ -49,7 +49,7 @@ private slots: private: Ui::NewInstanceDialog *ui; - InstVersionPtr m_selectedVersion; + BaseVersionPtr m_selectedVersion; QString InstIconKey; }; diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index 66d772b0..b14956fd 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -22,11 +22,11 @@ #include -#include -#include +#include +#include #include -VersionSelectDialog::VersionSelectDialog(InstVersionList *vlist, QWidget *parent) : +VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QWidget *parent) : QDialog(parent), ui(new Ui::VersionSelectDialog) { @@ -69,11 +69,11 @@ void VersionSelectDialog::loadList() taskDlg->exec(loadTask); } -InstVersionPtr VersionSelectDialog::selectedVersion() const +BaseVersionPtr VersionSelectDialog::selectedVersion() const { auto currentIndex = ui->listView->selectionModel()->currentIndex(); - auto variant = m_proxyModel->data(currentIndex, InstVersionList::VersionPointerRole); - return variant.value(); + auto variant = m_proxyModel->data(currentIndex, BaseVersionList::VersionPointerRole); + return variant.value(); } void VersionSelectDialog::on_refreshButton_clicked() @@ -83,7 +83,7 @@ void VersionSelectDialog::on_refreshButton_clicked() void VersionSelectDialog::updateFilterState() { - m_proxyModel->setFilterKeyColumn(InstVersionList::TypeColumn); + m_proxyModel->setFilterKeyColumn(BaseVersionList::TypeColumn); QStringList filteredTypes; if (!ui->filterSnapshotsCheckbox->isChecked()) diff --git a/gui/versionselectdialog.h b/gui/versionselectdialog.h index b864aee1..57e4d0df 100644 --- a/gui/versionselectdialog.h +++ b/gui/versionselectdialog.h @@ -19,9 +19,9 @@ #include #include -#include "logic/InstanceVersion.h" +#include "logic/BaseVersion.h" -class InstVersionList; +class BaseVersionList; namespace Ui { @@ -33,7 +33,7 @@ class VersionSelectDialog : public QDialog Q_OBJECT public: - explicit VersionSelectDialog(InstVersionList *vlist, QWidget *parent = 0); + explicit VersionSelectDialog(BaseVersionList *vlist, QWidget *parent = 0); ~VersionSelectDialog(); virtual int exec(); @@ -41,7 +41,7 @@ public: //! Starts a task that loads the list. void loadList(); - InstVersionPtr selectedVersion() const; + BaseVersionPtr selectedVersion() const; private slots: void on_refreshButton_clicked(); @@ -51,7 +51,7 @@ private slots: private: Ui::VersionSelectDialog *ui; - InstVersionList *m_vlist; + BaseVersionList *m_vlist; QSortFilterProxyModel *m_proxyModel; }; -- cgit v1.2.3 From b979d0ce5da515793a02802a6421ef607a498323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 18 Sep 2013 00:00:35 +0200 Subject: Implement legacy forge button! Many refactors of the task system. Progress dialog now accepts generic ProgressProvider objects --- gui/LegacyModEditDialog.cpp | 41 ++++++++++++++++- gui/LegacyModEditDialog.h | 2 + gui/LegacyModEditDialog.ui | 3 -- gui/OneSixModEditDialog.cpp | 22 +++++++-- gui/OneSixModEditDialog.h | 1 + gui/OneSixModEditDialog.ui | 2 +- gui/ProgressDialog.cpp | 108 ++++++++++++++++++++++++++++++++++++++++++++ gui/ProgressDialog.h | 62 +++++++++++++++++++++++++ gui/ProgressDialog.ui | 53 ++++++++++++++++++++++ gui/mainwindow.cpp | 8 ++-- gui/newinstancedialog.cpp | 2 +- gui/taskdialog.cpp | 107 ------------------------------------------- gui/taskdialog.h | 61 ------------------------- gui/taskdialog.ui | 53 ---------------------- gui/versionselectdialog.cpp | 19 +++----- gui/versionselectdialog.h | 5 +- gui/versionselectdialog.ui | 69 ---------------------------- 17 files changed, 298 insertions(+), 320 deletions(-) create mode 100644 gui/ProgressDialog.cpp create mode 100644 gui/ProgressDialog.h create mode 100644 gui/ProgressDialog.ui delete mode 100644 gui/taskdialog.cpp delete mode 100644 gui/taskdialog.h delete mode 100644 gui/taskdialog.ui (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index c336f837..ac7f7f25 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -13,10 +13,15 @@ * limitations under the License. */ +#include "MultiMC.h" #include "LegacyModEditDialog.h" #include "ModEditDialogCommon.h" +#include "versionselectdialog.h" +#include "ProgressDialog.h" #include "ui_LegacyModEditDialog.h" -#include +#include "logic/ModList.h" +#include "logic/lists/ForgeVersionList.h" + #include #include #include @@ -194,7 +199,39 @@ void LegacyModEditDialog::on_addCoreBtn_clicked() } void LegacyModEditDialog::on_addForgeBtn_clicked() { - + VersionSelectDialog vselect(MMC->forgelist(), this); + vselect.setFilter(1, m_inst->intendedVersionId()); + if (vselect.exec() && vselect.selectedVersion()) + { + ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast(); + if(!forge) + return; + auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename); + if(entry->stale) + { + DownloadJob * fjob = new DownloadJob("Forge download"); + fjob->add(forge->universal_url, entry); + ProgressDialog dlg(this); + dlg.exec(fjob); + if(dlg.result() == QDialog::Accepted) + { + m_jarmods->stopWatching(); + m_jarmods->installMod(QFileInfo(entry->getFullPath())); + m_jarmods->startWatching(); + } + else + { + // failed to download forge :/ + } + } + else + { + m_jarmods->stopWatching(); + m_jarmods->installMod(QFileInfo(entry->getFullPath())); + m_jarmods->startWatching(); + } + //m_selectedInstance->setIntendedVersionId(->descriptor()); + } } void LegacyModEditDialog::on_addJarBtn_clicked() { diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index bc9ebac0..b824a86a 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -17,6 +17,7 @@ #include #include "logic/LegacyInstance.h" +#include namespace Ui { class LegacyModEditDialog; @@ -64,4 +65,5 @@ private: QSharedPointer m_jarmods; QSharedPointer m_texturepacks; LegacyInstance * m_inst; + DownloadJobPtr forgeJob; }; diff --git a/gui/LegacyModEditDialog.ui b/gui/LegacyModEditDialog.ui index bd147c85..73b767dc 100644 --- a/gui/LegacyModEditDialog.ui +++ b/gui/LegacyModEditDialog.ui @@ -52,9 +52,6 @@ - - false - MCForge diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index f778127f..fad9d2e2 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -12,18 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include "MultiMC.h" #include "OneSixModEditDialog.h" #include "ModEditDialogCommon.h" #include "ui_OneSixModEditDialog.h" -#include +#include "logic/ModList.h" +#include "logic/OneSixVersion.h" +#include "logic/EnabledItemFilter.h" +#include "logic/lists/ForgeVersionList.h" +#include "gui/versionselectdialog.h" + #include #include #include #include #include -#include "logic/OneSixVersion.h" -#include OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent): m_inst(inst), @@ -66,6 +69,17 @@ OneSixModEditDialog::~OneSixModEditDialog() delete ui; } +void OneSixModEditDialog::on_forgeBtn_clicked() +{ + VersionSelectDialog vselect(MMC->forgelist(), this); + vselect.setFilter(1, m_inst->currentVersionId()); + if (vselect.exec() && vselect.selectedVersion()) + { + //m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); + } +} + + bool OneSixModEditDialog::loaderListFilter ( QKeyEvent* keyEvent ) { switch(keyEvent->key()) diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index c637df01..d14c842c 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -40,6 +40,7 @@ private slots: void on_viewResPackBtn_clicked(); // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); + void on_forgeBtn_clicked(); protected: bool eventFilter(QObject *obj, QEvent *ev); bool loaderListFilter( QKeyEvent* ev ); diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index bffcaed0..aadaf3ae 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -64,7 +64,7 @@ - + Replace any current custom version with Minecraft Forge diff --git a/gui/ProgressDialog.cpp b/gui/ProgressDialog.cpp new file mode 100644 index 00000000..154ab1c0 --- /dev/null +++ b/gui/ProgressDialog.cpp @@ -0,0 +1,108 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ProgressDialog.h" +#include "ui_ProgressDialog.h" + +#include + +#include "logic/tasks/Task.h" + +ProgressDialog::ProgressDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ProgressDialog) +{ + ui->setupUi(this); + updateSize(); + + changeProgress(0,100); +} + +ProgressDialog::~ProgressDialog() +{ + delete ui; +} + +void ProgressDialog::updateSize() +{ + resize(QSize(480, minimumSizeHint().height())); +} + +int ProgressDialog::exec(ProgressProvider *task) +{ + this->task = task; + + // Connect signals. + connect(task, SIGNAL(started()), SLOT(onTaskStarted())); + connect(task, SIGNAL(failed(QString)), SLOT(onTaskFailed(QString))); + connect(task, SIGNAL(succeeded()), SLOT(onTaskSucceeded())); + connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString&))); + connect(task, SIGNAL(progress(qint64,qint64)), SLOT(changeProgress(qint64,qint64))); + + // this makes sure that the task is started after the dialog is created + QMetaObject::invokeMethod(task, "start", Qt::QueuedConnection); + return QDialog::exec(); +} + +ProgressProvider* ProgressDialog::getTask() +{ + return task; +} + +void ProgressDialog::onTaskStarted() +{ + +} + +void ProgressDialog::onTaskFailed(QString failure) +{ + reject(); +} + +void ProgressDialog::onTaskSucceeded() +{ + accept(); +} + +void ProgressDialog::changeStatus(const QString &status) +{ + ui->statusLabel->setText(status); + updateSize(); +} + +void ProgressDialog::changeProgress(qint64 current, qint64 total) +{ + ui->taskProgressBar->setMaximum(total); + ui->taskProgressBar->setValue(current); +} + +void ProgressDialog::keyPressEvent(QKeyEvent* e) +{ + if (e->key() == Qt::Key_Escape) + return; + QDialog::keyPressEvent(e); +} + +void ProgressDialog::closeEvent(QCloseEvent* e) +{ + if (task && task->isRunning()) + { + e->ignore(); + } + else + { + QDialog::closeEvent(e); + } +} diff --git a/gui/ProgressDialog.h b/gui/ProgressDialog.h new file mode 100644 index 00000000..ac6bb412 --- /dev/null +++ b/gui/ProgressDialog.h @@ -0,0 +1,62 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TASKDIALOG_H +#define TASKDIALOG_H + +#include + +class ProgressProvider; + +namespace Ui { +class ProgressDialog; +} + +class ProgressDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ProgressDialog(QWidget *parent = 0); + ~ProgressDialog(); + + void updateSize(); + + int exec(ProgressProvider* task); + + ProgressProvider* getTask(); + +public slots: + void onTaskStarted(); + void onTaskFailed(QString failure); + void onTaskSucceeded(); + + void changeStatus(const QString& status); + void changeProgress(qint64 current, qint64 total); + +signals: + + +protected: + virtual void keyPressEvent(QKeyEvent* e); + virtual void closeEvent(QCloseEvent* e); + +private: + Ui::ProgressDialog *ui; + + ProgressProvider* task; +}; + +#endif // TASKDIALOG_H diff --git a/gui/ProgressDialog.ui b/gui/ProgressDialog.ui new file mode 100644 index 00000000..a56d2a92 --- /dev/null +++ b/gui/ProgressDialog.ui @@ -0,0 +1,53 @@ + + + ProgressDialog + + + + 0 + 0 + 400 + 68 + + + + + 400 + 0 + + + + + 600 + 16777215 + + + + Please wait... + + + + + + Task Status... + + + true + + + + + + + 24 + + + false + + + + + + + + diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 241df383..6f707236 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -42,7 +42,7 @@ #include "gui/settingsdialog.h" #include "gui/newinstancedialog.h" #include "gui/logindialog.h" -#include "gui/taskdialog.h" +#include "gui/ProgressDialog.h" #include "gui/aboutdialog.h" #include "gui/versionselectdialog.h" #include "gui/lwjglselectdialog.h" @@ -479,7 +479,7 @@ void MainWindow::doLogin(const QString& errorMsg) { UserInfo uInfo{loginDlg->getUsername(), loginDlg->getPassword()}; - TaskDialog* tDialog = new TaskDialog(this); + ProgressDialog* tDialog = new ProgressDialog(this); LoginTask* loginTask = new LoginTask(uInfo, tDialog); connect(loginTask, SIGNAL(succeeded()),SLOT(onLoginComplete()), Qt::QueuedConnection); connect(loginTask, SIGNAL(failed(QString)), SLOT(doLogin(QString)), Qt::QueuedConnection); @@ -512,7 +512,7 @@ void MainWindow::onLoginComplete() } else { - TaskDialog *tDialog = new TaskDialog(this); + ProgressDialog *tDialog = new ProgressDialog(this); connect(updateTask, SIGNAL(succeeded()),SLOT(onGameUpdateComplete())); connect(updateTask, SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); tDialog->exec(updateTask); @@ -575,7 +575,7 @@ void MainWindow::startTask(Task *task) connect(task, SIGNAL(started()), SLOT(taskStart())); connect(task, SIGNAL(succeeded()), SLOT(taskEnd())); connect(task, SIGNAL(failed(QString)), SLOT(taskEnd())); - task->startTask(); + task->start(); } diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index af2b11c5..6604d03b 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -24,7 +24,7 @@ #include "logic/tasks/Task.h" #include "versionselectdialog.h" -#include "taskdialog.h" +#include "ProgressDialog.h" #include "IconPickerDialog.h" #include diff --git a/gui/taskdialog.cpp b/gui/taskdialog.cpp deleted file mode 100644 index 8c745b38..00000000 --- a/gui/taskdialog.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "taskdialog.h" -#include "ui_taskdialog.h" - -#include - -#include "logic/tasks/Task.h" - -TaskDialog::TaskDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::TaskDialog) -{ - ui->setupUi(this); - updateSize(); - - changeProgress(0); -} - -TaskDialog::~TaskDialog() -{ - delete ui; -} - -void TaskDialog::updateSize() -{ - resize(QSize(480, minimumSizeHint().height())); -} - -void TaskDialog::exec(Task *task) -{ - this->task = task; - - // Connect signals. - connect(task, SIGNAL(started()), SLOT(onTaskStarted())); - connect(task, SIGNAL(failed(QString)), SLOT(onTaskEnded())); - connect(task, SIGNAL(succeeded()), SLOT(onTaskEnded())); - connect(task, SIGNAL(statusChanged(const QString&)), SLOT(changeStatus(const QString&))); - connect(task, SIGNAL(progressChanged(int)), SLOT(changeProgress(int))); - - // this makes sure that the task is started after the dialog is created - QMetaObject::invokeMethod(task, "startTask", Qt::QueuedConnection); - QDialog::exec(); -} - -Task* TaskDialog::getTask() -{ - return task; -} - -void TaskDialog::onTaskStarted() -{ - -} - -void TaskDialog::onTaskEnded() -{ - close(); -} - -void TaskDialog::changeStatus(const QString &status) -{ - ui->statusLabel->setText(status); - updateSize(); -} - -void TaskDialog::changeProgress(int progress) -{ - if (progress < 0) - progress = 0; - else if (progress > 100) - progress = 100; - - ui->taskProgressBar->setValue(progress); -} - -void TaskDialog::keyPressEvent(QKeyEvent* e) -{ - if (e->key() == Qt::Key_Escape) - return; - QDialog::keyPressEvent(e); -} - -void TaskDialog::closeEvent(QCloseEvent* e) -{ - if (task && task->isRunning()) - { - e->ignore(); - } - else - { - QDialog::closeEvent(e); - } -} diff --git a/gui/taskdialog.h b/gui/taskdialog.h deleted file mode 100644 index 3d31b7be..00000000 --- a/gui/taskdialog.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TASKDIALOG_H -#define TASKDIALOG_H - -#include - -class Task; - -namespace Ui { -class TaskDialog; -} - -class TaskDialog : public QDialog -{ - Q_OBJECT - -public: - explicit TaskDialog(QWidget *parent = 0); - ~TaskDialog(); - - void updateSize(); - - void exec(Task* task); - - Task* getTask(); - -public slots: - void onTaskStarted(); - void onTaskEnded(); - - void changeStatus(const QString& status); - void changeProgress(int progress); - -signals: - - -protected: - virtual void keyPressEvent(QKeyEvent* e); - virtual void closeEvent(QCloseEvent* e); - -private: - Ui::TaskDialog *ui; - - Task* task; -}; - -#endif // TASKDIALOG_H diff --git a/gui/taskdialog.ui b/gui/taskdialog.ui deleted file mode 100644 index 1cdf7978..00000000 --- a/gui/taskdialog.ui +++ /dev/null @@ -1,53 +0,0 @@ - - - TaskDialog - - - - 0 - 0 - 400 - 58 - - - - - 400 - 0 - - - - - 600 - 16777215 - - - - Please wait... - - - - - - Task Status... - - - true - - - - - - - 24 - - - false - - - - - - - - diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index b14956fd..1e60c7d9 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include @@ -41,11 +41,6 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QWidget *parent ui->listView->setModel(m_proxyModel); ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - - connect(ui->filterSnapshotsCheckbox, SIGNAL(clicked()), SLOT(updateFilterState())); - connect(ui->filterMCNostalgiaCheckbox, SIGNAL(clicked()), SLOT(updateFilterState())); - - updateFilterState(); } VersionSelectDialog::~VersionSelectDialog() @@ -63,7 +58,7 @@ int VersionSelectDialog::exec() void VersionSelectDialog::loadList() { - TaskDialog *taskDlg = new TaskDialog(this); + ProgressDialog *taskDlg = new ProgressDialog(this); Task *loadTask = m_vlist->getLoadTask(); loadTask->setParent(taskDlg); taskDlg->exec(loadTask); @@ -81,10 +76,11 @@ void VersionSelectDialog::on_refreshButton_clicked() loadList(); } -void VersionSelectDialog::updateFilterState() +void VersionSelectDialog::setFilter(int column, QString filter) { - m_proxyModel->setFilterKeyColumn(BaseVersionList::TypeColumn); - + m_proxyModel->setFilterKeyColumn(column); + m_proxyModel->setFilterFixedString(filter); + /* QStringList filteredTypes; if (!ui->filterSnapshotsCheckbox->isChecked()) filteredTypes += "Snapshot"; @@ -96,6 +92,5 @@ void VersionSelectDialog::updateFilterState() regexStr = QString("^((?!%1).)*$").arg(filteredTypes.join('|')); qDebug() << "Filter:" << regexStr; - - m_proxyModel->setFilterRegExp(regexStr); + */ } diff --git a/gui/versionselectdialog.h b/gui/versionselectdialog.h index 57e4d0df..0bb1745a 100644 --- a/gui/versionselectdialog.h +++ b/gui/versionselectdialog.h @@ -43,11 +43,10 @@ public: BaseVersionPtr selectedVersion() const; + void setFilter(int column, QString filter); + private slots: void on_refreshButton_clicked(); - - void updateFilterState(); - private: Ui::VersionSelectDialog *ui; diff --git a/gui/versionselectdialog.ui b/gui/versionselectdialog.ui index 02937794..222f29cf 100644 --- a/gui/versionselectdialog.ui +++ b/gui/versionselectdialog.ui @@ -39,75 +39,6 @@ - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Show &snapshots? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Show &Nostalgia? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - -- cgit v1.2.3 From c2c7293083de8e8d40190992ccd6a65b613a4d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 20 Sep 2013 01:21:48 +0200 Subject: Things... and stuff... with 1.6 modding. Maybe. --- gui/LegacyModEditDialog.cpp | 1 - gui/OneSixModEditDialog.cpp | 85 +++++++++++++++++++++++++++++++++++++++++---- gui/OneSixModEditDialog.h | 5 +++ gui/OneSixModEditDialog.ui | 9 ++++- 4 files changed, 92 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index ac7f7f25..1a1198b1 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -230,7 +230,6 @@ void LegacyModEditDialog::on_addForgeBtn_clicked() m_jarmods->installMod(QFileInfo(entry->getFullPath())); m_jarmods->startWatching(); } - //m_selectedInstance->setIntendedVersionId(->descriptor()); } } void LegacyModEditDialog::on_addJarBtn_clicked() diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index fad9d2e2..7cbb9cbd 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -21,9 +21,11 @@ #include "logic/EnabledItemFilter.h" #include "logic/lists/ForgeVersionList.h" #include "gui/versionselectdialog.h" +#include "ProgressDialog.h" #include #include +#include #include #include #include @@ -38,11 +40,13 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent) { m_version = m_inst->getFullVersion(); - auto filter = new EnabledItemFilter(this); - filter->setActive(true); - filter->setSourceModel(m_version.data()); - ui->libraryTreeView->setModel(filter); + main_model = new EnabledItemFilter(this); + main_model->setActive(true); + main_model->setSourceModel(m_version.data()); + ui->libraryTreeView->setModel(main_model); ui->libraryTreeView->installEventFilter( this ); + ui->mainClassEdit->setText(m_version->mainClass); + updateButtons(); } // Loader mods { @@ -69,17 +73,86 @@ OneSixModEditDialog::~OneSixModEditDialog() delete ui; } +void OneSixModEditDialog::updateButtons() +{ + bool customVersion = m_inst->versionIsCustom(); + ui->customizeBtn->setEnabled(!customVersion); + ui->revertBtn->setEnabled(customVersion); +} + + +void OneSixModEditDialog::on_customizeBtn_clicked() +{ + if(m_inst->customizeVersion()) + { + m_version = m_inst->getFullVersion(); + main_model->setSourceModel(m_version.data()); + updateButtons(); + } +} + +void OneSixModEditDialog::on_revertBtn_clicked() +{ + auto reply = QMessageBox::question(this, tr("Revert?"), tr("Do you want to revert the version of this instance to its original configuration?"),QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + if(m_inst->revertCustomVersion()) + { + m_version = m_inst->getFullVersion(); + main_model->setSourceModel(m_version.data()); + updateButtons(); + } + } +} + + void OneSixModEditDialog::on_forgeBtn_clicked() { VersionSelectDialog vselect(MMC->forgelist(), this); vselect.setFilter(1, m_inst->currentVersionId()); if (vselect.exec() && vselect.selectedVersion()) { - //m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); + if(m_inst->versionIsCustom()) + { + auto reply = QMessageBox::question(this, tr("Revert?"), tr("This will revert any changes you did to the version up to this point. Is that OK?"),QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + m_inst->revertCustomVersion(); + m_inst->customizeVersion(); + { + m_version = m_inst->getFullVersion(); + main_model->setSourceModel(m_version.data()); + updateButtons(); + } + } + else return; + } + ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast(); + if(!forge) + return; + auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename); + if(entry->stale) + { + DownloadJob * fjob = new DownloadJob("Forge download"); + fjob->add(forge->universal_url, entry); + ProgressDialog dlg(this); + dlg.exec(fjob); + if(dlg.result() == QDialog::Accepted) + { + // install + } + else + { + // failed to download forge :/ + } + } + else + { + // install + } } } - bool OneSixModEditDialog::loaderListFilter ( QKeyEvent* keyEvent ) { switch(keyEvent->key()) diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index d14c842c..714c911a 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -18,6 +18,7 @@ #include +class EnabledItemFilter; namespace Ui { class OneSixModEditDialog; } @@ -41,6 +42,9 @@ private slots: // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); void on_forgeBtn_clicked(); + void on_customizeBtn_clicked(); + void on_revertBtn_clicked(); + void updateButtons(); protected: bool eventFilter(QObject *obj, QEvent *ev); bool loaderListFilter( QKeyEvent* ev ); @@ -50,5 +54,6 @@ private: QSharedPointer m_version; QSharedPointer m_mods; QSharedPointer m_resourcepacks; + EnabledItemFilter * main_model; OneSixInstance * m_inst; }; diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index aadaf3ae..527899ca 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -55,7 +55,11 @@ - + + + false + + @@ -85,6 +89,9 @@ + + false + Revert to original base version -- cgit v1.2.3 From ceca6959d2a7f258d62ac4f589095b65084706c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 22 Sep 2013 04:21:36 +0200 Subject: Working 1.6 modding (currently only forge) --- gui/IconPickerDialog.cpp | 4 +- gui/LegacyModEditDialog.cpp | 2 +- gui/OneSixModEditDialog.cpp | 179 ++++++++++++++++++++++++++------------------ gui/OneSixModEditDialog.h | 3 +- gui/instancedelegate.h | 2 +- gui/lwjglselectdialog.cpp | 6 +- gui/mainwindow.cpp | 6 +- gui/mainwindow.ui | 2 +- gui/newinstancedialog.cpp | 2 +- gui/settingsdialog.cpp | 4 +- 10 files changed, 124 insertions(+), 86 deletions(-) (limited to 'gui') diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index f3947d21..8f5d8256 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -39,7 +39,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : contentsWidget->installEventFilter(this); - contentsWidget->setModel(MMC->icons()); + contentsWidget->setModel(MMC->icons().data()); auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"),QDialogButtonBox::ResetRole); auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"),QDialogButtonBox::ResetRole); @@ -119,7 +119,7 @@ void IconPickerDialog::selectionChanged ( QItemSelection selected, QItemSelectio int IconPickerDialog::exec ( QString selection ) { - IconList * list = MMC->icons(); + auto list = MMC->icons(); auto contentsWidget = ui->iconView; selectedIconKey = selection; diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 1a1198b1..20296769 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -199,7 +199,7 @@ void LegacyModEditDialog::on_addCoreBtn_clicked() } void LegacyModEditDialog::on_addForgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist(), this); + VersionSelectDialog vselect(MMC->forgelist().data(), this); vselect.setFilter(1, m_inst->intendedVersionId()); if (vselect.exec() && vselect.selectedVersion()) { diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 7cbb9cbd..94fea933 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -1,9 +1,9 @@ /* Copyright 2013 MultiMC Contributors - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -20,6 +20,7 @@ #include "logic/OneSixVersion.h" #include "logic/EnabledItemFilter.h" #include "logic/lists/ForgeVersionList.h" +#include #include "gui/versionselectdialog.h" #include "ProgressDialog.h" @@ -30,30 +31,33 @@ #include #include -OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent): - m_inst(inst), - QDialog(parent), - ui(new Ui::OneSixModEditDialog) +OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) + : m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog) { ui->setupUi(this); - //libraries! + // libraries! + + m_version = m_inst->getFullVersion(); + if (m_version) { - m_version = m_inst->getFullVersion(); - main_model = new EnabledItemFilter(this); main_model->setActive(true); main_model->setSourceModel(m_version.data()); ui->libraryTreeView->setModel(main_model); - ui->libraryTreeView->installEventFilter( this ); + ui->libraryTreeView->installEventFilter(this); ui->mainClassEdit->setText(m_version->mainClass); - updateButtons(); + updateVersionControls(); + } + else + { + disableVersionControls(); } // Loader mods { ensureFolderPathExists(m_inst->loaderModsDir()); m_mods = m_inst->loaderModList(); ui->loaderModTreeView->setModel(m_mods.data()); - ui->loaderModTreeView->installEventFilter( this ); + ui->loaderModTreeView->installEventFilter(this); m_mods->startWatching(); } // resource packs @@ -61,7 +65,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent) ensureFolderPathExists(m_inst->resourcePacksDir()); m_resourcepacks = m_inst->resourcePackList(); ui->resPackTreeView->setModel(m_resourcepacks.data()); - ui->resPackTreeView->installEventFilter( this ); + ui->resPackTreeView->installEventFilter(this); m_resourcepacks->startWatching(); } } @@ -73,48 +77,62 @@ OneSixModEditDialog::~OneSixModEditDialog() delete ui; } -void OneSixModEditDialog::updateButtons() +void OneSixModEditDialog::updateVersionControls() { bool customVersion = m_inst->versionIsCustom(); ui->customizeBtn->setEnabled(!customVersion); ui->revertBtn->setEnabled(customVersion); + ui->forgeBtn->setEnabled(true); } +void OneSixModEditDialog::disableVersionControls() +{ + ui->customizeBtn->setEnabled(false); + ui->revertBtn->setEnabled(false); + ui->forgeBtn->setEnabled(false); +} void OneSixModEditDialog::on_customizeBtn_clicked() { - if(m_inst->customizeVersion()) + if (m_inst->customizeVersion()) { m_version = m_inst->getFullVersion(); main_model->setSourceModel(m_version.data()); - updateButtons(); + updateVersionControls(); } } void OneSixModEditDialog::on_revertBtn_clicked() { - auto reply = QMessageBox::question(this, tr("Revert?"), tr("Do you want to revert the version of this instance to its original configuration?"),QMessageBox::Yes|QMessageBox::No); + auto reply = QMessageBox::question( + this, tr("Revert?"), tr("Do you want to revert the " + "version of this instance to its original configuration?"), + QMessageBox::Yes | QMessageBox::No); if (reply == QMessageBox::Yes) { - if(m_inst->revertCustomVersion()) + if (m_inst->revertCustomVersion()) { m_version = m_inst->getFullVersion(); main_model->setSourceModel(m_version.data()); - updateButtons(); + updateVersionControls(); } } } - void OneSixModEditDialog::on_forgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist(), this); + VersionSelectDialog vselect(MMC->forgelist().data(), this); vselect.setFilter(1, m_inst->currentVersionId()); if (vselect.exec() && vselect.selectedVersion()) { - if(m_inst->versionIsCustom()) + if (m_inst->versionIsCustom()) { - auto reply = QMessageBox::question(this, tr("Revert?"), tr("This will revert any changes you did to the version up to this point. Is that OK?"),QMessageBox::Yes|QMessageBox::No); + auto reply = QMessageBox::question( + this, tr("Revert?"), + tr("This will revert any " + "changes you did to the version up to this point. Is that " + "OK?"), + QMessageBox::Yes | QMessageBox::No); if (reply == QMessageBox::Yes) { m_inst->revertCustomVersion(); @@ -122,24 +140,38 @@ void OneSixModEditDialog::on_forgeBtn_clicked() { m_version = m_inst->getFullVersion(); main_model->setSourceModel(m_version.data()); - updateButtons(); + updateVersionControls(); } } - else return; + else + return; + } + else + { + m_inst->customizeVersion(); + m_version = m_inst->getFullVersion(); + main_model->setSourceModel(m_version.data()); + updateVersionControls(); } - ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast(); - if(!forge) + ForgeVersionPtr forgeVersion = vselect.selectedVersion().dynamicCast(); + if (!forgeVersion) return; - auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename); - if(entry->stale) + auto entry = MMC->metacache()->resolveEntry("minecraftforge", forgeVersion->filename); + if (entry->stale) { - DownloadJob * fjob = new DownloadJob("Forge download"); - fjob->add(forge->universal_url, entry); + DownloadJob *fjob = new DownloadJob("Forge download"); + fjob->add(forgeVersion->installer_url, entry); ProgressDialog dlg(this); dlg.exec(fjob); - if(dlg.result() == QDialog::Accepted) + if (dlg.result() == QDialog::Accepted) { // install + QString forgePath = entry->getFullPath(); + ForgeInstaller forge(forgePath, forgeVersion->universal_url); + if (!forge.apply(m_version)) + { + // failure notice + } } else { @@ -149,55 +181,60 @@ void OneSixModEditDialog::on_forgeBtn_clicked() else { // install + QString forgePath = entry->getFullPath(); + ForgeInstaller forge(forgePath, forgeVersion->universal_url); + if (!forge.apply(m_version)) + { + // failure notice + } } } } -bool OneSixModEditDialog::loaderListFilter ( QKeyEvent* keyEvent ) +bool OneSixModEditDialog::loaderListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Delete: - on_rmModBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addModBtn_clicked(); - return true; - default: - break; + case Qt::Key_Delete: + on_rmModBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addModBtn_clicked(); + return true; + default: + break; } - return QDialog::eventFilter( ui->loaderModTreeView, keyEvent ); + return QDialog::eventFilter(ui->loaderModTreeView, keyEvent); } -bool OneSixModEditDialog::resourcePackListFilter ( QKeyEvent* keyEvent ) +bool OneSixModEditDialog::resourcePackListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Delete: - on_rmResPackBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addResPackBtn_clicked(); - return true; - default: - break; + case Qt::Key_Delete: + on_rmResPackBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addResPackBtn_clicked(); + return true; + default: + break; } - return QDialog::eventFilter( ui->resPackTreeView, keyEvent ); + return QDialog::eventFilter(ui->resPackTreeView, keyEvent); } - -bool OneSixModEditDialog::eventFilter ( QObject* obj, QEvent* ev ) +bool OneSixModEditDialog::eventFilter(QObject *obj, QEvent *ev) { if (ev->type() != QEvent::KeyPress) { - return QDialog::eventFilter( obj, ev ); + return QDialog::eventFilter(obj, ev); } - QKeyEvent *keyEvent = static_cast(ev); - if(obj == ui->loaderModTreeView) + QKeyEvent *keyEvent = static_cast(ev); + if (obj == ui->loaderModTreeView) return loaderListFilter(keyEvent); - if(obj == ui->resPackTreeView) + if (obj == ui->resPackTreeView) return resourcePackListFilter(keyEvent); - return QDialog::eventFilter( obj, ev ); + return QDialog::eventFilter(obj, ev); } void OneSixModEditDialog::on_buttonBox_rejected() @@ -207,8 +244,9 @@ void OneSixModEditDialog::on_buttonBox_rejected() void OneSixModEditDialog::on_addModBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Loader Mods")); - for(auto filename:fileNames) + QStringList fileNames = QFileDialog::getOpenFileNames( + this, QApplication::translate("LegacyModEditDialog", "Select Loader Mods")); + for (auto filename : fileNames) { m_mods->stopWatching(); m_mods->installMod(QFileInfo(filename)); @@ -219,8 +257,8 @@ void OneSixModEditDialog::on_rmModBtn_clicked() { int first, last; auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_mods->stopWatching(); m_mods->deleteMods(first, last); @@ -231,11 +269,11 @@ void OneSixModEditDialog::on_viewModBtn_clicked() openDirInDefaultProgram(m_inst->loaderModsDir(), true); } - void OneSixModEditDialog::on_addResPackBtn_clicked() { - QStringList fileNames = QFileDialog::getOpenFileNames(this, QApplication::translate("LegacyModEditDialog", "Select Resource Packs")); - for(auto filename:fileNames) + QStringList fileNames = QFileDialog::getOpenFileNames( + this, QApplication::translate("LegacyModEditDialog", "Select Resource Packs")); + for (auto filename : fileNames) { m_resourcepacks->stopWatching(); m_resourcepacks->installMod(QFileInfo(filename)); @@ -246,8 +284,8 @@ void OneSixModEditDialog::on_rmResPackBtn_clicked() { int first, last; auto list = ui->resPackTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_resourcepacks->stopWatching(); m_resourcepacks->deleteMods(first, last); @@ -257,4 +295,3 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked() { openDirInDefaultProgram(m_inst->resourcePacksDir(), true); } - diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index 714c911a..e70bd73f 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -44,7 +44,8 @@ private slots: void on_forgeBtn_clicked(); void on_customizeBtn_clicked(); void on_revertBtn_clicked(); - void updateButtons(); + void updateVersionControls(); + void disableVersionControls(); protected: bool eventFilter(QObject *obj, QEvent *ev); bool loaderListFilter( QKeyEvent* ev ); diff --git a/gui/instancedelegate.h b/gui/instancedelegate.h index c80f95a5..56bc34ba 100644 --- a/gui/instancedelegate.h +++ b/gui/instancedelegate.h @@ -9,4 +9,4 @@ public: protected: void paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const; -}; \ No newline at end of file +}; diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index 7c424a6c..e48bb975 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -26,10 +26,10 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) : ui->setupUi(this); ui->labelStatus->setVisible(false); auto lwjgllist = MMC->lwjgllist(); - ui->lwjglListView->setModel(lwjgllist); + ui->lwjglListView->setModel(lwjgllist.data()); - connect(lwjgllist, SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); - connect(lwjgllist, SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); + connect(lwjgllist.data(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); + connect(lwjgllist.data(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); loadingStateUpdated(lwjgllist->isLoading()); } diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 6f707236..d3b167fa 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -124,7 +124,7 @@ MainWindow::MainWindow ( QWidget *parent ) //proxymodel->setDynamicSortFilter ( true ); // FIXME: instList should be global-ish, or at least not tied to the main window... maybe the application itself? - proxymodel->setSourceModel ( MMC->instances() ); + proxymodel->setSourceModel ( MMC->instances().data() ); proxymodel->sort ( 0 ); view->setFrameShape ( QFrame::NoFrame ); view->setModel ( proxymodel ); @@ -149,7 +149,7 @@ MainWindow::MainWindow ( QWidget *parent ) ); // model reset -> selection is invalid. All the instance pointers are wrong. // FIXME: stop using POINTERS everywhere - connect(MMC->instances() ,SIGNAL(dataIsInvalid()),SLOT(selectionBad())); + connect(MMC->instances().data() ,SIGNAL(dataIsInvalid()),SLOT(selectionBad())); // run the things that load and download other things... FIXME: this is NOT the place // FIXME: invisible actions in the background = NOPE. @@ -601,7 +601,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() if (view->selectionModel()->selectedIndexes().count() < 1) return; - VersionSelectDialog vselect(m_selectedInstance->versionList(), this); + VersionSelectDialog vselect(m_selectedInstance->versionList().data(), this); if (vselect.exec() && vselect.selectedVersion()) { m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 4360f5f6..1cda7a34 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -440,7 +440,7 @@ Meow - <html><head/><body><p align="center"><span style=" font-weight:600; color:#ff0004;">Catnatok!</span></p><p align="center">Or just a cat with a ball of yarn?</p><p align="center"><span style=" font-style:italic;">WHO KNOWS?!</span></p><p align="center"><img src=":/icons/instances/tnt"/></p></body></html> + <html><head/><body><p align="center"><span style=" font-weight:600; color:#ff0004;">Catnarok!</span></p><p align="center">Or just a cat with a ball of yarn?</p><p align="center"><span style=" font-style:italic;">WHO KNOWS?!</span></p><p align="center"><img src=":/icons/instances/tnt"/></p></body></html> diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index 6604d03b..859077d9 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -96,7 +96,7 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const void NewInstanceDialog::on_btnChangeVersion_clicked() { - VersionSelectDialog vselect(MMC->minecraftlist(), this); + VersionSelectDialog vselect(MMC->minecraftlist().data(), this); vselect.exec(); if (vselect.result() == QDialog::Accepted) { diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index a5283b36..9736c1c7 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -27,7 +27,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : { ui->setupUi(this); - loadSettings(MMC->settings()); + loadSettings(MMC->settings().data()); updateCheckboxStuff(); } @@ -85,7 +85,7 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) void SettingsDialog::on_buttonBox_accepted() { - applySettings(MMC->settings()); + applySettings(MMC->settings().data()); } void SettingsDialog::applySettings(SettingsObject *s) -- cgit v1.2.3 From 984c36e571aae45cdd55da2fb689538198aadd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 23 Sep 2013 00:23:50 +0200 Subject: Implement basic yggdrasil auth. No fancy login token saving involved. --- gui/mainwindow.cpp | 8 ++++---- gui/mainwindow.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d3b167fa..d7b77c8b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -54,7 +54,7 @@ #include "logic/lists/LwjglVersionList.h" #include "logic/lists/IconList.h" -#include "logic/tasks/LoginTask.h" +#include "logic/net/LoginTask.h" #include "logic/BaseInstance.h" #include "logic/InstanceFactory.h" #include "logic/MinecraftProcess.h" @@ -491,7 +491,7 @@ void MainWindow::doLogin(const QString& errorMsg) QString user = loginDlg->getUsername(); if (user.length() == 0) user = QString("Offline"); - m_activeLogin = {user, QString("Offline"), qint64(-1)}; + m_activeLogin = {user, QString("Offline"), QString(), QString()}; m_activeInst = m_selectedInstance; launchInstance(m_activeInst, m_activeLogin); } @@ -533,7 +533,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) { Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL"); - proc = instance->prepareForLaunch(response.username, response.sessionID); + proc = instance->prepareForLaunch(response); if(!proc) return; @@ -552,7 +552,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, SLOT(write(QString, MessageLevel::Enum))); connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded())); - proc->setLogin(m_activeLogin.username, m_activeLogin.sessionID); + proc->setLogin(response.username, response.session_id); proc->launch(); } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 2b0e1d34..cc9b0b7b 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -19,7 +19,7 @@ #include #include "logic/lists/InstanceList.h" -#include "logic/tasks/LoginTask.h" +#include "logic/net/LoginTask.h" #include "logic/BaseInstance.h" class LabeledToolButton; -- cgit v1.2.3 From 8b0f8b9e597eb50ff9323037fd5fa1b9e330c467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 30 Sep 2013 02:34:46 +0200 Subject: ``Working'' forge unpackers. Needs a lot of hardening but good for alpha. --- gui/LegacyModEditDialog.cpp | 2 +- gui/OneSixModEditDialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 20296769..053aef6b 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -210,7 +210,7 @@ void LegacyModEditDialog::on_addForgeBtn_clicked() if(entry->stale) { DownloadJob * fjob = new DownloadJob("Forge download"); - fjob->add(forge->universal_url, entry); + fjob->addCacheDownload(forge->universal_url, entry); ProgressDialog dlg(this); dlg.exec(fjob); if(dlg.result() == QDialog::Accepted) diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 94fea933..f2e7c5d2 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -160,7 +160,7 @@ void OneSixModEditDialog::on_forgeBtn_clicked() if (entry->stale) { DownloadJob *fjob = new DownloadJob("Forge download"); - fjob->add(forgeVersion->installer_url, entry); + fjob->addCacheDownload(forgeVersion->installer_url, entry); ProgressDialog dlg(this); dlg.exec(fjob); if (dlg.result() == QDialog::Accepted) -- cgit v1.2.3 From 1dee4bb60d08995f0fd4eb229f131f2ca546d24c Mon Sep 17 00:00:00 2001 From: Sky Date: Sat, 5 Oct 2013 01:08:13 +0100 Subject: Add naive Windows Java detection - JavaUtils for finding it on other systems (incomplete) --- gui/settingsdialog.cpp | 11 ++++++++++- gui/settingsdialog.h | 2 ++ gui/settingsdialog.ui | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index 9736c1c7..b5ff8d56 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -13,10 +13,11 @@ * limitations under the License. */ +#include #include "settingsdialog.h" #include "ui_settingsdialog.h" +#include "logic/JavaUtils.h" -#include #include #include #include @@ -180,3 +181,11 @@ void SettingsDialog::loadSettings(SettingsObject *s) ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString()); ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString()); } + +void SettingsDialog::on_pushButton_clicked() +{ + JavaUtils jut; + QStringList paths = jut.FindJavaPath(); + + ui->javaPathTextBox->setText(paths.at(0)); +} diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index b0a8c673..2611f105 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -53,6 +53,8 @@ private slots: void on_buttonBox_accepted(); + void on_pushButton_clicked(); + private: Ui::SettingsDialog *ui; }; diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index 0d30e301..f0cb5c3d 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -33,7 +33,7 @@ QTabWidget::Rounded - 0 + 2 -- cgit v1.2.3 From 932376c6e0aad27f65b25574b23e601afb6047d2 Mon Sep 17 00:00:00 2001 From: Sky Date: Sat, 5 Oct 2013 02:02:47 +0100 Subject: Add "browse" button using Qt's file browser to settings dialog --- gui/settingsdialog.cpp | 9 +++++++++ gui/settingsdialog.h | 2 ++ gui/settingsdialog.ui | 23 +++++++++++++++-------- 3 files changed, 26 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index b5ff8d56..fd876a97 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -189,3 +189,12 @@ void SettingsDialog::on_pushButton_clicked() ui->javaPathTextBox->setText(paths.at(0)); } + +void SettingsDialog::on_btnBrowse_clicked() +{ + QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable")); + if(!dir.isNull()) + { + ui->javaPathTextBox->setText(dir); + } +} diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 2611f105..a8dfb1c6 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -55,6 +55,8 @@ private slots: void on_pushButton_clicked(); + void on_btnBrowse_clicked(); + private: Ui::SettingsDialog *ui; }; diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index f0cb5c3d..36c117f3 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -379,26 +379,33 @@ - - - - + JVM arguments: - - + + - Auto-detect + Browse... - + + + + + + + + Auto-detect + + + -- cgit v1.2.3 From 2398acc9e490ce124aa621c19156c89ef87591f1 Mon Sep 17 00:00:00 2001 From: Sky Date: Sat, 5 Oct 2013 02:07:19 +0100 Subject: Fix Java detection button sizes --- gui/settingsdialog.ui | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gui') diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index 36c117f3..d7a134fb 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -388,6 +388,12 @@ + + + 0 + 0 + + Browse... @@ -401,6 +407,12 @@ + + + 0 + 0 + + Auto-detect -- cgit v1.2.3 From f83119ce7ec3d11a903901b8eff762d2b0a9f635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 6 Oct 2013 01:13:40 +0200 Subject: Added file logger --- gui/IconPickerDialog.cpp | 2 +- gui/LegacyModEditDialog.cpp | 206 +++++++++++++------------ gui/LegacyModEditDialog.h | 8 +- gui/OneSixModEditDialog.cpp | 19 +-- gui/OneSixModEditDialog.h | 6 +- gui/aboutdialog.ui | 97 ++++++------ gui/logindialog.cpp | 10 +- gui/lwjglselectdialog.cpp | 6 +- gui/mainwindow.cpp | 360 ++++++++++++++++++++++---------------------- gui/newinstancedialog.cpp | 2 +- gui/settingsdialog.cpp | 4 +- gui/versionselectdialog.cpp | 2 +- 12 files changed, 361 insertions(+), 361 deletions(-) (limited to 'gui') diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index 8f5d8256..6a1ca546 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -39,7 +39,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : contentsWidget->installEventFilter(this); - contentsWidget->setModel(MMC->icons().data()); + contentsWidget->setModel(MMC->icons().get()); auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"),QDialogButtonBox::ResetRole); auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"),QDialogButtonBox::ResetRole); diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 053aef6b..c240daff 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -3,7 +3,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -28,49 +28,47 @@ #include #include -LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent ) : - m_inst(inst), - QDialog(parent), - ui(new Ui::LegacyModEditDialog) +LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) + : m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog) { ui->setupUi(this); - + // Jar mods { ensureFolderPathExists(m_inst->jarModsDir()); m_jarmods = m_inst->jarModList(); - ui->jarModsTreeView->setModel(m_jarmods.data()); + ui->jarModsTreeView->setModel(m_jarmods.get()); #ifndef Q_OS_LINUX // FIXME: internal DnD causes segfaults later ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop); // FIXME: DnD is glitched with contiguous (we move only first item in selection) ui->jarModsTreeView->setSelectionMode(QAbstractItemView::SingleSelection); #endif - ui->jarModsTreeView->installEventFilter( this ); + ui->jarModsTreeView->installEventFilter(this); m_jarmods->startWatching(); } // Core mods { ensureFolderPathExists(m_inst->coreModsDir()); m_coremods = m_inst->coreModList(); - ui->coreModsTreeView->setModel(m_coremods.data()); - ui->coreModsTreeView->installEventFilter( this ); + ui->coreModsTreeView->setModel(m_coremods.get()); + ui->coreModsTreeView->installEventFilter(this); m_coremods->startWatching(); } // Loader mods { ensureFolderPathExists(m_inst->loaderModsDir()); m_mods = m_inst->loaderModList(); - ui->loaderModTreeView->setModel(m_mods.data()); - ui->loaderModTreeView->installEventFilter( this ); + ui->loaderModTreeView->setModel(m_mods.get()); + ui->loaderModTreeView->installEventFilter(this); m_mods->startWatching(); } // texture packs { ensureFolderPathExists(m_inst->texturePacksDir()); m_texturepacks = m_inst->texturePackList(); - ui->texPackTreeView->setModel(m_texturepacks.data()); - ui->texPackTreeView->installEventFilter( this ); + ui->texPackTreeView->setModel(m_texturepacks.get()); + ui->texPackTreeView->installEventFilter(this); m_texturepacks->startWatching(); } } @@ -84,113 +82,111 @@ LegacyModEditDialog::~LegacyModEditDialog() delete ui; } -bool LegacyModEditDialog::coreListFilter ( QKeyEvent* keyEvent ) +bool LegacyModEditDialog::coreListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Delete: - on_rmCoreBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addCoreBtn_clicked(); - return true; - default: - break; + case Qt::Key_Delete: + on_rmCoreBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addCoreBtn_clicked(); + return true; + default: + break; } - return QDialog::eventFilter( ui->coreModsTreeView, keyEvent ); + return QDialog::eventFilter(ui->coreModsTreeView, keyEvent); } -bool LegacyModEditDialog::jarListFilter ( QKeyEvent* keyEvent ) +bool LegacyModEditDialog::jarListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Up: + case Qt::Key_Up: + { + if (keyEvent->modifiers() & Qt::ControlModifier) { - if(keyEvent->modifiers() & Qt::ControlModifier) - { - on_moveJarUpBtn_clicked(); - return true; - } - break; + on_moveJarUpBtn_clicked(); + return true; } - case Qt::Key_Down: + break; + } + case Qt::Key_Down: + { + if (keyEvent->modifiers() & Qt::ControlModifier) { - if(keyEvent->modifiers() & Qt::ControlModifier) - { - on_moveJarDownBtn_clicked(); - return true; - } - break; - } - case Qt::Key_Delete: - on_rmJarBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addJarBtn_clicked(); + on_moveJarDownBtn_clicked(); return true; - default: - break; + } + break; } - return QDialog::eventFilter( ui->jarModsTreeView, keyEvent ); + case Qt::Key_Delete: + on_rmJarBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addJarBtn_clicked(); + return true; + default: + break; + } + return QDialog::eventFilter(ui->jarModsTreeView, keyEvent); } -bool LegacyModEditDialog::loaderListFilter ( QKeyEvent* keyEvent ) +bool LegacyModEditDialog::loaderListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Delete: - on_rmModBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addModBtn_clicked(); - return true; - default: - break; + case Qt::Key_Delete: + on_rmModBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addModBtn_clicked(); + return true; + default: + break; } - return QDialog::eventFilter( ui->loaderModTreeView, keyEvent ); + return QDialog::eventFilter(ui->loaderModTreeView, keyEvent); } -bool LegacyModEditDialog::texturePackListFilter ( QKeyEvent* keyEvent ) +bool LegacyModEditDialog::texturePackListFilter(QKeyEvent *keyEvent) { - switch(keyEvent->key()) + switch (keyEvent->key()) { - case Qt::Key_Delete: - on_rmTexPackBtn_clicked(); - return true; - case Qt::Key_Plus: - on_addTexPackBtn_clicked(); - return true; - default: - break; + case Qt::Key_Delete: + on_rmTexPackBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addTexPackBtn_clicked(); + return true; + default: + break; } - return QDialog::eventFilter( ui->texPackTreeView, keyEvent ); + return QDialog::eventFilter(ui->texPackTreeView, keyEvent); } - -bool LegacyModEditDialog::eventFilter ( QObject* obj, QEvent* ev ) +bool LegacyModEditDialog::eventFilter(QObject *obj, QEvent *ev) { if (ev->type() != QEvent::KeyPress) { - return QDialog::eventFilter( obj, ev ); + return QDialog::eventFilter(obj, ev); } - QKeyEvent *keyEvent = static_cast(ev); - if(obj == ui->jarModsTreeView) + QKeyEvent *keyEvent = static_cast(ev); + if (obj == ui->jarModsTreeView) return jarListFilter(keyEvent); - if(obj == ui->coreModsTreeView) + if (obj == ui->coreModsTreeView) return coreListFilter(keyEvent); - if(obj == ui->loaderModTreeView) + if (obj == ui->loaderModTreeView) return loaderListFilter(keyEvent); - if(obj == ui->texPackTreeView) + if (obj == ui->texPackTreeView) return texturePackListFilter(keyEvent); - return QDialog::eventFilter( obj, ev ); + return QDialog::eventFilter(obj, ev); } - void LegacyModEditDialog::on_addCoreBtn_clicked() { //: Title of core mod selection dialog QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Core Mods")); - for(auto filename:fileNames) + for (auto filename : fileNames) { m_coremods->stopWatching(); m_coremods->installMod(QFileInfo(filename)); @@ -199,21 +195,22 @@ void LegacyModEditDialog::on_addCoreBtn_clicked() } void LegacyModEditDialog::on_addForgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist().data(), this); + VersionSelectDialog vselect(MMC->forgelist().get(), this); vselect.setFilter(1, m_inst->intendedVersionId()); if (vselect.exec() && vselect.selectedVersion()) { - ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast(); - if(!forge) + ForgeVersionPtr forge = + std::dynamic_pointer_cast (vselect.selectedVersion()); + if (!forge) return; auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename); - if(entry->stale) + if (entry->stale) { - DownloadJob * fjob = new DownloadJob("Forge download"); + DownloadJob *fjob = new DownloadJob("Forge download"); fjob->addCacheDownload(forge->universal_url, entry); ProgressDialog dlg(this); dlg.exec(fjob); - if(dlg.result() == QDialog::Accepted) + if (dlg.result() == QDialog::Accepted) { m_jarmods->stopWatching(); m_jarmods->installMod(QFileInfo(entry->getFullPath())); @@ -236,7 +233,7 @@ void LegacyModEditDialog::on_addJarBtn_clicked() { //: Title of jar mod selection dialog QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Jar Mods")); - for(auto filename:fileNames) + for (auto filename : fileNames) { m_jarmods->stopWatching(); m_jarmods->installMod(QFileInfo(filename)); @@ -247,7 +244,7 @@ void LegacyModEditDialog::on_addModBtn_clicked() { //: Title of regular mod selection dialog QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Loader Mods")); - for(auto filename:fileNames) + for (auto filename : fileNames) { m_mods->stopWatching(); m_mods->installMod(QFileInfo(filename)); @@ -258,7 +255,7 @@ void LegacyModEditDialog::on_addTexPackBtn_clicked() { //: Title of texture pack selection dialog QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Texture Packs")); - for(auto filename:fileNames) + for (auto filename : fileNames) { m_texturepacks->stopWatching(); m_texturepacks->installMod(QFileInfo(filename)); @@ -270,8 +267,8 @@ void LegacyModEditDialog::on_moveJarDownBtn_clicked() { int first, last; auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_jarmods->moveModsDown(first, last); @@ -280,8 +277,8 @@ void LegacyModEditDialog::on_moveJarUpBtn_clicked() { int first, last; auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_jarmods->moveModsUp(first, last); } @@ -289,8 +286,8 @@ void LegacyModEditDialog::on_rmCoreBtn_clicked() { int first, last; auto list = ui->coreModsTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_coremods->stopWatching(); m_coremods->deleteMods(first, last); @@ -300,8 +297,8 @@ void LegacyModEditDialog::on_rmJarBtn_clicked() { int first, last; auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_jarmods->stopWatching(); m_jarmods->deleteMods(first, last); @@ -311,8 +308,8 @@ void LegacyModEditDialog::on_rmModBtn_clicked() { int first, last; auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_mods->stopWatching(); m_mods->deleteMods(first, last); @@ -322,8 +319,8 @@ void LegacyModEditDialog::on_rmTexPackBtn_clicked() { int first, last; auto list = ui->texPackTreeView->selectionModel()->selectedRows(); - - if(!lastfirst(list, first, last)) + + if (!lastfirst(list, first, last)) return; m_texturepacks->stopWatching(); m_texturepacks->deleteMods(first, last); @@ -342,7 +339,6 @@ void LegacyModEditDialog::on_viewTexPackBtn_clicked() openDirInDefaultProgram(m_inst->texturePacksDir(), true); } - void LegacyModEditDialog::on_buttonBox_rejected() { close(); diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index b824a86a..5f6973d3 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -60,10 +60,10 @@ protected: bool texturePackListFilter( QKeyEvent* ev ); private: Ui::LegacyModEditDialog *ui; - QSharedPointer m_mods; - QSharedPointer m_coremods; - QSharedPointer m_jarmods; - QSharedPointer m_texturepacks; + std::shared_ptr m_mods; + std::shared_ptr m_coremods; + std::shared_ptr m_jarmods; + std::shared_ptr m_texturepacks; LegacyInstance * m_inst; DownloadJobPtr forgeJob; }; diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index f2e7c5d2..e8c7f9ed 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -42,7 +42,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) { main_model = new EnabledItemFilter(this); main_model->setActive(true); - main_model->setSourceModel(m_version.data()); + main_model->setSourceModel(m_version.get()); ui->libraryTreeView->setModel(main_model); ui->libraryTreeView->installEventFilter(this); ui->mainClassEdit->setText(m_version->mainClass); @@ -56,7 +56,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) { ensureFolderPathExists(m_inst->loaderModsDir()); m_mods = m_inst->loaderModList(); - ui->loaderModTreeView->setModel(m_mods.data()); + ui->loaderModTreeView->setModel(m_mods.get()); ui->loaderModTreeView->installEventFilter(this); m_mods->startWatching(); } @@ -64,7 +64,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) { ensureFolderPathExists(m_inst->resourcePacksDir()); m_resourcepacks = m_inst->resourcePackList(); - ui->resPackTreeView->setModel(m_resourcepacks.data()); + ui->resPackTreeView->setModel(m_resourcepacks.get()); ui->resPackTreeView->installEventFilter(this); m_resourcepacks->startWatching(); } @@ -97,7 +97,7 @@ void OneSixModEditDialog::on_customizeBtn_clicked() if (m_inst->customizeVersion()) { m_version = m_inst->getFullVersion(); - main_model->setSourceModel(m_version.data()); + main_model->setSourceModel(m_version.get()); updateVersionControls(); } } @@ -113,7 +113,7 @@ void OneSixModEditDialog::on_revertBtn_clicked() if (m_inst->revertCustomVersion()) { m_version = m_inst->getFullVersion(); - main_model->setSourceModel(m_version.data()); + main_model->setSourceModel(m_version.get()); updateVersionControls(); } } @@ -121,7 +121,7 @@ void OneSixModEditDialog::on_revertBtn_clicked() void OneSixModEditDialog::on_forgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist().data(), this); + VersionSelectDialog vselect(MMC->forgelist().get(), this); vselect.setFilter(1, m_inst->currentVersionId()); if (vselect.exec() && vselect.selectedVersion()) { @@ -139,7 +139,7 @@ void OneSixModEditDialog::on_forgeBtn_clicked() m_inst->customizeVersion(); { m_version = m_inst->getFullVersion(); - main_model->setSourceModel(m_version.data()); + main_model->setSourceModel(m_version.get()); updateVersionControls(); } } @@ -150,10 +150,11 @@ void OneSixModEditDialog::on_forgeBtn_clicked() { m_inst->customizeVersion(); m_version = m_inst->getFullVersion(); - main_model->setSourceModel(m_version.data()); + main_model->setSourceModel(m_version.get()); updateVersionControls(); } - ForgeVersionPtr forgeVersion = vselect.selectedVersion().dynamicCast(); + ForgeVersionPtr forgeVersion = + std::dynamic_pointer_cast(vselect.selectedVersion()); if (!forgeVersion) return; auto entry = MMC->metacache()->resolveEntry("minecraftforge", forgeVersion->filename); diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index e70bd73f..5c65fea3 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -52,9 +52,9 @@ protected: bool resourcePackListFilter( QKeyEvent* ev ); private: Ui::OneSixModEditDialog *ui; - QSharedPointer m_version; - QSharedPointer m_mods; - QSharedPointer m_resourcepacks; + std::shared_ptr m_version; + std::shared_ptr m_mods; + std::shared_ptr m_resourcepacks; EnabledItemFilter * main_model; OneSixInstance * m_inst; }; diff --git a/gui/aboutdialog.ui b/gui/aboutdialog.ui index ac4952f9..bd5cc568 100644 --- a/gui/aboutdialog.ui +++ b/gui/aboutdialog.ui @@ -7,7 +7,7 @@ 0 0 450 - 400 + 429 @@ -101,7 +101,7 @@ 0 0 432 - 159 + 179 @@ -159,8 +159,8 @@ 0 0 - 98 - 93 + 682 + 584 @@ -176,10 +176,10 @@ <!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:'Sans'; font-size:10pt; 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'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html> +</style></head><body style=" font-family:'Bitstream Vera Sans'; 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></body></html> @@ -190,8 +190,8 @@ p, li { white-space: pre-wrap; } 0 0 - 98 - 93 + 682 + 584 @@ -213,44 +213,45 @@ p, li { white-space: pre-wrap; } <!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:'Sans'; font-size:10pt; 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';">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-family:'Ubuntu';">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-family:'Ubuntu';">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-family:'Ubuntu';">You may obtain a copy of the License at</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:'Ubuntu';"><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';"> http://www.apache.org/licenses/LICENSE-2.0</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:'Ubuntu';"><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';">Unless required by applicable law or agreed to in writing, software</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';">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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';">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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';">See the License for the specific language governing permissions and</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';">limitations under the 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:'Ubuntu';"><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';">MultiMC uses bspatch, </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';">Copyright 2003-2005 Colin Percival</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';">All rights reserved</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:'Ubuntu';"><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';">Redistribution and use in source and binary forms, with or without</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';">modification, are permitted providing that the following conditions</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';">are met: </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';">1. Redistributions of source code must retain the above copyright</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';"> notice, this list of conditions and the following disclaimer.</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';">2. Redistributions in binary form must reproduce the above copyright</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';"> notice, this list of conditions and the following disclaimer in the</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';"> documentation and/or other materials provided with the distribution.</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:'Ubuntu';"><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';">THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR</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';">IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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';">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</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';">ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY</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';">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</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';">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</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';">OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</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';">HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,</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';">STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING</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';">IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</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';">POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> +</style></head><body style=" font-family:'Bitstream Vera Sans'; 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'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; font-size:10pt;">You may obtain a copy of the License at</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:'Ubuntu'; font-size:10pt;"><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;"> http://www.apache.org/licenses/LICENSE-2.0</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:'Ubuntu'; font-size:10pt;"><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;">Unless required by applicable law or agreed to in writing, software</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'; font-size:10pt;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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'; font-size:10pt;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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'; font-size:10pt;">See the License for the specific language governing permissions and</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'; font-size:10pt;">limitations under the 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:'Ubuntu'; font-size:10pt;"><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;">MultiMC uses QSLog, </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'; font-size:10pt;">Copyright (c) 2010, Razvan Petru</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'; font-size:10pt;">All rights reserved.</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:'Ubuntu'; font-size:10pt;"><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;">Redistribution and use in source and binary forms, with or without modification,</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'; font-size:10pt;">are permitted provided that the following conditions are met:</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:'Ubuntu'; font-size:10pt;"><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;">* Redistributions of source code must retain the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer.</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'; font-size:10pt;">* Redistributions in binary form must reproduce the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer in the documentation and/or other</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'; font-size:10pt;"> materials provided with the distribution.</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'; font-size:10pt;">* The name of the contributors may not be used to endorse or promote products</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'; font-size:10pt;"> derived from this software without specific prior written permission.</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:'Ubuntu'; font-size:10pt;"><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;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</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'; font-size:10pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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'; font-size:10pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</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'; font-size:10pt;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</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'; font-size:10pt;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</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'; font-size:10pt;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</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'; font-size:10pt;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</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'; font-size:10pt;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</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'; font-size:10pt;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</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'; font-size:10pt;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index 37e30c85..fdc94ac7 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -16,7 +16,7 @@ #include "logindialog.h" #include "ui_logindialog.h" #include "keyring.h" -#include +#include LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : QDialog(parent), @@ -109,7 +109,7 @@ void LoginDialog::passwordToggled ( bool state ) blockToggles = true; if(!state) { - qDebug() << "password disabled"; + QLOG_DEBUG() << "password disabled"; } else { @@ -117,7 +117,7 @@ void LoginDialog::passwordToggled ( bool state ) { ui->rememberUsernameCheckbox->setChecked(true); } - qDebug() << "password enabled"; + QLOG_DEBUG() << "password enabled"; } blockToggles = false; } @@ -134,11 +134,11 @@ void LoginDialog::usernameToggled ( bool state ) { ui->rememberPasswordCheckbox->setChecked(false); } - qDebug() << "username disabled"; + QLOG_DEBUG() << "username disabled"; } else { - qDebug() << "username enabled"; + QLOG_DEBUG() << "username enabled"; } blockToggles = false; } diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index e48bb975..4518e8cd 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -26,10 +26,10 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) : ui->setupUi(this); ui->labelStatus->setVisible(false); auto lwjgllist = MMC->lwjgllist(); - ui->lwjglListView->setModel(lwjgllist.data()); + ui->lwjglListView->setModel(lwjgllist.get()); - connect(lwjgllist.data(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); - connect(lwjgllist.data(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); + connect(lwjgllist.get(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool))); + connect(lwjgllist.get(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString))); loadingStateUpdated(lwjgllist->isLoading()); } diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d7b77c8b..ecf5f79d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -68,20 +68,19 @@ #include "LabeledToolButton.h" #include "EditNotesDialog.h" -MainWindow::MainWindow ( QWidget *parent ) - :QMainWindow ( parent ), ui ( new Ui::MainWindow ) +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { - ui->setupUi ( this ); - setWindowTitle ( QString ( "MultiMC %1" ).arg ( MMC->version().toString() ) ); - + ui->setupUi(this); + setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); + // Set the selected instance to null m_selectedInstance = nullptr; // Set active instance to null. m_activeInst = nullptr; - + // OSX magic. setUnifiedTitleAndToolBarOnMac(true); - + // The instance action toolbar customizations { ui->instanceToolBar->setEnabled(false); @@ -92,44 +91,45 @@ MainWindow::MainWindow ( QWidget *parent ) connect(renameButton, SIGNAL(clicked(bool)), SLOT(on_actionRenameInstance_triggered())); ui->instanceToolBar->insertWidget(ui->actionLaunchInstance, renameButton); ui->instanceToolBar->insertSeparator(ui->actionLaunchInstance); - renameButton->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); + renameButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); } - + // Create the instance list widget { - view = new KCategorizedView ( ui->centralWidget ); - drawer = new KCategoryDrawer ( view ); - - view->setSelectionMode ( QAbstractItemView::SingleSelection ); - view->setCategoryDrawer ( drawer ); - view->setCollapsibleBlocks ( true ); - view->setViewMode ( QListView::IconMode ); - view->setFlow ( QListView::LeftToRight ); + view = new KCategorizedView(ui->centralWidget); + drawer = new KCategoryDrawer(view); + + view->setSelectionMode(QAbstractItemView::SingleSelection); + view->setCategoryDrawer(drawer); + view->setCollapsibleBlocks(true); + view->setViewMode(QListView::IconMode); + view->setFlow(QListView::LeftToRight); view->setWordWrap(true); - view->setMouseTracking ( true ); - view->viewport()->setAttribute ( Qt::WA_Hover ); + view->setMouseTracking(true); + view->viewport()->setAttribute(Qt::WA_Hover); auto delegate = new ListViewDelegate(); view->setItemDelegate(delegate); view->setSpacing(10); view->setUniformItemWidths(true); - + // do not show ugly blue border on the mac view->setAttribute(Qt::WA_MacShowFocusRect, false); - + view->installEventFilter(this); - proxymodel = new InstanceProxyModel ( this ); - proxymodel->setSortRole ( KCategorizedSortFilterProxyModel::CategorySortRole ); - proxymodel->setFilterRole ( KCategorizedSortFilterProxyModel::CategorySortRole ); - //proxymodel->setDynamicSortFilter ( true ); - - // FIXME: instList should be global-ish, or at least not tied to the main window... maybe the application itself? - proxymodel->setSourceModel ( MMC->instances().data() ); - proxymodel->sort ( 0 ); - view->setFrameShape ( QFrame::NoFrame ); - view->setModel ( proxymodel ); - - ui->horizontalLayout->addWidget ( view ); + proxymodel = new InstanceProxyModel(this); + proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole); + proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole); + // proxymodel->setDynamicSortFilter ( true ); + + // FIXME: instList should be global-ish, or at least not tied to the main window... + // maybe the application itself? + proxymodel->setSourceModel(MMC->instances().get()); + proxymodel->sort(0); + view->setFrameShape(QFrame::NoFrame); + view->setModel(proxymodel); + + ui->horizontalLayout->addWidget(view); } // The cat background { @@ -139,18 +139,16 @@ MainWindow::MainWindow ( QWidget *parent ) setCatBackground(cat_enable); } // start instance when double-clicked - connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(instanceActivated(const QModelIndex &))); + connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, + SLOT(instanceActivated(const QModelIndex &))); // track the selection -- update the instance toolbar - connect( - view->selectionModel(), - SIGNAL(currentChanged(const QModelIndex &,const QModelIndex &)), - this, - SLOT(instanceChanged(const QModelIndex &,const QModelIndex &)) - ); + connect(view->selectionModel(), + SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, + SLOT(instanceChanged(const QModelIndex &, const QModelIndex &))); // model reset -> selection is invalid. All the instance pointers are wrong. // FIXME: stop using POINTERS everywhere - connect(MMC->instances().data() ,SIGNAL(dataIsInvalid()),SLOT(selectionBad())); - + connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad())); + // run the things that load and download other things... FIXME: this is NOT the place // FIXME: invisible actions in the background = NOPE. { @@ -176,57 +174,55 @@ MainWindow::~MainWindow() delete assets_downloader; } -bool MainWindow::eventFilter ( QObject* obj, QEvent* ev ) +bool MainWindow::eventFilter(QObject *obj, QEvent *ev) { - if(obj == view) + if (obj == view) { if (ev->type() == QEvent::KeyPress) { - QKeyEvent *keyEvent = static_cast(ev); - switch(keyEvent->key()) + QKeyEvent *keyEvent = static_cast(ev); + switch (keyEvent->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - on_actionLaunchInstance_triggered(); - return true; - case Qt::Key_Delete: - on_actionDeleteInstance_triggered(); - return true; - case Qt::Key_F5: - on_actionRefresh_triggered(); - return true; - case Qt::Key_F2: - on_actionRenameInstance_triggered(); - return true; - default: - break; + case Qt::Key_Enter: + case Qt::Key_Return: + on_actionLaunchInstance_triggered(); + return true; + case Qt::Key_Delete: + on_actionDeleteInstance_triggered(); + return true; + case Qt::Key_F5: + on_actionRefresh_triggered(); + return true; + case Qt::Key_F2: + on_actionRenameInstance_triggered(); + return true; + default: + break; } } } - return QMainWindow::eventFilter ( obj, ev ); + return QMainWindow::eventFilter(obj, ev); } -void MainWindow::onCatToggled ( bool state ) +void MainWindow::onCatToggled(bool state) { setCatBackground(state); MMC->settings()->set("TheCat", state); } -void MainWindow::setCatBackground ( bool enabled ) +void MainWindow::setCatBackground(bool enabled) { - if(enabled) + if (enabled) { - view->setStyleSheet( - "QListView" - "{" - "background-image: url(:/backgrounds/kitteh);" - "background-attachment: fixed;" - "background-clip: padding;" - "background-position: top right;" - "background-repeat: none;" - "background-color:palette(base);" - "}" - ); + view->setStyleSheet("QListView" + "{" + "background-image: url(:/backgrounds/kitteh);" + "background-attachment: fixed;" + "background-clip: padding;" + "background-position: top right;" + "background-repeat: none;" + "background-color:palette(base);" + "}"); } else { @@ -234,37 +230,37 @@ void MainWindow::setCatBackground ( bool enabled ) } } - -void MainWindow::instanceActivated ( QModelIndex index ) +void MainWindow::instanceActivated(QModelIndex index) { - if(!index.isValid()) + if (!index.isValid()) return; - BaseInstance * inst = (BaseInstance *) index.data(InstanceList::InstancePointerRole).value(); + BaseInstance *inst = + (BaseInstance *)index.data(InstanceList::InstancePointerRole).value(); doLogin(); } void MainWindow::on_actionAddInstance_triggered() { - if (!MMC->minecraftlist()->isLoaded() && - m_versionLoadTask && m_versionLoadTask->isRunning()) + if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask && + m_versionLoadTask->isRunning()) { QEventLoop waitLoop; waitLoop.connect(m_versionLoadTask, SIGNAL(failed(QString)), SLOT(quit())); waitLoop.connect(m_versionLoadTask, SIGNAL(succeeded()), SLOT(quit())); waitLoop.exec(); } - - NewInstanceDialog newInstDlg( this ); + + NewInstanceDialog newInstDlg(this); if (!newInstDlg.exec()) return; - + BaseInstance *newInstance = NULL; - + QString instDirName = DirNameFromString(newInstDlg.instName()); QString instDir = PathCombine(MMC->settings()->get("InstanceDir").toString(), instDirName); - + auto &loader = InstanceFactory::get(); - + auto error = loader.createInstance(newInstance, newInstDlg.selectedVersion(), instDir); QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName); switch (error) @@ -274,17 +270,17 @@ void MainWindow::on_actionAddInstance_triggered() newInstance->setIconKey(newInstDlg.iconKey()); MMC->instances()->add(InstancePtr(newInstance)); return; - + case InstanceFactory::InstExists: errorMsg += "An instance with the given directory name already exists."; QMessageBox::warning(this, "Error", errorMsg); break; - + case InstanceFactory::CantCreateDir: errorMsg += "Failed to create the instance directory."; QMessageBox::warning(this, "Error", errorMsg); break; - + default: errorMsg += QString("Unknown instance loader error %1").arg(error); QMessageBox::warning(this, "Error", errorMsg); @@ -294,12 +290,12 @@ void MainWindow::on_actionAddInstance_triggered() void MainWindow::on_actionChangeInstIcon_triggered() { - if(!m_selectedInstance) + if (!m_selectedInstance) return; - + IconPickerDialog dlg(this); dlg.exec(m_selectedInstance->iconKey()); - if(dlg.result() == QDialog::Accepted) + if (dlg.result() == QDialog::Accepted) { m_selectedInstance->setIconKey(dlg.selectedIconKey); auto ico = MMC->icons()->getIcon(dlg.selectedIconKey); @@ -307,25 +303,23 @@ void MainWindow::on_actionChangeInstIcon_triggered() } } - void MainWindow::on_actionChangeInstGroup_triggered() { - if(!m_selectedInstance) + if (!m_selectedInstance) return; - + bool ok = false; - QString name ( m_selectedInstance->group() ); - name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ), - QLineEdit::Normal, name, &ok ); - if(ok) + QString name(m_selectedInstance->group()); + name = QInputDialog::getText(this, tr("Group name"), tr("Enter a new group name."), + QLineEdit::Normal, name, &ok); + if (ok) m_selectedInstance->setGroupPost(name); } - void MainWindow::on_actionViewInstanceFolder_triggered() { - QString str = MMC->settings()->get ( "InstanceDir" ).toString(); - openDirInDefaultProgram ( str ); + QString str = MMC->settings()->get("InstanceDir").toString(); + openDirInDefaultProgram(str); } void MainWindow::on_actionRefresh_triggered() @@ -335,59 +329,58 @@ void MainWindow::on_actionRefresh_triggered() void MainWindow::on_actionViewCentralModsFolder_triggered() { - openDirInDefaultProgram ( MMC->settings()->get ( "CentralModsDir" ).toString() , true); + openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true); } void MainWindow::on_actionConfig_Folder_triggered() { - if(m_selectedInstance) + if (m_selectedInstance) { QString str = m_selectedInstance->instanceConfigFolder(); - openDirInDefaultProgram ( QDir(str).absolutePath() ); + openDirInDefaultProgram(QDir(str).absolutePath()); } } - void MainWindow::on_actionCheckUpdate_triggered() { - } void MainWindow::on_actionSettings_triggered() { - SettingsDialog dialog ( this ); + SettingsDialog dialog(this); dialog.exec(); } void MainWindow::on_actionReportBug_triggered() { - openWebPage ( QUrl ( "http://multimc.myjetbrains.com/youtrack/dashboard#newissue=yes" ) ); + openWebPage(QUrl("http://multimc.myjetbrains.com/youtrack/dashboard#newissue=yes")); } void MainWindow::on_actionNews_triggered() { - openWebPage ( QUrl ( "http://forkk.net/tag/multimc.html" ) ); + openWebPage(QUrl("http://forkk.net/tag/multimc.html")); } void MainWindow::on_actionAbout_triggered() { - AboutDialog dialog ( this ); + AboutDialog dialog(this); dialog.exec(); } -void MainWindow::on_mainToolBar_visibilityChanged ( bool ) +void MainWindow::on_mainToolBar_visibilityChanged(bool) { // Don't allow hiding the main toolbar. // This is the only way I could find to prevent it... :/ - ui->mainToolBar->setVisible ( true ); + ui->mainToolBar->setVisible(true); } void MainWindow::on_actionDeleteInstance_triggered() { if (m_selectedInstance) { - int response = QMessageBox::question(this, "CAREFUL", - QString("This is permanent! Are you sure?\nAbout to delete: ") + m_selectedInstance->name()); + int response = QMessageBox::question( + this, "CAREFUL", QString("This is permanent! Are you sure?\nAbout to delete: ") + + m_selectedInstance->name()); if (response == QMessageBox::Yes) { m_selectedInstance->nuke(); @@ -397,31 +390,31 @@ void MainWindow::on_actionDeleteInstance_triggered() void MainWindow::on_actionRenameInstance_triggered() { - if(m_selectedInstance) + if (m_selectedInstance) { bool ok = false; - QString name ( m_selectedInstance->name() ); - name = QInputDialog::getText ( this, tr ( "Instance name" ), tr ( "Enter a new instance name." ), - QLineEdit::Normal, name, &ok ); - + QString name(m_selectedInstance->name()); + name = + QInputDialog::getText(this, tr("Instance name"), tr("Enter a new instance name."), + QLineEdit::Normal, name, &ok); + if (name.length() > 0) { - if(ok && name.length()) + if (ok && name.length()) { m_selectedInstance->setName(name); renameButton->setText(name); } } - } } void MainWindow::on_actionViewSelectedInstFolder_triggered() { - if(m_selectedInstance) + if (m_selectedInstance) { QString str = m_selectedInstance->instanceRoot(); - openDirInDefaultProgram ( QDir(str).absolutePath() ); + openDirInDefaultProgram(QDir(str).absolutePath()); } } @@ -430,59 +423,61 @@ void MainWindow::on_actionEditInstMods_triggered() if (m_selectedInstance) { auto dialog = m_selectedInstance->createModEditDialog(this); - if(dialog) + if (dialog) dialog->exec(); dialog->deleteLater(); } } -void MainWindow::closeEvent ( QCloseEvent *event ) +void MainWindow::closeEvent(QCloseEvent *event) { // Save the window state and geometry. // TODO: Make this work with the new settings system. -// settings->getConfig().setValue("MainWindowGeometry", saveGeometry()); -// settings->getConfig().setValue("MainWindowState", saveState()); - QMainWindow::closeEvent ( event ); + // settings->getConfig().setValue("MainWindowGeometry", saveGeometry()); + // settings->getConfig().setValue("MainWindowState", saveState()); + QMainWindow::closeEvent(event); } -void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos ) +void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos) { - QMenu *instContextMenu = new QMenu ( "Instance", this ); + QMenu *instContextMenu = new QMenu("Instance", this); // Add the actions from the toolbar to the context menu. - instContextMenu->addActions ( ui->instanceToolBar->actions() ); + instContextMenu->addActions(ui->instanceToolBar->actions()); - instContextMenu->exec ( view->mapToGlobal ( pos ) ); + instContextMenu->exec(view->mapToGlobal(pos)); } void MainWindow::on_actionLaunchInstance_triggered() { - if(m_selectedInstance) + if (m_selectedInstance) { doLogin(); } } -void MainWindow::doLogin(const QString& errorMsg) +void MainWindow::doLogin(const QString &errorMsg) { if (!m_selectedInstance) return; - - LoginDialog* loginDlg = new LoginDialog(this, errorMsg); + + LoginDialog *loginDlg = new LoginDialog(this, errorMsg); if (!m_selectedInstance->lastLaunch()) loginDlg->forceOnline(); - + loginDlg->exec(); - if(loginDlg->result() == QDialog::Accepted) + if (loginDlg->result() == QDialog::Accepted) { - if (loginDlg->isOnline()) + if (loginDlg->isOnline()) { UserInfo uInfo{loginDlg->getUsername(), loginDlg->getPassword()}; - ProgressDialog* tDialog = new ProgressDialog(this); - LoginTask* loginTask = new LoginTask(uInfo, tDialog); - connect(loginTask, SIGNAL(succeeded()),SLOT(onLoginComplete()), Qt::QueuedConnection); - connect(loginTask, SIGNAL(failed(QString)), SLOT(doLogin(QString)), Qt::QueuedConnection); + ProgressDialog *tDialog = new ProgressDialog(this); + LoginTask *loginTask = new LoginTask(uInfo, tDialog); + connect(loginTask, SIGNAL(succeeded()), SLOT(onLoginComplete()), + Qt::QueuedConnection); + connect(loginTask, SIGNAL(failed(QString)), SLOT(doLogin(QString)), + Qt::QueuedConnection); m_activeInst = m_selectedInstance; tDialog->exec(loginTask); } @@ -490,7 +485,7 @@ void MainWindow::doLogin(const QString& errorMsg) { QString user = loginDlg->getUsername(); if (user.length() == 0) - user = QString("Offline"); + user = QString("Offline"); m_activeLogin = {user, QString("Offline"), QString(), QString()}; m_activeInst = m_selectedInstance; launchInstance(m_activeInst, m_activeLogin); @@ -500,20 +495,20 @@ void MainWindow::doLogin(const QString& errorMsg) void MainWindow::onLoginComplete() { - if(!m_activeInst) + if (!m_activeInst) return; - LoginTask * task = (LoginTask *) QObject::sender(); + LoginTask *task = (LoginTask *)QObject::sender(); m_activeLogin = task->getResult(); - + BaseUpdate *updateTask = m_activeInst->doUpdate(); - if(!updateTask) + if (!updateTask) { launchInstance(m_activeInst, m_activeLogin); } else { ProgressDialog *tDialog = new ProgressDialog(this); - connect(updateTask, SIGNAL(succeeded()),SLOT(onGameUpdateComplete())); + connect(updateTask, SIGNAL(succeeded()), SLOT(onGameUpdateComplete())); connect(updateTask, SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); tDialog->exec(updateTask); } @@ -532,11 +527,11 @@ void MainWindow::onGameUpdateError(QString error) void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) { Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL"); - + proc = instance->prepareForLaunch(response); - if(!proc) + if (!proc) return; - + // Prepare GUI: If it shall stay open disable the required parts if (MMC->settings()->get("NoHide").toBool()) { @@ -546,11 +541,11 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) { this->hide(); } - + console = new ConsoleWindow(proc); console->show(); - connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), - console, SLOT(write(QString, MessageLevel::Enum))); + connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, + SLOT(write(QString, MessageLevel::Enum))); connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded())); proc->setLogin(response.username, response.session_id); proc->launch(); @@ -566,7 +561,7 @@ void MainWindow::taskEnd() QObject *sender = QObject::sender(); if (sender == m_versionLoadTask) m_versionLoadTask = NULL; - + sender->deleteLater(); } @@ -578,20 +573,24 @@ void MainWindow::startTask(Task *task) task->start(); } - // Create A Desktop Shortcut void MainWindow::on_actionMakeDesktopShortcut_triggered() { - QString name ( "Test" ); - name = QInputDialog::getText ( this, tr ( "MultiMC Shortcut" ), tr ( "Enter a Shortcut Name." ), QLineEdit::Normal, name ); + QString name("Test"); + name = QInputDialog::getText(this, tr("MultiMC Shortcut"), tr("Enter a Shortcut Name."), + QLineEdit::Normal, name); - Util::createShortCut ( Util::getDesktopDir(), QApplication::instance()->applicationFilePath(), QStringList() << "-dl" << QDir::currentPath() << "test", name, "application-x-octet-stream" ); + Util::createShortCut(Util::getDesktopDir(), QApplication::instance()->applicationFilePath(), + QStringList() << "-dl" << QDir::currentPath() << "test", name, + "application-x-octet-stream"); - QMessageBox::warning ( this, tr("Not useful"), tr("A Dummy Shortcut was created. it will not do anything productive") ); + QMessageBox::warning( + this, tr("Not useful"), + tr("A Dummy Shortcut was created. it will not do anything productive")); } // BrowserDialog -void MainWindow::openWebPage ( QUrl url ) +void MainWindow::openWebPage(QUrl url) { QDesktopServices::openUrl(url); } @@ -600,8 +599,8 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() { if (view->selectionModel()->selectedIndexes().count() < 1) return; - - VersionSelectDialog vselect(m_selectedInstance->versionList().data(), this); + + VersionSelectDialog vselect(m_selectedInstance->versionList().get(), this); if (vselect.exec() && vselect.selectedVersion()) { m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); @@ -612,12 +611,12 @@ void MainWindow::on_actionChangeInstLWJGLVersion_triggered() { if (!m_selectedInstance) return; - + LWJGLSelectDialog lselect(this); lselect.exec(); if (lselect.result() == QDialog::Accepted) { - LegacyInstance * linst = (LegacyInstance *) m_selectedInstance; + LegacyInstance *linst = (LegacyInstance *)m_selectedInstance; linst->setLWJGLVersion(lselect.selectedVersion()); } } @@ -632,18 +631,23 @@ void MainWindow::on_actionInstanceSettings_triggered() settings.exec(); } -void MainWindow::instanceChanged( const QModelIndex& current, const QModelIndex& previous ) +void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous) { - if(current.isValid() && nullptr != (m_selectedInstance = (BaseInstance *) current.data(InstanceList::InstancePointerRole).value())) + if (current.isValid() && + nullptr != (m_selectedInstance = + (BaseInstance *)current.data(InstanceList::InstancePointerRole) + .value())) { ui->instanceToolBar->setEnabled(true); QString iconKey = m_selectedInstance->iconKey(); renameButton->setText(m_selectedInstance->name()); - ui->actionChangeInstLWJGLVersion->setEnabled(m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion")); - ui->actionEditInstMods->setEnabled(m_selectedInstance->menuActionEnabled("actionEditInstMods")); + ui->actionChangeInstLWJGLVersion->setEnabled( + m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion")); + ui->actionEditInstMods->setEnabled( + m_selectedInstance->menuActionEnabled("actionEditInstMods")); statusBar()->clearMessage(); statusBar()->showMessage(m_selectedInstance->getStatusbarDescription()); - auto ico =MMC->icons()->getIcon(iconKey); + auto ico = MMC->icons()->getIcon(iconKey); ui->actionChangeInstIcon->setIcon(ico); } else @@ -663,19 +667,17 @@ void MainWindow::selectionBad() ui->actionChangeInstIcon->setIcon(ico); } - - void MainWindow::on_actionEditInstNotes_triggered() { if (!m_selectedInstance) return; - LegacyInstance * linst = (LegacyInstance *) m_selectedInstance; - + LegacyInstance *linst = (LegacyInstance *)m_selectedInstance; + EditNotesDialog noteedit(linst->notes(), linst->name(), this); noteedit.exec(); if (noteedit.result() == QDialog::Accepted) { - + linst->setNotes(noteedit.getText()); } } diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index 859077d9..c035302c 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -96,7 +96,7 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const void NewInstanceDialog::on_btnChangeVersion_clicked() { - VersionSelectDialog vselect(MMC->minecraftlist().data(), this); + VersionSelectDialog vselect(MMC->minecraftlist().get(), this); vselect.exec(); if (vselect.result() == QDialog::Accepted) { diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index 9736c1c7..31fe2d96 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -27,7 +27,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : { ui->setupUi(this); - loadSettings(MMC->settings().data()); + loadSettings(MMC->settings().get()); updateCheckboxStuff(); } @@ -85,7 +85,7 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) void SettingsDialog::on_buttonBox_accepted() { - applySettings(MMC->settings().data()); + applySettings(MMC->settings().get()); } void SettingsDialog::applySettings(SettingsObject *s) diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index 1e60c7d9..ff990188 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -91,6 +91,6 @@ void VersionSelectDialog::setFilter(int column, QString filter) if (filteredTypes.length() > 0) regexStr = QString("^((?!%1).)*$").arg(filteredTypes.join('|')); - qDebug() << "Filter:" << regexStr; + QLOG_DEBUG() << "Filter:" << regexStr; */ } -- cgit v1.2.3 From 8b18af051585108a65a01347d333ce79e2e82d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 6 Oct 2013 03:07:57 +0200 Subject: Get rid of junky timestamps, along with some select pointless log messages --- gui/mainwindow.cpp | 4 +-- gui/mainwindow.h | 98 ++++++++++++++++++++++++++---------------------------- 2 files changed, 50 insertions(+), 52 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index ecf5f79d..da767709 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -437,7 +437,7 @@ void MainWindow::closeEvent(QCloseEvent *event) // settings->getConfig().setValue("MainWindowState", saveState()); QMainWindow::closeEvent(event); } - +/* void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos) { QMenu *instContextMenu = new QMenu("Instance", this); @@ -447,7 +447,7 @@ void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos) instContextMenu->exec(view->mapToGlobal(pos)); } - +*/ void MainWindow::on_actionLaunchInstance_triggered() { if (m_selectedInstance) diff --git a/gui/mainwindow.h b/gui/mainwindow.h index cc9b0b7b..86f21113 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -3,7 +3,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -39,115 +39,113 @@ class MainWindow; class MainWindow : public QMainWindow { Q_OBJECT - + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); - + void closeEvent(QCloseEvent *event); // Browser Dialog void openWebPage(QUrl url); - - + private slots: void onCatToggled(bool); - + void on_actionAbout_triggered(); - + void on_actionAddInstance_triggered(); - + void on_actionChangeInstGroup_triggered(); - + void on_actionChangeInstIcon_triggered(); - + void on_actionViewInstanceFolder_triggered(); - + void on_actionConfig_Folder_triggered(); - + void on_actionViewSelectedInstFolder_triggered(); void on_actionRefresh_triggered(); - + void on_actionViewCentralModsFolder_triggered(); - + void on_actionCheckUpdate_triggered(); - + void on_actionSettings_triggered(); - + void on_actionReportBug_triggered(); - + void on_actionNews_triggered(); - + void on_mainToolBar_visibilityChanged(bool); - - void on_instanceView_customContextMenuRequested(const QPoint &pos); - + + // void on_instanceView_customContextMenuRequested(const QPoint &pos); + void on_actionLaunchInstance_triggered(); - + void on_actionDeleteInstance_triggered(); - + void on_actionRenameInstance_triggered(); - + void on_actionMakeDesktopShortcut_triggered(); - + void on_actionChangeInstMCVersion_triggered(); - + void on_actionEditInstMods_triggered(); - + void on_actionEditInstNotes_triggered(); - - void doLogin(const QString& errorMsg = ""); - - + + void doLogin(const QString &errorMsg = ""); + void onLoginComplete(); - - + void onGameUpdateComplete(); void onGameUpdateError(QString error); - + void taskStart(); void taskEnd(); void on_actionChangeInstLWJGLVersion_triggered(); - + void instanceEnded(); - - void on_actionInstanceSettings_triggered(); + + void on_actionInstanceSettings_triggered(); public slots: - void instanceActivated ( QModelIndex ); + void instanceActivated(QModelIndex); + + void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous); - void instanceChanged (const QModelIndex & current,const QModelIndex & previous); - void selectionBad(); - + void startTask(Task *task); - + void launchInstance(BaseInstance *inst, LoginResponse response); protected: bool eventFilter(QObject *obj, QEvent *ev); void setCatBackground(bool enabled); + private: - + Ui::MainWindow *ui; - KCategoryDrawer * drawer; - KCategorizedView * view; - InstanceProxyModel * proxymodel; + KCategoryDrawer *drawer; + KCategorizedView *view; + InstanceProxyModel *proxymodel; MinecraftProcess *proc; ConsoleWindow *console; OneSixAssets *assets_downloader; - LabeledToolButton * renameButton; - + LabeledToolButton *renameButton; + BaseInstance *m_selectedInstance; - + // A pointer to the instance we are actively doing stuff with. // This is set when the user launches an instance and is used to refer to that // instance throughout the launching process. BaseInstance *m_activeInst; LoginResponse m_activeLogin; - + Task *m_versionLoadTask; }; -- cgit v1.2.3 From 17c98655f86f8ea41c4528e3fc25d12388a36861 Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 6 Oct 2013 19:54:52 +0100 Subject: First draft of multiple Java installation detection on Windows --- gui/settingsdialog.cpp | 4 ++-- gui/settingsdialog.ui | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index c6fe893d..011925b7 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -185,9 +185,9 @@ void SettingsDialog::loadSettings(SettingsObject *s) void SettingsDialog::on_pushButton_clicked() { JavaUtils jut; - QStringList paths = jut.FindJavaPath(); + auto javas = jut.FindJavaPaths(); - ui->javaPathTextBox->setText(paths.at(0)); + ui->javaPathTextBox->setText(std::get(javas.at(0))); } void SettingsDialog::on_btnBrowse_clicked() diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index d7a134fb..8fa5e96e 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -374,6 +374,12 @@ + + + 0 + 0 + + Java path: @@ -381,6 +387,12 @@ + + + 0 + 0 + + JVM arguments: @@ -402,9 +414,6 @@ - - - @@ -418,6 +427,9 @@ + + + -- cgit v1.2.3 From ecc5153efe626e3c96047ea7da92876fdb59afe1 Mon Sep 17 00:00:00 2001 From: Sky Date: Mon, 7 Oct 2013 19:55:49 +0100 Subject: Fix About logo, inflate ego --- gui/aboutdialog.ui | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'gui') diff --git a/gui/aboutdialog.ui b/gui/aboutdialog.ui index bd5cc568..eb055ebe 100644 --- a/gui/aboutdialog.ui +++ b/gui/aboutdialog.ui @@ -58,6 +58,9 @@ + + :/icons/multimc/scalable/apps/multimc.svg + @@ -101,7 +104,7 @@ 0 0 432 - 179 + 197 @@ -159,8 +162,8 @@ 0 0 - 682 - 584 + 432 + 197 @@ -176,10 +179,11 @@ <!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:'Bitstream Vera Sans'; 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></body></html> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; 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'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Sky Welch &lt;</span><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html> @@ -190,8 +194,8 @@ p, li { white-space: pre-wrap; } 0 0 - 682 - 584 + 432 + 197 @@ -213,7 +217,7 @@ p, li { white-space: pre-wrap; } <!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:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; 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'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; font-size:10pt;">you may not use this file except in compliance with the License.</span></p> @@ -263,6 +267,9 @@ p, li { white-space: pre-wrap; } + + false + About Qt @@ -292,6 +299,8 @@ p, li { white-space: pre-wrap; } - + + + -- cgit v1.2.3 From 50035e9aa1b4f04c91cce3830effbc11c0eec269 Mon Sep 17 00:00:00 2001 From: Sky Date: Mon, 7 Oct 2013 22:42:14 +0100 Subject: Set offline player name to "Player" to prevent a crash on world loading in an offline session --- gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index da767709..3ba6e52b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -486,7 +486,7 @@ void MainWindow::doLogin(const QString &errorMsg) QString user = loginDlg->getUsername(); if (user.length() == 0) user = QString("Offline"); - m_activeLogin = {user, QString("Offline"), QString(), QString()}; + m_activeLogin = {user, QString("Offline"), QString("Player"), QString()}; m_activeInst = m_selectedInstance; launchInstance(m_activeInst, m_activeLogin); } -- cgit v1.2.3 From 346087efbb1eadf462b8b448a0d4c0458d3a2c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 6 Oct 2013 14:43:46 +0200 Subject: Misc version dialog changes --- gui/LegacyModEditDialog.cpp | 2 +- gui/OneSixModEditDialog.cpp | 2 +- gui/mainwindow.cpp | 3 ++- gui/newinstancedialog.cpp | 23 +++++++++++------------ gui/versionselectdialog.cpp | 18 +++++++++--------- gui/versionselectdialog.h | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index c240daff..45f041f3 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -195,7 +195,7 @@ void LegacyModEditDialog::on_addCoreBtn_clicked() } void LegacyModEditDialog::on_addForgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist().get(), this); + VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); vselect.setFilter(1, m_inst->intendedVersionId()); if (vselect.exec() && vselect.selectedVersion()) { diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index e8c7f9ed..24f01c53 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -121,7 +121,7 @@ void OneSixModEditDialog::on_revertBtn_clicked() void OneSixModEditDialog::on_forgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist().get(), this); + VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); vselect.setFilter(1, m_inst->currentVersionId()); if (vselect.exec() && vselect.selectedVersion()) { diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 3ba6e52b..080ce4b2 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -600,7 +600,8 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() if (view->selectionModel()->selectedIndexes().count() < 1) return; - VersionSelectDialog vselect(m_selectedInstance->versionList().get(), this); + VersionSelectDialog vselect(m_selectedInstance->versionList().get(), + tr("Change Minecraft version"), this); if (vselect.exec() && vselect.selectedVersion()) { m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index c035302c..04b38316 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -3,7 +3,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -30,11 +30,8 @@ #include #include - - -NewInstanceDialog::NewInstanceDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::NewInstanceDialog) +NewInstanceDialog::NewInstanceDialog(QWidget *parent) + : QDialog(parent), ui(new Ui::NewInstanceDialog) { ui->setupUi(this); resize(minimumSizeHint()); @@ -60,13 +57,14 @@ NewInstanceDialog::~NewInstanceDialog() void NewInstanceDialog::updateDialogState() { - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty() && m_selectedVersion); + ui->buttonBox->button(QDialogButtonBox::Ok) + ->setEnabled(!instName().isEmpty() && m_selectedVersion); } void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version) { m_selectedVersion = version; - + if (m_selectedVersion) { ui->versionTextBox->setText(version->name()); @@ -75,7 +73,7 @@ void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version) { ui->versionTextBox->setText(""); } - + updateDialogState(); } @@ -96,7 +94,8 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const void NewInstanceDialog::on_btnChangeVersion_clicked() { - VersionSelectDialog vselect(MMC->minecraftlist().get(), this); + VersionSelectDialog vselect(MMC->minecraftlist().get(), tr("Change Minecraft version"), + this); vselect.exec(); if (vselect.result() == QDialog::Accepted) { @@ -110,8 +109,8 @@ void NewInstanceDialog::on_iconButton_clicked() { IconPickerDialog dlg(this); dlg.exec(InstIconKey); - - if(dlg.result() == QDialog::Accepted) + + if (dlg.result() == QDialog::Accepted) { InstIconKey = dlg.selectedIconKey; ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index ff990188..d975a7b4 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -3,7 +3,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -26,18 +26,18 @@ #include #include -VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QWidget *parent) : - QDialog(parent), - ui(new Ui::VersionSelectDialog) +VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent) + : QDialog(parent), ui(new Ui::VersionSelectDialog) { ui->setupUi(this); setWindowModality(Qt::WindowModal); - + setWindowTitle(title); + m_vlist = vlist; - + m_proxyModel = new QSortFilterProxyModel(this); m_proxyModel->setSourceModel(vlist); - + ui->listView->setModel(m_proxyModel); ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); @@ -86,11 +86,11 @@ void VersionSelectDialog::setFilter(int column, QString filter) filteredTypes += "Snapshot"; if (!ui->filterMCNostalgiaCheckbox->isChecked()) filteredTypes += "Nostalgia"; - + QString regexStr = "^.*$"; if (filteredTypes.length() > 0) regexStr = QString("^((?!%1).)*$").arg(filteredTypes.join('|')); - + QLOG_DEBUG() << "Filter:" << regexStr; */ } diff --git a/gui/versionselectdialog.h b/gui/versionselectdialog.h index 0bb1745a..4be048af 100644 --- a/gui/versionselectdialog.h +++ b/gui/versionselectdialog.h @@ -33,7 +33,7 @@ class VersionSelectDialog : public QDialog Q_OBJECT public: - explicit VersionSelectDialog(BaseVersionList *vlist, QWidget *parent = 0); + explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0); ~VersionSelectDialog(); virtual int exec(); -- cgit v1.2.3 From a58912eaf7e98c1bc9e960fbf77b6293e57c28a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 7 Oct 2013 23:09:50 +0200 Subject: Basic version changing (OneSix only for now) --- gui/mainwindow.cpp | 3 +++ gui/mainwindow.ui | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 080ce4b2..70d26e02 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -602,6 +602,7 @@ 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()) { m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); @@ -646,6 +647,8 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion")); ui->actionEditInstMods->setEnabled( m_selectedInstance->menuActionEnabled("actionEditInstMods")); + ui->actionChangeInstMCVersion->setEnabled( + m_selectedInstance->menuActionEnabled("actionChangeInstMCVersion")); statusBar()->clearMessage(); statusBar()->showMessage(m_selectedInstance->getStatusbarDescription()); auto ico = MMC->icons()->getIcon(iconKey); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 1cda7a34..4c288d5f 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -107,6 +107,7 @@ + @@ -371,9 +372,6 @@ - - false - Change Version -- cgit v1.2.3 From 05e2da51d8d25374140dce3c1646a2a1a0a2a553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 8 Oct 2013 01:36:11 +0200 Subject: Add mod website button thing feature widget. It is super effective. --- gui/LegacyModEditDialog.cpp | 35 ++++++++++++++++++++++++++++++++++- gui/LegacyModEditDialog.h | 39 ++++++++++++++++++++++++--------------- gui/LegacyModEditDialog.ui | 21 +++++++++++++++++++++ gui/ModEditDialogCommon.cpp | 37 ++++++++++++++++++++++++++++++------- gui/ModEditDialogCommon.h | 5 ++++- gui/OneSixModEditDialog.cpp | 11 +++++++++++ gui/OneSixModEditDialog.h | 1 + gui/OneSixModEditDialog.ui | 7 +++++++ 8 files changed, 132 insertions(+), 24 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 45f041f3..87647e0f 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -24,6 +24,7 @@ #include #include +//#include #include #include #include @@ -342,4 +343,36 @@ void LegacyModEditDialog::on_viewTexPackBtn_clicked() void LegacyModEditDialog::on_buttonBox_rejected() { close(); -} \ No newline at end of file +} + +//FIXME: too much copypasta makes peterix a sad hacker. BUT IT'S SO DELICIOUS! + +void LegacyModEditDialog::on_coreWebsite_clicked() +{ + int first, last; + auto list = ui->coreModsTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + showWebsiteForMod(this, m_coremods->operator[](first)); +} + +void LegacyModEditDialog::on_jarWebsite_clicked() +{ + int first, last; + auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + showWebsiteForMod(this, m_jarmods->operator[](first)); +} + +void LegacyModEditDialog::on_loaderWebsite_clicked() +{ + int first, last; + auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + showWebsiteForMod(this, m_mods->operator[](first)); +} diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index 5f6973d3..f12d9a7b 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -3,7 +3,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -19,51 +19,60 @@ #include "logic/LegacyInstance.h" #include -namespace Ui { +namespace Ui +{ class LegacyModEditDialog; } class LegacyModEditDialog : public QDialog { Q_OBJECT - + public: - explicit LegacyModEditDialog(LegacyInstance* inst, QWidget *parent = 0); + explicit LegacyModEditDialog(LegacyInstance *inst, QWidget *parent = 0); ~LegacyModEditDialog(); - -private slots: - + +private +slots: + void on_addJarBtn_clicked(); void on_rmJarBtn_clicked(); void on_addForgeBtn_clicked(); void on_moveJarUpBtn_clicked(); void on_moveJarDownBtn_clicked(); - + void on_addCoreBtn_clicked(); void on_rmCoreBtn_clicked(); void on_viewCoreBtn_clicked(); - + void on_addModBtn_clicked(); void on_rmModBtn_clicked(); void on_viewModBtn_clicked(); - + void on_addTexPackBtn_clicked(); void on_rmTexPackBtn_clicked(); void on_viewTexPackBtn_clicked(); + + void on_jarWebsite_clicked(); + void on_loaderWebsite_clicked(); + void on_coreWebsite_clicked(); + // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); + protected: bool eventFilter(QObject *obj, QEvent *ev); - bool jarListFilter( QKeyEvent* ev ); - bool coreListFilter( QKeyEvent* ev ); - bool loaderListFilter( QKeyEvent* ev ); - bool texturePackListFilter( QKeyEvent* ev ); + bool jarListFilter(QKeyEvent *ev); + bool coreListFilter(QKeyEvent *ev); + bool loaderListFilter(QKeyEvent *ev); + bool texturePackListFilter(QKeyEvent *ev); + private: Ui::LegacyModEditDialog *ui; std::shared_ptr m_mods; std::shared_ptr m_coremods; std::shared_ptr m_jarmods; std::shared_ptr m_texturepacks; - LegacyInstance * m_inst; + LegacyInstance *m_inst; DownloadJobPtr forgeJob; }; diff --git a/gui/LegacyModEditDialog.ui b/gui/LegacyModEditDialog.ui index 73b767dc..6a4b6d1e 100644 --- a/gui/LegacyModEditDialog.ui +++ b/gui/LegacyModEditDialog.ui @@ -57,6 +57,13 @@ + + + + Website + + + @@ -116,6 +123,13 @@ + + + + Website + + + @@ -171,6 +185,13 @@ + + + + Website + + + diff --git a/gui/ModEditDialogCommon.cpp b/gui/ModEditDialogCommon.cpp index 5da0a039..692ac0c4 100644 --- a/gui/ModEditDialogCommon.cpp +++ b/gui/ModEditDialogCommon.cpp @@ -1,17 +1,40 @@ #include "ModEditDialogCommon.h" - -bool lastfirst (QModelIndexList & list, int & first, int & last) +#include +#include +#include +#include +bool lastfirst(QModelIndexList &list, int &first, int &last) { - if(!list.size()) + if (!list.size()) return false; first = last = list[0].row(); - for(auto item: list) + for (auto item : list) { int row = item.row(); - if(row < first) + if (row < first) first = row; - if(row > last) + if (row > last) last = row; } return true; -} \ No newline at end of file +} + +void showWebsiteForMod(QWidget *parentDlg, Mod &m) +{ + QString url = m.homeurl(); + if (url.size()) + { + // catch the cases where the protocol is missing + if(!url.startsWith("http")) + { + url = "http://" + url; + } + QDesktopServices::openUrl(url); + } + else + { + QMessageBox::warning( + parentDlg, parentDlg->tr("How sad!"), + parentDlg->tr("The mod author didn't provide a website link for this mod.")); + } +} diff --git a/gui/ModEditDialogCommon.h b/gui/ModEditDialogCommon.h index a27a8a82..bc8e223f 100644 --- a/gui/ModEditDialogCommon.h +++ b/gui/ModEditDialogCommon.h @@ -1,4 +1,7 @@ #pragma once #include +#include -bool lastfirst (QModelIndexList & list, int & first, int & last); \ No newline at end of file +bool lastfirst (QModelIndexList & list, int & first, int & last); + +void showWebsiteForMod(QWidget * parentDlg, Mod& m); \ No newline at end of file diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 24f01c53..788a61d0 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -30,6 +30,7 @@ #include #include #include +#include OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) : m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog) @@ -296,3 +297,13 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked() { openDirInDefaultProgram(m_inst->resourcePacksDir(), true); } + +void OneSixModEditDialog::on_loaderWebsite_clicked() +{ + int first, last; + auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + showWebsiteForMod(this, m_mods->operator[](first)); +} diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index 5c65fea3..ce4da4fe 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -44,6 +44,7 @@ private slots: void on_forgeBtn_clicked(); void on_customizeBtn_clicked(); void on_revertBtn_clicked(); + void on_loaderWebsite_clicked(); void updateVersionControls(); void disableVersionControls(); protected: diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index 527899ca..b97d4304 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -184,6 +184,13 @@ + + + + Website + + + -- cgit v1.2.3 From 60e7e019fe62f48ebdb5cea0ab83ab58f3379fdf Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 17:07:54 +0100 Subject: Start mcmod.info panel. Needs to be its own widget and included in legacy mod edit window, text labels need eliding --- gui/OneSixModEditDialog.cpp | 31 +++- gui/OneSixModEditDialog.h | 4 +- gui/OneSixModEditDialog.ui | 365 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 347 insertions(+), 53 deletions(-) (limited to 'gui') diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 788a61d0..d97967e8 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -298,12 +298,39 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked() openDirInDefaultProgram(m_inst->resourcePacksDir(), true); } -void OneSixModEditDialog::on_loaderWebsite_clicked() +void OneSixModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index) { int first, last; auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); if (!lastfirst(list, first, last)) return; - showWebsiteForMod(this, m_mods->operator[](first)); + + Mod &m = m_mods->operator[](first); + + QString missing = "

Missing from mcmod.info

"; + + QString name = m.name(); + if(name.isEmpty()) name = missing; + QString description = m.description(); + if(description.isEmpty()) description = missing; + QString authors = m.authors(); + if(authors.isEmpty()) authors = missing; + QString credits = m.credits(); + if(credits.isEmpty()) credits = missing; + QString website = m.homeurl(); + if(website.isEmpty()) website = missing; + else website = "" + website + ""; + + ui->label_Name->setText("

" + name + "

"); + ui->label_Description->setText(description); + ui->label_Authors->setText(authors); + ui->label_Credits->setText(credits); + ui->label_Website->setText(website); + + ui->label_Name->setToolTip("

" + name + "

"); + ui->label_Description->setToolTip(description); + ui->label_Authors->setToolTip(authors); + ui->label_Credits->setToolTip(credits); + //ui->label_Website->setToolTip(website); } diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index ce4da4fe..03ebf7a3 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -44,9 +44,11 @@ private slots: void on_forgeBtn_clicked(); void on_customizeBtn_clicked(); void on_revertBtn_clicked(); - void on_loaderWebsite_clicked(); void updateVersionControls(); void disableVersionControls(); + + void on_loaderModTreeView_pressed(const QModelIndex &index); + protected: bool eventFilter(QObject *obj, QEvent *ev); bool loaderListFilter( QKeyEvent* ev ); diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index b97d4304..88ba5a76 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -26,7 +26,7 @@
- 0 + 1 @@ -157,62 +157,327 @@ Loader Mods - + - - - true - - - QAbstractItemView::DropOnly - - - - - - - - - &Add - - - - - - - &Remove - - - - - - - Website - - - + - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + 0 + 0 + + + + true + + + QAbstractItemView::DropOnly + + + + - - - &View Folder - - + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + &View Folder + + + + + + + + + 55 + 0 + + + + + 16777215 + 150 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 250 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 9 + + + 0 + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-size:9pt; font-weight:600; font-style:italic;">Select a mod to view information...</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic;">Mod description</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + QLayout::SetDefaultConstraint + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod authors</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Credits: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Website: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + + + + + Authors: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + -- cgit v1.2.3 From f2291ef161c6ae2d47ede15633626ab1e8caab86 Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 21:45:48 +0100 Subject: Move mod info frame and handler to MCModInfoFrame, use on all instances --- gui/LegacyModEditDialog.cpp | 39 ++++++ gui/LegacyModEditDialog.h | 6 + gui/LegacyModEditDialog.ui | 327 ++++++++++++++++++++++++-------------------- gui/MCModInfoFrame.cpp | 66 +++++++++ gui/MCModInfoFrame.h | 32 +++++ gui/MCModInfoFrame.ui | 261 +++++++++++++++++++++++++++++++++++ gui/ModListView.h | 3 +- gui/OneSixModEditDialog.cpp | 26 +--- gui/OneSixModEditDialog.ui | 256 +--------------------------------- 9 files changed, 591 insertions(+), 425 deletions(-) create mode 100644 gui/MCModInfoFrame.cpp create mode 100644 gui/MCModInfoFrame.h create mode 100644 gui/MCModInfoFrame.ui (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 87647e0f..72792581 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -376,3 +376,42 @@ void LegacyModEditDialog::on_loaderWebsite_clicked() return; showWebsiteForMod(this, m_mods->operator[](first)); } + +void LegacyModEditDialog::on_jarModsTreeView_pressed(const QModelIndex &index) +{ + int first, last; + auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + + Mod &m = m_jarmods->operator[](first); + + handleModInfoUpdate(m, ui->jarMIFrame); +} + +void LegacyModEditDialog::on_coreModsTreeView_pressed(const QModelIndex &index) +{ + int first, last; + auto list = ui->coreModsTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + + Mod &m = m_coremods->operator[](first); + + handleModInfoUpdate(m, ui->coreMIFrame); +} + +void LegacyModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index) +{ + int first, last; + auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + + Mod &m = m_mods->operator[](first); + + handleModInfoUpdate(m, ui->loaderMIFrame); +} diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index f12d9a7b..fcf07f1c 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -60,6 +60,12 @@ slots: // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); + void on_jarModsTreeView_pressed(const QModelIndex &index); + + void on_coreModsTreeView_pressed(const QModelIndex &index); + + void on_loaderModTreeView_pressed(const QModelIndex &index); + protected: bool eventFilter(QObject *obj, QEvent *ev); bool jarListFilter(QKeyEvent *ev); diff --git a/gui/LegacyModEditDialog.ui b/gui/LegacyModEditDialog.ui index 6a4b6d1e..3ab946d9 100644 --- a/gui/LegacyModEditDialog.ui +++ b/gui/LegacyModEditDialog.ui @@ -23,197 +23,218 @@ Jar Mods - + - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - - - - - - - &Add - - - - - - - &Remove - - - + - - - MCForge - - - - - - - Website - - - - - - - Qt::Vertical - - - - 20 - 40 - + + + Qt::ScrollBarAlwaysOn - - - - - - Move &Up + + Qt::ScrollBarAlwaysOff - - - Move &Down - - + + + + + &Add + + + + + + + &Remove + + + + + + + MCForge + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Move &Up + + + + + + + Move &Down + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + Core Mods - + - - - QAbstractItemView::DropOnly - - - - - - - - - &Add - - - + - - - &Remove + + + QAbstractItemView::DropOnly - - - Website - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - &View Folder - - + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + &View Folder + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + Loader Mods - - - - - true - - - QAbstractItemView::DropOnly - - - + - + - - - &Add + + + true - - - - - - &Remove - - - - - - - Website + + QAbstractItemView::DropOnly - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - &View Folder - - + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + &View Folder + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + @@ -291,6 +312,12 @@ QTreeView
gui/ModListView.h
+ + MCModInfoFrame + QFrame +
gui/MCModInfoFrame.h
+ 1 +
diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp new file mode 100644 index 00000000..805af56b --- /dev/null +++ b/gui/MCModInfoFrame.cpp @@ -0,0 +1,66 @@ +#include "MCModInfoFrame.h" +#include "ui_MCModInfoFrame.h" + +void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) +{ + QString missing = "

Missing from mcmod.info

"; + + QString name = m.name(); + if(name.isEmpty()) name = missing; + QString description = m.description(); + if(description.isEmpty()) description = missing; + QString authors = m.authors(); + if(authors.isEmpty()) authors = missing; + QString credits = m.credits(); + if(credits.isEmpty()) credits = missing; + QString website = m.homeurl(); + if(website.isEmpty()) website = missing; + else website = "" + website + ""; + + frame->setName("

" + name + "

"); + frame->setDescription(description); + frame->setAuthors(authors); + frame->setCredits(credits); + frame->setWebsite(website); +} + +MCModInfoFrame::MCModInfoFrame(QWidget *parent) : + QFrame(parent), + ui(new Ui::MCModInfoFrame) +{ + ui->setupUi(this); +} + +MCModInfoFrame::~MCModInfoFrame() +{ + delete ui; +} + +void MCModInfoFrame::setName(QString name) +{ + ui->label_Name->setText(name); + ui->label_Name->setToolTip(name); +} + +void MCModInfoFrame::setDescription(QString description) +{ + ui->label_Description->setText(description); + ui->label_Description->setToolTip(description); +} + +void MCModInfoFrame::setAuthors(QString authors) +{ + ui->label_Authors->setText(authors); + ui->label_Authors->setToolTip(authors); +} + +void MCModInfoFrame::setCredits(QString credits) +{ + ui->label_Credits->setText(credits); + ui->label_Credits->setToolTip(credits); +} + +void MCModInfoFrame::setWebsite(QString website) +{ + ui->label_Website->setText(website); +} diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h new file mode 100644 index 00000000..7910bd0c --- /dev/null +++ b/gui/MCModInfoFrame.h @@ -0,0 +1,32 @@ +#ifndef MCMODINFOFRAME_H +#define MCMODINFOFRAME_H + +#include +#include "logic/Mod.h" + +namespace Ui { +class MCModInfoFrame; +} + +class MCModInfoFrame : public QFrame +{ + Q_OBJECT + +public: + explicit MCModInfoFrame(QWidget *parent = 0); + ~MCModInfoFrame(); + + void setName(QString name); + void setDescription(QString description); + void setAuthors(QString authors); + void setCredits(QString credits); + void setWebsite(QString website); + + +private: + Ui::MCModInfoFrame *ui; +}; + +void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame); + +#endif // MCMODINFOFRAME_H diff --git a/gui/MCModInfoFrame.ui b/gui/MCModInfoFrame.ui new file mode 100644 index 00000000..022588d5 --- /dev/null +++ b/gui/MCModInfoFrame.ui @@ -0,0 +1,261 @@ + + + MCModInfoFrame + + + + 0 + 0 + 571 + 55 + + + + Frame + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 250 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 9 + + + 0 + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-size:9pt; font-weight:600; font-style:italic;">Select a mod to view information...</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic;">Mod description</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + QLayout::SetDefaultConstraint + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod authors</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Credits: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Website: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 200 + 0 + + + + + 16777215 + 92 + + + + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + + + + + Authors: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + diff --git a/gui/ModListView.h b/gui/ModListView.h index a9408fe7..69a26755 100644 --- a/gui/ModListView.h +++ b/gui/ModListView.h @@ -9,4 +9,5 @@ class ModListView: public QTreeView public: explicit ModListView ( QWidget* parent = 0 ); virtual void setModel ( QAbstractItemModel* model ); -}; \ No newline at end of file + +}; diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index d97967e8..9724cec5 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -308,29 +308,5 @@ void OneSixModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index) Mod &m = m_mods->operator[](first); - QString missing = "

Missing from mcmod.info

"; - - QString name = m.name(); - if(name.isEmpty()) name = missing; - QString description = m.description(); - if(description.isEmpty()) description = missing; - QString authors = m.authors(); - if(authors.isEmpty()) authors = missing; - QString credits = m.credits(); - if(credits.isEmpty()) credits = missing; - QString website = m.homeurl(); - if(website.isEmpty()) website = missing; - else website = "" + website + ""; - - ui->label_Name->setText("

" + name + "

"); - ui->label_Description->setText(description); - ui->label_Authors->setText(authors); - ui->label_Credits->setText(credits); - ui->label_Website->setText(website); - - ui->label_Name->setToolTip("

" + name + "

"); - ui->label_Description->setToolTip(description); - ui->label_Authors->setToolTip(authors); - ui->label_Credits->setToolTip(credits); - //ui->label_Website->setToolTip(website); + handleModInfoUpdate(m, ui->frame); } diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index 88ba5a76..675a6faa 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -221,261 +221,13 @@
- - - - 55 - 0 - - - - - 16777215 - 150 - - + QFrame::StyledPanel QFrame::Raised - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 9 - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-size:9pt; font-weight:600; font-style:italic;">Select a mod to view information...</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-style:italic;">Mod description</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - - - QLayout::SetDefaultConstraint - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod authors</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Credits: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Website: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - - - - - Authors: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - @@ -555,6 +307,12 @@ QTreeView
gui/ModListView.h
+ + MCModInfoFrame + QFrame +
gui/MCModInfoFrame.h
+ 1 +
-- cgit v1.2.3 From bf951c3eb82f90a83e5496b6a897f95f585aff89 Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 22:11:24 +0100 Subject: Licenses, cleanup --- gui/LegacyModEditDialog.cpp | 32 ------------------------------ gui/LegacyModEditDialog.h | 6 ------ gui/MCModInfoFrame.cpp | 15 ++++++++++++++ gui/MCModInfoFrame.h | 20 +++++++++++++++---- gui/MCModInfoFrame.ui | 48 ++++++++++++++++++++++----------------------- 5 files changed, 55 insertions(+), 66 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 72792581..585bfdfb 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -345,38 +345,6 @@ void LegacyModEditDialog::on_buttonBox_rejected() close(); } -//FIXME: too much copypasta makes peterix a sad hacker. BUT IT'S SO DELICIOUS! - -void LegacyModEditDialog::on_coreWebsite_clicked() -{ - int first, last; - auto list = ui->coreModsTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) - return; - showWebsiteForMod(this, m_coremods->operator[](first)); -} - -void LegacyModEditDialog::on_jarWebsite_clicked() -{ - int first, last; - auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) - return; - showWebsiteForMod(this, m_jarmods->operator[](first)); -} - -void LegacyModEditDialog::on_loaderWebsite_clicked() -{ - int first, last; - auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) - return; - showWebsiteForMod(this, m_mods->operator[](first)); -} - void LegacyModEditDialog::on_jarModsTreeView_pressed(const QModelIndex &index) { int first, last; diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index fcf07f1c..b5d51fd5 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -53,17 +53,11 @@ slots: void on_rmTexPackBtn_clicked(); void on_viewTexPackBtn_clicked(); - void on_jarWebsite_clicked(); - void on_loaderWebsite_clicked(); - void on_coreWebsite_clicked(); - // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); void on_jarModsTreeView_pressed(const QModelIndex &index); - void on_coreModsTreeView_pressed(const QModelIndex &index); - void on_loaderModTreeView_pressed(const QModelIndex &index); protected: diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 805af56b..e7e669ec 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -1,3 +1,18 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index 7910bd0c..516fc5ed 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -1,5 +1,19 @@ -#ifndef MCMODINFOFRAME_H -#define MCMODINFOFRAME_H +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include #include "logic/Mod.h" @@ -28,5 +42,3 @@ private: }; void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame); - -#endif // MCMODINFOFRAME_H diff --git a/gui/MCModInfoFrame.ui b/gui/MCModInfoFrame.ui index 022588d5..73b93a2e 100644 --- a/gui/MCModInfoFrame.ui +++ b/gui/MCModInfoFrame.ui @@ -144,6 +144,16 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + Authors: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + @@ -169,18 +179,18 @@ - - + + - Credits: + Website: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + + 200 @@ -194,7 +204,7 @@ - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -202,20 +212,13 @@ true - - - - - - Website: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true - - + + 200 @@ -229,7 +232,7 @@ - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -237,15 +240,12 @@ true - - true - - - + + - Authors: + Credits: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop -- cgit v1.2.3 From 9edc486f137c9719bd62c8c63ecc3d195f9dc79e Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 22:25:56 +0100 Subject: Show defaults if mod type is 'folder' --- gui/MCModInfoFrame.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index e7e669ec..70cfd46a 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -18,6 +18,17 @@ void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) { + if(m.type() == m.MOD_FOLDER) + { + frame->setName("

Select a mod to view information...

"); + frame->setDescription("

Mod description

"); + frame->setAuthors("

Mod authors

"); + frame->setCredits("

Mod credits

"); + frame->setWebsite("

Mod website

"); + + return; + } + QString missing = "

Missing from mcmod.info

"; QString name = m.name(); -- cgit v1.2.3 From 6bc9df84d9e72d8ee06c23c505b6c5ad54820115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 9 Oct 2013 02:03:02 +0200 Subject: Mod info, with less HTML! And responding to keyboard events too. --- gui/LegacyModEditDialog.cpp | 62 ++++++++------ gui/LegacyModEditDialog.h | 6 +- gui/MCModInfoFrame.cpp | 39 +++++---- gui/MCModInfoFrame.h | 11 +-- gui/MCModInfoFrame.ui | 201 ++++++++++++++++---------------------------- gui/OneSixModEditDialog.cpp | 20 +++-- gui/OneSixModEditDialog.h | 36 ++++---- 7 files changed, 168 insertions(+), 207 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 585bfdfb..82532cfd 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -47,6 +47,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) #endif ui->jarModsTreeView->installEventFilter(this); m_jarmods->startWatching(); + auto smodel = ui->jarModsTreeView->selectionModel(); + connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(jarCurrent(QModelIndex, QModelIndex))); } // Core mods { @@ -55,6 +58,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) ui->coreModsTreeView->setModel(m_coremods.get()); ui->coreModsTreeView->installEventFilter(this); m_coremods->startWatching(); + auto smodel = ui->coreModsTreeView->selectionModel(); + connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(coreCurrent(QModelIndex, QModelIndex))); } // Loader mods { @@ -63,6 +69,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) ui->loaderModTreeView->setModel(m_mods.get()); ui->loaderModTreeView->installEventFilter(this); m_mods->startWatching(); + auto smodel = ui->loaderModTreeView->selectionModel(); + connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(loaderCurrent(QModelIndex, QModelIndex))); } // texture packs { @@ -201,7 +210,7 @@ void LegacyModEditDialog::on_addForgeBtn_clicked() if (vselect.exec() && vselect.selectedVersion()) { ForgeVersionPtr forge = - std::dynamic_pointer_cast (vselect.selectedVersion()); + std::dynamic_pointer_cast(vselect.selectedVersion()); if (!forge) return; auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename); @@ -345,41 +354,38 @@ void LegacyModEditDialog::on_buttonBox_rejected() close(); } -void LegacyModEditDialog::on_jarModsTreeView_pressed(const QModelIndex &index) +void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous) { - int first, last; - auto list = ui->jarModsTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) + if(!current.isValid()) + { + ui->jarMIFrame->clear(); return; - - Mod &m = m_jarmods->operator[](first); - - handleModInfoUpdate(m, ui->jarMIFrame); + } + int row = current.row(); + Mod &m = m_jarmods->operator[](row); + ui->jarMIFrame->updateWithMod(m); } -void LegacyModEditDialog::on_coreModsTreeView_pressed(const QModelIndex &index) +void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous) { - int first, last; - auto list = ui->coreModsTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) + if(!current.isValid()) + { + ui->coreMIFrame->clear(); return; - - Mod &m = m_coremods->operator[](first); - - handleModInfoUpdate(m, ui->coreMIFrame); + } + int row = current.row(); + Mod &m = m_coremods->operator[](row); + ui->coreMIFrame->updateWithMod(m); } -void LegacyModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index) +void LegacyModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous) { - int first, last; - auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) + if(!current.isValid()) + { + ui->loaderMIFrame->clear(); return; - - Mod &m = m_mods->operator[](first); - - handleModInfoUpdate(m, ui->loaderMIFrame); + } + int row = current.row(); + Mod &m = m_mods->operator[](row); + ui->loaderMIFrame->updateWithMod(m); } diff --git a/gui/LegacyModEditDialog.h b/gui/LegacyModEditDialog.h index b5d51fd5..fc3ea1e6 100644 --- a/gui/LegacyModEditDialog.h +++ b/gui/LegacyModEditDialog.h @@ -56,9 +56,9 @@ slots: // Questionable: SettingsDialog doesn't need this for some reason? void on_buttonBox_rejected(); - void on_jarModsTreeView_pressed(const QModelIndex &index); - void on_coreModsTreeView_pressed(const QModelIndex &index); - void on_loaderModTreeView_pressed(const QModelIndex &index); + void jarCurrent(QModelIndex current, QModelIndex previous); + void coreCurrent(QModelIndex current, QModelIndex previous); + void loaderCurrent(QModelIndex current, QModelIndex previous); protected: bool eventFilter(QObject *obj, QEvent *ev); diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 70cfd46a..15ead7ab 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,21 +15,15 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" - -void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) +void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) { - frame->setName("

Select a mod to view information...

"); - frame->setDescription("

Mod description

"); - frame->setAuthors("

Mod authors

"); - frame->setCredits("

Mod credits

"); - frame->setWebsite("

Mod website

"); - + clear(); return; } - QString missing = "

Missing from mcmod.info

"; + QString missing = tr("Missing from mcmod.info"); QString name = m.name(); if(name.isEmpty()) name = missing; @@ -43,11 +37,20 @@ void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) if(website.isEmpty()) website = missing; else website = "" + website + ""; - frame->setName("

" + name + "

"); - frame->setDescription(description); - frame->setAuthors(authors); - frame->setCredits(credits); - frame->setWebsite(website); + setName(name); + setDescription(description); + setAuthors(authors); + setCredits(credits); + setWebsite(website); +} + +void MCModInfoFrame::clear() +{ + setName(tr("Select a mod to view information...")); + setDescription(tr("Mod description")); + setAuthors(tr("Mod authors")); + setCredits(tr("Mod credits")); + setWebsite(tr("Mod website")); } MCModInfoFrame::MCModInfoFrame(QWidget *parent) : @@ -65,25 +68,25 @@ MCModInfoFrame::~MCModInfoFrame() void MCModInfoFrame::setName(QString name) { ui->label_Name->setText(name); - ui->label_Name->setToolTip(name); + //ui->label_Name->setToolTip(name); } void MCModInfoFrame::setDescription(QString description) { ui->label_Description->setText(description); - ui->label_Description->setToolTip(description); + //ui->label_Description->setToolTip(description); } void MCModInfoFrame::setAuthors(QString authors) { ui->label_Authors->setText(authors); - ui->label_Authors->setToolTip(authors); + //ui->label_Authors->setToolTip(authors); } void MCModInfoFrame::setCredits(QString credits) { ui->label_Credits->setText(credits); - ui->label_Credits->setToolTip(credits); + //ui->label_Credits->setToolTip(credits); } void MCModInfoFrame::setWebsite(QString website) diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index 516fc5ed..01812df7 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -18,14 +18,15 @@ #include #include "logic/Mod.h" -namespace Ui { +namespace Ui +{ class MCModInfoFrame; } class MCModInfoFrame : public QFrame { Q_OBJECT - + public: explicit MCModInfoFrame(QWidget *parent = 0); ~MCModInfoFrame(); @@ -36,9 +37,9 @@ public: void setCredits(QString credits); void setWebsite(QString website); - + void updateWithMod(Mod &m); + void clear(); + private: Ui::MCModInfoFrame *ui; }; - -void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame); diff --git a/gui/MCModInfoFrame.ui b/gui/MCModInfoFrame.ui index 73b93a2e..41902c1a 100644 --- a/gui/MCModInfoFrame.ui +++ b/gui/MCModInfoFrame.ui @@ -2,136 +2,81 @@ MCModInfoFrame - - - 0 - 0 - 571 - 55 - - Frame - - QFrame::StyledPanel - - - QFrame::Raised - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - 0 - - - - - 250 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 9 - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-size:9pt; font-weight:600; font-style:italic;">Select a mod to view information...</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - <html><head/><body><p><span style=" font-style:italic;">Mod description</span></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + + 75 + true + + + + Select a mod to view information... + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 92 + + + + Mod description + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + @@ -169,7 +114,7 @@
- <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod authors</span></p></body></html> + Mod authors Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -204,7 +149,7 @@ - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html> + Mod website Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -232,7 +177,7 @@ - <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> + Mod credits Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 9724cec5..e072a238 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -60,6 +60,9 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) ui->loaderModTreeView->setModel(m_mods.get()); ui->loaderModTreeView->installEventFilter(this); m_mods->startWatching(); + auto smodel = ui->loaderModTreeView->selectionModel(); + connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(loaderCurrent(QModelIndex,QModelIndex))); } // resource packs { @@ -298,15 +301,14 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked() openDirInDefaultProgram(m_inst->resourcePacksDir(), true); } -void OneSixModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index) +void OneSixModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous) { - int first, last; - auto list = ui->loaderModTreeView->selectionModel()->selectedRows(); - - if (!lastfirst(list, first, last)) + if(!current.isValid()) + { + ui->frame->clear(); return; - - Mod &m = m_mods->operator[](first); - - handleModInfoUpdate(m, ui->frame); + } + int row = current.row(); + Mod &m = m_mods->operator[](row); + ui->frame->updateWithMod(m); } diff --git a/gui/OneSixModEditDialog.h b/gui/OneSixModEditDialog.h index 03ebf7a3..5376e526 100644 --- a/gui/OneSixModEditDialog.h +++ b/gui/OneSixModEditDialog.h @@ -1,9 +1,9 @@ /* Copyright 2013 MultiMC Contributors - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -19,23 +19,25 @@ #include class EnabledItemFilter; -namespace Ui { - class OneSixModEditDialog; +namespace Ui +{ +class OneSixModEditDialog; } class OneSixModEditDialog : public QDialog { Q_OBJECT - + public: - explicit OneSixModEditDialog(OneSixInstance* inst, QWidget *parent = 0); + explicit OneSixModEditDialog(OneSixInstance *inst, QWidget *parent = 0); virtual ~OneSixModEditDialog(); - -private slots: + +private +slots: void on_addModBtn_clicked(); void on_rmModBtn_clicked(); void on_viewModBtn_clicked(); - + void on_addResPackBtn_clicked(); void on_rmResPackBtn_clicked(); void on_viewResPackBtn_clicked(); @@ -44,20 +46,22 @@ private slots: void on_forgeBtn_clicked(); void on_customizeBtn_clicked(); void on_revertBtn_clicked(); - void updateVersionControls(); + void updateVersionControls(); void disableVersionControls(); - void on_loaderModTreeView_pressed(const QModelIndex &index); - protected: bool eventFilter(QObject *obj, QEvent *ev); - bool loaderListFilter( QKeyEvent* ev ); - bool resourcePackListFilter( QKeyEvent* ev ); + bool loaderListFilter(QKeyEvent *ev); + bool resourcePackListFilter(QKeyEvent *ev); + private: Ui::OneSixModEditDialog *ui; std::shared_ptr m_version; std::shared_ptr m_mods; std::shared_ptr m_resourcepacks; - EnabledItemFilter * main_model; - OneSixInstance * m_inst; + EnabledItemFilter *main_model; + OneSixInstance *m_inst; +public +slots: + void loaderCurrent(QModelIndex current, QModelIndex previous); }; -- cgit v1.2.3 From 14b47057fdbcec7d259ae0a73b201f3f0757b8e2 Mon Sep 17 00:00:00 2001 From: Sky Date: Wed, 9 Oct 2013 02:26:03 +0100 Subject: Clean up mcmod panel massively. Keep it simple - name (optionally linked), optional authors and description. Needs cut-off handling, frame looking at on Windows --- gui/LegacyModEditDialog.ui | 5 +- gui/MCModInfoFrame.cpp | 64 ++++-------- gui/MCModInfoFrame.h | 7 +- gui/MCModInfoFrame.ui | 246 +++++++++++---------------------------------- gui/OneSixModEditDialog.ui | 10 +- 5 files changed, 87 insertions(+), 245 deletions(-) (limited to 'gui') diff --git a/gui/LegacyModEditDialog.ui b/gui/LegacyModEditDialog.ui index 3ab946d9..bb0d9ef2 100644 --- a/gui/LegacyModEditDialog.ui +++ b/gui/LegacyModEditDialog.ui @@ -92,11 +92,8 @@
- - QFrame::StyledPanel - - QFrame::Raised + QFrame::Plain diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 15ead7ab..a0458cbc 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -23,34 +23,27 @@ void MCModInfoFrame::updateWithMod(Mod &m) return; } - QString missing = tr("Missing from mcmod.info"); + QString text = ""; + if(m.homeurl().isEmpty()) text = m.name(); + else text = "" + m.name() + ""; + if(!m.authors().isEmpty()) text += " by " + m.authors(); - QString name = m.name(); - if(name.isEmpty()) name = missing; - QString description = m.description(); - if(description.isEmpty()) description = missing; - QString authors = m.authors(); - if(authors.isEmpty()) authors = missing; - QString credits = m.credits(); - if(credits.isEmpty()) credits = missing; - QString website = m.homeurl(); - if(website.isEmpty()) website = missing; - else website = "" + website + ""; + setModText(text); - setName(name); - setDescription(description); - setAuthors(authors); - setCredits(credits); - setWebsite(website); + if(m.description().isEmpty()) + { + setModDescription(tr("No description provided in mcmod.info")); + } + else + { + setModDescription(m.description()); + } } void MCModInfoFrame::clear() { - setName(tr("Select a mod to view information...")); - setDescription(tr("Mod description")); - setAuthors(tr("Mod authors")); - setCredits(tr("Mod credits")); - setWebsite(tr("Mod website")); + setModText(tr("Select a mod to view title and authors...")); + setModDescription(tr("Select a mod to view description...")); } MCModInfoFrame::MCModInfoFrame(QWidget *parent) : @@ -65,31 +58,12 @@ MCModInfoFrame::~MCModInfoFrame() delete ui; } -void MCModInfoFrame::setName(QString name) -{ - ui->label_Name->setText(name); - //ui->label_Name->setToolTip(name); -} - -void MCModInfoFrame::setDescription(QString description) -{ - ui->label_Description->setText(description); - //ui->label_Description->setToolTip(description); -} - -void MCModInfoFrame::setAuthors(QString authors) -{ - ui->label_Authors->setText(authors); - //ui->label_Authors->setToolTip(authors); -} - -void MCModInfoFrame::setCredits(QString credits) +void MCModInfoFrame::setModText(QString text) { - ui->label_Credits->setText(credits); - //ui->label_Credits->setToolTip(credits); + ui->label_ModText->setText(text); } -void MCModInfoFrame::setWebsite(QString website) +void MCModInfoFrame::setModDescription(QString text) { - ui->label_Website->setText(website); + ui->label_ModDescription->setText(text); } diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index 01812df7..cdf399cb 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -31,11 +31,8 @@ public: explicit MCModInfoFrame(QWidget *parent = 0); ~MCModInfoFrame(); - void setName(QString name); - void setDescription(QString description); - void setAuthors(QString authors); - void setCredits(QString credits); - void setWebsite(QString website); + void setModText(QString text); + void setModDescription(QString text); void updateWithMod(Mod &m); void clear(); diff --git a/gui/MCModInfoFrame.ui b/gui/MCModInfoFrame.ui index 41902c1a..b24251ae 100644 --- a/gui/MCModInfoFrame.ui +++ b/gui/MCModInfoFrame.ui @@ -2,202 +2,76 @@ MCModInfoFrame + + + 0 + 0 + 527 + 68 + + + + + 0 + 0 + + + + + 16777215 + 120 + + Frame - + - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - - 75 - true - - - - Select a mod to view information... - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 16777215 - 92 - - - - Mod description - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - + + + + 0 + 0 + + + + Select a mod to view title and authors... + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + - - - QLayout::SetDefaultConstraint + + + + 0 + 0 + + + + Select a mod to view description... - - QFormLayout::AllNonFixedFieldsGrow + + Qt::PlainText - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - Authors: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - Mod authors - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Website: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - Mod website - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - - - - - - 200 - 0 - - - - - 16777215 - 92 - - - - Mod credits - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Credits: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - + + true + +
diff --git a/gui/OneSixModEditDialog.ui b/gui/OneSixModEditDialog.ui index 675a6faa..6d70200a 100644 --- a/gui/OneSixModEditDialog.ui +++ b/gui/OneSixModEditDialog.ui @@ -222,11 +222,11 @@
- - QFrame::StyledPanel - - - QFrame::Raised + + + 0 + 0 + -- cgit v1.2.3 From 595943244ca929e5c566a78efae9a017ebaed69f Mon Sep 17 00:00:00 2001 From: Sky Date: Wed, 9 Oct 2013 03:10:56 +0100 Subject: Fall back to mod ID if name is missing for some reason --- gui/MCModInfoFrame.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index a0458cbc..51651e33 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -24,8 +24,12 @@ void MCModInfoFrame::updateWithMod(Mod &m) } QString text = ""; - if(m.homeurl().isEmpty()) text = m.name(); - else text = "" + m.name() + ""; + QString name = ""; + if(m.name().isEmpty()) name = m.id(); + else name = m.name(); + + if(m.homeurl().isEmpty()) text = name; + else text = "" + name + ""; if(!m.authors().isEmpty()) text += " by " + m.authors(); setModText(text); -- cgit v1.2.3 From eaf0cbeafc5ff70bd2bb0d66b5f5980a71f824c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 9 Oct 2013 23:16:10 +0200 Subject: Fix MMC-15 ``mod does not delete from jar'' --- gui/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 70d26e02..5784b85a 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -507,10 +507,11 @@ void MainWindow::onLoginComplete() } else { - ProgressDialog *tDialog = new ProgressDialog(this); + ProgressDialog tDialog(this); connect(updateTask, SIGNAL(succeeded()), SLOT(onGameUpdateComplete())); connect(updateTask, SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); - tDialog->exec(updateTask); + tDialog.exec(updateTask); + delete updateTask; } } -- cgit v1.2.3 From 73f8bc5c92cb4a9b7ce507309001c6b206b5c8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 10 Oct 2013 01:47:48 +0200 Subject: Version changing removes any existing version json. --- gui/MCModInfoFrame.ui | 14 +------------- gui/mainwindow.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.ui b/gui/MCModInfoFrame.ui index b24251ae..60e0a65c 100644 --- a/gui/MCModInfoFrame.ui +++ b/gui/MCModInfoFrame.ui @@ -7,7 +7,7 @@ 0 0 527 - 68 + 113 @@ -28,12 +28,6 @@ - - - 0 - 0 - - Select a mod to view title and authors... @@ -53,12 +47,6 @@ - - - 0 - 0 - - Select a mod to view description... diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5784b85a..c726591d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -606,6 +606,15 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() vselect.setFilter(1, "OneSix"); if (vselect.exec() && vselect.selectedVersion()) { + if (m_selectedInstance->versionIsCustom()) + { + auto result = QMessageBox::warning( + 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::Ok, QMessageBox::Abort); + if(result != QMessageBox::Ok) + return; + } m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); } } -- cgit v1.2.3 From bd11749d2ae475a27b5d61a57a282159faaf721b Mon Sep 17 00:00:00 2001 From: Kilobyte22 Date: Thu, 10 Oct 2013 21:19:31 +0200 Subject: HOTFIX: Redid about dialog stuff - working this time. Sorry again --- gui/aboutdialog.ui | 107 +++++++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 48 deletions(-) (limited to 'gui') diff --git a/gui/aboutdialog.ui b/gui/aboutdialog.ui index 7516a5f1..58a2b5ed 100644 --- a/gui/aboutdialog.ui +++ b/gui/aboutdialog.ui @@ -96,7 +96,7 @@ - 0 + 1 @@ -104,7 +104,7 @@ 0 0 432 - 197 + 203 @@ -163,7 +163,7 @@ 0 0 432 - 197 + 203 @@ -179,11 +179,22 @@ <!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:8.25pt; 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'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Sky Welch &lt;</span><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:9pt; 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:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-size:11pt;">&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:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-size:11pt;">&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:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-size:11pt;">&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:11pt;">Sky Welch &lt;</span><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-size:11pt;">&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:11pt;">Kilobyte &lt;</span><a href="mailto:stiepen22@gmx.de"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">stiepen22@gmx.de</span></a><span style=" font-size:11pt;">&gt;</span></p></body></html>
+ + + + + + + No Language file loaded. + + + true @@ -195,7 +206,7 @@ p, li { white-space: pre-wrap; } 0 0 432 - 197 + 203 @@ -217,45 +228,45 @@ p, li { white-space: pre-wrap; } <!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:8.25pt; 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'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; font-size:10pt;">You may obtain a copy of the License at</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:'Ubuntu'; font-size:10pt;"><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;"> http://www.apache.org/licenses/LICENSE-2.0</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:'Ubuntu'; font-size:10pt;"><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;">Unless required by applicable law or agreed to in writing, software</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'; font-size:10pt;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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'; font-size:10pt;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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'; font-size:10pt;">See the License for the specific language governing permissions and</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'; font-size:10pt;">limitations under the 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:'Ubuntu'; font-size:10pt;"><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;">MultiMC uses QSLog, </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'; font-size:10pt;">Copyright (c) 2010, Razvan Petru</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'; font-size:10pt;">All rights reserved.</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:'Ubuntu'; font-size:10pt;"><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;">Redistribution and use in source and binary forms, with or without modification,</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'; font-size:10pt;">are permitted provided that the following conditions are met:</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:'Ubuntu'; font-size:10pt;"><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;">* Redistributions of source code must retain the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer.</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'; font-size:10pt;">* Redistributions in binary form must reproduce the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer in the documentation and/or other</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'; font-size:10pt;"> materials provided with the distribution.</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'; font-size:10pt;">* The name of the contributors may not be used to endorse or promote products</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'; font-size:10pt;"> derived from this software without specific prior written permission.</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:'Ubuntu'; font-size:10pt;"><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;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</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'; font-size:10pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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'; font-size:10pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</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'; font-size:10pt;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</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'; font-size:10pt;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</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'; font-size:10pt;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</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'; font-size:10pt;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</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'; font-size:10pt;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</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'; font-size:10pt;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</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'; font-size:10pt;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:9pt; 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;">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;">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> +<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;"><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-size:10pt;"> http://www.apache.org/licenses/LICENSE-2.0</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;"><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-size:10pt;">Unless required by applicable law or agreed to in writing, software</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;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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;">See the License for the specific language governing permissions and</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;">limitations under the 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-size:10pt;"><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-size:10pt;">MultiMC uses QSLog, </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 (c) 2010, Razvan Petru</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;">All rights reserved.</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;"><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-size:10pt;">Redistribution and use in source and binary forms, with or without modification,</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;">are permitted provided that the following conditions are met:</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;"><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-size:10pt;">* Redistributions of source code must retain the above copyright notice, this</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;"> list of conditions and the following disclaimer.</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;">* Redistributions in binary form must reproduce the above copyright notice, this</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;"> list of conditions and the following disclaimer in the documentation and/or other</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;"> materials provided with the distribution.</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;">* The name of the contributors may not be used to endorse or promote products</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;"> derived from this software without specific prior written permission.</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;"><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-size:10pt;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</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;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</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;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</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;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</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;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</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;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</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;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</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;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</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;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> -- cgit v1.2.3 From 4d320e8fc9997ec54ba53c44bd8607399a2c4476 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Fri, 11 Oct 2013 17:54:58 -0400 Subject: remove dupe newlines from trimmed mod description. whoo --- gui/MCModInfoFrame.cpp | 15 ++++++++++++++- gui/MCModInfoFrame.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 51651e33..22a53819 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -69,5 +69,18 @@ void MCModInfoFrame::setModText(QString text) void MCModInfoFrame::setModDescription(QString text) { - ui->label_ModDescription->setText(text); + QString intermediatetext = text.trimmed(); + bool prev(false); + QChar rem('\n'); + QString finaltext; + finaltext.reserve(intermediatetext.size()); + foreach(const QChar& c, intermediatetext) + { + if(c == rem && prev){ + continue; + } + prev = c == rem; + finaltext += c; + } + ui->label_ModDescription->setText(finaltext); } diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index cdf399cb..bc10ae6a 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -17,6 +17,7 @@ #include #include "logic/Mod.h" +#include namespace Ui { -- cgit v1.2.3 From f99a3072b8ff2119972e90fa30045c21078ebf92 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 08:28:21 -0400 Subject: mod description size limiter done --- gui/MCModInfoFrame.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 22a53819..4659afba 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,6 +15,7 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" +#include void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) @@ -82,5 +83,17 @@ void MCModInfoFrame::setModDescription(QString text) prev = c == rem; finaltext += c; } - ui->label_ModDescription->setText(finaltext); + QString labeltext; + labeltext.reserve(300); + if(finaltext.length() > 297) + { + labeltext.append(finaltext.left(287) + "..."); + ui->label_ModDescription->setToolTip(text); + } + else + { + labeltext.append(finaltext); + } +// std::cout << finaltext.length() << std::endl; + ui->label_ModDescription->setText(labeltext); } -- cgit v1.2.3 From 71948073e9980ae517d38892fbc3fdf6b715a470 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 08:45:24 -0400 Subject: tool tip bugfixes --- gui/MCModInfoFrame.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 4659afba..a45e30ea 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,7 +15,6 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" -#include void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) @@ -70,6 +69,7 @@ void MCModInfoFrame::setModText(QString text) void MCModInfoFrame::setModDescription(QString text) { + ui->label_ModDescription->setToolTip(""); QString intermediatetext = text.trimmed(); bool prev(false); QChar rem('\n'); @@ -88,12 +88,11 @@ void MCModInfoFrame::setModDescription(QString text) if(finaltext.length() > 297) { labeltext.append(finaltext.left(287) + "..."); - ui->label_ModDescription->setToolTip(text); + ui->label_ModDescription->setToolTip(text.replace('\n', "
")); } else { labeltext.append(finaltext); } -// std::cout << finaltext.length() << std::endl; ui->label_ModDescription->setText(labeltext); } -- cgit v1.2.3 From 281826f713d9a373c71cf01fb365c045c1555fe6 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 09:19:49 -0400 Subject: switch from tooltip to messagebox --- gui/MCModInfoFrame.cpp | 15 ++++++++++++--- gui/MCModInfoFrame.h | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index a45e30ea..4a78d329 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,6 +15,8 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" +#include +#include void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) @@ -85,10 +87,11 @@ void MCModInfoFrame::setModDescription(QString text) } QString labeltext; labeltext.reserve(300); - if(finaltext.length() > 297) + if(finaltext.length() > 290) { - labeltext.append(finaltext.left(287) + "..."); - ui->label_ModDescription->setToolTip(text.replace('\n', "
")); + ui->label_ModDescription->setOpenExternalLinks(false); + labeltext.append(finaltext.left(287) + "..."); + QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); } else { @@ -96,3 +99,9 @@ void MCModInfoFrame::setModDescription(QString text) } ui->label_ModDescription->setText(labeltext); } +void MCModInfoFrame::modDescEllipsisHandler(const QString &link) +{ + QMessageBox msgbox; + msgbox.setDetailedText(desc); + msgbox.exec(); +} diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index bc10ae6a..9064fea7 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -17,7 +17,6 @@ #include #include "logic/Mod.h" -#include namespace Ui { @@ -38,6 +37,10 @@ public: void updateWithMod(Mod &m); void clear(); +public slots: + void modDescEllipsisHandler(const QString& link ); + private: Ui::MCModInfoFrame *ui; + QString desc; }; -- cgit v1.2.3 From aef28fd3a54884c82d3eb196b79de95c2583df64 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 09:58:26 -0400 Subject: It works... yeehaa! --- gui/MCModInfoFrame.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 4a78d329..5b65d169 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -42,6 +42,7 @@ void MCModInfoFrame::updateWithMod(Mod &m) } else { + desc = m.description(); setModDescription(m.description()); } } @@ -90,11 +91,13 @@ void MCModInfoFrame::setModDescription(QString text) if(finaltext.length() > 290) { ui->label_ModDescription->setOpenExternalLinks(false); - labeltext.append(finaltext.left(287) + "..."); + ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); + labeltext.append("" + finaltext.left(287) + "..."); QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); } else { + ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText); labeltext.append(finaltext); } ui->label_ModDescription->setText(labeltext); @@ -102,6 +105,6 @@ void MCModInfoFrame::setModDescription(QString text) void MCModInfoFrame::modDescEllipsisHandler(const QString &link) { QMessageBox msgbox; - msgbox.setDetailedText(desc); + msgbox.setText(desc); msgbox.exec(); } -- cgit v1.2.3 From 4c64c3c612149cd392cef8b704fc30682f8127e6 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 09:59:18 -0400 Subject: cleanup --- gui/MCModInfoFrame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 5b65d169..a31502d3 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -41,8 +41,7 @@ void MCModInfoFrame::updateWithMod(Mod &m) setModDescription(tr("No description provided in mcmod.info")); } else - { - desc = m.description(); + { setModDescription(m.description()); } } @@ -92,6 +91,7 @@ void MCModInfoFrame::setModDescription(QString text) { ui->label_ModDescription->setOpenExternalLinks(false); ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); + desc = text; labeltext.append("" + finaltext.left(287) + "..."); QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); } -- cgit v1.2.3 From c7cc32f1d493a0b6349ea089a2a99107fb29f1b7 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 13:59:14 -0400 Subject: Indent fixing! --- gui/MCModInfoFrame.cpp | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index a31502d3..b3f4ca5b 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -41,7 +41,7 @@ void MCModInfoFrame::updateWithMod(Mod &m) setModDescription(tr("No description provided in mcmod.info")); } else - { + { setModDescription(m.description()); } } @@ -71,40 +71,40 @@ void MCModInfoFrame::setModText(QString text) void MCModInfoFrame::setModDescription(QString text) { - ui->label_ModDescription->setToolTip(""); - QString intermediatetext = text.trimmed(); - bool prev(false); - QChar rem('\n'); - QString finaltext; - finaltext.reserve(intermediatetext.size()); - foreach(const QChar& c, intermediatetext) - { - if(c == rem && prev){ - continue; - } - prev = c == rem; - finaltext += c; - } - QString labeltext; - labeltext.reserve(300); - if(finaltext.length() > 290) - { - ui->label_ModDescription->setOpenExternalLinks(false); - ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); - desc = text; - labeltext.append("" + finaltext.left(287) + "..."); - QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); - } - else - { - ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText); - labeltext.append(finaltext); - } - ui->label_ModDescription->setText(labeltext); + ui->label_ModDescription->setToolTip(""); + QString intermediatetext = text.trimmed(); + bool prev(false); + QChar rem('\n'); + QString finaltext; + finaltext.reserve(intermediatetext.size()); + foreach(const QChar& c, intermediatetext) + { + if(c == rem && prev){ + continue; + } + prev = c == rem; + finaltext += c; + } + QString labeltext; + labeltext.reserve(300); + if(finaltext.length() > 290) + { + ui->label_ModDescription->setOpenExternalLinks(false); + ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); + desc = text; + labeltext.append("" + finaltext.left(287) + "..."); + QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); + } + else + { + ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText); + labeltext.append(finaltext); + } + ui->label_ModDescription->setText(labeltext); } void MCModInfoFrame::modDescEllipsisHandler(const QString &link) { - QMessageBox msgbox; - msgbox.setText(desc); - msgbox.exec(); + QMessageBox msgbox; + msgbox.setText(desc); + msgbox.exec(); } -- cgit v1.2.3 From 52031a681429d475ed323c1756cc2ec546ced5f1 Mon Sep 17 00:00:00 2001 From: robotbrain Date: Sat, 12 Oct 2013 15:44:34 -0400 Subject: Update MCModInfoFrame.h fix moar indents :) --- gui/MCModInfoFrame.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index 9064fea7..54c5d674 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -38,9 +38,9 @@ public: void clear(); public slots: - void modDescEllipsisHandler(const QString& link ); + void modDescEllipsisHandler(const QString& link ); private: Ui::MCModInfoFrame *ui; - QString desc; + QString desc; }; -- cgit v1.2.3 From a21338866d92b310a4c07a8434dc1175d1e5cd9d Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 13 Oct 2013 15:59:15 +0100 Subject: Fix tab ordering in settings dialog --- gui/settingsdialog.ui | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'gui') diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index 8fa5e96e..0b7985f1 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -497,6 +497,35 @@ + + settingsTabs + buttonBox + sortLastLaunchedBtn + sortByNameBtn + devBuildsCheckBox + autoUpdateCheckBox + instDirTextBox + modsDirTextBox + lwjglDirTextBox + instDirBrowseBtn + modsDirBrowseBtn + lwjglDirBrowseBtn + maximizedCheckBox + windowWidthSpinBox + windowHeightSpinBox + showConsoleCheck + autoCloseConsoleCheck + autoLoginCheckBox + minMemSpinBox + maxMemSpinBox + permGenSpinBox + javaPathTextBox + pushButton + btnBrowse + jvmArgsTextBox + preLaunchCmdTextBox + postExitCmdTextBox + -- cgit v1.2.3 From 0ae8073d41de014beb8fd386cfb4713ad86c4766 Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 13 Oct 2013 16:01:12 +0100 Subject: Fix instance settings tab order --- gui/instancesettings.ui | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/instancesettings.ui b/gui/instancesettings.ui index 49309f11..413c09b2 100644 --- a/gui/instancesettings.ui +++ b/gui/instancesettings.ui @@ -20,7 +20,7 @@ QTabWidget::Rounded - 0 + 1 @@ -395,6 +395,7 @@ settingsTabs + buttonBox windowSizeGroupBox maximizedCheckBox windowWidthSpinBox @@ -407,6 +408,7 @@ memoryGroupBox minMemSpinBox maxMemSpinBox + permGenSpinBox javaSettingsGroupBox javaPathTextBox pushButton @@ -414,7 +416,6 @@ customCommandsGroupBox preLaunchCmdTextBox postExitCmdTextBox - buttonBox -- cgit v1.2.3 From 40a2456646df96e0dd8731ab78cba920a734a8e3 Mon Sep 17 00:00:00 2001 From: Sky Date: Mon, 14 Oct 2013 02:59:21 +0100 Subject: Huge Java detection refactor, version dialogs on first run (no JavaPath set) and "auto detect" button --- gui/mainwindow.cpp | 30 ++++++++++++++++++++++++++++++ gui/mainwindow.h | 3 ++- gui/settingsdialog.cpp | 15 ++++++++++++--- gui/settingsdialog.ui | 2 +- gui/versionselectdialog.cpp | 16 ++++++++++++++-- gui/versionselectdialog.h | 5 ++++- 6 files changed, 63 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c726591d..06329140 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -53,6 +53,7 @@ #include "logic/lists/MinecraftVersionList.h" #include "logic/lists/LwjglVersionList.h" #include "logic/lists/IconList.h" +#include "logic/lists/JavaVersionList.h" #include "logic/net/LoginTask.h" #include "logic/BaseInstance.h" @@ -60,6 +61,7 @@ #include "logic/MinecraftProcess.h" #include "logic/OneSixAssets.h" #include "logic/OneSixUpdate.h" +#include "logic/JavaUtils.h" #include "logic/LegacyInstance.h" @@ -701,3 +703,31 @@ void MainWindow::instanceEnded() this->show(); ui->actionLaunchInstance->setEnabled(m_selectedInstance); } + +void MainWindow::checkSetDefaultJava() +{ + QString currentJavaPath = MMC->settings()->get("JavaPath").toString(); + if(currentJavaPath.isEmpty()) + { + QLOG_DEBUG() << "Java path not set, showing Java selection dialog..."; + + JavaVersionPtr java; + + VersionSelectDialog vselect(MMC->javalist().get(), tr("First run: select a Java version"), this, false); + vselect.setResizeOn(2); + vselect.exec(); + + if (!vselect.selectedVersion()) + { + QMessageBox::warning( + this, tr("Invalid version selected"), tr("You didn't select a valid Java version, so MultiMC will select the default. " + "You can change this in the settings dialog.")); + + JavaUtils ju; + java = ju.GetDefaultJava(); + } + + java = std::dynamic_pointer_cast(vselect.selectedVersion()); + MMC->settings()->set("JavaPath", java->path); + } +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 86f21113..dbf7c4c3 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -49,6 +49,8 @@ public: // Browser Dialog void openWebPage(QUrl url); + void checkSetDefaultJava(); + private slots: void onCatToggled(bool); @@ -128,7 +130,6 @@ protected: void setCatBackground(bool enabled); private: - Ui::MainWindow *ui; KCategoryDrawer *drawer; KCategorizedView *view; diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index 011925b7..a3347680 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -17,6 +17,8 @@ #include "settingsdialog.h" #include "ui_settingsdialog.h" #include "logic/JavaUtils.h" +#include "gui/versionselectdialog.h" +#include "logic/lists/JavaVersionList.h" #include #include @@ -184,10 +186,17 @@ void SettingsDialog::loadSettings(SettingsObject *s) void SettingsDialog::on_pushButton_clicked() { - JavaUtils jut; - auto javas = jut.FindJavaPaths(); + JavaVersionPtr java; - ui->javaPathTextBox->setText(std::get(javas.at(0))); + VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true); + vselect.setResizeOn(2); + vselect.exec(); + + if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) + { + java = std::dynamic_pointer_cast(vselect.selectedVersion()); + ui->javaPathTextBox->setText(java->path); + } } void SettingsDialog::on_btnBrowse_clicked() diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index 0b7985f1..f8e78b4d 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -423,7 +423,7 @@ - Auto-detect + Auto-detect... diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index d975a7b4..900cd092 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -26,7 +26,7 @@ #include #include -VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent) +VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, bool cancelable) : QDialog(parent), ui(new Ui::VersionSelectDialog) { ui->setupUi(this); @@ -40,7 +40,12 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, ui->listView->setModel(m_proxyModel); ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); + + if(!cancelable) + { + ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); + } } VersionSelectDialog::~VersionSelectDialog() @@ -48,6 +53,13 @@ VersionSelectDialog::~VersionSelectDialog() delete ui; } +void VersionSelectDialog::setResizeOn(int column) +{ + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::ResizeToContents); + resizeOnColumn = column; + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); +} + int VersionSelectDialog::exec() { QDialog::open(); diff --git a/gui/versionselectdialog.h b/gui/versionselectdialog.h index 4be048af..319caeca 100644 --- a/gui/versionselectdialog.h +++ b/gui/versionselectdialog.h @@ -33,7 +33,7 @@ class VersionSelectDialog : public QDialog Q_OBJECT public: - explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0); + explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0, bool cancelable = true); ~VersionSelectDialog(); virtual int exec(); @@ -44,6 +44,7 @@ public: BaseVersionPtr selectedVersion() const; void setFilter(int column, QString filter); + void setResizeOn(int column); private slots: void on_refreshButton_clicked(); @@ -53,6 +54,8 @@ private: BaseVersionList *m_vlist; QSortFilterProxyModel *m_proxyModel; + + int resizeOnColumn = 0; }; #endif // VERSIONSELECTDIALOG_H -- cgit v1.2.3 From deffe7db436c39ebaea9f32759fb7c4344420b04 Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 15 Oct 2013 00:19:22 +0100 Subject: Change "News" URL to new website --- gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 06329140..ae244d91 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -360,7 +360,7 @@ void MainWindow::on_actionReportBug_triggered() void MainWindow::on_actionNews_triggered() { - openWebPage(QUrl("http://forkk.net/tag/multimc.html")); + openWebPage(QUrl("http://multimc.org/posts.html")); } void MainWindow::on_actionAbout_triggered() -- cgit v1.2.3 From f5733f201bb3c088c8990fbac63cded2a5761586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 15 Oct 2013 20:11:05 +0200 Subject: Make permgen limit ridiculously high. --- gui/instancesettings.ui | 6 +++--- gui/settingsdialog.ui | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'gui') diff --git a/gui/instancesettings.ui b/gui/instancesettings.ui index 413c09b2..b536e9ff 100644 --- a/gui/instancesettings.ui +++ b/gui/instancesettings.ui @@ -6,7 +6,7 @@ 0 0 - 477 + 526 590 @@ -20,7 +20,7 @@ QTabWidget::Rounded - 1 + 0 @@ -249,7 +249,7 @@ 64 - 512 + 999999999 8 diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index f8e78b4d..bf173b1b 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 453 - 550 + 502 + 599 @@ -33,7 +33,7 @@ QTabWidget::Rounded - 2 + 0 @@ -353,7 +353,7 @@ 64 - 512 + 999999999 8 -- cgit v1.2.3 From b5ae2e974d7044545d4f41c067e1b228806d54b7 Mon Sep 17 00:00:00 2001 From: Sky Date: Wed, 16 Oct 2013 02:46:57 +0100 Subject: Trim console output (fixes excessive whitespace in Windows console output) --- gui/consolewindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gui') diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 628c5f00..5cd332c4 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -36,6 +36,11 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode) if (data.endsWith('\n')) data = data.left(data.length()-1); QStringList paragraphs = data.split('\n'); + for(QString ¶graph : paragraphs) + { + paragraph = paragraph.trimmed(); + } + QListIterator iter(paragraphs); if (mode == MessageLevel::MultiMC) while(iter.hasNext()) -- cgit v1.2.3 From 78882ff6b13ea8c5e7c14bee51c87f199e9c8a20 Mon Sep 17 00:00:00 2001 From: Orochimarufan Date: Fri, 18 Oct 2013 18:42:41 +0200 Subject: Fix MainWindow Icon; Fix WM_CLASS issue; now links QX11Extras and libxcb on linux --- gui/EditNotesDialog.cpp | 2 ++ gui/IconPickerDialog.cpp | 2 ++ gui/LegacyModEditDialog.cpp | 2 ++ gui/OneSixModEditDialog.cpp | 4 ++- gui/ProgressDialog.cpp | 2 ++ gui/aboutdialog.cpp | 2 ++ gui/consolewindow.cpp | 3 +++ gui/instancesettings.cpp | 2 ++ gui/logindialog.cpp | 4 ++- gui/lwjglselectdialog.cpp | 2 ++ gui/mainwindow.cpp | 2 ++ gui/mainwindow.ui | 4 +++ gui/newinstancedialog.cpp | 2 ++ gui/platform.h | 35 +++++++++++++++++++++++++ gui/platform_other.cpp | 27 ++++++++++++++++++++ gui/platform_x11.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++ gui/settingsdialog.cpp | 2 ++ gui/versionselectdialog.cpp | 2 ++ 18 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 gui/platform.h create mode 100644 gui/platform_other.cpp create mode 100644 gui/platform_x11.cpp (limited to 'gui') diff --git a/gui/EditNotesDialog.cpp b/gui/EditNotesDialog.cpp index 5b90ef53..535ca804 100644 --- a/gui/EditNotesDialog.cpp +++ b/gui/EditNotesDialog.cpp @@ -1,5 +1,6 @@ #include "EditNotesDialog.h" #include "ui_EditNotesDialog.h" +#include "gui/platform.h" #include #include @@ -10,6 +11,7 @@ EditNotesDialog::EditNotesDialog( QString notes, QString name, QWidget* parent ) QDialog(parent), ui(new Ui::EditNotesDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->noteEditor->setText(notes); setWindowTitle(tr("Edit notes of %1").arg(m_instance_name)); diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index 6a1ca546..ebacf87c 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -3,6 +3,7 @@ #include "instancedelegate.h" #include "ui_IconPickerDialog.h" #include "logic/lists/IconList.h" +#include "gui/platform.h" #include #include #include @@ -11,6 +12,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IconPickerDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 82532cfd..b230193a 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -21,6 +21,7 @@ #include "ui_LegacyModEditDialog.h" #include "logic/ModList.h" #include "logic/lists/ForgeVersionList.h" +#include "gui/platform.h" #include #include @@ -32,6 +33,7 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) : m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); // Jar mods diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index e072a238..88738938 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -20,8 +20,9 @@ #include "logic/OneSixVersion.h" #include "logic/EnabledItemFilter.h" #include "logic/lists/ForgeVersionList.h" -#include +#include "logic/ForgeInstaller.h" #include "gui/versionselectdialog.h" +#include "gui/platform.h" #include "ProgressDialog.h" #include @@ -35,6 +36,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) : m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); // libraries! diff --git a/gui/ProgressDialog.cpp b/gui/ProgressDialog.cpp index 154ab1c0..2e5251a0 100644 --- a/gui/ProgressDialog.cpp +++ b/gui/ProgressDialog.cpp @@ -19,11 +19,13 @@ #include #include "logic/tasks/Task.h" +#include "gui/platform.h" ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); updateSize(); diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 9792d4fe..7105446c 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -2,11 +2,13 @@ #include "ui_aboutdialog.h" #include #include +#include "gui/platform.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64)); diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 5cd332c4..deeedd65 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -4,12 +4,15 @@ #include #include +#include + ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : QDialog(parent), ui(new Ui::ConsoleWindow), m_mayclose(true), proc(mcproc) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded())); } diff --git a/gui/instancesettings.cpp b/gui/instancesettings.cpp index dfb04f3d..73eb6627 100644 --- a/gui/instancesettings.cpp +++ b/gui/instancesettings.cpp @@ -19,12 +19,14 @@ #include "instancesettings.h" #include "ui_instancesettings.h" +#include "gui/platform.h" InstanceSettings::InstanceSettings( SettingsObject * obj, QWidget *parent) : m_obj(obj), QDialog(parent), ui(new Ui::InstanceSettings) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); loadSettings(); } diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index fdc94ac7..ed3983b7 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -16,12 +16,14 @@ #include "logindialog.h" #include "ui_logindialog.h" #include "keyring.h" +#include "gui/platform.h" #include LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : QDialog(parent), ui(new Ui::LoginDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); //: Use offline mode one time @@ -194,4 +196,4 @@ void LoginDialog::forceOnline() { onlineForced = true; offlineButton->setEnabled(false); -} \ No newline at end of file +} diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index 4518e8cd..09963ce0 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -16,6 +16,7 @@ #include "MultiMC.h" #include "lwjglselectdialog.h" #include "ui_lwjglselectdialog.h" +#include "gui/platform.h" #include "logic/lists/LwjglVersionList.h" @@ -23,6 +24,7 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LWJGLSelectDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->labelStatus->setVisible(false); auto lwjgllist = MMC->lwjgllist(); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index ae244d91..294ffd3d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -48,6 +48,7 @@ #include "gui/lwjglselectdialog.h" #include "gui/consolewindow.h" #include "gui/instancesettings.h" +#include "gui/platform.h" #include "logic/lists/InstanceList.h" #include "logic/lists/MinecraftVersionList.h" @@ -72,6 +73,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 4c288d5f..0f883d13 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -13,6 +13,10 @@ MultiMC 5 + + + :/icons/multimc/scalable/apps/multimc.svg:/icons/multimc/scalable/apps/multimc.svg + diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index 04b38316..c37db2ac 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -23,6 +23,7 @@ #include "logic/lists/MinecraftVersionList.h" #include "logic/tasks/Task.h" +#include "gui/platform.h" #include "versionselectdialog.h" #include "ProgressDialog.h" #include "IconPickerDialog.h" @@ -33,6 +34,7 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) : QDialog(parent), ui(new Ui::NewInstanceDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/gui/platform.h b/gui/platform.h new file mode 100644 index 00000000..5cf9ed80 --- /dev/null +++ b/gui/platform.h @@ -0,0 +1,35 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLATFORM_H +#define PLATFORM_H + +/** + * @file platform.h + * This file contains platform-specific functions, tweaks and fixes. + */ + +#include + +class MultiMCPlatform +{ +public: + // X11 WM_CLASS + static void fixWM_CLASS(QWidget *widget); +}; + +#endif // PLATFORM_H diff --git a/gui/platform_other.cpp b/gui/platform_other.cpp new file mode 100644 index 00000000..0d7bcbe7 --- /dev/null +++ b/gui/platform_other.cpp @@ -0,0 +1,27 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +/** + * Stub for non-X11 platforms + * @brief MultiMCPlatform::fixWM_CLASS + * @param widget + */ +MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + Q_UNUSED(widget); +} diff --git a/gui/platform_x11.cpp b/gui/platform_x11.cpp new file mode 100644 index 00000000..0401e8bf --- /dev/null +++ b/gui/platform_x11.cpp @@ -0,0 +1,62 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +static QByteArray WM_CLASS = "MultiMC5\0MultiMC5"; + +template +static inline unsigned int XcbCallVoid(xcb_void_cookie_t (*func)(xcb_connection_t *, ArgTypes...), ArgTypes2... args...) +{ + return func(QX11Info::connection(), args...).sequence; +} + +static void getAtoms(size_t n, xcb_atom_t *atoms, const char *const names[], bool create) +{ + xcb_connection_t *conn = QX11Info::connection(); + xcb_intern_atom_cookie_t *cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t) * 2); + for (size_t i = 0; i < n; ++i) + cookies[i] = xcb_intern_atom(conn, create, strlen(names[i]), names[i]); + memset(atoms, 0, sizeof(xcb_atom_t) * n); + for (size_t i = 0; i < n; ++i) + { + xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(conn, cookies[i], 0); + if (r) + { + atoms[i] = r->atom; + free(r); + } + } + free(cookies); +} + +static inline xcb_atom_t getAtom(const char *name, bool create=false) +{ + xcb_atom_t atom; + getAtoms(1, &atom, &name, create); + return atom; +} + +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + static const xcb_atom_t atom = getAtom("WM_CLASS"); + XcbCallVoid(xcb_change_property, XCB_PROP_MODE_REPLACE, + widget->winId(), atom, XCB_ATOM_STRING, 8, WM_CLASS.count(), + WM_CLASS.constData()); +} diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index a3347680..14eba492 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -18,6 +18,7 @@ #include "ui_settingsdialog.h" #include "logic/JavaUtils.h" #include "gui/versionselectdialog.h" +#include "gui/platform.h" #include "logic/lists/JavaVersionList.h" #include @@ -28,6 +29,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); loadSettings(MMC->settings().get()); diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index 900cd092..8fa62f75 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -21,6 +21,7 @@ #include #include +#include "gui/platform.h" #include #include @@ -29,6 +30,7 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, bool cancelable) : QDialog(parent), ui(new Ui::VersionSelectDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); setWindowTitle(title); -- cgit v1.2.3 From dcf58cdf12ae9370ba1bf9d6bb789649db82e520 Mon Sep 17 00:00:00 2001 From: Orochimarufan Date: Fri, 18 Oct 2013 19:01:40 +0200 Subject: Derp - typo in platform_other.cpp --- gui/platform_other.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/platform_other.cpp b/gui/platform_other.cpp index 0d7bcbe7..a41abe36 100644 --- a/gui/platform_other.cpp +++ b/gui/platform_other.cpp @@ -21,7 +21,7 @@ * @brief MultiMCPlatform::fixWM_CLASS * @param widget */ -MultiMCPlatform::fixWM_CLASS(QWidget *widget) +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) { Q_UNUSED(widget); } -- cgit v1.2.3 From 709252fe9ecec3cc388966d695844f2593029c4f Mon Sep 17 00:00:00 2001 From: Sky Date: Fri, 18 Oct 2013 18:10:19 +0100 Subject: Use player username if offline, or "Player" if blank --- gui/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index ae244d91..d99210a9 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -487,8 +487,8 @@ void MainWindow::doLogin(const QString &errorMsg) { QString user = loginDlg->getUsername(); if (user.length() == 0) - user = QString("Offline"); - m_activeLogin = {user, QString("Offline"), QString("Player"), QString()}; + user = QString("Player"); + m_activeLogin = {user, QString("Offline"), user, QString()}; m_activeInst = m_selectedInstance; launchInstance(m_activeInst, m_activeLogin); } -- cgit v1.2.3 From be2c7f451541647899478d0197d3e9500d63c833 Mon Sep 17 00:00:00 2001 From: Orochimarufan Date: Fri, 18 Oct 2013 19:57:38 +0200 Subject: Change Organization and App name, might invalidate some configs? Add Tak to credits screen --- gui/aboutdialog.ui | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 51 deletions(-) (limited to 'gui') diff --git a/gui/aboutdialog.ui b/gui/aboutdialog.ui index 58a2b5ed..66b40036 100644 --- a/gui/aboutdialog.ui +++ b/gui/aboutdialog.ui @@ -95,16 +95,13 @@ - - 1 - 0 0 432 - 203 + 191 @@ -163,7 +160,7 @@ 0 0 432 - 203 + 191 @@ -179,12 +176,13 @@ <!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:'Ubuntu'; font-size:9pt; 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:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-size:11pt;">&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:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-size:11pt;">&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:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-size:11pt;">&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:11pt;">Sky Welch &lt;</span><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-size:11pt;">&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:11pt;">Kilobyte &lt;</span><a href="mailto:stiepen22@gmx.de"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">stiepen22@gmx.de</span></a><span style=" font-size:11pt;">&gt;</span></p></body></html> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; 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'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">TakSuyu &lt;</span><a href="mailto:taksuyu@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">taksuyu@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Sky Welch &lt;</span><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">multimc@bunnies.cc</span><span style=" font-family:'Ubuntu'; font-size:11pt;">&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'; font-size:11pt;">Kilobyte &lt;</span><a href="mailto:stiepen22@gmx.de"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">stiepen22@gmx.de</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html> @@ -206,7 +204,7 @@ p, li { white-space: pre-wrap; } 0 0 432 - 203 + 191 @@ -228,45 +226,45 @@ p, li { white-space: pre-wrap; } <!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:'Ubuntu'; font-size:9pt; 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;">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;">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> -<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;"><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-size:10pt;"> http://www.apache.org/licenses/LICENSE-2.0</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;"><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-size:10pt;">Unless required by applicable law or agreed to in writing, software</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;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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;">See the License for the specific language governing permissions and</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;">limitations under the 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-size:10pt;"><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-size:10pt;">MultiMC uses QSLog, </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 (c) 2010, Razvan Petru</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;">All rights reserved.</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;"><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-size:10pt;">Redistribution and use in source and binary forms, with or without modification,</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;">are permitted provided that the following conditions are met:</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;"><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-size:10pt;">* Redistributions of source code must retain the above copyright notice, this</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;"> list of conditions and the following disclaimer.</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;">* Redistributions in binary form must reproduce the above copyright notice, this</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;"> list of conditions and the following disclaimer in the documentation and/or other</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;"> materials provided with the distribution.</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;">* The name of the contributors may not be used to endorse or promote products</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;"> derived from this software without specific prior written permission.</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;"><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-size:10pt;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</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;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</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;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</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;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</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;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</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;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</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;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</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;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</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;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; 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'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; 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-family:'Ubuntu'; font-size:10pt;">You may obtain a copy of the License at</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:'Ubuntu'; font-size:10pt;"><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;"> http://www.apache.org/licenses/LICENSE-2.0</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:'Ubuntu'; font-size:10pt;"><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;">Unless required by applicable law or agreed to in writing, software</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'; font-size:10pt;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</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'; font-size:10pt;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</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'; font-size:10pt;">See the License for the specific language governing permissions and</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'; font-size:10pt;">limitations under the 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:'Ubuntu'; font-size:10pt;"><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;">MultiMC uses QSLog, </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'; font-size:10pt;">Copyright (c) 2010, Razvan Petru</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'; font-size:10pt;">All rights reserved.</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:'Ubuntu'; font-size:10pt;"><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;">Redistribution and use in source and binary forms, with or without modification,</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'; font-size:10pt;">are permitted provided that the following conditions are met:</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:'Ubuntu'; font-size:10pt;"><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;">* Redistributions of source code must retain the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer.</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'; font-size:10pt;">* Redistributions in binary form must reproduce the above copyright notice, this</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'; font-size:10pt;"> list of conditions and the following disclaimer in the documentation and/or other</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'; font-size:10pt;"> materials provided with the distribution.</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'; font-size:10pt;">* The name of the contributors may not be used to endorse or promote products</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'; font-size:10pt;"> derived from this software without specific prior written permission.</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:'Ubuntu'; font-size:10pt;"><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;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</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'; font-size:10pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</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'; font-size:10pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</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'; font-size:10pt;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</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'; font-size:10pt;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</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'; font-size:10pt;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</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'; font-size:10pt;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</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'; font-size:10pt;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</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'; font-size:10pt;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</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'; font-size:10pt;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html> -- cgit v1.2.3 From 681d36b23251993a8678db8e72859d4018396b63 Mon Sep 17 00:00:00 2001 From: Sky Date: Sat, 19 Oct 2013 06:40:46 +0100 Subject: First draft of player faces in the login dialog --- gui/logindialog.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ gui/logindialog.ui | 43 ++++++++++++++++++++++++++++++++++++++----- gui/mainwindow.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index ed3983b7..332b5d38 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -17,6 +17,13 @@ #include "ui_logindialog.h" #include "keyring.h" #include "gui/platform.h" +#include "MultiMC.h" + +#include +#include +#include +#include +#include "logic/net/HttpMetaCache.h" #include LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : @@ -51,6 +58,8 @@ LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : arg(loginErrMsg)); } + ui->lblFace->setVisible(false); + resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); Keyring * k = Keyring::instance(); @@ -151,13 +160,54 @@ void LoginDialog::userTextChanged ( const QString& user ) blockToggles = true; Keyring * k = Keyring::instance(); QStringList sl = k->getStoredAccounts("minecraft"); + bool gotFace = false; + if(sl.contains(user)) { ui->rememberUsernameCheckbox->setChecked(true); QString passwd = k->getPassword("minecraft",user); ui->rememberPasswordCheckbox->setChecked(!passwd.isEmpty()); ui->passwordTextBox->setText(passwd); + + QByteArray data; + { + auto filename = MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath(); + QFile listFile(filename); + if(!listFile.open(QIODevice::ReadOnly)) + return; + data = listFile.readAll(); + } + + QJsonParseError jsonError; + QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); + QJsonObject root = jsonDoc.object(); + QJsonObject mappings = root.value("mappings").toObject(); + + if(!mappings[user].isUndefined()) + { + QJsonArray usernames = mappings.value(user).toArray(); + if(!usernames.isEmpty()) + { + QString mapped_username = usernames[0].toString(); + + if(!mapped_username.isEmpty()) + { + QFile fskin(MMC->metacache()->resolveEntry("skins", mapped_username + ".png")->getFullPath()); + if(fskin.exists()) + { + QPixmap skin(MMC->metacache()->resolveEntry("skins", mapped_username + ".png")->getFullPath()); + QPixmap face = skin.copy(8, 8, 8, 8).scaled(48, 48, Qt::KeepAspectRatio); + + ui->lblFace->setPixmap(face); + gotFace = true; + } + } + } + } } + + if(gotFace) ui->lblFace->setVisible(true); + else ui->lblFace->setVisible(false); blockToggles = false; } diff --git a/gui/logindialog.ui b/gui/logindialog.ui index 0aaad52b..46965425 100644 --- a/gui/logindialog.ui +++ b/gui/logindialog.ui @@ -23,10 +23,34 @@ - - + + + + + 48 + 48 + + + + + 48 + 48 + + + + + 1 + 1 + + - Username: + + + + :/icons/instances/steve + + + true @@ -37,6 +61,13 @@ + + + + Username: + + + @@ -54,7 +85,7 @@ - + @@ -111,7 +142,9 @@ - + + + loginButtonBox diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 0bd6f651..b68af5fa 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -57,6 +57,8 @@ #include "logic/lists/JavaVersionList.h" #include "logic/net/LoginTask.h" +#include "logic/net/SkinDownload.h" + #include "logic/BaseInstance.h" #include "logic/InstanceFactory.h" #include "logic/MinecraftProcess.h" @@ -517,6 +519,42 @@ void MainWindow::onLoginComplete() tDialog.exec(updateTask); delete updateTask; } + + auto download = new SkinDownload(m_activeLogin.player_name); + download->start(); + + auto filename = MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath(); + QFile listFile(filename); + + // Add skin mapping + QByteArray data; + { + if(!listFile.open(QIODevice::ReadWrite)) + { + QLOG_ERROR() << "Failed to open/make skins list JSON"; + return; + } + + data = listFile.readAll(); + } + + QJsonParseError jsonError; + QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); + QJsonObject root = jsonDoc.object(); + QJsonObject mappings = root.value("mappings").toObject(); + QJsonArray usernames = mappings.value(m_activeLogin.username).toArray(); + + if(!usernames.contains(m_activeLogin.player_name)) + { + usernames.prepend(m_activeLogin.player_name); + mappings[m_activeLogin.username] = usernames; + root["mappings"] = mappings; + jsonDoc.setObject(root); + + // QJson hack - shouldn't have to clear the file every time a save happens + listFile.resize(0); + listFile.write(jsonDoc.toJson()); + } } void MainWindow::onGameUpdateComplete() -- cgit v1.2.3 From aca7764afc82f39bef32f41c5c53eb70e8f54ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 20 Oct 2013 22:28:31 +0200 Subject: Ask for java path when hostname changes from the last run. --- gui/mainwindow.cpp | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'gui') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 0bd6f651..2efcda44 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -73,7 +73,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { - MultiMCPlatform::fixWM_CLASS(this); + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); @@ -615,8 +615,9 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() auto result = QMessageBox::warning( 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::Ok, QMessageBox::Abort); - if(result != QMessageBox::Ok) + "This includes things like Forge install and similar."), + QMessageBox::Ok, QMessageBox::Abort); + if (result != QMessageBox::Ok) return; } m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); @@ -708,22 +709,42 @@ void MainWindow::instanceEnded() void MainWindow::checkSetDefaultJava() { - QString currentJavaPath = MMC->settings()->get("JavaPath").toString(); - if(currentJavaPath.isEmpty()) + bool askForJava = false; { - QLOG_DEBUG() << "Java path not set, showing Java selection dialog..."; + QString currentHostName = QHostInfo::localHostName(); + QString oldHostName = MMC->settings()->get("LastHostname").toString(); + if (currentHostName != oldHostName) + { + MMC->settings()->set("LastHostname", currentHostName); + askForJava = true; + } + } + + { + QString currentJavaPath = MMC->settings()->get("JavaPath").toString(); + if (currentJavaPath.isEmpty()) + { + askForJava = true; + } + } + + if (askForJava) + { + QLOG_DEBUG() << "Java path needs resetting, showing Java selection dialog..."; JavaVersionPtr java; - VersionSelectDialog vselect(MMC->javalist().get(), tr("First run: select a Java version"), this, false); + VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, + false); vselect.setResizeOn(2); vselect.exec(); if (!vselect.selectedVersion()) { - QMessageBox::warning( - this, tr("Invalid version selected"), tr("You didn't select a valid Java version, so MultiMC will select the default. " - "You can change this in the settings dialog.")); + QMessageBox::warning(this, tr("Invalid version selected"), + tr("You didn't select a valid Java version, so MultiMC will " + "select the default. " + "You can change this in the settings dialog.")); JavaUtils ju; java = ju.GetDefaultJava(); -- cgit v1.2.3 From ce512e1cf228584336353acbcacbdc30e21f5c4a Mon Sep 17 00:00:00 2001 From: Sky Date: Mon, 21 Oct 2013 17:50:45 +0100 Subject: Clean up skins, remove wrapper, save to accounts/skins --- gui/logindialog.cpp | 3 +-- gui/mainwindow.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index 332b5d38..aeaaaa9e 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -206,8 +206,7 @@ void LoginDialog::userTextChanged ( const QString& user ) } } - if(gotFace) ui->lblFace->setVisible(true); - else ui->lblFace->setVisible(false); + ui->lblFace->setVisible(gotFace); blockToggles = false; } diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b68af5fa..f5503754 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -57,7 +57,6 @@ #include "logic/lists/JavaVersionList.h" #include "logic/net/LoginTask.h" -#include "logic/net/SkinDownload.h" #include "logic/BaseInstance.h" #include "logic/InstanceFactory.h" @@ -520,9 +519,13 @@ void MainWindow::onLoginComplete() delete updateTask; } - auto download = new SkinDownload(m_activeLogin.player_name); - download->start(); + auto job = new DownloadJob("Player skin: " + m_activeLogin.player_name); + auto meta = MMC->metacache()->resolveEntry("skins", m_activeLogin.player_name + ".png"); + job->addCacheDownload(QUrl("http://skins.minecraft.net/MinecraftSkins/" + m_activeLogin.player_name + ".png"), meta); + meta->stale = true; + + job->start(); auto filename = MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath(); QFile listFile(filename); -- cgit v1.2.3