mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
rework some startup order to load servent before UI components
This commit is contained in:
parent
5083849514
commit
a1c69b0b43
@ -74,6 +74,7 @@ ViewManager::ViewManager( QObject* parent )
|
||||
, m_whatsHotWidget( new WhatsHotWidget() )
|
||||
, m_topLovedWidget( 0 )
|
||||
, m_currentMode( PlaylistInterface::Tree )
|
||||
, m_loaded( false )
|
||||
{
|
||||
s_instance = this;
|
||||
|
||||
@ -112,6 +113,10 @@ ViewManager::ViewManager( QObject* parent )
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||
connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
||||
connect( m_infobar, SIGNAL( autoUpdateChanged( int ) ), SLOT( autoUpdateChanged( int ) ) );
|
||||
|
||||
connect( this, SIGNAL( tomahawkLoaded() ), m_whatsHotWidget, SLOT( fetchData() ) );
|
||||
connect( this, SIGNAL( tomahawkLoaded() ), m_welcomeWidget, SLOT( loadData() ) );
|
||||
|
||||
/* connect( m_infobar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
|
||||
connect( m_infobar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
|
||||
connect( m_infobar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );*/
|
||||
@ -811,6 +816,15 @@ ViewManager::createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVari
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::setTomahawkLoaded()
|
||||
{
|
||||
m_loaded = true;
|
||||
emit tomahawkLoaded();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ViewPage*
|
||||
ViewManager::pageForCollection( const collection_ptr& col ) const
|
||||
{
|
||||
|
@ -106,6 +106,8 @@ public:
|
||||
// linked to the sidebar. call it right after creating the playlist
|
||||
PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl );
|
||||
|
||||
bool isTomahawkLoaded() const { return m_loaded; }
|
||||
|
||||
signals:
|
||||
void numSourcesChanged( unsigned int sources );
|
||||
void numTracksChanged( unsigned int tracks );
|
||||
@ -130,6 +132,7 @@ signals:
|
||||
void showQueueRequested();
|
||||
void hideQueueRequested();
|
||||
|
||||
void tomahawkLoaded();
|
||||
public slots:
|
||||
Tomahawk::ViewPage* showSuperCollection();
|
||||
Tomahawk::ViewPage* showWelcomePage();
|
||||
@ -164,6 +167,8 @@ public slots:
|
||||
void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
|
||||
void setTomahawkLoaded();
|
||||
|
||||
private slots:
|
||||
void setFilter( const QString& filter );
|
||||
void applyFilter();
|
||||
@ -217,6 +222,8 @@ private:
|
||||
QTimer m_filterTimer;
|
||||
QString m_filter;
|
||||
|
||||
bool m_loaded;
|
||||
|
||||
static ViewManager* s_instance;
|
||||
};
|
||||
|
||||
|
@ -80,7 +80,6 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
|
||||
ui->additionsView->setAlbumModel( m_recentAlbumsModel );
|
||||
ui->additionsView->proxyModel()->sort( -1 );
|
||||
m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime, true );
|
||||
|
||||
m_timer = new QTimer( this );
|
||||
connect( m_timer, SIGNAL( timeout() ), SLOT( checkQueries() ) );
|
||||
@ -98,6 +97,14 @@ WelcomeWidget::~WelcomeWidget()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WelcomeWidget::loadData()
|
||||
{
|
||||
|
||||
m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime, true );
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
WelcomeWidget::playlistInterface() const
|
||||
{
|
||||
|
@ -105,6 +105,7 @@ public slots:
|
||||
void updatePlaylists();
|
||||
void updateRecentAdditions();
|
||||
|
||||
void loadData();
|
||||
private slots:
|
||||
void onSourcesReady();
|
||||
void onSourceAdded( const Tomahawk::source_ptr& source );
|
||||
|
@ -103,8 +103,6 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
||||
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
|
||||
|
||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||
|
||||
QTimer::singleShot( 0, this, SLOT( fetchData() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,9 +82,9 @@ signals:
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
public slots:
|
||||
void fetchData();
|
||||
|
||||
private slots:
|
||||
void fetchData();
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
void infoSystemFinished( QString target );
|
||||
void leftCrumbIndexChanged( QModelIndex );
|
||||
|
@ -75,9 +75,6 @@ public:
|
||||
|
||||
SourcesModel::CategoryType categoryType() { return m_category; }
|
||||
|
||||
signals:
|
||||
void toggleExpandRequest( SourceTreeItem* );
|
||||
|
||||
private:
|
||||
SourcesModel::CategoryType m_category;
|
||||
CategoryAddItem* m_addItem;
|
||||
|
@ -119,6 +119,8 @@ using namespace Tomahawk;
|
||||
|
||||
TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
: TOMAHAWK_APPLICATION( argc, argv )
|
||||
, m_headless( false )
|
||||
, m_loaded( false )
|
||||
{
|
||||
setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) );
|
||||
setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) );
|
||||
@ -423,7 +425,7 @@ TomahawkApp::registerMetaTypes()
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" );
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::InfoSystemCache* >( "Tomahawk::InfoSystem::InfoSystemCache*" );
|
||||
qRegisterMetaType< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
||||
|
||||
|
||||
qRegisterMetaTypeStreamOperators< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
||||
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
||||
|
||||
@ -516,7 +518,7 @@ TomahawkApp::initServent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Called after Servent emits ready()
|
||||
void
|
||||
TomahawkApp::initSIP()
|
||||
{
|
||||
@ -531,6 +533,9 @@ TomahawkApp::initSIP()
|
||||
//SipHandler::instance()->refreshProxy();
|
||||
SipHandler::instance()->loadFromConfig( true );
|
||||
}
|
||||
|
||||
m_loaded = true;
|
||||
emit tomahawkLoaded();
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,6 +89,11 @@ public:
|
||||
// PlatformInterface
|
||||
virtual bool loadUrl( const QString& url );
|
||||
|
||||
bool isTomahawkLoaded() const { return m_loaded; }
|
||||
|
||||
signals:
|
||||
void tomahawkLoaded();
|
||||
|
||||
public slots:
|
||||
virtual void activate();
|
||||
void instanceStarted( KDSingleApplicationGuard::Instance );
|
||||
@ -128,7 +133,7 @@ private:
|
||||
TomahawkWindow* m_mainwindow;
|
||||
#endif
|
||||
|
||||
bool m_headless;
|
||||
bool m_headless, m_loaded;
|
||||
|
||||
QxtHttpServerConnector m_connector;
|
||||
QxtHttpSessionManager m_session;
|
||||
|
@ -86,6 +86,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
ViewManager* vm = new ViewManager( this );
|
||||
connect( vm, SIGNAL( showQueueRequested() ), SLOT( showQueue() ) );
|
||||
connect( vm, SIGNAL( hideQueueRequested() ), SLOT( hideQueue() ) );
|
||||
connect( APP, SIGNAL( tomahawkLoaded() ), vm, SLOT( setTomahawkLoaded() ) ); // Pass loaded signal into libtomahawk so components in there can connect to ViewManager
|
||||
|
||||
ui->setupUi( this );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user