GH-1313 remove translatable strings from MCModInfoFrame

This commit is contained in:
Petr Mrázek 2016-01-02 04:01:00 +01:00
parent da2af5e449
commit b9b5a82c2e
3 changed files with 67 additions and 8 deletions

View File

@ -46,7 +46,7 @@ void MCModInfoFrame::updateWithMod(Mod &m)
if (m.description().isEmpty()) if (m.description().isEmpty())
{ {
setModDescription(tr("No description provided in mcmod.info")); setModDescription(QString());
} }
else else
{ {
@ -56,8 +56,8 @@ void MCModInfoFrame::updateWithMod(Mod &m)
void MCModInfoFrame::clear() void MCModInfoFrame::clear()
{ {
setModText(tr("Select a mod to view title and authors...")); setModText(QString());
setModDescription(tr("Select a mod to view description...")); setModDescription(QString());
} }
MCModInfoFrame::MCModInfoFrame(QWidget *parent) : MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
@ -65,6 +65,9 @@ MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
ui(new Ui::MCModInfoFrame) ui(new Ui::MCModInfoFrame)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->label_ModDescription->setHidden(true);
ui->label_ModText->setHidden(true);
updateHiddenState();
} }
MCModInfoFrame::~MCModInfoFrame() MCModInfoFrame::~MCModInfoFrame()
@ -72,13 +75,45 @@ MCModInfoFrame::~MCModInfoFrame()
delete ui; delete ui;
} }
void MCModInfoFrame::updateHiddenState()
{
if(ui->label_ModDescription->isHidden() && ui->label_ModText->isHidden())
{
setHidden(true);
}
else
{
setHidden(false);
}
}
void MCModInfoFrame::setModText(QString text) void MCModInfoFrame::setModText(QString text)
{ {
if(text.isEmpty())
{
ui->label_ModText->setHidden(true);
}
else
{
ui->label_ModText->setText(text); ui->label_ModText->setText(text);
ui->label_ModText->setHidden(false);
}
updateHiddenState();
} }
void MCModInfoFrame::setModDescription(QString text) 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(""); ui->label_ModDescription->setToolTip("");
QString intermediatetext = text.trimmed(); QString intermediatetext = text.trimmed();
bool prev(false); bool prev(false);
@ -115,7 +150,7 @@ void MCModInfoFrame::modDescEllipsisHandler(const QString &link)
{ {
if(!currentBox) if(!currentBox)
{ {
currentBox = CustomMessageBox::selectable(this, tr(""), desc); currentBox = CustomMessageBox::selectable(this, QString(), desc);
connect(currentBox, &QMessageBox::finished, this, &MCModInfoFrame::boxClosed); connect(currentBox, &QMessageBox::finished, this, &MCModInfoFrame::boxClosed);
currentBox->show(); currentBox->show();
} }

View File

@ -41,6 +41,9 @@ public slots:
void modDescEllipsisHandler(const QString& link ); void modDescEllipsisHandler(const QString& link );
void boxClosed(int result); void boxClosed(int result);
private:
void updateHiddenState();
private: private:
Ui::MCModInfoFrame *ui; Ui::MCModInfoFrame *ui;
QString desc; QString desc;

View File

@ -26,10 +26,25 @@
<string>Frame</string> <string>Frame</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <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> <item>
<widget class="QLabel" name="label_ModText"> <widget class="QLabel" name="label_ModText">
<property name="text"> <property name="text">
<string>Select a mod to view title and authors...</string> <string notr="true"/>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -50,11 +65,14 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label_ModDescription"> <widget class="QLabel" name="label_ModDescription">
<property name="toolTip">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>Select a mod to view description...</string> <string notr="true"/>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::PlainText</enum> <enum>Qt::RichText</enum>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -62,6 +80,9 @@
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property> </property>