1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

ATV modulator: pass text overlay switch in settings

This commit is contained in:
f4exb 2018-04-15 01:34:46 +02:00
parent b21ea9ab2f
commit 875cf59fda
5 changed files with 26 additions and 51 deletions

View File

@ -43,7 +43,6 @@ MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraIndex, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraData, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportCameraData, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureOverlayText, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureShowOverlayText, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportEffectiveSampleRate, Message)
const QString ATVMod::m_channelIdURI = "sdrangel.channeltx.modatv";
@ -73,7 +72,7 @@ ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
m_videoEOF(false),
m_videoOK(false),
m_cameraIndex(-1),
m_showOverlayText(false),
//m_showOverlayText(false),
m_SSBFilter(0),
m_SSBFilterBuffer(0),
m_SSBFilterBufferIndex(0),
@ -325,7 +324,7 @@ void ATVMod::pullVideo(Real& sample)
if (!colorFrame.empty()) // some frames may not come out properly
{
if (m_showOverlayText) {
if (m_settings.m_showOverlayText) {
mixImageAndText(colorFrame);
}
@ -445,7 +444,7 @@ void ATVMod::pullVideo(Real& sample)
if (!colorFrame.empty()) // some frames may not come out properly
{
if (m_showOverlayText) {
if (m_settings.m_showOverlayText) {
mixImageAndText(colorFrame);
}
@ -620,28 +619,6 @@ bool ATVMod::handleMessage(const Message& cmd)
m_overlayText = cfg.getOverlayText().toStdString();
return true;
}
else if (MsgConfigureShowOverlayText::match(cmd))
{
MsgConfigureShowOverlayText& cfg = (MsgConfigureShowOverlayText&) cmd;
bool showOverlayText = cfg.getShowOverlayText();
if (!m_imageFromFile.empty())
{
m_imageFromFile.copyTo(m_imageOriginal);
if (showOverlayText) {
qDebug("ATVMod::handleMessage: overlay text");
mixImageAndText(m_imageOriginal);
} else{
qDebug("ATVMod::handleMessage: clear text");
}
resizeImage();
}
m_showOverlayText = showOverlayText;
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
@ -825,7 +802,7 @@ void ATVMod::openImage(const QString& fileName)
{
m_imageFromFile.copyTo(m_imageOriginal);
if (m_showOverlayText) {
if (m_settings.m_showOverlayText) {
mixImageAndText(m_imageOriginal);
}
@ -1106,6 +1083,7 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
<< " m_rfScalingFactor: " << settings.m_rfScalingFactor
<< " m_fmExcursion: " << settings.m_fmExcursion
<< " m_forceDecimator: " << settings.m_forceDecimator
<< " m_showOverlayText: " << settings.m_showOverlayText
<< " force: " << force;
if ((settings.m_atvStd != m_settings.m_atvStd)
@ -1158,6 +1136,23 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
m_settingsMutex.unlock();
}
if ((settings.m_showOverlayText != m_settings.m_showOverlayText) || force)
{
if (!m_imageFromFile.empty())
{
m_imageFromFile.copyTo(m_imageOriginal);
if (settings.m_showOverlayText) {
qDebug("ATVMod::applySettings: set overlay text");
mixImageAndText(m_imageOriginal);
} else{
qDebug("ATVMod::applySettings: clear overlay text");
}
resizeImage();
}
}
m_settings = settings;
}

View File

@ -345,27 +345,6 @@ public:
{ }
};
class MsgConfigureShowOverlayText : public Message
{
MESSAGE_CLASS_DECLARATION
public:
bool getShowOverlayText() const { return m_showOverlayText; }
static MsgConfigureShowOverlayText* create(bool showOverlayText)
{
return new MsgConfigureShowOverlayText(showOverlayText);
}
private:
bool m_showOverlayText;
MsgConfigureShowOverlayText(bool showOverlayText) :
Message(),
m_showOverlayText(showOverlayText)
{ }
};
class MsgReportEffectiveSampleRate : public Message
{
MESSAGE_CLASS_DECLARATION
@ -555,7 +534,6 @@ private:
int m_cameraIndex; //!< curent camera index in list of available cameras
std::string m_overlayText;
bool m_showOverlayText;
// Used for standard SSB
fftfilt* m_SSBFilter;

View File

@ -563,8 +563,8 @@ void ATVModGUI::on_cameraManualFPS_valueChanged(int value)
void ATVModGUI::on_overlayTextShow_toggled(bool checked)
{
ATVMod::MsgConfigureShowOverlayText* message = ATVMod::MsgConfigureShowOverlayText::create(checked);
m_atvMod->getInputMessageQueue()->push(message);
m_settings.m_showOverlayText = checked;
applySettings();
}
void ATVModGUI::on_overlayText_textEdited(const QString& arg1 __attribute__((unused)))

View File

@ -46,6 +46,7 @@ void ATVModSettings::resetToDefaults()
m_rfScalingFactor = 0.891235351562f * SDR_TX_SCALEF; // -1dB
m_fmExcursion = 0.5f; // half bandwidth
m_forceDecimator = false;
m_showOverlayText = false;
m_overlayText = "ATV";
m_rgbColor = QColor(255, 255, 255).rgb();
m_title = "ATV Modulator";

View File

@ -75,6 +75,7 @@ struct ATVModSettings
float m_rfScalingFactor; //!< Scaling factor from +/-1 to +/-2^15
float m_fmExcursion; //!< FM excursion factor relative to full bandwidth
bool m_forceDecimator; //!< Forces decimator even when channel and source sample rates are equal
bool m_showOverlayText; //!< Show overlay text on image
QString m_overlayText;
quint32 m_rgbColor;
QString m_title;