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();
|
||||
QString *satelliteName = aos->getSatelliteName();
|
||||
qDebug() << "APTDemod::webapiActionsPost - AOS " << *satelliteName;
|
||||
if (satelliteName != nullptr)
|
||||
{
|
||||
if (matchSatellite(*satelliteName))
|
||||
@ -617,6 +618,7 @@ int APTDemod::webapiActionsPost(
|
||||
{
|
||||
SWGSDRangel::SWGAPTDemodActions_los* los = swgAPTDemodActions->getLos();
|
||||
QString *satelliteName = los->getSatelliteName();
|
||||
qDebug() << "APTDemod::webapiActionsPost - LOS " << *satelliteName;
|
||||
|
||||
if (satelliteName != nullptr)
|
||||
{
|
||||
|
@ -25,9 +25,10 @@
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QFileDialog>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
#include "aptdemodgui.h"
|
||||
#include "util/ax25.h"
|
||||
|
||||
#include "device/deviceuiset.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@ -42,6 +43,7 @@
|
||||
#include "gui/devicestreamselectiondialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "gui/crightclickenabler.h"
|
||||
#include "gui/graphicsviewzoom.h"
|
||||
#include "channel/channelwebapiutils.h"
|
||||
#include "maincore.h"
|
||||
|
||||
@ -101,7 +103,20 @@ bool APTDemodGUI::handleMessage(const Message& message)
|
||||
const APTDemod::MsgImage& imageMsg = (APTDemod::MsgImage&) message;
|
||||
m_image = imageMsg.getImage();
|
||||
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();
|
||||
if (imageTypes.size() == 0)
|
||||
{
|
||||
@ -171,7 +186,19 @@ bool APTDemodGUI::handleMessage(const Message& message)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -302,7 +329,9 @@ void APTDemodGUI::on_startStop_clicked(bool checked)
|
||||
|
||||
void APTDemodGUI::on_resetDecoder_clicked()
|
||||
{
|
||||
ui->image->setPixmap(QPixmap());
|
||||
if (m_pixmapItem != nullptr) {
|
||||
m_pixmapItem->setPixmap(QPixmap());
|
||||
}
|
||||
ui->imageContainer->setWindowTitle("Received image");
|
||||
// Send message to reset decoder
|
||||
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) widget;
|
||||
@ -389,7 +442,9 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_channelMarker(this),
|
||||
m_doApplySettings(true),
|
||||
m_tickCount(0)
|
||||
m_tickCount(0),
|
||||
m_scene(nullptr),
|
||||
m_pixmapItem(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -425,6 +480,13 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||
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();
|
||||
applySettings(true);
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ class DeviceUISet;
|
||||
class BasebandSampleSink;
|
||||
class APTDemod;
|
||||
class APTDemodGUI;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsPixmapItem;
|
||||
class GraphicsViewZoom;
|
||||
|
||||
namespace Ui {
|
||||
class APTDemodGUI;
|
||||
@ -79,6 +82,9 @@ private:
|
||||
|
||||
QImage m_image;
|
||||
QPixmap m_pixmap;
|
||||
QGraphicsScene* m_scene;
|
||||
QGraphicsPixmapItem* m_pixmapItem;
|
||||
GraphicsViewZoom* m_zoom;
|
||||
|
||||
explicit APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
||||
virtual ~APTDemodGUI();
|
||||
@ -107,6 +113,10 @@ private slots:
|
||||
void on_showSettings_clicked();
|
||||
void on_resetDecoder_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 onMenuDialogCalled(const QPoint& p);
|
||||
void handleInputMessages();
|
||||
|
@ -356,6 +356,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
@ -372,7 +375,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="showSettings">
|
||||
<widget class="QToolButton" name="showSettings">
|
||||
<property name="toolTip">
|
||||
<string>Show settings dialog</string>
|
||||
</property>
|
||||
@ -386,7 +389,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetDecoder">
|
||||
<widget class="QToolButton" name="resetDecoder">
|
||||
<property name="toolTip">
|
||||
<string>Reset decoder (clears current image)</string>
|
||||
</property>
|
||||
@ -400,7 +403,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveImage">
|
||||
<widget class="QToolButton" name="saveImage">
|
||||
<property name="toolTip">
|
||||
<string>Save image to disk</string>
|
||||
</property>
|
||||
@ -413,6 +416,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
@ -426,13 +477,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelsLabel">
|
||||
<property name="text">
|
||||
<string>Channels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="channels">
|
||||
<property name="minimumSize">
|
||||
@ -645,25 +689,13 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ScaledImage" name="image">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QGraphicsView" name="image">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>350</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -677,9 +709,10 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LevelMeterSignalDB</class>
|
||||
@ -688,15 +721,9 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ScaledImage</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/scaledimage.h</header>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -107,6 +107,7 @@
|
||||
<file>load.png</file>
|
||||
<file>keyboard.png</file>
|
||||
<file>kill.png</file>
|
||||
<file>zoomall.png</file>
|
||||
<file>zoomin.png</file>
|
||||
<file>zoomout.png</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