Compare commits
33 Commits
libvlc
...
revert-268
Author | SHA1 | Date | |
---|---|---|---|
|
92811215a5 | ||
|
c1d99b4868 | ||
|
8bb14cc26c | ||
|
d74c465e58 | ||
|
69653c4934 | ||
|
46239947f5 | ||
|
eee50b2f93 | ||
|
655edf3e98 | ||
|
45e6d52db7 | ||
|
b6dd736fea | ||
|
0229746f8b | ||
|
ea18ab891f | ||
|
906285e442 | ||
|
0812855b60 | ||
|
5e2253881f | ||
|
e9c7fd7a16 | ||
|
1a6a15844b | ||
|
8dd8c77610 | ||
|
16a3e9eccb | ||
|
225d5764e7 | ||
|
44ffefb1fb | ||
|
1d3d8001a4 | ||
|
29ba03444b | ||
|
51fe1aa0df | ||
|
5d9b42182b | ||
|
01534d222f | ||
|
8a58114f73 | ||
|
a8642a687f | ||
|
fb66be9746 | ||
|
22a58b7e21 | ||
|
f55ff6f13b | ||
|
af0b14b728 | ||
|
99f6330b95 |
@@ -33,8 +33,8 @@ ENDIF()
|
||||
|
||||
SET( TOMAHAWK_VERSION_MAJOR 0 )
|
||||
SET( TOMAHAWK_VERSION_MINOR 8 )
|
||||
SET( TOMAHAWK_VERSION_PATCH 99 )
|
||||
#SET( TOMAHAWK_VERSION_RC 0 )
|
||||
SET( TOMAHAWK_VERSION_PATCH 0 )
|
||||
SET( TOMAHAWK_VERSION_RC 1 )
|
||||
|
||||
SET( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs de en el es fi fr hi_IN hu gl it ja lt pl pt_BR ro ru sv tr zh_CN zh_TW )
|
||||
|
||||
|
BIN
data/icons/tomahawk-white-icon-128x128.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 893 KiB |
Before Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 266 KiB |
Before Width: | Height: | Size: 659 KiB After Width: | Height: | Size: 507 KiB |
@@ -1,7 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>data/images/collection_background.png</file>
|
||||
<file>data/images/collection_background_small.png</file>
|
||||
<file>data/images/playlist_background.png</file>
|
||||
<file>data/images/filter.svg</file>
|
||||
<file>data/images/loved.svg</file>
|
||||
@@ -162,5 +161,6 @@
|
||||
<file>data/images/copy.svg</file>
|
||||
<file>data/icons/tomahawk-icon-1024x1024.png</file>
|
||||
<file>data/images/plugins.svg</file>
|
||||
<file>data/icons/tomahawk-white-icon-128x128.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -38,7 +38,6 @@ set( libGuiSources
|
||||
playlist/InboxModel.cpp
|
||||
playlist/InboxView.cpp
|
||||
playlist/ContextView.cpp
|
||||
playlist/FlexibleTreeView.cpp
|
||||
playlist/TreeModel.cpp
|
||||
playlist/TreeProxyModel.cpp
|
||||
playlist/TreeProxyModelPlaylistInterface.cpp
|
||||
@@ -121,6 +120,7 @@ set( libGuiSources
|
||||
viewpages/AlbumViewPage.cpp
|
||||
viewpages/TrackViewPage.cpp
|
||||
viewpages/PlaylistViewPage.cpp
|
||||
viewpages/CollectionViewPage.cpp
|
||||
|
||||
widgets/AnimatedSplitter.cpp
|
||||
widgets/BasicHeader.cpp
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include "audio/AudioEngine.h"
|
||||
|
||||
#include "playlist/ContextView.h"
|
||||
#include "playlist/FlexibleTreeView.h"
|
||||
#include "playlist/TreeModel.h"
|
||||
#include "playlist/PlaylistModel.h"
|
||||
#include "playlist/TrackView.h"
|
||||
@@ -42,13 +41,12 @@
|
||||
#include "playlist/RecentlyPlayedModel.h"
|
||||
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
||||
|
||||
#include "resolvers/ScriptCollection.h"
|
||||
|
||||
#include "viewpages/PlaylistViewPage.h"
|
||||
#include "viewpages/SourceViewPage.h"
|
||||
#include "viewpages/ArtistViewPage.h"
|
||||
#include "viewpages/AlbumViewPage.h"
|
||||
#include "viewpages/TrackViewPage.h"
|
||||
#include "viewpages/CollectionViewPage.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
@@ -261,32 +259,12 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
m_currentCollection = collection;
|
||||
|
||||
FlexibleTreeView* view;
|
||||
CollectionViewPage* view;
|
||||
if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
|
||||
{
|
||||
view = new FlexibleTreeView();
|
||||
|
||||
view->columnView()->proxyModel()->setStyle( PlayableProxyModel::Collection );
|
||||
TreeModel* model = new TreeModel();
|
||||
PlayableModel* flatModel = new PlayableModel();
|
||||
PlayableModel* albumModel = new PlayableModel();
|
||||
|
||||
view->setTreeModel( model );
|
||||
view->setFlatModel( flatModel );
|
||||
view->setAlbumModel( albumModel );
|
||||
|
||||
model->addCollection( collection );
|
||||
flatModel->appendTracks( collection );
|
||||
albumModel->appendAlbums( collection );
|
||||
|
||||
view = new CollectionViewPage( collection );
|
||||
setPage( view );
|
||||
|
||||
if ( !collection.isNull() )
|
||||
view->setEmptyTip( collection->emptyText() );
|
||||
|
||||
if ( collection.objectCast<ScriptCollection>() )
|
||||
view->trackView()->setEmptyTip( tr( "Cloud collections aren't supported in the flat view yet. We will have them covered soon. Switch to another view to navigate them." ) );
|
||||
|
||||
m_collectionViews.insert( collection, view );
|
||||
}
|
||||
else
|
||||
|
@@ -42,7 +42,7 @@ class AlbumInfoWidget;
|
||||
class ArtistInfoWidget;
|
||||
class CollectionModel;
|
||||
class PlaylistViewPage;
|
||||
class FlexibleTreeView;
|
||||
class CollectionViewPage;
|
||||
class PlaylistModel;
|
||||
class TrackProxyModel;
|
||||
class TrackModel;
|
||||
@@ -164,7 +164,7 @@ private:
|
||||
QHash< QString, boost::function< Tomahawk::ViewPage*() > > m_dynamicPagesInstanceLoaders;
|
||||
|
||||
QHash< Tomahawk::dynplaylist_ptr, QPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets;
|
||||
QHash< Tomahawk::collection_ptr, QPointer<FlexibleTreeView> > m_collectionViews;
|
||||
QHash< Tomahawk::collection_ptr, QPointer<CollectionViewPage> > m_collectionViews;
|
||||
QHash< Tomahawk::artist_ptr, QPointer<ArtistInfoWidget> > m_artistViews;
|
||||
QHash< Tomahawk::album_ptr, QPointer<AlbumInfoWidget> > m_albumViews;
|
||||
QHash< Tomahawk::query_ptr, QPointer<TrackInfoWidget> > m_trackViews;
|
||||
|
@@ -98,13 +98,6 @@ Collection::bigIcon() const
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Collection::emptyText() const
|
||||
{
|
||||
return tr( "This collection is empty." );
|
||||
}
|
||||
|
||||
|
||||
const
|
||||
source_ptr& Collection::source() const
|
||||
{
|
||||
|
@@ -67,7 +67,6 @@ public:
|
||||
virtual BackendType backendType() const { return NullCollectionType; }
|
||||
virtual QIcon icon() const;
|
||||
virtual QPixmap bigIcon() const; //for the ViewPage header
|
||||
virtual QString emptyText() const;
|
||||
|
||||
virtual void loadPlaylists();
|
||||
virtual void loadAutoPlaylists();
|
||||
|
@@ -119,6 +119,7 @@ Database::Database( const QString& dbname, QObject* parent )
|
||||
tDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentThreads << "database worker threads";
|
||||
|
||||
connect( m_impl, SIGNAL( indexReady() ), SLOT( markAsReady() ) );
|
||||
connect( m_impl, SIGNAL( indexStarted() ), SIGNAL( indexStarted() ) );
|
||||
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( indexReady() ) );
|
||||
|
||||
Q_ASSERT( m_workerRW );
|
||||
|
@@ -101,7 +101,8 @@ public:
|
||||
}
|
||||
|
||||
signals:
|
||||
void indexReady(); // search index
|
||||
void indexStarted();
|
||||
void indexReady();
|
||||
void ready();
|
||||
|
||||
void newJobRO( Tomahawk::dbcmd_ptr );
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2012 Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@@ -26,9 +26,6 @@
|
||||
#include "TomahawkSqlQuery.h"
|
||||
|
||||
#include "fuzzyindex/DatabaseFuzzyIndex.h"
|
||||
#include "jobview/IndexingJobItem.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
namespace Tomahawk
|
||||
@@ -36,22 +33,14 @@ namespace Tomahawk
|
||||
|
||||
DatabaseCommand_UpdateSearchIndex::DatabaseCommand_UpdateSearchIndex()
|
||||
: DatabaseCommand()
|
||||
, m_statusJob( new IndexingJobItem )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Updating index.";
|
||||
|
||||
JobStatusView::addJob( m_statusJob );
|
||||
tDebug() << Q_FUNC_INFO << "Updating index.";
|
||||
}
|
||||
|
||||
|
||||
DatabaseCommand_UpdateSearchIndex::~DatabaseCommand_UpdateSearchIndex()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( ! m_statusJob.isNull() )
|
||||
{
|
||||
m_statusJob.data()->done();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#include "DllMacro.h"
|
||||
#include <QPointer>
|
||||
|
||||
class IndexingJobItem;
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
@@ -47,9 +45,6 @@ public:
|
||||
virtual QString commandname() const { return "updatesearchindex"; }
|
||||
virtual bool doesMutates() const { return true; }
|
||||
virtual void exec( DatabaseImpl* db );
|
||||
|
||||
private:
|
||||
QPointer<IndexingJobItem> m_statusJob;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -199,6 +199,7 @@ Tomahawk::DatabaseImpl::dumpDatabase()
|
||||
void
|
||||
Tomahawk::DatabaseImpl::loadIndex()
|
||||
{
|
||||
connect( m_fuzzyIndex, SIGNAL( indexStarted() ), SIGNAL( indexStarted() ) );
|
||||
connect( m_fuzzyIndex, SIGNAL( indexReady() ), SIGNAL( indexReady() ) );
|
||||
m_fuzzyIndex->loadLuceneIndex();
|
||||
}
|
||||
|
@@ -86,7 +86,9 @@ public:
|
||||
void loadIndex();
|
||||
|
||||
signals:
|
||||
void indexStarted();
|
||||
void indexReady();
|
||||
|
||||
void schemaUpdateStarted();
|
||||
void schemaUpdateStatus( const QString& message );
|
||||
void schemaUpdateDone();
|
||||
|
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
||||
|
||||
|
||||
This program 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 2 of the License, or
|
||||
@@ -42,10 +41,3 @@ LocalCollection::prettyName() const
|
||||
{
|
||||
return tr( "Your Collection" );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LocalCollection::emptyText() const
|
||||
{
|
||||
return tr( "After you have scanned your music collection you will find your tracks right here." );
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ public:
|
||||
explicit LocalCollection( const Tomahawk::source_ptr& source, QObject* parent = 0 );
|
||||
|
||||
virtual QString prettyName() const;
|
||||
virtual QString emptyText() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.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 "DatabaseFuzzyIndex.h"
|
||||
|
||||
#include "database/DatabaseImpl.h"
|
||||
@@ -8,7 +26,6 @@ namespace Tomahawk {
|
||||
DatabaseFuzzyIndex::DatabaseFuzzyIndex( QObject* parent, bool wipe )
|
||||
: FuzzyIndex( parent, "tomahawk.lucene", wipe )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.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 TOMAHAWK_DATABASEFUZZYINDEX_H
|
||||
#define TOMAHAWK_DATABASEFUZZYINDEX_H
|
||||
|
||||
|
@@ -94,6 +94,7 @@ FuzzyIndex::updateIndexSlot()
|
||||
void
|
||||
FuzzyIndex::beginIndexing()
|
||||
{
|
||||
emit indexStarted();
|
||||
m_mutex.lock();
|
||||
|
||||
try
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
virtual void updateIndex();
|
||||
|
||||
signals:
|
||||
void indexStarted();
|
||||
void indexReady();
|
||||
|
||||
public slots:
|
||||
|
@@ -18,7 +18,11 @@
|
||||
|
||||
#include "IndexingJobItem.h"
|
||||
|
||||
#include "JobStatusModel.h"
|
||||
#include "JobStatusView.h"
|
||||
#include "database/Database.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
@@ -29,16 +33,40 @@ IndexingJobItem::mainText() const
|
||||
return tr( "Indexing Music Library" );
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
IndexingJobItem::icon() const
|
||||
{
|
||||
return TomahawkUtils::defaultPixmap( TomahawkUtils::ViewRefresh, TomahawkUtils::Original, QSize( 128, 128 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IndexingJobItem::done()
|
||||
void
|
||||
IndexingJobItem::done()
|
||||
{
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
||||
IndexStatusManager::IndexStatusManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
connect( Tomahawk::Database::instance(), SIGNAL( indexStarted() ), SLOT( started() ) );
|
||||
connect( Tomahawk::Database::instance(), SIGNAL( indexReady() ), SLOT( finished() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IndexStatusManager::started()
|
||||
{
|
||||
m_curItem = new IndexingJobItem;
|
||||
JobStatusView::instance()->model()->addJob( m_curItem.data() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IndexStatusManager::finished()
|
||||
{
|
||||
if ( m_curItem )
|
||||
m_curItem->done();
|
||||
}
|
||||
|
@@ -19,8 +19,9 @@
|
||||
#ifndef INDEXINGJOBITEM_H
|
||||
#define INDEXINGJOBITEM_H
|
||||
|
||||
#include <jobview/JobStatusItem.h>
|
||||
#include "JobStatusItem.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class IndexingJobItem : public JobStatusItem
|
||||
{
|
||||
@@ -37,4 +38,19 @@ public:
|
||||
virtual QString type() const { return "indexerjob"; }
|
||||
};
|
||||
|
||||
class IndexStatusManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IndexStatusManager( QObject* parent = 0 );
|
||||
virtual ~IndexStatusManager() {}
|
||||
|
||||
private slots:
|
||||
void started();
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QPointer<IndexingJobItem> m_curItem;
|
||||
};
|
||||
|
||||
#endif // INDEXINGJOBITEM_H
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "JobStatusDelegate.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Source.h"
|
||||
#include "IndexingJobItem.h"
|
||||
#include "PipelineStatusItem.h"
|
||||
#include "TransferStatusItem.h"
|
||||
#include "LatchedStatusItem.h"
|
||||
@@ -92,6 +93,7 @@ JobStatusView::JobStatusView( AnimatedSplitter* parent )
|
||||
m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
m_view->setUniformItemSizes( false );
|
||||
|
||||
new IndexStatusManager( this );
|
||||
new PipelineStatusManager( this );
|
||||
new TransferStatusManager( this );
|
||||
new LatchedStatusManager( this );
|
||||
|
@@ -110,7 +110,7 @@ void
|
||||
ColumnView::setModel( QAbstractItemModel* model )
|
||||
{
|
||||
Q_UNUSED( model );
|
||||
tDebug() << "Explicitly use setPlaylistModel instead";
|
||||
tDebug() << "Explicitly use setTreeModel instead";
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||
m_trackView->proxyModel()->setStyle( PlayableProxyModel::Fancy );
|
||||
TomahawkStyle::styleScrollBar( m_trackView->verticalScrollBar() );
|
||||
|
||||
setLayout( new QVBoxLayout( this ) );
|
||||
setLayout( new QVBoxLayout() );
|
||||
TomahawkUtils::unmarginLayout( layout() );
|
||||
|
||||
m_trackView->setStyleSheet( QString( "QTreeView { background-color: white; }" ) );
|
||||
@@ -63,7 +63,7 @@ ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||
vbox->setPalette( pal );
|
||||
vbox->setAutoFillBackground( true );
|
||||
|
||||
QVBoxLayout* vboxl = new QVBoxLayout( this );
|
||||
QVBoxLayout* vboxl = new QVBoxLayout();
|
||||
TomahawkUtils::unmarginLayout( vboxl );
|
||||
vboxl->setContentsMargins( 32, 32, 32, 32 );
|
||||
vboxl->setSpacing( 32 );
|
||||
@@ -71,11 +71,11 @@ ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||
vbox->setLayout( vboxl );
|
||||
|
||||
QWidget* hbox = new QWidget;
|
||||
QHBoxLayout* hboxl = new QHBoxLayout( this );
|
||||
QHBoxLayout* hboxl = new QHBoxLayout();
|
||||
TomahawkUtils::unmarginLayout( hboxl );
|
||||
hboxl->setSpacing( 32 );
|
||||
|
||||
m_innerLayout = new QVBoxLayout( this );
|
||||
m_innerLayout = new QVBoxLayout();
|
||||
TomahawkUtils::unmarginLayout( m_innerLayout );
|
||||
m_innerLayout->addWidget( m_trackView, 1 );
|
||||
m_innerLayout->addStretch();
|
||||
|
@@ -566,3 +566,10 @@ GridView::onScrollTimeout()
|
||||
m_proxyModel->updateDetailedInfo( m_proxyModel->index( i, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlayableModel*
|
||||
GridView::model() const
|
||||
{
|
||||
return m_model.data();
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
void setProxyModel( PlayableProxyModel* model );
|
||||
|
||||
PlayableModel* model() const { return m_model; }
|
||||
PlayableModel* model() const;
|
||||
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
|
||||
GridItemDelegate* delegate() const { return m_delegate; }
|
||||
|
||||
@@ -117,7 +117,7 @@ private slots:
|
||||
void verifySize();
|
||||
|
||||
private:
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
PlayableProxyModel* m_proxyModel;
|
||||
GridItemDelegate* m_delegate;
|
||||
AnimatedSpinner* m_loadingSpinner;
|
||||
|
@@ -137,7 +137,7 @@ private:
|
||||
bool visibilityFilterAcceptsRow( int sourceRow, const QModelIndex& sourceParent, PlayableProxyModelFilterMemo& memo ) const;
|
||||
bool lessThan( int column, const Tomahawk::query_ptr& left, const Tomahawk::query_ptr& right ) const;
|
||||
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
|
||||
bool m_showOfflineResults;
|
||||
bool m_hideEmptyParents;
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include <QPainter>
|
||||
#include <QToolTip>
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
#include "Query.h"
|
||||
#include "Result.h"
|
||||
#include "Artist.h"
|
||||
@@ -673,7 +671,7 @@ PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem&
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen( Qt::transparent );
|
||||
painter->setBrush( Qt::darkRed );
|
||||
painter->setBrush( QColor( "#ff004c" ));
|
||||
|
||||
QRect playBar = r.adjusted( 0, r.height() + 2, 0, 0 );
|
||||
playBar.setHeight( 2 );
|
||||
|
@@ -941,3 +941,10 @@ TrackView::selectFirstTrack()
|
||||
currentChanged( idx, QModelIndex() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlayableModel*
|
||||
TrackView::model() const
|
||||
{
|
||||
return m_model.data();
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
virtual void setModel( QAbstractItemModel* model );
|
||||
void setProxyModel( PlayableProxyModel* model );
|
||||
|
||||
virtual PlayableModel* model() const { return m_model; }
|
||||
virtual PlayableModel* model() const;
|
||||
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
|
||||
PlaylistItemDelegate* delegate() const { return m_delegate; }
|
||||
ViewHeader* header() const { return m_header; }
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
void updateHoverIndex( const QPoint& pos );
|
||||
|
||||
QString m_guid;
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
PlayableProxyModel* m_proxyModel;
|
||||
PlaylistItemDelegate* m_delegate;
|
||||
ViewHeader* m_header;
|
||||
|
@@ -131,30 +131,6 @@ TreeModel::fetchMore( const QModelIndex& parent )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::addAllCollections()
|
||||
{
|
||||
startLoading();
|
||||
|
||||
DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists();
|
||||
|
||||
connect( cmd, SIGNAL( artists( QList<Tomahawk::artist_ptr> ) ),
|
||||
SLOT( onArtistsAdded( QList<Tomahawk::artist_ptr> ) ) );
|
||||
|
||||
Database::instance()->enqueue( Tomahawk::dbcmd_ptr( cmd ) );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ), Qt::UniqueConnection );
|
||||
|
||||
QList<Tomahawk::source_ptr> sources = SourceList::instance()->sources();
|
||||
foreach ( const source_ptr& source, sources )
|
||||
{
|
||||
connect( source->dbCollection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
setTitle( tr( "All Artists" ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::addArtists( const artist_ptr& artist )
|
||||
{
|
||||
@@ -262,25 +238,12 @@ TreeModel::addCollection( const collection_ptr& collection )
|
||||
this, SLOT( onArtistsAdded( QList< Tomahawk::artist_ptr > ) ), Qt::UniqueConnection );
|
||||
req->enqueue();
|
||||
|
||||
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||
|
||||
setIcon( collection->bigIcon() );
|
||||
setTitle( collection->prettyName() );
|
||||
setDescription( collection->description() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::reloadCollection()
|
||||
{
|
||||
if ( m_collection.isNull() )
|
||||
return;
|
||||
|
||||
if ( !isLoading() )
|
||||
onCollectionChanged();
|
||||
}
|
||||
|
||||
|
||||
//void
|
||||
//TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order )
|
||||
//{
|
||||
@@ -305,25 +268,6 @@ TreeModel::reloadCollection()
|
||||
//}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::onSourceAdded( const Tomahawk::source_ptr& source )
|
||||
{
|
||||
connect( source->dbCollection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::onCollectionChanged()
|
||||
{
|
||||
clear();
|
||||
|
||||
if ( m_collection )
|
||||
addCollection( m_collection );
|
||||
else
|
||||
addAllCollections();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeModel::onArtistsAdded( const QList<Tomahawk::artist_ptr>& artists )
|
||||
{
|
||||
|
@@ -51,7 +51,6 @@ public:
|
||||
|
||||
Tomahawk::collection_ptr collection() const;
|
||||
|
||||
void addAllCollections();
|
||||
void addCollection( const Tomahawk::collection_ptr& collection );
|
||||
//TODO: Unused, but will be useful for supporting filtered queries. - Teo 1/2013
|
||||
//void addFilteredCollection( const Tomahawk::collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order );
|
||||
@@ -71,7 +70,6 @@ public:
|
||||
|
||||
public slots:
|
||||
void addAlbums( const QModelIndex& parent, const QList<Tomahawk::album_ptr>& albums );
|
||||
void reloadCollection();
|
||||
|
||||
signals:
|
||||
void modeChanged( Tomahawk::ModelMode mode );
|
||||
@@ -86,9 +84,6 @@ private slots:
|
||||
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QModelIndex& index );
|
||||
void onTracksFound( const QList<Tomahawk::query_ptr>& tracks, Tomahawk::ModelMode mode, Tomahawk::collection_ptr collection );
|
||||
|
||||
void onSourceAdded( const Tomahawk::source_ptr& source );
|
||||
void onCollectionChanged();
|
||||
|
||||
private:
|
||||
Tomahawk::ModelMode m_mode;
|
||||
Tomahawk::collection_ptr m_collection;
|
||||
|
@@ -45,7 +45,7 @@ TreeProxyModel::TreeProxyModel( QObject* parent )
|
||||
void
|
||||
TreeProxyModel::setSourcePlayableModel( TreeModel* model )
|
||||
{
|
||||
if ( sourceModel() )
|
||||
if ( m_model )
|
||||
{
|
||||
disconnect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( onRowsInserted( QModelIndex, int, int ) ) );
|
||||
disconnect( m_model, SIGNAL( modelReset() ), this, SLOT( onModelReset() ) );
|
||||
@@ -54,7 +54,7 @@ TreeProxyModel::setSourcePlayableModel( TreeModel* model )
|
||||
PlayableProxyModel::setSourcePlayableModel( model );
|
||||
m_model = model;
|
||||
|
||||
if ( sourceModel() )
|
||||
if ( m_model )
|
||||
{
|
||||
connect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onRowsInserted( QModelIndex, int, int ) ) );
|
||||
connect( m_model, SIGNAL( modelReset() ), SLOT( onModelReset() ) );
|
||||
|
@@ -78,7 +78,7 @@ private:
|
||||
Tomahawk::ArtistsRequest* m_artistsFilterCmd;
|
||||
|
||||
QString m_filter;
|
||||
TreeModel* m_model;
|
||||
QPointer<TreeModel> m_model;
|
||||
};
|
||||
|
||||
#endif // TREEPROXYMODEL_H
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "FlexibleTreeView.h"
|
||||
#include "CollectionViewPage.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QStackedWidget>
|
||||
@@ -29,7 +29,8 @@
|
||||
#include "playlist/ColumnView.h"
|
||||
#include "playlist/TrackView.h"
|
||||
#include "playlist/GridView.h"
|
||||
#include "PlayableProxyModelPlaylistInterface.h"
|
||||
#include "playlist/PlayableProxyModelPlaylistInterface.h"
|
||||
#include "resolvers/ScriptCollection.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
@@ -40,7 +41,7 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collection, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_header( new FilterHeader( this ) )
|
||||
, m_columnView( new ColumnView() )
|
||||
@@ -48,22 +49,16 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
, m_albumView( new GridView() )
|
||||
, m_model( 0 )
|
||||
, m_flatModel( 0 )
|
||||
, m_temporary( false )
|
||||
, m_albumModel( 0 )
|
||||
{
|
||||
qRegisterMetaType< FlexibleTreeViewMode >( "FlexibleTreeViewMode" );
|
||||
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
|
||||
|
||||
m_header->setBackgroundColor( Qt::black );
|
||||
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background_small.png", QSize( 0, 0 ) ), false );
|
||||
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
|
||||
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultCollection, TomahawkUtils::Original, QSize( 256, 256 ) ) );
|
||||
|
||||
// m_trackView->setPlaylistInterface( m_playlistInterface );
|
||||
// m_columnView->setPlaylistInterface( m_trackView->proxyModel()->playlistInterface() );
|
||||
// m_gridView->setPlaylistInterface( m_trackView->proxyModel()->playlistInterface() );
|
||||
|
||||
/* m_columnView->setColumnHidden( PlayableModel::Age, true ); // Hide age column per default
|
||||
m_columnView->setColumnHidden( PlayableModel::Filesize, true ); // Hide filesize column per default
|
||||
m_columnView->setColumnHidden( PlayableModel::Composer, true ); // Hide composer column per default*/
|
||||
m_columnView->proxyModel()->setStyle( PlayableProxyModel::Collection );
|
||||
|
||||
m_trackView->setColumnHidden( PlayableModel::Composer, true );
|
||||
m_trackView->setColumnHidden( PlayableModel::Origin, true );
|
||||
m_trackView->setColumnHidden( PlayableModel::Score, true );
|
||||
m_trackView->setGuid( QString( "trackview/flat" ) );
|
||||
@@ -71,7 +66,6 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
{
|
||||
m_albumView->setAutoResize( false );
|
||||
m_albumView->setAutoFitItems( true );
|
||||
// m_albumView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
m_albumView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
m_albumView->setItemSize( QSize( 170, 170 + 56 ) );
|
||||
|
||||
@@ -105,14 +99,12 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
m_header->ui->anchor2Label->setFixedWidth( fm.width( m_header->ui->anchor2Label->text() ) + 16 );
|
||||
m_header->ui->anchor3Label->setFixedWidth( fm.width( m_header->ui->anchor3Label->text() ) + 16 );
|
||||
|
||||
NewClosure( m_header->ui->anchor1Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Columns )->setAutoDelete( false );
|
||||
NewClosure( m_header->ui->anchor2Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Albums )->setAutoDelete( false );
|
||||
NewClosure( m_header->ui->anchor3Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Flat )->setAutoDelete( false );
|
||||
NewClosure( m_header->ui->anchor1Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Columns )->setAutoDelete( false );
|
||||
NewClosure( m_header->ui->anchor2Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Albums )->setAutoDelete( false );
|
||||
NewClosure( m_header->ui->anchor3Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Flat )->setAutoDelete( false );
|
||||
}
|
||||
|
||||
layout()->addWidget( m_header );
|
||||
if ( extraHeader )
|
||||
layout()->addWidget( extraHeader );
|
||||
layout()->addWidget( m_stack );
|
||||
|
||||
m_stack->addWidget( m_columnView );
|
||||
@@ -120,108 +112,89 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
m_stack->addWidget( m_trackView );
|
||||
|
||||
connect( m_header, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
||||
|
||||
loadCollection( collection );
|
||||
}
|
||||
|
||||
|
||||
FlexibleTreeView::~FlexibleTreeView()
|
||||
CollectionViewPage::~CollectionViewPage()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setTrackView( TrackView* view )
|
||||
CollectionViewPage::loadCollection( const collection_ptr& collection )
|
||||
{
|
||||
if ( m_trackView )
|
||||
if ( m_collection )
|
||||
{
|
||||
m_stack->removeWidget( m_trackView );
|
||||
delete m_trackView;
|
||||
disconnect( collection.data(), SIGNAL( changed() ), this, SLOT( onCollectionChanged() ) );
|
||||
}
|
||||
|
||||
// view->setPlaylistInterface( m_playlistInterface );
|
||||
m_collection = collection;
|
||||
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||
|
||||
m_trackView = view;
|
||||
m_stack->addWidget( view );
|
||||
onCollectionChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setColumnView( ColumnView* view )
|
||||
CollectionViewPage::setTreeModel( TreeModel* model )
|
||||
{
|
||||
if ( m_columnView )
|
||||
{
|
||||
m_stack->removeWidget( m_columnView );
|
||||
delete m_columnView;
|
||||
}
|
||||
|
||||
connect( view, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ), Qt::UniqueConnection );
|
||||
|
||||
// view->setPlaylistInterface( m_trackView->proxyModel()->playlistInterface() );
|
||||
|
||||
m_columnView = view;
|
||||
m_stack->addWidget( view );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setTreeModel( TreeModel* model )
|
||||
{
|
||||
if ( m_model )
|
||||
{
|
||||
disconnect( m_model, SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
delete m_model;
|
||||
}
|
||||
|
||||
QPointer<PlayableModel> oldModel = m_model;
|
||||
m_model = model;
|
||||
|
||||
// m_trackView->setPlayableModel( model );
|
||||
m_columnView->setTreeModel( model );
|
||||
|
||||
/* m_trackView->setSortingEnabled( false );
|
||||
m_trackView->sortByColumn( -1 );
|
||||
m_trackView->proxyModel()->sort( -1 );
|
||||
m_columnView->proxyModel()->sort( -1 );
|
||||
m_gridView->proxyModel()->sort( -1 );*/
|
||||
|
||||
connect( model, SIGNAL( changed() ), SLOT( onModelChanged() ), Qt::UniqueConnection );
|
||||
onModelChanged();
|
||||
|
||||
if ( oldModel )
|
||||
{
|
||||
disconnect( oldModel.data(), SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
delete oldModel.data();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setFlatModel( PlayableModel* model )
|
||||
CollectionViewPage::setFlatModel( PlayableModel* model )
|
||||
{
|
||||
if ( m_flatModel )
|
||||
{
|
||||
// disconnect( m_flatModel, SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
delete m_flatModel;
|
||||
}
|
||||
QPointer<PlayableModel> oldModel = m_flatModel;
|
||||
|
||||
m_flatModel = model;
|
||||
|
||||
m_trackView->setPlayableModel( model );
|
||||
|
||||
m_trackView->setSortingEnabled( true );
|
||||
m_trackView->sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
/* connect( model, SIGNAL( changed() ), SLOT( onModelChanged() ), Qt::UniqueConnection );
|
||||
onModelChanged();*/
|
||||
if ( oldModel )
|
||||
{
|
||||
disconnect( oldModel.data(), SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
delete oldModel.data();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setAlbumModel( PlayableModel* model )
|
||||
CollectionViewPage::setAlbumModel( PlayableModel* model )
|
||||
{
|
||||
QPointer<PlayableModel> oldModel = m_albumModel;
|
||||
|
||||
if ( m_albumModel )
|
||||
delete m_albumModel;
|
||||
|
||||
m_albumModel = model;
|
||||
m_albumView->setPlayableModel( model );
|
||||
|
||||
/* connect( model, SIGNAL( changed() ), SLOT( onModelChanged() ), Qt::UniqueConnection );
|
||||
* onModelChanged();*/
|
||||
if ( oldModel )
|
||||
{
|
||||
disconnect( oldModel.data(), SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
delete oldModel.data();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
|
||||
CollectionViewPage::setCurrentMode( CollectionViewPageMode mode )
|
||||
{
|
||||
if ( m_mode != mode )
|
||||
{
|
||||
@@ -289,35 +262,35 @@ FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
FlexibleTreeView::playlistInterface() const
|
||||
CollectionViewPage::playlistInterface() const
|
||||
{
|
||||
return m_columnView->proxyModel()->playlistInterface();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
FlexibleTreeView::title() const
|
||||
CollectionViewPage::title() const
|
||||
{
|
||||
return m_model->title();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
FlexibleTreeView::description() const
|
||||
CollectionViewPage::description() const
|
||||
{
|
||||
return m_model->description();
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
FlexibleTreeView::pixmap() const
|
||||
CollectionViewPage::pixmap() const
|
||||
{
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
FlexibleTreeView::jumpToCurrentTrack()
|
||||
CollectionViewPage::jumpToCurrentTrack()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
|
||||
@@ -333,7 +306,7 @@ FlexibleTreeView::jumpToCurrentTrack()
|
||||
|
||||
|
||||
bool
|
||||
FlexibleTreeView::setFilter( const QString& pattern )
|
||||
CollectionViewPage::setFilter( const QString& pattern )
|
||||
{
|
||||
ViewPage::setFilter( pattern );
|
||||
|
||||
@@ -346,27 +319,29 @@ FlexibleTreeView::setFilter( const QString& pattern )
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::restoreViewMode()
|
||||
CollectionViewPage::restoreViewMode()
|
||||
{
|
||||
//FIXME: needs be moved to TomahawkSettings
|
||||
TomahawkSettings::instance()->beginGroup( "ui" );
|
||||
int modeNumber = TomahawkSettings::instance()->value( "flexibleTreeViewMode", Columns ).toInt();
|
||||
m_mode = static_cast< FlexibleTreeViewMode >( modeNumber );
|
||||
m_mode = static_cast< CollectionViewPageMode >( modeNumber );
|
||||
TomahawkSettings::instance()->endGroup();
|
||||
|
||||
setCurrentMode( (FlexibleTreeViewMode)modeNumber );
|
||||
setCurrentMode( (CollectionViewPageMode)modeNumber );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setEmptyTip( const QString& tip )
|
||||
CollectionViewPage::setEmptyTip( const QString& tip )
|
||||
{
|
||||
m_columnView->setEmptyTip( tip );
|
||||
m_albumView->setEmptyTip( tip );
|
||||
m_trackView->setEmptyTip( tip );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
CollectionViewPage::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
{
|
||||
m_pixmap = pixmap;
|
||||
m_header->setPixmap( pixmap, tinted );
|
||||
@@ -374,40 +349,50 @@ FlexibleTreeView::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::onModelChanged()
|
||||
CollectionViewPage::onModelChanged()
|
||||
{
|
||||
setPixmap( m_model->icon(), false );
|
||||
m_header->setCaption( m_model->title() );
|
||||
m_header->setDescription( m_model->description() );
|
||||
|
||||
setEmptyTip( tr( "This collection is currently empty." ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::onWidgetDestroyed( QWidget* widget )
|
||||
CollectionViewPage::onCollectionChanged()
|
||||
{
|
||||
Q_UNUSED( widget );
|
||||
emit destroyed( this );
|
||||
TreeModel* model = new TreeModel();
|
||||
PlayableModel* flatModel = new PlayableModel();
|
||||
PlayableModel* albumModel = new PlayableModel();
|
||||
|
||||
setTreeModel( model );
|
||||
setFlatModel( flatModel );
|
||||
setAlbumModel( albumModel );
|
||||
|
||||
model->addCollection( m_collection );
|
||||
flatModel->appendTracks( m_collection );
|
||||
albumModel->appendAlbums( m_collection );
|
||||
|
||||
if ( m_collection && m_collection->source() && m_collection->source()->isLocal() )
|
||||
{
|
||||
setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
|
||||
}
|
||||
else
|
||||
setEmptyTip( tr( "This collection is empty." ) );
|
||||
|
||||
if ( m_collection.objectCast<ScriptCollection>() )
|
||||
m_trackView->setEmptyTip( tr( "Cloud collections aren't supported in the flat view yet. We will have them covered soon. Switch to another view to navigate them." ) );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
FlexibleTreeView::isTemporaryPage() const
|
||||
CollectionViewPage::isTemporaryPage() const
|
||||
{
|
||||
return m_temporary;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setTemporaryPage( bool b )
|
||||
{
|
||||
m_temporary = b;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
FlexibleTreeView::isBeingPlayed() const
|
||||
CollectionViewPage::isBeingPlayed() const
|
||||
{
|
||||
if ( !playlistInterface() )
|
||||
return false;
|
@@ -17,8 +17,8 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FLEXIBLETREEVIEW_H
|
||||
#define FLEXIBLETREEVIEW_H
|
||||
#ifndef COLLECTIONVIEWPAGE_H
|
||||
#define COLLECTIONVIEWPAGE_H
|
||||
|
||||
#include "ViewPage.h"
|
||||
#include "PlaylistInterface.h"
|
||||
@@ -34,16 +34,16 @@ class PlayableModel;
|
||||
class PlaylistModel;
|
||||
class FilterHeader;
|
||||
|
||||
class DLLEXPORT FlexibleTreeView : public QWidget, public Tomahawk::ViewPage
|
||||
class DLLEXPORT CollectionViewPage : public QWidget, public Tomahawk::ViewPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum FlexibleTreeViewMode
|
||||
enum CollectionViewPageMode
|
||||
{ Columns = 0, Albums = 1, Flat = 2 };
|
||||
|
||||
explicit FlexibleTreeView( QWidget* parent = 0, QWidget* extraHeader = 0 );
|
||||
~FlexibleTreeView();
|
||||
explicit CollectionViewPage( const Tomahawk::collection_ptr& collection, QWidget* parent = 0 );
|
||||
~CollectionViewPage();
|
||||
|
||||
virtual QWidget* widget() { return this; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||
@@ -55,13 +55,6 @@ public:
|
||||
virtual bool jumpToCurrentTrack();
|
||||
virtual bool isTemporaryPage() const;
|
||||
virtual bool isBeingPlayed() const;
|
||||
void setTemporaryPage( bool b );
|
||||
|
||||
ColumnView* columnView() const { return m_columnView; }
|
||||
TrackView* trackView() const { return m_trackView; }
|
||||
|
||||
void setColumnView( ColumnView* view );
|
||||
void setTrackView( TrackView* view );
|
||||
|
||||
void setTreeModel( TreeModel* model );
|
||||
void setFlatModel( PlayableModel* model );
|
||||
@@ -71,17 +64,19 @@ public:
|
||||
void setEmptyTip( const QString& tip );
|
||||
|
||||
public slots:
|
||||
void setCurrentMode( FlexibleTreeViewMode mode );
|
||||
void setCurrentMode( CollectionViewPageMode mode );
|
||||
virtual bool setFilter( const QString& pattern );
|
||||
void restoreViewMode(); //ViewManager calls this on every show
|
||||
|
||||
void loadCollection( const Tomahawk::collection_ptr& collection );
|
||||
|
||||
signals:
|
||||
void modeChanged( FlexibleTreeViewMode mode );
|
||||
void modeChanged( CollectionViewPageMode mode );
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
private slots:
|
||||
void onModelChanged();
|
||||
void onWidgetDestroyed( QWidget* widget );
|
||||
void onCollectionChanged();
|
||||
|
||||
private:
|
||||
FilterHeader* m_header;
|
||||
@@ -96,10 +91,11 @@ private:
|
||||
PlayableModel* m_albumModel;
|
||||
QStackedWidget* m_stack;
|
||||
|
||||
FlexibleTreeViewMode m_mode;
|
||||
bool m_temporary;
|
||||
Tomahawk::collection_ptr m_collection;
|
||||
|
||||
CollectionViewPageMode m_mode;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( FlexibleTreeView::FlexibleTreeViewMode );
|
||||
Q_DECLARE_METATYPE( CollectionViewPage::CollectionViewPageMode );
|
||||
|
||||
#endif // FLEXIBLETREEVIEW_H
|
||||
#endif // COLLECTIONVIEWPAGE_H
|
@@ -46,7 +46,7 @@ AccountWidget::AccountWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, TomahawkUtils::DpiScaler( this )
|
||||
{
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout( this );
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout();
|
||||
TomahawkUtils::unmarginLayout( mainLayout );
|
||||
setLayout( mainLayout );
|
||||
setContentsMargins( 0, scaledY( 8 ), 0, scaledY( 8 ) );
|
||||
@@ -55,7 +55,7 @@ AccountWidget::AccountWidget( QWidget* parent )
|
||||
mainLayout->addWidget( m_imageLabel );
|
||||
mainLayout->setSpacing( scaledX( 4 ) );
|
||||
|
||||
QGridLayout* vLayout = new QGridLayout( this );
|
||||
QGridLayout* vLayout = new QGridLayout();
|
||||
vLayout->setSpacing( 8 );
|
||||
mainLayout->addLayout( vLayout );
|
||||
|
||||
@@ -63,7 +63,7 @@ AccountWidget::AccountWidget( QWidget* parent )
|
||||
idContainer->setAttribute( Qt::WA_TranslucentBackground, false );
|
||||
vLayout->addWidget( idContainer, 0, 0 );
|
||||
|
||||
QHBoxLayout* idContLayout = new QHBoxLayout( idContainer );
|
||||
QHBoxLayout* idContLayout = new QHBoxLayout();
|
||||
idContainer->setLayout( idContLayout );
|
||||
idContainer->setContentsMargins( 0, 0, 0, 0 );
|
||||
idContLayout->setMargin( 2 );
|
||||
@@ -96,7 +96,7 @@ AccountWidget::AccountWidget( QWidget* parent )
|
||||
m_statusToggle->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_statusToggle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
|
||||
m_statusToggle->setFixedSize( m_statusToggle->sizeHint() );
|
||||
QHBoxLayout *statusToggleLayout = new QHBoxLayout( this );
|
||||
QHBoxLayout *statusToggleLayout = new QHBoxLayout();
|
||||
vLayout->addLayout( statusToggleLayout, 0, 1, 1, 1 );
|
||||
statusToggleLayout->addStretch();
|
||||
statusToggleLayout->addWidget( m_statusToggle );
|
||||
@@ -109,7 +109,7 @@ AccountWidget::AccountWidget( QWidget* parent )
|
||||
m_inviteContainer->setContentsMargins( 1, 1, 1, 2 );
|
||||
m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false );
|
||||
|
||||
QHBoxLayout* containerLayout = new QHBoxLayout( m_inviteContainer );
|
||||
QHBoxLayout* containerLayout = new QHBoxLayout();
|
||||
m_inviteContainer->setLayout( containerLayout );
|
||||
TomahawkUtils::unmarginLayout( containerLayout );
|
||||
containerLayout->setContentsMargins( 1, 1, 0, 0 );
|
||||
|