1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Add files

This commit is contained in:
Leo Franchi 2011-10-02 12:20:56 -04:00
parent 56280db289
commit 4402bd8f03
2 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,92 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Hugo Lindström <hugolm84@gmail.com>
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dropjobnotifier.h"
#include "utils/logger.h"
#include "utils/tomahawkutils.h"
#include "query.h"
#include "sourcelist.h"
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#include "dropjob.h"
#include <qjson/parser.h>
#include "dropjobnotifier.h"
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
class QNetworkReply;
using namespace Tomahawk;
DropJobNotifier::DropJobNotifier( QPixmap servicePixmap, QString service, DropJob::DropType type, QNetworkReply* job )
: JobStatusItem()
, m_type( "unknown" )
, m_job( 0 )
, m_service ( service )
, m_pixmap ( servicePixmap )
{
if( type == DropJob::Playlist )
m_type = "playlist";
if( type == DropJob::Artist )
m_type = "artist";
if( type == DropJob::Track )
m_type = "track";
if( type == DropJob::Album )
m_type = "album";
if( m_service.isEmpty() )
m_service = "DropJob";
connect( job, SIGNAL( finished() ), this, SLOT( setFinished() ) );
}
DropJobNotifier::~DropJobNotifier()
{}
QString
DropJobNotifier::rightColumnText() const
{
return QString();
}
QPixmap
DropJobNotifier::icon() const
{
return m_pixmap;
}
QString
DropJobNotifier::mainText() const
{
return tr( "Parsing %1 %2" ).arg( m_service )
.arg( m_type );
}
void
DropJobNotifier::setFinished()
{
emit finished();
}

View File

@ -0,0 +1,62 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Hugo Lindström <hugolm84@gmail.com>
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DROPJOBNOTIFIER_H
#define DROPJOBNOTIFIER_H
#include "dllmacro.h"
#include "dropjob.h"
#include "typedefs.h"
#include "query.h"
#include "jobview/JobStatusItem.h"
#include <QObject>
#include <QSet>
#include <QtCore/QStringList>
class QNetworkReply;
namespace Tomahawk
{
class DLLEXPORT DropJobNotifier : public JobStatusItem
{
Q_OBJECT
public:
DropJobNotifier( QPixmap pixmap, QString service, DropJob::DropType type, QNetworkReply* job );
virtual ~DropJobNotifier();
virtual QString rightColumnText() const;
virtual QString mainText() const;
virtual QPixmap icon() const;
virtual QString type() const { return m_type; }
virtual bool collapseItem() const { return true; }
public slots:
void setFinished();
private:
QString m_type;
QNetworkReply* m_job;
QPixmap m_pixmap;
QString m_service;
};
}
#endif // DROPJOBNOTIFIER_H