2
/***************************************************************************
3
channelpropertiesdialogimpl.cpp
4
-------------------------------
5
begin : Sat Apr 10 2004
6
copyright : (C) 2004 by Dirk Ziegelmeier
8
***************************************************************************/
11
* This library is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Library General Public
13
* License as published by the Free Software Foundation; either
14
* version 2 of the License, or (at your option) any later version.
16
* This library is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* Library General Public License for more details.
21
* You should have received a copy of the GNU Library General Public License
22
* along with this library; see the file COPYING.LIB. If not, write to
23
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
24
* Boston, MA 02110-1301, USA.
29
#include <knuminput.h>
31
#include <qcheckbox.h>
33
#include <qcombobox.h>
34
#include <qlcdnumber.h>
35
#include <qlineedit.h>
36
#include <qpushbutton.h>
39
#include "channelpropertiesdialogimpl.h"
41
#include "sourcemanager.h"
44
ChannelPropertiesDialogImpl::ChannelPropertiesDialogImpl( Channel* channel,
50
: ChannelPropertiesDialog(parent, name, modal, fl),
54
_enabled->setChecked(_c->enabled());
55
_number->display(_c->number());
56
_name->setText(_c->name());
57
_freq->setValue(((double)_c->getChannelProperty("frequency").toULongLong())/1000);
58
_url->setText(_c->url());
59
_description->setText(_c->description());
60
_globalControls->setChecked(!_c->hasControls(_srcm->device()));
62
// add sources to listbox
63
_source->insertStringList(_srcm->sourcesFor(_srcm->device()));
64
// select current source
65
for (int i = 0; i < _source->count(); i++) {
66
if (_c->getChannelProperty("source").toString() == _source->text(i)) {
67
_source->setCurrentItem(i);
72
// add norms to listbox
73
_encoding->insertStringList(_srcm->encodingsFor(_srcm->device()));
74
// select current norm
75
for (int i = 0; i < _encoding->count(); i++) {
76
if (_c->getChannelProperty("encoding").toString() == _encoding->text(i)) {
77
_encoding->setCurrentItem(i);
82
connect(_freq, SIGNAL( valueChanged(double) ),
83
this, SLOT( freqChanged(double) ));
84
connect(_source, SIGNAL( activated(const QString&) ),
85
_srcm, SLOT( setSource(const QString&) ));
86
connect(_encoding, SIGNAL( activated(const QString&) ),
87
_srcm, SLOT( setEncoding(const QString&) ));
88
connect(_freqUp, SIGNAL( clicked() ),
89
this, SLOT( freqUp() ));
90
connect(_freqDown, SIGNAL( clicked() ),
91
this, SLOT( freqDown() ));
92
connect(_guess, SIGNAL( clicked() ),
93
this, SLOT( guessClicked() ));
96
ChannelPropertiesDialogImpl::~ChannelPropertiesDialogImpl()
100
void ChannelPropertiesDialogImpl::freqChanged(double f)
102
_srcm->setFrequency((long)(f*1000));
105
void ChannelPropertiesDialogImpl::freqUp()
107
_freq->setValue( QMIN(_freq->value()+0.25, 1000.0) );
110
void ChannelPropertiesDialogImpl::freqDown()
112
_freq->setValue( QMAX(_freq->value()-0.25, 0.0) );
115
void ChannelPropertiesDialogImpl::guessClicked()
117
_url->setText("http://www." + _name->text().remove(" ") + ".com");
120
void ChannelPropertiesDialogImpl::accept()
122
_c->updateValues( _name->text(), _c->number(), _enabled->isChecked() );
123
_c->setChannelProperty("frequency", (Q_ULLONG)(_freq->value()*1000));
124
_c->setChannelProperty("source", _source->currentText());
125
_c->setChannelProperty("encoding", _encoding->currentText());
126
_c->setDescription(_description->text());
127
_c->setURL(_url->text());
128
_c->setHasControls(_srcm->device(), !_globalControls->isChecked());
133
void ChannelPropertiesDialogImpl::reject()
139
#include "channelpropertiesdialogimpl.moc"