mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Massive UI revamping (v7): device set presets
This commit is contained in:
parent
af13b31d85
commit
c797060a7d
@ -744,6 +744,7 @@ public:
|
||||
friend class MainWindow;
|
||||
friend class WebAPIAdapter;
|
||||
friend class CommandsDialog;
|
||||
friend class DeviceSetPresetsDialog;
|
||||
|
||||
signals:
|
||||
void deviceSetAdded(int index, DeviceAPI *device);
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
void clearPresets();
|
||||
const Preset& getWorkingPresetConst() const { return m_workingPreset; }
|
||||
Preset* getWorkingPreset() { return &m_workingPreset; }
|
||||
QList<Preset*> *getPresets() { return &m_presets; }
|
||||
|
||||
void addCommand(Command *command);
|
||||
void deleteCommand(const Command* command);
|
||||
|
@ -29,6 +29,7 @@ set(sdrgui_SOURCES
|
||||
gui/cwkeyergui.cpp
|
||||
gui/datetimedelegate.cpp
|
||||
gui/decimaldelegate.cpp
|
||||
gui/devicesetpresetsdialog.cpp
|
||||
gui/devicestreamselectiondialog.cpp
|
||||
gui/deviceuserargsdialog.cpp
|
||||
gui/dmsspinbox.cpp
|
||||
@ -130,6 +131,7 @@ set(sdrgui_HEADERS
|
||||
gui/cwkeyergui.h
|
||||
gui/datetimedelegate.h
|
||||
gui/decimaldelegate.h
|
||||
gui/devicesetpresetsdialog.h
|
||||
gui/devicestreamselectiondialog.h
|
||||
gui/deviceuserargsdialog.h
|
||||
gui/dmsspinbox.h
|
||||
@ -220,6 +222,7 @@ set(sdrgui_FORMS
|
||||
gui/commandoutputdialog.ui
|
||||
gui/configurationsdialog.ui
|
||||
gui/cwkeyergui.ui
|
||||
gui/devicesetpresetsdialog.ui
|
||||
gui/devicestreamselectiondialog.ui
|
||||
gui/deviceuserargsdialog.ui
|
||||
gui/editcommanddialog.ui
|
||||
|
@ -169,6 +169,7 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
||||
connect(m_changeDeviceButton, SIGNAL(clicked()), this, SLOT(openChangeDeviceDialog()));
|
||||
connect(m_reloadDeviceButton, SIGNAL(clicked()), this, SLOT(deviceReload()));
|
||||
connect(m_addChannelsButton, SIGNAL(clicked()), this, SLOT(openAddChannelsDialog()));
|
||||
connect(m_deviceSetPresetsButton, SIGNAL(clicked()), this, SLOT(deviceSetPresetsDialog()));
|
||||
connect(m_helpButton, SIGNAL(clicked()), this, SLOT(showHelp()));
|
||||
connect(m_moveButton, SIGNAL(clicked()), this, SLOT(openMoveToWorkspaceDialog()));
|
||||
connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow()));
|
||||
@ -305,6 +306,12 @@ void DeviceGUI::shrinkWindow()
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void DeviceGUI::deviceSetPresetsDialog()
|
||||
{
|
||||
QPoint p = mapFromGlobal(QCursor::pos());
|
||||
emit deviceSetPresetsDialogRequested(p, this);
|
||||
}
|
||||
|
||||
void DeviceGUI::setTitle(const QString& title)
|
||||
{
|
||||
m_titleLabel->setText(title);
|
||||
|
@ -131,6 +131,7 @@ private slots:
|
||||
void openMoveToWorkspaceDialog();
|
||||
void showSpectrumHandler();
|
||||
void showAllChannelsHandler();
|
||||
void deviceSetPresetsDialog();
|
||||
|
||||
signals:
|
||||
void forceClose();
|
||||
@ -142,6 +143,7 @@ signals:
|
||||
void showSpectrum(int deviceSetIndex);
|
||||
void showAllChannels(int deviceSetIndex);
|
||||
void addChannelEmitted(int channelIndex);
|
||||
void deviceSetPresetsDialogRequested(QPoint, DeviceGUI*);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_DEVICEGUI_H
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
~DeviceUISet();
|
||||
|
||||
void setIndex(int deviceSetIndex);
|
||||
int getIndex() const { return m_deviceSetIndex; }
|
||||
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter
|
||||
void setSpectrumScalingFactor(float scalef);
|
||||
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
|
||||
|
468
sdrgui/gui/devicesetpresetsdialog.cpp
Normal file
468
sdrgui/gui/devicesetpresetsdialog.cpp
Normal file
@ -0,0 +1,468 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 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 <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "settings/preset.h"
|
||||
#include "gui/presetitem.h"
|
||||
#include "gui/addpresetdialog.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "maincore.h"
|
||||
|
||||
#include "devicesetpresetsdialog.h"
|
||||
#include "ui_devicesetpresetsdialog.h"
|
||||
|
||||
DeviceSetPresetsDialog::DeviceSetPresetsDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DeviceSetPresetsDialog),
|
||||
m_deviceSetPresets(nullptr),
|
||||
m_deviceUISet(nullptr),
|
||||
m_pluginAPI(nullptr),
|
||||
m_currentWorkspace(nullptr),
|
||||
m_workspaces(nullptr),
|
||||
m_presetLoaded(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
DeviceSetPresetsDialog::~DeviceSetPresetsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::populateTree(int deviceType)
|
||||
{
|
||||
if (!m_deviceSetPresets) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<Preset*>::const_iterator it = m_deviceSetPresets->begin();
|
||||
QList<QTreeWidgetItem*> treeItems;
|
||||
ui->presetTree->clear();
|
||||
|
||||
for (int i = 0; it != m_deviceSetPresets->end(); ++it, i++)
|
||||
{
|
||||
if (((*it)->isSourcePreset() && (deviceType == 0)) ||
|
||||
((*it)->isSinkPreset() && (deviceType == 1)) ||
|
||||
((*it)->isMIMOPreset() && (deviceType == 2)))
|
||||
{
|
||||
QTreeWidgetItem *treeItem = addPresetToTree(*it);
|
||||
treeItems.push_back(treeItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (treeItems.size() > 0) {
|
||||
ui->presetTree->setCurrentItem(treeItems.at(treeItems.size()/2));
|
||||
}
|
||||
|
||||
updatePresetControls();
|
||||
}
|
||||
|
||||
QTreeWidgetItem* DeviceSetPresetsDialog::addPresetToTree(const Preset* preset)
|
||||
{
|
||||
QTreeWidgetItem* group = 0;
|
||||
|
||||
for(int i = 0; i < ui->presetTree->topLevelItemCount(); i++)
|
||||
{
|
||||
if(ui->presetTree->topLevelItem(i)->text(0) == preset->getGroup())
|
||||
{
|
||||
group = ui->presetTree->topLevelItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(group == 0)
|
||||
{
|
||||
QStringList sl;
|
||||
sl.append(preset->getGroup());
|
||||
group = new QTreeWidgetItem(ui->presetTree, sl, PGroup);
|
||||
group->setFirstColumnSpanned(true);
|
||||
group->setExpanded(true);
|
||||
ui->presetTree->sortByColumn(0, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
QStringList sl;
|
||||
sl.append(QString("%1").arg(preset->getCenterFrequency() / 1e6f, 0, 'f', 3)); // frequency column
|
||||
sl.append(QString("%1").arg(preset->isSourcePreset() ? 'R' : preset->isSinkPreset() ? 'T' : preset->isMIMOPreset() ? 'M' : 'X')); // mode column
|
||||
sl.append(preset->getDescription()); // description column
|
||||
PresetItem* item = new PresetItem(group, sl, preset->getCenterFrequency(), PItem);
|
||||
item->setTextAlignment(0, Qt::AlignRight);
|
||||
item->setData(0, Qt::UserRole, QVariant::fromValue(preset));
|
||||
ui->presetTree->resizeColumnToContents(0); // Resize frequency column to minimum
|
||||
ui->presetTree->resizeColumnToContents(1); // Resize mode column to minimum
|
||||
|
||||
updatePresetControls();
|
||||
return item;
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::updatePresetControls()
|
||||
{
|
||||
ui->presetTree->resizeColumnToContents(0);
|
||||
|
||||
if (ui->presetTree->currentItem() != 0)
|
||||
{
|
||||
ui->presetDelete->setEnabled(true);
|
||||
ui->presetLoad->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->presetDelete->setEnabled(false);
|
||||
ui->presetLoad->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetSave_clicked()
|
||||
{
|
||||
QStringList groups;
|
||||
QString group;
|
||||
QString description = "";
|
||||
|
||||
for(int i = 0; i < ui->presetTree->topLevelItemCount(); i++) {
|
||||
groups.append(ui->presetTree->topLevelItem(i)->text(0));
|
||||
}
|
||||
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
if (item->type() == PGroup)
|
||||
{
|
||||
group = item->text(0);
|
||||
}
|
||||
else if (item->type() == PItem)
|
||||
{
|
||||
group = item->parent()->text(0);
|
||||
description = item->text(0);
|
||||
}
|
||||
}
|
||||
|
||||
AddPresetDialog dlg(groups, group, this);
|
||||
|
||||
if (description.length() > 0) {
|
||||
dlg.setDescription(description);
|
||||
}
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
Preset* preset = MainCore::instance()->m_settings.newPreset(dlg.group(), dlg.description());
|
||||
m_deviceUISet->saveDeviceSetSettings(preset);
|
||||
ui->presetTree->setCurrentItem(addPresetToTree(preset));
|
||||
}
|
||||
|
||||
MainCore::instance()->m_settings.sortPresets();
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetUpdate_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
const Preset* changedPreset = 0;
|
||||
|
||||
if(item != 0)
|
||||
{
|
||||
if(item->type() == PItem)
|
||||
{
|
||||
const Preset* preset = qvariant_cast<const Preset*>(item->data(0, Qt::UserRole));
|
||||
|
||||
if (preset != 0)
|
||||
{
|
||||
Preset* preset_mod = const_cast<Preset*>(preset);
|
||||
m_deviceUISet->saveDeviceSetSettings(preset_mod);
|
||||
changedPreset = preset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MainCore::instance()->m_settings.sortPresets();
|
||||
ui->presetTree->clear();
|
||||
|
||||
for (int i = 0; i < MainCore::instance()->m_settings.getPresetCount(); ++i)
|
||||
{
|
||||
QTreeWidgetItem *item_x = addPresetToTree(MainCore::instance()->m_settings.getPreset(i));
|
||||
const Preset* preset_x = qvariant_cast<const Preset*>(item_x->data(0, Qt::UserRole));
|
||||
|
||||
if (changedPreset && (preset_x == changedPreset)) { // set cursor on changed preset
|
||||
ui->presetTree->setCurrentItem(item_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetEdit_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
QStringList groups;
|
||||
bool change = false;
|
||||
const Preset *changedPreset = 0;
|
||||
QString newGroupName;
|
||||
|
||||
for(int i = 0; i < ui->presetTree->topLevelItemCount(); i++) {
|
||||
groups.append(ui->presetTree->topLevelItem(i)->text(0));
|
||||
}
|
||||
|
||||
if (item)
|
||||
{
|
||||
if (item->type() == PItem)
|
||||
{
|
||||
const Preset* preset = qvariant_cast<const Preset*>(item->data(0, Qt::UserRole));
|
||||
AddPresetDialog dlg(groups, preset->getGroup(), this);
|
||||
dlg.setDescription(preset->getDescription());
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
Preset* preset_mod = const_cast<Preset*>(preset);
|
||||
preset_mod->setGroup(dlg.group());
|
||||
preset_mod->setDescription(dlg.description());
|
||||
change = true;
|
||||
changedPreset = preset;
|
||||
}
|
||||
}
|
||||
else if (item->type() == PGroup)
|
||||
{
|
||||
AddPresetDialog dlg(groups, item->text(0), this);
|
||||
dlg.showGroupOnly();
|
||||
dlg.setDialogTitle("Edit preset group");
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
MainCore::instance()->m_settings.renamePresetGroup(item->text(0), dlg.group());
|
||||
newGroupName = dlg.group();
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (change)
|
||||
{
|
||||
MainCore::instance()->m_settings.sortPresets();
|
||||
ui->presetTree->clear();
|
||||
|
||||
for (int i = 0; i < MainCore::instance()->m_settings.getPresetCount(); ++i)
|
||||
{
|
||||
QTreeWidgetItem *item_x = addPresetToTree(MainCore::instance()->m_settings.getPreset(i));
|
||||
const Preset* preset_x = qvariant_cast<const Preset*>(item_x->data(0, Qt::UserRole));
|
||||
|
||||
if (changedPreset && (preset_x == changedPreset)) { // set cursor on changed preset
|
||||
ui->presetTree->setCurrentItem(item_x);
|
||||
}
|
||||
}
|
||||
|
||||
if (!changedPreset) // on group name change set cursor on the group that has been changed
|
||||
{
|
||||
for(int i = 0; i < ui->presetTree->topLevelItemCount(); i++)
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->topLevelItem(i);
|
||||
|
||||
if (item->text(0) == newGroupName) {
|
||||
ui->presetTree->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetExport_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
if (item->type() == PItem)
|
||||
{
|
||||
const Preset* preset = qvariant_cast<const Preset*>(item->data(0, Qt::UserRole));
|
||||
QString base64Str = preset->serialize().toBase64();
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("Open preset export file"),
|
||||
".",
|
||||
tr("Preset export files (*.prex)"),
|
||||
0,
|
||||
QFileDialog::DontUseNativeDialog
|
||||
);
|
||||
|
||||
if (fileName != "")
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
|
||||
if (fileInfo.suffix() != "prex") {
|
||||
fileName += ".prex";
|
||||
}
|
||||
|
||||
QFile exportFile(fileName);
|
||||
|
||||
if (exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream outstream(&exportFile);
|
||||
outstream << base64Str;
|
||||
exportFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("Message"), tr("Cannot open file for writing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetImport_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
QString group;
|
||||
|
||||
if (item->type() == PGroup) {
|
||||
group = item->text(0);
|
||||
} else if (item->type() == PItem) {
|
||||
group = item->parent()->text(0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Open preset export file"),
|
||||
".",
|
||||
tr("Preset export files (*.prex)"),
|
||||
0,
|
||||
QFileDialog::DontUseNativeDialog
|
||||
);
|
||||
|
||||
if (fileName != "")
|
||||
{
|
||||
QFile exportFile(fileName);
|
||||
|
||||
if (exportFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QByteArray base64Str;
|
||||
QTextStream instream(&exportFile);
|
||||
instream >> base64Str;
|
||||
exportFile.close();
|
||||
|
||||
Preset* preset = MainCore::instance()->m_settings.newPreset("", "");
|
||||
preset->deserialize(QByteArray::fromBase64(base64Str));
|
||||
preset->setGroup(group); // override with current group
|
||||
|
||||
ui->presetTree->setCurrentItem(addPresetToTree(preset));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("Message"), tr("Cannot open file for reading"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetLoad_clicked()
|
||||
{
|
||||
qDebug() << "DeviceSetPresetsDialog::on_presetLoad_clicked";
|
||||
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
qDebug("DeviceSetPresetsDialog::on_presetLoad_clicked: item null");
|
||||
updatePresetControls();
|
||||
return;
|
||||
}
|
||||
|
||||
const Preset* preset = qvariant_cast<const Preset*>(item->data(0, Qt::UserRole));
|
||||
|
||||
if (!preset)
|
||||
{
|
||||
qDebug("DeviceSetPresetsDialog::on_presetLoad_clicked: preset null");
|
||||
return;
|
||||
}
|
||||
|
||||
loadDeviceSetPresetSettings(preset);
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetDelete_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
updatePresetControls();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->type() == PItem)
|
||||
{
|
||||
const Preset* preset = qvariant_cast<const Preset*>(item->data(0, Qt::UserRole));
|
||||
|
||||
if (preset)
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
this,
|
||||
tr("Delete Preset"),
|
||||
tr("Do you want to delete preset '%1'?").arg(preset->getDescription()),
|
||||
QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes
|
||||
)
|
||||
{
|
||||
delete item;
|
||||
MainCore::instance()->m_settings.deletePreset(preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item->type() == PGroup)
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
this,
|
||||
tr("Delete preset group"),
|
||||
tr("Do you want to delete preset group '%1'?").arg(item->text(0)),
|
||||
QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes
|
||||
)
|
||||
{
|
||||
MainCore::instance()->m_settings.deletePresetGroup(item->text(0));
|
||||
|
||||
ui->presetTree->clear();
|
||||
|
||||
for (int i = 0; i < MainCore::instance()->m_settings.getPresetCount(); ++i) {
|
||||
addPresetToTree(MainCore::instance()->m_settings.getPreset(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
(void) current;
|
||||
(void) previous;
|
||||
updatePresetControls();
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::on_presetTree_itemActivated(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
(void) item;
|
||||
(void) column;
|
||||
on_presetLoad_clicked();
|
||||
}
|
||||
|
||||
void DeviceSetPresetsDialog::loadDeviceSetPresetSettings(const Preset* preset)
|
||||
{
|
||||
qDebug("DeviceSetPresetsDialog::loadPresetSettings: preset [%s | %s]",
|
||||
qPrintable(preset->getGroup()),
|
||||
qPrintable(preset->getDescription()));
|
||||
|
||||
m_deviceUISet->loadDeviceSetSettings(preset, m_pluginAPI, m_workspaces, m_currentWorkspace);
|
||||
m_presetLoaded = true;
|
||||
}
|
80
sdrgui/gui/devicesetpresetsdialog.h
Normal file
80
sdrgui/gui/devicesetpresetsdialog.h
Normal file
@ -0,0 +1,80 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 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_DEVICESETPRESETDIALOG_H_
|
||||
#define SDRGUI_GUI_DEVICESETPRESETDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class Preset;
|
||||
class DeviceUISet;
|
||||
class PluginAPI;
|
||||
class Workspace;
|
||||
|
||||
namespace Ui {
|
||||
class DeviceSetPresetsDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API DeviceSetPresetsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DeviceSetPresetsDialog(QWidget* parent = nullptr);
|
||||
~DeviceSetPresetsDialog();
|
||||
|
||||
void setPresets(QList<Preset*>* presets) { m_deviceSetPresets = presets; }
|
||||
void setDeviceUISet(DeviceUISet *deviceUISet) { m_deviceUISet = deviceUISet; }
|
||||
void setPluginAPI(PluginAPI *pluginAPI) { m_pluginAPI = pluginAPI; }
|
||||
void setCurrentWorkspace(Workspace *workspace) { m_currentWorkspace = workspace; }
|
||||
void setWorkspaces(QList<Workspace*> *workspaces) { m_workspaces = workspaces; }
|
||||
void populateTree(int deviceType);
|
||||
bool wasPresetLoaded() const { return m_presetLoaded; }
|
||||
|
||||
private:
|
||||
enum {
|
||||
PGroup,
|
||||
PItem
|
||||
};
|
||||
|
||||
Ui::DeviceSetPresetsDialog* ui;
|
||||
QList<Preset*> *m_deviceSetPresets;
|
||||
DeviceUISet *m_deviceUISet;
|
||||
PluginAPI *m_pluginAPI;
|
||||
Workspace *m_currentWorkspace;
|
||||
QList<Workspace*> *m_workspaces;
|
||||
bool m_presetLoaded;
|
||||
|
||||
QTreeWidgetItem* addPresetToTree(const Preset* preset);
|
||||
void updatePresetControls();
|
||||
void loadDeviceSetPresetSettings(const Preset* preset);
|
||||
|
||||
private slots:
|
||||
void on_presetSave_clicked();
|
||||
void on_presetUpdate_clicked();
|
||||
void on_presetEdit_clicked();
|
||||
void on_presetExport_clicked();
|
||||
void on_presetImport_clicked();
|
||||
void on_presetLoad_clicked();
|
||||
void on_presetDelete_clicked();
|
||||
void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
void on_presetTree_itemActivated(QTreeWidgetItem *item, int column);
|
||||
};
|
||||
|
||||
#endif // SDRGUI_GUI_DEVICESETPRESETDIALOG_H_
|
264
sdrgui/gui/devicesetpresetsdialog.ui
Normal file
264
sdrgui/gui/devicesetpresetsdialog.ui
Normal file
@ -0,0 +1,264 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeviceSetPresetsDialog</class>
|
||||
<widget class="QDialog" name="DeviceSetPresetsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Device Set Presets</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="presetTree">
|
||||
<property name="indentation">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>5</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Freq (MHz)</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Center frequency in MHz</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>M</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mode: R: Rx or source, T: Tx or sink</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="presetsControl">
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetSave">
|
||||
<property name="toolTip">
|
||||
<string>Save current settings as new preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/create.png</normaloff>:/create.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetUpdate">
|
||||
<property name="toolTip">
|
||||
<string>Update selected preset with current settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetEdit">
|
||||
<property name="toolTip">
|
||||
<string>Edit preset details</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/edit.png</normaloff>:/edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetExport">
|
||||
<property name="toolTip">
|
||||
<string>Export current preset to file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/export.png</normaloff>:/export.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetImport">
|
||||
<property name="toolTip">
|
||||
<string>Import preset from file into current group</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/import.png</normaloff>:/import.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="QToolButton" name="presetDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetLoad">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/load.png</normaloff>:/load.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DeviceSetPresetsDialog</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>DeviceSetPresetsDialog</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>
|
@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>392</width>
|
||||
<height>414</height>
|
||||
<width>376</width>
|
||||
<height>399</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
@ -19,187 +25,175 @@
|
||||
<property name="windowTitle">
|
||||
<string>Feature presets</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>380</y>
|
||||
<width>341</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="QWidget" name="widget" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>392</width>
|
||||
<height>310</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="presetsTree">
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>5</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="presetsTree">
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>5</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="presetsControl">
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetSave">
|
||||
<property name="toolTip">
|
||||
<string>Save current settings as new preset</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>330</y>
|
||||
<width>392</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="presetsControl">
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetSave">
|
||||
<property name="toolTip">
|
||||
<string>Save current settings as new preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/create.png</normaloff>:/create.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetUpdate">
|
||||
<property name="toolTip">
|
||||
<string>Update selected preset with current settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetEdit">
|
||||
<property name="toolTip">
|
||||
<string>Edit preset details</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/edit.png</normaloff>:/edit.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="QToolButton" name="presetDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetLoad">
|
||||
<property name="toolTip">
|
||||
<string>Load selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/load.png</normaloff>:/load.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/create.png</normaloff>:/create.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetUpdate">
|
||||
<property name="toolTip">
|
||||
<string>Update selected preset with current settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetEdit">
|
||||
<property name="toolTip">
|
||||
<string>Edit preset details</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/edit.png</normaloff>:/edit.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="QToolButton" name="presetDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QToolButton" name="presetLoad">
|
||||
<property name="toolTip">
|
||||
<string>Load selected preset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/load.png</normaloff>:/load.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
|
@ -66,6 +66,7 @@
|
||||
#include "gui/ambedevicesdialog.h"
|
||||
#include "gui/workspace.h"
|
||||
#include "gui/featurepresetsdialog.h"
|
||||
#include "gui/devicesetpresetsdialog.h"
|
||||
#include "gui/commandsdialog.h"
|
||||
#include "gui/configurationsdialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@ -542,6 +543,12 @@ void MainWindow::sampleSourceCreate(
|
||||
this,
|
||||
[=](){ this->removeDeviceSet(deviceGUI->getIndex()); }
|
||||
);
|
||||
QObject::connect(
|
||||
deviceGUI,
|
||||
&DeviceGUI::deviceSetPresetsDialogRequested,
|
||||
this,
|
||||
&MainWindow::openDeviceSetPresetsDialog
|
||||
);
|
||||
|
||||
deviceAPI->getSampleSource()->setMessageQueueToGUI(deviceGUI->getInputMessageQueue());
|
||||
deviceUISet->m_deviceGUI = deviceGUI;
|
||||
@ -753,6 +760,13 @@ void MainWindow::sampleSinkCreate(
|
||||
this,
|
||||
[=](){ this->removeDeviceSet(deviceGUI->getIndex()); }
|
||||
);
|
||||
QObject::connect(
|
||||
deviceGUI,
|
||||
&DeviceGUI::deviceSetPresetsDialogRequested,
|
||||
this,
|
||||
&MainWindow::openDeviceSetPresetsDialog
|
||||
);
|
||||
|
||||
deviceAPI->getSampleSink()->setMessageQueueToGUI(deviceGUI->getInputMessageQueue());
|
||||
deviceUISet->m_deviceGUI = deviceGUI;
|
||||
const PluginInterface::SamplingDevice *selectedDevice = DeviceEnumerator::instance()->getRxSamplingDevice(selectedDeviceIndex);
|
||||
@ -937,6 +951,13 @@ void MainWindow::sampleMIMOCreate(
|
||||
this,
|
||||
[=](){ this->removeDeviceSet(deviceGUI->getIndex()); }
|
||||
);
|
||||
QObject::connect(
|
||||
deviceGUI,
|
||||
&DeviceGUI::deviceSetPresetsDialogRequested,
|
||||
this,
|
||||
&MainWindow::openDeviceSetPresetsDialog
|
||||
);
|
||||
|
||||
deviceAPI->getSampleMIMO()->setMessageQueueToGUI(deviceGUI->getInputMessageQueue());
|
||||
deviceUISet->m_deviceGUI = deviceGUI;
|
||||
const PluginInterface::SamplingDevice *selectedDevice = DeviceEnumerator::instance()->getRxSamplingDevice(selectedDeviceIndex);
|
||||
@ -1591,44 +1612,6 @@ void MainWindow::updatePresetControls()
|
||||
// }
|
||||
}
|
||||
|
||||
QTreeWidgetItem* MainWindow::addPresetToTree(const Preset* preset)
|
||||
{
|
||||
// QTreeWidgetItem* group = 0;
|
||||
|
||||
// for(int i = 0; i < ui->presetTree->topLevelItemCount(); i++)
|
||||
// {
|
||||
// if(ui->presetTree->topLevelItem(i)->text(0) == preset->getGroup())
|
||||
// {
|
||||
// group = ui->presetTree->topLevelItem(i);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(group == 0)
|
||||
// {
|
||||
// QStringList sl;
|
||||
// sl.append(preset->getGroup());
|
||||
// group = new QTreeWidgetItem(ui->presetTree, sl, PGroup);
|
||||
// group->setFirstColumnSpanned(true);
|
||||
// group->setExpanded(true);
|
||||
// ui->presetTree->sortByColumn(0, Qt::AscendingOrder);
|
||||
// }
|
||||
|
||||
// QStringList sl;
|
||||
// sl.append(QString("%1").arg(preset->getCenterFrequency() / 1e6f, 0, 'f', 3)); // frequency column
|
||||
// sl.append(QString("%1").arg(preset->isSourcePreset() ? 'R' : preset->isSinkPreset() ? 'T' : preset->isMIMOPreset() ? 'M' : 'X')); // mode column
|
||||
// sl.append(preset->getDescription()); // description column
|
||||
// PresetItem* item = new PresetItem(group, sl, preset->getCenterFrequency(), PItem);
|
||||
// item->setTextAlignment(0, Qt::AlignRight);
|
||||
// item->setData(0, Qt::UserRole, QVariant::fromValue(preset));
|
||||
// ui->presetTree->resizeColumnToContents(0); // Resize frequency column to minimum
|
||||
// ui->presetTree->resizeColumnToContents(1); // Resize mode column to minimum
|
||||
|
||||
// updatePresetControls();
|
||||
// return item;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::applySettings()
|
||||
{
|
||||
// loadDeviceSetPresetSettings(m_mainCore->m_settings.getWorkingPreset(), 0);
|
||||
@ -1664,7 +1647,15 @@ bool MainWindow::handleMessage(const Message& cmd)
|
||||
if (MainCore::MsgLoadPreset::match(cmd))
|
||||
{
|
||||
MainCore::MsgLoadPreset& notif = (MainCore::MsgLoadPreset&) cmd;
|
||||
loadDeviceSetPresetSettings(notif.getPreset(), notif.getDeviceSetIndex());
|
||||
int deviceSetIndex = notif.getDeviceSetIndex();
|
||||
const Preset *preset = notif.getPreset();
|
||||
|
||||
if (deviceSetIndex < (int) m_deviceUIs.size())
|
||||
{
|
||||
DeviceUISet *deviceUISet = m_deviceUIs[deviceSetIndex];
|
||||
deviceUISet->loadDeviceSetSettings(preset, m_pluginManager->getPluginAPI(), &m_workspaces, nullptr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgSavePreset::match(cmd))
|
||||
@ -2303,14 +2294,14 @@ void MainWindow::on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTre
|
||||
{
|
||||
(void) current;
|
||||
(void) previous;
|
||||
updatePresetControls();
|
||||
// updatePresetControls();
|
||||
}
|
||||
|
||||
void MainWindow::on_presetTree_itemActivated(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
(void) item;
|
||||
(void) column;
|
||||
on_presetLoad_clicked();
|
||||
// on_presetLoad_clicked();
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Quick_Start_triggered()
|
||||
@ -2787,6 +2778,36 @@ void MainWindow::openFeaturePresetsDialog(QPoint p, Workspace *workspace)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openDeviceSetPresetsDialog(QPoint p, DeviceGUI *deviceGUI)
|
||||
{
|
||||
Workspace *workspace = m_workspaces[deviceGUI->getWorkspaceIndex()];
|
||||
DeviceUISet *deviceUISet = m_deviceUIs[deviceGUI->getIndex()];
|
||||
|
||||
DeviceSetPresetsDialog dialog;
|
||||
dialog.setDeviceUISet(deviceUISet);
|
||||
dialog.setPresets(m_mainCore->m_settings.getPresets());
|
||||
dialog.setPluginAPI(m_pluginManager->getPluginAPI());
|
||||
dialog.setCurrentWorkspace(workspace);
|
||||
dialog.setWorkspaces(&m_workspaces);
|
||||
dialog.populateTree((int) deviceGUI->getDeviceType());
|
||||
dialog.move(p);
|
||||
dialog.exec();
|
||||
|
||||
// if (dialog.wasPresetLoaded())
|
||||
// {
|
||||
// for (int i = 0; i < m_featureUIs[0]->getNumberOfFeatures(); i++)
|
||||
// {
|
||||
// FeatureGUI *gui = m_featureUIs[0]->getFeatureGuiAt(i);
|
||||
// QObject::connect(
|
||||
// gui,
|
||||
// &FeatureGUI::moveToWorkspace,
|
||||
// this,
|
||||
// [=](int wsIndexDest){ this->featureMove(gui, wsIndexDest); }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void MainWindow::deleteFeature(int featureSetIndex, int featureIndex)
|
||||
{
|
||||
if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_featureUIs.size()))
|
||||
|
@ -138,7 +138,6 @@ private:
|
||||
void createStatusBar();
|
||||
void closeEvent(QCloseEvent*);
|
||||
void updatePresetControls();
|
||||
QTreeWidgetItem* addPresetToTree(const Preset* preset);
|
||||
void applySettings();
|
||||
|
||||
void removeDeviceSet(int deviceSetIndex);
|
||||
@ -215,6 +214,7 @@ private slots:
|
||||
void mainSpectrumMove(MainSpectrumGUI *gui, int wsIndexDestnation);
|
||||
void mainSpectrumShow(MainSpectrumGUI *gui);
|
||||
void showAllChannels(int deviceSetIndex);
|
||||
void openDeviceSetPresetsDialog(QPoint p, DeviceGUI *deviceGUI);
|
||||
void on_action_Quick_Start_triggered();
|
||||
void on_action_Main_Window_triggered();
|
||||
void on_action_Loaded_Plugins_triggered();
|
||||
|
Loading…
Reference in New Issue
Block a user