Add version info to About Dialog.
authorNguyễn Hồng Quân <ng.hong.quan@gmail.com>
Tue, 30 Oct 2012 07:52:25 +0000 (14:52 +0700)
committerNguyễn Hồng Quân <ng.hong.quan@gmail.com>
Tue, 30 Oct 2012 07:52:25 +0000 (14:52 +0700)
about.cpp
about.h
mainwindow.cpp
mverbiste.pro

index f8d45c6..939c0e0 100644 (file)
--- a/about.cpp
+++ b/about.cpp
@@ -1,41 +1,44 @@
 #include "about.h"
 
 #include "about.h"
 
-AboutDialog::AboutDialog(const char *iconFile, const char *title)
+AboutDialog::AboutDialog(const char *iconFile, const QString &title)
     : QDialog()
 {
     : QDialog()
 {
-    setWindowTitle(title);
+    setWindowTitle("About");
     QHBoxLayout *mlayout = new QHBoxLayout();
     QLabel *iconshow = new QLabel();
     iconshow->setPixmap(QPixmap(iconFile));
     QHBoxLayout *mlayout = new QHBoxLayout();
     QLabel *iconshow = new QLabel();
     iconshow->setPixmap(QPixmap(iconFile));
+    mlayout->addWidget(iconshow);
 
     rlayout = new QVBoxLayout();
 
     rlayout = new QVBoxLayout();
-    mlayout->addWidget(iconshow);
+    QLabel *tit = new QLabel(title);
+    tit->setStyleSheet("QLabel {font-size: 40px}");
+    rlayout->addWidget(tit);
     mlayout->addLayout(rlayout);
     setLayout(mlayout);
 }
 
 void AboutDialog::setIntro(const QString &text)
 {
     mlayout->addLayout(rlayout);
     setLayout(mlayout);
 }
 
 void AboutDialog::setIntro(const QString &text)
 {
-    // Place to the first item of rlayout
-    if (rlayout->count() == 0) {
+    // Place to the second item of rlayout
+    if (rlayout->count() == 1) {
         // No item yet, add one
         rlayout->addWidget(new QLabel(text));
     }
     else {
         // No item yet, add one
         rlayout->addWidget(new QLabel(text));
     }
     else {
-        // First item has existed, replace it.
-        QWidget *child = (QWidget *)rlayout->itemAt(0);
-        rlayout->removeWidget(child);
+        // Second item has existed, replace it.
+        QWidget *child = (QWidget *)rlayout->takeAt(0);
+        delete child;
         rlayout->insertWidget(0, new QLabel(text));
     }
 }
 
 void AboutDialog::addAuthor(const QString &name)
 {
         rlayout->insertWidget(0, new QLabel(text));
     }
 }
 
 void AboutDialog::addAuthor(const QString &name)
 {
-    // Place from the second item of rlayout
-    if (rlayout->count() == 0) {
-        // No first item, add empty one.
+    // Place from the third item of rlayout
+    if (rlayout->count() == 1) {
+        // No second item, add empty one.
         rlayout->addWidget(new QLabel(""));
     }
         rlayout->addWidget(new QLabel(""));
     }
-    // Add from the second
+    // Add from the third
     rlayout->addWidget(new QLabel(name));
 }
     rlayout->addWidget(new QLabel(name));
 }
diff --git a/about.h b/about.h
index c913b31..96bcd29 100644 (file)
--- a/about.h
+++ b/about.h
@@ -9,7 +9,7 @@ class AboutDialog: public QDialog
 {
     Q_OBJECT
 public:
 {
     Q_OBJECT
 public:
-    explicit AboutDialog(const char *iconFile, const char *title);
+    explicit AboutDialog(const char *iconFile, const QString &title);
 
     void setIntro(const QString &text);
     void addAuthor(const QString &name);
 
     void setIntro(const QString &text);
     void addAuthor(const QString &name);
index 2ae5a60..2496c75 100644 (file)
@@ -49,7 +49,7 @@ void MainWindow::setupcodedUI()
     setWindowIcon(*icon);
 
     /* About Dialog */
     setWindowIcon(*icon);
 
     /* About Dialog */
-    aboutDialog = new AboutDialog(ICONFILE, "MVerbiste");
+    aboutDialog = new AboutDialog(ICONFILE, QString("MVerbiste v%1").arg(VERSTR));
     aboutDialog->setIntro(trUtf8("A French conjugation utility for Maemo and MeeGo"));
     aboutDialog->addAuthor(QString::fromUtf8("Nguyễn Hồng Quân <ng.hong.quan@gmail.com>\nPierre Sarrazin <sarrazip@sarrazip.com>"));
 
     aboutDialog->setIntro(trUtf8("A French conjugation utility for Maemo and MeeGo"));
     aboutDialog->addAuthor(QString::fromUtf8("Nguyễn Hồng Quân <ng.hong.quan@gmail.com>\nPierre Sarrazin <sarrazip@sarrazip.com>"));
 
index 62e1007..abce02a 100644 (file)
@@ -62,14 +62,14 @@ OTHER_FILES += \
     verbiste/Makefile.in \
     verbiste/Makefile.am \
     gui/Makefile.in \
     verbiste/Makefile.in \
     verbiste/Makefile.am \
     gui/Makefile.in \
-    gui/Makefile.am \
-    icons/mverbiste.svg \
-    icons/mverbiste160.png
+    gui/Makefile.am
 
 # To build verbiste
 unix: CONFIG += link_pkgconfig
 unix: PKGCONFIG += libxml-2.0
 
 
 # To build verbiste
 unix: CONFIG += link_pkgconfig
 unix: PKGCONFIG += libxml-2.0
 
+DEFINES += VERSTR=\\\"1.0\\\"
+
 # For verbiste
 DEFINES += ICONV_CONST=
 
 # For verbiste
 DEFINES += ICONV_CONST=