1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 23:26:40 +02:00

* Move topbar into PlaylistManager's widget, making it essentially a playlist's private toolbar.

This commit is contained in:
Christian Muehlhaeuser
2011-01-28 00:36:51 +01:00
parent de530dd775
commit f105b18560
7 changed files with 45 additions and 45 deletions

View File

@@ -14,7 +14,7 @@ ELSE()
ENDIF() ENDIF()
FIND_PACKAGE( Taglib 1.6.0 REQUIRED ) FIND_PACKAGE( Taglib 1.6.0 REQUIRED )
FIND_PACKAGE( LibLastFm REQUIRED ) FIND_PACKAGE( LibLastFm 0.3.3 REQUIRED )
FIND_PACKAGE( LibEchonest REQUIRED ) FIND_PACKAGE( LibEchonest REQUIRED )
IF( UNIX AND NOT APPLE ) IF( UNIX AND NOT APPLE )

View File

@@ -10,8 +10,8 @@ find_path(LIBLASTFM_INCLUDE_DIR NAMES Audioscrobbler
HINTS HINTS
~/usr/include ~/usr/include
/opt/local/include /opt/local/include
/usr/include
/usr/local/include /usr/local/include
/usr/include
/opt/kde4/include /opt/kde4/include
${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}
PATH_SUFFIXES lastfm PATH_SUFFIXES lastfm
@@ -21,9 +21,9 @@ find_library( LIBLASTFM_LIBRARY NAMES lastfm
PATHS PATHS
~/usr/lib ~/usr/lib
/opt/local/lib /opt/local/lib
/usr/local/lib
/usr/lib /usr/lib
/usr/lib64 /usr/lib64
/usr/local/lib
/opt/kde4/lib /opt/kde4/lib
${KDE4_LIB_DIR} ${KDE4_LIB_DIR}
) )

View File

@@ -169,7 +169,7 @@ DatabaseWorker::doWork()
} }
if ( m_outstanding > 0 ) if ( m_outstanding > 0 )
doWork(); QTimer::singleShot( 0, this, SLOT( doWork() ) );
} }

View File

