Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 79029 | Differences between
and this patch

Collapse All | Expand All

(-)kdelibs-3.4.0/arts/knotify/Makefile.am (-1 / +2 lines)
Lines 6-12 INCLUDES= -I$(top_srcdir)/arts/kde -I$(i Link Here
6
kde_module_LTLIBRARIES = knotify.la
6
kde_module_LTLIBRARIES = knotify.la
7
7
8
knotify_la_SOURCES	= knotify.cpp knotify.skel
8
knotify_la_SOURCES	= knotify.cpp knotify.skel
9
knotify_la_LIBADD	= -lsoundserver_idl -lqtmcop $(LIB_KDEUI) $(top_builddir)/arts/kde/libartskde.la
9
knotify_la_LIBADD	=
10
10
knotify_la_LDFLAGS = $(all_libraries) -module -avoid-version
11
knotify_la_LDFLAGS = $(all_libraries) -module -avoid-version
11
knotify_la_METASOURCES = AUTO
12
knotify_la_METASOURCES = AUTO
12
13
(-)kdelibs-3.4.0/arts/knotify/knotify.cpp (-2 / +37 lines)
Lines 26-49 Link Here
26
#include <sys/types.h>
26
#include <sys/types.h>
27
#include <sys/stat.h>
27
#include <sys/stat.h>
28
28
29
#include <config.h>
30
#ifndef WITHOUT_ARTS
29
// aRts headers
31
// aRts headers
30
#include <connect.h>
32
#include <connect.h>
31
#include <dispatcher.h>
33
#include <dispatcher.h>
32
#include <flowsystem.h>
34
#include <flowsystem.h>
33
#include <soundserver.h>
35
#include <soundserver.h>
36
#endif
34
37
35
// QT headers
38
// QT headers
36
#include <qfile.h>
39
#include <qfile.h>
37
#include <qfileinfo.h>
40
#include <qfileinfo.h>
41
#ifndef WITHOUT_ARTS
38
#include <qiomanager.h>
42
#include <qiomanager.h>
43
#endif
39
#include <qstringlist.h>
44
#include <qstringlist.h>
40
#include <qtextstream.h>
45
#include <qtextstream.h>
41
46
42
// KDE headers
47
// KDE headers
43
#include <dcopclient.h>
48
#include <dcopclient.h>
44
#include <kaboutdata.h>
49
#include <kaboutdata.h>
50
#ifndef WITHOUT_ARTS
45
#include <kartsdispatcher.h>
51
#include <kartsdispatcher.h>
46
#include <kartsserver.h>
52
#include <kartsserver.h>
53
#endif
47
#include <kcmdlineargs.h>
54
#include <kcmdlineargs.h>
48
#include <kconfig.h>
55
#include <kconfig.h>
49
#include <kdebug.h>
56
#include <kdebug.h>
Lines 53-60 Link Here
53
#include <kpassivepopup.h>
60
#include <kpassivepopup.h>
54
#include <kiconloader.h>
61
#include <kiconloader.h>
55
#include <kmacroexpander.h>
62
#include <kmacroexpander.h>
63
#ifndef WITHOUT_ARTS
56
#include <kplayobjectfactory.h>
64
#include <kplayobjectfactory.h>
57
#include <kaudiomanagerplay.h>
65
#include <kaudiomanagerplay.h>
66
#endif
58
#include <kprocess.h>
67
#include <kprocess.h>
59
#include <kstandarddirs.h>
68
#include <kstandarddirs.h>
60
#include <kuniqueapplication.h>
69
#include <kuniqueapplication.h>
Lines 73-94 public: Link Here
73
    QString externalPlayer;
82
    QString externalPlayer;
74
    KProcess *externalPlayerProc;
83
    KProcess *externalPlayerProc;
75
84
85
#ifndef WITHOUT_ARTS
76
    QPtrList<KDE::PlayObject> playObjects;
86
    QPtrList<KDE::PlayObject> playObjects;
77
    QMap<KDE::PlayObject*,int> playObjectEventMap;
87
    QMap<KDE::PlayObject*,int> playObjectEventMap;
88
#endif
78
    int externalPlayerEventId;
89
    int externalPlayerEventId;
79
90
80
    bool useExternal;
91
    bool useExternal;
81
    bool useArts;
92
    bool useArts;
82
    int volume;
93
    int volume;
83
    QTimer *playTimer;
94
    QTimer *playTimer;
95
#ifndef WITHOUT_ARTS
84
    KAudioManagerPlay *audioManager;
96
    KAudioManagerPlay *audioManager;
97
#endif
85
    bool inStartup;
98
    bool inStartup;
86
    QString startupEvents;
99
    QString startupEvents;
87
};
100
};
88
101
89
// Yes, it's ugly to put this here, but this facilitates the cautious startup
102
// Yes, it's ugly to put this here, but this facilitates the cautious startup
90
// procedure.
103
// procedure.
104
#ifndef WITHOUT_ARTS
91
KArtsServer *soundServer = 0;
105
KArtsServer *soundServer = 0;
106
#endif
92
107
93
extern "C"{
108
extern "C"{
94
109
Lines 159-170 KDE_EXPORT int kdemain(int argc, char ** Link Here
159
    config.writeEntry( "Use Arts", useArts );
174
    config.writeEntry( "Use Arts", useArts );
160
    config.sync();
175
    config.sync();
161
176
177
#ifndef WITHOUT_ARTS
162
    KArtsDispatcher *dispatcher = 0;
178
    KArtsDispatcher *dispatcher = 0;
163
    if ( useArts )
179
    if ( useArts )
164
    {
180
    {
165
        dispatcher = new KArtsDispatcher;
181
        dispatcher = new KArtsDispatcher;
166
        soundServer = new KArtsServer;
182
        soundServer = new KArtsServer;
167
    }
183
    }
184
#endif
168
185
169
    // ok, seemed to work.
186
    // ok, seemed to work.
170
    config.writeEntry("Arts Init", useArts );
187
    config.writeEntry("Arts Init", useArts );
Lines 190-199 KDE_EXPORT int kdemain(int argc, char ** Link Here
190
             == KMessageBox::No )
207
             == KMessageBox::No )
191
        {
208
        {
192
            useArts = false;
209
            useArts = false;
210
#ifndef WITHOUT_ARTS
193
            delete soundServer;
211
            delete soundServer;
194
            soundServer = 0L;
212
            soundServer = 0L;
195
            delete dispatcher;
213
            delete dispatcher;
196
            dispatcher = 0L;
214
            dispatcher = 0L;
215
#endif
197
        }
216
        }
198
    }
217
    }
