Add control hiding (CTRL+M) to fast graph to minimize screen usage

Also cleans up a few layout issues.

Thanks to Mike, W9MDB, for this contribution.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7603 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-03-14 14:23:13 +00:00
parent 2ae5bb316b
commit a77d274b41
3 changed files with 258 additions and 260 deletions

View File

@ -12,14 +12,14 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
QDialog {parent, Qt::Window | Qt::WindowTitleHint |
Qt::WindowCloseButtonHint |
Qt::WindowMinimizeButtonHint},
m_settings (settings),
ui(new Ui::FastGraph)
m_settings {settings},
m_ave {40},
ui {new Ui::FastGraph}
{
ui->setupUi(this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
installEventFilter(parent); //Installing the filter
ui->fastPlot->setCursor(Qt::CrossCursor);
m_ave=40;
//Restore user's settings
m_settings->beginGroup("FastGraph");
@ -30,6 +30,7 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
m_settings->endGroup();
connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick);
@ -55,6 +56,7 @@ void FastGraph::saveSettings()
m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain);
m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
m_settings->setValue("HideControls",!ui->controls_widget->isVisible ());
m_settings->endGroup();
}
@ -105,3 +107,17 @@ void FastGraph::setMode(QString mode) //setMode
{
ui->fastPlot->setMode(mode);
}
void FastGraph::keyPressEvent(QKeyEvent *e)
{
switch(e->key())
{
case Qt::Key_M:
if(e->modifiers() & Qt::ControlModifier) {
ui->controls_widget->setVisible (!ui->controls_widget->isVisible ());
}
break;
default:
QDialog::keyPressEvent (e);
}
}

View File

@ -16,6 +16,7 @@ class FastGraph : public QDialog
protected:
void closeEvent (QCloseEvent *) override;
void keyPressEvent( QKeyEvent *e ) override;
public:
explicit FastGraph(QSettings *, QWidget *parent = 0);

View File

@ -1,257 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FastGraph</class>
<widget class="QDialog" name="FastGraph">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>710</width>
<height>250</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>710</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>710</width>
<height>250</height>
</size>
</property>
<property name="windowTitle">
<string>Fast Graph</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="FPlotter" name="fastPlot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="gainSlider">
<property name="toolTip">
<string>Waterfall gain</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>140</number>
</property>
<property name="pageStep">
<number>40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="zeroSlider">
<property name="toolTip">
<string>Waterfall zero</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="greenZeroSlider">
<property name="toolTip">
<string>Spectrum zero</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>160</number>
</property>
<property name="value">
<number>30</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbAutoLevel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set reasonable levels for gain and zero sliders.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Auto Level</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FPlotter</class>
<extends>QFrame</extends>
<header>fastplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FastGraph</class>
<widget class="QDialog" name="FastGraph">
<property name="windowTitle">
<string>Fast Graph</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="FPlotter" name="fastPlot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="controls_widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>99</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="gainSlider">
<property name="toolTip">
<string>Waterfall gain</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>140</number>
</property>
<property name="pageStep">
<number>40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="zeroSlider">
<property name="toolTip">
<string>Waterfall zero</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="greenZeroSlider">
<property name="toolTip">
<string>Spectrum zero</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>160</number>
</property>
<property name="value">
<number>30</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbAutoLevel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set reasonable levels for gain and zero sliders.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Auto Level</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>99</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FPlotter</class>
<extends>QFrame</extends>
<header>fastplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>