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"
|
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;
|
2022-08-03 13:41:19 +02:00
|
|
|
class QCommandLineParser;
|
2015-07-10 13:14:55 +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
|
|
|
{
|
2022-08-03 13:41:19 +02:00
|
|
|
Q_OBJECT // NOLINT
|
2015-07-10 13:14:55 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
MApplication(int &argc, char **argv);
|
2022-08-03 13:41:19 +02:00
|
|
|
~MApplication() override;
|
2015-09-19 22:08:03 +02:00
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
auto notify(QObject * receiver, QEvent * event) -> bool override;
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
auto IsTestMode() const -> bool;
|
|
|
|
auto IsAppInGUIMode() const -> bool override;
|
|
|
|
auto MainWindow() -> TMainWindow *;
|
|
|
|
auto MainWindows() -> QList<TMainWindow*>;
|
|
|
|
auto NewMainWindow() -> TMainWindow *;
|
2015-07-10 13:14:55 +02:00
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
void InitOptions();
|
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
auto TrVars() -> const VTranslateVars * override;
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
void OpenSettings() override;
|
|
|
|
auto TapeSettings() -> VTapeSettings *;
|
2020-02-16 18:18:39 +01:00
|
|
|
void ActivateDarkMode();
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
static auto diagramsPath() -> QString;
|
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
|
|
|
|
2022-08-03 13:41:19 +02:00
|
|
|
static auto VApp() -> MApplication *;
|
2021-02-06 14:52:21 +01:00
|
|
|
|
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:
|
2022-08-03 13:41:19 +02:00
|
|
|
void InitTrVars() override;
|
|
|
|
auto event(QEvent *e) -> bool override;
|
2015-09-19 21:58:32 +02:00
|
|
|
|
2019-07-01 11:47:06 +02:00
|
|
|
protected slots:
|
2022-08-03 13:41:19 +02:00
|
|
|
void AboutToQuit() override;
|
2019-07-01 11:47:06 +02:00
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
private slots:
|
|
|
|
void NewLocalSocketConnection();
|
|
|
|
|
|
|
|
private:
|
2022-08-08 14:25:14 +02:00
|
|
|
// cppcheck-suppress unknownMacro
|
2022-08-03 13:41:19 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(MApplication) // NOLINT
|
|
|
|
QList<QPointer<TMainWindow> > m_mainWindows{};
|
|
|
|
QLocalServer *m_localServer{nullptr};
|
|
|
|
VTranslateVars *m_trVars{nullptr};
|
|
|
|
QPointer<DialogMDataBase> m_dataBase{};
|
|
|
|
bool m_testMode{false};
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
void Clean();
|
2022-08-03 13:41:19 +02:00
|
|
|
|
|
|
|
static void InitParserOptions(QCommandLineParser &parser);
|
|
|
|
void StartLocalServer(const QString &serverName);
|
|
|
|
|
2022-08-08 15:14:46 +02:00
|
|
|
auto StartWithFiles(QCommandLineParser &parser) -> bool;
|
|
|
|
auto SingleStart(QCommandLineParser &parser) -> bool;
|
2022-08-03 13:41:19 +02:00
|
|
|
|
|
|
|
static void ParseDimensionAOption(QCommandLineParser &parser, int &dimensionAValue, bool &flagDimensionA);
|
|
|
|
static void ParseDimensionBOption(QCommandLineParser &parser, int &dimensionBValue, bool &flagDimensionB);
|
|
|
|
static void ParseDimensionCOption(QCommandLineParser &parser, int &dimensionCValue, bool &flagDimensionC);
|
|
|
|
static void ParseUnitsOption(QCommandLineParser &parser, Unit &unit , bool &flagUnits);
|
2015-07-10 13:14:55 +02:00
|
|
|
};
|
2018-02-03 11:45:16 +01:00
|
|
|
|
2020-05-10 17:35:15 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2022-08-03 13:41:19 +02:00
|
|
|
inline auto MApplication::TrVars() -> const VTranslateVars *
|
2018-02-03 11:45:16 +01:00
|
|
|
{
|
2022-08-03 13:41:19 +02:00
|
|
|
return m_trVars;
|
2018-02-03 11:45:16 +01:00
|
|
|
}
|
2015-07-10 13:14:55 +02:00
|
|
|
|
|
|
|
#endif // MAPPLICATION_H
|