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