From 88f76c5a61f2d16932b45892286d7995dd77793e Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 28 Sep 2016 17:01:57 +0200 Subject: [PATCH] New dialog to store my geolocalisation --- sdrbase/gui/myposdialog.ui | 122 +++++++++++++++++++++++++++++++ sdrbase/gui/mypositiondialog.cpp | 45 ++++++++++++ sdrbase/gui/mypositiondialog.h | 46 ++++++++++++ sdrbase/mainwindow.cpp | 7 ++ sdrbase/mainwindow.h | 1 + sdrbase/mainwindow.ui | 91 +++++++++++++++++++++-- sdrbase/sdrbase.pro | 3 + 7 files changed, 308 insertions(+), 7 deletions(-) create mode 100644 sdrbase/gui/myposdialog.ui create mode 100644 sdrbase/gui/mypositiondialog.cpp create mode 100644 sdrbase/gui/mypositiondialog.h diff --git a/sdrbase/gui/myposdialog.ui b/sdrbase/gui/myposdialog.ui new file mode 100644 index 000000000..a794c7925 --- /dev/null +++ b/sdrbase/gui/myposdialog.ui @@ -0,0 +1,122 @@ + + + MyPositionDialog + + + + 0 + 0 + 324 + 127 + + + + + Sans Serif + 9 + + + + Dialog + + + + + + My Station Position + + + + + + Latitude + + + + + + + Longitude + + + + + + + 6 + + + -180.000000000000000 + + + 180.000000000000000 + + + + + + + 6 + + + -90.000000000000000 + + + 90.000000000000000 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + buttonBox + + + + + buttonBox + accepted() + MyPositionDialog + accept() + + + 257 + 194 + + + 157 + 203 + + + + + buttonBox + rejected() + MyPositionDialog + reject() + + + 314 + 194 + + + 286 + 203 + + + + + diff --git a/sdrbase/gui/mypositiondialog.cpp b/sdrbase/gui/mypositiondialog.cpp new file mode 100644 index 000000000..ede97ebe1 --- /dev/null +++ b/sdrbase/gui/mypositiondialog.cpp @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 F4EXB // +// written by Edouard Griffiths // +// // +// OpenGL interface modernization. // +// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html // +// // +// 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 // +// // +// 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 "gui/mypositiondialog.h" +#include "ui_myposdialog.h" + + +MyPositionDialog::MyPositionDialog(MainSettings& mainSettings, QWidget* parent) : + m_mainSettings(mainSettings), + QDialog(parent), + ui(new Ui::MyPositionDialog) +{ + ui->setupUi(this); + ui->latitudeSpinBox->setValue(m_mainSettings.getLatitude()); + ui->longitudeSpinBox->setValue(m_mainSettings.getLongitude()); +} + +MyPositionDialog::~MyPositionDialog() +{ + delete ui; +} + +void MyPositionDialog::accept() +{ + m_mainSettings.setLatitude(ui->latitudeSpinBox->value()); + m_mainSettings.setLongitude(ui->longitudeSpinBox->value()); + QDialog::accept(); +} diff --git a/sdrbase/gui/mypositiondialog.h b/sdrbase/gui/mypositiondialog.h new file mode 100644 index 000000000..185e4d3e8 --- /dev/null +++ b/sdrbase/gui/mypositiondialog.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 F4EXB // +// written by Edouard Griffiths // +// // +// OpenGL interface modernization. // +// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html // +// // +// 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 // +// // +// 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 SDRBASE_GUI_MYPOSITIONDIALOG_H_ +#define SDRBASE_GUI_MYPOSITIONDIALOG_H_ + +#include +#include "settings/mainsettings.h" + +namespace Ui { + class MyPositionDialog; +} + +class MyPositionDialog : public QDialog { + Q_OBJECT + +public: + explicit MyPositionDialog(MainSettings& mainSettings, QWidget* parent = 0); + ~MyPositionDialog(); + +private: + Ui::MyPositionDialog* ui; + MainSettings& m_mainSettings; + +private slots: + void accept(); +}; + +#endif /* SDRBASE_GUI_MYPOSITIONDIALOG_H_ */ diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index d08fc1e82..b6076be0d 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -38,6 +38,7 @@ #include "gui/channelwindow.h" #include "gui/audiodialog.h" #include "gui/samplingdevicecontrol.h" +#include "gui/mypositiondialog.h" #include "dsp/dspengine.h" #include "dsp/spectrumvis.h" #include "dsp/dspcommands.h" @@ -617,6 +618,12 @@ void MainWindow::on_action_Audio_triggered() audioDialog.exec(); } +void MainWindow::on_action_My_Position_triggered() +{ + MyPositionDialog myPositionDialog(m_settings, this); + myPositionDialog.exec(); +} + void MainWindow::on_action_DV_Serial_triggered(bool checked) { m_dspEngine->setDVSerialSupport(checked); diff --git a/sdrbase/mainwindow.h b/sdrbase/mainwindow.h index d13042121..6b5b347d0 100644 --- a/sdrbase/mainwindow.h +++ b/sdrbase/mainwindow.h @@ -149,6 +149,7 @@ private slots: void on_presetTree_itemActivated(QTreeWidgetItem *item, int column); void on_action_Audio_triggered(); void on_action_DV_Serial_triggered(bool checked); + void on_action_My_Position_triggered(); void on_sampleSource_confirmClicked(bool checked); void on_action_Loaded_Plugins_triggered(); void on_action_About_triggered(); diff --git a/sdrbase/mainwindow.ui b/sdrbase/mainwindow.ui index 098075ee7..6b4135207 100644 --- a/sdrbase/mainwindow.ui +++ b/sdrbase/mainwindow.ui @@ -33,7 +33,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -66,7 +75,7 @@ 0 0 1012 - 19 + 21 @@ -137,6 +146,7 @@ + @@ -162,7 +172,16 @@ - + + 2 + + + 2 + + + 2 + + 2 @@ -373,7 +392,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -404,7 +432,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -441,7 +478,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -469,7 +515,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -596,6 +651,11 @@ DV Serial + + + My Position + + presetDock channelDock @@ -608,6 +668,23 @@ + + + + + + + + + + + + + + + + + diff --git a/sdrbase/sdrbase.pro b/sdrbase/sdrbase.pro index 6806f81fa..16a651364 100644 --- a/sdrbase/sdrbase.pro +++ b/sdrbase/sdrbase.pro @@ -80,6 +80,7 @@ SOURCES += mainwindow.cpp\ gui/presetitem.cpp\ gui/rollupwidget.cpp\ gui/samplingdevicecontrol.cpp\ + gui/mypositiondialog.cpp\ gui/scale.cpp\ gui/scaleengine.cpp\ gui/valuedial.cpp\ @@ -159,6 +160,7 @@ HEADERS += mainwindow.h\ gui/presetitem.h\ gui/rollupwidget.h\ gui/samplingdevicecontrol.h\ + gui/mypositiondialog.h\ gui/scale.h\ gui/scaleengine.h\ gui/valuedial.h\ @@ -189,6 +191,7 @@ FORMS += mainwindow.ui\ gui/aboutdialog.ui\ gui/pluginsdialog.ui\ gui/samplingdevicecontrol.ui\ + gui/myposdialog.ui\ gui/glspectrumgui.ui\ mainwindow.ui