NOISSUE Show FTB pack descriptions in text browser

This commit is contained in:
Jamie Mansfield 2021-02-10 16:57:46 +00:00
parent 6b3b7ded2d
commit 6eabd336ee
No known key found for this signature in database
GPG Key ID: 36F61598F39F67B0
2 changed files with 37 additions and 21 deletions

View File

@ -6,6 +6,8 @@
#include "dialogs/NewInstanceDialog.h" #include "dialogs/NewInstanceDialog.h"
#include "modplatform/modpacksch/FTBPackInstallTask.h" #include "modplatform/modpacksch/FTBPackInstallTask.h"
#include "HoeDown.h"
FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent) FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent)
: QWidget(parent), ui(new Ui::FtbPage), dialog(dialog) : QWidget(parent), ui(new Ui::FtbPage), dialog(dialog)
{ {
@ -108,6 +110,10 @@ void FtbPage::onSelectionChanged(QModelIndex first, QModelIndex second)
selected = filterModel->data(first, Qt::UserRole).value<ModpacksCH::Modpack>(); selected = filterModel->data(first, Qt::UserRole).value<ModpacksCH::Modpack>();
HoeDown hoedown;
QString output = hoedown.process(selected.description.toUtf8());
ui->packDescription->setHtml(output);
// reverse foreach, so that the newest versions are first // reverse foreach, so that the newest versions are first
for (auto i = selected.versions.size(); i--;) { for (auto i = selected.versions.size(); i--;) {
ui->versionSelectionBox->addItem(selected.versions.at(i).name); ui->versionSelectionBox->addItem(selected.versions.at(i).name);

View File

@ -11,16 +11,6 @@
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="searchButton">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="searchEdit"/>
</item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0" rowminimumheight="0" columnminimumwidth="0,0,0"> <layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0" rowminimumheight="0" columnminimumwidth="0,0,0">
<item row="0" column="2"> <item row="0" column="2">
@ -41,11 +31,20 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="0" column="0">
<widget class="QTreeView" name="packView"> <widget class="QLineEdit" name="searchEdit"/>
<property name="alternatingRowColors"> </item>
<bool>true</bool> <item row="0" column="1">
<widget class="QPushButton" name="searchButton">
<property name="text">
<string>Search</string>
</property> </property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTreeView" name="packView">
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>48</width> <width>48</width>
@ -54,12 +53,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QTextBrowser" name="packDescription">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>searchEdit</tabstop> <tabstop>searchEdit</tabstop>
<tabstop>searchButton</tabstop> <tabstop>searchButton</tabstop>
<tabstop>packView</tabstop>
<tabstop>versionSelectionBox</tabstop> <tabstop>versionSelectionBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>