2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vapplication.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-11-04 21:38:54 +01:00
|
|
|
** 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/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-11-04 21:38:54 +01:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
#ifndef VAPPLICATION_H
|
|
|
|
#define VAPPLICATION_H
|
|
|
|
|
2015-07-10 11:24:47 +02:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
2014-03-19 19:27:11 +01:00
|
|
|
#include "../options.h"
|
2015-07-10 11:24:47 +02:00
|
|
|
#include "../vwidgets/vmaingraphicsview.h"
|
|
|
|
#include "../vpatterndb/vtranslatevars.h"
|
2015-02-10 20:27:11 +01:00
|
|
|
#include "vsettings.h"
|
2015-08-25 19:53:03 +02:00
|
|
|
#include "vcmdexport.h"
|
|
|
|
|
2015-06-18 10:45:38 +02:00
|
|
|
class VApplication;// use in define
|
2014-03-19 19:27:11 +01:00
|
|
|
|
|
|
|
#if defined(qApp)
|
|
|
|
#undef qApp
|
|
|
|
#endif
|
2015-06-18 10:45:38 +02:00
|
|
|
#define qApp (static_cast<VApplication*>(VAbstractApplication::instance()))
|
2013-09-23 14:08:06 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 13:27:26 +01:00
|
|
|
* @brief The VApplication class reimplamentation QApplication class.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2015-06-18 10:45:38 +02:00
|
|
|
class VApplication : public VAbstractApplication
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-09-23 14:08:06 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-08-25 19:53:03 +02:00
|
|
|
|
2014-03-19 19:27:11 +01:00
|
|
|
VApplication(int &argc, char ** argv);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~VApplication() Q_DECL_OVERRIDE;
|
2014-10-23 11:13:18 +02:00
|
|
|
static void NewValentina(const QString &fileName = QString());
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE;
|
2014-07-23 12:04:23 +02:00
|
|
|
|
2015-06-11 14:24:38 +02:00
|
|
|
void InitOptions();
|
|
|
|
|
2015-08-18 12:36:17 +02:00
|
|
|
QString TapeFilePath() const;
|
2015-02-10 21:09:44 +01:00
|
|
|
|
2014-06-13 19:02:41 +02:00
|
|
|
QTimer *getAutoSaveTimer() const;
|
|
|
|
void setAutoSaveTimer(QTimer *value);
|
2014-09-08 13:02:14 +02:00
|
|
|
|
2014-09-09 15:11:50 +02:00
|
|
|
static QStringList LabelLanguages();
|
2014-11-29 13:12:43 +01:00
|
|
|
|
2014-11-20 13:18:43 +01:00
|
|
|
void StartLogging();
|
|
|
|
QTextStream *LogFile();
|
2014-11-15 16:52:27 +01:00
|
|
|
|
2016-05-03 18:50:37 +02:00
|
|
|
virtual const VTranslateVars *TrVars() Q_DECL_OVERRIDE;
|
2015-06-11 12:15:57 +02:00
|
|
|
|
2014-11-15 16:52:27 +01:00
|
|
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
|
|
|
static void DrMingw();
|
|
|
|
void CollectReports() const;
|
2014-11-20 13:18:43 +01:00
|
|
|
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
2015-12-09 12:31:33 +01:00
|
|
|
bool static IsGUIMode();
|
2016-05-03 18:50:37 +02:00
|
|
|
virtual bool IsAppInGUIMode() const Q_DECL_OVERRIDE;
|
2015-08-25 19:53:03 +02:00
|
|
|
|
2015-07-24 14:06:53 +02:00
|
|
|
virtual void OpenSettings() Q_DECL_OVERRIDE;
|
|
|
|
VSettings *ValentinaSettings();
|
|
|
|
|
2015-09-19 21:58:32 +02:00
|
|
|
protected:
|
|
|
|
virtual void InitTrVars() Q_DECL_OVERRIDE;
|
2015-11-19 16:17:25 +01:00
|
|
|
virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
|
2015-09-19 21:58:32 +02:00
|
|
|
|
2014-11-15 16:52:27 +01:00
|
|
|
private slots:
|
2014-11-20 13:18:43 +01:00
|
|
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
2014-11-15 16:52:27 +01:00
|
|
|
void CleanGist() const;
|
2014-11-15 17:29:10 +01:00
|
|
|
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
2014-11-20 13:18:43 +01:00
|
|
|
|
2014-03-19 19:27:11 +01:00
|
|
|
private:
|
2014-06-04 13:30:45 +02:00
|
|
|
Q_DISABLE_COPY(VApplication)
|
2015-06-11 12:15:57 +02:00
|
|
|
VTranslateVars *trVars;
|
2014-06-13 19:02:41 +02:00
|
|
|
QTimer *autoSaveTimer;
|
2015-06-18 19:23:24 +02:00
|
|
|
|
2015-10-23 19:47:33 +02:00
|
|
|
std::shared_ptr<VLockGuard<QFile>> lockLog;
|
2015-09-14 13:53:49 +02:00
|
|
|
std::shared_ptr<QTextStream> out;
|
|
|
|
|
2014-11-15 16:52:27 +01:00
|
|
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
|
|
|
static const QString GistFileName;
|
|
|
|
|
|
|
|
void CollectReport(const QString &reportName) const;
|
|
|
|
void SendReport(const QString &reportName) const;
|
2014-11-20 13:18:43 +01:00
|
|
|
QString ReadFileForSending(QFile &file)const;
|
2014-11-29 13:12:43 +01:00
|
|
|
void ClearOldReports()const;
|
2014-11-30 16:30:47 +01:00
|
|
|
void GatherLogs()const;
|
2014-11-15 17:29:10 +01:00
|
|
|
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
2014-11-20 13:18:43 +01:00
|
|
|
|
|
|
|
QString LogDirPath()const;
|
|
|
|
QString LogPath()const;
|
2017-04-19 11:48:13 +02:00
|
|
|
bool CreateLogDir()const;
|
2014-11-28 14:49:06 +01:00
|
|
|
void BeginLogging();
|
|
|
|
void ClearOldLogs()const;
|
2015-08-27 17:55:17 +02:00
|
|
|
|
2015-08-27 20:06:40 +02:00
|
|
|
public:
|
2015-08-27 17:55:17 +02:00
|
|
|
//moved to the end of class so merge should go
|
|
|
|
const VCommandLinePtr CommandLine() const;
|
2013-09-23 14:08:06 +02:00
|
|
|
};
|
|
|
|
|
2014-06-08 12:59:39 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline QTimer *VApplication::getAutoSaveTimer() const
|
|
|
|
{
|
|
|
|
return autoSaveTimer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline void VApplication::setAutoSaveTimer(QTimer *value)
|
|
|
|
{
|
|
|
|
autoSaveTimer = value;
|
|
|
|
}
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2014-06-08 12:59:39 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
#endif // VAPPLICATION_H
|