2015-07-10 13:14:55 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file mapplication.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 8 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef MAPPLICATION_H
|
|
|
|
#define MAPPLICATION_H
|
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
#include "../vpatterndb/vtranslatevars.h"
|
|
|
|
#include "../vmisc/def.h"
|
|
|
|
#include "../vmisc/vtapesettings.h"
|
2015-07-24 14:06:53 +02:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
2015-08-01 15:56:37 +02:00
|
|
|
#include "dialogs/dialogmdatabase.h"
|
2015-07-15 09:16:59 +02:00
|
|
|
|
|
|
|
class MApplication;// use in define
|
2015-07-10 13:14:55 +02:00
|
|
|
class TMainWindow;
|
|
|
|
class QLocalServer;
|
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
#if defined(qApp)
|
|
|
|
#undef qApp
|
|
|
|
#endif
|
2015-07-24 14:06:53 +02:00
|
|
|
#define qApp (static_cast<MApplication*>(VAbstractApplication::instance()))
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-10-03 16:16:28 +02:00
|
|
|
enum class SocketConnection : bool {Client = false, Server = true};
|
|
|
|
|
2015-07-24 14:06:53 +02:00
|
|
|
class MApplication : public VAbstractApplication
|
2015-07-10 13:14:55 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MApplication(int &argc, char **argv);
|
|
|
|
virtual ~MApplication() Q_DECL_OVERRIDE;
|
2015-09-19 22:08:03 +02:00
|
|
|
|
|
|
|
virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE;
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2015-09-28 12:42:26 +02:00
|
|
|
bool IsTestMode() const;
|
2016-05-03 18:50:37 +02:00
|
|
|
virtual bool IsAppInGUIMode() const Q_DECL_OVERRIDE;
|
2015-07-10 13:14:55 +02:00
|
|
|
TMainWindow *MainWindow();
|
|
|
|
QList<TMainWindow*> MainWindows();
|
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
void InitOptions();
|
|
|
|
|
2015-09-19 21:58:32 +02:00
|
|
|
virtual const VTranslateVars *TrVars() Q_DECL_OVERRIDE;
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-07-24 14:06:53 +02:00
|
|
|
virtual void OpenSettings() Q_DECL_OVERRIDE;
|
|
|
|
VTapeSettings *TapeSettings();
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-08-01 11:39:32 +02:00
|
|
|
QString diagramsPath() const;
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-08-01 15:56:37 +02:00
|
|
|
void ShowDataBase();
|
2015-08-08 16:33:37 +02:00
|
|
|
void RetranslateGroups();
|
|
|
|
void RetranslateTables();
|
2015-08-01 15:56:37 +02:00
|
|
|
|
2015-10-03 16:16:28 +02:00
|
|
|
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
2015-08-20 12:56:55 +02:00
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
public slots:
|
|
|
|
TMainWindow *NewMainWindow();
|
2015-10-11 11:06:14 +02:00
|
|
|
void ProcessCMD();
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2015-09-19 21:58:32 +02:00
|
|
|
protected:
|
|
|
|
virtual void InitTrVars() Q_DECL_OVERRIDE;
|
2015-11-19 16:17:25 +01:00
|
|
|
virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
|
2015-09-19 21:58:32 +02:00
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
private slots:
|
|
|
|
void OpenFile(const QString &path);
|
|
|
|
void NewLocalSocketConnection();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(MApplication)
|
|
|
|
QList<QPointer<TMainWindow> > mainWindows;
|
|
|
|
QLocalServer *localServer;
|
2015-07-15 09:16:59 +02:00
|
|
|
VTranslateVars *trVars;
|
2015-08-01 15:56:37 +02:00
|
|
|
QPointer<DialogMDataBase> dataBase;
|
2015-09-28 12:42:26 +02:00
|
|
|
bool testMode;
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
void Clean();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAPPLICATION_H
|