1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00
This commit is contained in:
Alejandro Wainzinger
2011-08-13 02:14:11 -07:00
8 changed files with 43 additions and 41 deletions

View File

@@ -495,7 +495,6 @@ target_link_libraries( tomahawklib
${LIBECHONEST_LIBRARY} ${LIBECHONEST_LIBRARY}
${QT_QTUITOOLS_LIBRARY} ${QT_QTUITOOLS_LIBRARY}
${QT_LIBRARIES} ${QT_LIBRARIES}
${QT_QTUITOOLS_LIBRARY} # We really need to link twice against it for windows, maybe QTBUG-20498 is related
${OS_SPECIFIC_LINK_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${LINK_LIBRARIES} ${LINK_LIBRARIES}

View File

@@ -25,18 +25,21 @@
using namespace Tomahawk; using namespace Tomahawk;
GeneratorInterface* GeneratorInterface*
DatabaseFactory::create() DatabaseFactory::create()
{ {
return new DatabaseGenerator(); return new DatabaseGenerator();
} }
dyncontrol_ptr dyncontrol_ptr
DatabaseFactory::createControl ( const QString& controlType ) DatabaseFactory::createControl ( const QString& controlType )
{ {
return dyncontrol_ptr( new DatabaseControl( controlType, typeSelectors() ) ); return dyncontrol_ptr( new DatabaseControl( controlType, typeSelectors() ) );
} }
dyncontrol_ptr dyncontrol_ptr
DatabaseFactory::createControl ( const QString& sql, DatabaseCommand_GenericSelect::QueryType type, const QString& summary ) DatabaseFactory::createControl ( const QString& sql, DatabaseCommand_GenericSelect::QueryType type, const QString& summary )
{ {
@@ -62,11 +65,12 @@ DatabaseGenerator::DatabaseGenerator ( QObject* parent )
// m_logo.load( RESPATH "images ) // m_logo.load( RESPATH "images )
} }
DatabaseGenerator::~DatabaseGenerator() DatabaseGenerator::~DatabaseGenerator()
{ {
} }
QPixmap QPixmap
DatabaseGenerator::logo() DatabaseGenerator::logo()
{ {
@@ -77,15 +81,15 @@ DatabaseGenerator::logo()
void void
DatabaseGenerator::dynamicFetched() DatabaseGenerator::dynamicFetched()
{ {
} }
void void
DatabaseGenerator::dynamicStarted() DatabaseGenerator::dynamicStarted()
{ {
} }
void void
DatabaseGenerator::generate( int number ) DatabaseGenerator::generate( int number )
{ {
@@ -136,6 +140,7 @@ DatabaseGenerator::generate( int number )
} }
void void
DatabaseGenerator::tracksGenerated ( const QList< query_ptr >& tracks ) DatabaseGenerator::tracksGenerated ( const QList< query_ptr >& tracks )
{ {
@@ -150,6 +155,7 @@ DatabaseGenerator::createControl( const QString& type )
return m_controls.last(); return m_controls.last();
} }
dyncontrol_ptr dyncontrol_ptr
DatabaseGenerator::createControl ( const QString& sql, DatabaseCommand_GenericSelect::QueryType type, const QString& summary ) DatabaseGenerator::createControl ( const QString& sql, DatabaseCommand_GenericSelect::QueryType type, const QString& summary )
{ {
@@ -160,10 +166,11 @@ DatabaseGenerator::createControl ( const QString& sql, DatabaseCommand_GenericSe
void void
DatabaseGenerator::fetchNext( int rating ) DatabaseGenerator::fetchNext( int /* rating */ )
{ {
} }
QString QString
DatabaseGenerator::sentenceSummary() DatabaseGenerator::sentenceSummary()
{ {
@@ -174,8 +181,8 @@ DatabaseGenerator::sentenceSummary()
return QString(); return QString();
} }
void void
DatabaseGenerator::startOnDemand() DatabaseGenerator::startOnDemand()
{ {
} }

View File

@@ -521,7 +521,6 @@ TreeModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVaria
if ( parent.isValid() ) if ( parent.isValid() )
crows.second -= 1; crows.second -= 1;
qDebug() << crows.first << crows.second;
if ( !parent.isValid() || crows.second > 0 ) if ( !parent.isValid() || crows.second > 0 )
emit beginInsertRows( parent, crows.first, crows.second ); emit beginInsertRows( parent, crows.first, crows.second );
@@ -551,7 +550,6 @@ TreeModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVaria
else else
emit dataChanged( albumitem->index, albumitem->index.sibling( albumitem->index.row(), columnCount( QModelIndex() ) - 1 ) ); emit dataChanged( albumitem->index, albumitem->index.sibling( albumitem->index.row(), columnCount( QModelIndex() ) - 1 ) );
qDebug() << rowCount( parent );
emit loadingFinished(); emit loadingFinished();
} }
@@ -568,14 +566,16 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QVaria
QModelIndex parent = index( rows.first().toUInt(), 0, index( rows.at( 1 ).toUInt(), 0, QModelIndex() ) ); QModelIndex parent = index( rows.first().toUInt(), 0, index( rows.at( 1 ).toUInt(), 0, QModelIndex() ) );
TreeModelItem* parentItem = itemFromIndex( parent ); TreeModelItem* parentItem = itemFromIndex( parent );
// the -1 is because we fake a rowCount of 1 to trigger Qt calling fetchMore()
int c = rowCount( parent ) - 1;
QPair< int, int > crows; QPair< int, int > crows;
int c = rowCount( parent );
crows.first = c; crows.first = c;
crows.second = c + tracks.count() - 1; crows.second = c + tracks.count() - 1;
if ( crows.second > 0 ) if ( parent.isValid() )
emit beginInsertRows( parent, crows.first + 1, crows.second ); crows.second -= 1;
if ( !parent.isValid() || crows.second > 0 )
emit beginInsertRows( parent, crows.first, crows.second );
TreeModelItem* item = 0; TreeModelItem* item = 0;
foreach( const query_ptr& query, tracks ) foreach( const query_ptr& query, tracks )
@@ -587,7 +587,7 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QVaria
connect( item, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) ); connect( item, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
} }
if ( crows.second > 0 ) if ( !parent.isValid() || crows.second > 0 )
emit endInsertRows(); emit endInsertRows();
emit dataChanged( item->index.sibling( 0, 0 ), item->index.sibling( item->index.row(), columnCount( QModelIndex() ) - 1 ) ); emit dataChanged( item->index.sibling( 0, 0 ), item->index.sibling( item->index.row(), columnCount( QModelIndex() ) - 1 ) );

View File

@@ -80,13 +80,6 @@ ViewManager::ViewManager( QObject* parent )
m_infobar = new InfoBar(); m_infobar = new InfoBar();
m_stack = new QStackedWidget(); m_stack = new QStackedWidget();
#ifdef Q_OS_MAC
QFrame* line = new QFrame();
line->setFrameStyle( QFrame::HLine );
line->setStyleSheet( "border: 1px solid gray;" );
line->setMaximumHeight( 1 );
#endif
m_splitter = new AnimatedSplitter(); m_splitter = new AnimatedSplitter();
m_splitter->setOrientation( Qt::Vertical ); m_splitter->setOrientation( Qt::Vertical );
m_splitter->setChildrenCollapsible( false ); m_splitter->setChildrenCollapsible( false );
@@ -103,9 +96,6 @@ ViewManager::ViewManager( QObject* parent )
m_widget->layout()->addWidget( m_infobar ); m_widget->layout()->addWidget( m_infobar );
m_widget->layout()->addWidget( m_topbar ); m_widget->layout()->addWidget( m_topbar );
#ifdef Q_OS_MAC
m_widget->layout()->addWidget( line );
#endif
m_widget->layout()->addWidget( m_splitter ); m_widget->layout()->addWidget( m_splitter );
m_superCollectionView = new ArtistView(); m_superCollectionView = new ArtistView();

View File

@@ -264,7 +264,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
QRect rectText = option.rect.adjusted( 66, 20, -100, -8 ); QRect rectText = option.rect.adjusted( 66, 20, -100, -8 );
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
rectText.adjust( 0, 1, 0, 0 ); rectText.adjust( 0, 1, 0, 0 );
#elif Q_OS_WIN #elif defined Q_OS_WIN
rectText.adjust( 0, 2, 0, 0 ); rectText.adjust( 0, 2, 0, 0 );
#endif #endif

View File

@@ -20,6 +20,8 @@
#include "config.h" #include "config.h"
#include <iostream>
#include <QPluginLoader> #include <QPluginLoader>
#include <QDir> #include <QDir>
#include <QMetaType> #include <QMetaType>
@@ -110,8 +112,6 @@ using namespace Tomahawk;
TomahawkApp::TomahawkApp( int& argc, char *argv[] ) TomahawkApp::TomahawkApp( int& argc, char *argv[] )
: TOMAHAWK_APPLICATION( argc, argv ) : TOMAHAWK_APPLICATION( argc, argv )
{ {
qDebug() << "TomahawkApp thread:" << thread();
setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) ); setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) );
setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) ); setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) );
setApplicationName( QLatin1String( TOMAHAWK_APPLICATION_NAME ) ); setApplicationName( QLatin1String( TOMAHAWK_APPLICATION_NAME ) );
@@ -130,6 +130,7 @@ TomahawkApp::init()
::exit(0); ::exit(0);
} }
qDebug() << "TomahawkApp thread:" << thread();
Logger::setupLogfile(); Logger::setupLogfile();
qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) ); qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) );
@@ -303,21 +304,25 @@ TomahawkApp::instance()
return (TomahawkApp*)TOMAHAWK_APPLICATION::instance(); return (TomahawkApp*)TOMAHAWK_APPLICATION::instance();
} }
void void
TomahawkApp::printHelp() TomahawkApp::printHelp()
{ {
std::cout << QString( "usage: " + arguments().at( 0 ) + " [options] [url]\n" ).toAscii().data(); #define echo( X ) std::cout << QString( X ).toAscii().data()
std::cout << QString( "options are:\n" ).toAscii().data();
std::cout << QString( " --help Show this help\n" ).toAscii().data(); echo( "Usage: " + arguments().at( 0 ) + " [options] [url]\n" );
std::cout << QString( " --http Initialize HTTP server\n" ).toAscii().data(); echo( "Options are:\n" );
std::cout << QString( " --filescan Scan for files on startup\n" ).toAscii().data(); echo( " --help Show this help\n" );
std::cout << QString( " --testdb Use a test database instead of real collection\n" ).toAscii().data(); echo( " --http Initialize HTTP server\n" );
std::cout << QString( " --noupnp Disable UPNP\n" ).toAscii().data(); echo( " --filescan Scan for files on startup\n" );
std::cout << QString( " --nosip Disable SIP\n" ).toAscii().data(); echo( " --testdb Use a test database instead of real collection\n" );
std::cout << QString( "\nurl is a tomahawk:// command or alternatively a url that Tomahawk can recognize.\n" ).toAscii().data(); echo( " --noupnp Disable UPNP\n" );
std::cout << QString( "For more documentation, see http://wiki.tomahawk-player.org/mediawiki/index.php/Tomahawk://_Links\n" ).toAscii().data(); echo( " --nosip Disable SIP\n" );
echo( "\nurl is a tomahawk:// command or alternatively a url that Tomahawk can recognize.\n" );
echo( "For more documentation, see http://wiki.tomahawk-player.org/mediawiki/index.php/Tomahawk://_Links\n" );
} }
#ifndef TOMAHAWK_HEADLESS #ifndef TOMAHAWK_HEADLESS
AudioControls* AudioControls*
TomahawkApp::audioControls() TomahawkApp::audioControls()

