1 /* This file is part of the KDE project
2 Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #include "anglewidget.h"
21 #include <QtGui/QHBoxLayout>
22 #include <QtGui/QVBoxLayout>
24 AngleWidget::AngleWidget(QWidget
*parent
)
25 : QWidget(parent
), m_iface(0)
27 setAttribute(Qt::WA_QuitOnClose
, false);
28 QVBoxLayout
*topLayout
= new QVBoxLayout(this);
30 QHBoxLayout
*hlayout
= new QHBoxLayout(this);
31 topLayout
->addLayout(hlayout
);
32 QLabel
*l
= new QLabel("current angle:", this);
33 m_currentAngle
= new QSpinBox(this);
34 hlayout
->addWidget(l
);
35 hlayout
->addWidget(m_currentAngle
);
36 l
->setBuddy(m_currentAngle
);
37 m_currentAngle
->setRange(1, 1);
39 hlayout
= new QHBoxLayout(this);
40 topLayout
->addLayout(hlayout
);
41 l
= new QLabel("available angles:", this);
42 m_availableAngles
= new QLabel("0", this);
43 hlayout
->addWidget(l
);
44 hlayout
->addWidget(m_availableAngles
);
47 AngleWidget::~AngleWidget()
51 void AngleWidget::setInterface(MediaController
*i
)
54 disconnect(m_iface
, 0, m_currentAngle
, 0);
55 disconnect(m_currentAngle
, 0, m_iface
, 0);
56 disconnect(m_iface
, 0, m_availableAngles
, 0);
60 connect(m_iface
, SIGNAL(availableAnglesChanged(int)), SLOT(availableAnglesChanged(int)));
61 connect(m_iface
, SIGNAL(availableAnglesChanged(int)), m_availableAngles
, SLOT(setNum(int)));
62 connect(m_iface
, SIGNAL(angleChanged(int)), m_currentAngle
, SLOT(setValue(int)));
63 connect(m_currentAngle
, SIGNAL(valueChanged(int)), m_iface
, SLOT(setCurrentAngle(int)));
67 void AngleWidget::availableAnglesChanged(int x
) { m_currentAngle
->setMaximum(x
); }