This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
amarokFS/amarokFS-0.4.2-start_amarok.patch

65 lines
1.9 KiB
Diff

diff -uNr amarokFS-qt3-0.4.2/amfs-xml.cpp amarokFS-qt3-0.4.2-mod/amfs-xml.cpp
--- amarokFS-qt3-0.4.2/amfs-xml.cpp 2007-02-11 18:57:18.000000000 +0200
+++ amarokFS-qt3-0.4.2-mod/amfs-xml.cpp 2007-02-11 22:06:06.000000000 +0200
@@ -14,6 +14,7 @@
#include <qmessagebox.h>
#include <qerrormessage.h>
#include <qregexp.h>
+#include <qprocess.h>
using namespace std;
@@ -21,7 +22,7 @@
AmfsXML::AmfsXML( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ) {
-
+ startedAmarok = false;
progressBar = (QProgressBar *) 0;
cdcover = (QLabel *) 0;
gradient = (QLabel *) 0;
@@ -339,6 +340,20 @@
connect( setupButton, SIGNAL(clicked()), this, SLOT(launchConfig()) );
+ //start Amarok (if necessary)
+ if (!dcopClient->isApplicationRegistered("amarok")) {
+ QProcess *amarokProc = new QProcess(QString("amarok"));
+ if (!amarokProc->launch(QString::null)) {
+ qDebug("error starting Amarok.");
+ } else {
+ while (!dcopClient->isApplicationRegistered("amarok"))
+ qApp->processEvents();
+ usleep(100);
+ startedAmarok = true;
+ }
+ delete amarokProc;
+ }
+
setMouseTracking(TRUE);
nowPlaying = "";
@@ -362,6 +377,11 @@
{
//restore the screen saver if it was disabled
if(isSetDisScrSvr) restoreScreenSaver();
+ //stop Amarok (if it was started by AmarokFS)
+ if (startedAmarok) {
+ if (!dcopClient->send("amarok", "MainApplication-Interface", "quit()", (QByteArray) 0))
+ qDebug("there was some error using DCOP.");
+ }
ce->accept();
return;
}
diff -uNr amarokFS-qt3-0.4.2/amfs-xml.h amarokFS-qt3-0.4.2-mod/amfs-xml.h
--- amarokFS-qt3-0.4.2/amfs-xml.h 2007-02-11 18:57:18.000000000 +0200
+++ amarokFS-qt3-0.4.2-mod/amfs-xml.h 2007-02-11 21:27:00.000000000 +0200
@@ -39,6 +39,8 @@
AKControlButton *cb;
QLabel *b;
QPushButton* pushButton1;
+ //stores whether Amarok was started by AmarokFS (true) or by the user
+ bool startedAmarok;
private:
QString getDCOPDataText(QCString func);