View File

@@ -177,10 +177,8 @@ TomahawkWindow::applyPlatformTweaks()
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
ui->hline1->setMaximumHeight( 0 ); delete ui->hline1;
ui->hline2->setMaximumHeight( 0 ); delete ui->hline2;
ui->hline1->hide();
ui->hline2->hide();
#else #else
ui->hline1->setStyleSheet( "border: 1px solid gray;" ); ui->hline1->setStyleSheet( "border: 1px solid gray;" );
ui->hline2->setStyleSheet( "border: 1px solid gray;" ); ui->hline2->setStyleSheet( "border: 1px solid gray;" );
@@ -213,7 +211,10 @@ TomahawkWindow::setupSideBar()
sidebarWidget->setContentsMargins( 0, 0, 0, 0 ); sidebarWidget->setContentsMargins( 0, 0, 0, 0 );
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 ); sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
sidebarWidget->layout()->setMargin( 0 ); sidebarWidget->layout()->setMargin( 0 );
#ifndef Q_OS_MAC
sidebarWidget->layout()->setSpacing( 0 ); sidebarWidget->layout()->setSpacing( 0 );
#endif
ui->splitter->addWidget( sidebarWidget ); ui->splitter->addWidget( sidebarWidget );
ui->splitter->addWidget( ViewManager::instance()->widget() ); ui->splitter->addWidget( ViewManager::instance()->widget() );

View File

@@ -67,7 +67,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>1000</width>
<height>20</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuSettings"> <widget class="QMenu" name="menuSettings">