Seamly2D
Code documentation
VApplication Class Reference

The VApplication class reimplamentation QApplication class. More...

#include <vapplication.h>

Inheritance diagram for VApplication:
Collaboration diagram for VApplication:

Public Member Functions

 VApplication (int &argc, char **argv)
 VApplication constructor. More...
 
virtual ~VApplication () Q_DECL_OVERRIDE
 
virtual bool notify (QObject *receiver, QEvent *event) Q_DECL_OVERRIDE
 notify Reimplemented from QApplication::notify(). More...
 
void InitOptions ()
 
QString SeamlyMeFilePath () const
 
QTimer * getAutoSaveTimer () const
 
void setAutoSaveTimer (QTimer *value)
 
void StartLogging ()
 
QTextStream * LogFile ()
 
virtual const VTranslateVarsTrVars () Q_DECL_OVERRIDE
 
virtual bool IsAppInGUIMode () const Q_DECL_OVERRIDE
 IsAppInGUIMode little hack that allow to have access to application state from VAbstractApplication class. More...
 
virtual void OpenSettings () Q_DECL_OVERRIDE
 OpenSettings get acsses to application settings. More...
 
VSettingsSeamly2DSettings ()
 
const VCommandLinePtr CommandLine () const
 
- Public Member Functions inherited from VAbstractApplication
 VAbstractApplication (int &argc, char **argv)
 
virtual ~VAbstractApplication () Q_DECL_OVERRIDE
 
QString translationsPath (const QString &locale=QString()) const
 translationsPath return path to the root directory that contains QM files. More...
 
void loadTranslations (const QString &locale)
 
Unit patternUnit () const
 
const UnitpatternUnitP () const
 
void setPatternUnit (const Unit &patternUnit)
 
MeasurementsType patternType () const
 
void setPatternType (const MeasurementsType &patternType)
 
VCommonSettingsSettings ()
 getSettings hide settings constructor. More...
 
template<typename T >
QString LocaleToString (const T &value)
 
QGraphicsScene * getCurrentScene () const
 
void setCurrentScene (QGraphicsScene **value)
 
VMainGraphicsViewgetSceneView () const
 
void setSceneView (VMainGraphicsView *value)
 
double toPixel (double val) const
 
double fromPixel (double pix) const
 
void setCurrentDocument (VAbstractPattern *doc)
 
VAbstractPatterngetCurrentDocument () const
 
void setCurrentData (VContainer *data)
 
VContainergetCurrentData () const
 
bool getOpeningPattern () const
 
void setOpeningPattern ()
 
QWidget * getMainWindow () const
 
void setMainWindow (QWidget *value)
 
QUndoStack * getUndoStack () const
 
QString getFilePath () const
 
void setFilePath (const QString &value)
 

Static Public Member Functions

static void NewSeamly2D (const QString &fileName=QString())
 NewSeamly2D start Seamly2D in new process, send path to pattern file in argument. More...
 
static QStringList LabelLanguages ()
 
static bool IsGUIMode ()
 

Protected Member Functions

virtual void InitTrVars () Q_DECL_OVERRIDE
 
virtual bool event (QEvent *e) Q_DECL_OVERRIDE
 

Private Member Functions

QString LogDirPath () const
 
QString LogPath () const
 
bool CreateLogDir () const
 
void BeginLogging ()
 
void ClearOldLogs () const
 

Private Attributes

VTranslateVarstrVars
 
QTimer * autoSaveTimer
 
std::shared_ptr< VLockGuard< QFile > > lockLog
 
std::shared_ptr< QTextStream > out
 

Additional Inherited Members

- Protected Attributes inherited from VAbstractApplication
QUndoStack * undoStack
 
QWidget * mainWindow
 mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window modality doesn't work. More...
 
VCommonSettingssettings
 settings pointer to settings. Help hide constructor creation settings. Make make code more readable. More...
 
QPointer< QTranslator > qtTranslator
 
QPointer< QTranslator > qtxmlTranslator
 
QPointer< QTranslator > qtBaseTranslator
 
QPointer< QTranslator > appTranslator
 
QPointer< QTranslator > pmsTranslator
 

Detailed Description

The VApplication class reimplamentation QApplication class.

Definition at line 72 of file vapplication.h.

Constructor & Destructor Documentation

◆ VApplication()

VApplication::VApplication ( int &  argc,
char **  argv 
)

◆ ~VApplication()

VApplication::~VApplication ( )
virtual

Definition at line 299 of file vapplication.cpp.

References VCommandLine::Reset(), and trVars.

Member Function Documentation

◆ BeginLogging()

void VApplication::BeginLogging ( )
private

Definition at line 503 of file vapplication.cpp.

References lockLog, LogPath(), noisyFailureMsgHandler(), out, and VlpCreateLock().

Referenced by StartLogging().

◆ ClearOldLogs()

void VApplication::ClearOldLogs ( ) const
private

Definition at line 528 of file vapplication.cpp.

