File indexing completed on 2024-05-19 04:50:21

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Casey Link <unnamedrambler@gmail.com>                             *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef MP3TUNESHARMONYHANDLER_H
0018 #define MP3TUNESHARMONYHANDLER_H
0019 
0020 #include "harmonydaemon/Mp3tunesHarmonyDownload.h"
0021 #include "AmarokProcess.h"
0022 
0023 #include <QObject>
0024 #include <QString>
0025 #include <QMap>
0026 
0027 
0028 class Mp3tunesHarmonyHandler : public QObject {
0029     Q_OBJECT
0030     Q_CLASSINFO("Amarok Harmony D-Bus Interface", "org.kde.amarok.Mp3tunesHarmonyHandler")
0031     public:
0032         explicit Mp3tunesHarmonyHandler( QString identifier,
0033                                          QString email = QString(),
0034                                          QString pin  = QString() );
0035         ~Mp3tunesHarmonyHandler();
0036 
0037         bool startDaemon();
0038         void stopDaemon();
0039         bool daemonRunning();
0040         bool daemonConnected();
0041         void makeConnection();
0042         void breakConnection();
0043         QString pin();
0044         QString email();
0045 
0046     Q_SIGNALS:
0047       void waitingForEmail( const QString &pin );
0048       void waitingForPin();
0049       void connected();
0050       void disconnected();
0051       void signalError( const QString &error );
0052       void downloadReady( const QVariantMap &download );
0053       void downloadPending( const QVariantMap &download );
0054 
0055     public Q_SLOTS:
0056         virtual void emitError( const QString &error );
0057         virtual void emitWaitingForEmail( const QString &pin );
0058         virtual void emitWaitingForPin();
0059         virtual void emitConnected();
0060         virtual void emitDisconnected();
0061         virtual void emitDownloadReady( const QVariantMap &download  );
0062         virtual void emitDownloadPending( const QVariantMap &download  );
0063 
0064     private Q_SLOTS:
0065         void slotFinished();
0066         void slotError( QProcess::ProcessError error );
0067 
0068     private:
0069         AmarokProcess *m_daemon;
0070 
0071         QString m_identifier;
0072         QString m_email;
0073         QString m_pin;
0074 };
0075 #endif