Dialog about app.
--HG-- branch : feature
This commit is contained in:
parent
4a96b92d93
commit
47c5a2dc99
97
src/app/tape/dialogs/dialogabouttape.cpp
Normal file
97
src/app/tape/dialogs/dialogabouttape.cpp
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogabouttape.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 7, 2015
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2015 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "dialogabouttape.h"
|
||||||
|
#include "ui_dialogabouttape.h"
|
||||||
|
#include "../version.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogAboutTape::DialogAboutTape(QWidget *parent)
|
||||||
|
:QDialog(parent),
|
||||||
|
ui(new Ui::DialogAboutTape)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
//qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
|
ui->label_Tape_Version->setText(QString("Tape %1").arg(APP_VERSION_STR));
|
||||||
|
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(BUILD_REVISION));
|
||||||
|
ui->label_QT_Version->setText(buildCompatibilityString());
|
||||||
|
|
||||||
|
QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
|
||||||
|
ui->label_Tape_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__));
|
||||||
|
|
||||||
|
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
|
||||||
|
"The program is provided AS IS with NO WARRANTY OF ANY "
|
||||||
|
"KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY "
|
||||||
|
"AND FITNESS FOR A PARTICULAR PURPOSE."));
|
||||||
|
|
||||||
|
|
||||||
|
ui->pushButton_Web_Site->setText(tr("Web site : %1")
|
||||||
|
.arg(VER_COMPANYDOMAIN_STR));
|
||||||
|
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, &DialogAboutTape::WebButtonClicked);
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
|
||||||
|
|
||||||
|
// By default on Windows font point size 8 points we need 11 like on Linux.
|
||||||
|
FontPointSize(ui->label_Legal_Stuff, 11);
|
||||||
|
FontPointSize(ui->label_Tape_Built, 11);
|
||||||
|
FontPointSize(ui->label_QT_Version, 11);
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
setMaximumSize(size());
|
||||||
|
setMinimumSize(size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogAboutTape::~DialogAboutTape()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogAboutTape::WebButtonClicked()
|
||||||
|
{
|
||||||
|
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Warning"), tr("Cannot open your default browser"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
|
||||||
|
{
|
||||||
|
SCASSERT(w != nullptr);
|
||||||
|
|
||||||
|
QFont font = w->font();
|
||||||
|
font.setPointSize(pointSize);
|
||||||
|
w->setFont(font);
|
||||||
|
}
|
56
src/app/tape/dialogs/dialogabouttape.h
Normal file
56
src/app/tape/dialogs/dialogabouttape.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogabouttape.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 7, 2015
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2015 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DIALOGABOUTTAPE_H
|
||||||
|
#define DIALOGABOUTTAPE_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DialogAboutTape;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogAboutTape : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DialogAboutTape(QWidget *parent = 0);
|
||||||
|
~DialogAboutTape();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void WebButtonClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogAboutTape)
|
||||||
|
Ui::DialogAboutTape *ui;
|
||||||
|
|
||||||
|
void FontPointSize(QWidget *w, int pointSize);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGABOUTTAPE_H
|
236
src/app/tape/dialogs/dialogabouttape.ui
Normal file
236
src/app/tape/dialogs/dialogabouttape.ui
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogAboutTape</class>
|
||||||
|
<widget class="QDialog" name="DialogAboutTape">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>559</width>
|
||||||
|
<height>241</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</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/tapeicon.qrc">:/tapeicon/64x64/logo.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_Tape_Version">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>15</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tape version</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="labelBuildRevision">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Build revision:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>This program is part of Valentina project.</string>
|
||||||
|
</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 notr="true">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_Tape_Built">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">label_Tape_Built</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_QT_Version">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">label_QT_Version</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_Legal_Stuff">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">label_Legal_Stuff</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../share/resources/tapeicon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -5,12 +5,15 @@ SOURCES += \
|
||||||
$$PWD/main.cpp \
|
$$PWD/main.cpp \
|
||||||
$$PWD/tmainwindow.cpp \
|
$$PWD/tmainwindow.cpp \
|
||||||
$$PWD/stable.cpp \
|
$$PWD/stable.cpp \
|
||||||
$$PWD/mapplication.cpp
|
$$PWD/mapplication.cpp \
|
||||||
|
dialogs/dialogabouttape.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/tmainwindow.h \
|
$$PWD/tmainwindow.h \
|
||||||
$$PWD/stable.h \
|
$$PWD/stable.h \
|
||||||
$$PWD/mapplication.h
|
$$PWD/mapplication.h \
|
||||||
|
dialogs/dialogabouttape.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tmainwindow.ui
|
$$PWD/tmainwindow.ui \
|
||||||
|
dialogs/dialogabouttape.ui
|
||||||
|
|
|
@ -98,7 +98,7 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEFINES += "BUILD_REVISION=\\\"unknown\\\""
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
DEFINES += V_NO_ASSERT
|
DEFINES += V_NO_ASSERT
|
||||||
|
@ -117,6 +117,25 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_LFLAGS_RELEASE =
|
QMAKE_LFLAGS_RELEASE =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macx{
|
||||||
|
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
||||||
|
}else {
|
||||||
|
HG = hg # All other platforms all OK.
|
||||||
|
}
|
||||||
|
|
||||||
|
#build revision number for using in version
|
||||||
|
unix {
|
||||||
|
HG_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
||||||
|
} else {
|
||||||
|
# Use escape character before "|" on Windows
|
||||||
|
HG_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
||||||
|
}
|
||||||
|
isEmpty(HG_HESH){
|
||||||
|
HG_HESH = "unknown" # if we can't find build revision left unknown.
|
||||||
|
}
|
||||||
|
message("Build revision:" $${HG_HESH})
|
||||||
|
DEFINES += "BUILD_REVISION=\\\"$${HG_HESH}\\\"" # Make available build revision number in sources.
|
||||||
}
|
}
|
||||||
|
|
||||||
# Path to recource file.
|
# Path to recource file.
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "tmainwindow.h"
|
#include "tmainwindow.h"
|
||||||
#include "ui_tmainwindow.h"
|
#include "ui_tmainwindow.h"
|
||||||
#include "mapplication.h"
|
#include "mapplication.h"
|
||||||
|
#include "dialogs/dialogabouttape.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TMainWindow::TMainWindow(QWidget *parent)
|
TMainWindow::TMainWindow(QWidget *parent)
|
||||||
|
@ -108,7 +109,9 @@ void TMainWindow::ShowWindow()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::AboutApplication()
|
void TMainWindow::AboutApplication()
|
||||||
{
|
{
|
||||||
|
DialogAboutTape * aboutDialog = new DialogAboutTape(this);
|
||||||
|
aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
aboutDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user