valentina/src/app/tape/mapplication.h

119 lines
3.8 KiB
C
Raw Normal View History

/************************************************************************
**
** @file mapplication.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 8 7, 2015
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2015 Valentina project
** <https://gitlab.com/smart-pattern/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
#include "../vpatterndb/vtranslatevars.h"
#include "vtapesettings.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogs/dialogmdatabase.h"
class TMainWindow;
class QLocalServer;
2022-08-03 13:41:19 +02:00
class QCommandLineParser;
enum class SocketConnection : bool {Client = false, Server = true};
class MApplication : public VAbstractApplication
{
2022-08-03 13:41:19 +02:00
Q_OBJECT // NOLINT
public:
MApplication(int &argc, char **argv);
2022-08-03 13:41:19 +02:00
~MApplication() override;
2022-08-03 13:41:19 +02:00
auto notify(QObject * receiver, QEvent * event) -> bool override;
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 *;
void InitOptions();
2022-08-03 13:41:19 +02:00
auto TrVars() -> const VTranslateVars * override;
2022-08-03 13:41:19 +02:00
void OpenSettings() override;
auto TapeSettings() -> VTapeSettings *;
2020-02-16 18:18:39 +01:00
void ActivateDarkMode();
2022-08-03 13:41:19 +02:00
static auto diagramsPath() -> QString;
void ShowDataBase();
void RetranslateGroups();
void RetranslateTables();
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
2022-08-03 13:41:19 +02:00
static auto VApp() -> MApplication *;
2021-02-06 14:52:21 +01:00
public slots:
void ProcessCMD();
protected:
2022-08-03 13:41:19 +02:00
void InitTrVars() override;
auto event(QEvent *e) -> bool override;
protected slots:
2022-08-03 13:41:19 +02:00
void AboutToQuit() override;
private slots:
void NewLocalSocketConnection();
private:
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};
void Clean();
2022-08-03 13:41:19 +02:00
static void InitParserOptions(QCommandLineParser &parser);
void StartLocalServer(const QString &serverName);
void StartWithFiles(QCommandLineParser &parser);
void SingleStart(QCommandLineParser &parser);
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);
};
2020-05-10 17:35:15 +02:00
//---------------------------------------------------------------------------------------------------------------------
2022-08-03 13:41:19 +02:00
inline auto MApplication::TrVars() -> const VTranslateVars *
{
2022-08-03 13:41:19 +02:00
return m_trVars;
}
#endif // MAPPLICATION_H