diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/common.h psi-0.10/src/common.h --- psi-0.10.vanilla/src/common.h 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/common.h 2006-01-23 21:12:46.000000000 +0100 @@ -151,6 +151,9 @@ int sizeOccList; bool jidComplete, grabUrls, noGCSound; +#ifdef Q_WS_X11 + bool useAudacious; +#endif QString pgp; diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/options/opt_advanced-ui.ui psi-0.10/src/options/opt_advanced-ui.ui --- psi-0.10.vanilla/src/options/opt_advanced-ui.ui 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/options/opt_advanced-ui.ui 2006-01-23 21:14:10.000000000 +0100 @@ -127,6 +127,14 @@ cb_incomingAs + + + ck_AudaciousStatus + + + Set status message to song title from Audacious + + diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/options/opt_advanced.cpp psi-0.10/src/options/opt_advanced.cpp --- psi-0.10.vanilla/src/options/opt_advanced.cpp 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/options/opt_advanced.cpp 2006-01-23 21:13:41.000000000 +0100 @@ -61,6 +61,15 @@ QWhatsThis::add(d->ck_ignoreHeadline, tr("Makes Psi ignore all incoming \"headline\" events," " like system-wide news on MSN, announcements, etc.")); +#ifndef Q_WS_X11 + QWhatsThis::add(d->ck_AudaciousStatus, tr("This option is available only for Linux.")); + d->ck_AudaciousStatus->setEnabled(FALSE); +#else + QWhatsThis::add(d->ck_AudaciousStatus, + tr("Makes Psi grab status message (only message is changed) from Audacious" + " - details of song that is currently played by it. tag" + "from current status is replaced with song details.")); +#endif return w; } @@ -82,6 +91,9 @@ opt->autoVersion = d->ck_autoVersion->isChecked(); opt->autoVCardOnLogin = d->ck_autoVCardOnLogin->isChecked(); opt->ignoreHeadline = d->ck_ignoreHeadline->isChecked(); +#ifdef Q_WS_X11 + opt->useAudacious = d->ck_AudaciousStatus->isChecked(); +#endif } void OptionsTabAdvanced::restoreOptions(const Options *opt) @@ -101,4 +113,7 @@ d->ck_autoVersion->setChecked( opt->autoVersion ); d->ck_autoVCardOnLogin->setChecked( opt->autoVCardOnLogin ); d->ck_ignoreHeadline->setChecked( opt->ignoreHeadline ); +#ifdef Q_WS_X11 + d->ck_AudaciousStatus->setChecked( opt->useAudacious ); +#endif } diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/psi_profiles.cpp psi-0.10/src/psi_profiles.cpp --- psi-0.10.vanilla/src/psi_profiles.cpp 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/psi_profiles.cpp 2006-01-23 21:14:46.000000000 +0100 @@ -417,6 +417,9 @@ prefs.chatBgImage = ""; prefs.rosterBgImage = ""; prefs.autoCopy = false; +#ifdef Q_WS_X11 + prefs.useAudacious = false; +#endif prefs.sp.clear(); prefs.sp.set(QObject::tr("Away from desk"), QObject::tr("I am away from my desk. Leave a message.")); @@ -908,6 +911,9 @@ p_misc.appendChild(textTag(doc, "lastPath", prefs.lastPath)); p_misc.appendChild(textTag(doc, "lastSavePath", prefs.lastSavePath)); p_misc.appendChild(textTag(doc, "autoCopy", prefs.autoCopy)); +#ifdef Q_WS_X11 + p_misc.appendChild(textTag(doc, "useAudacious", prefs.useAudacious)); +#endif } { QDomElement p_dock = doc.createElement("dock"); @@ -1787,6 +1793,9 @@ readEntry(tag, "lastPath", &prefs.lastPath); readEntry(tag, "lastSavePath", &prefs.lastSavePath); readBoolEntry(tag, "autoCopy", &prefs.autoCopy); +#ifdef Q_WS_X11 + readBoolEntry(tag, "useAudacious", &prefs.useAudacious); +#endif } tag = findSubTag(p_general, "dock", &found); diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/psicon.cpp psi-0.10/src/psicon.cpp --- psi-0.10.vanilla/src/psicon.cpp 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/psicon.cpp 2006-01-23 21:17:22.000000000 +0100 @@ -67,6 +67,10 @@ #include "mac_dock.h" #endif +#ifdef Q_WS_X11 +#include +#endif + //---------------------------------------------------------------------------- // PsiIconFactory //---------------------------------------------------------------------------- @@ -539,11 +543,25 @@ d->globalAccelManager->setAccel(option.globalAccels[1]); connect(d->globalAccelManager, SIGNAL(activated(int)), SLOT(accel_activated(int))); +#ifdef Q_WS_X11 + // Audacious timer: + audacious_timer = new QTimer(this, "audacious_timer"); + connect(audacious_timer, SIGNAL(timeout()), this, SLOT(doAudacious())); + audacious_timer->start(5000); // 5 seconds + audaciousUpdating = false; +#endif + return true; } void PsiCon::deinit() { +#ifdef Q_WS_X11 + // Delete timer for XMMS: + audacious_timer->stop(); + delete audacious_timer; +#endif + // this deletes all dialogs except for mainwin deleteAllDialogs(); @@ -582,6 +600,45 @@ d->saveProfile(acc); } +#ifdef Q_WS_X11 +void PsiCon::doAudacious() { + + if (option.useAudacious) { + + if (audaciousVanillaStatus.status().find("") == -1) + return; + + QString newStatus = audaciousVanillaStatus.status(); + + if (xmms_remote_is_running(0)) { + + QString songTitle = QString::fromUtf8(xmms_remote_get_playlist_title(0, xmms_remote_get_playlist_pos(0))); + newStatus = newStatus.replace("", songTitle); + + } else { + + newStatus = newStatus.replace("", ""); + + } + + Status st = audaciousLastStatus; + + // Status is changed only if diffrent from current + if (st.status() != newStatus) { + + st.setStatus(newStatus); + + audaciousUpdating = true; + setGlobalStatus(st); + audaciousUpdating = false; + + } + + } + +} +#endif + PsiAccount *PsiCon::loadAccount(const UserAccount &acc) { PsiAccount *pa = new PsiAccount(acc, this); @@ -993,6 +1050,12 @@ } } +#ifdef Q_WS_X11 + audaciousLastStatus = s; + if (!audaciousUpdating) + audaciousVanillaStatus = s; +#endif + // globally set each account which is logged in PsiAccountListIt it(d->listEnabled); for( ; (pa = it.current()); ++it) diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/psicon.h psi-0.10/src/psicon.h --- psi-0.10.vanilla/src/psicon.h 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/psicon.h 2006-01-23 21:18:06.000000000 +0100 @@ -149,6 +149,11 @@ void processEvent(PsiEvent *); QString lastStatusString; +#ifdef Q_WS_X11 + Status audaciousLastStatus; + Status audaciousVanillaStatus; + bool audaciousUpdating; +#endif signals: void quit(int); @@ -189,12 +194,18 @@ void accel_activated(int); void updateMainwinStatus(); void tabDying(TabDlg*); +#ifdef Q_WS_X11 + void doAudacious(); +#endif void mainWinGeomChanged(int x, int y, int w, int h); private: class Private; Private *d; +#ifdef Q_WS_X11 + QTimer *audacious_timer; +#endif PsiAccount *loadAccount(const UserAccount &); void loadAccounts(const UserAccountList &); diff --exclude=config.h --exclude='*.o' --exclude='*.moc' --exclude=conf.pri --exclude=conf.log --exclude=Makefile -Nru psi-0.10.vanilla/src/src.pro psi-0.10/src/src.pro --- psi-0.10.vanilla/src/src.pro 2006-01-15 01:23:30.000000000 +0100 +++ psi-0.10/src/src.pro 2006-01-23 21:12:01.000000000 +0100 @@ -62,6 +62,12 @@ } } +unix: { + # Audacious: + INCLUDEPATH += /usr/include/audacious /usr/include/glib-2.0 /usr/lib/glib-2.0/include /usr/include/gtk-2.0 /usr/lib/gtk-2.0/include /usr/include/atk-1.0 /usr/include/cairo /usr/include/pango-1.0 + LIBS += `pkg-config --libs audacious` +} + # IPv6 ? #DEFINES += NO_NDNS