From be34eaa657a72ba38f4548e2b3701928b0b79cef Mon Sep 17 00:00:00 2001 From: Patrick Proy Date: Tue, 6 May 2014 16:28:49 +0200 Subject: [PATCH] Issue # 139 & 140 --HG-- branch : develop --- src/app/dialogs/app/dialogaboutapp.cpp | 37 +++ src/app/dialogs/app/dialogaboutapp.h | 29 +++ src/app/dialogs/app/dialogaboutapp.ui | 299 +++++++++++++++++++++++++ src/app/dialogs/dialogs.h | 1 + src/app/dialogs/dialogs.pri | 9 +- src/app/mainwindow.cpp | 11 +- 6 files changed, 375 insertions(+), 11 deletions(-) create mode 100644 src/app/dialogs/app/dialogaboutapp.cpp create mode 100644 src/app/dialogs/app/dialogaboutapp.h create mode 100644 src/app/dialogs/app/dialogaboutapp.ui diff --git a/src/app/dialogs/app/dialogaboutapp.cpp b/src/app/dialogs/app/dialogaboutapp.cpp new file mode 100644 index 000000000..abe3cb981 --- /dev/null +++ b/src/app/dialogs/app/dialogaboutapp.cpp @@ -0,0 +1,37 @@ +#include "dialogaboutapp.h" +#include "ui_dialogaboutapp.h" +#include "../../version.h" + +DialogAboutApp::DialogAboutApp(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogAboutApp) +{ + ui->setupUi(this); + + ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION)); + ui->label_QT_Version->setText(tr("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR)); + + QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); + ui->label_Valentina_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__)); + + ui->label_Legal_Stuff->setText(WARRANTY); + + ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR)); + connect(ui->pushButton_Web_Site, &QPushButton::clicked, + this, &DialogAboutApp::webButtonClicked ); + +} + +DialogAboutApp::~DialogAboutApp() +{ + delete ui; +} + +void DialogAboutApp::webButtonClicked() { + if ( ! QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR))) { + QMessageBox::warning(this, + tr("Warning"), + tr("Cannot open your default browser")); + } + +} diff --git a/src/app/dialogs/app/dialogaboutapp.h b/src/app/dialogs/app/dialogaboutapp.h new file mode 100644 index 000000000..7f2d6c630 --- /dev/null +++ b/src/app/dialogs/app/dialogaboutapp.h @@ -0,0 +1,29 @@ +#ifndef DIALOGABOUTAPP_H +#define DIALOGABOUTAPP_H + +#include + +namespace Ui { +class DialogAboutApp; +} + +class DialogAboutApp : public QDialog +{ + Q_OBJECT + +public: + explicit DialogAboutApp(QWidget *parent = 0); + ~DialogAboutApp(); + +private: + Ui::DialogAboutApp *ui; + Q_DISABLE_COPY(DialogAboutApp) + +private slots: + /** + * @brief Fake button clicked + */ + void webButtonClicked(); +}; + +#endif // DIALOGABOUTAPP_H diff --git a/src/app/dialogs/app/dialogaboutapp.ui b/src/app/dialogs/app/dialogaboutapp.ui new file mode 100644 index 000000000..a8fe8b008 --- /dev/null +++ b/src/app/dialogs/app/dialogaboutapp.ui @@ -0,0 +1,299 @@ + + + DialogAboutApp + + + + 0 + 0 + 398 + 356 + + + + + 0 + 0 + + + + ArrowCursor + + + Qt::NoContextMenu + + + About Valentina + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + true + + + + + 0 + 320 + 401 + 41 + + + + true + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + + + 9 + 9 + 381 + 301 + + + + + 4 + + + + + + 0 + 0 + + + + + + + :/icon/64x64/icon64x64.png + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + 15 + 75 + true + + + + Valentina version + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 120 + 120 + 120 + + + + + + + + + true + + + + PointingHandCursor + + + pushButton_Web_Site + + + false + + + true + + + + + + + + 0 + 0 + + + + Contributors + + + 3 + + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContentsOnFirstShow + + + QTextEdit::AutoNone + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">dismine Sabine Schmaltz</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Susan Spencer grumpi</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Roman Telezhinsky Steve Conklin</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">luzpazB cosina</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Christine</span></p></body></html> + + + false + + + + + + + + 0 + 0 + + + + label_Valentina_Built + + + + + + + + 0 + 0 + + + + label_QT_Version + + + + + + + label_Legal_Stuff + + + true + + + + + + + + + + + + + + buttonBox + accepted() + DialogAboutApp + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogAboutApp + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/app/dialogs/dialogs.h b/src/app/dialogs/dialogs.h index d85318e0b..a64ffcdbb 100644 --- a/src/app/dialogs/dialogs.h +++ b/src/app/dialogs/dialogs.h @@ -57,5 +57,6 @@ #include "app/dialogmeasurements.h" #include "app/dialogindividualmeasurements.h" #include "app/dialogstandardmeasurements.h" +#include "app/dialogaboutapp.h" #endif // DIALOGS_H diff --git a/src/app/dialogs/dialogs.pri b/src/app/dialogs/dialogs.pri index 7cb2470bf..62dd44ef5 100644 --- a/src/app/dialogs/dialogs.pri +++ b/src/app/dialogs/dialogs.pri @@ -28,7 +28,8 @@ HEADERS += \ dialogs/app/dialogpatternproperties.h \ dialogs/app/dialogmeasurements.h \ dialogs/app/dialogstandardmeasurements.h \ - dialogs/app/dialogindividualmeasurements.h + dialogs/app/dialogindividualmeasurements.h \ + dialogs/app/dialogaboutapp.h SOURCES += \ dialogs/tools/dialogtriangle.cpp \ @@ -59,7 +60,8 @@ SOURCES += \ dialogs/app/dialogpatternproperties.cpp \ dialogs/app/dialogmeasurements.cpp \ dialogs/app/dialogstandardmeasurements.cpp \ - dialogs/app/dialogindividualmeasurements.cpp + dialogs/app/dialogindividualmeasurements.cpp \ + dialogs/app/dialogaboutapp.cpp FORMS += \ dialogs/tools/dialogtriangle.ui \ @@ -87,4 +89,5 @@ FORMS += \ dialogs/app/dialogpatternproperties.ui \ dialogs/app/dialogmeasurements.ui \ dialogs/app/dialogstandardmeasurements.ui \ - dialogs/app/dialogindividualmeasurements.ui + dialogs/app/dialogindividualmeasurements.ui \ + dialogs/app/dialogaboutapp.ui diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 5d3a47ab0..47155b812 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -502,14 +502,9 @@ void MainWindow::ClosedDialogCutArc(int result) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::About() { - QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); - - QString fullName = QString("Valentina %1").arg(APP_VERSION); - QString qtBase(tr("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR)); - QString buildOn(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__)); - QString about = QString(tr("

%1

%2

%3

%4")).arg(fullName).arg(qtBase).arg(buildOn) - .arg(WARRANTY); - QMessageBox::about(this, tr("About Valentina"), about); + DialogAboutApp * about_dialog = new DialogAboutApp(this); + about_dialog->setAttribute(Qt::WA_DeleteOnClose,true); + about_dialog->show(); } //---------------------------------------------------------------------------------------------------------------------