mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-05 15:34:57 -04:00
git clone git://git.osmocom.org/sdrangelove.git
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#ifndef INCLUDE_ABOUTDIALOG_H
|
||||
#define INCLUDE_ABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget* parent = NULL);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
Ui::AboutDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_ABOUTDIALOG_H
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef INCLUDE_ADDPRESETDIALOG_H
|
||||
#define INCLUDE_ADDPRESETDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AddPresetDialog;
|
||||
}
|
||||
|
||||
class AddPresetDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddPresetDialog(const QStringList& groups, const QString& group, QWidget* parent = NULL);
|
||||
~AddPresetDialog();
|
||||
|
||||
QString group() const;
|
||||
QString description() const;
|
||||
|
||||
private:
|
||||
enum Audio {
|
||||
ATDefault,
|
||||
ATInterface,
|
||||
ATDevice
|
||||
};
|
||||
|
||||
Ui::AddPresetDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_ADDPRESETDIALOG_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef INCLUDE_BUTTONSWITCH_H
|
||||
#define INCLUDE_BUTTONSWITCH_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
class ButtonSwitch : public QToolButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ButtonSwitch(QWidget* parent = NULL);
|
||||
|
||||
private slots:
|
||||
void onToggled(bool checked);
|
||||
|
||||
private:
|
||||
QPalette m_originalPalette;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_BUTTONSWITCH_H
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef INCLUDE_CHANNELWINDOW_H
|
||||
#define INCLUDE_CHANNELWINDOW_H
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
class QBoxLayout;
|
||||
class QSpacerItem;
|
||||
class RollupWidget;
|
||||
|
||||
class ChannelWindow : public QScrollArea {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChannelWindow(QWidget* parent = NULL);
|
||||
|
||||
void addRollupWidget(QWidget* rollupWidget);
|
||||
|
||||
protected:
|
||||
QWidget* m_container;
|
||||
QBoxLayout* m_layout;
|
||||
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_CHANNELWINDOW_H
|
||||
@@ -0,0 +1,110 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_GLSCOPE_H
|
||||
#define INCLUDE_GLSCOPE_H
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QPen>
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/scopevis.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class DSPEngine;
|
||||
class ScopeVis;
|
||||
|
||||
class SDRANGELOVE_API GLScope: public QGLWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
ModeIQ,
|
||||
ModeMagLinPha,
|
||||
ModeMagdBPha,
|
||||
ModeDerived12,
|
||||
ModeCyclostationary
|
||||
};
|
||||
|
||||
GLScope(QWidget* parent = NULL);
|
||||
~GLScope();
|
||||
|
||||
void setDSPEngine(DSPEngine* dspEngine);
|
||||
void setAmp(Real amp);
|
||||
void setTimeBase(int timeBase);
|
||||
void setTimeOfsProMill(int timeOfsProMill);
|
||||
void setMode(Mode mode);
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
|
||||
void newTrace(const std::vector<Complex>& trace, int sampleRate);
|
||||
|
||||
int getTraceSize() const { return m_rawTrace.size(); }
|
||||
|
||||
signals:
|
||||
void traceSizeChanged(int);
|
||||
|
||||
private:
|
||||
// state
|
||||
QTimer m_timer;
|
||||
QMutex m_mutex;
|
||||
bool m_dataChanged;
|
||||
bool m_configChanged;
|
||||
Mode m_mode;
|
||||
Qt::Orientation m_orientation;
|
||||
|
||||
// traces
|
||||
std::vector<Complex> m_rawTrace;
|
||||
std::vector<Complex> m_mathTrace;
|
||||
std::vector<Complex>* m_displayTrace;
|
||||
int m_oldTraceSize;
|
||||
int m_sampleRate;
|
||||
Real m_amp1;
|
||||
Real m_amp2;
|
||||
Real m_ofs1;
|
||||
Real m_ofs2;
|
||||
|
||||
// sample sink
|
||||
DSPEngine* m_dspEngine;
|
||||
ScopeVis* m_scopeVis;
|
||||
|
||||
// config
|
||||
Real m_amp;
|
||||
int m_timeBase;
|
||||
int m_timeOfsProMill;
|
||||
ScopeVis::TriggerChannel m_triggerChannel;
|
||||
Real m_triggerLevelHigh;
|
||||
Real m_triggerLevelLow;
|
||||
|
||||
// graphics stuff
|
||||
QRectF m_glScopeRect1;
|
||||
QRectF m_glScopeRect2;
|
||||
|
||||
void initializeGL();
|
||||
void resizeGL(int width, int height);
|
||||
void paintGL();
|
||||
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
|
||||
void handleMode();
|
||||
void applyConfig();
|
||||
|
||||
protected slots:
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_GLSCOPE_H
|
||||
@@ -0,0 +1,157 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_GLSPECTRUM_H
|
||||
#define INCLUDE_GLSPECTRUM_H
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "gui/scaleengine.h"
|
||||
#include "dsp/channelmarker.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGELOVE_API GLSpectrum : public QGLWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GLSpectrum(QWidget* parent = NULL);
|
||||
~GLSpectrum();
|
||||
|
||||
void setCenterFrequency(quint64 frequency);
|
||||
void setSampleRate(qint32 sampleRate);
|
||||
void setReferenceLevel(Real referenceLevel);
|
||||
void setPowerRange(Real powerRange);
|
||||
void setDecay(int decay);
|
||||
void setDisplayWaterfall(bool display);
|
||||
void setInvertedWaterfall(bool inv);
|
||||
void setDisplayMaxHold(bool display);
|
||||
void setDisplayHistogram(bool display);
|
||||
void setDisplayGrid(bool display);
|
||||
|
||||
void addChannelMarker(ChannelMarker* channelMarker);
|
||||
void removeChannelMarker(ChannelMarker* channelMarker);
|
||||
|
||||
void newSpectrum(const std::vector<Real>& spectrum, int fftSize);
|
||||
|
||||
private:
|
||||
struct ChannelMarkerState {
|
||||
ChannelMarker* m_channelMarker;
|
||||
QRectF m_glRect;
|
||||
QRect m_rect;
|
||||
|
||||
ChannelMarkerState(ChannelMarker* channelMarker) :
|
||||
m_channelMarker(channelMarker),
|
||||
m_glRect()
|
||||
{ }
|
||||
};
|
||||
QList<ChannelMarkerState*> m_channelMarkerStates;
|
||||
|
||||
enum CursorState {
|
||||
CSNormal,
|
||||
CSSplitter,
|
||||
CSSplitterMoving,
|
||||
CSChannel,
|
||||
CSChannelMoving
|
||||
};
|
||||
|
||||
CursorState m_cursorState;
|
||||
int m_cursorChannel;
|
||||
|
||||
QTimer m_timer;
|
||||
QMutex m_mutex;
|
||||
bool m_mouseInside;
|
||||
bool m_changesPending;
|
||||
|
||||
qint64 m_centerFrequency;
|
||||
Real m_referenceLevel;
|
||||
Real m_powerRange;
|
||||
int m_decay;
|
||||
quint32 m_sampleRate;
|
||||
|
||||
int m_fftSize;
|
||||
|
||||
bool m_displayGrid;
|
||||
bool m_invertedWaterfall;
|
||||
|
||||
std::vector<Real> m_maxHold;
|
||||
bool m_displayMaxHold;
|
||||
|
||||
Real m_waterfallShare;
|
||||
|
||||
QPixmap m_leftMarginPixmap;
|
||||
bool m_leftMarginTextureAllocated;
|
||||
GLuint m_leftMarginTexture;
|
||||
QPixmap m_frequencyPixmap;
|
||||
bool m_frequencyTextureAllocated;
|
||||
GLuint m_frequencyTexture;
|
||||
ScaleEngine m_timeScale;
|
||||
ScaleEngine m_powerScale;
|
||||
ScaleEngine m_frequencyScale;
|
||||
QRectF m_glLeftScaleRect;
|
||||
QRectF m_glFrequencyScaleRect;
|
||||
QRect m_frequencyScaleRect;
|
||||
|
||||
QRgb m_waterfallPalette[240];
|
||||
QImage* m_waterfallBuffer;
|
||||
int m_waterfallBufferPos;
|
||||
bool m_waterfallTextureAllocated;
|
||||
GLuint m_waterfallTexture;
|
||||
int m_waterfallTextureHeight;
|
||||
int m_waterfallTexturePos;
|
||||
QRectF m_glWaterfallRect;
|
||||
bool m_displayWaterfall;
|
||||
|
||||
QRgb m_histogramPalette[240];
|
||||
QImage* m_histogramBuffer;
|
||||
quint8* m_histogram;
|
||||
quint8* m_histogramHoldoff;
|
||||
bool m_histogramTextureAllocated;
|
||||
GLuint m_histogramTexture;
|
||||
int m_histogramHoldoffBase;
|
||||
int m_histogramHoldoffCount;
|
||||
int m_histogramLateHoldoff;
|
||||
QRectF m_glHistogramRect;
|
||||
bool m_displayHistogram;
|
||||
|
||||
bool m_displayChanged;
|
||||
|
||||
void updateWaterfall(const std::vector<Real>& spectrum);
|
||||
void updateHistogram(const std::vector<Real>& spectrum);
|
||||
|
||||
void initializeGL();
|
||||
void resizeGL(int width, int height);
|
||||
void paintGL();
|
||||
|
||||
void stopDrag();
|
||||
void applyChanges();
|
||||
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
void enterEvent(QEvent* event);
|
||||
void leaveEvent(QEvent* event);
|
||||
|
||||
private slots:
|
||||
void tick();
|
||||
void channelMarkerChanged();
|
||||
void channelMarkerDestroyed(QObject* object);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_GLSPECTRUM_H
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef INCLUDE_GLSPECTRUMGUI_H
|
||||
#define INCLUDE_GLSPECTRUMGUI_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "util/export.h"
|
||||
|
||||
namespace Ui {
|
||||
class GLSpectrumGUI;
|
||||
}
|
||||
|
||||
class MessageQueue;
|
||||
class SpectrumVis;
|
||||
class GLSpectrum;
|
||||
|
||||
class SDRANGELOVE_API GLSpectrumGUI : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GLSpectrumGUI(QWidget* parent = NULL);
|
||||
~GLSpectrumGUI();
|
||||
|
||||
void setBuddies(MessageQueue* messageQueue, SpectrumVis* spectrumVis, GLSpectrum* glSpectrum);
|
||||
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
private:
|
||||
Ui::GLSpectrumGUI* ui;
|
||||
|
||||
MessageQueue* m_messageQueue;
|
||||
SpectrumVis* m_spectrumVis;
|
||||
GLSpectrum* m_glSpectrum;
|
||||
|
||||
qint32 m_fftSize;
|
||||
qint32 m_fftOverlap;
|
||||
qint32 m_fftWindow;
|
||||
Real m_refLevel;
|
||||
Real m_powerRange;
|
||||
int m_decay;
|
||||
bool m_displayWaterfall;
|
||||
bool m_invertedWaterfall;
|
||||
bool m_displayMaxHold;
|
||||
bool m_displayHistogram;
|
||||
bool m_displayGrid;
|
||||
bool m_invert;
|
||||
|
||||
void applySettings();
|
||||
|
||||
private slots:
|
||||
void on_fftWindow_currentIndexChanged(int index);
|
||||
void on_fftSize_currentIndexChanged(int index);
|
||||
void on_refLevel_currentIndexChanged(int index);
|
||||
void on_levelRange_currentIndexChanged(int index);
|
||||
void on_decay_currentIndexChanged(int index);
|
||||
|
||||
void on_waterfall_toggled(bool checked);
|
||||
void on_histogram_toggled(bool checked);
|
||||
void on_maxHold_toggled(bool checked);
|
||||
void on_invert_toggled(bool checked);
|
||||
void on_grid_toggled(bool checked);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_GLSPECTRUMGUI_H
|
||||
@@ -0,0 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_INDICATOR_H
|
||||
#define INCLUDE_INDICATOR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGELOVE_API Indicator : public QWidget {
|
||||
private:
|
||||
Q_OBJECT;
|
||||
|
||||
QColor m_color;
|
||||
QString m_text;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
QSize sizeHint() const;
|
||||
|
||||
public:
|
||||
Indicator(const QString& text, QWidget* parent = NULL);
|
||||
|
||||
void setColor(const QColor& color);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INDICATOR_H
|
||||
@@ -0,0 +1,35 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_PHYSICALUNIT_H
|
||||
#define INCLUDE_PHYSICALUNIT_H
|
||||
|
||||
namespace Unit {
|
||||
enum Physical {
|
||||
None,
|
||||
Frequency,
|
||||
Information,
|
||||
Percent,
|
||||
Decibel,
|
||||
DecibelMilliWatt,
|
||||
DecibelMicroVolt,
|
||||
AngleDegrees,
|
||||
Time
|
||||
};
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PHYSICALUNIT_H
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef INCLUDE_PLUGINSDIALOG_H
|
||||
#define INCLUDE_PLUGINSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "plugin/pluginmanager.h"
|
||||
|
||||
namespace Ui {
|
||||
class PluginsDialog;
|
||||
}
|
||||
|
||||
class PluginsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PluginsDialog(PluginManager* pluginManager, QWidget* parent = NULL);
|
||||
~PluginsDialog();
|
||||
|
||||
private:
|
||||
Ui::PluginsDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PLUGINSDIALOG_H
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef INCLUDE_PREFERENCESDIALOG_H
|
||||
#define INCLUDE_PREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class AudioDeviceInfo;
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesDialog;
|
||||
}
|
||||
|
||||
class PreferencesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferencesDialog(AudioDeviceInfo* audioDeviceInfo, QWidget* parent = NULL);
|
||||
~PreferencesDialog();
|
||||
|
||||
private:
|
||||
enum Audio {
|
||||
ATDefault,
|
||||
ATInterface,
|
||||
ATDevice
|
||||
};
|
||||
|
||||
Ui::PreferencesDialog* ui;
|
||||
|
||||
AudioDeviceInfo* m_audioDeviceInfo;
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PREFERENCESDIALOG_H
|
||||
@@ -0,0 +1,27 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
class PresetItem : public QTreeWidgetItem {
|
||||
public:
|
||||
PresetItem(QTreeWidgetItem* parent, const QStringList& strings, quint64 frequency, int type);
|
||||
bool operator<(const QTreeWidgetItem& other) const;
|
||||
|
||||
private:
|
||||
quint64 m_frequency;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QWidget>
|
||||
#include "gui/scaleengine.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGELOVE_API Scale : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Scale(QWidget* parent = NULL);
|
||||
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax);
|
||||
|
||||
private:
|
||||
Qt::Orientation m_orientation;
|
||||
ScaleEngine m_scaleEngine;
|
||||
|
||||
void paintEvent(QPaintEvent*);
|
||||
void resizeEvent(QResizeEvent*);
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_SCALEENGINE_H
|
||||
#define INCLUDE_SCALEENGINE_H
|
||||
|
||||
#include <QFont>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include "physicalunit.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGELOVE_API ScaleEngine {
|
||||
public:
|
||||
struct Tick {
|
||||
float pos;
|
||||
bool major;
|
||||
float textPos;
|
||||
float textSize;
|
||||
QString text;
|
||||
};
|
||||
typedef QList<Tick> TickList;
|
||||
|
||||
private:
|
||||
// base configuration
|
||||
Qt::Orientation m_orientation;
|
||||
QFont m_font;
|
||||
float m_charSize;
|
||||
|
||||
// graph configuration
|
||||
float m_size;
|
||||
Unit::Physical m_physicalUnit;
|
||||
float m_rangeMin;
|
||||
float m_rangeMax;
|
||||
|
||||
// calculated values
|
||||
bool m_recalc;
|
||||
double m_scale;
|
||||
QString m_unitStr;
|
||||
TickList m_tickList;
|
||||
double m_majorTickValueDistance;
|
||||
double m_firstMajorTickValue;
|
||||
int m_numMinorTicks;
|
||||
int m_decimalPlaces;
|
||||
|
||||
QString formatTick(double value, int decimalPlaces, bool fancyTime = true);
|
||||
void calcCharSize();
|
||||
void calcScaleFactor();
|
||||
double calcMajorTickUnits(double distance, int* retDecimalPlaces);
|
||||
int calcTickTextSize();
|
||||
void forceTwoTicks();
|
||||
void reCalc();
|
||||
|
||||
double majorTickValue(int tick);
|
||||
double minorTickValue(int tick);
|
||||
|
||||
public:
|
||||
ScaleEngine();
|
||||
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
void setFont(const QFont& font);
|
||||
void setSize(float size);
|
||||
float getSize() { return m_size; }
|
||||
void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax);
|
||||
|
||||
float getPosFromValue(double value);
|
||||
float getValueFromPos(double pos);
|
||||
const TickList& getTickList();
|
||||
|
||||
QString getRangeMinStr();
|
||||
QString getRangeMaxStr();
|
||||
|
||||
float getScaleWidth();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SCALEENGINE_H
|
||||
@@ -0,0 +1,67 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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 INCLUDE_SCOPEWINDOW_H
|
||||
#define INCLUDE_SCOPEWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class DSPEngine;
|
||||
|
||||
namespace Ui {
|
||||
class ScopeWindow;
|
||||
}
|
||||
|
||||
class SDRANGELOVE_API ScopeWindow : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScopeWindow(DSPEngine* dspEngine, QWidget* parent = NULL);
|
||||
~ScopeWindow();
|
||||
|
||||
void setSampleRate(int sampleRate);
|
||||
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
private slots:
|
||||
void on_amp_valueChanged(int value);
|
||||
void on_scope_traceSizeChanged(int value);
|
||||
void on_time_valueChanged(int value);
|
||||
void on_timeOfs_valueChanged(int value);
|
||||
void on_displayMode_currentIndexChanged(int index);
|
||||
|
||||
void on_horizView_clicked();
|
||||
void on_vertView_clicked();
|
||||
|
||||
private:
|
||||
Ui::ScopeWindow *ui;
|
||||
int m_sampleRate;
|
||||
|
||||
qint32 m_displayData;
|
||||
qint32 m_displayOrientation;
|
||||
qint32 m_timeBase;
|
||||
qint32 m_timeOffset;
|
||||
qint32 m_amplification;
|
||||
|
||||
void applySettings();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SCOPEWINDOW_H
|
||||
@@ -0,0 +1,72 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// 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 //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGELOVE_API ValueDial : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValueDial(QWidget* parent = NULL);
|
||||
|
||||
void setValue(quint64 value);
|
||||
void setValueRange(uint numDigits, quint64 min, quint64 max);
|
||||
void setFont(const QFont& font);
|
||||
|
||||
signals:
|
||||
void changed(quint64 value);
|
||||
|
||||
private:
|
||||
QLinearGradient m_background;
|
||||
int m_numDigits;
|
||||
int m_numDecimalPoints;
|
||||
int m_digitWidth;
|
||||
int m_digitHeight;
|
||||
int m_hightlightedDigit;
|
||||
int m_cursor;
|
||||
bool m_cursorState;
|
||||
quint64 m_value;
|
||||
quint64 m_valueMax;
|
||||
quint64 m_valueMin;
|
||||
QString m_text;
|
||||
|
||||
quint64 m_valueNew;
|
||||
QString m_textNew;
|
||||
int m_animationState;
|
||||
QTimer m_animationTimer;
|
||||
QTimer m_blinkTimer;
|
||||
|
||||
quint64 findExponent(int digit);
|
||||
QChar digitNeigh(QChar c, bool dir);
|
||||
QString formatText(quint64 value);
|
||||
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseMoveEvent(QMouseEvent*);
|
||||
void wheelEvent(QWheelEvent*);
|
||||
void leaveEvent(QEvent*);
|
||||
void keyPressEvent(QKeyEvent*);
|
||||
void focusInEvent(QFocusEvent*);
|
||||
void focusOutEvent(QFocusEvent*);
|
||||
|
||||
private slots:
|
||||
void animate();
|
||||
void blink();
|
||||
};
|
||||
Reference in New Issue
Block a user