From 1d41938715738cdd4adae3fc34084cc4f94d282a Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 16 Sep 2012 18:13:53 +0200 Subject: [PATCH] Some more tweaks to the new About dialog. --- src/Config.h | 2 +- src/Dialog_About.cpp | 36 ++++++++++++++++++++++++++++-------- src/Dialog_About.h | 3 ++- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/Config.h b/src/Config.h index 9701c0d0..448b4d79 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 5 #define VER_LAMEXP_TYPE Final #define VER_LAMEXP_PATCH 2 -#define VER_LAMEXP_BUILD 1111 +#define VER_LAMEXP_BUILD 1113 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index ed6fb8a0..e890b599 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,7 @@ //Helper macros #define LINK(URL) QString("%2").arg(URL).arg(QString(URL).replace("-", "−")) +#define TRIM_RIGHT(STR) do { while(STR.endsWith(QChar(' ')) || STR.endsWith(QChar('\t')) || STR.endsWith(QChar('\r')) || STR.endsWith(QChar('\n'))) STR.chop(1); } while(0) //Constants const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html"; @@ -99,11 +101,15 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta tabWidget->setCurrentIndex(tabWidget->indexOf(infoTab)); //Disable "X" button - if(HMENU hMenu = GetSystemMenu((HWND) winId(), FALSE)) + if(firstStart) { - EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); + if(HMENU hMenu = GetSystemMenu((HWND) winId(), FALSE)) + { + EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); + } } + //Init images for(int i = 0; i < 4; i++) { m_cartoon[i] = NULL; @@ -242,6 +248,8 @@ void AboutDialog::tabChanged(int index) } m_initFlags->insert(tabWidget->widget(index), true); + + tabWidget->widget(index)->update(); qApp->processEvents(); qApp->restoreOverrideCursor(); } @@ -388,6 +396,11 @@ void AboutDialog::showEvent(QShowEvent *e) } } +void AboutDialog::closeEvent(QCloseEvent *e) +{ + if(m_firstShow) e->ignore(); +} + bool AboutDialog::eventFilter(QObject *obj, QEvent *event) { if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress)) @@ -695,7 +708,7 @@ void AboutDialog::initSoftwareTab(void) tr("By Mark James, released under the Creative Commons 'by' License."), "http://www.famfamfam.com/lab/icons/silk/" ); - moreAboutText += QString(" %1
").arg + moreAboutText += QString(" 
%1
").arg ( tr("The copyright of LameXP as a whole belongs to LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors.") ); @@ -717,25 +730,31 @@ void AboutDialog::initLicenseTab(void) unsigned int counter = 0; while((!stream.atEnd()) && (stream.status() == QTextStream::Ok)) { - QString line = stream.readLine().replace('<', "<").replace('>', ">"); + QString line = stream.readLine(); + const bool bIsBlank = line.trimmed().isEmpty(); + line.replace('<', "<").replace('>', ">"); + switch(counter) { case 0: - if(!line.isEmpty()) licenseText += QString("%1
").arg(line.simplified()); + if(!bIsBlank) licenseText += QString("%1
").arg(line.simplified()); break; case 1: - if(!line.isEmpty()) licenseText += QString("%1
").arg(line.simplified()); + if(!bIsBlank) licenseText += QString("%1
").arg(line.simplified()); break; default: + TRIM_RIGHT(line); licenseText += QString("%1
").arg(line.replace(' ', " ")); break; } - if(!line.isEmpty()) counter++; + + if(!bIsBlank) counter++; } stream.device()->close(); } else { + licenseText += QString("Oups, failed to load license text. Please refer to:
"); licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html"); } @@ -743,6 +762,7 @@ void AboutDialog::initLicenseTab(void) licenseLabel->setText(licenseText); licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65))); + connect(licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString))); } @@ -759,7 +779,7 @@ QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBi toolText += QString("%1
").arg(NOBR(toolLicense)); if(!extraInfo.isEmpty()) toolText += QString("%1
").arg(NOBR(extraInfo)); toolText += QString("%1").arg(LINK(toolWebsite)); - toolText += QString("

"); + toolText += QString("
 
"); return toolText; } diff --git a/src/Dialog_About.h b/src/Dialog_About.h index ec2fbee7..020b2e05 100644 --- a/src/Dialog_About.h +++ b/src/Dialog_About.h @@ -45,7 +45,8 @@ public slots: void tabChanged(int index); protected: - void showEvent(QShowEvent *e); + virtual void showEvent(QShowEvent *e); + virtual void closeEvent(QCloseEvent *e); bool eventFilter(QObject *obj, QEvent *event); private: