ui: Added scroll speed setting to preferences

This commit is contained in:
Eberhard Graether
2016-08-18 12:12:19 +02:00
parent 3d40f4ed4e
commit c269493942
20 changed files with 206 additions and 27 deletions
+1 -1
View File
@@ -10,6 +10,7 @@
#include <QSysInfo>
#include <QTimer>
#include "Application.h"
#include "component/view/View.h"
#include "component/view/CompositeView.h"
#include "qt/utility/QtContextMenu.h"
@@ -21,7 +22,6 @@
#include "qt/window/QtAbout.h"
#include "qt/window/QtLicense.h"
#include "settings/ApplicationSettings.h"
#include "Application.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageCodeReference.h"
@@ -23,6 +23,7 @@
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageScrollSpeedChange.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/solution/SolutionParserVisualStudio.h"
#include "utility/utilityString.h"
@@ -37,9 +38,11 @@ QtProjectWizzard::QtProjectWizzard(QWidget* parent)
connect(&m_windowStack, SIGNAL(push()), this, SLOT(windowStackChanged()));
connect(&m_windowStack, SIGNAL(pop()), this, SLOT(windowStackChanged()));
// save old application settings so they can be compared later
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
m_parserManager = std::make_shared<SolutionParserManager>();
@@ -699,6 +702,11 @@ void QtProjectWizzard::savePreferences()
{
bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
if (m_appSettings.getScrollSpeed() != ApplicationSettings::getInstance()->getScrollSpeed())
{
MessageScrollSpeedChange(ApplicationSettings::getInstance()->getScrollSpeed()).dispatch();
}
if (appSettingsChanged)
{
Project* currentProject = Application::getInstance()->getCurrentProject().get();
@@ -84,8 +84,21 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
layout->addWidget(m_colorSchemes, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++;
layout->setRowMinimumHeight(row++, 20);
// scroll speed
m_scrollSpeed = new QLineEdit();
m_scrollSpeed->setObjectName("name");
m_scrollSpeed->setAttribute(Qt::WA_MacShowFocusRect, 0);
layout->addWidget(createFormLabel("Scroll Speed"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_scrollSpeed, row, QtProjectWizzardWindow::BACK_COL);
addHelpButton(
"Multiplier for scroll speed. Set to a value between 0 and 1 to scroll slower, or set to larger than 1 to scroll faster."
, layout, row
);
row++;
layout->setRowMinimumHeight(row++, 20);
// indexing
layout->addWidget(createFormTitle("INDEXING"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
@@ -142,6 +155,8 @@ void QtProjectWizzardContentPreferences::load()
}
}
m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1));
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
}
@@ -158,6 +173,12 @@ void QtProjectWizzardContentPreferences::save()
appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]);
m_oldColorSchemeIndex = -1;
float scrollSpeed = m_scrollSpeed->text().toFloat();
if (scrollSpeed)
{
appSettings->setScrollSpeed(scrollSpeed);
}
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
}
@@ -32,6 +32,7 @@ private:
QComboBox* m_fontSize;
QComboBox* m_tabWidth;
QComboBox* m_colorSchemes;
QLineEdit* m_scrollSpeed;
QComboBox* m_threads;
QCheckBox* m_fatalErrors;