Seamly2D
Code documentation
main.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
* *
3
* Copyright (C) 2017 Seamly, LLC *
4
* *
5
* https://github.com/fashionfreedom/seamly2d *
6
* *
7
***************************************************************************
8
**
9
** Seamly2D is free software: you can redistribute it and/or modify
10
** it under the terms of the GNU General Public License as published by
11
** the Free Software Foundation, either version 3 of the License, or
12
** (at your option) any later version.
13
**
14
** Seamly2D is distributed in the hope that it will be useful,
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
** GNU General Public License for more details.
18
**
19
** You should have received a copy of the GNU General Public License
20
** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21
**
22
**************************************************************************
23
24
************************************************************************
25
**
26
** @file main.cpp
27
** @author Roman Telezhynskyi <dismine(at)gmail.com>
28
** @date November 15, 2013
29
**
30
** @brief
31
** @copyright
32
** This source code is part of the Valentine project, a pattern making
33
** program, whose allow create and modeling patterns of clothing.
34
** Copyright (C) 2013-2015 Seamly2D project
35
** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36
**
37
** Seamly2D is free software: you can redistribute it and/or modify
38
** it under the terms of the GNU General Public License as published by
39
** the Free Software Foundation, either version 3 of the License, or
40
** (at your option) any later version.
41
**
42
** Seamly2D is distributed in the hope that it will be useful,
43
** but WITHOUT ANY WARRANTY; without even the implied warranty of
44
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
** GNU General Public License for more details.
46
**
47
** You should have received a copy of the GNU General Public License
48
** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49
**
50
*************************************************************************/
51
52
/*
53
* @brief entry point of Seamly2D application
54
* @return non-zero value is code of the error
55
*/
56
57
#include "
mainwindow.h
"
58
#include "
core/vapplication.h
"
59
#include "../vpatterndb/vpiecenode.h"
60
61
#include <QApplication>
62
#include <QMessageBox>
// For QT_REQUIRE_VERSION
63
#include <QTimer>
64
65
//---------------------------------------------------------------------------------------------------------------------
66
67
int
main
(
int
argc,
char
*argv[])
68
{
69
Q_INIT_RESOURCE(cursor);
70
Q_INIT_RESOURCE(icon);
71
Q_INIT_RESOURCE(schema);
72
Q_INIT_RESOURCE(theme);
73
Q_INIT_RESOURCE(flags);
74
Q_INIT_RESOURCE(icons);
75
Q_INIT_RESOURCE(toolicon);
76
Q_INIT_RESOURCE(sounds);
77
78
QT_REQUIRE_VERSION(argc, argv,
"5.15.2"
);
79
80
// Need to internally move a node inside a piece main path
81
qRegisterMetaTypeStreamOperators<VPieceNode>(
"VPieceNode"
);
82
83
//------------------------------------------------------------------------
84
// On macOS, correct WebView / QtQuick compositing and stacking requires running
85
// Qt in layer-backed mode, which again requires rendering on the Gui thread.
86
qWarning(
"Seamly2D: Setting QT_MAC_WANTS_LAYER=1 and QSG_RENDER_LOOP=basic"
);
87
qputenv(
"QT_MAC_WANTS_LAYER"
,
"1"
);
88
//------------------------------------------------------------------------
89
90
#ifndef Q_OS_MAC
// supports natively
91
InitHighDpiScaling
(argc, argv);
92
#endif
//Q_OS_MAC
93
94
VApplication
app(argc, argv);
95
96
app.
InitOptions
();
97
98
MainWindow
w;
99
#if !defined(Q_OS_MAC)
100
app.setWindowIcon(QIcon(
":/icon/64x64/icon64x64.png"
));
101
#endif
// !defined(Q_OS_MAC)
102
app.
setMainWindow
(&w);
103
104
int
msec = 0;
105
//Before we load pattern show window.
106
if
(
VApplication::IsGUIMode
())
107
{
108
w.show();
109
msec = 15;
// set delay for correct the first fitbest zoom
110
}
111
112
QTimer::singleShot(msec, &w, SLOT(ProcessCMD()));
113
114
return
app.exec();
115
}
main
int main(int argc, char *argv[])
Definition:
main.cpp:67
MainWindow
The MainWindow class main windows.
Definition:
mainwindow.h:87
VAbstractApplication::setMainWindow
void setMainWindow(QWidget *value)
Definition:
vabstractapplication.cpp:188
VApplication
The VApplication class reimplamentation QApplication class.
Definition:
vapplication.h:73
VApplication::IsGUIMode
static bool IsGUIMode()
Definition:
vapplication.cpp:719
VApplication::InitOptions
void InitOptions()
Definition:
vapplication.cpp:570
InitHighDpiScaling
void InitHighDpiScaling(int argc, char *argv[])
Definition:
def.cpp:551
mainwindow.h
vapplication.h
src
app
seamly2d
main.cpp
Generated by
1.9.1