Undo limit.
--HG-- branch : feature
This commit is contained in:
parent
f28bbc6acd
commit
292b10e72c
|
@ -188,16 +188,16 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PatternPage::PatternPage(QWidget *parent):
|
PatternPage::PatternPage(QWidget *parent):
|
||||||
QWidget(parent), userName(0), graphOutputCheck(0), undoneCount(0)
|
QWidget(parent), userName(0), graphOutputCheck(0), undoCount(0)
|
||||||
{
|
{
|
||||||
QGroupBox *userGroup = UserGroup();
|
QGroupBox *userGroup = UserGroup();
|
||||||
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
||||||
QGroupBox *undoneGroup = UndoneGroup();
|
QGroupBox *undoGroup = UndoGroup();
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addWidget(userGroup);
|
mainLayout->addWidget(userGroup);
|
||||||
mainLayout->addWidget(graphOutputGroup);
|
mainLayout->addWidget(graphOutputGroup);
|
||||||
mainLayout->addWidget(undoneGroup);
|
mainLayout->addWidget(undoGroup);
|
||||||
mainLayout->addStretch(1);
|
mainLayout->addStretch(1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,10 @@ void PatternPage::Apply()
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
||||||
|
|
||||||
settings.setValue("pattern/undone", undoneCount->value());
|
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||||
|
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||||
|
* prints a warning and does nothing.*/
|
||||||
|
settings.setValue("pattern/undo", undoCount->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -266,29 +269,29 @@ QGroupBox *PatternPage::GraphOutputGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGroupBox *PatternPage::UndoneGroup()
|
QGroupBox *PatternPage::UndoGroup()
|
||||||
{
|
{
|
||||||
// QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
// QApplication::applicationName());
|
QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *undoneGroup = new QGroupBox(tr("Undone"));
|
QGroupBox *undoGroup = new QGroupBox(tr("Undo"));
|
||||||
QLabel *undoneLabel = new QLabel(tr("Count steps"));
|
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
||||||
undoneCount = new QSpinBox;
|
undoCount = new QSpinBox;
|
||||||
// bool ok = true;
|
undoCount->setMinimum(0);
|
||||||
// qint32 count = settings.value("pattern/undone", 100).toInt(&ok);
|
bool ok = true;
|
||||||
// if (ok == false)
|
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
||||||
// {
|
if (ok == false)
|
||||||
// count = 100;
|
{
|
||||||
// }
|
count = 0;
|
||||||
// undoneCount->setValue(count);
|
}
|
||||||
undoneCount->setEnabled(false);
|
undoCount->setValue(count);
|
||||||
|
|
||||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||||
countLayout->addWidget(undoneLabel);
|
countLayout->addWidget(undoLabel);
|
||||||
countLayout->addWidget(undoneCount);
|
countLayout->addWidget(undoCount);
|
||||||
|
|
||||||
QVBoxLayout *undoneLayout = new QVBoxLayout;
|
QVBoxLayout *undoLayout = new QVBoxLayout;
|
||||||
undoneLayout->addLayout(countLayout);
|
undoLayout->addLayout(countLayout);
|
||||||
undoneGroup->setLayout(undoneLayout);
|
undoGroup->setLayout(undoLayout);
|
||||||
return undoneGroup;
|
return undoGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,10 +60,10 @@ private:
|
||||||
Q_DISABLE_COPY(PatternPage)
|
Q_DISABLE_COPY(PatternPage)
|
||||||
QLineEdit *userName;
|
QLineEdit *userName;
|
||||||
QCheckBox *graphOutputCheck;
|
QCheckBox *graphOutputCheck;
|
||||||
QSpinBox *undoneCount;
|
QSpinBox *undoCount;
|
||||||
QGroupBox *UserGroup();
|
QGroupBox *UserGroup();
|
||||||
QGroupBox *GraphOutputGroup();
|
QGroupBox *GraphOutputGroup();
|
||||||
QGroupBox *UndoneGroup();
|
QGroupBox *UndoGroup();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PAGES_H
|
#endif // PAGES_H
|
||||||
|
|
|
@ -1726,9 +1726,19 @@ void MainWindow::ReadSettings()
|
||||||
resize(size);
|
resize(size);
|
||||||
move(pos);
|
move(pos);
|
||||||
|
|
||||||
|
// Scene antialiasing
|
||||||
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||||
view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
||||||
view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
||||||
|
|
||||||
|
// Stack limit
|
||||||
|
bool ok = true;
|
||||||
|
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
||||||
|
if (ok == false)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
qApp->getUndoStack()->setUndoLimit(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user