diff options
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/ui/widgets/InfoFrame.cpp | 15 | ||||
-rw-r--r-- | launcher/ui/widgets/InfoFrame.h | 1 | ||||
-rw-r--r-- | launcher/ui/widgets/InfoFrame.ui | 34 |
3 files changed, 44 insertions, 6 deletions
diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp index 69d77603..97d0ba37 100644 --- a/launcher/ui/widgets/InfoFrame.cpp +++ b/launcher/ui/widgets/InfoFrame.cpp @@ -87,11 +87,14 @@ void InfoFrame::updateWithMod(Mod const& m) { setDescription(m.description()); } + + setImage(); } void InfoFrame::updateWithResource(const Resource& resource) { setName(resource.name()); + setImage(); } // https://www.sportskeeda.com/minecraft-wiki/color-codes @@ -146,12 +149,14 @@ void InfoFrame::updateWithResourcePack(const ResourcePack& resource_pack) description_parsed.replace("\n", "<br>"); setDescription(description_parsed); + setImage(resource_pack.image({64, 64})); } void InfoFrame::clear() { setName(); setDescription(); + setImage(); } void InfoFrame::updateHiddenState() @@ -226,6 +231,16 @@ void InfoFrame::setDescription(QString text) ui->descriptionLabel->setText(labeltext); } +void InfoFrame::setImage(QPixmap img) +{ + if (img.isNull()) { + ui->iconLabel->setHidden(true); + } else { + ui->iconLabel->setHidden(false); + ui->iconLabel->setPixmap(img); + } +} + void InfoFrame::descriptionEllipsisHandler(QString link) { if(!m_current_box) diff --git a/launcher/ui/widgets/InfoFrame.h b/launcher/ui/widgets/InfoFrame.h index 4b6df023..d914aa0c 100644 --- a/launcher/ui/widgets/InfoFrame.h +++ b/launcher/ui/widgets/InfoFrame.h @@ -34,6 +34,7 @@ class InfoFrame : public QFrame { void setName(QString text = {}); void setDescription(QString text = {}); + void setImage(QPixmap img = {}); void clear(); diff --git a/launcher/ui/widgets/InfoFrame.ui b/launcher/ui/widgets/InfoFrame.ui index 0d3772d7..9e407ce9 100644 --- a/launcher/ui/widgets/InfoFrame.ui +++ b/launcher/ui/widgets/InfoFrame.ui @@ -22,10 +22,7 @@ <height>120</height> </size> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>6</number> - </property> + <layout class="QGridLayout" name="gridLayout"> <property name="leftMargin"> <number>0</number> </property> @@ -38,7 +35,7 @@ <property name="bottomMargin"> <number>0</number> </property> - <item> + <item row="0" column="1"> <widget class="QLabel" name="nameLabel"> <property name="text"> <string notr="true"/> @@ -60,7 +57,7 @@ </property> </widget> </item> - <item> + <item row="1" column="1"> <widget class="QLabel" name="descriptionLabel"> <property name="toolTip"> <string notr="true"/> @@ -85,6 +82,31 @@ </property> </widget> </item> + <item row="0" column="0" rowspan="2"> + <widget class="QLabel" name="iconLabel"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>64</width> + <height>64</height> + </size> + </property> + <property name="text"> + <string notr="true"/> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="margin"> + <number>0</number> + </property> + </widget> + </item> </layout> </widget> <resources/> |