#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
+#include <QSpinBox>
#include <QString>
#include <QTextBrowser>
#include <QTextDocument>
QWidget *Settings::get_view_settings_form(QWidget *parent) const
{
+ GlobalSettings settings;
QCheckBox *cb;
QWidget *form = new QWidget(parent);
SLOT(on_view_showAnalogMinorGrid_changed(int)));
trace_view_layout->addRow(tr("Show analog minor grid in addition to vdiv grid"), cb);
+ QSpinBox *default_div_height_sb = new QSpinBox();
+ default_div_height_sb->setRange(20, 1000);
+ default_div_height_sb->setSuffix(tr(" pixels"));
+ default_div_height_sb->setValue(
+ settings.value(GlobalSettings::Key_View_DefaultDivHeight).toInt());
+ connect(default_div_height_sb, SIGNAL(valueChanged(int)), this,
+ SLOT(on_view_defaultDivHeight_changed(int)));
+ trace_view_layout->addRow(tr("Default analog trace div height"), default_div_height_sb);
+
return form;
}
settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, state ? true : false);
}
+void Settings::on_view_defaultDivHeight_changed(int value)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_DefaultDivHeight, value);
+}
+
void Settings::on_dec_initialStateConfigurable_changed(int state)
{
GlobalSettings settings;
void on_view_stickyScrolling_changed(int state);
void on_view_showSamplingPoints_changed(int state);
void on_view_showAnalogMinorGrid_changed(int state);
+ void on_view_defaultDivHeight_changed(int value);
void on_dec_initialStateConfigurable_changed(int state);
private:
#include "globalsettings.hpp"
+#include <QApplication>
#include <QByteArray>
+#include <QFontMetrics>
#include <QString>
using std::function;
const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
const QString GlobalSettings::Key_View_ShowSamplingPoints = "View_ShowSamplingPoints";
const QString GlobalSettings::Key_View_ShowAnalogMinorGrid = "View_ShowAnalogMinorGrid";
+const QString GlobalSettings::Key_View_DefaultDivHeight = "View_DefaultDivHeight";
const QString GlobalSettings::Key_Dec_InitialStateConfigurable = "Dec_InitialStateConfigurable";
multimap< QString, function<void(QVariant)> > GlobalSettings::callbacks_;
// Enable showing sampling points by default
if (!contains(Key_View_ShowSamplingPoints))
setValue(Key_View_ShowSamplingPoints, true);
+
+ if (!contains(Key_View_DefaultDivHeight))
+ setValue(Key_View_DefaultDivHeight,
+ 3 * QFontMetrics(QApplication::font()).height());
}
void GlobalSettings::register_change_handler(const QString key,
static const QString Key_View_StickyScrolling;
static const QString Key_View_ShowSamplingPoints;
static const QString Key_View_ShowAnalogMinorGrid;
+ static const QString Key_View_DefaultDivHeight;
static const QString Key_Dec_InitialStateConfigurable;
public: