1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Web API: DeviceSetList: added focused device set index for the GUI

This commit is contained in:
f4exb 2018-01-06 09:50:09 +01:00
parent 7974548a25
commit 9256e6b0ed
9 changed files with 65 additions and 32 deletions

View File

@ -955,6 +955,10 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Number of device sets opened in this instance"
},
"devicesetfocus" : {
"type" : "integer",
"description" : "Index of the deviceset that has focus (relevant for GUI only)"
},
"deviceSets" : {
"type" : "array",
"items" : {
@ -7693,7 +7697,7 @@ public class DeviceSetApiExample {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
@ -7712,7 +7716,7 @@ public class DeviceSetApiExample {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
@ -7731,7 +7735,7 @@ public class DeviceSetApiExample {
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
[apiInstance devicesetFocusPatchWith:deviceSetIndex
completionHandler: ^(DeviceSet output, NSError* error) {
completionHandler: ^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -7783,7 +7787,7 @@ namespace Example
try
{
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
Debug.WriteLine(result);
}
catch (Exception e)
@ -7886,24 +7890,24 @@ except ApiException as e:
<h2>Responses</h2>
<h3> Status: 200 - On success return details on the device set </h3>
<h3> Status: 202 - Message to focus on device set was sent successfully </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetFocusPatch-200-schema">Schema</a>
<a data-toggle="tab" href="#responses-devicesetFocusPatch-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetFocusPatch-200-schema">
<div id='responses-devicesetFocusPatch-200-schema-200' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<div class="tab-pane active" id="responses-devicesetFocusPatch-202-schema">
<div id='responses-devicesetFocusPatch-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return details on the device set",
"description" : "Message to focus on device set was sent successfully",
"schema" : {
"$ref" : "#/definitions/DeviceSet"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -7918,14 +7922,14 @@ except ApiException as e:
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-devicesetFocusPatch-200-schema-data').val(stringify(schema));
var result = $('#responses-devicesetFocusPatch-200-schema-200');
$('#responses-devicesetFocusPatch-202-schema-data').val(stringify(schema));
var result = $('#responses-devicesetFocusPatch-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetFocusPatch-200-schema-data' type='hidden' value=''></input>
<input id='responses-devicesetFocusPatch-202-schema-data' type='hidden' value=''></input>
</div>
</div>
@ -16890,7 +16894,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-01-06T03:02:37.398+01:00
Generated 2018-01-06T09:41:18.709+01:00
</div>
</div>
</div>

View File

@ -1247,6 +1247,10 @@ void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSet
deviceSetList->init();
deviceSetList->setDevicesetcount((int) m_mainWindow.m_deviceUIs.size());
if (m_mainWindow.m_deviceUIs.size() > 0) {
deviceSetList->setDevicesetfocus(m_mainWindow.ui->tabInputsView->currentIndex());
}
std::vector<DeviceUISet*>::const_iterator it = m_mainWindow.m_deviceUIs.begin();
for (int i = 0; it != m_mainWindow.m_deviceUIs.end(); ++it, i++)

View File

@ -1159,6 +1159,9 @@ definitions:
devicesetcount:
description: "Number of device sets opened in this instance"
type: integer
devicesetfocus:
description: "Index of the deviceset that has focus (relevant for GUI only)"
type: integer
deviceSets:
type: array
items:

View File

@ -955,6 +955,10 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Number of device sets opened in this instance"
},
"devicesetfocus" : {
"type" : "integer",
"description" : "Index of the deviceset that has focus (relevant for GUI only)"
},
"deviceSets" : {
"type" : "array",
"items" : {
@ -7693,7 +7697,7 @@ public class DeviceSetApiExample {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
@ -7712,7 +7716,7 @@ public class DeviceSetApiExample {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
@ -7731,7 +7735,7 @@ public class DeviceSetApiExample {
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
[apiInstance devicesetFocusPatchWith:deviceSetIndex
completionHandler: ^(DeviceSet output, NSError* error) {
completionHandler: ^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -7783,7 +7787,7 @@ namespace Example
try
{
DeviceSet result = apiInstance.devicesetFocusPatch(deviceSetIndex);
SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
Debug.WriteLine(result);
}
catch (Exception e)
@ -7886,24 +7890,24 @@ except ApiException as e:
<h2>Responses</h2>
<h3> Status: 200 - On success return details on the device set </h3>
<h3> Status: 202 - Message to focus on device set was sent successfully </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetFocusPatch-200-schema">Schema</a>
<a data-toggle="tab" href="#responses-devicesetFocusPatch-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetFocusPatch-200-schema">
<div id='responses-devicesetFocusPatch-200-schema-200' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<div class="tab-pane active" id="responses-devicesetFocusPatch-202-schema">
<div id='responses-devicesetFocusPatch-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return details on the device set",
"description" : "Message to focus on device set was sent successfully",
"schema" : {
"$ref" : "#/definitions/DeviceSet"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -7918,14 +7922,14 @@ except ApiException as e:
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-devicesetFocusPatch-200-schema-data').val(stringify(schema));
var result = $('#responses-devicesetFocusPatch-200-schema-200');
$('#responses-devicesetFocusPatch-202-schema-data').val(stringify(schema));
var result = $('#responses-devicesetFocusPatch-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetFocusPatch-200-schema-data' type='hidden' value=''></input>
<input id='responses-devicesetFocusPatch-202-schema-data' type='hidden' value=''></input>
</div>
</div>
@ -16890,7 +16894,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-01-06T03:02:37.398+01:00
Generated 2018-01-06T09:41:18.709+01:00
</div>
</div>
</div>

View File

@ -691,7 +691,7 @@ SWGDeviceSetApi::devicesetFocusPatchCallback(HttpRequestWorker * worker) {
QString json(worker->response);
SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet")));
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit devicesetFocusPatchSignal(output);

View File

@ -87,7 +87,7 @@ signals:
void devicesetDeviceSettingsGetSignal(SWGDeviceSettings* summary);
void devicesetDeviceSettingsPatchSignal(SWGDeviceSettings* summary);
void devicesetDeviceSettingsPutSignal(SWGDeviceSettings* summary);
void devicesetFocusPatchSignal(SWGDeviceSet* summary);
void devicesetFocusPatchSignal(SWGSuccessResponse* summary);
void devicesetGetSignal(SWGDeviceSet* summary);
void instanceDeviceSetDeleteSignal(SWGSuccessResponse* summary);
void instanceDeviceSetPostSignal(SWGSuccessResponse* summary);
@ -104,7 +104,7 @@ signals:
void devicesetDeviceSettingsGetSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceSettingsPatchSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceSettingsPutSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetFocusPatchSignalE(SWGDeviceSet* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetFocusPatchSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetGetSignalE(SWGDeviceSet* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -38,6 +38,7 @@ SWGDeviceSetList::~SWGDeviceSetList() {
void
SWGDeviceSetList::init() {
devicesetcount = 0;
devicesetfocus = 0;
device_sets = new QList<SWGDeviceSet*>();
}
@ -45,6 +46,7 @@ void
SWGDeviceSetList::cleanup() {
if(device_sets != nullptr) {
QList<SWGDeviceSet*>* arr = device_sets;
foreach(SWGDeviceSet* o, *arr) {
@ -66,6 +68,7 @@ SWGDeviceSetList::fromJson(QString &json) {
void
SWGDeviceSetList::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", "");
::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", "");
::SWGSDRangel::setValue(&device_sets, pJson["deviceSets"], "QList", "SWGDeviceSet");
@ -87,6 +90,8 @@ SWGDeviceSetList::asJsonObject() {
obj->insert("devicesetcount", QJsonValue(devicesetcount));
obj->insert("devicesetfocus", QJsonValue(devicesetfocus));
QJsonArray device_setsJsonArray;
toJsonArray((QList<void*>*)device_sets, &device_setsJsonArray, "device_sets", "SWGDeviceSet");
obj->insert("deviceSets", device_setsJsonArray);
@ -103,6 +108,15 @@ SWGDeviceSetList::setDevicesetcount(qint32 devicesetcount) {
this->devicesetcount = devicesetcount;
}
qint32
SWGDeviceSetList::getDevicesetfocus() {
return devicesetfocus;
}
void
SWGDeviceSetList::setDevicesetfocus(qint32 devicesetfocus) {
this->devicesetfocus = devicesetfocus;
}
QList<SWGDeviceSet*>*
SWGDeviceSetList::getDeviceSets() {
return device_sets;

View File

@ -46,12 +46,16 @@ public:
qint32 getDevicesetcount();
void setDevicesetcount(qint32 devicesetcount);
qint32 getDevicesetfocus();
void setDevicesetfocus(qint32 devicesetfocus);
QList<SWGDeviceSet*>* getDeviceSets();
void setDeviceSets(QList<SWGDeviceSet*>* device_sets);
private:
qint32 devicesetcount;
qint32 devicesetfocus;
QList<SWGDeviceSet*>* device_sets;
};

View File

@ -1,4 +1,4 @@
dev_focus_url#!/usr/bin/env python
#!/usr/bin/env python
import requests, traceback, sys
from optparse import OptionParser