mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-25 12:23:36 +01:00
* Properly shutdown InfoSystem again.
* Default sizes & restoring of TreeHeader columns. * Fix square cover painting in TreeItemDelegate.
This commit is contained in:
parent
9f4c3bb461
commit
e3c90784e1
@ -52,6 +52,10 @@ class XMPPBot;
|
||||
namespace Tomahawk
|
||||
{
|
||||
class ShortcutHandler;
|
||||
namespace InfoSystem
|
||||
{
|
||||
class InfoSystem;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIBLASTFM_FOUND
|
||||
@ -119,6 +123,7 @@ private:
|
||||
AudioEngine* m_audioEngine;
|
||||
SipHandler* m_sipHandler;
|
||||
Servent* m_servent;
|
||||
Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
|
||||
XMPPBot* m_xmppBot;
|
||||
Tomahawk::ShortcutHandler* m_shortcutHandler;
|
||||
bool m_scrubFriendlyName;
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
namespace Tomahawk {
|
||||
|
||||
namespace InfoSystem {
|
||||
@ -97,7 +99,7 @@ typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
|
||||
typedef QHash< QString, QVariant > InfoCustomData;
|
||||
typedef QHash< QString, QString > InfoCacheCriteria;
|
||||
|
||||
class InfoPlugin : public QObject
|
||||
class DLLEXPORT InfoPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -134,7 +136,7 @@ protected:
|
||||
|
||||
typedef QWeakPointer< InfoPlugin > InfoPluginPtr;
|
||||
|
||||
class InfoSystem : public QObject
|
||||
class DLLEXPORT InfoSystem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -274,7 +274,6 @@ AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned in
|
||||
void
|
||||
AlbumModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums )
|
||||
{
|
||||
Q_UNUSED( collection );
|
||||
if ( !albums.count() )
|
||||
return;
|
||||
|
||||
|
@ -149,6 +149,14 @@ ArtistView::paintEvent( QPaintEvent* event )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistView::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
QTreeView::resizeEvent( event );
|
||||
m_header->checkState();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistView::onFilterChanged( const QString& )
|
||||
{
|
||||
|
@ -52,10 +52,13 @@ public:
|
||||
virtual QString title() const { return m_model->title(); }
|
||||
virtual QString description() const { return m_model->description(); }
|
||||
|
||||
virtual bool showStatsBar() const { return false; }
|
||||
virtual bool showModes() const { return true; }
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
|
||||
QString guid() const { return QString( "ArtistView" ); }
|
||||
|
||||
public slots:
|
||||
void onItemActivated( const QModelIndex& index );
|
||||
|
||||
@ -64,6 +67,7 @@ protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent* event );
|
||||
virtual void dragMoveEvent( QDragMoveEvent* event );
|
||||
virtual void dropEvent( QDropEvent* event );
|
||||
virtual void resizeEvent( QResizeEvent* event );
|
||||
|
||||
void paintEvent( QPaintEvent* event );
|
||||
|
||||
|
@ -60,7 +60,7 @@ TreeHeader::onSectionResized()
|
||||
if ( !m_init )
|
||||
return;
|
||||
|
||||
// TomahawkSettings::instance()->setPlaylistColumnSizes( m_parent->guid(), saveState() );
|
||||
TomahawkSettings::instance()->setPlaylistColumnSizes( m_parent->guid(), saveState() );
|
||||
}
|
||||
|
||||
|
||||
@ -77,13 +77,13 @@ TreeHeader::checkState()
|
||||
if ( !count() || m_init )
|
||||
return;
|
||||
|
||||
/* QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
||||
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
||||
if ( !state.isEmpty() )
|
||||
restoreState( state );
|
||||
else
|
||||
{
|
||||
QList< double > m_columnWeights;
|
||||
m_columnWeights << 0.21 << 0.22 << 0.20 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05; // << 0.12;
|
||||
m_columnWeights << 0.50 << 0.07 << 0.07 << 0.07 << 0.07 << 0.07; // << 0.12;
|
||||
|
||||
for ( int i = 0; i < count() - 1; i++ )
|
||||
{
|
||||
@ -96,7 +96,7 @@ TreeHeader::checkState()
|
||||
}
|
||||
}
|
||||
|
||||
m_init = true;*/
|
||||
m_init = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
painter->setRenderHint( QPainter::Antialiasing );
|
||||
painter->setPen( opt.palette.color( QPalette::Text ) );
|
||||
|
||||
QRect r = option.rect.adjusted( 4, 4, -option.rect.width() + option.rect.height() - 8, -4 );
|
||||
QRect r = option.rect.adjusted( 4, 4, -option.rect.width() + option.rect.height() - 4, -4 );
|
||||
// painter->drawPixmap( option.rect.adjusted( 4, 4, -4, -38 ), QPixmap( RESPATH "images/cover-shadow.png" ) );
|
||||
painter->drawPixmap( r, item->cover );
|
||||
|
||||
|
@ -396,7 +396,7 @@ TreeModel::addCollection( const collection_ptr& collection )
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
|
||||
m_title = tr( "All artists from %1" ).arg( collection->source()->friendlyName() );
|
||||
m_title = tr( "All Artists from %1" ).arg( collection->source()->friendlyName() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -222,6 +222,16 @@ Source::onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::Stat
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
Source::trackCount() const
|
||||
{
|
||||
if ( m_stats.contains( "numfiles" ) )
|
||||
return m_stats.value( "numfiles" ).toUInt();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Source::onPlaybackStarted( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -65,11 +65,11 @@ public:
|
||||
|
||||
void scanningProgress( unsigned int files );
|
||||
void scanningFinished( unsigned int files );
|
||||
|
||||
|
||||
void setOffline();
|
||||
void setOnline();
|
||||
|
||||
unsigned int trackCount() const { return m_stats.value( "numfiles" ).toUInt(); }
|
||||
unsigned int trackCount() const;
|
||||
|
||||
Tomahawk::query_ptr currentTrack() const { return m_currentTrack; }
|
||||
QString textStatus() const { return m_textStatus; }
|
||||
@ -102,7 +102,7 @@ private slots:
|
||||
void onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::State oldstate, const QString& info );
|
||||
void onPlaybackStarted( const Tomahawk::query_ptr& query );
|
||||
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
||||
|
||||
|
||||
private:
|
||||
bool m_isLocal;
|
||||
bool m_online;
|
||||
|
@ -215,7 +215,7 @@ TomahawkApp::init()
|
||||
}
|
||||
|
||||
qDebug() << "Init InfoSystem.";
|
||||
new Tomahawk::InfoSystem::InfoSystem( this );
|
||||
m_infoSystem = new Tomahawk::InfoSystem::InfoSystem( this );
|
||||
|
||||
#ifdef LIBLASTFM_FOUND
|
||||
qDebug() << "Init Scrobbler.";
|
||||
@ -302,7 +302,7 @@ TomahawkApp::~TomahawkApp()
|
||||
delete m_mainwindow;
|
||||
delete m_audioEngine;
|
||||
#endif
|
||||
// delete m_infoSystem;
|
||||
delete m_infoSystem;
|
||||
delete m_database;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user