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 dfecb4ed1f
commit f65242cd74
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 | QDialog {parent, Qt::Window | Qt::WindowTitleHint |
Qt::WindowCloseButtonHint | Qt::WindowCloseButtonHint |
Qt::WindowMinimizeButtonHint}, Qt::WindowMinimizeButtonHint},
m_settings (settings), m_settings {settings},
ui(new Ui::FastGraph) m_ave {40},
ui {new Ui::FastGraph}
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph")); setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
installEventFilter(parent); //Installing the filter installEventFilter(parent); //Installing the filter
ui->fastPlot->setCursor(Qt::CrossCursor); ui->fastPlot->setCursor(Qt::CrossCursor);
m_ave=40;
//Restore user's settings //Restore user's settings
m_settings->beginGroup("FastGraph"); m_settings->beginGroup("FastGraph");
@ -30,6 +30,7 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
ui->gainSlider->setValue(ui->fastPlot->m_plotGain); ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt()); ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero); ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
m_settings->endGroup(); m_settings->endGroup();
connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick); 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("PlotGain",ui->fastPlot->m_plotGain);
m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero); m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain); m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
m_settings->setValue("HideControls",!ui->controls_widget->isVisible ());
m_settings->endGroup(); m_settings->endGroup();
} }
@ -105,3 +107,17 @@ void FastGraph::setMode(QString mode) //setMode
{ {
ui->fastPlot->setMode(mode); 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: protected:
void closeEvent (QCloseEvent *) override; void closeEvent (QCloseEvent *) override;
void keyPressEvent( QKeyEvent *e ) override;
public: public:
explicit FastGraph(QSettings *, QWidget *parent = 0); explicit FastGraph(QSettings *, QWidget *parent = 0);

View File

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