]> Some of my projects - localmylist.git/commitdiff
Add a version dialog to management-gui
authorAPTX <marek321@gmail.com>
Sat, 6 Apr 2013 21:43:10 +0000 (23:43 +0200)
committerAPTX <marek321@gmail.com>
Sat, 6 Apr 2013 21:43:10 +0000 (23:43 +0200)
localmylist/localmylist.pro
localmylist/mylist.cpp
localmylist/mylist.h
management-gui/mainwindow.cpp
management-gui/mainwindow.h
management-gui/mainwindow.ui
management-gui/management-gui.pro
management-gui/versiondialog.cpp [new file with mode: 0644]
management-gui/versiondialog.h [new file with mode: 0644]

index 6f50ac1134f79657ef5ad6c11d2183736881d992..279b4782479f1cec9b6148920cc4071a2212ac5e 100644 (file)
@@ -94,6 +94,8 @@ CONV_HEADERS += \
        DEFINES += LOCALMYLIST_NO_ANIDBUDPCLIENT
 }
 
+REV = $$system(git show-ref --head -s HEAD)
+DEFINES += REVISION=\"$${REV}\"
 
 SHARE += \
        share/schema/schema.sql \
index 7fe57c995cc94320840ae2778a588b76f6e26826..097e7ceb8e512ff3857f2b54b1710aed8d10ddf4 100644 (file)
@@ -354,6 +354,20 @@ bool MyList::isUdpClientAvailable()
 #endif
 }
 
+const char *MyList::revision()
+{
+#ifdef REVISION
+#define LML_GET_REV_I(X) #X
+#define LML_GET_REV(X) LML_GET_REV_I(X)
+       return LML_GET_REV(REVISION);
+#undef LML_GET_REV_I
+#undef LML_GET_REV
+#else
+       return 0;
+#endif
+
+}
+
 void MyList::init()
 {
        static bool init = false;
index 36d2cc685756b30f0bd339159897a58fb263a2c3..63b7a315e4495c5f67ae6a4a4565eded9698e8df 100644 (file)
@@ -99,6 +99,8 @@ public:
 
        static bool isUdpClientAvailable();
 
+       static const char *revision();
+
        static bool REGISTER_QT_TYPES;
        static bool MANUAL_CLEANUP;
 
index f9d4aca9de4bea6048e125c5e8f67192c4474c4b..9902a831555586c0f68d3d6524f95f3a7bf6f77b 100644 (file)
@@ -25,6 +25,7 @@
 #      include "renamesettingsdialog.h"
 #endif
 #include "reporteditordialog.h"
+#include "versiondialog.h"
 
 #include <QDebug>
 
@@ -555,4 +556,8 @@ void MainWindow::saveSettings()
        s.endGroup();
 }
 
-
+void MainWindow::on_actionAboutLocalMyList_triggered()
+{
+       VersionDialog d;
+       d.exec();
+}
index 78f458c7547675fcc96bcc12c2cc4adb72113735..d9f2f12a895e00109d30f7461b682f7ba8d1e951 100644 (file)
@@ -86,6 +86,8 @@ private slots:
        void on_addReport_clicked();
        void on_tabWidget_currentChanged(int idx);
 
+       void on_actionAboutLocalMyList_triggered();
+
 protected:
        void dragEnterEvent(QDragEnterEvent *event);
        void dropEvent(QDropEvent *event);
index bc478681daad9d532ab95a4f50638c001ca20ea7..635818628fb52514cabb076b8b249918d8f8a8ee 100644 (file)
     <addaction name="actionClearAnimeTitleData"/>
     <addaction name="separator"/>
    </widget>
+   <widget class="QMenu" name="menu_Help">
+    <property name="title">
+     <string>&amp;Help</string>
+    </property>
+    <addaction name="actionAboutLocalMyList"/>
+   </widget>
    <addaction name="menuConnection"/>
    <addaction name="menu_Actions"/>
    <addaction name="menuSettings"/>
+   <addaction name="menu_Help"/>
   </widget>
   <widget class="QToolBar" name="mainToolBar">
    <attribute name="toolBarArea">
     <string>Import Titles from Web</string>
    </property>
   </action>
+  <action name="actionAboutLocalMyList">
+   <property name="text">
+    <string>About LocalMyList...</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
index 08ad5853eca6163f9e72c8eef62b1a79fbf58b4b..0c3fdea2526c1d1cdbe88af2eca64e5ec317d70c 100644 (file)
@@ -14,13 +14,15 @@ SOURCES += main.cpp\
        databaseconnectiondialog.cpp \
        mylistview.cpp \
        mylistfiltermodel.cpp \
-       reporteditordialog.cpp
+       reporteditordialog.cpp \
+       versiondialog.cpp
 
 HEADERS += mainwindow.h \
        databaseconnectiondialog.h \
        mylistview.h \
        mylistfiltermodel.h \
-       reporteditordialog.h
+       reporteditordialog.h \
+       versiondialog.h
 
 FORMS += mainwindow.ui \
        databaseconnectiondialog.ui
diff --git a/management-gui/versiondialog.cpp b/management-gui/versiondialog.cpp
new file mode 100644 (file)
index 0000000..3151a81
--- /dev/null
@@ -0,0 +1,58 @@
+#include "versiondialog.h"
+
+#include <QGridLayout>
+#include <QLabel>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <QSysInfo>
+#include <QApplication>
+#include "mylist.h"
+
+VersionDialog::VersionDialog(QWidget *parent) : QDialog(parent)
+{
+       setWindowTitle(tr("About %1").arg(qApp->applicationName()));
+
+       setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+       QGridLayout *layout = new QGridLayout(this);
+       layout->setSizeConstraint(QLayout::SetFixedSize);
+
+       QString revision;
+       if (LocalMyList::MyList::revision())
+               revision = tr("from revision %1").arg(LocalMyList::MyList::revision());
+
+       const QString description = tr(
+               "<h3>%1 %2 <font size=\"3\">(%7 bit)</font></h3>"
+               "<p>Built with\tQt %3<br/>"
+               "Running with\tQt %4<br/>"
+               "<br/>"
+               "Built on " __DATE__ " at " __TIME__ " "
+               "%6"
+               "<br/>"
+               "<br/>"
+               "Copyright (C) 2009 %5. All rights reserved.</p>"
+               "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND, "
+               "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
+               "PARTICULAR PURPOSE.</p>")
+               .arg(qApp->applicationName())
+               .arg(qApp->applicationVersion())
+               .arg(QLatin1String(QT_VERSION_STR))
+               .arg(QLatin1String(qVersion()))
+               .arg(qApp->organizationName())
+               .arg(revision)
+               .arg(QSysInfo::WordSize);
+
+       QLabel *copyrightLabel = new QLabel(description);
+       copyrightLabel->setWordWrap(true);
+       copyrightLabel->setOpenExternalLinks(true);
+       copyrightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
+
+       QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+       QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
+
+       buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
+       connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
+
+       layout->addWidget(copyrightLabel, 0, 1, 4, 4);
+       layout->addWidget(buttonBox, 4, 0, 1, 5);
+}
diff --git a/management-gui/versiondialog.h b/management-gui/versiondialog.h
new file mode 100644 (file)
index 0000000..05cbd9e
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef VERSIONDIALOG_H
+#define VERSIONDIALOG_H
+
+#include <QDialog>
+
+class VersionDialog : public QDialog
+{
+public:
+       VersionDialog(QWidget *parent = 0);
+};
+
+#endif // VERSIONDIALOG_H