2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file main.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2013-11-15 13:41:26 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-06-20 16:09:50 +02:00
|
|
|
#include "mainwindow.h"
|
2014-09-25 17:44:06 +02:00
|
|
|
#include "core/vapplication.h"
|
2016-07-15 11:00:00 +02:00
|
|
|
#include "../fervor/fvupdater.h"
|
2016-11-04 16:34:15 +01:00
|
|
|
#include "../vpatterndb/vpiecenode.h"
|
2016-07-15 11:00:00 +02:00
|
|
|
|
2015-06-25 12:42:49 +02:00
|
|
|
#include <QMessageBox> // For QT_REQUIRE_VERSION
|
2015-10-18 21:30:51 +02:00
|
|
|
#include <QTimer>
|
2015-06-25 12:42:49 +02:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-08-25 19:53:03 +02:00
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2019-11-28 18:00:23 +01:00
|
|
|
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
|
|
|
|
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
|
|
|
|
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
|
|
|
|
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
|
|
|
|
*/
|
|
|
|
VAbstractApplication::SetICUData(argc, argv);
|
|
|
|
#endif
|
|
|
|
|
2014-02-07 17:12:18 +01:00
|
|
|
Q_INIT_RESOURCE(cursor);
|
|
|
|
Q_INIT_RESOURCE(icon);
|
|
|
|
Q_INIT_RESOURCE(schema);
|
|
|
|
Q_INIT_RESOURCE(theme);
|
2014-12-05 13:52:24 +01:00
|
|
|
Q_INIT_RESOURCE(flags);
|
2015-04-11 16:30:49 +02:00
|
|
|
Q_INIT_RESOURCE(icons);
|
2015-06-08 11:29:50 +02:00
|
|
|
Q_INIT_RESOURCE(toolicon);
|
2018-10-29 13:05:49 +01:00
|
|
|
Q_INIT_RESOURCE(style);
|
2014-02-07 17:12:18 +01:00
|
|
|
|
2019-11-28 15:42:06 +01:00
|
|
|
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
|
|
|
|
|
2017-12-10 12:17:04 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
VAbstractApplication::WinAttachConsole();
|
|
|
|
#endif
|
|
|
|
|
2017-03-28 11:08:33 +02:00
|
|
|
// Need to internally move a node inside a piece main path
|
|
|
|
qRegisterMetaTypeStreamOperators<VPieceNode>("VPieceNode");
|
2018-12-21 12:01:32 +01:00
|
|
|
// Need to internally move a node inside a custom seam allowance path
|
|
|
|
qRegisterMetaTypeStreamOperators<CustomSARecord>("CustomSARecord");
|
2017-03-28 11:08:33 +02:00
|
|
|
|
2017-02-09 14:43:17 +01:00
|
|
|
#ifndef Q_OS_MAC // supports natively
|
|
|
|
InitHighDpiScaling(argc, argv);
|
|
|
|
#endif //Q_OS_MAC
|
2016-11-04 11:47:10 +01:00
|
|
|
|
2013-10-01 20:15:59 +02:00
|
|
|
VApplication app(argc, argv);
|
2015-06-11 14:24:38 +02:00
|
|
|
app.InitOptions();
|
2014-02-19 22:34:57 +01:00
|
|
|
|
2019-08-23 07:17:26 +02:00
|
|
|
if (FvUpdater::IsStaledTestBuild())
|
|
|
|
{
|
|
|
|
qWarning() << QApplication::translate("Valentina",
|
|
|
|
"This test build is older than %1 days. To provide you with better "
|
|
|
|
"quality service we restrict the lifetime you can use a test build. "
|
|
|
|
"To continue using Valentina please update to newer test build. The "
|
|
|
|
"application will be shut down.")
|
|
|
|
.arg(FvUpdater::testBuildLifetime);
|
|
|
|
return V_EX_UNAVAILABLE;
|
|
|
|
}
|
|
|
|
|
2016-07-15 12:14:48 +02:00
|
|
|
if (VApplication::IsGUIMode())
|
|
|
|
{
|
|
|
|
// Set feed URL before doing anything else
|
2018-02-06 12:38:05 +01:00
|
|
|
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
2016-07-15 11:00:00 +02:00
|
|
|
|
2016-07-15 12:14:48 +02:00
|
|
|
// Check for updates automatically
|
|
|
|
FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
|
|
|
|
}
|
2016-07-15 11:00:00 +02:00
|
|
|
|
2013-06-20 16:09:50 +02:00
|
|
|
MainWindow w;
|
2015-12-05 15:16:29 +01:00
|
|
|
#if !defined(Q_OS_MAC)
|
2013-07-03 14:29:26 +02:00
|
|
|
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
|
2015-12-05 15:16:29 +01:00
|
|
|
#endif // !defined(Q_OS_MAC)
|
2014-07-08 12:59:50 +02:00
|
|
|
app.setMainWindow(&w);
|
2015-08-27 18:03:43 +02:00
|
|
|
|
2016-01-08 12:08:54 +01:00
|
|
|
int msec = 0;
|
|
|
|
//Before we load pattern show window.
|
|
|
|
if (VApplication::IsGUIMode())
|
|
|
|
{
|
|
|
|
w.show();
|
|
|
|
msec = 15; // set delay for correct the first fitbest zoom
|
|
|
|
}
|
|
|
|
|
2018-04-18 10:15:53 +02:00
|
|
|
QTimer::singleShot(msec, &w, &MainWindow::ProcessCMD);
|
2014-07-13 14:49:00 +02:00
|
|
|
|
2015-10-11 11:06:14 +02:00
|
|
|
return app.exec();
|
2013-06-20 16:09:50 +02:00
|
|
|
}
|