199
218
Lines 214-221 KDE_EXPORT int kdemain(int argc, char ** Link Here
214
233
215
    int ret = app.exec();
234
    int ret = app.exec();
216
    delete notify;
235
    delete notify;
236
#ifndef WITHOUT_ARTS
217
    delete soundServer;
237
    delete soundServer;
218
    delete dispatcher;
238
    delete dispatcher;
239
#endif
219
    return ret;
240
    return ret;
220
}
241
}
221
}// end extern "C"
242
}// end extern "C"
Lines 228-241 KNotify::KNotify( bool useArts ) Link Here
228
    d->globalConfig = new KConfig("knotify.eventsrc", true, false);
249
    d->globalConfig = new KConfig("knotify.eventsrc", true, false);
229
    d->externalPlayerProc = 0;
250
    d->externalPlayerProc = 0;
230
    d->useArts = useArts;
251
    d->useArts = useArts;
252
#ifndef WITHOUT_ARTS
231
    d->playObjects.setAutoDelete(true);
253
    d->playObjects.setAutoDelete(true);
232
    d->audioManager = 0;
254
    d->audioManager = 0;
255
#endif
233
    d->inStartup = true;
256
    d->inStartup = true;
257
#ifndef WITHOUT_ARTS
234
    if( useArts )
258
    if( useArts )
235
    {
259
    {
236
        connect( soundServer, SIGNAL( restartedServer() ), this, SLOT( restartedArtsd() ) );
260
        connect( soundServer, SIGNAL( restartedServer() ), this, SLOT( restartedArtsd() ) );
237
        restartedArtsd(); //started allready need to initialize d->audioManager
261
        restartedArtsd(); //started allready need to initialize d->audioManager
238
    }
262
    }
263
#endif
239
264
240
    d->volume = 100;
265
    d->volume = 100;
241
266
Lines 248-259 KNotify::~KNotify() Link Here
248
{
273
{
249
    reconfigure();
274
    reconfigure();
250
275
276
#ifndef WITHOUT_ARTS
251
    d->playObjects.clear();
277
    d->playObjects.clear();
252
278
253
    delete d->globalEvents;
279
    delete d->globalEvents;
254
    delete d->globalConfig;
280
    delete d->globalConfig;
255
    delete d->externalPlayerProc;
281
    delete d->externalPlayerProc;
256
    delete d->audioManager;
282
    delete d->audioManager;
283
#endif
257
    delete d;
284
    delete d;
258
}
285
}
259
286
Lines 449-454 bool KNotify::notifyBySound( const QStri Link Here
449
            return false;
476
            return false;
450
        }
477
        }
451
478
479
#ifndef WITHOUT_ARTS
452
        // play sound finally
480
        // play sound finally
