From 806b955110b1fe97f5e9d7b3af0e7d0ba898e2a3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 8 Mar 2017 01:35:18 +0100 Subject: [PATCH] ATV Modulator: added image file dialog --- plugins/channeltx/modatv/atvmod.cpp | 8 +++++ plugins/channeltx/modatv/atvmod.h | 25 ++++++++++++++- plugins/channeltx/modatv/atvmodgui.cpp | 20 ++++++++++++ plugins/channeltx/modatv/atvmodgui.h | 4 ++- plugins/channeltx/modatv/atvmodgui.ui | 41 ++++++++++++++++++++++--- sdrbase/resources/film.png | Bin 0 -> 378 bytes sdrbase/resources/film_reel.png | Bin 0 -> 888 bytes sdrbase/resources/picture.png | Bin 0 -> 408 bytes sdrbase/resources/res.qrc | 3 ++ 9 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 sdrbase/resources/film.png create mode 100644 sdrbase/resources/film_reel.png create mode 100644 sdrbase/resources/picture.png diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 088ae8b6f..75e8847d4 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -20,6 +20,7 @@ #include "atvmod.h" MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureATVMod, Message) +MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureImageFileName, Message) const float ATVMod::m_blackLevel = 0.3f; const float ATVMod::m_spanLevel = 0.7f; @@ -242,6 +243,13 @@ bool ATVMod::handleMessage(const Message& cmd) return true; } + else if (MsgConfigureImageFileName::match(cmd)) + { + MsgConfigureImageFileName& conf = (MsgConfigureImageFileName&) cmd; +// m_fileName = conf.getFileName(); // TODO +// openFileStream(); + return true; + } else { return false; diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index b7b8c8e99..27a23063e 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -45,7 +45,9 @@ public: ATVModInputVBars, ATVModInputCheckbox, ATVModInputHGradient, - ATVModInputVGradient + ATVModInputVGradient, + ATVModInputImage, + ATVModInputVideo } ATVModInput; typedef enum @@ -54,6 +56,27 @@ public: ATVModulationFM } ATVModulation; + class MsgConfigureImageFileName : public Message + { + MESSAGE_CLASS_DECLARATION + + public: + const QString& getFileName() const { return m_fileName; } + + static MsgConfigureImageFileName* create(const QString& fileName) + { + return new MsgConfigureImageFileName(fileName); + } + + private: + QString m_fileName; + + MsgConfigureImageFileName(const QString& fileName) : + Message(), + m_fileName(fileName) + { } + }; + ATVMod(); ~ATVMod(); diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index db304b742..42b963d64 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -227,6 +227,26 @@ void ATVModGUI::on_channelMute_toggled(bool checked) applySettings(); } +void ATVModGUI::on_imageFileDialog_clicked(bool checked) +{ + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open image file"), ".", tr("Image Files (*.png *.jpg *.bmp)")); + + if (fileName != "") + { + m_imageFileName = fileName; + ui->recordFileText->setText(m_imageFileName); + configureImageFileName(); + } +} + +void ATVModGUI::configureImageFileName() +{ + qDebug() << "ATVModGUI::configureImageFileName: " << m_imageFileName.toStdString().c_str(); + ATVMod::MsgConfigureImageFileName* message = ATVMod::MsgConfigureImageFileName::create(m_imageFileName); + m_atvMod->getInputMessageQueue()->push(message); +} + void ATVModGUI::onWidgetRolled(QWidget* widget, bool rollDown) { } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 57d3beae0..48138becc 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -66,10 +66,12 @@ private slots: void on_inputSelect_currentIndexChanged(int index); void on_volume_valueChanged(int value); void on_channelMute_toggled(bool checked); + void on_imageFileDialog_clicked(bool checked); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); + void configureImageFileName(); void tick(); private: @@ -85,7 +87,7 @@ private: ATVMod* m_atvMod; MovingAverage m_channelPowerDbAvg; - QString m_fileName; + QString m_imageFileName; quint32 m_recordLength; int m_recordSampleRate; int m_samplesCount; diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index b595d9e01..643b2274e 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -372,7 +372,7 @@ - Chekbox + Chekbd @@ -474,7 +474,7 @@ - + 24 @@ -488,14 +488,47 @@ - Open record file (48 kHz 32 bit float LE mono) + Open still image file - :/preset-load.png:/preset-load.png + :/picture.png:/picture.png + + + + + + + Qt::Vertical + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Open video file + + + + + + + :/film_reel.png:/film_reel.png diff --git a/sdrbase/resources/film.png b/sdrbase/resources/film.png new file mode 100644 index 0000000000000000000000000000000000000000..3621a68daf0d469914c82315b8584a6693627ada GIT binary patch literal 378 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBixcc5xY{hetaXF)%Q)d%8G=cpSew)zI&7fPl+=77x)# z8HU2fEhU!DdJQql9;%#lbvkG(#MwDZ?g-CB_KQb**Inv;&*FWps#`XWD z{_*C#4yd_OQ=c&P=-!D%VWlz2S5_2q=P)~8|blE3*nn{3&RO)AUf@=A~jFz}Tr>3wNrumxX;JQ6gzL5~S{N-7 zK{rK<76lN@qpao0;lM(S#9@f{%W*rz2 zZFP-03Ty$^0jq!|zzyK4`aN(eB0kQD7S%GKw$x@d65FkgtA9HySJW}}uL8TOzNZe= z*-~577(c9DD~xp2Z`HNxpn5=^>{&mrK3Y*$8CRS17~iK}cdpz~-zXv;Qa|%S|yx=RX6dfob3=;Alj2=j5UA{z!WAq542#n-aUN z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