summaryrefslogtreecommitdiffstats
path: root/include-gpl/mainwindow.h
blob: 0f0b48106b3ed24a5720bbaf2baf474ce0d9a254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
///////////////////////////////////////////////////////////////////////////////////
// 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_MAINWINDOW_H
#define INCLUDE_MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include "settings/settings.h"
#include "util/export.h"

class QLabel;
class QTreeWidgetItem;
class QDir;

class AudioDeviceInfo;
class DSPEngine;
class Indicator;
class ScopeWindow;
class SpectrumVis;
class SampleSource;
class PluginAPI;
class PluginGUI;
class ChannelMarker;
class MessageQueue;
class PluginManager;
class PluginInterface;

namespace Ui {
	class MainWindow;
}

class SDRANGELOVE_API MainWindow : public QMainWindow {
	Q_OBJECT

public:
	explicit MainWindow(QWidget* parent = NULL);
	~MainWindow();

	MessageQueue* getMessageQueue() { return m_messageQueue; }

	void addChannelCreateAction(QAction* action);
	void addChannelRollup(QWidget* widget);
	void addViewAction(QAction* action);

	void addChannelMarker(ChannelMarker* channelMarker);
	void removeChannelMarker(ChannelMarker* channelMarker);

	void setInputGUI(QWidget* gui);

private:
	enum {
		PGroup,
		PItem
	};

	Ui::MainWindow* ui;

	AudioDeviceInfo* m_audioDeviceInfo;

	MessageQueue* m_messageQueue;

	Settings m_settings;

	SpectrumVis* m_spectrumVis;

	DSPEngine* m_dspEngine;

	QTimer m_statusTimer;
	int m_lastEngineState;

	QLabel* m_sampleRateWidget;
	Indicator* m_engineIdle;
	Indicator* m_engineRunning;
	Indicator* m_engineError;

	bool m_startOsmoSDRUpdateAfterStop;

	ScopeWindow* m_scopeWindow;
	QWidget* m_inputGUI;

	int m_sampleRate;
	quint64 m_centerFrequency;

	PluginManager* m_pluginManager;

	void loadSettings();
	void loadSettings(const Preset* preset);
	void saveSettings(Preset* preset);
	void saveSettings();

	void createStatusBar();
	void closeEvent(QCloseEvent*);
	void updateCenterFreqDisplay();
	void updateSampleRate();
	void updatePresets();
	QTreeWidgetItem* addPresetToTree(const Preset* preset);
	void applySettings();

private slots:
	void handleMessages();
	void updateStatus();
	void scopeWindowDestroyed();
	void on_action_Start_triggered();
	void on_action_Stop_triggered();
	void on_dcOffset_toggled(bool checked);
	void on_iqImbalance_toggled(bool checked);
	void on_action_View_Fullscreen_toggled(bool checked);
	void on_actionOsmoSDR_Firmware_Upgrade_triggered();
	void on_presetSave_clicked();
	void on_presetLoad_clicked();
	void on_presetDelete_clicked();
	void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
	void on_presetTree_itemActivated(QTreeWidgetItem *item, int column);
	void on_action_Oscilloscope_triggered();
	void on_action_Loaded_Plugins_triggered();
	void on_action_Preferences_triggered();
	void on_sampleSource_currentIndexChanged(int index);
	void on_action_About_triggered();
};

#endif // INCLUDE_MAINWINDOW_H