diff --exclude='*orig' -Naur psi-0.10-orig/src/common.h psi-0.10/src/common.h --- psi-0.10-orig/src/common.h 2006-01-14 23:01:14.000000000 +0000 +++ psi-0.10/src/common.h 2006-01-14 23:01:32.000000000 +0000 @@ -151,6 +151,7 @@ int sizeOccList; bool jidComplete, grabUrls, noGCSound; + bool useXmms; QString pgp; diff --exclude='*orig' -Naur psi-0.10-orig/src/options/opt_status.cpp psi-0.10/src/options/opt_status.cpp --- psi-0.10-orig/src/options/opt_status.cpp 2006-01-14 23:01:12.000000000 +0000 +++ psi-0.10/src/options/opt_status.cpp 2006-01-14 23:01:32.000000000 +0000 @@ -51,6 +51,12 @@ " This will disconnect you from the Jabber server."); QWhatsThis::add(d->ck_asOffline, s); QWhatsThis::add(d->sb_asOffline, s); + s = tr("Makes Psi grab status message (only message is changed) from Xmms" + " - details of song that is currently played by it."); + QWhatsThis::add(d->ck_XmmsStatus, s); +#ifndef Q_WS_X11 + d->ck_XmmsStatus->setEnabled(FALSE); +#endif QWhatsThis::add(d->te_asMessage, tr("Specifies an extended message to use if you allow Psi" @@ -115,6 +121,7 @@ opt->eaArMessage = d->te_eaArMessage->text(); // k opt->clLogStatus = d->ck_LogStatus->isChecked(); opt->clLogEmptyStatus = d->ck_LogEmptyStatus->isChecked(); + opt->useXmms = d->ck_XmmsStatus->isChecked(); opt->sp = o->sp; @@ -155,6 +162,7 @@ d->ck_LogStatus->setChecked( opt->clLogStatus ); d->ck_LogEmptyStatus->setEnabled( opt->clLogStatus ); d->ck_LogEmptyStatus->setChecked( opt->clLogEmptyStatus ); + d->ck_XmmsStatus->setChecked( opt->useXmms ); o->sp = opt->sp; d->lb_sp->clear(); diff --exclude='*orig' -Naur psi-0.10-orig/src/options/opt_status-ui.ui psi-0.10/src/options/opt_status-ui.ui --- psi-0.10-orig/src/options/opt_status-ui.ui 2006-01-14 23:01:12.000000000 +0000 +++ psi-0.10/src/options/opt_status-ui.ui 2006-01-14 23:01:32.000000000 +0000 @@ -141,6 +141,14 @@ Additionaly log empty status changes + + + ck_XmmsStatus + + + Set status message to song title from Xmms + + ck_asXa diff --exclude='*orig' -Naur psi-0.10-orig/src/psicon.cpp psi-0.10/src/psicon.cpp --- psi-0.10-orig/src/psicon.cpp 2006-01-14 23:01:13.000000000 +0000 +++ psi-0.10/src/psicon.cpp 2006-01-14 23:02:42.000000000 +0000 @@ -67,6 +67,11 @@ #include "mac_dock.h" #endif +#ifdef Q_WS_X11 +// Xmms: +#include +#endif + //---------------------------------------------------------------------------- // PsiIconFactory //---------------------------------------------------------------------------- @@ -533,6 +538,13 @@ connect(sw, SIGNAL(idleSleep()), this, SLOT(doSleep())); connect(sw, SIGNAL(wakeup()), this, SLOT(doWakeup())); +#ifdef Q_WS_X11 + // XMMS timer: + xmms_timer = new QTimer(this, "xmms_timer"); + connect(xmms_timer, SIGNAL(timeout()), this, SLOT(doXmms())); + xmms_timer->start(3000); // 3 seconds +#endif + // global accelerator manager d->globalAccelManager = new GlobalAccelManager; d->globalAccelManager->setAccel(option.globalAccels[0]); @@ -547,6 +559,12 @@ // this deletes all dialogs except for mainwin deleteAllDialogs(); + // Delete timer for XMMS: +#ifdef Q_WS_X11 + xmms_timer->stop(); + delete xmms_timer; +#endif + d->idle.stop(); // shut down all accounts @@ -582,6 +600,27 @@ d->saveProfile(acc); } +void PsiCon::doXmms() { + +#ifdef Q_WS_X11 + if (option.useXmms) { + + if (!xmms_remote_is_running(0)) + return; + + QString title = QString(xmms_remote_get_playlist_title(0, xmms_remote_get_playlist_pos(0))); + Status st = xmmsLastStatus; + // Status is changed only if diffrent from current + if (st.status() != title) { + st.setStatus(title); + setGlobalStatus(st); + } + + } +#endif + +} + PsiAccount *PsiCon::loadAccount(const UserAccount &acc) { PsiAccount *pa = new PsiAccount(acc, this); @@ -993,6 +1032,8 @@ } } + xmmsLastStatus = s; + // globally set each account which is logged in PsiAccountListIt it(d->listEnabled); for( ; (pa = it.current()); ++it) diff --exclude='*orig' -Naur psi-0.10-orig/src/psicon.h psi-0.10/src/psicon.h --- psi-0.10-orig/src/psicon.h 2006-01-14 23:01:13.000000000 +0000 +++ psi-0.10/src/psicon.h 2006-01-14 23:01:32.000000000 +0000 @@ -149,6 +149,7 @@ void processEvent(PsiEvent *); QString lastStatusString; + Status xmmsLastStatus; signals: void quit(int); @@ -189,12 +190,14 @@ void accel_activated(int); void updateMainwinStatus(); void tabDying(TabDlg*); + void doXmms(); void mainWinGeomChanged(int x, int y, int w, int h); private: class Private; Private *d; + QTimer *xmms_timer; PsiAccount *loadAccount(const UserAccount &); void loadAccounts(const UserAccountList &); diff --exclude='*orig' -Naur psi-0.10-orig/src/psi_profiles.cpp psi-0.10/src/psi_profiles.cpp --- psi-0.10-orig/src/psi_profiles.cpp 2006-01-14 23:01:14.000000000 +0000 +++ psi-0.10/src/psi_profiles.cpp 2006-01-14 23:01:32.000000000 +0000 @@ -417,6 +417,7 @@ prefs.chatBgImage = ""; prefs.rosterBgImage = ""; prefs.autoCopy = false; + prefs.useXmms = false; prefs.sp.clear(); prefs.sp.set(QObject::tr("Away from desk"), QObject::tr("I am away from my desk. Leave a message.")); @@ -908,6 +909,7 @@ p_misc.appendChild(textTag(doc, "lastPath", prefs.lastPath)); p_misc.appendChild(textTag(doc, "lastSavePath", prefs.lastSavePath)); p_misc.appendChild(textTag(doc, "autoCopy", prefs.autoCopy)); + p_misc.appendChild(textTag(doc, "useXmms", prefs.useXmms)); } { QDomElement p_dock = doc.createElement("dock"); @@ -1787,6 +1789,7 @@ readEntry(tag, "lastPath", &prefs.lastPath); readEntry(tag, "lastSavePath", &prefs.lastSavePath); readBoolEntry(tag, "autoCopy", &prefs.autoCopy); + readBoolEntry(tag, "useXmms", &prefs.useXmms); } tag = findSubTag(p_general, "dock", &found); diff --exclude='*orig' -Naur psi-0.10-orig/src/src.pro psi-0.10/src/src.pro --- psi-0.10-orig/src/src.pro 2006-01-14 23:01:12.000000000 +0000 +++ psi-0.10/src/src.pro 2006-01-14 23:01:32.000000000 +0000 @@ -62,6 +62,12 @@ } } +unix: { + # Xmms: + INCLUDEPATH += /usr/include/glib-1.2 /usr/lib/glib/include + LIBS += `xmms-config --libs` +} + # IPv6 ? #DEFINES += NO_NDNS