diff --git a/sdrgui/gui/devicestreamselectiondialog.cpp b/sdrgui/gui/devicestreamselectiondialog.cpp new file mode 100644 index 000000000..f7d906c3e --- /dev/null +++ b/sdrgui/gui/devicestreamselectiondialog.cpp @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "ui_devicestreamselectiondialog.h" +#include "devicestreamselectiondialog.h" + +DeviceStreamSelectionDialog::DeviceStreamSelectionDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::DeviceStreamSelectionDialog), + m_hasChanged(false), + m_streamIndex(0) +{ + ui->setupUi(this); +} + +DeviceStreamSelectionDialog::~DeviceStreamSelectionDialog() +{ + delete ui; +} + +void DeviceStreamSelectionDialog::setNumberOfStreams(int nbStreams) +{ + ui->deviceStream->clear(); + + for (int i = 0; i < nbStreams; i++) { + ui->deviceStream->addItem(tr("%1").arg(i)); + } +} + +void DeviceStreamSelectionDialog::setStreamIndex(int index) +{ + ui->deviceStream->setCurrentIndex(index); + m_streamIndex = ui->deviceStream->currentIndex(); +} + +void DeviceStreamSelectionDialog::accept() +{ + m_streamIndex = ui->deviceStream->currentIndex(); + m_hasChanged = true; + QDialog::accept(); +} \ No newline at end of file diff --git a/sdrgui/gui/devicestreamselectiondialog.h b/sdrgui/gui/devicestreamselectiondialog.h new file mode 100644 index 000000000..7dc249bb9 --- /dev/null +++ b/sdrgui/gui/devicestreamselectiondialog.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_DEVICESTREAMSELECTIONDIALOG_H_ +#define _SDRGUI_DEVICESTREAMSELECTIONDIALOG_H_ + +#include + +#include "../../exports/export.h" + +namespace Ui { + class DeviceStreamSelectionDialog; +} + +class SDRGUI_API DeviceStreamSelectionDialog : public QDialog +{ + Q_OBJECT +public: + explicit DeviceStreamSelectionDialog(QWidget *parent = nullptr); + ~DeviceStreamSelectionDialog(); + bool hasChanged() const { return m_hasChanged; } + void setNumberOfStreams(int nbStreams); + void setStreamIndex(int index); + int getSelectedStreamIndex() const { return m_streamIndex; }; + +private slots: + void accept(); + +private: + Ui::DeviceStreamSelectionDialog *ui; + bool m_hasChanged; + int m_streamIndex; +}; + +#endif // _SDRGUI_DEVICESTREAMSELECTIONDIALOG_H_ \ No newline at end of file diff --git a/sdrgui/gui/devicestreamselectiondialog.ui b/sdrgui/gui/devicestreamselectiondialog.ui new file mode 100644 index 000000000..2bfff89ef --- /dev/null +++ b/sdrgui/gui/devicestreamselectiondialog.ui @@ -0,0 +1,101 @@ + + + DeviceStreamSelectionDialog + + + + 0 + 0 + 400 + 135 + + + + + Liberation Sans + 9 + + + + Select device stream + + + + + + + + Stream + + + + + + + Devcie stream index + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DeviceStreamSelectionDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DeviceStreamSelectionDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/sdrgui/gui/rollupwidget.cpp b/sdrgui/gui/rollupwidget.cpp index caa7a01c7..4557a3fdb 100644 --- a/sdrgui/gui/rollupwidget.cpp +++ b/sdrgui/gui/rollupwidget.cpp @@ -322,7 +322,6 @@ void RollupWidget::mousePressEvent(QMouseEvent* event) return; } - // close button right if(QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) { close();