From 60e7e019fe62f48ebdb5cea0ab83ab58f3379fdf Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 17:07:54 +0100 Subject: [PATCH 1/4] 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 +++++++++++++++++++++++++++++++----- logic/Mod.cpp | 12 ++ logic/Mod.h | 18 ++ 5 files changed, 377 insertions(+), 53 deletions(-) diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index 788a61d0c..d97967e8f 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 ce4da4fe4..03ebf7a3b 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 b97d4304b..88ba5a766 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 - - + + + + + + 0 + 0 + + + + true + + + QAbstractItemView::DropOnly + + + + - - - &Remove - - - - - - - Website - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - &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 + + + + + + + + diff --git a/logic/Mod.cpp b/logic/Mod.cpp index 825e663f0..c45e3ad2f 100644 --- a/logic/Mod.cpp +++ b/logic/Mod.cpp @@ -119,6 +119,18 @@ void Mod::ReadMCModInfo(QByteArray contents) m_name = firstObj.value("name").toString(); m_version = firstObj.value("version").toString(); m_homeurl = firstObj.value("url").toString(); + m_description = firstObj.value("description").toString(); + QJsonArray authors = firstObj.value("authors").toArray(); + if(authors.size() == 0) m_authors = ""; + else if(authors.size() >= 1) + { + m_authors = authors.at(0).toString(); + for(int i = 1; i < authors.size(); i++) + { + m_authors += ", " + authors.at(i).toString(); + } + } + m_credits = firstObj.value("credits").toString(); return; } ; diff --git a/logic/Mod.h b/logic/Mod.h index 9831fdc01..f3aaf18b9 100644 --- a/logic/Mod.h +++ b/logic/Mod.h @@ -63,6 +63,21 @@ public: return m_homeurl; } + QString description() const + { + return m_description; + } + + QString authors() const + { + return m_authors; + } + + QString credits() const + { + return m_credits; + } + // delete all the files of this mod bool destroy(); // replace this mod with a copy of the other @@ -99,6 +114,9 @@ protected: QString m_version; QString m_mcversion; QString m_homeurl; + QString m_description; + QString m_authors; + QString m_credits; ModType m_type; }; From f2291ef161c6ae2d47ede15633626ab1e8caab86 Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 21:45:48 +0100 Subject: [PATCH 2/4] Move mod info frame and handler to MCModInfoFrame, use on all instances --- CMakeLists.txt | 4 + gui/LegacyModEditDialog.cpp | 39 +++++ gui/LegacyModEditDialog.h | 6 + gui/LegacyModEditDialog.ui | 331 +++++++++++++++++++----------------- gui/MCModInfoFrame.cpp | 66 +++++++ gui/MCModInfoFrame.h | 32 ++++ gui/MCModInfoFrame.ui | 261 ++++++++++++++++++++++++++++ gui/ModListView.h | 3 +- gui/OneSixModEditDialog.cpp | 26 +-- gui/OneSixModEditDialog.ui | 256 +--------------------------- 10 files changed, 597 insertions(+), 427 deletions(-) create mode 100644 gui/MCModInfoFrame.cpp create mode 100644 gui/MCModInfoFrame.h create mode 100644 gui/MCModInfoFrame.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index a02a4b27a..5503c5ca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,8 @@ gui/LabeledToolButton.h gui/LabeledToolButton.cpp gui/EditNotesDialog.h gui/EditNotesDialog.cpp +gui/MCModInfoFrame.h +gui/MCModInfoFrame.cpp # Base classes and infrastructure logic/BaseVersion.h @@ -334,6 +336,8 @@ gui/IconPickerDialog.ui gui/LegacyModEditDialog.ui gui/OneSixModEditDialog.ui gui/EditNotesDialog.ui + +gui/MCModInfoFrame.ui ) set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${MULTIMC_SOURCES} ${MULTIMC_UIS}) diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 87647e0fa..72792581a 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 f12d9a7be..fcf07f1cb 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 6a4b6d1ec..3ab946d97 100644 --- a/gui/LegacyModEditDialog.ui +++ b/gui/LegacyModEditDialog.ui @@ -23,197 +23,218 @@ Jar Mods - + - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - - - + - - - &Add + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff - - - &Remove - - - - - - - MCForge - - - - - - - Website - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Move &Up - - - - - - - Move &Down - - + + + + + &Add + + + + + + + &Remove + + + + + + + MCForge + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Move &Up + + + + + + + Move &Down + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + Core Mods - + - - - QAbstractItemView::DropOnly - - - - - + - - - &Add + + + QAbstractItemView::DropOnly - - - &Remove - - - - - - - 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 + + + QAbstractItemView::DropOnly - - - &Remove - - - - - - - Website - - - - - - - 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 000000000..805af56b6 --- /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 000000000..7910bd0ce --- /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 000000000..022588d56 --- /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 a9408fe70..69a26755a 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 d97967e8f..9724cec5c 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 88ba5a766..675a6faa2 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 +
From bf951c3eb82f90a83e5496b6a897f95f585aff89 Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 22:11:24 +0100 Subject: [PATCH 3/4] Licenses, cleanup --- gui/LegacyModEditDialog.cpp | 32 ---------------- gui/LegacyModEditDialog.h | 6 --- gui/MCModInfoFrame.cpp | 15 ++++++++ gui/MCModInfoFrame.h | 20 ++++++++-- gui/MCModInfoFrame.ui | 76 ++++++++++++++++++------------------- 5 files changed, 69 insertions(+), 80 deletions(-) diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 72792581a..585bfdfb1 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 fcf07f1cb..b5d51fd55 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 805af56b6..e7e669ece 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 7910bd0ce..516fc5ed7 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 022588d56..73b93a2ef 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,41 +179,6 @@ - - - - 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 - - - @@ -242,10 +217,35 @@ - - + + + + + 200 + 0 + + + + + 16777215 + 92 + + - Authors: + <html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Credits: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop From 9edc486f137c9719bd62c8c63ecc3d195f9dc79e Mon Sep 17 00:00:00 2001 From: Sky Date: Tue, 8 Oct 2013 22:25:56 +0100 Subject: [PATCH 4/4] Show defaults if mod type is 'folder' --- gui/MCModInfoFrame.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index e7e669ece..70cfd46a7 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();