about puzzle dialog
This commit is contained in:
parent
fbbc3ba479
commit
234529f398
|
@ -53,3 +53,6 @@ unix {
|
|||
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = src
|
||||
|
||||
RESOURCES += \
|
||||
src/app/puzzle/share/resources/tapeicon.qrc
|
||||
|
|
141
src/app/puzzle/dialogs/dialogaboutpuzzle.cpp
Normal file
141
src/app/puzzle/dialogs/dialogaboutpuzzle.cpp
Normal file
|
@ -0,0 +1,141 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogaboutpuzzle.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 11 4, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 "dialogaboutpuzzle.h"
|
||||
#include "ui_dialogaboutpuzzle.h"
|
||||
#include "../version.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../fervor/fvupdater.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QShowEvent>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogAboutPuzzle::DialogAboutPuzzle(QWidget *parent)
|
||||
:QDialog(parent),
|
||||
ui(new Ui::DialogAboutPuzzle),
|
||||
isInitialized(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
RetranslateUi();
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, []()
|
||||
{
|
||||
if ( not QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)))
|
||||
{
|
||||
qWarning() << tr("Cannot open your default browser");
|
||||
}
|
||||
});
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutPuzzle::close);
|
||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
|
||||
{
|
||||
// Set feed URL before doing anything else
|
||||
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
||||
FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent();
|
||||
});
|
||||
|
||||
// By default on Windows font point size 8 points we need 11 like on Linux.
|
||||
FontPointSize(ui->label_Legal_Stuff, 11);
|
||||
FontPointSize(ui->label_Puzzle_Built, 11);
|
||||
FontPointSize(ui->label_QT_Version, 11);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogAboutPuzzle::~DialogAboutPuzzle()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutPuzzle::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
RetranslateUi();
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutPuzzle::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event );
|
||||
if ( event->spontaneous() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// do your init stuff here
|
||||
|
||||
setMaximumSize(size());
|
||||
setMinimumSize(size());
|
||||
|
||||
isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutPuzzle::FontPointSize(QWidget *w, int pointSize)
|
||||
{
|
||||
SCASSERT(w != nullptr)
|
||||
|
||||
QFont font = w->font();
|
||||
font.setPointSize(pointSize);
|
||||
w->setFont(font);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutPuzzle::RetranslateUi()
|
||||
{
|
||||
ui->label_Puzzle_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());
|
||||
|
||||
const QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
|
||||
ui->label_Puzzle_Built->setText(tr("Built on %1 at %2").arg(date.toString(), __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));
|
||||
}
|
61
src/app/puzzle/dialogs/dialogaboutpuzzle.h
Normal file
61
src/app/puzzle/dialogs/dialogaboutpuzzle.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogaboutpuzzle.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 11 4, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 DIALOGABOUTPUZZLE_H
|
||||
#define DIALOGABOUTPUZZLE_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAboutPuzzle;
|
||||
}
|
||||
|
||||
class DialogAboutPuzzle : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogAboutPuzzle(QWidget *parent = nullptr);
|
||||
virtual ~DialogAboutPuzzle();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogAboutPuzzle)
|
||||
Ui::DialogAboutPuzzle *ui;
|
||||
bool isInitialized;
|
||||
|
||||
void FontPointSize(QWidget *w, int pointSize);
|
||||
|
||||
void RetranslateUi();
|
||||
};
|
||||
|
||||
#endif // DIALOGABOUTPUZZLE_H
|
296
src/app/puzzle/dialogs/dialogaboutpuzzle.ui
Normal file
296
src/app/puzzle/dialogs/dialogaboutpuzzle.ui
Normal file
|
@ -0,0 +1,296 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogAboutPuzzle</class>
|
||||
<widget class="QDialog" name="DialogAboutPuzzle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>462</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About Tape</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../tape/share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</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/puzzleicon.qrc">:/puzzleicon/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_Puzzle_Version">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Puzzle version</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</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>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</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_Puzzle_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>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">label_Tape_Built</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">label_QT_Version</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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>0</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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonCheckUpdate">
|
||||
<property name="text">
|
||||
<string>Check For Updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../share/resources/puzzleicon.qrc"/>
|
||||
<include location="../../tape/share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -4,14 +4,17 @@
|
|||
SOURCES += \
|
||||
$$PWD/main.cpp \
|
||||
$$PWD/puzzlemainwindow.cpp \
|
||||
$$PWD/puzzleapplication.cpp
|
||||
$$PWD/puzzleapplication.cpp \
|
||||
$$PWD/dialogs/dialogaboutpuzzle.cpp
|
||||
|
||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/puzzlemainwindow.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/puzzleapplication.h
|
||||
$$PWD/puzzleapplication.h \
|
||||
$$PWD/dialogs/dialogaboutpuzzle.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/puzzlemainwindow.ui
|
||||
$$PWD/puzzlemainwindow.ui \
|
||||
$$PWD/dialogs/dialogaboutpuzzle.ui
|
||||
|
|
|
@ -333,3 +333,5 @@ CONFIG(release, debug|release){
|
|||
QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app
|
||||
}
|
||||
}
|
||||
|
||||
FORMS +=
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
#include "puzzlemainwindow.h"
|
||||
#include "ui_puzzlemainwindow.h"
|
||||
#include "dialogs/dialogaboutpuzzle.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PuzzleMainWindow::PuzzleMainWindow(QWidget *parent) :
|
||||
|
@ -166,12 +167,9 @@ void PuzzleMainWindow::AboutQt()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::AboutPuzzle()
|
||||
{
|
||||
// just for test purpuses, to be removed:
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("TODO PuzzleMainWindow::AboutPuzzle");
|
||||
int ret = msgBox.exec();
|
||||
|
||||
// TODO
|
||||
auto *aboutDialog = new DialogAboutPuzzle(this);
|
||||
aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
aboutDialog->show();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user