mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-06 12:10:47 +02:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9a81ce8b89 | ||
|
c805d283d4 | ||
|
03379f361c | ||
|
c671c0e898 | ||
|
edaf49b4c5 | ||
|
682903b0cb | ||
|
53f7f599d5 | ||
|
cc669fc20f | ||
|
4e7496a38a | ||
|
5842cdceee | ||
|
b7e0be8d9d | ||
|
a203b60cbb | ||
|
2be08af321 | ||
|
ad4c229a6b | ||
|
b2e0206e34 | ||
|
743ae013ea | ||
|
767cf7c1b9 | ||
|
6be94ab81c | ||
|
b1ed304a61 |
@@ -16,7 +16,7 @@ SET( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
|
||||
|
||||
SET( TOMAHAWK_VERSION_MAJOR 0 )
|
||||
SET( TOMAHAWK_VERSION_MINOR 3 )
|
||||
SET( TOMAHAWK_VERSION_PATCH 0 )
|
||||
SET( TOMAHAWK_VERSION_PATCH 1 )
|
||||
|
||||
#SET( TOMAHAWK_VERSION_RC 0 )
|
||||
|
||||
|
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,17 @@
|
||||
Version 0.3.1:
|
||||
* Fixed not resolving to local files.
|
||||
* Fixed shutdown crash on Windows.
|
||||
* Support more widget types in Javascript resolver configs.
|
||||
* Fixed bug where red headphone would be visible on My Collection
|
||||
when listened along to source went offline.
|
||||
* Draw author name as well as avatar in recently played playlists.
|
||||
* Fixed Tomahawk integration in Unity.
|
||||
* Fixed incorrect item selected in source tree when deleting temporary
|
||||
pages.
|
||||
* Fixed currently played label disappearing after 10 minutes regardless
|
||||
of length of track.
|
||||
* Fixed crash on Sparkle upgrade on OS X.
|
||||
|
||||
Version 0.3.0:
|
||||
* Make artist names in the album view clickable.
|
||||
* Don't start playing if a tomahawk:// link was clicked while Tomahawk
|
||||
@@ -12,7 +26,7 @@ Version 0.3.0:
|
||||
* Added YouTube resolver.
|
||||
* Fixed bug where going offline then online would not re-connect to many
|
||||
peers.
|
||||
* Added support for auto-updating live XSPF playlists.
|
||||
* Added support for auto-updating live XSPF playlists.
|
||||
* Don't show an age of 41 years for tracks that have no age information.
|
||||
* Show config UI for resolvers that have them as soon as you add them.
|
||||
* Add support for Echo Nest Personal Catalogs and User Radio. Synchronize
|
||||
|
@@ -40,6 +40,7 @@ SET( tomahawkSources ${tomahawkSources}
|
||||
musicscanner.cpp
|
||||
shortcuthandler.cpp
|
||||
scanmanager.cpp
|
||||
ubuntuunityhack.cpp
|
||||
tomahawkapp.cpp
|
||||
main.cpp
|
||||
)
|
||||
@@ -85,6 +86,7 @@ SET( tomahawkHeaders ${tomahawkHeaders}
|
||||
|
||||
musicscanner.h
|
||||
scanmanager.h
|
||||
ubuntuunityhack.h
|
||||
shortcuthandler.h
|
||||
)
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#cmakedefine DEBUG_BUILD
|
||||
|
||||
#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#define CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}"
|
||||
#define CMAKE_SYSTEM "${CMAKE_SYSTEM}"
|
||||
|
||||
#cmakedefine LION
|
||||
|
@@ -94,18 +94,8 @@ DatabaseCommand_LoadDynamicPlaylistEntries::exec( DatabaseImpl* dbi )
|
||||
}
|
||||
else
|
||||
{
|
||||
// No controls, lets load the info we need directly from the playlist table
|
||||
TomahawkSqlQuery info = dbi->newquery();
|
||||
info.prepare( QString( "SELECT dynamic_playlist.pltype, dynamic_playlist.plmode FROM playlist, dynamic_playlist WHERE playlist.guid = \"%1\" AND playlist.guid = dynamic_playlist.guid" ).arg( playlist_guid ) );
|
||||
if( !info.exec() ) {
|
||||
qWarning() << "Failed to load dynplaylist info..";
|
||||
return;
|
||||
} else if( !info.first() ) {
|
||||
qWarning() << "Noo results for queryL:" << info.lastQuery();
|
||||
return;
|
||||
}
|
||||
type = info.value( 0 ).toString();
|
||||
mode = static_cast<GeneratorMode>( info.value( 1 ).toInt() );
|
||||
// No controls or plguid is null, but that's okay. We'll get a setdynrevision command with a proper revision some point later
|
||||
return;
|
||||
}
|
||||
|
||||
if( mode == OnDemand )
|
||||
|
@@ -26,6 +26,7 @@
|
||||
DatabaseCommand_UpdateSearchIndex::DatabaseCommand_UpdateSearchIndex()
|
||||
: DatabaseCommand()
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Updating index.";
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -121,7 +121,7 @@ DBSyncConnection::trigger()
|
||||
void
|
||||
DBSyncConnection::check()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << m_source->id();
|
||||
qDebug() << Q_FUNC_INFO << this << m_source->id();
|
||||
if ( m_state != UNKNOWN && m_state != SYNCED )
|
||||
{
|
||||
qDebug() << "Syncing in progress already.";
|
||||
|
@@ -527,7 +527,7 @@ QtScriptResolver::loadDataFromWidgets()
|
||||
QString widgetName = data["widget"].toString();
|
||||
QWidget* widget= findWidget( m_configWidget.data(), widgetName );
|
||||
|
||||
QString value = widgetData( widget, data["property"].toString() ).toString();
|
||||
QVariant value = widgetData( widget, data["property"].toString() );
|
||||
|
||||
saveData[ data["name"].toString() ] = value;
|
||||
}
|
||||
|
@@ -310,6 +310,7 @@ Source::onPlaybackStarted( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << query->toString();
|
||||
m_currentTrack = query;
|
||||
m_currentTrackTimer.stop();
|
||||
if ( m_playlistInterface.isNull() )
|
||||
getPlaylistInterface();
|
||||
emit playbackStarted( query );
|
||||
@@ -358,5 +359,11 @@ Source::reportSocialAttributesChanged( DatabaseCommand_SocialAction* action )
|
||||
void
|
||||
Source::updateIndexWhenSynced()
|
||||
{
|
||||
m_updateIndexWhenSynced = true;
|
||||
if ( isLocal() )
|
||||
{
|
||||
DatabaseCommand* cmd = new DatabaseCommand_UpdateSearchIndex();
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}
|
||||
else
|
||||
m_updateIndexWhenSynced = true;
|
||||
}
|
||||
|
@@ -31,7 +31,10 @@
|
||||
#include "utils/logger.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define VERSION 4
|
||||
#include "database/databasecommand_updatesearchindex.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#define VERSION 5
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -220,6 +223,10 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
|
||||
tDebug() << "UPGRADING AND DELETING:" << resolverDir.absolutePath();
|
||||
TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
|
||||
}
|
||||
} else if ( oldVersion == 4 )
|
||||
{
|
||||
// 0.3.0 contained a bug which prevent indexing local files. Force a reindex.
|
||||
QTimer::singleShot( 0, this, SLOT( updateIndex() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -991,3 +998,11 @@ TomahawkSettings::setPrivateListeningMode( TomahawkSettings::PrivateListeningMod
|
||||
{
|
||||
setValue( "privatelisteningmode", mode );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::updateIndex()
|
||||
{
|
||||
DatabaseCommand* cmd = new DatabaseCommand_UpdateSearchIndex();
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}
|
||||
|
@@ -216,6 +216,9 @@ signals:
|
||||
void changed();
|
||||
void recentlyPlayedPlaylistAdded( const Tomahawk::playlist_ptr& playlist );
|
||||
|
||||
private slots:
|
||||
void updateIndex();
|
||||
|
||||
private:
|
||||
void doInitialSetup();
|
||||
void doUpgrade( int oldVersion, int newVersion );
|
||||
|
@@ -271,31 +271,6 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
painter->drawPixmap( pixmapRect, icon );
|
||||
|
||||
QString descText;
|
||||
if ( type == RecentlyPlayedPlaylistsModel::Station )
|
||||
{
|
||||
descText = index.data( RecentlyPlayedPlaylistsModel::DynamicPlaylistRole ).value< Tomahawk::dynplaylist_ptr >()->generator()->sentenceSummary();
|
||||
} else
|
||||
{
|
||||
descText = index.data( RecentlyPlayedPlaylistsModel::ArtistRole ).toString();
|
||||
}
|
||||
QColor c = painter->pen().color();
|
||||
painter->setPen( QColor( Qt::gray ).darker() );
|
||||
QFont font2 = font;
|
||||
font2.setPointSize( font2.pointSize() - 1 );
|
||||
painter->setFont( font2 );
|
||||
|
||||
QRect rectText = option.rect.adjusted( 66, 20, -100, -8 );
|
||||
#ifdef Q_WS_MAC
|
||||
rectText.adjust( 0, 1, 0, 0 );
|
||||
#elif defined Q_WS_WIN
|
||||
rectText.adjust( 0, 2, 0, 0 );
|
||||
#endif
|
||||
|
||||
painter->drawText( rectText, descText );
|
||||
painter->setPen( c );
|
||||
painter->setFont( font );
|
||||
|
||||
if ( type != RecentlyPlayedPlaylistsModel::Station )
|
||||
{
|
||||
painter->save();
|
||||
@@ -324,6 +299,40 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
QRect r( option.rect.width() - avatar.width() - 10, option.rect.top() + option.rect.height()/2 - avatar.height()/2, avatar.width(), avatar.height() );
|
||||
painter->drawPixmap( r, avatar );
|
||||
|
||||
QString author = index.data( RecentlyPlayedPlaylistsModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->friendlyName();
|
||||
if ( author.contains( "@" ) )
|
||||
author = author.mid( 0, author.indexOf( '@' ) );
|
||||
|
||||
const int w = painter->fontMetrics().width( author );
|
||||
QRect avatarNameRect( opt.rect.width() - 10 - w, r.bottom(), w, opt.rect.bottom() - r.bottom() );
|
||||
painter->drawText( avatarNameRect, author, QTextOption( Qt::AlignCenter ) );
|
||||
|
||||
const int leftEdge = opt.rect.width() - qMin( avatarNameRect.left(), r.left() );
|
||||
QString descText;
|
||||
if ( type == RecentlyPlayedPlaylistsModel::Station )
|
||||
{
|
||||
descText = index.data( RecentlyPlayedPlaylistsModel::DynamicPlaylistRole ).value< Tomahawk::dynplaylist_ptr >()->generator()->sentenceSummary();
|
||||
} else
|
||||
{
|
||||
descText = index.data( RecentlyPlayedPlaylistsModel::ArtistRole ).toString();
|
||||
}
|
||||
QColor c = painter->pen().color();
|
||||
painter->setPen( QColor( Qt::gray ).darker() );
|
||||
QFont font2 = font;
|
||||
font2.setPointSize( font2.pointSize() - 1 );
|
||||
painter->setFont( font2 );
|
||||
|
||||
QRect rectText = option.rect.adjusted( 66, 20, -leftEdge - 10, -8 );
|
||||
#ifdef Q_WS_MAC
|
||||
rectText.adjust( 0, 1, 0, 0 );
|
||||
#elif defined Q_WS_WIN
|
||||
rectText.adjust( 0, 2, 0, 0 );
|
||||
#endif
|
||||
|
||||
painter->drawText( rectText, descText );
|
||||
painter->setPen( c );
|
||||
painter->setFont( font );
|
||||
|
||||
painter->setFont( boldFont );
|
||||
painter->drawText( option.rect.adjusted( 56, 6, -100, -option.rect.height() + 20 ), index.data().toString() );
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "macshortcuthandler.h"
|
||||
#include "config.h"
|
||||
#include "tomahawkwindow.h"
|
||||
#include "audio/audioengine.h"
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
@@ -54,6 +55,9 @@
|
||||
|
||||
- (Tomahawk::PlatformInterface*) application_handler;
|
||||
- (void) setApplicationHandler: (Tomahawk::PlatformInterface*)handler;
|
||||
|
||||
// SUUpdaterDelegate
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
|
||||
@end
|
||||
|
||||
|
||||
@@ -205,6 +209,13 @@
|
||||
[super sendEvent: event];
|
||||
}
|
||||
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update
|
||||
{
|
||||
tLog() << "NSApp in willInstallUpdate, deleting Phonon objects";
|
||||
AudioEngine::instance()->stop();
|
||||
delete AudioEngine::instance();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void Tomahawk::macMain() {
|
||||
|
22
src/main.cpp
22
src/main.cpp
@@ -22,6 +22,7 @@
|
||||
#include <QTranslator>
|
||||
|
||||
#include "breakpad/BreakPad.h"
|
||||
#include "ubuntuunityhack.h"
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include "tomahawkapp_mac.h"
|
||||
@@ -34,13 +35,22 @@ int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
#ifdef Q_WS_MAC
|
||||
// Do Mac specific startup to get media keys working.
|
||||
// This must go before QApplication initialisation.
|
||||
Tomahawk::macMain();
|
||||
// Do Mac specific startup to get media keys working.
|
||||
// This must go before QApplication initialisation.
|
||||
Tomahawk::macMain();
|
||||
|
||||
// used for url handler
|
||||
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
|
||||
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
|
||||
// used for url handler
|
||||
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
|
||||
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
|
||||
#endif
|
||||
|
||||
// Unity hack taken from Clementine's main.cpp
|
||||
#ifdef Q_OS_LINUX
|
||||
// In 11.04 Ubuntu decided that the system tray should be reserved for certain
|
||||
// whitelisted applications. Tomahawk will override this setting and insert
|
||||
// itself into the list of whitelisted apps.
|
||||
setenv( "QT_X11_NO_NATIVE_MENUBAR", "1", true );
|
||||
UbuntuUnityHack hack;
|
||||
#endif
|
||||
|
||||
TomahawkApp a( argc, argv );
|
||||
|
@@ -197,12 +197,13 @@ ResolversModel::addInstalledResolvers()
|
||||
|
||||
QDir appDir( qApp->applicationDirPath() );
|
||||
QDir libDir( CMAKE_INSTALL_PREFIX "/lib" );
|
||||
QDir libexecDir( CMAKE_INSTALL_LIBEXECDIR );
|
||||
|
||||
QDir lib64Dir( appDir );
|
||||
lib64Dir.cdUp();
|
||||
lib64Dir.cd( "lib64" );
|
||||
|
||||
pluginDirs << appDir << libDir << lib64Dir << QDir( qApp->applicationDirPath() );
|
||||
pluginDirs << appDir << libDir << lib64Dir << libexecDir << QDir( qApp->applicationDirPath() );
|
||||
foreach ( const QDir& pluginDir, pluginDirs )
|
||||
{
|
||||
qDebug() << "Checking directory for resolvers:" << pluginDir;
|
||||
|
@@ -135,22 +135,29 @@ ScanManager::runScan( bool manualFull )
|
||||
if ( !Database::instance() || ( Database::instance() && !Database::instance()->isReady() ) )
|
||||
return;
|
||||
|
||||
if ( manualFull )
|
||||
if ( !m_musicScannerThreadController && m_scanner.isNull() ) //still running if these are not zero
|
||||
{
|
||||
DatabaseCommand_DeleteFiles *cmd = new DatabaseCommand_DeleteFiles( SourceList::instance()->getLocal() );
|
||||
connect( cmd, SIGNAL( done( const QStringList&, const Tomahawk::collection_ptr& ) ),
|
||||
SLOT( filesDeleted( const QStringList&, const Tomahawk::collection_ptr& ) ) );
|
||||
if ( manualFull )
|
||||
{
|
||||
DatabaseCommand_DeleteFiles *cmd = new DatabaseCommand_DeleteFiles( SourceList::instance()->getLocal() );
|
||||
connect( cmd, SIGNAL( done( const QStringList&, const Tomahawk::collection_ptr& ) ),
|
||||
SLOT( filesDeleted( const QStringList&, const Tomahawk::collection_ptr& ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
return;
|
||||
}
|
||||
|
||||
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes( true );
|
||||
connect( cmd, SIGNAL( done( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ),
|
||||
SLOT( fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Could not run dir scan, old scan still running";
|
||||
return;
|
||||
}
|
||||
|
||||
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes( true );
|
||||
connect( cmd, SIGNAL( done( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ),
|
||||
SLOT( fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +173,7 @@ ScanManager::fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
runDirScan();
|
||||
}
|
||||
|
||||
@@ -190,7 +197,7 @@ ScanManager::runDirScan()
|
||||
return;
|
||||
|
||||
QStringList paths = TomahawkSettings::instance()->scannerPaths();
|
||||
|
||||
|
||||
if ( !m_musicScannerThreadController && m_scanner.isNull() ) //still running if these are not zero
|
||||
{
|
||||
m_scanTimer->stop();
|
||||
|
@@ -201,8 +201,9 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
||||
}
|
||||
|
||||
QString name = firstArtist.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( firstArtist );
|
||||
newpl->rename( name );
|
||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||
newpl->setProperty( "newname", name );
|
||||
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
|
||||
ViewManager::instance()->show( newpl );
|
||||
return true;
|
||||
@@ -278,6 +279,22 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CategoryAddItem::playlistToRenameLoaded()
|
||||
{
|
||||
Playlist* pl = qobject_cast< Playlist* >( sender() );
|
||||
Q_ASSERT( pl );
|
||||
|
||||
QString name = sender()->property( "newname" ).toString();
|
||||
if ( !name.isEmpty() )
|
||||
pl->rename( name );
|
||||
else
|
||||
QTimer::singleShot( 400, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
||||
|
||||
disconnect( pl, SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
||||
{
|
||||
@@ -322,8 +339,7 @@ CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||
|
||||
ViewManager::instance()->show( newpl );
|
||||
// Give a shot to try to rename it. The playlist has to be created first. ugly.
|
||||
QTimer::singleShot( 300, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
||||
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,9 +40,13 @@ private slots:
|
||||
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||
void dialogClosed( int ret );
|
||||
|
||||
//
|
||||
void playlistToRenameLoaded();
|
||||
private:
|
||||
SourcesModel::CategoryType m_categoryType;
|
||||
QIcon m_icon;
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
class CategoryItem : public SourceTreeItem
|
||||
|
@@ -200,12 +200,28 @@ CollectionItem::icon() const
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CollectionItem::localLatchedOn() const
|
||||
{
|
||||
// Don't show a listen icon if this is the local collection and we are latched on to someone who went offline
|
||||
// we are technically still latched on (if they come back online we'll be still listening along) but it's not visible
|
||||
// in the UI and confusing to the user why the red headphones are still there
|
||||
|
||||
if ( !m_source.isNull() && m_source->isLocal() &&
|
||||
!m_latchedOnTo.isNull() && !m_latchedOnTo->isOnline() )
|
||||
return false;
|
||||
|
||||
return m_latchedOn;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionItem::latchedOff( const source_ptr& from, const source_ptr& to )
|
||||
{
|
||||
if ( from->isLocal() && ( m_source == to || m_source == from ) )
|
||||
{
|
||||
m_latchedOn = false;
|
||||
m_latchedOnTo.clear();
|
||||
emit updated();
|
||||
}
|
||||
}
|
||||
@@ -216,6 +232,7 @@ CollectionItem::latchedOn( const source_ptr& from, const source_ptr& to )
|
||||
if ( from->isLocal() && ( m_source == to || m_source == from ) )
|
||||
{
|
||||
m_latchedOn = true;
|
||||
m_latchedOnTo = to;
|
||||
emit updated();
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
virtual int peerSortValue() const;
|
||||
virtual int IDValue() const;
|
||||
|
||||
virtual bool localLatchedOn() const { return m_latchedOn; }
|
||||
virtual bool localLatchedOn() const;
|
||||
|
||||
Tomahawk::source_ptr source() const;
|
||||
|
||||
@@ -85,7 +85,9 @@ private:
|
||||
QPixmap m_superCol, m_defaultAvatar;
|
||||
CategoryItem* m_playlists;
|
||||
CategoryItem* m_stations;
|
||||
|
||||
bool m_latchedOn;
|
||||
Tomahawk::source_ptr m_latchedOnTo;
|
||||
|
||||
QList< TemporaryPageItem* > m_tempItems;
|
||||
GenericPageItem* m_sourceInfoItem;
|
||||
|
@@ -414,7 +414,7 @@ bool
|
||||
SourceDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
||||
{
|
||||
|
||||
if ( event->type() == QEvent::MouseButtonRelease )
|
||||
if ( event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::MouseButtonPress )
|
||||
{
|
||||
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
|
||||
if ( type == SourcesModel::TemporaryPage )
|
||||
@@ -429,7 +429,12 @@ SourceDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QS
|
||||
QRect r ( o.rect.right() - padding - m_iconHeight, padding + o.rect.y(), m_iconHeight, m_iconHeight );
|
||||
|
||||
if ( r.contains( ev->pos() ) )
|
||||
gpi->removeFromList();
|
||||
{
|
||||
if ( event->type() == QEvent::MouseButtonRelease )
|
||||
gpi->removeFromList();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( type == SourcesModel::Collection )
|
||||
{
|
||||
|
@@ -132,7 +132,7 @@ TomahawkApp::init()
|
||||
if ( arguments().contains( "--help" ) || arguments().contains( "-h" ) )
|
||||
{
|
||||
printHelp();
|
||||
::exit(0);
|
||||
::exit( 0 );
|
||||
}
|
||||
|
||||
qDebug() << "TomahawkApp thread:" << thread();
|
||||
@@ -283,8 +283,9 @@ TomahawkApp::~TomahawkApp()
|
||||
|
||||
if ( !m_audioEngine.isNull() )
|
||||
delete m_audioEngine.data();
|
||||
if ( !m_infoSystem.isNull() )
|
||||
delete m_infoSystem.data();
|
||||
|
||||
/* if ( !m_infoSystem.isNull() )
|
||||
delete m_infoSystem.data(); */ // FIXME: this causes a shutdown crash on Windows
|
||||
|
||||
//FIXME: delete GeneratorFactory::registerFactory( "echonest", new EchonestFactory ); ?
|
||||
|
||||
|
@@ -111,8 +111,6 @@ private:
|
||||
|
||||
void initHTTP();
|
||||
|
||||
QList<Tomahawk::collection_ptr> m_collections;
|
||||
|
||||
QWeakPointer<Database> m_database;
|
||||
QWeakPointer<ScanManager> m_scanManager;
|
||||
QWeakPointer<AudioEngine> m_audioEngine;
|
||||
|
83
src/ubuntuunityhack.cpp
Normal file
83
src/ubuntuunityhack.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ubuntuunityhack.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
const char* UbuntuUnityHack::kGSettingsFileName = "gsettings";
|
||||
const char* UbuntuUnityHack::kUnityPanel = "com.canonical.Unity.Panel";
|
||||
const char* UbuntuUnityHack::kUnitySystrayWhitelist = "systray-whitelist";
|
||||
|
||||
UbuntuUnityHack::UbuntuUnityHack(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// Get the systray whitelist from gsettings. If this fails we're probably
|
||||
// not running on a system with unity
|
||||
QProcess* get = new QProcess(this);
|
||||
connect(get, SIGNAL(finished(int)), SLOT(GetFinished(int)));
|
||||
connect(get, SIGNAL(error(QProcess::ProcessError)), SLOT(GetError()));
|
||||
get->start(kGSettingsFileName, QStringList()
|
||||
<< "get" << kUnityPanel << kUnitySystrayWhitelist);
|
||||
}
|
||||
|
||||
void UbuntuUnityHack::GetError() {
|
||||
QProcess* get = qobject_cast<QProcess*>(sender());
|
||||
if (!get) {
|
||||
return;
|
||||
}
|
||||
|
||||
get->deleteLater();
|
||||
}
|
||||
|
||||
void UbuntuUnityHack::GetFinished(int exit_code) {
|
||||
QProcess* get = qobject_cast<QProcess*>(sender());
|
||||
if (!get) {
|
||||
return;
|
||||
}
|
||||
|
||||
get->deleteLater();
|
||||
|
||||
if (exit_code != 0) {
|
||||
// Probably not running in Unity.
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray whitelist = get->readAllStandardOutput();
|
||||
|
||||
tDebug() << "Unity whitelist is" << whitelist;
|
||||
|
||||
int index = whitelist.lastIndexOf(']');
|
||||
if (index == -1 || whitelist.contains("'tomahawk'")) {
|
||||
return;
|
||||
}
|
||||
|
||||
whitelist = whitelist.left(index) + QString(", 'tomahawk'").toUtf8() +
|
||||
whitelist.mid(index);
|
||||
|
||||
tLog() << "Setting unity whitelist to" << whitelist;
|
||||
|
||||
QProcess* set = new QProcess(this);
|
||||
connect(set, SIGNAL(finished(int)), set, SLOT(deleteLater()));
|
||||
set->start(kGSettingsFileName, QStringList()
|
||||
<< "set" << kUnityPanel << kUnitySystrayWhitelist << whitelist);
|
||||
|
||||
tLog() << "Tomahawk has added itself to the Unity system tray" <<
|
||||
"whitelist, but this won't take effect until the next time" <<
|
||||
"you log out and log back in.";
|
||||
}
|
40
src/ubuntuunityhack.h
Normal file
40
src/ubuntuunityhack.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UBUNTUUNITYHACK_H
|
||||
#define UBUNTUUNITYHACK_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QProcess;
|
||||
|
||||
class UbuntuUnityHack : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
UbuntuUnityHack(QObject* parent = NULL);
|
||||
|
||||
private slots:
|
||||
void GetFinished(int exit_code);
|
||||
void GetError();
|
||||
|
||||
private:
|
||||
static const char* kGSettingsFileName;
|
||||
static const char* kUnityPanel;
|
||||
static const char* kUnitySystrayWhitelist;
|
||||
};
|
||||
|
||||
#endif // UBUNTUUNITYHACK_H
|
Reference in New Issue
Block a user