Browse Source

Web API: workspace actions to arrange the windows

POST /sdrangel/workspace/{workspaceIndex}/actions with a WorkspaceActions body whose action
is one of cascade, tile, stackVertical, stack, autostack or tab, doing what the workspace
toolbar buttons do. The one-shot arrangements switch tabbed windows off first; autostack and
tab set the corresponding option. The SWG class is written by hand to match the yaml, as the
code generator was not run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chirpmodem-v8.0.0
Jon Beniston 2 months ago
parent
commit
ec42db8694
  1. 1
      sdrbase/maincore.cpp
  2. 24
      sdrbase/maincore.h
  3. 53
      sdrbase/resources/webapi/doc/swagger/swagger.yaml
  4. 42
      sdrbase/webapi/webapiadapter.cpp
  5. 6
      sdrbase/webapi/webapiadapter.h
  6. 1
      sdrbase/webapi/webapiadapterinterface.cpp
  7. 20
      sdrbase/webapi/webapiadapterinterface.h
  8. 88
      sdrbase/webapi/webapirequestmapper.cpp
  9. 2
      sdrbase/webapi/webapirequestmapper.h
  10. 46
      sdrgui/mainwindow.cpp
  11. 53
      swagger/sdrangel/api/swagger/swagger.yaml
  12. 6
      swagger/sdrangel/code/qt5/client/SWGModelFactory.h
  13. 110
      swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.cpp
  14. 59
      swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.h

1
sdrbase/maincore.cpp

@ -66,6 +66,7 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgChannelSettings, Message) @@ -66,6 +66,7 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgChannelSettings, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgChannelDemodReport, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgChannelDemodQuery, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgMoveDeviceUIToWorkspace, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgArrangeWorkspace, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgMoveMainSpectrumUIToWorkspace, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgMoveFeatureUIToWorkspace, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgMoveChannelUIToWorkspace, Message)

24
sdrbase/maincore.h

