Clean up mcmod panel massively. Keep it simple - name (optionally linked), optional authors and description. Needs cut-off handling, frame looking at on Windows

This commit is contained in:
Sky 2013-10-09 02:26:03 +01:00
parent 6bc9df84d9
commit 14b47057fd
5 changed files with 89 additions and 247 deletions

View File

@ -92,11 +92,8 @@
</item> </item>
<item> <item>
<widget class="MCModInfoFrame" name="jarMIFrame"> <widget class="MCModInfoFrame" name="jarMIFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Plain</enum>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -23,34 +23,27 @@ void MCModInfoFrame::updateWithMod(Mod &m)
return; return;
} }
QString missing = tr("Missing from mcmod.info"); QString text = "";
if(m.homeurl().isEmpty()) text = m.name();
else text = "<a href=\"" + m.homeurl() + "\">" + m.name() + "</a>";
if(!m.authors().isEmpty()) text += " by " + m.authors();
QString name = m.name(); setModText(text);
if(name.isEmpty()) name = missing;
QString description = m.description();
if(description.isEmpty()) description = missing;
QString authors = m.authors();
if(authors.isEmpty()) authors = missing;
QString credits = m.credits();
if(credits.isEmpty()) credits = missing;
QString website = m.homeurl();
if(website.isEmpty()) website = missing;
else website = "<a href=\"" + website + "\">" + website + "</a>";
setName(name); if(m.description().isEmpty())
setDescription(description); {
setAuthors(authors); setModDescription(tr("No description provided in mcmod.info"));
setCredits(credits); }
setWebsite(website); else
{
setModDescription(m.description());
}
} }
void MCModInfoFrame::clear() void MCModInfoFrame::clear()
{ {
setName(tr("Select a mod to view information...")); setModText(tr("Select a mod to view title and authors..."));
setDescription(tr("Mod description")); setModDescription(tr("Select a mod to view description..."));
setAuthors(tr("Mod authors"));
setCredits(tr("Mod credits"));
setWebsite(tr("Mod website"));
} }
MCModInfoFrame::MCModInfoFrame(QWidget *parent) : MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
@ -65,31 +58,12 @@ MCModInfoFrame::~MCModInfoFrame()
delete ui; delete ui;
} }
void MCModInfoFrame::setName(QString name) void MCModInfoFrame::setModText(QString text)
{ {
ui->label_Name->setText(name); ui->label_ModText->setText(text);
//ui->label_Name->setToolTip(name);
} }
void MCModInfoFrame::setDescription(QString description) void MCModInfoFrame::setModDescription(QString text)
{ {
ui->label_Description->setText(description); ui->label_ModDescription->setText(text);
//ui->label_Description->setToolTip(description);
}
void MCModInfoFrame::setAuthors(QString authors)
{
ui->label_Authors->setText(authors);
//ui->label_Authors->setToolTip(authors);
}
void MCModInfoFrame::setCredits(QString credits)
{
ui->label_Credits->setText(credits);
//ui->label_Credits->setToolTip(credits);
}
void MCModInfoFrame::setWebsite(QString website)
{
ui->label_Website->setText(website);
} }

View File

@ -31,11 +31,8 @@ public:
explicit MCModInfoFrame(QWidget *parent = 0); explicit MCModInfoFrame(QWidget *parent = 0);
~MCModInfoFrame(); ~MCModInfoFrame();
void setName(QString name); void setModText(QString text);
void setDescription(QString description); void setModDescription(QString text);
void setAuthors(QString authors);
void setCredits(QString credits);
void setWebsite(QString website);
void updateWithMod(Mod &m); void updateWithMod(Mod &m);
void clear(); void clear();

View File

@ -2,154 +2,43 @@
<ui version="4.0"> <ui version="4.0">
<class>MCModInfoFrame</class> <class>MCModInfoFrame</class>
<widget class="QFrame" name="MCModInfoFrame"> <widget class="QFrame" name="MCModInfoFrame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>527</width>
<height>68</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Frame</string> <string>Frame</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="label_ModText">
<item>
<widget class="QLabel" name="label_Name">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>92</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Select a mod to view information...</string> <string>Select a mod to view title and authors...</string>
</property> </property>
<property name="alignment"> <property name="textFormat">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Description">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>92</height>
</size>
</property>
<property name="text">
<string>Mod description</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Authors:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_Authors">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>92</height>
</size>
</property>
<property name="text">
<string>Mod authors</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Website:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_Website">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>92</height>
</size>
</property>
<property name="text">
<string>Mod website</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -162,22 +51,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item>
<widget class="QLabel" name="label_Credits"> <widget class="QLabel" name="label_ModDescription">
<property name="minimumSize"> <property name="sizePolicy">
<size> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<width>200</width> <horstretch>0</horstretch>
<height>0</height> <verstretch>0</verstretch>
</size> </sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>92</height>
</size>
</property> </property>
<property name="text"> <property name="text">
<string>Mod credits</string> <string>Select a mod to view description...</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</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>
@ -187,18 +73,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Credits:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -222,11 +222,11 @@
</item> </item>
<item> <item>
<widget class="MCModInfoFrame" name="frame"> <widget class="MCModInfoFrame" name="frame">
<property name="frameShape"> <property name="sizePolicy">
<enum>QFrame::StyledPanel</enum> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
</property> <horstretch>0</horstretch>
<property name="frameShadow"> <verstretch>0</verstretch>
<enum>QFrame::Raised</enum> </sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>