mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Device user arguments (2)
This commit is contained in:
parent
1c8f0c8c14
commit
6ebccb5b64
@ -116,7 +116,7 @@ set(sdrbase_SOURCES
|
||||
|
||||
device/deviceapi.cpp
|
||||
device/deviceenumerator.cpp
|
||||
device/deviceuserarg.cpp
|
||||
device/deviceuserargs.cpp
|
||||
|
||||
settings/preferences.cpp
|
||||
settings/preset.cpp
|
||||
@ -242,7 +242,7 @@ set(sdrbase_HEADERS
|
||||
|
||||
device/deviceapi.h
|
||||
device/deviceenumerator.h
|
||||
device/deviceuserarg.h
|
||||
device/deviceuserargs.h
|
||||
|
||||
plugin/plugininstancegui.h
|
||||
plugin/plugininterface.h
|
||||
|
@ -18,19 +18,19 @@
|
||||
#include <QDataStream>
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "deviceuserarg.h"
|
||||
#include "deviceuserargs.h"
|
||||
|
||||
QByteArray DeviceUserArg::serialize() const
|
||||
QByteArray DeviceUserArgs::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
QByteArray data;
|
||||
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
|
||||
*stream << m_argByDevice;
|
||||
*stream << m_argsByDevice;
|
||||
s.writeBlob(1, data);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool DeviceUserArg::deserialize(const QByteArray& data)
|
||||
bool DeviceUserArgs::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
@ -44,7 +44,7 @@ bool DeviceUserArg::deserialize(const QByteArray& data)
|
||||
|
||||
d.readBlob(1, &data);
|
||||
QDataStream readStream(&data, QIODevice::ReadOnly);
|
||||
readStream >> m_argByDevice;
|
||||
readStream >> m_argsByDevice;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -54,12 +54,12 @@ bool DeviceUserArg::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUserArg::splitDeviceKey(const QString& key, QString& driver, int& sequence)
|
||||
void DeviceUserArgs::splitDeviceKey(const QString& key, QString& id, int& sequence)
|
||||
{
|
||||
QStringList elms = key.split('-');
|
||||
|
||||
if (elms.size() > 0) {
|
||||
driver = elms[0];
|
||||
id = elms[0];
|
||||
}
|
||||
|
||||
if (elms.size() > 1)
|
||||
@ -74,10 +74,10 @@ void DeviceUserArg::splitDeviceKey(const QString& key, QString& driver, int& seq
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUserArg::composeDeviceKey(const QString& driver, int sequence, QString& key)
|
||||
void DeviceUserArgs::composeDeviceKey(const QString& id, int sequence, QString& key)
|
||||
{
|
||||
QStringList strList;
|
||||
strList.append(driver);
|
||||
strList.append(id);
|
||||
strList.append(QString::number(sequence));
|
||||
key = strList.join('-');
|
||||
}
|
@ -15,8 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_DEVICE_DEVICEUSERARG_H_
|
||||
#define SDRBASE_DEVICE_DEVICEUSERARG_H_
|
||||
#ifndef SDRBASE_DEVICE_DEVICEUSERARGS_H_
|
||||
#define SDRBASE_DEVICE_DEVICEUSERARGS_H_
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
@ -24,18 +24,16 @@
|
||||
|
||||
#include "export.h"
|
||||
|
||||
struct DEVICES_API DeviceUserArg
|
||||
struct DEVICES_API DeviceUserArgs
|
||||
{
|
||||
public:
|
||||
typedef QMap<QString, QString> UserArgs;
|
||||
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
static void splitDeviceKey(const QString& key, QString& id, int& sequence);
|
||||
static void composeDeviceKey(const QString& id, int sequence, QString& key);
|
||||
|
||||
QMap<QString, UserArgs> m_argByDevice; //!< "id-index" to arg map
|
||||
QMap<QString, QString> m_argsByDevice; //!< "id-sequence" to arg map. Id is hardwareId when referencing hardware device but not limited to it
|
||||
};
|
||||
|
||||
|
@ -84,6 +84,8 @@ void MainSettings::load()
|
||||
s.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray())));
|
||||
}
|
||||
|
||||
void MainSettings::save() const
|
||||
@ -123,6 +125,8 @@ void MainSettings::save() const
|
||||
s.setValue("data", qCompress(m_commands[i]->serialize()).toBase64());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64());
|
||||
}
|
||||
|
||||
void MainSettings::resetToDefaults()
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef INCLUDE_SETTINGS_H
|
||||
#define INCLUDE_SETTINGS_H
|
||||
|
||||
#include <audio/audiodevicemanager.h>
|
||||
#include <QString>
|
||||
#include "audio/audiodevicemanager.h"
|
||||
#include "device/deviceuserargs.h"
|
||||
#include "preferences.h"
|
||||
#include "preset.h"
|
||||
#include "export.h"
|
||||
@ -58,6 +59,7 @@ public:
|
||||
QtMsgType getFileMinLogLevel() const { return m_preferences.getFileMinLogLevel(); }
|
||||
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
|
||||
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
|
||||
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
|
||||
|
||||
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
||||
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
||||
@ -70,6 +72,7 @@ protected:
|
||||
Presets m_presets;
|
||||
typedef QList<Command*> Commands;
|
||||
Commands m_commands;
|
||||
DeviceUserArgs m_hardwareDeviceUserArgs;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SETTINGS_H
|
||||
|
@ -23,7 +23,7 @@ set(sdrgui_SOURCES
|
||||
gui/crightclickenabler.cpp
|
||||
gui/cwkeyergui.cpp
|
||||
gui/devicestreamselectiondialog.cpp
|
||||
gui/deviceuserargdialog.cpp
|
||||
gui/deviceuserargsdialog.cpp
|
||||
gui/editcommanddialog.cpp
|
||||
gui/externalclockbutton.cpp
|
||||
gui/externalclockdialog.cpp
|
||||
@ -92,7 +92,7 @@ set(sdrgui_HEADERS
|
||||
gui/crightclickenabler.h
|
||||
gui/cwkeyergui.h
|
||||
gui/devicestreamselectiondialog.h
|
||||
gui/deviceuserargdialog.h
|
||||
gui/deviceuserargsdialog.h
|
||||
gui/editcommanddialog.h
|
||||
gui/externalclockbutton.h
|
||||
gui/externalclockdialog.h
|
||||
@ -151,7 +151,7 @@ set(sdrgui_FORMS
|
||||
gui/commandoutputdialog.ui
|
||||
gui/cwkeyergui.ui
|
||||
gui/devicestreamselectiondialog.ui
|
||||
gui/deviceuserargdialog.ui
|
||||
gui/deviceuserargsdialog.ui
|
||||
gui/editcommanddialog.ui
|
||||
gui/externalclockdialog.ui
|
||||
gui/glscopegui.ui
|
||||
|
@ -1,72 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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 "ui_deviceuserargdialog.h"
|
||||
#include "deviceuserargdialog.h"
|
||||
|
||||
DeviceUserArgDialog::DeviceUserArgDialog(DeviceEnumerator* deviceEnumerator, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DeviceUserArgDialog),
|
||||
m_deviceEnumerator(deviceEnumerator)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
DeviceUserArgDialog::~DeviceUserArgDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::accept()
|
||||
{
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_keySelect_currentIndexChanged(int index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_deleteKey_clicked(bool checked)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_keyEdit_returnPressed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_addKey_clicked(bool checked)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_refreshKeys_clicked(bool checked)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgDialog::on_valueEdit_returnPressed()
|
||||
{
|
||||
|
||||
}
|
@ -1,334 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeviceUserArgDialog</class>
|
||||
<widget class="QDialog" name="DeviceUserArgDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<height>461</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Device user arguments</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>430</y>
|
||||
<width>461</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>461</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Override kwargs</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabKwargs">
|
||||
<attribute name="title">
|
||||
<string>Kwargs</string>
|
||||
</attribute>
|
||||
<widget class="QTreeWidget" name="deviceTree">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>441</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>SD</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Driver</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Seq</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>250</y>
|
||||
<width>441</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="deviceLabelLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<width>441</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="keysLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="keyLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="keySelect">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel copy mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteKey">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Delete key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="keyEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>New key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addKey">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add the key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/plusw.png</normaloff>:/plusw.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="QPushButton" name="refreshKeys">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>310</y>
|
||||
<width>441</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="valuesLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="valueLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="valueEdit">
|
||||
<property name="toolTip">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SoapySDRDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SoapySDRDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
128
sdrgui/gui/deviceuserargsdialog.cpp
Normal file
128
sdrgui/gui/deviceuserargsdialog.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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 "device/deviceenumerator.h"
|
||||
#include "device/deviceuserargs.h"
|
||||
#include "ui_deviceuserargsdialog.h"
|
||||
#include "deviceuserargsdialog.h"
|
||||
|
||||
DeviceUserArgsDialog::DeviceUserArgsDialog(
|
||||
DeviceEnumerator* deviceEnumerator,
|
||||
DeviceUserArgs& hardwareDeviceUserArgs,
|
||||
QWidget* parent
|
||||
) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DeviceUserArgsDialog),
|
||||
m_deviceEnumerator(deviceEnumerator),
|
||||
m_hardwareDeviceUserArgs(hardwareDeviceUserArgs)
|
||||
{
|
||||
qDebug("DeviceUserArgsDialog::DeviceUserArgsDialog");
|
||||
ui->setupUi(this);
|
||||
|
||||
for (int i = 0; i < m_deviceEnumerator->getNbRxSamplingDevices(); i++) {
|
||||
pushHWDeviceReference(m_deviceEnumerator->getRxSamplingDevice(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_deviceEnumerator->getNbTxSamplingDevices(); i++) {
|
||||
pushHWDeviceReference(m_deviceEnumerator->getTxSamplingDevice(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_deviceEnumerator->getNbMIMOSamplingDevices(); i++) {
|
||||
pushHWDeviceReference(m_deviceEnumerator->getMIMOSamplingDevice(i));
|
||||
}
|
||||
|
||||
for (auto& hwItem : m_availableHWDevices)
|
||||
{
|
||||
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->deviceTree);
|
||||
treeItem->setText(0, hwItem.m_hardwareId);
|
||||
treeItem->setText(1, tr("%1").arg(hwItem.m_sequence));
|
||||
treeItem->setText(2, hwItem.m_description);
|
||||
qDebug("DeviceUserArgsDialog::DeviceUserArgsDialog: available %s:%d", qPrintable(hwItem.m_hardwareId), hwItem.m_sequence);
|
||||
}
|
||||
|
||||
ui->deviceTree->resizeColumnToContents(0);
|
||||
ui->deviceTree->resizeColumnToContents(1);
|
||||
ui->deviceTree->resizeColumnToContents(2);
|
||||
|
||||
for (auto& deviceKey : hardwareDeviceUserArgs.m_argsByDevice)
|
||||
{
|
||||
QString hardwareId;
|
||||
int sequence;
|
||||
DeviceUserArgs::splitDeviceKey(deviceKey, hardwareId, sequence);
|
||||
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->argsTree);
|
||||
treeItem->setText(0, hardwareId);
|
||||
treeItem->setText(1, tr("%1").arg(sequence));
|
||||
treeItem->setText(2, hardwareDeviceUserArgs.m_argsByDevice.value(deviceKey));
|
||||
qDebug("DeviceUserArgsDialog::DeviceUserArgsDialog: args %s:%d", qPrintable(hardwareId), sequence);
|
||||
}
|
||||
|
||||
ui->argsTree->resizeColumnToContents(0);
|
||||
ui->argsTree->resizeColumnToContents(1);
|
||||
ui->argsTree->resizeColumnToContents(2);
|
||||
}
|
||||
|
||||
DeviceUserArgsDialog::~DeviceUserArgsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::pushHWDeviceReference(const PluginInterface::SamplingDevice *samplingDevice)
|
||||
{
|
||||
HWDeviceReference hw;
|
||||
hw.m_hardwareId = samplingDevice->hardwareId;
|
||||
hw.m_sequence = samplingDevice->sequence;
|
||||
hw.m_description = samplingDevice->displayedName;
|
||||
bool found = false;
|
||||
|
||||
for (auto& hwAvail : m_availableHWDevices)
|
||||
{
|
||||
if (hw == hwAvail)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
m_availableHWDevices.push_back(hw);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::accept()
|
||||
{
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::on_importDevice_clicked(bool checked)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::on_deleteArgs_clicked(bool checked)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeviceUserArgsDialog::on_argStringEdit_returnPressed()
|
||||
{
|
||||
|
||||
}
|
@ -15,40 +15,57 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRGUI_GUI_DEVICEUSERARGDIALOG_H
|
||||
#define SDRGUI_GUI_DEVICEUSERARGDIALOG_H
|
||||
#ifndef SDRGUI_GUI_DEVICEUSERARGSDIALOG_H
|
||||
#define SDRGUI_GUI_DEVICEUSERARGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSet>
|
||||
|
||||
#include "plugin/plugininterface.h"
|
||||
#include "export.h"
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class DeviceEnumerator;
|
||||
struct DeviceUserArgs;
|
||||
|
||||
namespace Ui {
|
||||
class DeviceUserArgDialog;
|
||||
class DeviceUserArgsDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API DeviceUserArgDialog : public QDialog {
|
||||
class SDRGUI_API DeviceUserArgsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceUserArgDialog(DeviceEnumerator* deviceEnumerator, QWidget* parent = 0);
|
||||
~DeviceUserArgDialog();
|
||||
explicit DeviceUserArgsDialog(
|
||||
DeviceEnumerator* deviceEnumerator,
|
||||
DeviceUserArgs& hardwareDeviceUserArgs,
|
||||
QWidget* parent = 0);
|
||||
~DeviceUserArgsDialog();
|
||||
|
||||
private:
|
||||
Ui::DeviceUserArgDialog* ui;
|
||||
struct HWDeviceReference {
|
||||
QString m_hardwareId;
|
||||
int m_sequence;
|
||||
QString m_description;
|
||||
|
||||
bool operator==(const HWDeviceReference& rhs) {
|
||||
return (m_hardwareId == rhs.m_hardwareId) && (m_sequence == rhs.m_sequence);
|
||||
}
|
||||
};
|
||||
|
||||
Ui::DeviceUserArgsDialog* ui;
|
||||
DeviceEnumerator* m_deviceEnumerator;
|
||||
DeviceUserArgs& m_hardwareDeviceUserArgs;
|
||||
std::vector<HWDeviceReference> m_availableHWDevices;
|
||||
|
||||
void pushHWDeviceReference(const PluginInterface::SamplingDevice *samplingDevice);
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
void reject();
|
||||
void on_keySelect_currentIndexChanged(int index);
|
||||
void on_deleteKey_clicked(bool checked);
|
||||
void on_keyEdit_returnPressed();
|
||||
void on_addKey_clicked(bool checked);
|
||||
void on_refreshKeys_clicked(bool checked);
|
||||
void on_valueEdit_returnPressed();
|
||||
void on_importDevice_clicked(bool checked);
|
||||
void on_deleteArgs_clicked(bool checked);
|
||||
void on_argStringEdit_returnPressed();
|
||||
};
|
||||
|
||||
#endif // SDRGUI_GUI_DEVICEUSERARGDIALOG_H
|
||||
#endif // SDRGUI_GUI_DEVICEUSERARGSDIALOG_H
|
207
sdrgui/gui/deviceuserargsdialog.ui
Normal file
207
sdrgui/gui/deviceuserargsdialog.ui
Normal file
@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeviceUserArgsDialog</class>
|
||||
<widget class="QDialog" name="DeviceUserArgsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<height>461</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Device user arguments</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>430</y>
|
||||
<width>461</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>461</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>User argument string to open hardware</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabHW">
|
||||
<attribute name="title">
|
||||
<string>Hardware</string>
|
||||
</attribute>
|
||||
<widget class="QTreeWidget" name="deviceTree">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>441</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>HwID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Seq</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>160</y>
|
||||
<width>441</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="deviceImportLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="importDevice">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add the key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>350</y>
|
||||
<width>441</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="argStringLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteArgs">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add the key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="argStringLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Args</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="argStringEdit">
|
||||
<property name="toolTip">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTreeWidget" name="argsTree">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>190</y>
|
||||
<width>441</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>HwID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Seq</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Arg string</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -47,6 +47,7 @@
|
||||
#include "gui/channelwindow.h"
|
||||
#include "gui/audiodialog.h"
|
||||
#include "gui/loggingdialog.h"
|
||||
#include "gui/deviceuserargsdialog.h"
|
||||
#include "gui/samplingdevicecontrol.h"
|
||||
#include "gui/sdrangelsplash.h"
|
||||
#include "gui/mypositiondialog.h"
|
||||
@ -1594,6 +1595,13 @@ void MainWindow::on_action_My_Position_triggered()
|
||||
myPositionDialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_action_DeviceUserArguments_triggered()
|
||||
{
|
||||
qDebug("MainWindow::on_action_DeviceUserArguments_triggered");
|
||||
DeviceUserArgsDialog deviceUserArgsDialog(DeviceEnumerator::instance(), m_settings.getDeviceUserArgs(), this);
|
||||
deviceUserArgsDialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_action_DV_Serial_triggered(bool checked)
|
||||
{
|
||||
m_dspEngine->setDVSerialSupport(checked);
|
||||
|
@ -381,6 +381,7 @@ private slots:
|
||||
void on_action_Logging_triggered();
|
||||
void on_action_DV_Serial_triggered(bool checked);
|
||||
void on_action_My_Position_triggered();
|
||||
void on_action_DeviceUserArguments_triggered();
|
||||
void sampleSourceChanged();
|
||||
void sampleSinkChanged();
|
||||
void sampleMIMOChanged();
|
||||
|
@ -64,7 +64,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1012</width>
|
||||
<height>20</height>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
@ -117,10 +117,17 @@
|
||||
<property name="title">
|
||||
<string>&Preferences</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuDevices">
|
||||
<property name="title">
|
||||
<string>Devices</string>
|
||||
</property>
|
||||
<addaction name="action_DeviceUserArguments"/>
|
||||
</widget>
|
||||
<addaction name="action_Audio"/>
|
||||
<addaction name="action_Logging"/>
|
||||
<addaction name="action_DV_Serial"/>
|
||||
<addaction name="action_My_Position"/>
|
||||
<addaction name="menuDevices"/>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
<addaction name="menu_View"/>
|
||||
@ -926,6 +933,11 @@
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_DeviceUserArguments">
|
||||
<property name="text">
|
||||
<string>User arguments</string>
|
||||
</property>
|
||||
</action>
|
||||
<zorder>presetDock</zorder>
|
||||
<zorder>channelDock</zorder>
|
||||
<zorder>commandsDock</zorder>
|
||||
|
Loading…
Reference in New Issue
Block a user