2
* KMix -- KDE's full featured mini mixer
5
* Copyright (C) 2004 Christian Esken <esken@kde.org>
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this program; if not, write to the Free
19
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
#include "gui/kmixtoolbox.h"
28
#include <kglobalaccel.h>
30
#include <knotification.h>
32
#include "gui/guiprofile.h"
33
#include "mdwslider.h"
34
#include "gui/mixdevicewidget.h"
35
#include "core/mixdevice.h"
36
#include "core/mixer.h"
39
// TODO KMixToolbox is rather superfluous today, as there is no "KMix Applet" any more, and it was probably always bad style.
40
// I only have to think what to do with KMixToolBox::notification()
42
/***********************************************************************************
43
KMixToolbox contains several GUI relevant methods that are shared between the
44
KMix Main Program, and the KMix Applet.
45
kmixctrl - as not non-GUI application - does NOT link to KMixToolBox.
47
This means: Shared GUI stuff goes into the KMixToolBox class , non-GUI stuff goes
48
into the MixerToolBox class.
49
***********************************************************************************/
50
void KMixToolBox::setIcons(QList<QWidget *> &mdws, bool on ) {
51
for (int i=0; i < mdws.count(); ++i ){
52
QWidget *mdw = mdws[i];
53
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
54
static_cast<MixDeviceWidget*>(mdw)->setIcons( on );
59
void KMixToolBox::setLabels(QList<QWidget *> &mdws, bool on ) {
60
for (int i=0; i < mdws.count(); ++i ){
61
QWidget *mdw = mdws[i];
62
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
63
static_cast<MixDeviceWidget*>(mdw)->setLabeled( on );
68
void KMixToolBox::setTicks(QList<QWidget *> &mdws, bool on ) {
69
for (int i=0; i < mdws.count(); ++i ){
70
QWidget *mdw = mdws[i];
71
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
72
static_cast<MixDeviceWidget*>(mdw)->setTicks( on );
77
void KMixToolBox::notification(const char *notificationName, const QString &text,
78
const QStringList &actions, QObject *receiver,
79
const char *actionSlot)
81
KNotification *notification = new KNotification(notificationName);
82
//notification->setComponentData(componentData());
83
notification->setText(text);
84
//notification->setPixmap(...);
85
notification->addContext(QLatin1String("Application"), KGlobal::mainComponent().componentName());
86
if (!actions.isEmpty() && receiver && actionSlot) {
87
notification->setActions(actions);
88
QObject::connect(notification, SIGNAL(activated(uint)), receiver, actionSlot);
90
notification->sendEvent();