summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-01-02 04:01:00 +0100
committerPetr Mrázek <peterix@gmail.com>2016-01-02 04:01:00 +0100
commitb9b5a82c2e0893aac94803c306f8f8fb73f4f909 (patch)
tree862303979e6cf4689203f5af070ef03967803148
parentda2af5e449cca8524b298c2f6281bf281420eaf8 (diff)
downloadMultiMC-b9b5a82c2e0893aac94803c306f8f8fb73f4f909.tar
MultiMC-b9b5a82c2e0893aac94803c306f8f8fb73f4f909.tar.gz
MultiMC-b9b5a82c2e0893aac94803c306f8f8fb73f4f909.tar.lz
MultiMC-b9b5a82c2e0893aac94803c306f8f8fb73f4f909.tar.xz
MultiMC-b9b5a82c2e0893aac94803c306f8f8fb73f4f909.zip
GH-1313 remove translatable strings from MCModInfoFrame
-rw-r--r--application/widgets/MCModInfoFrame.cpp45
-rw-r--r--application/widgets/MCModInfoFrame.h3
-rw-r--r--application/widgets/MCModInfoFrame.ui27
3 files changed, 67 insertions, 8 deletions
diff --git a/application/widgets/MCModInfoFrame.cpp b/application/widgets/MCModInfoFrame.cpp
index cdf35be8..314b2e60 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 d29a32bd..0609007d 100644
--- a/application/widgets/MCModInfoFrame.h
+++ b/application/widgets/MCModInfoFrame.h
@@ -42,6 +42,9 @@ public slots:
void boxClosed(int result);
private:
+ void updateHiddenState();
+
+private:
Ui::MCModInfoFrame *ui;
QString desc;
class QMessageBox * currentBox = nullptr;
diff --git a/application/widgets/MCModInfoFrame.ui b/application/widgets/MCModInfoFrame.ui
index 12534b25..ce418267 100644
--- a/application/widgets/MCModInfoFrame.ui
+++ b/application/widgets/MCModInfoFrame.ui
@@ -26,10 +26,25 @@
<string>Frame</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item>
<widget class="QLabel" name="label_ModText">
<property name="text">
- <string>Select a mod to view title and authors...</string>
+ <string notr="true"/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@@ -50,11 +65,14 @@
</item>
<item>
<widget class="QLabel" name="label_ModDescription">
+ <property name="toolTip">
+ <string notr="true"/>
+ </property>
<property name="text">
- <string>Select a mod to view description...</string>
+ <string notr="true"/>
</property>
<property name="textFormat">
- <enum>Qt::PlainText</enum>
+ <enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@@ -62,6 +80,9 @@
<property name="wordWrap">
<bool>true</bool>
</property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>