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