453
        while( d->playObjects.count()>5 )
481
        while( d->playObjects.count()>5 )
454
            abortFirstPlayObject();
482
            abortFirstPlayObject();
Lines 508-514 bool KNotify::notifyBySound( const QStri Link Here
508
        }
536
        }
509
        if ( !d->playTimer->isActive() )
537
        if ( !d->playTimer->isActive() )
510
            d->playTimer->start( 1000 );
538
            d->playTimer->start( 1000 );
511
539
#endif
512
        return true;
540
        return true;
513
541
514
    } else if(!d->externalPlayer.isEmpty()) {
542
    } else if(!d->externalPlayer.isEmpty()) {
Lines 663-668 void KNotify::setVolume( int volume ) Link Here
663
691
664
void KNotify::playTimeout()
692
void KNotify::playTimeout()
665
{
693
{
694
#ifndef WITHOUT_ARTS
666
    for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it;)
695
    for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it;)
667
    {
696
    {
668
        QPtrListIterator< KDE::PlayObject > current = it;
697
        QPtrListIterator< KDE::PlayObject > current = it;
Lines 680-695 void KNotify::playTimeout() Link Here
680
    }
709
    }
681
    if ( !d->playObjects.count() )
710
    if ( !d->playObjects.count() )
682
        d->playTimer->stop();
711
        d->playTimer->stop();
712
#endif
683
}
713
}
684
714
685
bool KNotify::isPlaying( const QString& soundFile ) const
715
bool KNotify::isPlaying( const QString& soundFile ) const
686
{
716
{
717
#ifndef WITHOUT_ARTS
687
    for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it; ++it)
718
    for ( QPtrListIterator< KDE::PlayObject > it(d->playObjects); *it; ++it)
688
    {
719
    {
689
        if ( (*it)->mediaName() == soundFile )
720
        if ( (*it)->mediaName() == soundFile )
690
            return true;
721
            return true;
691
    }
722
    }
692
723
#endif
693
    return false;
724
    return false;
694
}
725
}
695
726
Lines 701-706 void KNotify::slotPlayerProcessExited( K Link Here
701
732
702
void KNotify::abortFirstPlayObject()
733
void KNotify::abortFirstPlayObject()
703
{
734
{
735
#ifndef WITHOUT_ARTS
704
    QMap<KDE::PlayObject*,int>::Iterator it = d->playObjectEventMap.find( d->playObjects.getFirst() );
736
    QMap<KDE::PlayObject*,int>::Iterator it = d->playObjectEventMap.find( d->playObjects.getFirst() );
705
    if ( it != d->playObjectEventMap.end() )
737
    if ( it != d->playObjectEventMap.end() )
706
    {
738
    {
Lines 708-713 void KNotify::abortFirstPlayObject() Link Here
708
        d->playObjectEventMap.remove( it );
740
        d->playObjectEventMap.remove( it );
709
    }
741
    }
710
    d->playObjects.removeFirst();
742
    d->playObjects.removeFirst();
743
#endif
711
}
744
}
712
745
713
void KNotify::soundFinished( int eventId, PlayingFinishedStatus reason )
746
void KNotify::soundFinished( int eventId, PlayingFinishedStatus reason )
Lines 752-761 WId KNotify::checkWinId( const QString & Link Here
752
785
753
void KNotify::restartedArtsd()
786
void KNotify::restartedArtsd()
754
{
787
{
788
#ifndef WITHOUT_ARTS
755
    delete d->audioManager;
789
    delete d->audioManager;
756
    d->audioManager = new KAudioManagerPlay( soundServer );
790
    d->audioManager = new KAudioManagerPlay( soundServer );
757
    d->audioManager->setTitle( i18n( "KDE System Notifications" ) );
791
    d->audioManager->setTitle( i18n( "KDE System Notifications" ) );
758
    d->audioManager->setAutoRestoreID( "KNotify Aman Play" );
792
    d->audioManager->setAutoRestoreID( "KNotify Aman Play" );
793
#endif
759
}
794
}
760
795
761
void KNotify::sessionReady()
796
void KNotify::sessionReady()
(-)kdelibs-3.4.0/arts/knotify/knotify.h (+2 lines)
Lines 23-29 Link Here
23
#include <qobject.h>
23
#include <qobject.h>
24
#include <knotifyclient.h>
24
#include <knotifyclient.h>
25
#include <dcopobject.h>
25
#include <dcopobject.h>
26
#ifndef WITHOUT_ARTS
26
#include <soundserver.h>
27
#include <soundserver.h>
28
#endif
27
29
28
class KNotifyPrivate;
30
class KNotifyPrivate;
29
class KProcess;
31
class KProcess;

Return to bug 79029