mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
AMBE feature: removed AMBE devices dialog
This commit is contained in:
parent
3880a0f98f
commit
558955f6f9
@ -205,7 +205,6 @@ set(sdrgui_FORMS
|
||||
# mainwindow.ui
|
||||
gui/aboutdialog.ui
|
||||
gui/addpresetdialog.ui
|
||||
gui/ambedevicesdialog.ui
|
||||
gui/basicchannelsettingsdialog.ui
|
||||
gui/basicdevicesettingsdialog.ui
|
||||
gui/basicfeaturesettingsdialog.ui
|
||||
|
@ -1,178 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// 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 <QString>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include "ambedevicesdialog.h"
|
||||
#include "ui_ambedevicesdialog.h"
|
||||
|
||||
AMBEDevicesDialog::AMBEDevicesDialog(AMBEEngine* ambeEngine, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AMBEDevicesDialog),
|
||||
m_ambeEngine(ambeEngine)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
populateSerialList();
|
||||
refreshInUseList();
|
||||
}
|
||||
|
||||
AMBEDevicesDialog::~AMBEDevicesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::populateSerialList()
|
||||
{
|
||||
std::vector<QString> ambeSerialDevices;
|
||||
m_ambeEngine->scan(ambeSerialDevices);
|
||||
ui->ambeSerialDevices->clear();
|
||||
std::vector<QString>::const_iterator it = ambeSerialDevices.begin();
|
||||
|
||||
for (; it != ambeSerialDevices.end(); ++it)
|
||||
{
|
||||
ui->ambeSerialDevices->addItem(QString(*it));
|
||||
}
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::refreshInUseList()
|
||||
{
|
||||
std::vector<QString> inUseDevices;
|
||||
m_ambeEngine->getDeviceRefs(inUseDevices);
|
||||
ui->ambeDeviceRefs->clear();
|
||||
std::vector<QString>::const_iterator it = inUseDevices.begin();
|
||||
|
||||
for (; it != inUseDevices.end(); ++it)
|
||||
{
|
||||
qDebug("AMBEDevicesDialog::refreshInUseList: %s", qPrintable(*it));
|
||||
ui->ambeDeviceRefs->addItem(*it);
|
||||
}
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_importSerial_clicked()
|
||||
{
|
||||
QListWidgetItem *serialItem = ui->ambeSerialDevices->currentItem();
|
||||
|
||||
if (!serialItem)
|
||||
{
|
||||
ui->statusText->setText("No selection");
|
||||
return;
|
||||
}
|
||||
|
||||
QString serialName = serialItem->text();
|
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
|
||||
if (foundItems.size() == 0)
|
||||
{
|
||||
if (m_ambeEngine->registerController(serialName.toStdString()))
|
||||
{
|
||||
ui->ambeDeviceRefs->addItem(serialName);
|
||||
ui->statusText->setText(tr("%1 added").arg(serialName));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusText->setText(tr("Cannot open %1").arg(serialName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusText->setText("Device already in use");
|
||||
}
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_importAllSerial_clicked()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < ui->ambeSerialDevices->count(); i++)
|
||||
{
|
||||
const QListWidgetItem *serialItem = ui->ambeSerialDevices->item(i);
|
||||
QString serialName = serialItem->text();
|
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
|
||||
if (foundItems.size() == 0)
|
||||
{
|
||||
if (m_ambeEngine->registerController(serialName.toStdString()))
|
||||
{
|
||||
ui->ambeDeviceRefs->addItem(serialName);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->statusText->setText(tr("%1 devices added").arg(count));
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_removeAmbeDevice_clicked()
|
||||
{
|
||||
QListWidgetItem *deviceItem = ui->ambeDeviceRefs->currentItem();
|
||||
|
||||
if (!deviceItem)
|
||||
{
|
||||
ui->statusText->setText("No selection");
|
||||
return;
|
||||
}
|
||||
|
||||
QString deviceName = deviceItem->text();
|
||||
m_ambeEngine->releaseController(deviceName.toStdString());
|
||||
ui->statusText->setText(tr("%1 removed").arg(deviceName));
|
||||
refreshInUseList();
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_refreshAmbeList_clicked()
|
||||
{
|
||||
refreshInUseList();
|
||||
ui->statusText->setText("In use refreshed");
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_clearAmbeList_clicked()
|
||||
{
|
||||
if (ui->ambeDeviceRefs->count() == 0)
|
||||
{
|
||||
ui->statusText->setText("No active items");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ambeEngine->releaseAll();
|
||||
ui->ambeDeviceRefs->clear();
|
||||
ui->statusText->setText("All items released");
|
||||
}
|
||||
|
||||
void AMBEDevicesDialog::on_importAddress_clicked()
|
||||
{
|
||||
QString addressAndPort = ui->ambeAddressText->text();
|
||||
|
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(addressAndPort, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
|
||||
if (foundItems.size() == 0)
|
||||
{
|
||||
if (m_ambeEngine->registerController(addressAndPort.toStdString()))
|
||||
{
|
||||
ui->ambeDeviceRefs->addItem(addressAndPort);
|
||||
ui->statusText->setText(tr("%1 added").arg(addressAndPort));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusText->setText(tr("Cannot open %1").arg(addressAndPort));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusText->setText("Address already in use");
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRGUI_GUI_AMBEDEVICESDIALOG_H_
|
||||
#define SDRGUI_GUI_AMBEDEVICESDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "export.h"
|
||||
#include "ambe/ambeengine.h"
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Ui {
|
||||
class AMBEDevicesDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API AMBEDevicesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AMBEDevicesDialog(AMBEEngine* ambeEngine, QWidget* parent = nullptr);
|
||||
~AMBEDevicesDialog();
|
||||
|
||||
private:
|
||||
void populateSerialList();
|
||||
void refreshInUseList();
|
||||
|
||||
Ui::AMBEDevicesDialog* ui;
|
||||
AMBEEngine* m_ambeEngine;
|
||||
|
||||
private slots:
|
||||
void on_importSerial_clicked();
|
||||
void on_importAllSerial_clicked();
|
||||
void on_removeAmbeDevice_clicked();
|
||||
void on_refreshAmbeList_clicked();
|
||||
void on_clearAmbeList_clicked();
|
||||
void on_importAddress_clicked();
|
||||
};
|
||||
|
||||
#endif // SDRGUI_GUI_AMBEDEVICESDIALOG_H_
|
@ -1,284 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AMBEDevicesDialog</class>
|
||||
<widget class="QDialog" name="AMBEDevicesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>401</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>AMBE devices control</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>410</y>
|
||||
<width>81</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="ambeSerialDevices">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<width>181</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>List of available AMBE serial devices available</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="ambeDeviceRefs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>381</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>List of devices/servers in use</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ambeSerialLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>260</y>
|
||||
<width>101</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial devices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ambeServerLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>381</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AMBE server IP and port or direct input</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="ambeAddressText">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>381</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>AMBE server address as ip:port or direct input</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="refreshAmbeList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>60</y>
|
||||
<width>28</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh list of devices and servers in use</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="removeAmbeDevice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>60</y>
|
||||
<width>24</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Release all devices and servers</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ambeSerialLabel_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>In use</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="importSerial">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>250</y>
|
||||
<width>24</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use serial device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="importAddress">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>60</y>
|
||||
<width>24</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use server</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>
|
||||
<widget class="QPushButton" name="clearAmbeList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>60</y>
|
||||
<width>28</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove all devices</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/sweep.png</normaloff>:/sweep.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="statusText">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>420</y>
|
||||
<width>291</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="importAllSerial">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>250</y>
|
||||
<width>24</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use all serial devices</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/double_arrow_up.png</normaloff>:/double_arrow_up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AMBEDevicesDialog</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>AMBEDevicesDialog</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>
|
@ -61,7 +61,6 @@
|
||||
#include "gui/sdrangelsplash.h"
|
||||
#include "gui/mypositiondialog.h"
|
||||
#include "gui/fftwisdomdialog.h"
|
||||
#include "gui/ambedevicesdialog.h"
|
||||
#include "gui/workspace.h"
|
||||
#include "gui/featurepresetsdialog.h"
|
||||
#include "gui/devicesetpresetsdialog.h"
|
||||
|
Loading…
Reference in New Issue
Block a user