mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Open directory in file manager when clicking the finished download.
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
@@ -136,6 +137,11 @@ PlaylistItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
|
|||||||
Q_ASSERT( item );
|
Q_ASSERT( item );
|
||||||
|
|
||||||
if ( index.column() == PlayableModel::Download && item->result() &&
|
if ( index.column() == PlayableModel::Download && item->result() &&
|
||||||
|
!DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ) ).absolutePath() ) );
|
||||||
|
}
|
||||||
|
else if ( index.column() == PlayableModel::Download && item->result() &&
|
||||||
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
||||||
{
|
{
|
||||||
QStringList formats;
|
QStringList formats;
|
||||||
@@ -396,7 +402,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
|||||||
if ( item->result()->downloadJob()->state() == DownloadJob::Finished )
|
if ( item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||||
{
|
{
|
||||||
painter->setPen( opt.palette.text().color() );
|
painter->setPen( opt.palette.text().color() );
|
||||||
const QString text = painter->fontMetrics().elidedText( tr( "Finished" ), Qt::ElideRight, opt.rect.width() - 3 );
|
const QString text = painter->fontMetrics().elidedText( tr( "View in Finder" ), Qt::ElideRight, opt.rect.width() - 3 );
|
||||||
painter->drawText( opt.rect, text, textOption );
|
painter->drawText( opt.rect, text, textOption );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user