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.
27
#include <kglobalaccel.h>
29
#include <knotification.h>
31
#include "gui/guiprofile.h"
32
#include "mdwslider.h"
33
#include "gui/mixdevicewidget.h"
34
#include "core/mixdevice.h"
35
#include "core/mixer.h"
38
#include "gui/kmixtoolbox.h"
40
/***********************************************************************************
41
KMixToolbox contains several GUI relevant methods that are shared between the
42
KMix Main Program, and the KMix Applet.
43
kmixctrl - as not non-GUI application - does NOT link to KMixToolBox.
45
This means: Shared GUI stuff goes into the KMixToolBox class , non-GUI stuff goes
46
into the MixerToolBox class.
47
***********************************************************************************/
48
void KMixToolBox::setIcons(QList<QWidget *> &mdws, bool on ) {
49
for (int i=0; i < mdws.count(); ++i ){
50
QWidget *mdw = mdws[i];
51
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
52
static_cast<MixDeviceWidget*>(mdw)->setIcons( on );
57
void KMixToolBox::setLabels(QList<QWidget *> &mdws, bool on ) {
58
for (int i=0; i < mdws.count(); ++i ){
59
QWidget *mdw = mdws[i];
60
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
61
static_cast<MixDeviceWidget*>(mdw)->setLabeled( on );
66
void KMixToolBox::setTicks(QList<QWidget *> &mdws, bool on ) {
67
for (int i=0; i < mdws.count(); ++i ){
68
QWidget *mdw = mdws[i];
69
if ( mdw->inherits("MixDeviceWidget") ) { // -<- play safe here
70
static_cast<MixDeviceWidget*>(mdw)->setTicks( on );
75
void KMixToolBox::notification(const char *notificationName, const QString &text,
76
const QStringList &actions, QObject *receiver,
77
const char *actionSlot)
79
KNotification *notification = new KNotification(notificationName);
80
//notification->setComponentData(componentData());
81
notification->setText(text);
82
//notification->setPixmap(...);
83
notification->addContext(QLatin1String("Application"), KGlobal::mainComponent().componentName());
84
if (!actions.isEmpty() && receiver && actionSlot) {
85
notification->setActions(actions);
86
QObject::connect(notification, SIGNAL(activated(unsigned int)), receiver, actionSlot);
88
notification->sendEvent();