mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 22:38:33 +01:00
Show discreet JobStatusItem for incoming tracks.
This commit is contained in:
parent
14fb8a8533
commit
0800aa6ac7
@ -40,6 +40,7 @@ set( libGuiSources
|
||||
jobview/LatchedStatusItem.cpp
|
||||
jobview/ErrorStatusMessage.cpp
|
||||
jobview/IndexingJobItem.cpp
|
||||
jobview/InboxJobItem.cpp
|
||||
|
||||
infobar/InfoBar.cpp
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "playlist/InboxModel.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "jobview/InboxJobItem.h"
|
||||
|
||||
DatabaseCommand_ShareTrack::DatabaseCommand_ShareTrack( QObject* parent )
|
||||
: DatabaseCommand_SocialAction( parent )
|
||||
@ -106,12 +106,9 @@ DatabaseCommand_ShareTrack::postCommitHook()
|
||||
Q_ARG( const Tomahawk::query_ptr&, m_query ),
|
||||
Q_ARG( int, 0 ) /*row*/ );
|
||||
|
||||
//TODO: replace with a proper JobStatusItem
|
||||
QString friendlyName = source()->friendlyName();
|
||||
if( ViewManager::instance()->currentPage() != ViewManager::instance()->inboxWidget() )
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "%1 recommended %2 by %3" )
|
||||
.arg( source()->friendlyName() )
|
||||
.arg( m_query->track() )
|
||||
.arg( m_query->artist() ) ) );
|
||||
JobStatusView::instance()->model()->addJob( new InboxJobItem( friendlyName, m_query ) );
|
||||
}
|
||||
|
||||
|
||||
|
65
src/libtomahawk/jobview/InboxJobItem.cpp
Normal file
65
src/libtomahawk/jobview/InboxJobItem.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* 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 "InboxJobItem.h"
|
||||
|
||||
#include "Query.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
InboxJobItem::InboxJobItem( const QString& sender,
|
||||
const Tomahawk::query_ptr& query,
|
||||
QObject* parent )
|
||||
: JobStatusItem()
|
||||
, m_query( query )
|
||||
, m_sender( sender )
|
||||
{
|
||||
m_timer = new QTimer( this );
|
||||
m_timer->setInterval( 8000 );
|
||||
m_timer->setSingleShot( true );
|
||||
|
||||
connect( m_timer, SIGNAL( timeout() ), this, SIGNAL( finished() ) );
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
|
||||
InboxJobItem::~InboxJobItem()
|
||||
{}
|
||||
|
||||
|
||||
QString
|
||||
InboxJobItem::mainText() const
|
||||
{
|
||||
return tr( "%1 sent you %2 by %3." )
|
||||
.arg( m_sender )
|
||||
.arg( m_query->track() )
|
||||
.arg( m_query->artist() );
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
InboxJobItem::icon() const
|
||||
{
|
||||
return TomahawkUtils::defaultPixmap( TomahawkUtils::Inbox, TomahawkUtils::Original, QSize( 64, 64 ) );
|
||||
}
|
51
src/libtomahawk/jobview/InboxJobItem.h
Normal file
51
src/libtomahawk/jobview/InboxJobItem.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* 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 INBOXJOBITEM_H
|
||||
#define INBOXJOBITEM_H
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusItem.h"
|
||||
|
||||
|
||||
class DLLEXPORT InboxJobItem : public JobStatusItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InboxJobItem( const QString& sender, const Tomahawk::query_ptr& query, QObject* parent = 0 );
|
||||
virtual ~InboxJobItem();
|
||||
|
||||
virtual QString rightColumnText() const { return QString(); }
|
||||
virtual QString mainText() const;
|
||||
virtual QPixmap icon() const;
|
||||
virtual QString type() const { return "inboxjob"; }
|
||||
|
||||
bool allowMultiLine() const { return true; }
|
||||
|
||||
private:
|
||||
Tomahawk::query_ptr m_query;
|
||||
QString m_sender;
|
||||
|
||||
QTimer* m_timer;
|
||||
static QPixmap* s_pixmap;
|
||||
};
|
||||
|
||||
#endif // INBOXJOBITEM_H
|
Loading…
x
Reference in New Issue
Block a user