From 6bc9df84d9e72d8ee06c23c505b6c5ad54820115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 9 Oct 2013 02:03:02 +0200 Subject: Mod info, with less HTML! And responding to keyboard events too. --- gui/MCModInfoFrame.cpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'gui/MCModInfoFrame.cpp') diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index 70cfd46a..15ead7ab 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,21 +15,15 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" - -void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) +void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) { - frame->setName("

Select a mod to view information...

"); - frame->setDescription("

Mod description

"); - frame->setAuthors("

Mod authors

"); - frame->setCredits("

Mod credits

"); - frame->setWebsite("

Mod website

"); - + clear(); return; } - QString missing = "

Missing from mcmod.info

"; + QString missing = tr("Missing from mcmod.info"); QString name = m.name(); if(name.isEmpty()) name = missing; @@ -43,11 +37,20 @@ void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame) if(website.isEmpty()) website = missing; else website = "" + website + ""; - frame->setName("

" + name + "

"); - frame->setDescription(description); - frame->setAuthors(authors); - frame->setCredits(credits); - frame->setWebsite(website); + setName(name); + setDescription(description); + setAuthors(authors); + setCredits(credits); + setWebsite(website); +} + +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")); } MCModInfoFrame::MCModInfoFrame(QWidget *parent) : @@ -65,25 +68,25 @@ MCModInfoFrame::~MCModInfoFrame() void MCModInfoFrame::setName(QString name) { ui->label_Name->setText(name); - ui->label_Name->setToolTip(name); + //ui->label_Name->setToolTip(name); } void MCModInfoFrame::setDescription(QString description) { ui->label_Description->setText(description); - ui->label_Description->setToolTip(description); + //ui->label_Description->setToolTip(description); } void MCModInfoFrame::setAuthors(QString authors) { ui->label_Authors->setText(authors); - ui->label_Authors->setToolTip(authors); + //ui->label_Authors->setToolTip(authors); } void MCModInfoFrame::setCredits(QString credits) { ui->label_Credits->setText(credits); - ui->label_Credits->setToolTip(credits); + //ui->label_Credits->setToolTip(credits); } void MCModInfoFrame::setWebsite(QString website) -- cgit v1.2.3