diff --git a/app/main.cpp b/app/main.cpp index 913e0f69c..0b02ffef8 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -33,7 +33,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo */ QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setApplicationName("SDRangel"); - QCoreApplication::setApplicationVersion("3.9.1"); + QCoreApplication::setApplicationVersion("3.10.0"); #if 1 qApp->setStyle(QStyleFactory::create("fusion")); diff --git a/doc/img/edit.xcf b/doc/img/edit.xcf new file mode 100644 index 000000000..57567ef87 Binary files /dev/null and b/doc/img/edit.xcf differ diff --git a/doc/img/listing.xcf b/doc/img/listing.xcf new file mode 100644 index 000000000..dad8dc968 Binary files /dev/null and b/doc/img/listing.xcf differ diff --git a/sdrgui/CMakeLists.txt b/sdrgui/CMakeLists.txt index 5fb6e333a..d907d9480 100644 --- a/sdrgui/CMakeLists.txt +++ b/sdrgui/CMakeLists.txt @@ -40,6 +40,8 @@ set(sdrgui_SOURCES gui/valuedial.cpp gui/valuedialz.cpp + commands/command.cpp + dsp/scopevis.cpp dsp/scopevisng.cpp dsp/scopevismulti.cpp @@ -92,6 +94,8 @@ set(sdrgui_HEADERS gui/valuedial.h gui/valuedialz.h + commands/command.h + dsp/scopevis.h dsp/scopevisng.h dsp/scopevismulti.h diff --git a/sdrgui/commands/command.cpp b/sdrgui/commands/command.cpp new file mode 100644 index 000000000..ab848b14a --- /dev/null +++ b/sdrgui/commands/command.cpp @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "command.h" +#include "util/simpleserializer.h" + +Command::Command() +{ + resetToDefaults(); +} + +Command::~Command() +{} + +void Command::resetToDefaults() +{ + m_group = "default"; + m_description = "no name"; + m_command = ""; + m_argString = ""; + m_pressKey = static_cast(0); + m_releaseKey = static_cast(0); +} + +QByteArray Command::serialize() const +{ + SimpleSerializer s(1); + + s.writeString(1, m_group); + s.writeString(2, m_description); + s.writeString(3, m_command); + s.writeString(4, m_argString); + s.writeS32(5, (int) m_pressKey); + s.writeS32(6, (int) m_releaseKey); + + return s.final(); +} + + +bool Command::deserialize(const QByteArray& data) +{ + SimpleDeserializer d(data); + + if (!d.isValid()) + { + resetToDefaults(); + return false; + } + + if (d.getVersion() == 1) + { + int tmpInt; + + d.readString(1, &m_group, "default"); + d.readString(2, &m_description, "no name"); + d.readString(3, &m_command, ""); + d.readString(4, &m_argString, ""); + d.readS32(5, &tmpInt, 0); + m_pressKey = static_cast(tmpInt); + d.readS32(6, &tmpInt, 0); + m_releaseKey = static_cast(tmpInt); + + return true; + } + else + { + resetToDefaults(); + return false; + } +} diff --git a/sdrgui/commands/command.h b/sdrgui/commands/command.h new file mode 100644 index 000000000..cca9e0bc7 --- /dev/null +++ b/sdrgui/commands/command.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRBASE_COMMANDS_COMMAND_H_ +#define SDRBASE_COMMANDS_COMMAND_H_ + +#include +#include +#include + +class Command +{ +public: + Command(); + ~Command(); + void resetToDefaults(); + + QByteArray serialize() const; + bool deserialize(const QByteArray& data); + + void setCommand(const QString& command) { m_command = command; } + const QString& getCommand() const { return m_command; } + void setArgString(const QString& argString) { m_argString = argString; } + const QString& getArgString() const { return m_argString; } + void setGroup(const QString& group) { m_group = group; } + const QString& getGroup() const { return m_group; } + void setDescription(const QString& description) { m_description = description; } + const QString& getDescription() const { return m_description; } + void setPressKey(Qt::Key key) { m_pressKey = key; } + Qt::Key getPressKey() const { return m_pressKey; } + void setReleaseKey(Qt::Key key) { m_releaseKey = key; } + Qt::Key getReleaseKey() const { return m_releaseKey; } + +private: + QString m_command; + QString m_argString; + QString m_group; + QString m_description; + Qt::Key m_pressKey; + Qt::Key m_releaseKey; +}; + + + +#endif /* SDRBASE_COMMANDS_COMMAND_H_ */ diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index ddde9df5e..2456dcf55 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -104,23 +104,28 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse removeDockWidget(ui->inputSelectDock); removeDockWidget(ui->spectraDisplayDock); removeDockWidget(ui->presetDock); + removeDockWidget(ui->commandsDock); removeDockWidget(ui->channelDock); addDockWidget(Qt::LeftDockWidgetArea, ui->inputViewDock); addDockWidget(Qt::LeftDockWidgetArea, ui->inputSelectDock); addDockWidget(Qt::LeftDockWidgetArea, ui->spectraDisplayDock); addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock); + addDockWidget(Qt::LeftDockWidgetArea, ui->commandsDock); + tabifyDockWidget(ui->presetDock, ui->commandsDock); addDockWidget(Qt::RightDockWidgetArea, ui->channelDock); ui->inputViewDock->show(); ui->inputSelectDock->show(); ui->spectraDisplayDock->show(); ui->presetDock->show(); + ui->commandsDock->show(); ui->channelDock->show(); ui->menu_Window->addAction(ui->inputViewDock->toggleViewAction()); ui->menu_Window->addAction(ui->inputSelectDock->toggleViewAction()); ui->menu_Window->addAction(ui->spectraDisplayDock->toggleViewAction()); ui->menu_Window->addAction(ui->presetDock->toggleViewAction()); + ui->menu_Window->addAction(ui->commandsDock->toggleViewAction()); ui->menu_Window->addAction(ui->channelDock->toggleViewAction()); ui->tabInputsView->setStyleSheet("QWidget { background: rgb(50,50,50); } " diff --git a/sdrgui/mainwindow.ui b/sdrgui/mainwindow.ui index 1709e7756..876147771 100644 --- a/sdrgui/mainwindow.ui +++ b/sdrgui/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1012 - 767 + 721 @@ -391,40 +391,6 @@ - - - - 10 - - - true - - - 5 - - - - Freq (MHz) - - - Center frequency in MHz - - - - - M - - - Mode: R: Rx or source, T: Tx or sink - - - - - Description - - - - @@ -519,6 +485,40 @@ + + + + 10 + + + true + + + 5 + + + + Freq (MHz) + + + Center frequency in MHz + + + + + M + + + Mode: R: Rx or source, T: Tx or sink + + + + + Description + + + + @@ -559,6 +559,163 @@ + + + Commands + + + 1 + + + + + 3 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + 5 + + + true + + + 3 + + + 5 + + + + Description + + + + + Key press + + + + + Key release + + + + + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + Edit command details + + + + + + + :/edit.png:/edit.png + + + + + + + Run command + + + + + + + :/play.png:/play.png + + + + + + + View last run output + + + + + + + :/listing.png:/listing.png + + + + + + + Save commands in settings + + + + + + + :/preset-last.png:/preset-last.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Delete selected command + + + + + + + :/preset-delete.png:/preset-delete.png + + + + + + + + E&xit @@ -699,6 +856,7 @@ presetDock channelDock + commandsDock diff --git a/sdrgui/resources/edit.png b/sdrgui/resources/edit.png new file mode 100644 index 000000000..7ff556af1 Binary files /dev/null and b/sdrgui/resources/edit.png differ diff --git a/sdrgui/resources/listing.png b/sdrgui/resources/listing.png new file mode 100644 index 000000000..9c950628c Binary files /dev/null and b/sdrgui/resources/listing.png differ diff --git a/sdrgui/resources/res.qrc b/sdrgui/resources/res.qrc index a085780ff..cf629361b 100644 --- a/sdrgui/resources/res.qrc +++ b/sdrgui/resources/res.qrc @@ -82,5 +82,7 @@ clocksource.png flip_sidebands.png filter_highpass.png + edit.png + listing.png