Initial undo stack.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-04 14:30:45 +03:00
parent a4083afc77
commit 0196db77d7
3 changed files with 15 additions and 2 deletions

View File

@ -770,6 +770,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
{ {
WriteSettings(); WriteSettings();
event->accept(); event->accept();
qApp->closeAllWindows();
} }
else else
{ {

View File

@ -51,8 +51,10 @@ VApplication::VApplication(int &argc, char **argv)
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()), _widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()),
guiTexts(QMap<QString, VTranslation>()), descriptions(QMap<QString, VTranslation>()), guiTexts(QMap<QString, VTranslation>()), descriptions(QMap<QString, VTranslation>()),
variables(QMap<QString, VTranslation>()), functions(QMap<QString, VTranslation>()), variables(QMap<QString, VTranslation>()), functions(QMap<QString, VTranslation>()),
postfixOperators(QMap<QString, VTranslation>()) postfixOperators(QMap<QString, VTranslation>()), undoStack(nullptr)
{ {
undoStack = new QUndoStack(this);
InitLineWidth(); InitLineWidth();
InitMeasurements(); InitMeasurements();
InitVariables(); InitVariables();
@ -1935,3 +1937,10 @@ QString VApplication::FormulaToUser(const QString &formula)
return newFormula; return newFormula;
} }
//---------------------------------------------------------------------------------------------------------------------
QUndoStack *VApplication::getUndoStack() const
{
return undoStack;
}

View File

@ -30,6 +30,7 @@
#define VAPPLICATION_H #define VAPPLICATION_H
#include <QApplication> #include <QApplication>
#include <QUndoStack>
#include "../options.h" #include "../options.h"
#include "vtranslation.h" #include "vtranslation.h"
@ -81,7 +82,9 @@ public:
QString PostfixOperator(const QString &name) const; QString PostfixOperator(const QString &name) const;
QString FormulaFromUser(const QString &formula); QString FormulaFromUser(const QString &formula);
QString FormulaToUser(const QString &formula); QString FormulaToUser(const QString &formula);
QUndoStack *getUndoStack() const;
private: private:
Q_DISABLE_COPY(VApplication)
Valentina::Units _patternUnit; Valentina::Units _patternUnit;
Pattern::Measurements _patternType; Pattern::Measurements _patternType;
qreal _widthMainLine; qreal _widthMainLine;
@ -92,6 +95,7 @@ private:
QMap<QString, VTranslation> variables; QMap<QString, VTranslation> variables;
QMap<QString, VTranslation> functions; QMap<QString, VTranslation> functions;
QMap<QString, VTranslation> postfixOperators; QMap<QString, VTranslation> postfixOperators;
QUndoStack *undoStack;
void InitLineWidth(); void InitLineWidth();
void InitMeasurements(); void InitMeasurements();
void InitVariables(); void InitVariables();
@ -107,7 +111,6 @@ private:
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens, void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
QMap<int, QString> &numbers); QMap<int, QString> &numbers);
void BiasTokens(int position, int bias, QMap<int, QString> &tokens) const; void BiasTokens(int position, int bias, QMap<int, QString> &tokens) const;
}; };
inline Valentina::Units VApplication::patternUnit() const inline Valentina::Units VApplication::patternUnit() const