From: Soeren Apel Date: Thu, 14 Jun 2018 15:41:02 +0000 (+0200) Subject: Prevent log length to be set to 0 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b9a3a67e4bb39b769ac580d8d2f76eef6458f5d6;p=pulseview.git Prevent log length to be set to 0 Doing so prevents PV from starting up, so disallow it --- diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index 04565a3f..5b33272b 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -493,6 +493,7 @@ QWidget *Settings::get_logging_page(QWidget *parent) const // Background buffer size QSpinBox *buffersize_sb = new QSpinBox(); buffersize_sb->setSuffix(tr(" lines")); + buffersize_sb->setMinimum(Logging::MIN_BUFFER_SIZE); buffersize_sb->setMaximum(Logging::MAX_BUFFER_SIZE); buffersize_sb->setValue( settings.value(GlobalSettings::Key_Log_BufferSize).toInt()); diff --git a/pv/logging.cpp b/pv/logging.cpp index ab0594c3..dea333e5 100644 --- a/pv/logging.cpp +++ b/pv/logging.cpp @@ -34,6 +34,7 @@ namespace pv { Logging logging; +const int Logging::MIN_BUFFER_SIZE = 10; const int Logging::MAX_BUFFER_SIZE = 50000; Logging::~Logging() diff --git a/pv/logging.hpp b/pv/logging.hpp index fe05c543..28f21074 100644 --- a/pv/logging.hpp +++ b/pv/logging.hpp @@ -44,6 +44,7 @@ public: LogSource_srd }; + static const int MIN_BUFFER_SIZE; static const int MAX_BUFFER_SIZE; public: