Issue # 139 & 140

--HG--
branch : develop
This commit is contained in:
Patrick Proy 2014-05-06 16:28:49 +02:00
parent 665a65a8f5
commit be34eaa657
6 changed files with 375 additions and 11 deletions

View File

@ -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"));
}
}

View File

@ -0,0 +1,29 @@
#ifndef DIALOGABOUTAPP_H
#define DIALOGABOUTAPP_H
#include <QDialog>
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

View File

@ -0,0 +1,299 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogAboutApp</class>
<widget class="QDialog" name="DialogAboutApp">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>356</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="windowTitle">
<string>About Valentina</string>
</property>
<property name="windowIcon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>0</x>
<y>320</y>
<width>401</width>
<height>41</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>381</width>
<height>301</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="label_appIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../share/resources/icon.qrc">:/icon/64x64/icon64x64.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_Valentina_Version">
<property name="font">
<font>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Valentina version</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Web_Site">
<property name="palette">
<palette>
<active>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>pushButton_Web_Site</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_contrib_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Contributors</string>
</property>
<property name="indent">
<number>3</number>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_Contributors">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="autoFormatting">
<set>QTextEdit::AutoNone</set>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;dismine Sabine Schmaltz&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Susan Spencer grumpi&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Roman Telezhinsky Steve Conklin&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;luzpazB cosina&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Christine&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Valentina_Built">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">label_Valentina_Built</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_QT_Version">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>label_QT_Version</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Legal_Stuff">
<property name="text">
<string notr="true">label_Legal_Stuff</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../../share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogAboutApp</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogAboutApp</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -57,5 +57,6 @@
#include "app/dialogmeasurements.h" #include "app/dialogmeasurements.h"
#include "app/dialogindividualmeasurements.h" #include "app/dialogindividualmeasurements.h"
#include "app/dialogstandardmeasurements.h" #include "app/dialogstandardmeasurements.h"
#include "app/dialogaboutapp.h"
#endif // DIALOGS_H #endif // DIALOGS_H

View File

@ -28,7 +28,8 @@ HEADERS += \
dialogs/app/dialogpatternproperties.h \ dialogs/app/dialogpatternproperties.h \
dialogs/app/dialogmeasurements.h \ dialogs/app/dialogmeasurements.h \
dialogs/app/dialogstandardmeasurements.h \ dialogs/app/dialogstandardmeasurements.h \
dialogs/app/dialogindividualmeasurements.h dialogs/app/dialogindividualmeasurements.h \
dialogs/app/dialogaboutapp.h
SOURCES += \ SOURCES += \
dialogs/tools/dialogtriangle.cpp \ dialogs/tools/dialogtriangle.cpp \
@ -59,7 +60,8 @@ SOURCES += \
dialogs/app/dialogpatternproperties.cpp \ dialogs/app/dialogpatternproperties.cpp \
dialogs/app/dialogmeasurements.cpp \ dialogs/app/dialogmeasurements.cpp \
dialogs/app/dialogstandardmeasurements.cpp \ dialogs/app/dialogstandardmeasurements.cpp \
dialogs/app/dialogindividualmeasurements.cpp dialogs/app/dialogindividualmeasurements.cpp \
dialogs/app/dialogaboutapp.cpp
FORMS += \ FORMS += \
dialogs/tools/dialogtriangle.ui \ dialogs/tools/dialogtriangle.ui \
@ -87,4 +89,5 @@ FORMS += \
dialogs/app/dialogpatternproperties.ui \ dialogs/app/dialogpatternproperties.ui \
dialogs/app/dialogmeasurements.ui \ dialogs/app/dialogmeasurements.ui \
dialogs/app/dialogstandardmeasurements.ui \ dialogs/app/dialogstandardmeasurements.ui \
dialogs/app/dialogindividualmeasurements.ui dialogs/app/dialogindividualmeasurements.ui \
dialogs/app/dialogaboutapp.ui

View File

@ -502,14 +502,9 @@ void MainWindow::ClosedDialogCutArc(int result)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::About() void MainWindow::About()
{ {
QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); DialogAboutApp * about_dialog = new DialogAboutApp(this);
about_dialog->setAttribute(Qt::WA_DeleteOnClose,true);
QString fullName = QString("Valentina %1").arg(APP_VERSION); about_dialog->show();
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("<h1>%1</h1> %2 <br/><br/> %3 <br/><br/> %4")).arg(fullName).arg(qtBase).arg(buildOn)
.arg(WARRANTY);
QMessageBox::about(this, tr("About Valentina"), about);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------