Seamly2D
Code documentation
mapplication.h
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 mapplication.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 8 7, 2015
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) 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 #ifndef MAPPLICATION_H
53 #define MAPPLICATION_H
54 
55 #include "../vpatterndb/vtranslatevars.h"
56 #include "../vmisc/def.h"
57 #include "../vmisc/vseamlymesettings.h"
58 #include "../vmisc/vabstractapplication.h"
60 
61 class MApplication;// use in define
62 class TMainWindow;
63 class QLocalServer;
64 
65 #if defined(qApp)
66 #undef qApp
67 #endif
68 #define qApp (static_cast<MApplication*>(VAbstractApplication::instance()))
69 
70 enum class SocketConnection : bool {Client = false, Server = true};
71 
73 {
74  Q_OBJECT
75 
76 public:
77  MApplication(int &argc, char **argv);
78  virtual ~MApplication() Q_DECL_OVERRIDE;
79 
80  virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE;
81 
82  bool IsTestMode() const;
83  virtual bool IsAppInGUIMode() const Q_DECL_OVERRIDE;
87 
88  void InitOptions();
89 
90  virtual const VTranslateVars *TrVars() Q_DECL_OVERRIDE;
91 
92  virtual void OpenSettings() Q_DECL_OVERRIDE;
94 
95  void ShowDataBase();
96  void retranslateGroups();
97  void RetranslateTables();
98 
99  void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
100 
101 public slots:
102  void ProcessCMD();
103 
104 protected:
105  virtual void InitTrVars() Q_DECL_OVERRIDE;
106  virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
107 
108 private slots:
110 
111 private:
112  Q_DISABLE_COPY(MApplication)
114  QLocalServer *localServer;
117  bool testMode;
118 
119  void Clean();
120 };
121 
122 #endif // MAPPLICATION_H
QLocalServer * localServer
Definition: mapplication.h:114
virtual bool notify(QObject *receiver, QEvent *event) Q_DECL_OVERRIDE
notify Reimplemented from QApplication::notify().
void NewLocalSocketConnection()
void RetranslateTables()
virtual bool IsAppInGUIMode() const Q_DECL_OVERRIDE
IsAppInGUIMode little hack that allow to have access to application state from VAbstractApplication c...
bool IsTestMode() const
virtual void OpenSettings() Q_DECL_OVERRIDE
MApplication(int &argc, char **argv)
QList< TMainWindow * > MainWindows()
void InitOptions()
virtual ~MApplication() Q_DECL_OVERRIDE
virtual const VTranslateVars * TrVars() Q_DECL_OVERRIDE
virtual void InitTrVars() Q_DECL_OVERRIDE
void ShowDataBase()
void retranslateGroups()
virtual bool event(QEvent *e) Q_DECL_OVERRIDE
QPointer< MeasurementDatabaseDialog > dataBase
Definition: mapplication.h:116
TMainWindow * MainWindow()
VTranslateVars * trVars
Definition: mapplication.h:115
VSeamlyMeSettings * SeamlyMeSettings()
QList< QPointer< TMainWindow > > mainWindows
Definition: mapplication.h:113
TMainWindow * NewMainWindow()
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
SocketConnection
Definition: mapplication.h:70