@@ -4,6 +4,8 @@
#include "audio/audioengine.h" #include "audio/audioengine.h"
#include "utils/animatedsplitter.h" #include "utils/animatedsplitter.h"
#include "topbar/topbar.h"
#include "widgets/infowidgets/sourceinfowidget.h"
#include "collectionmodel.h" #include "collectionmodel.h"
#include "collectionflatmodel.h" #include "collectionflatmodel.h"
@@ -19,8 +21,6 @@
#include "sourcelist.h" #include "sourcelist.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "widgets/infowidgets/sourceinfowidget.h"
#define FILTER_TIMEOUT 280 #define FILTER_TIMEOUT 280
PlaylistManager* PlaylistManager::s_instance = 0; PlaylistManager* PlaylistManager::s_instance = 0;
@@ -43,10 +43,12 @@ PlaylistManager::PlaylistManager( QObject* parent )
, m_modesAvailable( false ) , m_modesAvailable( false )
{ {
s_instance = this; s_instance = this;
m_stack = new QStackedWidget();
m_widget->setLayout( new QVBoxLayout() ); m_widget->setLayout( new QVBoxLayout() );
m_topbar = new TopBar();
m_stack = new QStackedWidget();
m_splitter = new AnimatedSplitter(); m_splitter = new AnimatedSplitter();
m_splitter->setOrientation( Qt::Vertical ); m_splitter->setOrientation( Qt::Vertical );
m_splitter->setChildrenCollapsible( false ); m_splitter->setChildrenCollapsible( false );
@@ -62,6 +64,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
m_splitter->hide( 1, false ); m_splitter->hide( 1, false );
m_widget->layout()->setMargin( 0 ); m_widget->layout()->setMargin( 0 );
m_widget->layout()->addWidget( m_topbar );
m_widget->layout()->addWidget( m_splitter ); m_widget->layout()->addWidget( m_splitter );
m_superCollectionView = new CollectionView(); m_superCollectionView = new CollectionView();
@@ -81,6 +84,36 @@ PlaylistManager::PlaylistManager( QObject* parent )
m_widget->layout()->setMargin( 0 ); m_widget->layout()->setMargin( 0 );
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) ); connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
connect( m_topbar, SIGNAL( filterTextChanged( QString ) ),
this, SLOT( setFilter( QString ) ) );
connect( this, SIGNAL( numSourcesChanged( unsigned int ) ),
m_topbar, SLOT( setNumSources( unsigned int ) ) );
connect( this, SIGNAL( numTracksChanged( unsigned int ) ),
m_topbar, SLOT( setNumTracks( unsigned int ) ) );
connect( this, SIGNAL( numArtistsChanged( unsigned int ) ),
m_topbar, SLOT( setNumArtists( unsigned int ) ) );
connect( this, SIGNAL( numShownChanged( unsigned int ) ),
m_topbar, SLOT( setNumShown( unsigned int ) ) );
connect( m_topbar, SIGNAL( flatMode() ),
this, SLOT( setTableMode() ) );
connect( m_topbar, SIGNAL( artistMode() ),
this, SLOT( setTreeMode() ) );
connect( m_topbar, SIGNAL( albumMode() ),
this, SLOT( setAlbumMode() ) );
connect( this, SIGNAL( statsAvailable( bool ) ),
m_topbar, SLOT( setStatsVisible( bool ) ) );
connect( this, SIGNAL( modesAvailable( bool ) ),
m_topbar, SLOT( setModesVisible( bool ) ) );
} }
@@ -493,7 +526,7 @@ PlaylistManager::linkPlaylist()
m_interfaceHistory << m_currentInterface; m_interfaceHistory << m_currentInterface;
} }
applyFilter(); // applyFilter();
AudioEngine::instance()->setPlaylist( m_currentInterface ); AudioEngine::instance()->setPlaylist( m_currentInterface );
if ( m_currentInterface && m_statsAvailable ) if ( m_currentInterface && m_statsAvailable )

View File

