2017-10-22 17:12:43 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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 //
|
2019-04-11 12:43:33 +00:00
|
|
|
// (at your option) any later version. //
|
2017-10-22 17:12:43 +00: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 INCLUDE_MAINWINDOW_H
|
|
|
|
#define INCLUDE_MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QList>
|
2021-11-02 00:04:43 +00:00
|
|
|
#include <QProcess>
|
2017-10-22 17:12:43 +00:00
|
|
|
|
|
|
|
#include "settings/mainsettings.h"
|
2017-11-25 15:08:18 +00:00
|
|
|
#include "util/message.h"
|
2017-10-22 17:12:43 +00:00
|
|
|
#include "util/messagequeue.h"
|
2018-03-20 12:49:21 +00:00
|
|
|
#include "export.h"
|
2017-11-18 04:06:43 +00:00
|
|
|
#include "mainparser.h"
|
2020-10-10 18:08:11 +00:00
|
|
|
#include "maincore.h"
|
2017-10-22 17:12:43 +00:00
|
|
|
|
|
|
|
class QLabel;
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class QDir;
|
2022-12-20 21:06:39 +00:00
|
|
|
class QToolButton;
|
2017-10-22 17:12:43 +00:00
|
|
|
|
|
|
|
class DSPEngine;
|
|
|
|
class DSPDeviceSourceEngine;
|
|
|
|
class DSPDeviceSinkEngine;
|
|
|
|
class Indicator;
|
|
|
|
class GLSpectrumGUI;
|
2022-04-09 11:38:22 +00:00
|
|
|
class MainSpectrumGUI;
|
2017-10-22 17:12:43 +00:00
|
|
|
class PluginAPI;
|
2020-10-04 04:16:15 +00:00
|
|
|
class ChannelGUI;
|
2017-10-22 17:12:43 +00:00
|
|
|
class ChannelMarker;
|
|
|
|
class PluginManager;
|
2019-05-08 20:11:53 +00:00
|
|
|
class DeviceAPI;
|
2017-10-24 16:34:39 +00:00
|
|
|
class DeviceUISet;
|
2020-09-19 23:06:34 +00:00
|
|
|
class FeatureUISet;
|
2017-10-22 17:12:43 +00:00
|
|
|
class PluginInterface;
|
|
|
|
class QWidget;
|
2017-11-17 07:52:15 +00:00
|
|
|
class WebAPIRequestMapper;
|
|
|
|
class WebAPIServer;
|
2020-10-11 10:39:30 +00:00
|
|
|
class WebAPIAdapter;
|
2018-01-04 10:11:53 +00:00
|
|
|
class Preset;
|
|
|
|
class Command;
|
2020-09-24 03:38:05 +00:00
|
|
|
class FeatureSetPreset;
|
2018-01-05 04:05:12 +00:00
|
|
|
class CommandKeyReceiver;
|
2022-04-12 14:20:45 +00:00
|
|
|
class ConfigurationsDialog;
|
2017-10-22 17:12:43 +00:00
|
|
|
|
2022-04-04 08:23:52 +00:00
|
|
|
class QMenuBar;
|
|
|
|
class Workspace;
|
|
|
|
|
|
|
|
// namespace Ui {
|
|
|
|
// class MainWindow;
|
|
|
|
// }
|
2017-10-22 17:12:43 +00:00
|
|
|
|
2018-03-03 19:23:38 +00:00
|
|
|
class SDRGUI_API MainWindow : public QMainWindow {
|
2017-10-22 17:12:43 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-04-04 08:23:52 +00:00
|
|
|
explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = nullptr);
|
2017-10-22 17:12:43 +00:00
|
|
|
~MainWindow();
|
2017-10-24 11:45:10 +00:00
|
|
|
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
|
2017-10-22 17:12:43 +00:00
|
|
|
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
2019-08-01 16:50:21 +00:00
|
|
|
const PluginManager *getPluginManager() const { return m_pluginManager; }
|
2020-01-21 17:05:14 +00:00
|
|
|
std::vector<DeviceUISet*>& getDeviceUISets() { return m_deviceUIs; }
|
2019-07-29 16:54:50 +00:00
|
|
|
void commandKeysConnect(QObject *object, const char *slot);
|
|
|
|
void commandKeysDisconnect(QObject *object, const char *slot);
|
2022-04-04 08:23:52 +00:00
|
|
|
int getNumberOfWorkspaces() const { return m_workspaces.size(); }
|
2017-10-22 17:12:43 +00:00
|
|
|
|
2022-04-12 14:20:45 +00:00
|
|
|
public slots:
|
2022-04-16 14:45:53 +00:00
|
|
|
void channelMove(ChannelGUI *gui, int wsIndexDestination);
|
2022-04-15 16:59:29 +00:00
|
|
|
void channelDuplicate(ChannelGUI *gui);
|
2022-04-16 14:45:53 +00:00
|
|
|
void channelMoveToDeviceSet(ChannelGUI *gui, int dsIndexDestination);
|
2022-04-12 14:20:45 +00:00
|
|
|
|
2017-10-22 17:12:43 +00:00
|
|
|
private:
|
2017-11-25 18:42:56 +00:00
|
|
|
enum {
|
2017-10-22 17:12:43 +00:00
|
|
|
PGroup,
|
|
|
|
PItem
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeviceWidgetTabData
|
|
|
|
{
|
|
|
|
QWidget *gui;
|
|
|
|
QString displayName;
|
|
|
|
QString tabName;
|
|
|
|
};
|
|
|
|
|
2017-10-24 11:45:10 +00:00
|
|
|
static MainWindow *m_instance;
|
2022-04-04 08:23:52 +00:00
|
|
|
QList<Workspace*> m_workspaces;
|
|
|
|
Workspace *m_currentWorkspace;
|
|
|
|
// Ui::MainWindow* ui;
|
2017-10-22 17:12:43 +00:00
|
|
|
MessageQueue m_inputMessageQueue;
|
2020-10-10 18:08:11 +00:00
|
|
|
MainCore *m_mainCore;
|
2017-10-22 17:12:43 +00:00
|
|
|
std::vector<DeviceUISet*> m_deviceUIs;
|
2020-09-19 23:06:34 +00:00
|
|
|
std::vector<FeatureUISet*> m_featureUIs;
|
2017-10-22 17:12:43 +00:00
|
|
|
QList<DeviceWidgetTabData> m_deviceWidgetTabs;
|
|
|
|
|
|
|
|
DSPEngine* m_dspEngine;
|
|
|
|
PluginManager* m_pluginManager;
|
|
|
|
|
|
|
|
QTimer m_statusTimer;
|
|
|
|
int m_lastEngineState;
|
|
|
|
|
2022-04-04 08:23:52 +00:00
|
|
|
QMenuBar *m_menuBar;
|
2017-10-22 17:12:43 +00:00
|
|
|
QLabel* m_dateTimeWidget;
|
|
|
|
QLabel* m_showSystemWidget;
|
|
|
|
|
2017-11-17 07:52:15 +00:00
|
|
|
WebAPIRequestMapper *m_requestMapper;
|
|
|
|
WebAPIServer *m_apiServer;
|
2020-10-11 10:39:30 +00:00
|
|
|
WebAPIAdapter *m_apiAdapter;
|
2018-01-11 23:57:05 +00:00
|
|
|
QString m_apiHost;
|
|
|
|
int m_apiPort;
|
2022-02-15 23:49:22 +00:00
|
|
|
QAction *m_spectrumToggleViewAction;
|
2017-11-17 07:52:15 +00:00
|
|
|
|
2018-01-05 04:05:12 +00:00
|
|
|
CommandKeyReceiver *m_commandKeyReceiver;
|
|
|
|
|
2021-11-02 00:04:43 +00:00
|
|
|
QProcess *m_fftWisdomProcess;
|
|
|
|
|
2017-10-22 17:12:43 +00:00
|
|
|
void loadSettings();
|
2022-04-09 11:38:22 +00:00
|
|
|
void loadDeviceSetPresetSettings(const Preset* preset, int deviceSetIndex);
|
|
|
|
void saveDeviceSetPresetSettings(Preset* preset, int deviceSetIndex);
|
2022-04-04 08:23:52 +00:00
|
|
|
void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex, Workspace *workspace);
|
2020-09-24 03:38:05 +00:00
|
|
|
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
|
2017-10-22 17:12:43 +00:00
|
|
|
|
2021-12-13 10:23:05 +00:00
|
|
|
QString openGLVersion();
|
2022-12-20 21:06:39 +00:00
|
|
|
void createMenuBar(QToolButton *button);
|
2017-10-22 17:12:43 +00:00
|
|
|
void createStatusBar();
|
|
|
|
void closeEvent(QCloseEvent*);
|
|
|
|
void applySettings();
|
|
|
|
|
2022-04-12 14:20:45 +00:00
|
|
|
void removeDeviceSet(int deviceSetIndex);
|
2022-04-15 08:04:24 +00:00
|
|
|
void removeLastDeviceSet();
|
2020-09-19 23:06:34 +00:00
|
|
|
void addFeatureSet();
|
2022-04-12 14:20:45 +00:00
|
|
|
void removeFeatureSet(unsigned int featureSetIndex);
|
2020-09-19 23:06:34 +00:00
|
|
|
void removeAllFeatureSets();
|
2017-12-23 22:41:37 +00:00
|
|
|
void deleteChannel(int deviceSetIndex, int channelIndex);
|
2022-04-16 14:45:53 +00:00
|
|
|
void channelDuplicateToDeviceSet(ChannelGUI *sourceChannelGUI, int dsIndexDestination);
|
2022-04-07 14:32:03 +00:00
|
|
|
void sampleDeviceChange(int deviceType, int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
|
|
|
void sampleSourceChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
|
|
|
void sampleSinkChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
|
|
|
void sampleMIMOChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
2022-04-09 11:38:22 +00:00
|
|
|
void sampleSourceCreate(
|
2022-04-07 14:32:03 +00:00
|
|
|
int deviceSetIndex,
|
|
|
|
int deviceIndex,
|
2022-04-09 11:38:22 +00:00
|
|
|
DeviceUISet *deviceUISet
|
2022-04-07 14:32:03 +00:00
|
|
|
);
|
2022-04-09 11:38:22 +00:00
|
|
|
void sampleSinkCreate(
|
2022-04-07 14:32:03 +00:00
|
|
|
int deviceSetIndex,
|
|
|
|
int deviceIndex,
|
2022-04-09 11:38:22 +00:00
|
|
|
DeviceUISet *deviceUISet
|
2022-04-07 14:32:03 +00:00
|
|
|
);
|
2022-04-09 11:38:22 +00:00
|
|
|
void sampleMIMOCreate(
|
2022-04-07 14:32:03 +00:00
|
|
|
int deviceSetIndex,
|
|
|
|
int deviceIndex,
|
2022-04-09 11:38:22 +00:00
|
|
|
DeviceUISet *deviceUISet
|
2022-04-07 14:32:03 +00:00
|
|
|
);
|
2020-09-21 01:13:36 +00:00
|
|
|
void deleteFeature(int featureSetIndex, int featureIndex);
|
2017-10-22 17:12:43 +00:00
|
|
|
|
2017-11-25 15:08:18 +00:00
|
|
|
bool handleMessage(const Message& cmd);
|
|
|
|
|
2022-12-20 21:06:39 +00:00
|
|
|
protected:
|
|
|
|
virtual void keyPressEvent(QKeyEvent* event) override;
|
|
|
|
|
2017-10-22 17:12:43 +00:00
|
|
|
private slots:
|
|
|
|
void handleMessages();
|
2022-04-04 08:23:52 +00:00
|
|
|
void handleWorkspaceVisibility(Workspace *workspace, bool visibility);
|
|
|
|
|
2023-02-17 21:57:09 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
void on_action_View_KeepScreenOn_toggled(bool checked);
|
|
|
|
#endif
|
2017-10-22 17:12:43 +00:00
|
|
|
void on_action_View_Fullscreen_toggled(bool checked);
|
2022-04-05 14:26:57 +00:00
|
|
|
void on_action_saveAll_triggered();
|
|
|
|
void on_action_Configurations_triggered();
|
2017-10-22 17:12:43 +00:00
|
|
|
void on_action_Audio_triggered();
|
2022-06-18 11:35:44 +00:00
|
|
|
void on_action_Graphics_triggered();
|
2017-11-11 18:26:23 +00:00
|
|
|
void on_action_Logging_triggered();
|
2021-11-02 00:04:43 +00:00
|
|
|
void on_action_FFT_triggered();
|
2017-10-22 17:12:43 +00:00
|
|
|
void on_action_My_Position_triggered();
|
2019-06-12 16:50:53 +00:00
|
|
|
void on_action_DeviceUserArguments_triggered();
|
2022-04-04 14:13:42 +00:00
|
|
|
void on_action_commands_triggered();
|
2022-04-15 08:04:24 +00:00
|
|
|
void on_action_Quick_Start_triggered();
|
|
|
|
void on_action_Main_Window_triggered();
|
|
|
|
void on_action_Loaded_Plugins_triggered();
|
|
|
|
void on_action_About_triggered();
|
|
|
|
|
|
|
|
void updateStatus();
|
|
|
|
void addWorkspace();
|
|
|
|
void viewAllWorkspaces();
|
|
|
|
void removeEmptyWorkspaces();
|
2022-12-20 21:06:39 +00:00
|
|
|
void openConfigurationDialog(bool openOnly);
|
|
|
|
void loadDefaultConfigurations();
|
2022-04-15 08:04:24 +00:00
|
|
|
void loadConfiguration(const Configuration *configuration, bool fromDialog = false);
|
|
|
|
void saveConfiguration(Configuration *configuration);
|
|
|
|
void sampleSourceAdd(Workspace *deviceWorkspace, Workspace *spectrumWorkspace, int deviceIndex);
|
|
|
|
void sampleSinkAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
|
|
|
void sampleMIMOAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
|
|
|
void samplingDeviceChangeHandler(DeviceGUI *deviceGUI, int newDeviceIndex);
|
2022-04-15 16:59:29 +00:00
|
|
|
void channelAddClicked(Workspace *workspace, int deviceSetIndex, int channelPluginIndex);
|
2022-04-04 08:23:52 +00:00
|
|
|
void featureAddClicked(Workspace *workspace, int featureIndex);
|
|
|
|
void featureMove(FeatureGUI *gui, int wsIndexDestnation);
|
2022-08-27 09:18:17 +00:00
|
|
|
void deviceStateChanged(DeviceAPI *deviceAPI);
|
2022-04-04 08:23:52 +00:00
|
|
|
void openFeaturePresetsDialog(QPoint p, Workspace *workspace);
|
2022-08-27 09:18:17 +00:00
|
|
|
void startAllDevices(Workspace *workspace);
|
|
|
|
void stopAllDevices(Workspace *workspace);
|
2022-04-07 14:32:03 +00:00
|
|
|
void deviceMove(DeviceGUI *gui, int wsIndexDestnation);
|
2022-04-09 11:38:22 +00:00
|
|
|
void mainSpectrumMove(MainSpectrumGUI *gui, int wsIndexDestnation);
|
2022-04-27 22:01:08 +00:00
|
|
|
void mainSpectrumShow(int deviceSetIndex);
|
2022-06-24 20:52:17 +00:00
|
|
|
void mainSpectrumRequestDeviceCenterFrequency(int deviceSetIndex, qint64 deviceCenterFrequency);
|
2022-04-12 14:20:45 +00:00
|
|
|
void showAllChannels(int deviceSetIndex);
|
2022-04-13 16:43:37 +00:00
|
|
|
void openDeviceSetPresetsDialog(QPoint p, DeviceGUI *deviceGUI);
|
2018-01-05 04:05:12 +00:00
|
|
|
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
|
2021-11-02 00:04:43 +00:00
|
|
|
void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
2022-12-20 21:06:39 +00:00
|
|
|
void orientationChanged(Qt::ScreenOrientation orientation);
|
2017-10-22 17:12:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_MAINWINDOW_H
|