You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.1 KiB
103 lines
3.1 KiB
15 years ago
|
/***************************************************************************
|
||
|
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. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
|
||
14 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqspinbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
|
||
|
#include <math.h>
|
||
|
|
||
|
#include "include/radiostation-config.h"
|
||
|
#include "include/frequencyradiostation.h"
|
||
|
|
||
|
|
||
13 years ago
|
RadioStationConfig::RadioStationConfig(TQWidget *parent)
|
||
|
: TQWidget (parent)
|
||
15 years ago
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
RadioStationConfig::~RadioStationConfig()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
///////////////////////////////////////////////////////////////////////
|
||
|
|
||
13 years ago
|
UndefinedRadioStationConfig::UndefinedRadioStationConfig (TQWidget *parent)
|
||
|
: RadioStationConfig(parent)
|
||
15 years ago
|
{
|
||
14 years ago
|
new TQLabel (i18n("I don't know how to edit this station"), this);
|
||
15 years ago
|
}
|
||
|
|
||
|
UndefinedRadioStationConfig::~UndefinedRadioStationConfig()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void UndefinedRadioStationConfig::setStationData (const RadioStation &/*rs*/)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void UndefinedRadioStationConfig::storeStationData (RadioStation &/*rs*/)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
///////////////////////////////////////////////////////////////////////
|
||
|
|
||
13 years ago
|
FrequencyRadioStationConfig::FrequencyRadioStationConfig (TQWidget *parent)
|
||
|
: RadioStationConfig(parent)
|
||
15 years ago
|
{
|
||
14 years ago
|
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);
|
||
15 years ago
|
vl->addWidget (m_editFrequency);
|
||
14 years ago
|
hl->addItem(new TQSpacerItem (10, 1, TQSizePolicy::Expanding, TQSizePolicy::Fixed));
|
||
15 years ago
|
|
||
14 years ago
|
connect (m_editFrequency, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged(int)));
|
||
15 years ago
|
}
|
||
|
|
||
|
FrequencyRadioStationConfig::~FrequencyRadioStationConfig()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void FrequencyRadioStationConfig::setStationData (const RadioStation &x)
|
||
|
{
|
||
|
const FrequencyRadioStation *rs = dynamic_cast<const FrequencyRadioStation*>(&x);
|
||
|
if (rs) {
|
||
|
m_editFrequency->setValue((int)rint(rs->frequency() * 1000));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void FrequencyRadioStationConfig::storeStationData (RadioStation &x)
|
||
|
{
|
||
|
FrequencyRadioStation *rs = dynamic_cast<FrequencyRadioStation*>(&x);
|
||
|
if (rs) {
|
||
|
rs->setFrequency(0.001 * m_editFrequency->value());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void FrequencyRadioStationConfig::slotValueChanged(int /*i*/)
|
||
|
{
|
||
|
emit changed(this);
|
||
|
}
|
||
|
|
||
|
|
||
|
#include "radiostation-config.moc"
|