2015-07-10 13:14:55 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file mapplication.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 8 7, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-07-10 13:14:55 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-07-10 13:14:55 +02:00
|
|
|
**
|
|
|
|
** 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"
|
2020-05-10 17:32:14 +02:00
|
|
|
#include "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
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
class TMainWindow;
|
|
|
|
class QLocalServer;
|
|
|
|
|
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);
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual ~MApplication() override;
|
2015-09-19 22:08:03 +02:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual bool notify(QObject * receiver, QEvent * event) override;
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2015-09-28 12:42:26 +02:00
|
|
|
bool IsTestMode() const;
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual bool IsAppInGUIMode() const override;
|
2015-07-10 13:14:55 +02:00
|
|
|
TMainWindow *MainWindow();
|
|
|
|
QList<TMainWindow*> MainWindows();
|
2016-07-18 17:09:15 +02:00
|
|
|
TMainWindow *NewMainWindow();
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
void InitOptions();
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual const VTranslateVars *TrVars() override;
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void OpenSettings() override;
|
2015-07-24 14:06:53 +02:00
|
|
|
VTapeSettings *TapeSettings();
|
2020-02-16 18:18:39 +01:00
|
|
|
void ActivateDarkMode();
|
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
|
|
|
|
2021-02-06 14:52:21 +01:00
|
|
|
static MApplication *VApp();
|
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
public slots:
|
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:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void InitTrVars() override;
|
|
|
|
virtual bool event(QEvent *e) override;
|
2015-09-19 21:58:32 +02:00
|
|
|
|
2019-07-01 11:47:06 +02:00
|
|
|
protected slots:
|
|
|
|
virtual void AboutToQuit() override;
|
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
private slots:
|
|
|
|
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();
|
|
|
|
};
|
2018-02-03 11:45:16 +01:00
|
|
|
|
2020-05-10 17:35:15 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2018-02-03 11:45:16 +01:00
|
|
|
inline const VTranslateVars *MApplication::TrVars()
|
|
|
|
{
|
|
|
|
return trVars;
|
|
|
|
}
|
2015-07-10 13:14:55 +02:00
|
|
|
|
|
|
|
#endif // MAPPLICATION_H
|