mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-07 11:59:04 -05:00
Added exernal clock dialog and button and implemented it in LimeSDR plugins GUIs
This commit is contained in:
parent
77a5cf3a21
commit
045652f5cb
@ -281,9 +281,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="extClock">
|
||||
<widget class="ExternalClockButton" name="extClock">
|
||||
<property name="toolTip">
|
||||
<string>External clock source selection</string>
|
||||
<string>External clock dialog</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -933,6 +933,11 @@ QToolTip{background-color: white; color: black;}</string>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ExternalClockButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/externalclockbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
|
@ -326,9 +326,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="extClock">
|
||||
<widget class="ExternalClockButton" name="extClock">
|
||||
<property name="toolTip">
|
||||
<string>External clock source selection</string>
|
||||
<string>External clock dialog</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -1161,6 +1161,11 @@ QToolTip{background-color: white; color: black;}</string>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ExternalClockButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/externalclockbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
|
@ -11,6 +11,8 @@ set(sdrgui_SOURCES
|
||||
gui/clickablelabel.cpp
|
||||
gui/colormapper.cpp
|
||||
gui/cwkeyergui.cpp
|
||||
gui/externalclockbutton.cpp
|
||||
gui/externalclockdialog.cpp
|
||||
gui/glscope.cpp
|
||||
gui/glscopegui.cpp
|
||||
gui/glscopeng.cpp
|
||||
@ -57,6 +59,8 @@ set(sdrgui_HEADERS
|
||||
gui/channelwindow.h
|
||||
gui/colormapper.h
|
||||
gui/cwkeyergui.h
|
||||
gui/externalclockbutton.h
|
||||
gui/externalclockdialog.h
|
||||
gui/glscope.h
|
||||
gui/glscopegui.h
|
||||
gui/glscopeng.h
|
||||
@ -106,6 +110,7 @@ set(sdrgui_FORMS
|
||||
gui/basicchannelsettingswidget.ui
|
||||
gui/basicchannelsettingsdialog.ui
|
||||
gui/cwkeyergui.ui
|
||||
gui/externalclockdialog.ui
|
||||
gui/glscopegui.ui
|
||||
gui/glscopenggui.ui
|
||||
gui/glscopemultigui.ui
|
||||
|
55
sdrgui/gui/externalclockbutton.cpp
Normal file
55
sdrgui/gui/externalclockbutton.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "externalclockdialog.h"
|
||||
#include "externalclockbutton.h"
|
||||
|
||||
ExternalClockButton::ExternalClockButton(QWidget* parent) :
|
||||
QPushButton(parent),
|
||||
m_externalClockFrequency(0),
|
||||
m_externalClockFrequencyActive(false)
|
||||
{
|
||||
setObjectName("ExternalClockButton");
|
||||
connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
|
||||
}
|
||||
|
||||
void ExternalClockButton::onClicked()
|
||||
{
|
||||
ExternalClockDialog externalClockDialog(m_externalClockFrequency, m_externalClockFrequencyActive, this);
|
||||
externalClockDialog.exec();
|
||||
updateState();
|
||||
}
|
||||
|
||||
void ExternalClockButton::updateState()
|
||||
{
|
||||
setToolTip(tr("External clock dialog. External clock frequency %1 MHz %2")
|
||||
.arg(m_externalClockFrequency/1000000.0)
|
||||
.arg(m_externalClockFrequencyActive ? "enabled" : "disabled"));
|
||||
|
||||
if(m_externalClockFrequencyActive)
|
||||
{
|
||||
setStyleSheet("ExternalClockButton { background:rgb(128, 70, 0); }");
|
||||
}
|
||||
else
|
||||
{
|
||||
setStyleSheet("ExternalClockButton { background:rgb(48, 48, 48); }");
|
||||
}
|
||||
|
||||
}
|
57
sdrgui/gui/externalclockbutton.h
Normal file
57
sdrgui/gui/externalclockbutton.h
Normal file
@ -0,0 +1,57 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_EXTERNALCLOCKBUTTON_H_
|
||||
#define SDRBASE_GUI_EXTERNALCLOCKBUTTON_H_
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
class ExternalClockButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExternalClockButton(QWidget* parent = 0);
|
||||
qint64 getExternalClockFrequency() const { return m_externalClockFrequency; }
|
||||
bool getExternalClockFrequencyActive() const { return m_externalClockFrequencyActive; }
|
||||
|
||||
void setExternalClockFrequency(qint64 deltaFrequency)
|
||||
{
|
||||
m_externalClockFrequency = deltaFrequency;
|
||||
updateState();
|
||||
}
|
||||
|
||||
void setExternalcClockFrequencyActive(bool active)
|
||||
{
|
||||
m_externalClockFrequencyActive = active;
|
||||
updateState();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onClicked();
|
||||
|
||||
private:
|
||||
qint64 m_externalClockFrequency;
|
||||
bool m_externalClockFrequencyActive;
|
||||
|
||||
void updateState();
|
||||
};
|
||||
|
||||
|
||||
#endif /* SDRBASE_GUI_EXTERNALCLOCKBUTTON_H_ */
|
49
sdrgui/gui/externalclockdialog.cpp
Normal file
49
sdrgui/gui/externalclockdialog.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "externalclockdialog.h"
|
||||
#include "ui_externalclockdialog.h"
|
||||
|
||||
|
||||
ExternalClockDialog::ExternalClockDialog(qint64& externalClockFrequency, bool& externalClockFrequencyActive, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ExternalClockDialog),
|
||||
m_externalClockFrequency(externalClockFrequency),
|
||||
m_externalClockFrequencyActive(externalClockFrequencyActive)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->externalClockFrequencyLabel->setText("f");
|
||||
ui->externalClockFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->externalClockFrequency->setValueRange(true, 9, 5000000L, 300000000L);
|
||||
ui->externalClockFrequency->setValue(externalClockFrequency);
|
||||
ui->externalClockFrequencyActive->setChecked(externalClockFrequencyActive);
|
||||
}
|
||||
|
||||
ExternalClockDialog::~ExternalClockDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExternalClockDialog::accept()
|
||||
{
|
||||
m_externalClockFrequency = ui->externalClockFrequency->getValueNew();
|
||||
m_externalClockFrequencyActive = ui->externalClockFrequencyActive->isChecked();
|
||||
QDialog::accept();
|
||||
}
|
48
sdrgui/gui/externalclockdialog.h
Normal file
48
sdrgui/gui/externalclockdialog.h
Normal file
@ -0,0 +1,48 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_EXTERNALCLOCKDIALOG_H_
|
||||
#define SDRBASE_GUI_EXTERNALCLOCKDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ExternalClockDialog;
|
||||
}
|
||||
|
||||
class ExternalClockDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExternalClockDialog(qint64& externalClockFrequency, bool& externalClockFrequencyActive, QWidget* parent = 0);
|
||||
~ExternalClockDialog();
|
||||
|
||||
private:
|
||||
Ui::ExternalClockDialog* ui;
|
||||
qint64& m_externalClockFrequency;
|
||||
bool& m_externalClockFrequencyActive;
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SDRBASE_GUI_EXTERNALCLOCKDIALOG_H_ */
|
168
sdrgui/gui/externalclockdialog.ui
Normal file
168
sdrgui/gui/externalclockdialog.ui
Normal file
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExternalClockDialog</class>
|
||||
<widget class="QDialog" name="ExternalClockDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>External Clock</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="ExternalClockLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="DialogLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="externalClockFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>f</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDialZ" name="externalClockFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>External clock frequency (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="externalClockFrequencyUnits">
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</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="ButtonSwitch" name="externalClockFrequencyActive">
|
||||
<property name="toolTip">
|
||||
<string>Enable or disable external clock</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/checkmark.png</normaloff>:/checkmark.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="terminateBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>terminateBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>terminateBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ExternalClockDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>257</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>terminateBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ExternalClockDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>314</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -49,6 +49,8 @@ SOURCES += mainwindow.cpp\
|
||||
gui/clickablelabel.cpp\
|
||||
gui/colormapper.cpp\
|
||||
gui/cwkeyergui.cpp\
|
||||
gui/externalclockbutton.cpp\
|
||||
gui/externalclockdialog.cpp\
|
||||
gui/glscope.cpp\
|
||||
gui/glscopegui.cpp\
|
||||
gui/glscopeng.cpp\
|
||||
@ -92,6 +94,8 @@ HEADERS += mainwindow.h\
|
||||
gui/clickablelabel.h\
|
||||
gui/colormapper.h\
|
||||
gui/cwkeyergui.h\
|
||||
gui/externalclockbutton.h\
|
||||
gui/externalclockdialog.h\
|
||||
gui/glscope.h\
|
||||
gui/glscopegui.h\
|
||||
gui/glscopeng.h\
|
||||
@ -122,6 +126,7 @@ FORMS += mainwindow.ui\
|
||||
gui/basicchannelsettingswidget.ui\
|
||||
gui/basicchannelsettingsdialog.ui\
|
||||
gui/cwkeyergui.ui\
|
||||
gui/externalclockdialog.ui\
|
||||
gui/audiodialog.ui\
|
||||
gui/glscopegui.ui\
|
||||
gui/glscopenggui.ui\
|
||||
|
Loading…
Reference in New Issue
Block a user