~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/gui/kmixtoolbox.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * KMix -- KDE's full featured mini mixer
 
3
 *
 
4
 *
 
5
 * Copyright (C) 2004 Christian Esken <esken@kde.org>
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 */
 
21
 
 
22
 
 
23
#include <QWidget>
 
24
#include <QString>
 
25
 
 
26
//#include <kdebug.h>
 
27
#include <kglobalaccel.h>
 
28
#include <klocale.h>
 
29
#include <knotification.h>
 
30
 
 
31
#include "gui/guiprofile.h"
 
32
#include "mdwslider.h"
 
33
#include "gui/mixdevicewidget.h"
 
34
#include "core/mixdevice.h"
 
35
#include "core/mixer.h"
 
36
#include "viewbase.h"
 
37
 
 
38
#include "gui/kmixtoolbox.h"
 
39
 
 
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.
 
44
 
 
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 );
 
53
      }
 
54
   }
 
55
}
 
56
 
 
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 );
 
62
      }
 
63
   }
 
64
}
 
65
 
 
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 );
 
71
      }
 
72
   }
 
73
}
 
74
 
 
75
void KMixToolBox::notification(const char *notificationName, const QString &text,
 
76
                                const QStringList &actions, QObject *receiver,
 
77
                                const char *actionSlot)
 
78
{
 
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);
 
87
    }
 
88
    notification->sendEvent();
 
89
}