From 4bb63bbf1bbeff28beac9b4f2fa9234eab0f144a Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 8 May 2018 10:10:15 +0200 Subject: [PATCH] Fixed keyboard input for negative values on realtive integer value dials (issue #168) --- app/main.cpp | 2 +- appbench/main.cpp | 2 +- appsrv/main.cpp | 2 +- debian/changelog | 6 ++++++ sdrgui/gui/valuedialz.cpp | 13 +++++++++---- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index e405a11df..964e327ed 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -35,7 +35,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo */ QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setApplicationName("SDRangel"); - QCoreApplication::setApplicationVersion("3.14.5"); + QCoreApplication::setApplicationVersion("3.14.6"); #if 1 qApp->setStyle(QStyleFactory::create("fusion")); diff --git a/appbench/main.cpp b/appbench/main.cpp index 74adea9bc..4c9c1554d 100644 --- a/appbench/main.cpp +++ b/appbench/main.cpp @@ -57,7 +57,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setApplicationName("SDRangelBench"); - QCoreApplication::setApplicationVersion("3.14.5"); + QCoreApplication::setApplicationVersion("3.14.6"); int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP}; std::vector vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int)); diff --git a/appsrv/main.cpp b/appsrv/main.cpp index d0fbbdfac..298db8ea7 100644 --- a/appsrv/main.cpp +++ b/appsrv/main.cpp @@ -56,7 +56,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setApplicationName("SDRangelSrv"); - QCoreApplication::setApplicationVersion("3.14.5"); + QCoreApplication::setApplicationVersion("3.14.6"); int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP}; std::vector vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int)); diff --git a/debian/changelog b/debian/changelog index dc80e9307..7c816084a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sdrangel (3.14.6-1) unstable; urgency=medium + + * Fixed keyboard input for negative values on realtive integer value dials + + -- Edouard Griffiths, F4EXB Sun, 13 May 2018 20:14:18 +0200 + sdrangel (3.14.5-1) unstable; urgency=medium * DSD demod: allow audio rates integer multiples of 8k other than 48k diff --git a/sdrgui/gui/valuedialz.cpp b/sdrgui/gui/valuedialz.cpp index 004000977..d8c74f342 100644 --- a/sdrgui/gui/valuedialz.cpp +++ b/sdrgui/gui/valuedialz.cpp @@ -599,12 +599,17 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value) { int d = c.toLatin1() - '0'; quint64 e = findExponent(m_cursor); - quint64 v = (m_value / e) % 10; - if(m_animationState != 0) + quint64 value = abs(m_value); + int sign = m_value < 0 ? -1 : 1; + quint64 v = (value / e) % 10; + + if(m_animationState != 0) { m_value = m_valueNew; - v = m_value - v * e; + } + + v = value - v * e; v += d * e; - setValue(v); + setValue(sign*v); emit changed(m_valueNew); m_cursor++;