ui: Added checkbox to enable/disable animations to preferences

This commit is contained in:
Eberhard Graether
2017-01-09 21:32:59 +01:00
parent 757f728f98
commit cee8a52ca4
7 changed files with 30 additions and 3 deletions
@@ -18,6 +18,8 @@
<font_size_min><!-- INTEGER: minimum font size in pt --></font_size_min>
<font_size_std><!-- INTEGER: standard font size in pt --></font_size_std>
<use_animations><!-- BOOL: define if animations are used --></use_animations>
<window_base_width><!-- INTEGER: initial width of an overlay window --></window_base_width>
<window_base_height><!-- INTEGER: initial height of an overlay window --></window_base_height>
+10
View File
@@ -89,6 +89,16 @@ void ApplicationSettings::setFontSize(int fontSize)
setValue<int>("application/font_size", fontSize);
}
bool ApplicationSettings::getUseAnimations() const
{
return getValue<bool>("application/use_animations", true);
}
void ApplicationSettings::setUseAnimations(bool useAnimations)
{
setValue<bool>("application/use_animations", useAnimations);
}
FilePath ApplicationSettings::getColorSchemePath() const
{
FilePath defaultPath(ResourcePaths::getColorSchemesPath() + "bright.xml");
+3
View File
@@ -41,6 +41,9 @@ public:
int getFontSizeStd() const;
void setFontSizeStd(const int fontSizeStd);
bool getUseAnimations() const;
void setUseAnimations(bool useAnimations);
int getWindowBaseWidth() const;
int getWindowBaseHeight() const;
@@ -4,6 +4,8 @@
#include <QScrollArea>
#include <QScrollBar>
#include "settings/ApplicationSettings.h"
QtCodeNavigateable::~QtCodeNavigateable()
{
}
@@ -40,7 +42,7 @@ void QtCodeNavigateable::ensureWidgetVisibleAnimated(
if (scrollBar && (value > 50 || value < -50))
{
if (animated)
if (animated && ApplicationSettings::getInstance()->getUseAnimations())
{
QPropertyAnimation* anim = new QPropertyAnimation(scrollBar, "value");
anim->setDuration(300);
@@ -87,7 +89,7 @@ void QtCodeNavigateable::ensurePercentVisibleAnimated(double percent, bool anima
int value = scrollHeight * scrollFactor;
if (animated)
if (animated && ApplicationSettings::getInstance()->getUseAnimations())
{
QPropertyAnimation* anim = new QPropertyAnimation(scrollBar, "value");
anim->setDuration(300);
+2 -1
View File
@@ -14,6 +14,7 @@
#include "component/controller/helper/GraphPostprocessor.h"
#include "component/view/GraphViewStyle.h"
#include "settings/ColorScheme.h"
#include "settings/ApplicationSettings.h"
#include "utility/messaging/type/MessageDeactivateEdge.h"
#include "utility/ResourcePaths.h"
@@ -276,7 +277,7 @@ void QtGraphView::doRebuildGraph(
m_activeNode.reset();
}
if (params.animatedTransition)
if (params.animatedTransition && ApplicationSettings::getInstance()->getUseAnimations())
{
createTransition();
}
@@ -57,6 +57,10 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
}
connect(m_colorSchemes, SIGNAL(activated(int)), this, SLOT(colorSchemeChanged(int)));
// animations
m_useAnimations = addCheckBox("Animations", "Enable animations",
"Enable/disable animations throughout the user interface.", layout, row);
// logging
m_loggingEnabled = addCheckBox("Logging", "Enable console and file logging",
"Save log files and show log information in the console.", layout, row);
@@ -173,6 +177,8 @@ void QtProjectWizzardContentPreferences::load()
}
}
m_useAnimations->setChecked(appSettings->getUseAnimations());
m_loggingEnabled->setChecked(appSettings->getLoggingEnabled());
m_verboseIndexerLoggingEnabled->setChecked(appSettings->getVerboseIndexerLoggingEnabled());
m_verboseIndexerLoggingEnabled->setEnabled(m_loggingEnabled->isChecked());
@@ -205,6 +211,8 @@ void QtProjectWizzardContentPreferences::save()
appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]);
m_oldColorSchemeIndex = -1;
appSettings->setUseAnimations(m_useAnimations->isChecked());
appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
appSettings->setVerboseIndexerLoggingEnabled(m_verboseIndexerLoggingEnabled->isChecked());
@@ -50,6 +50,7 @@ private:
QComboBox* m_colorSchemes;
std::vector<FilePath> m_colorSchemePaths;
int m_oldColorSchemeIndex;
QCheckBox* m_useAnimations;
QCheckBox* m_loggingEnabled;
QCheckBox* m_verboseIndexerLoggingEnabled;