From: APTX Date: Sat, 6 Apr 2013 21:43:10 +0000 (+0200) Subject: Add a version dialog to management-gui X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=97a064953b756b940a0aa3c338d6fb1abc0bb9d4;p=localmylist.git Add a version dialog to management-gui --- diff --git a/localmylist/localmylist.pro b/localmylist/localmylist.pro index 6f50ac1..279b478 100644 --- a/localmylist/localmylist.pro +++ b/localmylist/localmylist.pro @@ -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 \ diff --git a/localmylist/mylist.cpp b/localmylist/mylist.cpp index 7fe57c9..097e7ce 100644 --- a/localmylist/mylist.cpp +++ b/localmylist/mylist.cpp @@ -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; diff --git a/localmylist/mylist.h b/localmylist/mylist.h index 36d2cc6..63b7a31 100644 --- a/localmylist/mylist.h +++ b/localmylist/mylist.h @@ -99,6 +99,8 @@ public: static bool isUdpClientAvailable(); + static const char *revision(); + static bool REGISTER_QT_TYPES; static bool MANUAL_CLEANUP; diff --git a/management-gui/mainwindow.cpp b/management-gui/mainwindow.cpp index f9d4aca..9902a83 100644 --- a/management-gui/mainwindow.cpp +++ b/management-gui/mainwindow.cpp @@ -25,6 +25,7 @@ # include "renamesettingsdialog.h" #endif #include "reporteditordialog.h" +#include "versiondialog.h" #include @@ -555,4 +556,8 @@ void MainWindow::saveSettings() s.endGroup(); } - +void MainWindow::on_actionAboutLocalMyList_triggered() +{ + VersionDialog d; + d.exec(); +} diff --git a/management-gui/mainwindow.h b/management-gui/mainwindow.h index 78f458c..d9f2f12 100644 --- a/management-gui/mainwindow.h +++ b/management-gui/mainwindow.h @@ -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); diff --git a/management-gui/mainwindow.ui b/management-gui/mainwindow.ui index bc47868..6358186 100644 --- a/management-gui/mainwindow.ui +++ b/management-gui/mainwindow.ui @@ -239,9 +239,16 @@ + + + &Help + + + + @@ -383,6 +390,11 @@ Import Titles from Web + + + About LocalMyList... + + diff --git a/management-gui/management-gui.pro b/management-gui/management-gui.pro index 08ad585..0c3fdea 100644 --- a/management-gui/management-gui.pro +++ b/management-gui/management-gui.pro @@ -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 index 0000000..3151a81 --- /dev/null +++ b/management-gui/versiondialog.cpp @@ -0,0 +1,58 @@ +#include "versiondialog.h" + +#include +#include +#include +#include +#include +#include +#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( + "

%1 %2 (%7 bit)

" + "

Built with\tQt %3
" + "Running with\tQt %4
" + "
" + "Built on " __DATE__ " at " __TIME__ " " + "%6" + "
" + "
" + "Copyright (C) 2009 %5. All rights reserved.

" + "

The program is provided AS IS with NO WARRANTY OF ANY KIND, " + "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " + "PARTICULAR PURPOSE.

") + .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 index 0000000..05cbd9e --- /dev/null +++ b/management-gui/versiondialog.h @@ -0,0 +1,12 @@ +#ifndef VERSIONDIALOG_H +#define VERSIONDIALOG_H + +#include + +class VersionDialog : public QDialog +{ +public: + VersionDialog(QWidget *parent = 0); +}; + +#endif // VERSIONDIALOG_H