References DAYS_TO_KEEP_LOGS, VLockGuard< Guarded >::GetProtected(), and LogDirPath().

Referenced by StartLogging().

◆ CommandLine()

const VCommandLinePtr VApplication::CommandLine ( ) const

Definition at line 734 of file vapplication.cpp.

References VCommandLine::instance.

◆ CreateLogDir()

bool VApplication::CreateLogDir ( ) const
private

Definition at line 492 of file vapplication.cpp.

References LogDirPath().

Referenced by StartLogging().

◆ event()

bool VApplication::event ( QEvent *  e)
protectedvirtual

Definition at line 662 of file vapplication.cpp.

References MainWindow::LoadPattern(), and VAbstractApplication::mainWindow.

Referenced by notify().

◆ getAutoSaveTimer()

QTimer * VApplication::getAutoSaveTimer ( ) const
inline

Definition at line 145 of file vapplication.h.

References autoSaveTimer.

◆ InitOptions()

◆ InitTrVars()

void VApplication::InitTrVars ( )
protectedvirtual

Implements VAbstractApplication.

Definition at line 653 of file vapplication.cpp.

References trVars.

◆ IsAppInGUIMode()

bool VApplication::IsAppInGUIMode ( ) const
virtual

IsAppInGUIMode little hack that allow to have access to application state from VAbstractApplication class.

Implements VAbstractApplication.

Definition at line 728 of file vapplication.cpp.

References IsGUIMode().

◆ IsGUIMode()

◆ LabelLanguages()

QStringList VApplication::LabelLanguages ( )
static

◆ LogDirPath()

QString VApplication::LogDirPath ( ) const
private

Definition at line 472 of file vapplication.cpp.

Referenced by ClearOldLogs(), CreateLogDir(), and LogPath().

◆ LogFile()

QTextStream * VApplication::LogFile ( )

Definition at line 641 of file vapplication.cpp.

References out.

◆ LogPath()

QString VApplication::LogPath ( ) const
private

Definition at line 486 of file vapplication.cpp.

References LogDirPath().

Referenced by BeginLogging().

◆ NewSeamly2D()

void VApplication::NewSeamly2D ( const QString &  fileName = QString())
static

NewSeamly2D start Seamly2D in new process, send path to pattern file in argument.

Parameters
fileNamepath to pattern file.

Definition at line 312 of file vapplication.cpp.

Referenced by MainWindow::OpenNewSeamly2D().

◆ notify()

bool VApplication::notify ( QObject *  receiver,
QEvent *  event 
)
virtual

notify Reimplemented from QApplication::notify().

Parameters
receiverreceiver.
eventevent.
Returns
value that is returned from the receiver's event handler.

Definition at line 353 of file vapplication.cpp.

References VExceptionObjectError::DetailedInformation(), VExceptionObjectError::ErrorMessage(), event(), V_EX_DATAERR, V_EX_SOFTWARE, and VException::what().

◆ OpenSettings()

void VApplication::OpenSettings ( )
virtual

OpenSettings get acsses to application settings.

Because we can create object in constructor we open file separately.

Implements VAbstractApplication.

Definition at line 705 of file vapplication.cpp.

References VAbstractApplication::settings.

Referenced by InitOptions(), and VApplication().

◆ Seamly2DSettings()

VSettings * VApplication::Seamly2DSettings ( )

Definition at line 712 of file vapplication.cpp.

References SCASSERT, and VAbstractApplication::settings.

Referenced by InitOptions().

◆ SeamlyMeFilePath()

QString VApplication::SeamlyMeFilePath ( ) const

Definition at line 419 of file vapplication.cpp.

◆ setAutoSaveTimer()

void VApplication::setAutoSaveTimer ( QTimer *  value)
inline

Definition at line 151 of file vapplication.h.

References autoSaveTimer.

◆ StartLogging()

void VApplication::StartLogging ( )

Definition at line 628 of file vapplication.cpp.

References BeginLogging(), ClearOldLogs(), and CreateLogDir().

Referenced by InitOptions().

◆ TrVars()

const VTranslateVars * VApplication::TrVars ( )
virtual

Implements VAbstractApplication.

Definition at line 647 of file vapplication.cpp.

References trVars.

Member Data Documentation

◆ autoSaveTimer

QTimer* VApplication::autoSaveTimer
private

Definition at line 118 of file vapplication.h.

Referenced by getAutoSaveTimer(), and setAutoSaveTimer().

◆ lockLog

std::shared_ptr<VLockGuard<QFile> > VApplication::lockLog
private

Definition at line 120 of file vapplication.h.

Referenced by BeginLogging().

◆ out

std::shared_ptr<QTextStream> VApplication::out
private

Definition at line 121 of file vapplication.h.

Referenced by BeginLogging(), and LogFile().

◆ trVars

VTranslateVars* VApplication::trVars
private

Definition at line 117 of file vapplication.h.

Referenced by InitTrVars(), TrVars(), and ~VApplication().


The documentation for this class was generated from the following files: