diff --git a/bin/app/user/ApplicationSettings_template.xml b/bin/app/user/ApplicationSettings_template.xml
index 54ac0009..049d5d63 100644
--- a/bin/app/user/ApplicationSettings_template.xml
+++ b/bin/app/user/ApplicationSettings_template.xml
@@ -78,5 +78,6 @@
+
diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp
index 67f8b862..a4d94add 100644
--- a/src/lib/settings/ApplicationSettings.cpp
+++ b/src/lib/settings/ApplicationSettings.cpp
@@ -306,6 +306,16 @@ int ApplicationSettings::getControlsMouseForwardButton() const
return getValue("controls/mouse_forward_button", 0x10);
}
+bool ApplicationSettings::getControlsGraphZoomOnMouseWheel() const
+{
+ return getValue("controls/graph_zoom_on_mouse_wheel", false);
+}
+
+void ApplicationSettings::setControlsGraphZoomOnMouseWheel(bool zoomingDefault)
+{
+ setValue("controls/graph_zoom_on_mouse_wheel", zoomingDefault);
+}
+
std::string ApplicationSettings::getLicenseString() const
{
return getValue("user/license/license", "");
diff --git a/src/lib/settings/ApplicationSettings.h b/src/lib/settings/ApplicationSettings.h
index c1b8ac4b..3067b64c 100644
--- a/src/lib/settings/ApplicationSettings.h
+++ b/src/lib/settings/ApplicationSettings.h
@@ -93,6 +93,9 @@ public:
int getControlsMouseBackButton() const;
int getControlsMouseForwardButton() const;
+ bool getControlsGraphZoomOnMouseWheel() const;
+ void setControlsGraphZoomOnMouseWheel(bool zoomingDefault);
+
// license
std::string getLicenseString() const;
void setLicenseString(const std::string& licenseString);
diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.cpp b/src/lib_gui/qt/graphics/QtGraphicsView.cpp
index 57a0d5f5..d5edb313 100644
--- a/src/lib_gui/qt/graphics/QtGraphicsView.cpp
+++ b/src/lib_gui/qt/graphics/QtGraphicsView.cpp
@@ -9,6 +9,7 @@
#include
#include "qt/utility/QtContextMenu.h"
+#include "settings/ApplicationSettings.h"
QtGraphicsView::QtGraphicsView(QWidget* parent)
: QGraphicsView(parent)
@@ -168,13 +169,20 @@ void QtGraphicsView::keyReleaseEvent(QKeyEvent* event)
void QtGraphicsView::wheelEvent(QWheelEvent* event)
{
- if (event->modifiers() == Qt::ShiftModifier && event->delta() != 0.0f)
- {
- updateZoom(event->delta());
- return;
- }
+ bool zoomDefault = ApplicationSettings::getInstance()->getControlsGraphZoomOnMouseWheel();
+ bool shiftPressed = event->modifiers() == Qt::ShiftModifier;
- QGraphicsView::wheelEvent(event);
+ if (zoomDefault != shiftPressed)
+ {
+ if (event->delta() != 0.0f)
+ {
+ updateZoom(event->delta());
+ }
+ }
+ else
+ {
+ QGraphicsView::wheelEvent(event);
+ }
}
void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
@@ -247,34 +255,47 @@ void QtGraphicsView::stopTimer()
QString ShowSaveFileDialog(QWidget *parent,
const QString &title,
const QString &directory,
- const QString &filter) {
+ const QString &filter)
+{
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
- return QFileDialog::getSaveFileName(parent,
- title,
- directory,
- filter);
+
+ return QFileDialog::getSaveFileName(parent, title, directory, filter);
+
#else
QFileDialog dialog(parent, title, directory, filter);
- if (parent) {
+
+ if (parent)
+ {
dialog.setWindowModality(Qt::WindowModal);
}
+
QRegExp filter_regex(QLatin1String("(?:^\\*\\.(?!.*\\()|\\(\\*\\.)(\\w+)"));
QStringList filters = filter.split(QLatin1String(";;"));
- if (!filters.isEmpty()) {
+
+ if (!filters.isEmpty())
+ {
dialog.setNameFilters(filters);
}
+
dialog.setAcceptMode(QFileDialog::AcceptSave);
- if (dialog.exec() == QDialog::Accepted) {
+
+ if (dialog.exec() == QDialog::Accepted)
+ {
QString file_name = dialog.selectedFiles().first();
QFileInfo info(file_name);
- if (info.suffix().isEmpty() && !dialog.selectedNameFilter().isEmpty()) {
- if (filter_regex.indexIn(dialog.selectedNameFilter()) != -1) {
+
+ if (info.suffix().isEmpty() && !dialog.selectedNameFilter().isEmpty())
+ {
+ if (filter_regex.indexIn(dialog.selectedNameFilter()) != -1)
+ {
QString extension = filter_regex.cap(1);
file_name += QLatin1String(".") + extension;
}
}
return file_name;
- } else {
+ }
+ else
+ {
return QString();
}
#endif // Q_WS_MAC || Q_WS_WIN
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp
index c8cb015c..6141825e 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp
@@ -80,6 +80,26 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
layout->addWidget(m_colorSchemes, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++;
+ // logging
+ m_loggingEnabled = new QCheckBox("Enable console and file logging", this);
+
+ layout->addWidget(createFormLabel("Logging"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(m_loggingEnabled, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
+
+ addHelpButton(
+ "Save log files and show log information in the console."
+ , layout, row
+ );
+
+ row++;
+
+ layout->setRowMinimumHeight(row++, 20);
+
+
+ // Controls
+ layout->addWidget(createFormTitle("CONTROLS"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
+ row++;
+
// scroll speed
m_scrollSpeed = new QLineEdit();
m_scrollSpeed->setObjectName("name");
@@ -94,17 +114,16 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
);
row++;
- // logging
- m_loggingEnabled = new QCheckBox("Enable console and file logging", this);
+ // graph zooming
+ m_graphZooming = new QCheckBox("Zoom on mouse wheel by default", this);
- layout->addWidget(createFormLabel("Logging"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
- layout->addWidget(m_loggingEnabled, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
+ layout->addWidget(createFormLabel("Graph Zoom"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(m_graphZooming, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
addHelpButton(
- "Save log files and show log information in the console."
+ "Switch graph zooming to mouse wheel by default, instead of SHIFT + mouse wheel."
, layout, row
);
-
row++;
layout->setRowMinimumHeight(row++, 20);
@@ -222,6 +241,8 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
layout->setRowMinimumHeight(row, 30);
row++;
+ layout->setRowMinimumHeight(row++, 20);
+
// C/C++
layout->addWidget(createFormTitle("C/C++"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
row++;
@@ -247,9 +268,11 @@ void QtProjectWizzardContentPreferences::load()
}
}
- m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1));
m_loggingEnabled->setChecked(appSettings->getLoggingEnabled());
+ m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1));
+ m_graphZooming->setChecked(appSettings->getControlsGraphZoomOnMouseWheel());
+
m_coatiPort->setText(QString::number(appSettings->getCoatiPort()));
m_pluginPort->setText(QString::number(appSettings->getPluginPort()));
@@ -275,10 +298,12 @@ void QtProjectWizzardContentPreferences::save()
appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]);
m_oldColorSchemeIndex = -1;
+ appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
+
float scrollSpeed = m_scrollSpeed->text().toFloat();
if (scrollSpeed) appSettings->setScrollSpeed(scrollSpeed);
- appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
+ appSettings->setControlsGraphZoomOnMouseWheel(m_graphZooming->isChecked());
int coatiPort = m_coatiPort->text().toInt();
if (coatiPort) appSettings->setCoatiPort(coatiPort);
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
index bbf9a9e8..529babfe 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
@@ -40,9 +40,10 @@ private:
QComboBox* m_colorSchemes;
std::vector m_colorSchemePaths;
int m_oldColorSchemeIndex;
+ QCheckBox* m_loggingEnabled;
QLineEdit* m_scrollSpeed;
- QCheckBox* m_loggingEnabled;
+ QCheckBox* m_graphZooming;
QLineEdit* m_coatiPort;
QLineEdit* m_pluginPort;