NOISSUE expose twitch pack url, description and author list
This commit is contained in:
parent
cb0887ffa8
commit
5ca5661c23
@ -59,9 +59,34 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
{
|
{
|
||||||
dialog->setSuggestedPack();
|
dialog->setSuggestedPack();
|
||||||
}
|
}
|
||||||
|
ui->frame->clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
current = model->data(first, Qt::UserRole).value<Twitch::Modpack>();
|
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();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,12 +52,37 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>MCModInfoFrame</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>widgets/MCModInfoFrame.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>searchEdit</tabstop>
|
<tabstop>searchEdit</tabstop>
|
||||||
<tabstop>searchButton</tabstop>
|
<tabstop>searchButton</tabstop>
|
||||||
<tabstop>packView</tabstop>
|
<tabstop>packView</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user