2015-07-12 19:38:30 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @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"
|
2016-07-15 12:14:48 +02:00
|
|
|
#include "../fervor/fvupdater.h"
|
2015-07-12 19:38:30 +02:00
|
|
|
|
2015-08-08 16:33:37 +02:00
|
|
|
#include <QDate>
|
2015-07-12 19:38:30 +02:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QMessageBox>
|
2015-11-05 14:01:33 +01:00
|
|
|
#include <QShowEvent>
|
2015-10-18 21:30:51 +02:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QtDebug>
|
2015-07-12 19:38:30 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogAboutTape::DialogAboutTape(QWidget *parent)
|
|
|
|
:QDialog(parent),
|
2015-11-05 14:01:33 +01:00
|
|
|
ui(new Ui::DialogAboutTape),
|
|
|
|
isInitialized(false)
|
2015-07-12 19:38:30 +02:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2017-01-03 09:46:28 +01:00
|
|
|
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
2015-07-12 19:38:30 +02:00
|
|
|
|
2015-08-08 16:33:37 +02:00
|
|
|
RetranslateUi();
|
2016-12-21 19:45:14 +01:00
|
|
|
connect(ui->pushButton_Web_Site, &QPushButton::clicked, RECEIVER(this)[this]()
|
2016-07-19 19:51:12 +02:00
|
|
|
{
|
2016-07-15 12:14:48 +02:00
|
|
|
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
|
|
|
{
|
|
|
|
qWarning() << tr("Cannot open your default browser");
|
|
|
|
}
|
|
|
|
});
|
2015-07-12 19:38:30 +02:00
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
|
2016-12-21 19:45:14 +01:00
|
|
|
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
|
|
|
|
{
|
2017-01-24 14:47:25 +01:00
|
|
|
// Set feed URL before doing anything else
|
|
|
|
FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL);
|
2016-07-15 12:14:48 +02:00
|
|
|
FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent();
|
|
|
|
});
|
2015-07-12 19:38:30 +02:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogAboutTape::~DialogAboutTape()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2015-08-08 16:33:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogAboutTape::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);
|
|
|
|
}
|
|
|
|
|
2015-11-05 14:01:33 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogAboutTape::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
|
|
|
|
}
|
|
|
|
|
2015-07-12 19:38:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
|
|
|
|
{
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(w != nullptr)
|
2015-07-12 19:38:30 +02:00
|
|
|
|
|
|
|
QFont font = w->font();
|
|
|
|
font.setPointSize(pointSize);
|
|
|
|
w->setFont(font);
|
|
|
|
}
|
2015-08-08 16:33:37 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogAboutTape::RetranslateUi()
|
|
|
|
{
|
|
|
|
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());
|
|
|
|
|
2016-08-26 11:38:23 +02:00
|
|
|
const QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
|
2015-12-14 12:06:04 +01:00
|
|
|
ui->label_Tape_Built->setText(tr("Built on %1 at %2").arg(date.toString()).arg(__TIME__));
|
2015-08-08 16:33:37 +02:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|