1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Merge remote-tracking branch 'origin/master' into accounts

Conflicts:
	src/main.cpp
This commit is contained in:
Leo Franchi
2012-02-21 08:42:24 -06:00
16 changed files with 106 additions and 35 deletions

View File

@@ -169,6 +169,7 @@ DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi )
void void
DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi ) DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
{ {
return;
if ( !m_artist.isNull() ) if ( !m_artist.isNull() )
{ {
execForArtist( dbi ); execForArtist( dbi );

View File

@@ -162,6 +162,7 @@ CREATE TABLE IF NOT EXISTS file (
); );
CREATE UNIQUE INDEX file_url_src_uniq ON file(source, url); CREATE UNIQUE INDEX file_url_src_uniq ON file(source, url);
CREATE INDEX file_source ON file(source); CREATE INDEX file_source ON file(source);
CREATE INDEX file_mtime ON file(mtime);
-- mtime of dir when last scanned. -- mtime of dir when last scanned.
-- load into memory when rescanning, skip stuff that's unchanged -- load into memory when rescanning, skip stuff that's unchanged

View File

@@ -137,7 +137,7 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) ); connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) );
Pipeline::instance()->resolve( query, true ); Pipeline::instance()->resolve( query );
m_gotNextItem = false; m_gotNextItem = false;
} }

View File

@@ -74,6 +74,7 @@ ViewManager::ViewManager( QObject* parent )
, m_whatsHotWidget( new WhatsHotWidget() ) , m_whatsHotWidget( new WhatsHotWidget() )
, m_topLovedWidget( 0 ) , m_topLovedWidget( 0 )
, m_currentMode( PlaylistInterface::Tree ) , m_currentMode( PlaylistInterface::Tree )
, m_loaded( false )
{ {
s_instance = this; s_instance = this;
@@ -112,6 +113,10 @@ ViewManager::ViewManager( QObject* parent )
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) ); connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) ); connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
connect( m_infobar, SIGNAL( autoUpdateChanged( int ) ), SLOT( autoUpdateChanged( int ) ) ); 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( flatMode() ), SLOT( setTableMode() ) );
connect( m_infobar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) ); connect( m_infobar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
connect( m_infobar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );*/ 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* ViewPage*
ViewManager::pageForCollection( const collection_ptr& col ) const ViewManager::pageForCollection( const collection_ptr& col ) const
{ {

View File

@@ -106,6 +106,8 @@ public:
// linked to the sidebar. call it right after creating the playlist // linked to the sidebar. call it right after creating the playlist
PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl ); PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl );
bool isTomahawkLoaded() const { return m_loaded; }
signals: signals:
void numSourcesChanged( unsigned int sources ); void numSourcesChanged( unsigned int sources );
void numTracksChanged( unsigned int tracks ); void numTracksChanged( unsigned int tracks );
@@ -130,6 +132,7 @@ signals:
void showQueueRequested(); void showQueueRequested();
void hideQueueRequested(); void hideQueueRequested();
void tomahawkLoaded();
public slots: public slots:
Tomahawk::ViewPage* showSuperCollection(); Tomahawk::ViewPage* showSuperCollection();
Tomahawk::ViewPage* showWelcomePage(); Tomahawk::ViewPage* showWelcomePage();
@@ -164,6 +167,8 @@ public slots:
void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents ); void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents ); void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
void setTomahawkLoaded();
private slots: private slots:
void setFilter( const QString& filter ); void setFilter( const QString& filter );
void applyFilter(); void applyFilter();
@@ -217,6 +222,8 @@ private:
QTimer m_filterTimer; QTimer m_filterTimer;
QString m_filter; QString m_filter;
bool m_loaded;
static ViewManager* s_instance; static ViewManager* s_instance;
}; };

View File

@@ -80,7 +80,6 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
m_recentAlbumsModel = new AlbumModel( ui->additionsView ); m_recentAlbumsModel = new AlbumModel( ui->additionsView );
ui->additionsView->setAlbumModel( m_recentAlbumsModel ); ui->additionsView->setAlbumModel( m_recentAlbumsModel );
ui->additionsView->proxyModel()->sort( -1 ); ui->additionsView->proxyModel()->sort( -1 );
m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime, true );
m_timer = new QTimer( this ); m_timer = new QTimer( this );
connect( m_timer, SIGNAL( timeout() ), SLOT( checkQueries() ) ); 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 Tomahawk::playlistinterface_ptr
WelcomeWidget::playlistInterface() const WelcomeWidget::playlistInterface() const
{ {

View File

@@ -105,6 +105,7 @@ public slots:
void updatePlaylists(); void updatePlaylists();
void updateRecentAdditions(); void updateRecentAdditions();
void loadData();
private slots: private slots:
void onSourcesReady(); void onSourcesReady();
void onSourceAdded( const Tomahawk::source_ptr& source ); void onSourceAdded( const Tomahawk::source_ptr& source );

View File

@@ -103,8 +103,6 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
QTimer::singleShot( 0, this, SLOT( fetchData() ) );
} }

View File

@@ -83,9 +83,9 @@ signals:
void destroyed( QWidget* widget ); void destroyed( QWidget* widget );
public slots: public slots:
void fetchData();
private slots: private slots:
void fetchData();
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ); void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
void leftCrumbIndexChanged( QModelIndex ); void leftCrumbIndexChanged( QModelIndex );

View File

