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>
<widget class="MCModInfoFrame" name="jarMIFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>

View File

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

View File

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

View File

@ -2,202 +2,76 @@
<ui version="4.0">
<class>MCModInfoFrame</class>
<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">
<string>Frame</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_Name">
<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="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Select a mod to view information...</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</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>
<widget class="QLabel" name="label_ModText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<property name="text">
<string>Select a mod to view title and authors...</string>
</property>
<property name="labelAlignment">
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<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 name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_Credits">
<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 credits</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="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>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ModDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select a mod to view description...</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>

View File

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