Commands: basic dock widget setup and command class

pull/127/head
f4exb 2018-01-03 12:25:58 +01:00
rodzic 565d463f10
commit 28196978e2
11 zmienionych plików z 346 dodań i 36 usunięć

Wyświetl plik

@ -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"));

BIN
doc/img/edit.xcf 100644

Plik binarny nie jest wyświetlany.

BIN
doc/img/listing.xcf 100644

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -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

Wyświetl plik

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#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<Qt::Key>(0);
m_releaseKey = static_cast<Qt::Key>(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<Qt::Key>(tmpInt);
d.readS32(6, &tmpInt, 0);
m_releaseKey = static_cast<Qt::Key>(tmpInt);
return true;
}
else
{
resetToDefaults();
return false;
}
}

Wyświetl plik

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_COMMANDS_COMMAND_H_
#define SDRBASE_COMMANDS_COMMAND_H_
#include <Qt>
#include <QByteArray>
#include <QString>
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_ */

Wyświetl plik

@ -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); } "

Wyświetl plik

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1012</width>
<height>767</height>
<height>721</height>
</rect>
</property>
<property name="font">
@ -391,40 +391,6 @@
</property>
</widget>
</item>
<item row="1" column="1" rowspan="4" colspan="12">
<widget class="QTreeWidget" name="presetTree">
<property name="indentation">
<number>10</number>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerMinimumSectionSize">
<number>5</number>
</attribute>
<column>
<property name="text">
<string>Freq (MHz)</string>
</property>
<property name="toolTip">
<string>Center frequency in MHz</string>
</property>
</column>
<column>
<property name="text">
<string>M</string>
</property>
<property name="toolTip">
<string>Mode: R: Rx or source, T: Tx or sink</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
</widget>
</item>
<item row="5" column="2">
<widget class="QToolButton" name="presetUpdate">
<property name="toolTip">
@ -519,6 +485,40 @@
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2" colspan="12">
<widget class="QTreeWidget" name="presetTree">
<property name="indentation">
<number>10</number>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerMinimumSectionSize">
<number>5</number>
</attribute>
<column>
<property name="text">
<string>Freq (MHz)</string>
</property>
<property name="toolTip">
<string>Center frequency in MHz</string>
</property>
</column>
<column>
<property name="text">
<string>M</string>
</property>
<property name="toolTip">
<string>Mode: R: Rx or source, T: Tx or sink</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
@ -559,6 +559,163 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="commandsDock">
<property name="windowTitle">
<string>Commands</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="commandsDockWidget">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QTreeWidget" name="commadsTree">
<property name="indentation">
<number>5</number>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="headerMinimumSectionSize">
<number>5</number>
</attribute>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Key press</string>
</property>
</column>
<column>
<property name="text">
<string>Key release</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="commandsControl">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QToolButton" name="commandEdit">
<property name="toolTip">
<string>Edit command details</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources/res.qrc">
<normaloff>:/edit.png</normaloff>:/edit.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="commandRun">
<property name="toolTip">
<string>Run command</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources/res.qrc">
<normaloff>:/play.png</normaloff>:/play.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="commandViewOutput">
<property name="toolTip">
<string>View last run output</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources/res.qrc">
<normaloff>:/listing.png</normaloff>:/listing.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="commandsSave">
<property name="toolTip">
<string>Save commands in settings</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources/res.qrc">
<normaloff>:/preset-last.png</normaloff>:/preset-last.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="toolTip">
<string>Delete selected command</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources/res.qrc">
<normaloff>:/preset-delete.png</normaloff>:/preset-delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<action name="action_Exit">
<property name="text">
<string>E&amp;xit</string>
@ -699,6 +856,7 @@
</action>
<zorder>presetDock</zorder>
<zorder>channelDock</zorder>
<zorder>commandsDock</zorder>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 398 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 381 B

Wyświetl plik

@ -82,5 +82,7 @@
<file>clocksource.png</file>
<file>flip_sidebands.png</file>
<file>filter_highpass.png</file>
<file>edit.png</file>
<file>listing.png</file>
</qresource>
</RCC>