@@ -12,7 +12,7 @@ namespace Tomahawk {
class PlatformInterface; class PlatformInterface;
} }
#ifdef SNOW_LEOPARD #if ( defined MAC_OS_X_VERSION_10_7 || defined SNOW_LEOPARD )
@interface AppDelegate :NSObject <NSApplicationDelegate> { @interface AppDelegate :NSObject <NSApplicationDelegate> {
#else #else
@interface AppDelegate :NSObject { @interface AppDelegate :NSObject {

View File

@@ -68,10 +68,39 @@ inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states
return in; return in;
} }
#ifdef Q_OS_WIN
#include <io.h>
#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 int
main( int argc, char *argv[] ) main( int argc, char *argv[] )
{ {
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// Do Mac specific startup to get media keys working. // Do Mac specific startup to get media keys working.
// This must go before QApplication initialisation. // This must go before QApplication initialisation.
Tomahawk::macMain(); Tomahawk::macMain();
@@ -79,7 +108,8 @@ main( int argc, char *argv[] )
// used for url handler // used for url handler
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler ); AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false ); AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
#endif #endif // Q_WS_MAC
#endif //Q_OS_WIN
TomahawkApp a( argc, argv ); TomahawkApp a( argc, argv );

View File

@@ -1,17 +1,19 @@
/* /*
* This program is free software; you can redistribute it and/or modify * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* 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.
* *
* This program is distributed in the hope that it will be useful, * This program is free software; you can redistribute it and/or modify
* but WITHOUT ANY WARRANTY; without even the implied warranty of * it under the terms of the GNU General Public License as published by
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * the Free Software Foundation; either version 2 of the License, or
* GNU General Public License for more details. * (at your option) any later version.
* *
* You should have received a copy of the GNU General Public License along * This program is distributed in the hope that it will be useful,
* with this program; if not, write to the Free Software Foundation, Inc., * but WITHOUT ANY WARRANTY; without even the implied warranty of
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 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" #include "categoryitems.h"
@@ -365,8 +367,6 @@ CategoryItem::CategoryItem( SourcesModel* model, SourceTreeItem* parent, Sources
m_addItem = new CategoryAddItem( model, this, m_category ); m_addItem = new CategoryAddItem( model, this, m_category );
} }
// endRowsAdded(); // endRowsAdded();
connect( this, SIGNAL( toggleExpandRequest( SourceTreeItem* ) ), model, SLOT( itemToggleExpandRequest( SourceTreeItem* ) ) );
} }

View File

@@ -1,17 +1,19 @@
/* /*
* This program is free software; you can redistribute it and/or modify * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* 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.
* *
* This program is distributed in the hope that it will be useful, * This program is free software; you can redistribute it and/or modify
* but WITHOUT ANY WARRANTY; without even the implied warranty of * it under the terms of the GNU General Public License as published by
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * the Free Software Foundation; either version 2 of the License, or
* GNU General Public License for more details. * (at your option) any later version.
* *
* You should have received a copy of the GNU General Public License along * This program is distributed in the hope that it will be useful,
* with this program; if not, write to the Free Software Foundation, Inc., * but WITHOUT ANY WARRANTY; without even the implied warranty of
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 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 #ifndef CATEGORY_ITEM_H
@@ -45,7 +47,6 @@ private slots:
private: private:
SourcesModel::CategoryType m_categoryType; SourcesModel::CategoryType m_categoryType;
QIcon m_icon; QIcon m_icon;
public slots:
}; };

View File

@@ -119,6 +119,8 @@ using namespace Tomahawk;
TomahawkApp::TomahawkApp( int& argc, char *argv[] ) TomahawkApp::TomahawkApp( int& argc, char *argv[] )
: TOMAHAWK_APPLICATION( argc, argv ) : TOMAHAWK_APPLICATION( argc, argv )
, m_headless( false )
, m_loaded( false )
{ {
setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) ); setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) );
setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) ); setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) );
@@ -510,7 +512,7 @@ TomahawkApp::initServent()
} }
} }
// Called after Servent emits ready()
void void
TomahawkApp::initSIP() TomahawkApp::initSIP()
{ {
@@ -525,6 +527,9 @@ TomahawkApp::initSIP()
tDebug( LOGINFO ) << "Connecting SIP classes"; tDebug( LOGINFO ) << "Connecting SIP classes";
Accounts::AccountManager::instance()->initSIP(); Accounts::AccountManager::instance()->initSIP();
} }
m_loaded = true;
emit tomahawkLoaded();
} }

View File

@@ -95,6 +95,11 @@ public:
// PlatformInterface // PlatformInterface
virtual bool loadUrl( const QString& url ); virtual bool loadUrl( const QString& url );
bool isTomahawkLoaded() const { return m_loaded; }
signals:
void tomahawkLoaded();
public slots: public slots:
virtual void activate(); virtual void activate();
void instanceStarted( KDSingleApplicationGuard::Instance ); void instanceStarted( KDSingleApplicationGuard::Instance );
@@ -135,7 +140,7 @@ private:
TomahawkWindow* m_mainwindow; TomahawkWindow* m_mainwindow;
#endif #endif
bool m_headless; bool m_headless, m_loaded;
QxtHttpServerConnector m_connector; QxtHttpServerConnector m_connector;
QxtHttpSessionManager m_session; QxtHttpSessionManager m_session;

View File

@@ -86,6 +86,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
ViewManager* vm = new ViewManager( this ); ViewManager* vm = new ViewManager( this );
connect( vm, SIGNAL( showQueueRequested() ), SLOT( showQueue() ) ); connect( vm, SIGNAL( showQueueRequested() ), SLOT( showQueue() ) );
connect( vm, SIGNAL( hideQueueRequested() ), SLOT( hideQueue() ) ); 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 ); ui->setupUi( this );