From 9d7329284fd42187092c829ae6ed030561002776 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 30 May 2022 19:40:31 +0900 Subject: Standardize folder structure. Signed-off-by: Michele Calgaro (cherry picked from commit d95a4fea540b371fa86493d069fdbd54f33c5b40) --- src/radiostation-config.cpp | 102 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/radiostation-config.cpp (limited to 'src/radiostation-config.cpp') diff --git a/src/radiostation-config.cpp b/src/radiostation-config.cpp new file mode 100644 index 0000000..52a692e --- /dev/null +++ b/src/radiostation-config.cpp @@ -0,0 +1,102 @@ +/*************************************************************************** + radiostation-config.cpp - description + ------------------- + begin : Sa Aug 16 2003 + copyright : (C) 2003 by Martin Witte + email : witte@kawo1.rwth-aachen.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "include/radiostation-config.h" +#include "include/frequencyradiostation.h" + + +RadioStationConfig::RadioStationConfig(TQWidget *parent) + : TQWidget (parent) +{ + +} + +RadioStationConfig::~RadioStationConfig() +{ +} + + +/////////////////////////////////////////////////////////////////////// + +UndefinedRadioStationConfig::UndefinedRadioStationConfig (TQWidget *parent) + : RadioStationConfig(parent) +{ + new TQLabel (i18n("I don't know how to edit this station"), this); +} + +UndefinedRadioStationConfig::~UndefinedRadioStationConfig() +{ +} + +void UndefinedRadioStationConfig::setStationData (const RadioStation &/*rs*/) +{ +} + +void UndefinedRadioStationConfig::storeStationData (RadioStation &/*rs*/) +{ +} + + +/////////////////////////////////////////////////////////////////////// + +FrequencyRadioStationConfig::FrequencyRadioStationConfig (TQWidget *parent) + : RadioStationConfig(parent) +{ + TQHBoxLayout *hl = new TQHBoxLayout(this); + TQVBoxLayout *vl = new TQVBoxLayout(hl); + vl->addWidget (new TQLabel(i18n("Frequency:"), this)); + m_editFrequency = new TQSpinBox(20, 150000, 10, this); + vl->addWidget (m_editFrequency); + hl->addItem(new TQSpacerItem (10, 1, TQSizePolicy::Expanding, TQSizePolicy::Fixed)); + + connect (m_editFrequency, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged(int))); +} + +FrequencyRadioStationConfig::~FrequencyRadioStationConfig() +{ +} + +void FrequencyRadioStationConfig::setStationData (const RadioStation &x) +{ + const FrequencyRadioStation *rs = dynamic_cast(&x); + if (rs) { + m_editFrequency->setValue((int)rint(rs->frequency() * 1000)); + } +} + +void FrequencyRadioStationConfig::storeStationData (RadioStation &x) +{ + FrequencyRadioStation *rs = dynamic_cast(&x); + if (rs) { + rs->setFrequency(0.001 * m_editFrequency->value()); + } +} + +void FrequencyRadioStationConfig::slotValueChanged(int /*i*/) +{ + emit changed(this); +} + + +#include "radiostation-config.moc" -- cgit v1.2.3