diff --git a/src/libtomahawk/database/databasecommand_allalbums.cpp b/src/libtomahawk/database/databasecommand_allalbums.cpp index 5de1f6be0..f0b731291 100644 --- a/src/libtomahawk/database/databasecommand_allalbums.cpp +++ b/src/libtomahawk/database/databasecommand_allalbums.cpp @@ -169,6 +169,7 @@ DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi ) void DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi ) { + return; if ( !m_artist.isNull() ) { execForArtist( dbi ); diff --git a/src/libtomahawk/database/schema.sql b/src/libtomahawk/database/schema.sql index be05afdf1..e3c93c4b1 100644 --- a/src/libtomahawk/database/schema.sql +++ b/src/libtomahawk/database/schema.sql @@ -162,6 +162,7 @@ CREATE TABLE IF NOT EXISTS file ( ); CREATE UNIQUE INDEX file_url_src_uniq ON file(source, url); CREATE INDEX file_source ON file(source); +CREATE INDEX file_mtime ON file(mtime); -- mtime of dir when last scanned. -- load into memory when rescanning, skip stuff that's unchanged diff --git a/src/libtomahawk/sourceplaylistinterface.cpp b/src/libtomahawk/sourceplaylistinterface.cpp index d3ef4f011..41c6aef65 100644 --- a/src/libtomahawk/sourceplaylistinterface.cpp +++ b/src/libtomahawk/sourceplaylistinterface.cpp @@ -137,7 +137,7 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que { tDebug( LOGEXTRA ) << Q_FUNC_INFO; connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) ); - Pipeline::instance()->resolve( query, true ); + Pipeline::instance()->resolve( query ); m_gotNextItem = false; } diff --git a/src/libtomahawk/viewmanager.cpp b/src/libtomahawk/viewmanager.cpp index 674043939..0816d8203 100644 --- a/src/libtomahawk/viewmanager.cpp +++ b/src/libtomahawk/viewmanager.cpp @@ -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 { diff --git a/src/libtomahawk/viewmanager.h b/src/libtomahawk/viewmanager.h index e61a201d4..adce43cc6 100644 --- a/src/libtomahawk/viewmanager.h +++ b/src/libtomahawk/viewmanager.h @@ -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; }; diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index f0f22584f..145771d1c 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -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 { diff --git a/src/libtomahawk/widgets/welcomewidget.h b/src/libtomahawk/widgets/welcomewidget.h index 296fecfba..dc4e9250c 100644 --- a/src/libtomahawk/widgets/welcomewidget.h +++ b/src/libtomahawk/widgets/welcomewidget.h @@ -105,6 +105,7 @@ public slots: void updatePlaylists(); void updateRecentAdditions(); + void loadData(); private slots: void onSourcesReady(); void onSourceAdded( const Tomahawk::source_ptr& source ); diff --git a/src/libtomahawk/widgets/whatshotwidget.cpp b/src/libtomahawk/widgets/whatshotwidget.cpp index 114e12e61..bedad456a 100644 --- a/src/libtomahawk/widgets/whatshotwidget.cpp +++ b/src/libtomahawk/widgets/whatshotwidget.cpp @@ -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() ) ); } diff --git a/src/libtomahawk/widgets/whatshotwidget.h b/src/libtomahawk/widgets/whatshotwidget.h index 1ac2c6561..6e6801059 100644 --- a/src/libtomahawk/widgets/whatshotwidget.h +++ b/src/libtomahawk/widgets/whatshotwidget.h @@ -83,9 +83,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 ); diff --git a/src/mac/macdelegate.h b/src/mac/macdelegate.h index 7d684d39e..64b81a0ac 100644 --- a/src/mac/macdelegate.h +++ b/src/mac/macdelegate.h @@ -12,7 +12,7 @@ namespace Tomahawk { class PlatformInterface; } -#ifdef SNOW_LEOPARD +#if ( defined MAC_OS_X_VERSION_10_7 || defined SNOW_LEOPARD ) @interface AppDelegate :NSObject { #else @interface AppDelegate :NSObject { diff --git a/src/main.cpp b/src/main.cpp index 10591e684..4ad4ca4d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,10 +68,39 @@ inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states return in; } +#ifdef Q_OS_WIN +#include +#define argc __argc +#define argv __argv +// code taken from AbiWord, (c) AbiSource Inc. + +int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, + PSTR szCmdLine, int iCmdShow) +{ + if (fileno (stdout) != -1 && _get_osfhandle (fileno (stdout)) != -1) + { + /* stdout is fine, presumably redirected to a file or pipe */ + } + else + { + typedef BOOL (WINAPI * AttachConsole_t) (DWORD); + + AttachConsole_t p_AttachConsole = (AttachConsole_t) GetProcAddress (GetModuleHandleW(L"kernel32.dll"), "AttachConsole"); + + if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS)) + { + _wfreopen (L"CONOUT$", L"w", stdout); + dup2 (fileno (stdout), 1); + _wfreopen (L"CONOUT$", L"w", stderr); + dup2 (fileno (stderr), 2); + } + } +#else // Q_OS_WIN + int main( int argc, char *argv[] ) { -#ifdef Q_WS_MAC + #ifdef Q_WS_MAC // Do Mac specific startup to get media keys working. // This must go before QApplication initialisation. Tomahawk::macMain(); @@ -79,7 +108,8 @@ main( int argc, char *argv[] ) // used for url handler AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler ); AEInstallEventHandler( 'GURL', 'GURL', h, 0, false ); -#endif + #endif // Q_WS_MAC +#endif //Q_OS_WIN TomahawkApp a( argc, argv ); diff --git a/src/sourcetree/items/categoryitems.cpp b/src/sourcetree/items/categoryitems.cpp index 3cd74f326..cd9a89db9 100644 --- a/src/sourcetree/items/categoryitems.cpp +++ b/src/sourcetree/items/categoryitems.cpp @@ -1,17 +1,19 @@ /* - * 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 - * (at your option) any later version. + * Copyright 2010-2011, Leo Franchi * - * This program 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. + * 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 + * (at your option) any later version. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "categoryitems.h" @@ -365,8 +367,6 @@ CategoryItem::CategoryItem( SourcesModel* model, SourceTreeItem* parent, Sources m_addItem = new CategoryAddItem( model, this, m_category ); } // endRowsAdded(); - - connect( this, SIGNAL( toggleExpandRequest( SourceTreeItem* ) ), model, SLOT( itemToggleExpandRequest( SourceTreeItem* ) ) ); } diff --git a/src/sourcetree/items/categoryitems.h b/src/sourcetree/items/categoryitems.h index 0b9697955..72ac94c0e 100644 --- a/src/sourcetree/items/categoryitems.h +++ b/src/sourcetree/items/categoryitems.h @@ -1,17 +1,19 @@ /* - * 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 - * (at your option) any later version. + * Copyright 2010-2011, Leo Franchi * - * This program 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. + * 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 + * (at your option) any later version. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef CATEGORY_ITEM_H @@ -45,7 +47,6 @@ private slots: private: SourcesModel::CategoryType m_categoryType; QIcon m_icon; - public slots: }; diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 192256915..900d56182 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -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 ) ); @@ -510,7 +512,7 @@ TomahawkApp::initServent() } } - +// Called after Servent emits ready() void TomahawkApp::initSIP() { @@ -525,6 +527,9 @@ TomahawkApp::initSIP() tDebug( LOGINFO ) << "Connecting SIP classes"; Accounts::AccountManager::instance()->initSIP(); } + + m_loaded = true; + emit tomahawkLoaded(); } diff --git a/src/tomahawkapp.h b/src/tomahawkapp.h index b13d8ddf3..dcfe6336d 100644 --- a/src/tomahawkapp.h +++ b/src/tomahawkapp.h @@ -95,6 +95,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 ); @@ -135,7 +140,7 @@ private: TomahawkWindow* m_mainwindow; #endif - bool m_headless; + bool m_headless, m_loaded; QxtHttpServerConnector m_connector; QxtHttpSessionManager m_session; diff --git a/src/tomahawkwindow.cpp b/src/tomahawkwindow.cpp index a70a4927a..54b9fefb3 100644 --- a/src/tomahawkwindow.cpp +++ b/src/tomahawkwindow.cpp @@ -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 );