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 000000000..3621a68da Binary files /dev/null and b/sdrbase/resources/film.png differ diff --git a/sdrbase/resources/film_reel.png b/sdrbase/resources/film_reel.png new file mode 100644 index 000000000..c4f50ab7f Binary files /dev/null and b/sdrbase/resources/film_reel.png differ diff --git a/sdrbase/resources/picture.png b/sdrbase/resources/picture.png new file mode 100644 index 000000000..a84d4d572 Binary files /dev/null and b/sdrbase/resources/picture.png differ diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index 50d65a8b5..1d0437d80 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -71,5 +71,8 @@ txon.png arrow_down.png arrow_up.png + film_reel.png + film.png + picture.png