2020-02-16 18:18:39 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
2020-05-23 14:10:05 +02:00
|
|
|
** @file vpapplication.h
|
2020-02-16 18:18:39 +01:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 16 2, 2020
|
|
|
|
**
|
|
|
|
** @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) 2020 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
2020-05-23 14:10:05 +02:00
|
|
|
#ifndef VPAPPLICATION_H
|
|
|
|
#define VPAPPLICATION_H
|
2020-02-16 18:18:39 +01:00
|
|
|
|
|
|
|
#include "../vmisc/def.h"
|
2020-05-23 15:44:44 +02:00
|
|
|
#include "vpsettings.h"
|
2020-02-16 18:18:39 +01:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
2020-05-23 14:43:57 +02:00
|
|
|
#include "vpcommandline.h"
|
2020-04-12 22:28:36 +02:00
|
|
|
|
|
|
|
#include <memory>
|
2020-02-16 18:18:39 +01:00
|
|
|
|
2020-05-23 14:17:20 +02:00
|
|
|
class VPMainWindow;
|
2020-02-16 18:18:39 +01:00
|
|
|
class QLocalServer;
|
|
|
|
|
|
|
|
enum class SocketConnection : bool {Client = false, Server = true};
|
|
|
|
|
2020-05-23 14:10:05 +02:00
|
|
|
class VPApplication : public VAbstractApplication
|
2020-02-16 18:18:39 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-05-23 14:10:05 +02:00
|
|
|
VPApplication(int &argc, char **argv);
|
|
|
|
virtual ~VPApplication() override;
|
2020-02-16 18:18:39 +01:00
|
|
|
|
|
|
|
virtual bool notify(QObject * receiver, QEvent * event) override;
|
|
|
|
|
|
|
|
virtual bool IsAppInGUIMode() const override;
|
2020-05-23 14:17:20 +02:00
|
|
|
VPMainWindow *MainWindow();
|
|
|
|
QList<VPMainWindow*> MainWindows();
|
2021-05-20 17:33:53 +02:00
|
|
|
VPMainWindow *NewMainWindow();
|
2020-05-23 14:43:57 +02:00
|
|
|
VPMainWindow *NewMainWindow(const VPCommandLinePtr &cmd);
|
2020-02-16 18:18:39 +01:00
|
|
|
|
|
|
|
void InitOptions();
|
|
|
|
|
|
|
|
virtual const VTranslateVars *TrVars() override;
|
|
|
|
|
|
|
|
virtual void OpenSettings() override;
|
2020-05-23 15:44:44 +02:00
|
|
|
VPSettings *PuzzleSettings();
|
2020-02-16 18:18:39 +01:00
|
|
|
void ActivateDarkMode();
|
|
|
|
|
|
|
|
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
2020-05-23 14:43:57 +02:00
|
|
|
void ProcessArguments(const VPCommandLinePtr &cmd);
|
2021-05-20 16:10:43 +02:00
|
|
|
|
|
|
|
static VPCommandLinePtr CommandLine();
|
|
|
|
static VPApplication *VApp();
|
2020-02-16 18:18:39 +01:00
|
|
|
public slots:
|
|
|
|
void ProcessCMD();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void InitTrVars() override;
|
|
|
|
virtual bool event(QEvent *e) override;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
virtual void AboutToQuit() override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void NewLocalSocketConnection();
|
|
|
|
|
|
|
|
private:
|
2020-05-23 14:10:05 +02:00
|
|
|
Q_DISABLE_COPY(VPApplication)
|
2021-05-20 16:10:43 +02:00
|
|
|
QList<QPointer<VPMainWindow> > mainWindows{};
|
|
|
|
QLocalServer *localServer{nullptr};
|
2020-02-16 18:18:39 +01:00
|
|
|
|
|
|
|
void Clean();
|
|
|
|
};
|
|
|
|
|
2020-05-23 14:10:05 +02:00
|
|
|
#endif // VPAPPLICATION_H
|