valentina/src/app/puzzle/vpapplication.h

96 lines
2.8 KiB
C
Raw Normal View History

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"
#include <memory>
2020-02-16 18:18:39 +01:00
2020-05-23 14:10:05 +02:00
class VPApplication;// use in define
2020-05-23 14:17:20 +02:00
class VPMainWindow;
2020-02-16 18:18:39 +01:00
class QLocalServer;
#if defined(qApp)
#undef qApp
#endif
2020-05-23 14:10:05 +02:00
#define qApp (static_cast<VPApplication*>(VAbstractApplication::instance()))
2020-02-16 18:18:39 +01:00
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();
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);
VPCommandLinePtr CommandLine() const;
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)
2020-05-23 14:17:20 +02:00
QList<QPointer<VPMainWindow> > mainWindows;
2020-02-16 18:18:39 +01:00
QLocalServer *localServer;
void Clean();
};
2020-05-23 14:10:05 +02:00
#endif // VPAPPLICATION_H