diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp index a6962fc70..a05f30230 100644 --- a/sdrbase/maincore.cpp +++ b/sdrbase/maincore.cpp @@ -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) diff --git a/sdrbase/maincore.h b/sdrbase/maincore.h index dfa78024c..843540352 100644 --- a/sdrbase/maincore.h +++ b/sdrbase/maincore.h @@ -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 diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 1eed86e0e..9caa18ebf 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -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: 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: diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index 2808a3524..e3a3454b2 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -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( 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, diff --git a/sdrbase/webapi/webapiadapter.h b/sdrbase/webapi/webapiadapter.h index 40d4c60ae..ecc236572 100644 --- a/sdrbase/webapi/webapiadapter.h +++ b/sdrbase/webapi/webapiadapter.h @@ -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, diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index e1db46f15..a033592d1 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -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 { diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 96e216f1d..da33832f3 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -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: 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: static std::regex featuresetFeatureReportURLRe; static std::regex featuresetFeatureActionsURLRe; static std::regex featuresetFeatureWorkspaceURLRe; + static std::regex workspaceActionsURLRe; }; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 370e756e2..e84e27d70 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -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 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( } } +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(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 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")) diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index 59b98b32d..9ecf92921 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -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: 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); diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index a9dd03426..bcb5abb7f 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -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; diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 9e0a1f53c..f3c485357 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -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: 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: diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index f4d2109b6..ffac013c3 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -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 { 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(); diff --git a/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.cpp b/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.cpp new file mode 100644 index 000000000..78bc03d3f --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.cpp @@ -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 +#include +#include +#include + +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; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.h b/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.h new file mode 100644 index 000000000..119cb0fbf --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWorkspaceActions.h @@ -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 + + +#include + +#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_ */