1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00
sdrangel/sdrgui/gui/glscopegui.h

246 lines
8.0 KiB
C
Raw Normal View History

2017-01-29 13:51:45 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
2017-01-29 13:51:45 -05:00
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_GUI_GLSCOPENGGUI_H_
#define SDRBASE_GUI_GLSCOPENGGUI_H_
#include <QWidget>
2017-02-04 22:41:32 -05:00
#include <QComboBox>
2017-01-29 13:51:45 -05:00
#include "dsp/dsptypes.h"
#include "export.h"
2017-01-29 13:51:45 -05:00
#include "util/message.h"
2018-08-12 11:22:39 -04:00
#include "dsp/scopevis.h"
#include "settings/serializable.h"
2017-01-29 13:51:45 -05:00
namespace Ui {
class GLScopeGUI;
2017-01-29 13:51:45 -05:00
}
class MessageQueue;
2018-08-12 11:01:56 -04:00
class GLScope;
2017-01-29 13:51:45 -05:00
2018-08-12 10:48:03 -04:00
class SDRGUI_API GLScopeGUI : public QWidget, public Serializable {
2017-01-29 13:51:45 -05:00
Q_OBJECT
public:
enum DisplayMode {
DisplayXYH,
DisplayXYV,
DisplayX,
DisplayY,
DisplayPol
};
2018-08-12 10:48:03 -04:00
explicit GLScopeGUI(QWidget* parent = 0);
~GLScopeGUI();
2017-01-29 13:51:45 -05:00
2018-08-12 11:18:58 -04:00
void setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLScope* glScope);
2017-01-29 13:51:45 -05:00
void setSampleRate(int sampleRate);
void resetToDefaults();
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
2017-01-29 13:51:45 -05:00
bool handleMessage(Message* message);
// preconfiguration methods
// global (first line):
void setDisplayMode(DisplayMode displayMode);
void setTraceIntensity(int value);
void setGridIntensity(int value);
void setTimeBase(int step);
void setTimeOffset(int step);
void setTraceLength(int step);
void setPreTrigger(int step);
// trace (second line):
2018-08-12 11:18:58 -04:00
void changeTrace(int traceIndex, const ScopeVis::TraceData& traceData);
void addTrace(const ScopeVis::TraceData& traceData);
void focusOnTrace(int traceIndex);
// trigger (third line):
2018-08-12 11:18:58 -04:00
void changeTrigger(int triggerIndex, const ScopeVis::TriggerData& triggerData);
void addTrigger(const ScopeVis::TriggerData& triggerData);
void focusOnTrigger(int triggerIndex);
void traceLengthChange();
2017-01-29 13:51:45 -05:00
private:
class TrigUIBlocker
{
public:
TrigUIBlocker(Ui::GLScopeGUI *ui);
~TrigUIBlocker();
void unBlock();
private:
Ui::GLScopeGUI *m_ui;
bool m_oldStateTrigMode;
bool m_oldStateTrigCount;
bool m_oldStateTrigPos;
bool m_oldStateTrigNeg;
bool m_oldStateTrigBoth;
bool m_oldStateTrigLevelCoarse;
bool m_oldStateTrigLevelFine;
bool m_oldStateTrigDelayCoarse;
bool m_oldStateTrigDelayFine;
};
class TraceUIBlocker
{
public:
TraceUIBlocker(Ui::GLScopeGUI *ui);
~TraceUIBlocker();
void unBlock();
private:
Ui::GLScopeGUI *m_ui;
2017-02-20 16:19:50 -05:00
bool m_oldStateTrace;
bool m_oldStateTraceAdd;
bool m_oldStateTraceDel;
bool m_oldStateTraceMode;
bool m_oldStateAmp;
bool m_oldStateOfsCoarse;
bool m_oldStateOfsFine;
bool m_oldStateTraceDelayCoarse;
bool m_oldStateTraceDelayFine;
bool m_oldStateTraceColor;
};
class MainUIBlocker
{
public:
MainUIBlocker(Ui::GLScopeGUI *ui);
~MainUIBlocker();
void unBlock();
private:
Ui::GLScopeGUI *m_ui;
bool m_oldStateOnlyX;
bool m_oldStateOnlyY;
bool m_oldStateHorizontalXY;
bool m_oldStateVerticalXY;
bool m_oldStatePolar;
// bool m_oldStateTime;
// bool m_oldStateTimeOfs;
// bool m_oldStateTraceLen;
};
Ui::GLScopeGUI* ui;
2017-01-29 13:51:45 -05:00
MessageQueue* m_messageQueue;
2018-08-12 11:18:58 -04:00
ScopeVis* m_scopeVis;
2018-08-12 11:01:56 -04:00
GLScope* m_glScope;
2017-01-29 13:51:45 -05:00
int m_sampleRate;
2017-02-04 22:41:32 -05:00
int m_timeBase;
int m_timeOffset;
int m_traceLenMult;
QColor m_focusedTraceColor;
QColor m_focusedTriggerColor;
2017-02-04 22:41:32 -05:00
static const double amps[27];
2017-01-29 13:51:45 -05:00
void applySettings();
// First row
void setTraceIndexDisplay();
2017-02-04 22:41:32 -05:00
void setTimeScaleDisplay();
void setTraceLenDisplay();
void setTimeOfsDisplay();
// Second row
2017-02-05 07:26:07 -05:00
void setAmpScaleDisplay();
void setAmpOfsDisplay();
2017-02-16 19:54:55 -05:00
void setTraceDelayDisplay();
// Third row
void setTrigIndexDisplay();
void setTrigCountDisplay();
void setTrigLevelDisplay();
void setTrigDelayDisplay();
void setTrigPreDisplay();
2017-02-05 07:26:07 -05:00
void changeCurrentTrace();
void changeCurrentTrigger();
2017-02-04 22:41:32 -05:00
2018-08-12 11:18:58 -04:00
void fillTraceData(ScopeVis::TraceData& traceData);
void fillTriggerData(ScopeVis::TriggerData& triggerData);
void setTriggerUI(const ScopeVis::TriggerData& triggerData);
void setTraceUI(const ScopeVis::TraceData& traceData);
2017-02-04 22:41:32 -05:00
void fillProjectionCombo(QComboBox* comboBox);
void disableLiveMode(bool disable);
2017-01-29 13:51:45 -05:00
2017-01-29 16:52:38 -05:00
private slots:
void on_scope_sampleRateChanged(int value);
void on_scope_traceSizeChanged(uint32_t value);
void on_scope_preTriggerChanged(uint32_t value);
2017-02-05 20:40:31 -05:00
// First row
2017-02-03 02:27:03 -05:00
void on_onlyX_toggled(bool checked);
void on_onlyY_toggled(bool checked);
void on_horizontalXY_toggled(bool checked);
void on_verticalXY_toggled(bool checked);
void on_polar_toggled(bool checked);
void on_polarPoints_toggled(bool checked);
void on_polarGrid_toggled(bool checked);
2017-02-03 02:27:03 -05:00
void on_traceIntensity_valueChanged(int value);
void on_gridIntensity_valueChanged(int value);
void on_time_valueChanged(int value);
void on_timeOfs_valueChanged(int value);
void on_traceLen_valueChanged(int value);
2017-02-05 20:40:31 -05:00
// Second row
void on_trace_valueChanged(int value);
void on_traceAdd_clicked(bool checked);
void on_traceDel_clicked(bool checked);
2017-02-26 05:26:23 -05:00
void on_traceUp_clicked(bool checked);
void on_traceDown_clicked(bool checked);
2017-02-05 07:26:07 -05:00
void on_traceMode_currentIndexChanged(int index);
void on_amp_valueChanged(int value);
void on_ofsCoarse_valueChanged(int value);
void on_ofsFine_valueChanged(int value);
2017-02-16 19:54:55 -05:00
void on_traceDelayCoarse_valueChanged(int value);
void on_traceDelayFine_valueChanged(int value);
void on_traceView_toggled(bool checked);
void on_traceColor_clicked();
2018-10-14 20:47:26 -04:00
void on_memorySave_clicked(bool checked);
void on_memoryLoad_clicked(bool checked);
void on_mem_valueChanged(int value);
2017-02-05 20:40:31 -05:00
// Third row
void on_trig_valueChanged(int value);
void on_trigAdd_clicked(bool checked);
void on_trigDel_clicked(bool checked);
2017-02-26 13:14:27 -05:00
void on_trigUp_clicked(bool checked);
void on_trigDown_clicked(bool checked);
void on_trigMode_currentIndexChanged(int index);
void on_trigCount_valueChanged(int value);
void on_trigPos_toggled(bool checked);
void on_trigNeg_toggled(bool checked);
void on_trigBoth_toggled(bool checked);
2018-10-27 19:38:58 -04:00
void on_trigHoldoff_valueChanged(int value);
void on_trigLevelCoarse_valueChanged(int value);
void on_trigLevelFine_valueChanged(int value);
void on_trigDelayCoarse_valueChanged(int value);
void on_trigDelayFine_valueChanged(int value);
void on_trigPre_valueChanged(int value);
void on_trigColor_clicked();
void on_trigOneShot_toggled(bool checked);
2017-02-05 20:40:31 -05:00
void on_freerun_toggled(bool checked);
2017-01-29 13:51:45 -05:00
};
#endif /* SDRBASE_GUI_GLSCOPENGGUI_H_ */