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.
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
** <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
|
|
|
|
|
|
|
|
#include <QApplication>
|
2014-03-19 19:27:11 +01:00
|
|
|
#include "../options.h"
|
|
|
|
|
|
|
|
class VApplication;
|
|
|
|
|
|
|
|
#if defined(qApp)
|
|
|
|
#undef qApp
|
|
|
|
#endif
|
|
|
|
#define qApp (static_cast<VApplication*>(QCoreApplication::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
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
class VApplication : public QApplication
|
|
|
|
{
|
2013-09-23 14:08:06 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 13:27:26 +01:00
|
|
|
* @brief VApplication constructor.
|
|
|
|
* @param argc number arguments.
|
|
|
|
* @param argv command line.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-03-19 19:27:11 +01:00
|
|
|
VApplication(int &argc, char ** argv);
|
2013-10-27 09:10:39 +01:00
|
|
|
virtual ~VApplication() {}
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 13:27:26 +01:00
|
|
|
* @brief notify Reimplemented from QApplication::notify().
|
|
|
|
* @param receiver receiver.
|
|
|
|
* @param event event.
|
|
|
|
* @return value that is returned from the receiver's event handler.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-03-26 05:39:07 +01:00
|
|
|
virtual bool notify(QObject * receiver, QEvent * event);
|
|
|
|
Valentina::Units patternUnit() const;
|
|
|
|
void setPatternUnit(const Valentina::Units &patternUnit);
|
2014-03-19 19:27:11 +01:00
|
|
|
Pattern::Measurements patternType() const;
|
2014-03-26 05:39:07 +01:00
|
|
|
void setPatternType(const Pattern::Measurements &patternType);
|
|
|
|
double toPixel(double unit) const;
|
|
|
|
double fromPixel(double pix) const;
|
|
|
|
static const qreal PrintDPI;
|
|
|
|
QString translationsPath() const;
|
|
|
|
QString pathToTables() const;
|
|
|
|
qreal widthMainLine() const;
|
|
|
|
qreal widthHairLine() const;
|
2014-03-19 19:27:11 +01:00
|
|
|
private:
|
2014-03-26 05:39:07 +01:00
|
|
|
Valentina::Units _patternUnit;
|
2014-03-19 19:27:11 +01:00
|
|
|
Pattern::Measurements _patternType;
|
2014-03-26 05:39:07 +01:00
|
|
|
qreal _widthMainLine;
|
|
|
|
qreal _widthHairLine;
|
|
|
|
void InitLineWidth();
|
2013-09-23 14:08:06 +02:00
|
|
|
};
|
|
|
|
|
2014-03-19 19:27:11 +01:00
|
|
|
inline Valentina::Units VApplication::patternUnit() const
|
|
|
|
{
|
|
|
|
return _patternUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline Pattern::Measurements VApplication::patternType() const
|
|
|
|
{
|
|
|
|
return _patternType;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VApplication::setPatternType(const Pattern::Measurements &patternType)
|
|
|
|
{
|
|
|
|
_patternType = patternType;
|
|
|
|
}
|
|
|
|
|
2014-03-26 05:39:07 +01:00
|
|
|
inline qreal VApplication::widthMainLine() const
|
|
|
|
{
|
|
|
|
return _widthMainLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline qreal VApplication::widthHairLine() const
|
|
|
|
{
|
|
|
|
return _widthHairLine;
|
|
|
|
}
|
2014-03-19 19:27:11 +01:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
#endif // VAPPLICATION_H
|