diff --git a/application/widgets/MCModInfoFrame.cpp b/application/widgets/MCModInfoFrame.cpp
index cdf35be82..314b2e60d 100644
--- a/application/widgets/MCModInfoFrame.cpp
+++ b/application/widgets/MCModInfoFrame.cpp
@@ -46,7 +46,7 @@ void MCModInfoFrame::updateWithMod(Mod &m)
if (m.description().isEmpty())
{
- setModDescription(tr("No description provided in mcmod.info"));
+ setModDescription(QString());
}
else
{
@@ -56,8 +56,8 @@ void MCModInfoFrame::updateWithMod(Mod &m)
void MCModInfoFrame::clear()
{
- setModText(tr("Select a mod to view title and authors..."));
- setModDescription(tr("Select a mod to view description..."));
+ setModText(QString());
+ setModDescription(QString());
}
MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
@@ -65,6 +65,9 @@ MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
ui(new Ui::MCModInfoFrame)
{
ui->setupUi(this);
+ ui->label_ModDescription->setHidden(true);
+ ui->label_ModText->setHidden(true);
+ updateHiddenState();
}
MCModInfoFrame::~MCModInfoFrame()
@@ -72,13 +75,45 @@ MCModInfoFrame::~MCModInfoFrame()
delete ui;
}
+void MCModInfoFrame::updateHiddenState()
+{
+ if(ui->label_ModDescription->isHidden() && ui->label_ModText->isHidden())
+ {
+ setHidden(true);
+ }
+ else
+ {
+ setHidden(false);
+ }
+}
+
void MCModInfoFrame::setModText(QString text)
{
- ui->label_ModText->setText(text);
+ if(text.isEmpty())
+ {
+ ui->label_ModText->setHidden(true);
+ }
+ else
+ {
+ ui->label_ModText->setText(text);
+ ui->label_ModText->setHidden(false);
+ }
+ updateHiddenState();
}
void MCModInfoFrame::setModDescription(QString text)
{
+ if(text.isEmpty())
+ {
+ ui->label_ModDescription->setHidden(true);
+ updateHiddenState();
+ return;
+ }
+ else
+ {
+ ui->label_ModDescription->setHidden(false);
+ updateHiddenState();
+ }
ui->label_ModDescription->setToolTip("");
QString intermediatetext = text.trimmed();
bool prev(false);
@@ -115,7 +150,7 @@ void MCModInfoFrame::modDescEllipsisHandler(const QString &link)
{
if(!currentBox)
{
- currentBox = CustomMessageBox::selectable(this, tr(""), desc);
+ currentBox = CustomMessageBox::selectable(this, QString(), desc);
connect(currentBox, &QMessageBox::finished, this, &MCModInfoFrame::boxClosed);
currentBox->show();
}
diff --git a/application/widgets/MCModInfoFrame.h b/application/widgets/MCModInfoFrame.h
index d29a32bd4..0609007d7 100644
--- a/application/widgets/MCModInfoFrame.h
+++ b/application/widgets/MCModInfoFrame.h
@@ -41,6 +41,9 @@ public slots:
void modDescEllipsisHandler(const QString& link );
void boxClosed(int result);
+private:
+ void updateHiddenState();
+
private:
Ui::MCModInfoFrame *ui;
QString desc;
diff --git a/application/widgets/MCModInfoFrame.ui b/application/widgets/MCModInfoFrame.ui
index 12534b25e..ce418267e 100644
--- a/application/widgets/MCModInfoFrame.ui
+++ b/application/widgets/MCModInfoFrame.ui
@@ -26,10 +26,25 @@
Frame
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
- Select a mod to view title and authors...
+
Qt::RichText
@@ -50,11 +65,14 @@
-
+
+
+
- Select a mod to view description...
+
- Qt::PlainText
+ Qt::RichText
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
@@ -62,6 +80,9 @@
true
+
+ true
+
Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse