mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Add support for zooming in to image
This commit is contained in:
parent
5eff1c7bb4
commit
de2654aeb4
Binary file not shown.
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 254 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 11 KiB |
BIN
doc/img/RadioClock_waveforms.png
Normal file
BIN
doc/img/RadioClock_waveforms.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
@ -584,6 +584,7 @@ int APTDemod::webapiActionsPost(
|
|||||||
{
|
{
|
||||||
SWGSDRangel::SWGAPTDemodActions_aos* aos = swgAPTDemodActions->getAos();
|
SWGSDRangel::SWGAPTDemodActions_aos* aos = swgAPTDemodActions->getAos();
|
||||||
QString *satelliteName = aos->getSatelliteName();
|
QString *satelliteName = aos->getSatelliteName();
|
||||||
|
qDebug() << "APTDemod::webapiActionsPost - AOS " << *satelliteName;
|
||||||
if (satelliteName != nullptr)
|
if (satelliteName != nullptr)
|
||||||
{
|
{
|
||||||
if (matchSatellite(*satelliteName))
|
if (matchSatellite(*satelliteName))
|
||||||
@ -617,6 +618,7 @@ int APTDemod::webapiActionsPost(
|
|||||||
{
|
{
|
||||||
SWGSDRangel::SWGAPTDemodActions_los* los = swgAPTDemodActions->getLos();
|
SWGSDRangel::SWGAPTDemodActions_los* los = swgAPTDemodActions->getLos();
|
||||||
QString *satelliteName = los->getSatelliteName();
|
QString *satelliteName = los->getSatelliteName();
|
||||||
|
qDebug() << "APTDemod::webapiActionsPost - LOS " << *satelliteName;
|
||||||
|
|
||||||
if (satelliteName != nullptr)
|
if (satelliteName != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -25,9 +25,10 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QGraphicsPixmapItem>
|
||||||
|
|
||||||
#include "aptdemodgui.h"
|
#include "aptdemodgui.h"
|
||||||
#include "util/ax25.h"
|
|
||||||
|
|
||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
@ -42,6 +43,7 @@
|
|||||||
#include "gui/devicestreamselectiondialog.h"
|
#include "gui/devicestreamselectiondialog.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "gui/crightclickenabler.h"
|
#include "gui/crightclickenabler.h"
|
||||||
|
#include "gui/graphicsviewzoom.h"
|
||||||
#include "channel/channelwebapiutils.h"
|
#include "channel/channelwebapiutils.h"
|
||||||
#include "maincore.h"
|
#include "maincore.h"
|
||||||
|
|
||||||
@ -101,7 +103,20 @@ bool APTDemodGUI::handleMessage(const Message& message)
|
|||||||
const APTDemod::MsgImage& imageMsg = (APTDemod::MsgImage&) message;
|
const APTDemod::MsgImage& imageMsg = (APTDemod::MsgImage&) message;
|
||||||
m_image = imageMsg.getImage();
|
m_image = imageMsg.getImage();
|
||||||
m_pixmap.convertFromImage(m_image);
|
m_pixmap.convertFromImage(m_image);
|
||||||
ui->image->setPixmap(m_pixmap);
|
if (m_pixmapItem != nullptr)
|
||||||
|
{
|
||||||
|
m_pixmapItem->setPixmap(m_pixmap);
|
||||||
|
if (ui->zoomAll->isChecked()) {
|
||||||
|
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pixmapItem = m_scene->addPixmap(m_pixmap);
|
||||||
|
m_pixmapItem->setPos(0, 0);
|
||||||
|
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
QStringList imageTypes = imageMsg.getImageTypes();
|
QStringList imageTypes = imageMsg.getImageTypes();
|
||||||
if (imageTypes.size() == 0)
|
if (imageTypes.size() == 0)
|
||||||
{
|
{
|
||||||
@ -171,7 +186,19 @@ bool APTDemodGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_pixmap.convertFromImage(m_image);
|
m_pixmap.convertFromImage(m_image);
|
||||||
ui->image->setPixmap(m_pixmap);
|
if (m_pixmapItem != nullptr)
|
||||||
|
{
|
||||||
|
m_pixmapItem->setPixmap(m_pixmap);
|
||||||
|
if (ui->zoomAll->isChecked()) {
|
||||||
|
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pixmapItem = m_scene->addPixmap(m_pixmap);
|
||||||
|
m_pixmapItem->setPos(0, 0);
|
||||||
|
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -302,7 +329,9 @@ void APTDemodGUI::on_startStop_clicked(bool checked)
|
|||||||
|
|
||||||
void APTDemodGUI::on_resetDecoder_clicked()
|
void APTDemodGUI::on_resetDecoder_clicked()
|
||||||
{
|
{
|
||||||
ui->image->setPixmap(QPixmap());
|
if (m_pixmapItem != nullptr) {
|
||||||
|
m_pixmapItem->setPixmap(QPixmap());
|
||||||
|
}
|
||||||
ui->imageContainer->setWindowTitle("Received image");
|
ui->imageContainer->setWindowTitle("Received image");
|
||||||
// Send message to reset decoder
|
// Send message to reset decoder
|
||||||
m_aptDemod->getInputMessageQueue()->push(APTDemod::MsgResetDecoder::create());
|
m_aptDemod->getInputMessageQueue()->push(APTDemod::MsgResetDecoder::create());
|
||||||
@ -332,6 +361,30 @@ void APTDemodGUI::on_saveImage_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void APTDemodGUI::on_zoomIn_clicked()
|
||||||
|
{
|
||||||
|
m_zoom->gentleZoom(1.25);
|
||||||
|
ui->zoomAll->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APTDemodGUI::on_zoomOut_clicked()
|
||||||
|
{
|
||||||
|
m_zoom->gentleZoom(0.75);
|
||||||
|
ui->zoomAll->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APTDemodGUI::on_zoomAll_clicked(bool checked)
|
||||||
|
{
|
||||||
|
if (checked && (m_pixmapItem != nullptr)) {
|
||||||
|
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APTDemodGUI::on_image_zoomed()
|
||||||
|
{
|
||||||
|
ui->zoomAll->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
void APTDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void APTDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
(void) widget;
|
(void) widget;
|
||||||
@ -389,7 +442,9 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
|||||||
m_deviceUISet(deviceUISet),
|
m_deviceUISet(deviceUISet),
|
||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_tickCount(0)
|
m_tickCount(0),
|
||||||
|
m_scene(nullptr),
|
||||||
|
m_pixmapItem(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -425,6 +480,13 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
|||||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
|
|
||||||
|
m_zoom = new GraphicsViewZoom(ui->image); // Deleted automatically when view is deleted
|
||||||
|
connect(m_zoom, SIGNAL(zoomed()), this, SLOT(on_image_zoomed()));
|
||||||
|
|
||||||
|
m_scene = new QGraphicsScene(ui->image);
|
||||||
|
ui->image->setScene(m_scene);
|
||||||
|
ui->image->show();
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
applySettings(true);
|
applySettings(true);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,9 @@ class DeviceUISet;
|
|||||||
class BasebandSampleSink;
|
class BasebandSampleSink;
|
||||||
class APTDemod;
|
class APTDemod;
|
||||||
class APTDemodGUI;
|
class APTDemodGUI;
|
||||||
|
class QGraphicsScene;
|
||||||
|
class QGraphicsPixmapItem;
|
||||||
|
class GraphicsViewZoom;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class APTDemodGUI;
|
class APTDemodGUI;
|
||||||
@ -79,6 +82,9 @@ private:
|
|||||||
|
|
||||||
QImage m_image;
|
QImage m_image;
|
||||||
QPixmap m_pixmap;
|
QPixmap m_pixmap;
|
||||||
|
QGraphicsScene* m_scene;
|
||||||
|
QGraphicsPixmapItem* m_pixmapItem;
|
||||||
|
GraphicsViewZoom* m_zoom;
|
||||||
|
|
||||||
explicit APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
explicit APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
||||||
virtual ~APTDemodGUI();
|
virtual ~APTDemodGUI();
|
||||||
@ -107,6 +113,10 @@ private slots:
|
|||||||
void on_showSettings_clicked();
|
void on_showSettings_clicked();
|
||||||
void on_resetDecoder_clicked();
|
void on_resetDecoder_clicked();
|
||||||
void on_saveImage_clicked();
|
void on_saveImage_clicked();
|
||||||
|
void on_zoomIn_clicked();
|
||||||
|
void on_zoomOut_clicked();
|
||||||
|
void on_zoomAll_clicked(bool checked=false);
|
||||||
|
void on_image_zoomed();
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||||
void onMenuDialogCalled(const QPoint& p);
|
void onMenuDialogCalled(const QPoint& p);
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
@ -356,6 +356,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="buttonLayout">
|
<layout class="QHBoxLayout" name="buttonLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ButtonSwitch" name="startStop">
|
<widget class="ButtonSwitch" name="startStop">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -372,7 +375,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="showSettings">
|
<widget class="QToolButton" name="showSettings">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Show settings dialog</string>
|
<string>Show settings dialog</string>
|
||||||
</property>
|
</property>
|
||||||
@ -386,7 +389,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="resetDecoder">
|
<widget class="QToolButton" name="resetDecoder">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Reset decoder (clears current image)</string>
|
<string>Reset decoder (clears current image)</string>
|
||||||
</property>
|
</property>
|
||||||
@ -400,7 +403,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="saveImage">
|
<widget class="QToolButton" name="saveImage">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Save image to disk</string>
|
<string>Save image to disk</string>
|
||||||
</property>
|
</property>
|
||||||
@ -413,6 +416,54 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="zoomIn">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Zoom in to image</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/zoomin.png</normaloff>:/zoomin.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="zoomOut">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Zoom out from image</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/zoomout.png</normaloff>:/zoomout.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ButtonSwitch" name="zoomAll">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Zoom image to fit window</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>^</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/zoomall.png</normaloff>:/zoomall.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -426,13 +477,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="channelsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Channels</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="channels">
|
<widget class="QComboBox" name="channels">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -645,25 +689,13 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ScaledImage" name="image">
|
<widget class="QGraphicsView" name="image">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>300</width>
|
<width>300</width>
|
||||||
<height>350</height>
|
<height>350</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -677,9 +709,10 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ButtonSwitch</class>
|
<class>ValueDialZ</class>
|
||||||
<extends>QToolButton</extends>
|
<extends>QWidget</extends>
|
||||||
<header>gui/buttonswitch.h</header>
|
<header>gui/valuedialz.h</header>
|
||||||
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>LevelMeterSignalDB</class>
|
<class>LevelMeterSignalDB</class>
|
||||||
@ -688,15 +721,9 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ValueDialZ</class>
|
<class>ButtonSwitch</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QToolButton</extends>
|
||||||
<header>gui/valuedialz.h</header>
|
<header>gui/buttonswitch.h</header>
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>ScaledImage</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>gui/scaledimage.h</header>
|
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -107,6 +107,7 @@
|
|||||||
<file>load.png</file>
|
<file>load.png</file>
|
||||||
<file>keyboard.png</file>
|
<file>keyboard.png</file>
|
||||||
<file>kill.png</file>
|
<file>kill.png</file>
|
||||||
|
<file>zoomall.png</file>
|
||||||
<file>zoomin.png</file>
|
<file>zoomin.png</file>
|
||||||
<file>zoomout.png</file>
|
<file>zoomout.png</file>
|
||||||
<file>LiberationMono-Regular.ttf</file>
|
<file>LiberationMono-Regular.ttf</file>
|
||||||
|
BIN
sdrgui/resources/zoomall.png
Normal file
BIN
sdrgui/resources/zoomall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 B |
Loading…
Reference in New Issue
Block a user