mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 21:27:58 +02:00
Show errors when fetching information from the network. Fixes TWK-515
This commit is contained in:
BIN
data/images/process-stop.png
Normal file
BIN
data/images/process-stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@@ -134,5 +134,6 @@
|
|||||||
<file>data/images/no-album-no-case.png</file>
|
<file>data/images/no-album-no-case.png</file>
|
||||||
<file>data/images/rdio.png</file>
|
<file>data/images/rdio.png</file>
|
||||||
<file>data/sql/dbmigrate-27_to_28.sql</file>
|
<file>data/sql/dbmigrate-27_to_28.sql</file>
|
||||||
|
<file>data/images/process-stop.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -38,6 +38,7 @@ set( libGuiSources
|
|||||||
jobview/PipelineStatusItem.cpp
|
jobview/PipelineStatusItem.cpp
|
||||||
jobview/TransferStatusItem.cpp
|
jobview/TransferStatusItem.cpp
|
||||||
jobview/LatchedStatusItem.cpp
|
jobview/LatchedStatusItem.cpp
|
||||||
|
jobview/ErrorStatusMessage.cpp
|
||||||
|
|
||||||
infobar/infobar.cpp
|
infobar/infobar.cpp
|
||||||
|
|
||||||
@@ -276,6 +277,7 @@ set( libGuiHeaders
|
|||||||
jobview/PipelineStatusItem.h
|
jobview/PipelineStatusItem.h
|
||||||
jobview/TransferStatusItem.h
|
jobview/TransferStatusItem.h
|
||||||
jobview/LatchedStatusItem.h
|
jobview/LatchedStatusItem.h
|
||||||
|
jobview/ErrorStatusMessage.h
|
||||||
|
|
||||||
thirdparty/Qocoa/qsearchfield.h
|
thirdparty/Qocoa/qsearchfield.h
|
||||||
)
|
)
|
||||||
|
@@ -35,6 +35,8 @@
|
|||||||
#include "utils/xspfloader.h"
|
#include "utils/xspfloader.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
|
|
||||||
#ifdef QCA2_FOUND
|
#ifdef QCA2_FOUND
|
||||||
#include "utils/groovesharkparser.h"
|
#include "utils/groovesharkparser.h"
|
||||||
#endif //QCA2_FOUND
|
#endif //QCA2_FOUND
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
#include "query.h"
|
#include "query.h"
|
||||||
|
|
||||||
#include "infosystem/infosystem.h"
|
#include "infosystem/infosystem.h"
|
||||||
|
#include "utils/xspfloader.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
56
src/libtomahawk/jobview/ErrorStatusMessage.cpp
Normal file
56
src/libtomahawk/jobview/ErrorStatusMessage.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Leo Franchi <lfranchi@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 "ErrorStatusMessage.h"
|
||||||
|
|
||||||
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
QPixmap* ErrorStatusMessage::s_pixmap = 0;
|
||||||
|
|
||||||
|
ErrorStatusMessage::ErrorStatusMessage( const QString& message, int timeoutSecs ) :
|
||||||
|
JobStatusItem()
|
||||||
|
, m_message( message )
|
||||||
|
{
|
||||||
|
m_timer = new QTimer( this );
|
||||||
|
m_timer->setInterval( timeoutSecs * 1000 );
|
||||||
|
m_timer->setSingleShot( true );
|
||||||
|
|
||||||
|
connect( m_timer, SIGNAL( timeout() ), this, SIGNAL( finished() ) );
|
||||||
|
|
||||||
|
if ( !s_pixmap )
|
||||||
|
s_pixmap = new QPixmap( RESPATH "images/process-stop.png" );
|
||||||
|
|
||||||
|
m_timer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap
|
||||||
|
ErrorStatusMessage::icon() const
|
||||||
|
{
|
||||||
|
Q_ASSERT( s_pixmap );
|
||||||
|
return *s_pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
ErrorStatusMessage::mainText() const
|
||||||
|
{
|
||||||
|
return m_message;
|
||||||
|
}
|
47
src/libtomahawk/jobview/ErrorStatusMessage.h
Normal file
47
src/libtomahawk/jobview/ErrorStatusMessage.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Leo Franchi <lfranchi@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 ERRORSTATUSMESSAGE_H
|
||||||
|
#define ERRORSTATUSMESSAGE_H
|
||||||
|
|
||||||
|
#include "JobStatusItem.h"
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
class QPixmap;
|
||||||
|
|
||||||
|
class ErrorStatusMessage : public JobStatusItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ErrorStatusMessage( const QString& errorMessage, int defaultTimeoutSecs = 8 );
|
||||||
|
|
||||||
|
QString type() const { return "errormessage"; }
|
||||||
|
QString rightColumnText() const { return QString(); }
|
||||||
|
|
||||||
|
QPixmap icon() const;
|
||||||
|
QString mainText() const;
|
||||||
|
|
||||||
|
bool allowMultiLine() const { return true; }
|
||||||
|
private:
|
||||||
|
QString m_message;
|
||||||
|
QTimer* m_timer;
|
||||||
|
|
||||||
|
static QPixmap* s_pixmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ERRORSTATUSMESSAGE_H
|
@@ -23,14 +23,16 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QListView>
|
||||||
|
|
||||||
#define ROW_HEIGHT 20
|
#define ROW_HEIGHT 20
|
||||||
#define ICON_PADDING 1
|
#define ICON_PADDING 1
|
||||||
#define PADDING 2
|
#define PADDING 2
|
||||||
JobStatusDelegate::JobStatusDelegate( QObject* parent )
|
JobStatusDelegate::JobStatusDelegate( QObject* parent )
|
||||||
: QStyledItemDelegate ( parent )
|
: QStyledItemDelegate ( parent )
|
||||||
|
, m_parentView( qobject_cast< QListView* >( parent ) )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( m_parentView );
|
||||||
}
|
}
|
||||||
|
|
||||||
JobStatusDelegate::~JobStatusDelegate()
|
JobStatusDelegate::~JobStatusDelegate()
|
||||||
@@ -70,16 +72,36 @@ JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int mainW = rightEdge - 3*PADDING - iconRect.right();
|
const int mainW = rightEdge - 3*PADDING - iconRect.right();
|
||||||
|
const bool allowMultiLine = index.data( JobStatusModel::AllowMultiLineRole ).toBool();
|
||||||
QString mainText = index.data( Qt::DisplayRole ).toString();
|
QString mainText = index.data( Qt::DisplayRole ).toString();
|
||||||
|
QTextOption to( Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
if ( !allowMultiLine )
|
||||||
mainText = fm.elidedText( mainText, Qt::ElideRight, mainW );
|
mainText = fm.elidedText( mainText, Qt::ElideRight, mainW );
|
||||||
painter->drawText( QRect( iconRect.right() + 2*PADDING, PADDING + opt.rect.y(), mainW, opt.rect.height() - 2*PADDING ), Qt::AlignLeft | Qt::AlignVCenter, mainText );
|
else
|
||||||
|
to.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );
|
||||||
|
painter->drawText( QRect( iconRect.right() + 2*PADDING, PADDING + opt.rect.y(), mainW, opt.rect.height() - 2*PADDING ), mainText, to );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
// return QStyledItemDelegate::sizeHint( option, index );
|
const bool allowMultiLine = index.data( JobStatusModel::AllowMultiLineRole ).toBool();
|
||||||
const int w = QStyledItemDelegate::sizeHint ( option, index ).width();
|
|
||||||
return QSize( w, ROW_HEIGHT );
|
if ( !allowMultiLine )
|
||||||
|
return QSize( QStyledItemDelegate::sizeHint ( option, index ).width(), ROW_HEIGHT );
|
||||||
|
else if ( m_cachedMultiLineHeights.contains( index ) )
|
||||||
|
return QSize( QStyledItemDelegate::sizeHint ( option, index ).width(), m_cachedMultiLineHeights[ index ] );
|
||||||
|
|
||||||
|
// Don't elide, but stretch across as many rows as required
|
||||||
|
QStyleOptionViewItemV4 opt = option;
|
||||||
|
initStyleOption( &opt, index );
|
||||||
|
|
||||||
|
const QString text = index.data( Qt::DisplayRole ).toString();
|
||||||
|
const int leftEdge = ICON_PADDING + ROW_HEIGHT + 2*PADDING;
|
||||||
|
const QRect rect = opt.fontMetrics.boundingRect( leftEdge, opt.rect.top(), m_parentView->width() - leftEdge, 200, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text );
|
||||||
|
|
||||||
|
m_cachedMultiLineHeights.insert( index, rect.height() + 4*PADDING );
|
||||||
|
|
||||||
|
return QSize( QStyledItemDelegate::sizeHint ( option, index ).width(), rect.height() + 4*PADDING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
class QListView;
|
||||||
|
|
||||||
class JobStatusDelegate : public QStyledItemDelegate
|
class JobStatusDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,10 @@ public:
|
|||||||
|
|
||||||
virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||||
virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutable QHash< QPersistentModelIndex, int > m_cachedMultiLineHeights;
|
||||||
|
QListView* m_parentView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // JOBSTATUSDELEGATE_H
|
#endif // JOBSTATUSDELEGATE_H
|
||||||
|
@@ -53,6 +53,7 @@ public:
|
|||||||
* and a count will be shown instead.
|
* and a count will be shown instead.
|
||||||
*/
|
*/
|
||||||
virtual bool collapseItem() const { return false; }
|
virtual bool collapseItem() const { return false; }
|
||||||
|
virtual bool allowMultiLine() const { return false; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// Ask for an update
|
/// Ask for an update
|
||||||
|
@@ -100,6 +100,8 @@ JobStatusModel::data( const QModelIndex& index, int role ) const
|
|||||||
else
|
else
|
||||||
return item->rightColumnText();
|
return item->rightColumnText();
|
||||||
}
|
}
|
||||||
|
case AllowMultiLineRole:
|
||||||
|
return item->allowMultiLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@@ -31,7 +31,8 @@ public:
|
|||||||
enum JobRoles {
|
enum JobRoles {
|
||||||
// DecorationRole is icon
|
// DecorationRole is icon
|
||||||
// DisplayRole is main col
|
// DisplayRole is main col
|
||||||
RightColumnRole = Qt::UserRole + 1
|
RightColumnRole = Qt::UserRole + 1,
|
||||||
|
AllowMultiLineRole = Qt::UserRole + 2
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit JobStatusModel( QObject* parent = 0 );
|
explicit JobStatusModel( QObject* parent = 0 );
|
||||||
|
@@ -56,9 +56,7 @@ JobStatusView::JobStatusView( AnimatedSplitter* parent )
|
|||||||
|
|
||||||
m_view->setFrameShape( QFrame::NoFrame );
|
m_view->setFrameShape( QFrame::NoFrame );
|
||||||
m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
m_view->setUniformItemSizes( false );
|
||||||
// new QTreeWidgetItem( m_tree );
|
|
||||||
m_view->setUniformItemSizes( true );
|
|
||||||
|
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
QFont f = font();
|
QFont f = font();
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "dropjob.h"
|
#include "dropjob.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
#include "dropjobnotifier.h"
|
#include "dropjobnotifier.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
|
||||||
@@ -198,6 +199,7 @@ GroovesharkParser::groovesharkLookupFinished()
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching Grooveshark information from the network!" ) ) );
|
||||||
tLog() << "Error in network request to grooveshark for track decoding:" << r->errorString();
|
tLog() << "Error in network request to grooveshark for track decoding:" << r->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
|
|
||||||
#include <qjson/parser.h>
|
#include <qjson/parser.h>
|
||||||
|
|
||||||
@@ -166,6 +167,7 @@ ItunesParser::itunesResponseLookupFinished()
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching iTunes information from the network!" ) ) );
|
||||||
tLog() << "Error in network request to Itunes for track decoding:" << r->errorString();
|
tLog() << "Error in network request to Itunes for track decoding:" << r->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "dropjob.h"
|
#include "dropjob.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
#include "dropjobnotifier.h"
|
#include "dropjobnotifier.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
@@ -189,6 +190,7 @@ RdioParser::rdioReturned()
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching Rdio information from the network!" ) ) );
|
||||||
tLog() << "Error in network request to Rdio for track decoding:" << r->errorString();
|
tLog() << "Error in network request to Rdio for track decoding:" << r->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/JobStatusView.h"=
|
||||||
|
|
||||||
#include <qjson/parser.h>
|
#include <qjson/parser.h>
|
||||||
|
|
||||||
@@ -78,6 +81,9 @@ ShortenedLinkParser::lookupFinished()
|
|||||||
QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() );
|
QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() );
|
||||||
Q_ASSERT( r );
|
Q_ASSERT( r );
|
||||||
|
|
||||||
|
if ( r->error() != QNetworkReply::NoError )
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Network error parsing shortened link!" ) ) );
|
||||||
|
|
||||||
QVariant redir = r->attribute( QNetworkRequest::RedirectionTargetAttribute );
|
QVariant redir = r->attribute( QNetworkRequest::RedirectionTargetAttribute );
|
||||||
if ( redir.isValid() && !redir.toUrl().isEmpty() )
|
if ( redir.isValid() && !redir.toUrl().isEmpty() )
|
||||||
{
|
{
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "dropjob.h"
|
#include "dropjob.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
#include "dropjobnotifier.h"
|
#include "dropjobnotifier.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
|
||||||
@@ -220,6 +221,7 @@ SpotifyParser::spotifyBrowseFinished()
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching Spotify information from the network!" ) ) );
|
||||||
tLog() << "Error in network request to Spotify for track decoding:" << r->errorString();
|
tLog() << "Error in network request to Spotify for track decoding:" << r->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2011-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,6 +25,9 @@
|
|||||||
|
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "jobview/JobStatusView.h"
|
||||||
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
|
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
@@ -32,6 +36,20 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
QString
|
||||||
|
XSPFLoader::errorToString( XSPFErrorCode error )
|
||||||
|
{
|
||||||
|
switch ( error )
|
||||||
|
{
|
||||||
|
case ParseError:
|
||||||
|
return tr( "Failed to parse contents of XSPF playlist" );
|
||||||
|
case InvalidTrackError:
|
||||||
|
return tr( "Some playlist entries were found without artist and track name, they will be omitted");
|
||||||
|
case FetchError:
|
||||||
|
return tr( "Failed to fetch the desired playlist from the network, or the desired file does not exist" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XSPFLoader::XSPFLoader( bool autoCreate, bool autoUpdate, QObject *parent )
|
XSPFLoader::XSPFLoader( bool autoCreate, bool autoUpdate, QObject *parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_autoCreate( autoCreate )
|
, m_autoCreate( autoCreate )
|
||||||
@@ -97,6 +115,7 @@ void
|
|||||||
XSPFLoader::reportError()
|
XSPFLoader::reportError()
|
||||||
{
|
{
|
||||||
emit error( FetchError );
|
emit error( FetchError );
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorToString( FetchError) ) );
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2011-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,6 +49,8 @@ public:
|
|||||||
void setOverrideTitle( const QString& newTitle );
|
void setOverrideTitle( const QString& newTitle );
|
||||||
void setAutoResolveTracks( bool autoResolve ) { m_autoResolve = autoResolve; }
|
void setAutoResolveTracks( bool autoResolve ) { m_autoResolve = autoResolve; }
|
||||||
|
|
||||||
|
static QString errorToString( XSPFErrorCode error );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void error( XSPFLoader::XSPFErrorCode error );
|
void error( XSPFLoader::XSPFErrorCode error );
|
||||||
void ok( const Tomahawk::playlist_ptr& );
|
void ok( const Tomahawk::playlist_ptr& );
|
||||||
|
Reference in New Issue
Block a user