@@ -23,6 +23,7 @@ class TrackProxyModel;
class TrackModel; class TrackModel;
class TrackView; class TrackView;
class SourceInfoWidget; class SourceInfoWidget;
class TopBar;
class DLLEXPORT PlaylistManager : public QObject class DLLEXPORT PlaylistManager : public QObject
{ {
@@ -85,6 +86,7 @@ private:
void linkPlaylist(); void linkPlaylist();
QWidget* m_widget; QWidget* m_widget;
TopBar* m_topbar;
QStackedWidget* m_stack; QStackedWidget* m_stack;
AnimatedSplitter* m_splitter; AnimatedSplitter* m_splitter;

View File

@@ -22,7 +22,6 @@
#include "network/controlconnection.h" #include "network/controlconnection.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
#include "sip/SipHandler.h" #include "sip/SipHandler.h"
#include "topbar/topbar.h"
#include "utils/proxystyle.h" #include "utils/proxystyle.h"
#include "utils/widgetdragfilter.h" #include "utils/widgetdragfilter.h"
#include "utils/xspfloader.h" #include "utils/xspfloader.h"
@@ -41,7 +40,6 @@ using namespace Tomahawk;
TomahawkWindow::TomahawkWindow( QWidget* parent ) TomahawkWindow::TomahawkWindow( QWidget* parent )
: QMainWindow( parent ) : QMainWindow( parent )
, ui( new Ui::TomahawkWindow ) , ui( new Ui::TomahawkWindow )
, m_topbar( new TopBar( this ) )
, m_audioControls( new AudioControls( this ) ) , m_audioControls( new AudioControls( this ) )
, m_trayIcon( new TomahawkTrayIcon( this ) ) , m_trayIcon( new TomahawkTrayIcon( this ) )
{ {
@@ -68,12 +66,12 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
ui->sidebarSplitter->setStretchFactor( 1, 1 ); ui->sidebarSplitter->setStretchFactor( 1, 1 );
ui->sidebarSplitter->hide( 1, false ); ui->sidebarSplitter->hide( 1, false );
QToolBar* toolbar = addToolBar( "TomahawkToolbar" ); /* QToolBar* toolbar = addToolBar( "TomahawkToolbar" );
toolbar->setObjectName( "TomahawkToolbar" ); toolbar->setObjectName( "TomahawkToolbar" );
toolbar->addWidget( m_topbar ); toolbar->addWidget( m_topbar );
toolbar->setMovable( false ); toolbar->setMovable( false );
toolbar->setFloatable( false ); toolbar->setFloatable( false );
toolbar->installEventFilter( new WidgetDragFilter( toolbar ) ); toolbar->installEventFilter( new WidgetDragFilter( toolbar ) );*/
statusBar()->addPermanentWidget( m_audioControls, 1 ); statusBar()->addPermanentWidget( m_audioControls, 1 );
@@ -115,37 +113,6 @@ TomahawkWindow::saveSettings()
void void
TomahawkWindow::setupSignals() TomahawkWindow::setupSignals()
{ {
// <Playlist>
connect( m_topbar, SIGNAL( filterTextChanged( const QString& ) ),
PlaylistManager::instance(), SLOT( setFilter( const QString& ) ) );
connect( PlaylistManager::instance(), SIGNAL( numSourcesChanged( unsigned int ) ),
m_topbar, SLOT( setNumSources( unsigned int ) ) );
connect( PlaylistManager::instance(), SIGNAL( numTracksChanged( unsigned int ) ),
m_topbar, SLOT( setNumTracks( unsigned int ) ) );
connect( PlaylistManager::instance(), SIGNAL( numArtistsChanged( unsigned int ) ),
m_topbar, SLOT( setNumArtists( unsigned int ) ) );
connect( PlaylistManager::instance(), SIGNAL( numShownChanged( unsigned int ) ),
m_topbar, SLOT( setNumShown( unsigned int ) ) );
connect( m_topbar, SIGNAL( flatMode() ),
PlaylistManager::instance(), SLOT( setTableMode() ) );
connect( m_topbar, SIGNAL( artistMode() ),
PlaylistManager::instance(), SLOT( setTreeMode() ) );
connect( m_topbar, SIGNAL( albumMode() ),
PlaylistManager::instance(), SLOT( setAlbumMode() ) );
connect( PlaylistManager::instance(), SIGNAL( statsAvailable( bool ) ),
m_topbar, SLOT( setStatsVisible( bool ) ) );
connect( PlaylistManager::instance(), SIGNAL( modesAvailable( bool ) ),
m_topbar, SLOT( setModesVisible( bool ) ) );
// <From PlaylistManager> // <From PlaylistManager>
connect( PlaylistManager::instance(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ), connect( PlaylistManager::instance(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ),
m_audioControls, SLOT( onRepeatModeChanged( PlaylistInterface::RepeatMode ) ) ); m_audioControls, SLOT( onRepeatModeChanged( PlaylistInterface::RepeatMode ) ) );

View File

@@ -12,7 +12,6 @@
class QAction; class QAction;
class AudioControls; class AudioControls;
class TopBar;
class TomahawkTrayIcon; class TomahawkTrayIcon;
namespace Ui namespace Ui
@@ -66,7 +65,6 @@ private:
void setupSignals(); void setupSignals();
Ui::TomahawkWindow* ui; Ui::TomahawkWindow* ui;
TopBar* m_topbar;
AudioControls* m_audioControls; AudioControls* m_audioControls;
TomahawkTrayIcon* m_trayIcon; TomahawkTrayIcon* m_trayIcon;
QNetworkAccessManager m_nam; QNetworkAccessManager m_nam;