mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
Move SourcesModel initialization to TomahawkWindow
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
SourceTreeView::SourceTreeView( QWidget* parent, SourcesModel* model )
|
||||
: QTreeView( parent )
|
||||
, m_dragging( false )
|
||||
{
|
||||
@@ -85,7 +85,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
setContextMenuPolicy( Qt::CustomContextMenu );
|
||||
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
||||
|
||||
m_model = new SourcesModel( this );
|
||||
m_model = model;
|
||||
m_proxyModel = new SourcesProxyModel( m_model, this );
|
||||
connect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( selectRequest( QPersistentModelIndex ) ) );
|
||||
connect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expandRequest( QPersistentModelIndex ) ) );
|
||||
|
@@ -37,7 +37,7 @@ class SourceTreeView : public QTreeView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SourceTreeView( QWidget* parent = 0 );
|
||||
explicit SourceTreeView( QWidget* parent = 0, SourcesModel* model = 0 );
|
||||
|
||||
public slots:
|
||||
void showOfflineSources( bool offlineSourcesShown );
|
||||
|
@@ -174,7 +174,7 @@ TomahawkDesktopWindow::setupSideBar()
|
||||
m_searchWidget->setPlaceholderText( "Global Search..." );
|
||||
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
|
||||
|
||||
m_sourcetree = new SourceTreeView();
|
||||
m_sourcetree = new SourceTreeView( this, s_sourcesModel );
|
||||
TransferView* transferView = new TransferView( m_sidebar );
|
||||
PipelineStatusView* pipelineView = new PipelineStatusView( m_sidebar );
|
||||
|
||||
|
@@ -23,17 +23,22 @@
|
||||
#include "tomahawksettings.h"
|
||||
#include "tomahawktrayicon.h"
|
||||
#include "tomahawkapp.h"
|
||||
#include "sourcetree/sourcesmodel.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
SourcesModel* TomahawkWindow::s_sourcesModel = 0;
|
||||
|
||||
TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
: QMainWindow( parent )
|
||||
, m_trayIcon( new TomahawkTrayIcon( this ) )
|
||||
{
|
||||
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
|
||||
if( !s_sourcesModel )
|
||||
s_sourcesModel = new SourcesModel( this );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "result.h"
|
||||
|
||||
class SourcesModel;
|
||||
class TomahawkTrayIcon;
|
||||
|
||||
|
||||
@@ -51,6 +52,8 @@ private slots:
|
||||
virtual void maximize();
|
||||
|
||||
protected:
|
||||
static SourcesModel* s_sourcesModel;
|
||||
|
||||
QString m_windowTitle;
|
||||
TomahawkTrayIcon* m_trayIcon;
|
||||
Tomahawk::result_ptr m_currentTrack;
|
||||
|
Reference in New Issue
Block a user