1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-03 15:31:15 -05:00
sdrangel/sdrgui/mainwindow.h

232 lines
8.2 KiB
C
Raw Normal View History

///////////////////////////////////////////////////////////////////////////////////
// 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 //
// (at your option) any later version. //
// //
// 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>
#include "settings/mainsettings.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "export.h"
#include "mainparser.h"
#include "maincore.h"
class QLabel;
class QTreeWidgetItem;
class QDir;
class DSPEngine;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class Indicator;
class GLSpectrumGUI;
class MainSpectrumGUI;
class PluginAPI;
class ChannelGUI;
class ChannelMarker;
class PluginManager;
2019-05-08 16:11:53 -04:00
class DeviceAPI;
class DeviceUISet;
class FeatureUISet;
class PluginInterface;
class QWidget;
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;
class CommandKeyReceiver;
class ConfigurationsDialog;
2022-04-04 04:23:52 -04:00
class QMenuBar;
class Workspace;
// namespace Ui {
// class MainWindow;
// }
2018-03-03 14:23:38 -05:00
class SDRGUI_API MainWindow : public QMainWindow {
Q_OBJECT
public:
2022-04-04 04:23:52 -04:00
explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = nullptr);
~MainWindow();
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
const PluginManager *getPluginManager() const { return m_pluginManager; }
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(); }
public slots:
void channelMove(ChannelGUI *gui, int wsIndexDestnation);
private:
enum {
PGroup,
PItem
};
struct DeviceWidgetTabData
{
QWidget *gui;
QString displayName;
QString tabName;
};
static MainWindow *m_instance;
2022-04-04 04:23:52 -04:00
QList<Workspace*> m_workspaces;
Workspace *m_currentWorkspace;
// Ui::MainWindow* ui;
MessageQueue m_inputMessageQueue;
MainCore *m_mainCore;
std::vector<DeviceUISet*> m_deviceUIs;
std::vector<FeatureUISet*> m_featureUIs;
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;
QLabel* m_dateTimeWidget;
QLabel* m_showSystemWidget;
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;
QAction *m_spectrumToggleViewAction;
CommandKeyReceiver *m_commandKeyReceiver;
2021-11-01 20:04:43 -04:00
QProcess *m_fftWisdomProcess;
void loadSettings();
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);
QString openGLVersion();
2022-04-04 04:23:52 -04:00
void createMenuBar();
void createStatusBar();
void closeEvent(QCloseEvent*);
void updatePresetControls();
QTreeWidgetItem* addPresetToTree(const Preset* preset);
void applySettings();
void removeDeviceSet(int deviceSetIndex);
void removeLastDevice();
void addFeatureSet();
void removeFeatureSet(unsigned int featureSetIndex);
void removeAllFeatureSets();
void deleteChannel(int deviceSetIndex, int channelIndex);
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);
void sampleSourceCreate(
int deviceSetIndex,
int deviceIndex,
DeviceAPI *deviceAPI,
DeviceUISet *deviceUISet
);
void sampleSinkCreate(
int deviceSetIndex,
int deviceIndex,
DeviceAPI *deviceAPI,
DeviceUISet *deviceUISet
);
void sampleMIMOCreate(
int deviceSetIndex,
int deviceIndex,
DeviceAPI *deviceAPI,
DeviceUISet *deviceUISet
);
void deleteFeature(int featureSetIndex, int featureIndex);
bool handleMessage(const Message& cmd);
private slots:
void handleMessages();
2022-04-04 04:23:52 -04:00
void handleWorkspaceVisibility(Workspace *workspace, bool visibility);
void updateStatus();
2022-04-04 04:23:52 -04:00
void addWorkspace();
void viewAllWorkspaces();
void removeEmptyWorkspaces();
void loadConfiguration(const Configuration *configuration, bool fromDialog = false);
void saveConfiguration(Configuration *configuration);
void sampleSourceAdd(Workspace *workspace, int deviceIndex);
void sampleSinkAdd(Workspace *workspace, int deviceIndex);
void sampleMIMOAdd(Workspace *workspace, int deviceIndex);
void sampleDeviceChangeHandler(DeviceGUI *deviceGUI, int newDeviceIndex);
2022-04-04 04:23:52 -04:00
void on_action_View_Fullscreen_toggled(bool checked);
void on_presetSave_clicked();
void on_presetUpdate_clicked();
void on_presetEdit_clicked();
void on_presetExport_clicked();
void on_presetImport_clicked();
void on_action_saveAll_triggered();
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_Configurations_triggered();
void on_action_Audio_triggered();
void on_action_Logging_triggered();
2021-11-01 20:04:43 -04:00
void on_action_FFT_triggered();
2019-07-19 12:38:03 -04:00
void on_action_AMBE_triggered();
2020-01-11 19:10:51 -05:00
void on_action_LimeRFE_triggered();
void on_action_My_Position_triggered();
2019-06-12 12:50:53 -04:00
void on_action_DeviceUserArguments_triggered();
void on_action_commands_triggered();
void channelAddClicked(Workspace *workspace, int deviceSetIndex, int channelIndex);
2022-04-04 04:23:52 -04:00
void featureAddClicked(Workspace *workspace, int featureIndex);
void featureMove(FeatureGUI *gui, int wsIndexDestnation);
void openFeaturePresetsDialog(QPoint p, Workspace *workspace);
void deviceMove(DeviceGUI *gui, int wsIndexDestnation);
void mainSpectrumMove(MainSpectrumGUI *gui, int wsIndexDestnation);
void mainSpectrumShow(MainSpectrumGUI *gui);
void showAllChannels(int deviceSetIndex);
2021-11-24 06:31:51 -05: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 on_action_removeLastDevice_triggered();
void on_action_addFeatureSet_triggered();
void on_action_removeLastFeatureSet_triggered();
void tabInputViewIndexChanged();
void tabChannelsIndexChanged();
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);
};
#endif // INCLUDE_MAINWINDOW_H