diff --git a/sdrgui/CMakeLists.txt b/sdrgui/CMakeLists.txt index 21397b50d..5f6d97ffa 100644 --- a/sdrgui/CMakeLists.txt +++ b/sdrgui/CMakeLists.txt @@ -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 diff --git a/sdrgui/gui/ambedevicesdialog.cpp b/sdrgui/gui/ambedevicesdialog.cpp deleted file mode 100644 index 3c8195a61..000000000 --- a/sdrgui/gui/ambedevicesdialog.cpp +++ /dev/null @@ -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 . // -/////////////////////////////////////////////////////////////////////////////////// - -#include -#include - -#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 ambeSerialDevices; - m_ambeEngine->scan(ambeSerialDevices); - ui->ambeSerialDevices->clear(); - std::vector::const_iterator it = ambeSerialDevices.begin(); - - for (; it != ambeSerialDevices.end(); ++it) - { - ui->ambeSerialDevices->addItem(QString(*it)); - } -} - -void AMBEDevicesDialog::refreshInUseList() -{ - std::vector inUseDevices; - m_ambeEngine->getDeviceRefs(inUseDevices); - ui->ambeDeviceRefs->clear(); - std::vector::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 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 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 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"); - } -} diff --git a/sdrgui/gui/ambedevicesdialog.h b/sdrgui/gui/ambedevicesdialog.h deleted file mode 100644 index d32009e5a..000000000 --- a/sdrgui/gui/ambedevicesdialog.h +++ /dev/null @@ -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 . // -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef SDRGUI_GUI_AMBEDEVICESDIALOG_H_ -#define SDRGUI_GUI_AMBEDEVICESDIALOG_H_ - -#include - -#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_ diff --git a/sdrgui/gui/ambedevicesdialog.ui b/sdrgui/gui/ambedevicesdialog.ui deleted file mode 100644 index f1e34d493..000000000 --- a/sdrgui/gui/ambedevicesdialog.ui +++ /dev/null @@ -1,284 +0,0 @@ - - - AMBEDevicesDialog - - - - 0 - 0 - 401 - 450 - - - - AMBE devices control - - - - - 310 - 410 - 81 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - 10 - 280 - 181 - 121 - - - - List of available AMBE serial devices available - - - - - - 10 - 90 - 381 - 151 - - - - List of devices/servers in use - - - - - - 10 - 260 - 101 - 17 - - - - Serial devices - - - - - - 10 - 10 - 381 - 17 - - - - AMBE server IP and port or direct input - - - - - - 10 - 30 - 381 - 25 - - - - AMBE server address as ip:port or direct input - - - - - - - - - 310 - 60 - 28 - 24 - - - - Refresh list of devices and servers in use - - - - - - - :/recycle.png:/recycle.png - - - - - - 280 - 60 - 24 - 23 - - - - Release all devices and servers - - - - - - - :/bin.png:/bin.png - - - - - - 10 - 70 - 91 - 17 - - - - In use - - - - - - 120 - 250 - 24 - 23 - - - - Use serial device - - - - - - - :/arrow_up.png:/arrow_up.png - - - - - - 120 - 60 - 24 - 23 - - - - Use server - - - - - - - :/arrow_down.png:/arrow_down.png - - - - - - 360 - 60 - 28 - 24 - - - - Remove all devices - - - - - - - :/sweep.png:/sweep.png - - - - - - 10 - 420 - 291 - 19 - - - - ... - - - - - - 150 - 250 - 24 - 23 - - - - Use all serial devices - - - - - - - :/double_arrow_up.png:/double_arrow_up.png - - - - - - - - - buttonBox - accepted() - AMBEDevicesDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AMBEDevicesDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index b426ecd73..1a186e990 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -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"