@ -623,6 +623,30 @@ public: @@ -623,6 +623,30 @@ public:
{ }
};
class SDRBASE_API MsgArrangeWorkspace : public Message {
MESSAGE_CLASS_DECLARATION
public:
enum Arrangement { Cascade, Tile, StackVertical, Stack, AutoStack, Tab };
int getWorkspaceIndex() const { return m_workspaceIndex; }
Arrangement getArrangement() const { return m_arrangement; }
static MsgArrangeWorkspace* create(int workspaceIndex, Arrangement arrangement) {
return new MsgArrangeWorkspace(workspaceIndex, arrangement);
}
private:
int m_workspaceIndex;
Arrangement m_arrangement;
MsgArrangeWorkspace(int workspaceIndex, Arrangement arrangement) :
Message(),
m_workspaceIndex(workspaceIndex),
m_arrangement(arrangement)
{ }
};
class SDRBASE_API MsgMoveMainSpectrumUIToWorkspace : public Message {
MESSAGE_CLASS_DECLARATION

53
sdrbase/resources/webapi/doc/swagger/swagger.yaml

@ -1097,6 +1097,45 @@ paths: @@ -1097,6 +1097,45 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/workspace/{workspaceIndex}/actions:
x-swagger-router-controller: instance
post:
description: Arrange the windows of a workspace (GUI)
operationId: workspaceActionsPost
tags:
- Workspace
consumes:
- application/json
parameters:
- in: path
name: workspaceIndex
type: integer
required: true
description: Index of workspace in the list of workspaces
- name: body
in: body
description: Action to perform
required: true
schema:
$ref: "#/definitions/WorkspaceActions"
responses:
"202":
description: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid JSON request
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Invalid workspace index
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset:
x-swagger-router-controller: instance
post:
@ -3231,6 +3270,20 @@ definitions: @@ -3231,6 +3270,20 @@ definitions:
description: index of workspace in the list of workspaces
type: integer
WorkspaceActions:
description: "Actions on a workspace"
required:
- arrange
properties:
arrange:
description: >
How to arrange the workspace's windows. cascade, tile, stackVertical and stack rearrange
them once, and turn auto stacking and tabs off. autostack stacks them now and again
whenever a window is added or resized, and stays on until another arrangement is asked
for. tab shows one window at a time with a tab for each, and turns auto stacking off.
type: string
enum: [cascade, tile, stackVertical, stack, autostack, tab]
AudioDevices:
description: "List of audio devices available in the system"
required:

42
sdrbase/webapi/webapiadapter.cpp

@ -72,6 +72,7 @@ @@ -72,6 +72,7 @@
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGWorkspaceInfo.h"
#include "SWGWorkspaceActions.h"
#include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
@ -1740,6 +1741,47 @@ int WebAPIAdapter::instanceWorkspaceDelete( @@ -1740,6 +1741,47 @@ int WebAPIAdapter::instanceWorkspaceDelete(
return 202;
}
int WebAPIAdapter::workspaceActionsPost(
int workspaceIndex,
SWGSDRangel::SWGWorkspaceActions& query,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
// The workspaces live in the GUI, which is the only place their number is known, so the
// index is checked there and an out of range one is logged rather than reported
(void) error;
const QString arrange = query.getArrange() ? *query.getArrange() : QString();
MainCore::MsgArrangeWorkspace::Arrangement arrangement;
if (arrange == "cascade") {
arrangement = MainCore::MsgArrangeWorkspace::Cascade;
} else if (arrange == "tile") {
arrangement = MainCore::MsgArrangeWorkspace::Tile;
} else if (arrange == "stackVertical") {
arrangement = MainCore::MsgArrangeWorkspace::StackVertical;
} else if (arrange == "stack") {
arrangement = MainCore::MsgArrangeWorkspace::Stack;
} else if (arrange == "autostack") {
arrangement = MainCore::MsgArrangeWorkspace::AutoStack;
} else if (arrange == "tab") {
arrangement = MainCore::MsgArrangeWorkspace::Tab;
}
else
{
error.init();
*error.getMessage() = QString("Unknown arrangement %1").arg(arrange);
return 400;
}
MainCore::MsgArrangeWorkspace *msg = MainCore::MsgArrangeWorkspace::create(workspaceIndex, arrangement);
m_mainCore->m_mainMessageQueue->push(msg);
response.init();
*response.getMessage() = QString("Message to arrange workspace %1 (MsgArrangeWorkspace) was submitted successfully").arg(workspaceIndex);
return 202;
}
int WebAPIAdapter::devicesetGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceSet& response,

6
sdrbase/webapi/webapiadapter.h

@ -230,6 +230,12 @@ public: @@ -230,6 +230,12 @@ public:
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int workspaceActionsPost(
int workspaceIndex,
SWGSDRangel::SWGWorkspaceActions& query,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceSet& response,

1
sdrbase/webapi/webapiadapterinterface.cpp

@ -78,6 +78,7 @@ std::regex WebAPIAdapterInterface::featuresetFeatureSettingsURLRe("^/sdrangel/fe @@ -78,6 +78,7 @@ std::regex WebAPIAdapterInterface::featuresetFeatureSettingsURLRe("^/sdrangel/fe
std::regex WebAPIAdapterInterface::featuresetFeatureReportURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/report$");
std::regex WebAPIAdapterInterface::featuresetFeatureActionsURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/actions$");
std::regex WebAPIAdapterInterface::featuresetFeatureWorkspaceURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/workspace$");
std::regex WebAPIAdapterInterface::workspaceActionsURLRe("^/sdrangel/workspace/([0-9]{1,2})/actions$");
void WebAPIAdapterInterface::ConfigKeys::debug() const
{

20
sdrbase/webapi/webapiadapterinterface.h

@ -67,6 +67,7 @@ namespace SWGSDRangel @@ -67,6 +67,7 @@ namespace SWGSDRangel
class SWGDeviceReport;
class SWGDeviceActions;
class SWGWorkspaceInfo;
class SWGWorkspaceActions;
class SWGChannelsDetail;
class SWGChannelSettings;
class SWGChannelReport;
@ -810,6 +811,24 @@ public: @@ -810,6 +811,24 @@ public:
return 501;
}
/**
* Handler of /sdrangel/workspace/{workspaceIndex}/actions (POST) swagger/sdrangel/code/html2/index.html#api-Default-workspaceActionsPost
* returns the Http status code (default 501: not implemented)
*/
virtual int workspaceActionsPost(
int workspaceIndex,
SWGSDRangel::SWGWorkspaceActions& query,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) workspaceIndex;
(void) query;
(void) response;
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/**
* Handler of /sdrangel/deviceset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
@ -1794,6 +1813,7 @@ public: @@ -1794,6 +1813,7 @@ public:
static std::regex featuresetFeatureReportURLRe;
static std::regex featuresetFeatureActionsURLRe;
static std::regex featuresetFeatureWorkspaceURLRe;
static std::regex workspaceActionsURLRe;
};

88
sdrbase/webapi/webapirequestmapper.cpp

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGWorkspaceInfo.h"
#include "SWGWorkspaceActions.h"
#include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
@ -194,6 +195,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http @@ -194,6 +195,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
devicesetSpectrumDataService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumServerURLRe)) {
devicesetSpectrumServerService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::workspaceActionsURLRe)) {
workspaceActionsService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumWorkspaceURLRe)) {
devicesetSpectrumWorkspaceService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceSettingsURLRe)) {
@ -3638,6 +3641,73 @@ void WebAPIRequestMapper::featuresetFeatureActionsService( @@ -3638,6 +3641,73 @@ void WebAPIRequestMapper::featuresetFeatureActionsService(
}
}
void WebAPIRequestMapper::workspaceActionsService(
const std::string& workspaceIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
try
{
int workspaceIndex = boost::lexical_cast<int>(workspaceIndexStr);
if (request.getMethod() == "POST")
{
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (parseJsonBody(jsonStr, jsonObject, response))
{
SWGSDRangel::SWGWorkspaceActions query;
SWGSDRangel::SWGSuccessResponse normalResponse;
if (validateWorkspaceActions(query, jsonObject))
{
int status = m_adapter->workspaceActionsPost(workspaceIndex, query, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request: arrange must be one of cascade, tile, stackVertical, stack, autostack, tab";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(405,"Invalid HTTP method");
errorResponse.init();
*errorResponse.getMessage() = "Invalid HTTP method";
response.write(errorResponse.asJson().toUtf8());
}
}
catch (const boost::bad_lexical_cast &e)
{
errorResponse.init();
*errorResponse.getMessage() = "Wrong integer conversion on workspace index";
response.setStatus(400,"Invalid data");
response.write(errorResponse.asJson().toUtf8());
}
}
void WebAPIRequestMapper::featuresetFeatureWorkspaceService(
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
@ -4287,6 +4357,24 @@ bool WebAPIRequestMapper::validateSpectrumSettings(SWGSDRangel::SWGGLSpectrum& s @@ -4287,6 +4357,24 @@ bool WebAPIRequestMapper::validateSpectrumSettings(SWGSDRangel::SWGGLSpectrum& s
return true;
}
// The arrangement is an enumeration, and one outside it is refused here rather than passed on
bool WebAPIRequestMapper::validateWorkspaceActions(SWGSDRangel::SWGWorkspaceActions& workspaceActions, QJsonObject& jsonObject)
{
if (!jsonObject.contains("arrange") || !jsonObject["arrange"].isString()) {
return false;
}
static const QStringList arrangements = {"cascade", "tile", "stackVertical", "stack", "autostack", "tab"};
QString arrange = jsonObject["arrange"].toString();
if (!arrangements.contains(arrange)) {
return false;
}
workspaceActions.setArrange(new QString(arrange));
return true;
}
bool WebAPIRequestMapper::validateWorkspaceInfo(SWGSDRangel::SWGWorkspaceInfo& workspaceInfo, QJsonObject& jsonObject)
{
if (jsonObject.contains("index"))

2
sdrbase/webapi/webapirequestmapper.h

@ -114,6 +114,7 @@ private: @@ -114,6 +114,7 @@ private:
void featuresetFeatureReportService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureActionsService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureWorkspaceService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void workspaceActionsService(const std::string& workspaceIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);
@ -131,6 +132,7 @@ private: @@ -131,6 +132,7 @@ private:
bool validateAudioOutputDevice(SWGSDRangel::SWGAudioOutputDevice& audioOutputDevice, QJsonObject& jsonObject, QStringList& audioOutputDeviceKeys);
bool validateConfig(SWGSDRangel::SWGInstanceConfigResponse& config, QJsonObject& jsonObject, WebAPIAdapterInterface::ConfigKeys& configKeys);
bool validateWorkspaceInfo(SWGSDRangel::SWGWorkspaceInfo& workspaceInfo, QJsonObject& jsonObject);
bool validateWorkspaceActions(SWGSDRangel::SWGWorkspaceActions& workspaceActions, QJsonObject& jsonObject);
bool validateConfigurationIdentifier(SWGSDRangel::SWGConfigurationIdentifier& configurationIdentifier);
bool validateConfigurationImportExport(SWGSDRangel::SWGConfigurationImportExport& configuratopmImportExport);

46
sdrgui/mainwindow.cpp

@ -2479,6 +2479,52 @@ bool MainWindow::handleMessage(const Message& cmd) @@ -2479,6 +2479,52 @@ bool MainWindow::handleMessage(const Message& cmd)
return true;
}
else if (MainCore::MsgArrangeWorkspace::match(cmd))
{
auto& notif = (const MainCore::MsgArrangeWorkspace&) cmd;
int workspaceIndex = notif.getWorkspaceIndex();
if ((workspaceIndex >= 0) && (workspaceIndex < (int) m_workspaces.size()))
{
Workspace *workspace = m_workspaces[workspaceIndex];
// The same as the title bar buttons: each one-shot arrangement turns auto stacking
// and tabs off, and either mode turns the other off
switch (notif.getArrangement())
{
case MainCore::MsgArrangeWorkspace::Cascade:
workspace->setTabSubWindowsOption(false);
workspace->cascadeSubWindows();
break;
case MainCore::MsgArrangeWorkspace::Tile:
workspace->setTabSubWindowsOption(false);
workspace->tileSubWindows();
break;
case MainCore::MsgArrangeWorkspace::StackVertical:
workspace->setTabSubWindowsOption(false);
workspace->stackVerticalSubWindows();
break;
case MainCore::MsgArrangeWorkspace::Stack:
workspace->setTabSubWindowsOption(false);
workspace->stackSubWindows();
break;
case MainCore::MsgArrangeWorkspace::AutoStack:
workspace->setTabSubWindowsOption(false);
workspace->setAutoStackOption(true);
workspace->layoutSubWindows();
break;
case MainCore::MsgArrangeWorkspace::Tab:
workspace->setTabSubWindowsOption(true);
break;
}
}
else
{
qWarning("MainWindow::handleMessages: MsgArrangeWorkspace: no workspace with index %d", workspaceIndex);
}
return true;
}
else if (MainCore::MsgMoveMainSpectrumUIToWorkspace::match(cmd))
{
auto& notif = (const MainCore::MsgMoveMainSpectrumUIToWorkspace&) cmd;

53
swagger/sdrangel/api/swagger/swagger.yaml

@ -1097,6 +1097,45 @@ paths: @@ -1097,6 +1097,45 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/workspace/{workspaceIndex}/actions:
x-swagger-router-controller: instance
post:
description: Arrange the windows of a workspace (GUI)
operationId: workspaceActionsPost
tags:
- Workspace
consumes:
- application/json
parameters:
- in: path
name: workspaceIndex
type: integer
required: true
description: Index of workspace in the list of workspaces
- name: body
in: body
description: Action to perform
required: true
schema:
$ref: "#/definitions/WorkspaceActions"
responses:
"202":
description: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid JSON request
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Invalid workspace index
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset:
x-swagger-router-controller: instance
post:
@ -3231,6 +3270,20 @@ definitions: @@ -3231,6 +3270,20 @@ definitions:
description: index of workspace in the list of workspaces
type: integer
WorkspaceActions:
description: "Actions on a workspace"
required:
- arrange
properties:
arrange:
description: >
How to arrange the workspace's windows. cascade, tile, stackVertical and stack rearrange
them once, and turn auto stacking and tabs off. autostack stacks them now and again
whenever a window is added or resized, and stays on until another arrangement is asked
for. tab shows one window at a time with a tab for each, and turns auto stacking off.
type: string
enum: [cascade, tile, stackVertical, stack, autostack, tab]
AudioDevices:
description: "List of audio devices available in the system"
required:

6
swagger/sdrangel/code/qt5/client/SWGModelFactory.h

@ -412,6 +412,7 @@ @@ -412,6 +412,7 @@
#include "SWGWFMDemodSettings.h"
#include "SWGWFMModReport.h"
#include "SWGWFMModSettings.h"
#include "SWGWorkspaceActions.h"
#include "SWGWorkspaceInfo.h"
#include "SWGXtrxInputReport.h"
#include "SWGXtrxInputSettings.h"
@ -2413,6 +2414,11 @@ namespace SWGSDRangel { @@ -2413,6 +2414,11 @@ namespace SWGSDRangel {
obj->init();
return obj;
}
if(QString("SWGWorkspaceActions").compare(type) == 0) {
SWGWorkspaceActions *obj = new SWGWorkspaceActions();
obj->init();
return obj;
}
if(QString("SWGWorkspaceInfo").compare(type) == 0) {
SWGWorkspaceInfo *obj = new SWGWorkspaceInfo();
obj->init();

110
swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.cpp

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 7.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGWorkspaceActions.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGWorkspaceActions::SWGWorkspaceActions(QString* json) {
init();
this->fromJson(*json);
}
SWGWorkspaceActions::SWGWorkspaceActions() {
arrange = nullptr;
m_arrange_isSet = false;
}
SWGWorkspaceActions::~SWGWorkspaceActions() {
this->cleanup();
}
void
SWGWorkspaceActions::init() {
arrange = new QString("");
m_arrange_isSet = false;
}
void
SWGWorkspaceActions::cleanup() {
if(arrange != nullptr) {
delete arrange;
}
}
SWGWorkspaceActions*
SWGWorkspaceActions::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGWorkspaceActions::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&arrange, pJson["arrange"], "QString", "QString");
}
QString
SWGWorkspaceActions::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGWorkspaceActions::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(arrange != nullptr && *arrange != QString("")){
toJsonValue(QString("arrange"), arrange, obj, QString("QString"));
}
return obj;
}
QString*
SWGWorkspaceActions::getArrange() {
return arrange;
}
void
SWGWorkspaceActions::setArrange(QString* arrange) {
this->arrange = arrange;
this->m_arrange_isSet = true;
}
bool
SWGWorkspaceActions::isSet(){
bool isObjectUpdated = false;
do{
if(arrange && *arrange != QString("")){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

59
swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.h

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 7.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGWorkspaceActions.h
*
* Actions on a workspace
*/
#ifndef SWGWorkspaceActions_H_
#define SWGWorkspaceActions_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGWorkspaceActions: public SWGObject {
public:
SWGWorkspaceActions();
SWGWorkspaceActions(QString* json);
virtual ~SWGWorkspaceActions();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGWorkspaceActions* fromJson(QString &jsonString) override;
QString* getArrange();
void setArrange(QString* arrange);
virtual bool isSet() override;
private:
QString* arrange;
bool m_arrange_isSet;
};
}
#endif /* SWGWorkspaceActions_H_ */
Loading…
Cancel
Save