diff options
author | Petr Mrázek <peterix@gmail.com> | 2020-04-29 21:17:51 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2020-04-29 21:17:51 +0200 |
commit | 5ca5661c23050d738f1d5f9ced5e7fb71eef3fce (patch) | |
tree | 02d108881481f76c6c1dd6faab0cc2b844fcf8de | |
parent | cb0887ffa8f029d859cc936e327417066e363b6b (diff) | |
download | MultiMC-5ca5661c23050d738f1d5f9ced5e7fb71eef3fce.tar MultiMC-5ca5661c23050d738f1d5f9ced5e7fb71eef3fce.tar.gz MultiMC-5ca5661c23050d738f1d5f9ced5e7fb71eef3fce.tar.lz MultiMC-5ca5661c23050d738f1d5f9ced5e7fb71eef3fce.tar.xz MultiMC-5ca5661c23050d738f1d5f9ced5e7fb71eef3fce.zip |
NOISSUE expose twitch pack url, description and author list
-rw-r--r-- | application/pages/modplatform/twitch/TwitchPage.cpp | 25 | ||||
-rw-r--r-- | application/pages/modplatform/twitch/TwitchPage.ui | 25 |
2 files changed, 50 insertions, 0 deletions
diff --git a/application/pages/modplatform/twitch/TwitchPage.cpp b/application/pages/modplatform/twitch/TwitchPage.cpp index 80d83133..1e9f9dbb 100644 --- a/application/pages/modplatform/twitch/TwitchPage.cpp +++ b/application/pages/modplatform/twitch/TwitchPage.cpp @@ -59,9 +59,34 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) { dialog->setSuggestedPack(); } + ui->frame->clear(); return; } + current = model->data(first, Qt::UserRole).value<Twitch::Modpack>(); + QString text = ""; + QString name = current.name; + + if (current.websiteUrl.isEmpty()) + text = name; + else + text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>"; + if (!current.authors.empty()) { + auto authorToStr = [](Twitch::ModpackAuthor & author) { + if(author.url.isEmpty()) { + return author.name; + } + return QString("<a href=\"%1\">%2</a>").arg(author.url, author.name); + }; + QStringList authorStrs; + for(auto & author: current.authors) { + authorStrs.push_back(authorToStr(author)); + } + text += tr(" by ") + authorStrs.join(", "); + } + + ui->frame->setModText(text); + ui->frame->setModDescription(current.description); suggestCurrent(); } diff --git a/application/pages/modplatform/twitch/TwitchPage.ui b/application/pages/modplatform/twitch/TwitchPage.ui index 7a8203b1..29bdc727 100644 --- a/application/pages/modplatform/twitch/TwitchPage.ui +++ b/application/pages/modplatform/twitch/TwitchPage.ui @@ -52,12 +52,37 @@ </attribute> </widget> </item> + <item row="2" column="0" colspan="2"> + <widget class="MCModInfoFrame" name="frame"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>MCModInfoFrame</class> + <extends>QFrame</extends> + <header>widgets/MCModInfoFrame.h</header> + <container>1</container> + </customwidget> + </customwidgets> <tabstops> <tabstop>searchEdit</tabstop> <tabstop>searchButton</tabstop> <tabstop>packView</tabstop> </tabstops> + <resources/> <connections/> </ui> |