mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
Merge branch 'master' into leo-test
Conflicts: src/libtomahawk/playlist/dynamic/DynamicPlaylist.h src/libtomahawk/widgets/welcomeplaylistmodel.cpp
This commit is contained in:
@@ -20,6 +20,12 @@ SET( TOMAHAWK_VERSION_PATCH 0 )
|
||||
|
||||
# SET( TOMAHAWK_VERSION_RC 0 )
|
||||
|
||||
|
||||
# build options
|
||||
option(BUILD_GUI "Build Tomahawk with GUI" ON)
|
||||
|
||||
|
||||
# generate version string
|
||||
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
|
||||
# Use the date as the tweak level.
|
||||
INCLUDE( ${CMAKE_MODULE_PATH}/CMakeDateStamp.cmake )
|
||||
@@ -50,31 +56,27 @@ SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
|
||||
# installer creation
|
||||
INCLUDE( CPack.cmake )
|
||||
|
||||
# Check if we need qtgui:
|
||||
IF( "${gui}" STREQUAL "no" )
|
||||
ADD_DEFINITIONS( -DENABLE_HEADLESS )
|
||||
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
|
||||
FIND_PACKAGE( Qt4 4.7.0 COMPONENTS QtCore QtXml QtNetwork REQUIRED )
|
||||
ELSE()
|
||||
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
|
||||
FIND_PACKAGE( Qt4 4.7.0 COMPONENTS QtGui QtCore QtXml QtNetwork REQUIRED )
|
||||
ENDIF()
|
||||
|
||||
#deps
|
||||
INCLUDE( MacroOptionalFindPackage )
|
||||
INCLUDE( MacroLogFeature )
|
||||
|
||||
# required
|
||||
#While we distribute our own liblastfm2, don't need to look for it
|
||||
#macro_optional_find_package(LibLastFm 0.3.3)
|
||||
#macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
|
||||
set(LIBLASTFM_FOUND true)
|
||||
# Check if we need qtgui:
|
||||
SET(NEEDED_QT4_COMPONENTS QtCore QtXml QtNetwork )
|
||||
IF( NOT BUILD_GUI )
|
||||
ADD_DEFINITIONS( -DENABLE_HEADLESS )
|
||||
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
|
||||
ELSE()
|
||||
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
|
||||
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui")
|
||||
ENDIF()
|
||||
|
||||
find_package(Phonon REQUIRED)
|
||||
if(PHONON_VERSION STRLESS "4.5.0")
|
||||
message(FATAL_ERROR "Phonon version 4.5.0 or higher is required, you have version ${PHONON_VERSION}")
|
||||
else()
|
||||
message(STATUS "Phonon found; ensure that phonon-vlc is at least 0.4")
|
||||
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
|
||||
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "")
|
||||
|
||||
macro_optional_find_package(Phonon 4.5.0)
|
||||
macro_log_feature(PHONON_FOUND "Phonon" "The Phonon multimedia library" "http://phonon.kde.org" TRUE "" "")
|
||||
if(PHONON_FOUND)
|
||||
message(STATUS "Phonon found; ensure that phonon-vlc is at least 0.4")
|
||||
endif()
|
||||
|
||||
macro_optional_find_package(LibEchonest 1.1.7)
|
||||
@@ -88,6 +90,15 @@ macro_log_feature(QJSON_FOUND "QJson" "Qt library that maps JSON data to QVarian
|
||||
|
||||
macro_optional_find_package(Taglib 1.6.0)
|
||||
macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://developer.kde.org/~wheeler/taglib.html" TRUE "" "taglib is needed for reading meta data from audio files")
|
||||
include( CheckTagLibFileName )
|
||||
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
||||
|
||||
# required
|
||||
#While we distribute our own liblastfm2, don't need to look for it
|
||||
#macro_optional_find_package(LibLastFm 0.3.3)
|
||||
#macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
|
||||
set(LIBLASTFM_FOUND true)
|
||||
|
||||
|
||||
# this installs headers and such and should really be handled in a separate package by packagers
|
||||
IF( INTERNAL_JREEN )
|
||||
@@ -124,20 +135,22 @@ SET( LIBPORTFWD_LIBRARIES ${LIBPORTFWD_LIBRARY} )
|
||||
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/libportfwd )
|
||||
|
||||
# we need pthreads too
|
||||
find_package(Threads)
|
||||
macro_optional_find_package(Threads)
|
||||
macro_log_feature(THREADS_FOUND "Threads" "Threading Library" "" TRUE "" "Platform specific library for threading")
|
||||
|
||||
find_package(KDE4Installed)
|
||||
find_package(KDE4)
|
||||
IF(KDE4_FOUND)
|
||||
#KDE4 adds and removes some compiler flags that we don't like
|
||||
STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
|
||||
ELSE()
|
||||
SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
|
||||
ENDIF()
|
||||
macro_optional_find_package(KDE4Installed)
|
||||
|
||||
include( CheckTagLibFileName )
|
||||
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
||||
# this was used before we had FindKDE4Installed, just leaving it here to keep the flags
|
||||
# for future kde integration
|
||||
|
||||
# macro_optional_find_package(KDE4)
|
||||
# IF(KDE4_FOUND)
|
||||
# #KDE4 adds and removes some compiler flags that we don't like
|
||||
# STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
|
||||
# SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
|
||||
# ELSE()
|
||||
# SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
|
||||
# ENDIF()
|
||||
|
||||
IF( WIN32 )
|
||||
find_library(QTSPARKLE_LIBRARIES qtsparkle)
|
||||
|
@@ -12,9 +12,12 @@
|
||||
INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(FindLibraryWithDebug)
|
||||
|
||||
if(NOT CLUCENE_MIN_VERSION)
|
||||
set(CLUCENE_MIN_VERSION "0.9.23")
|
||||
endif(NOT CLUCENE_MIN_VERSION)
|
||||
|
||||
IF(CLucene_FIND_VERSION)
|
||||
SET(CLUCENE_MIN_VERSION ${CLucene_FIND_VERSION})
|
||||
ELSEIF()
|
||||
SET(CLUCENE_MIN_VERSION "0.9.23")
|
||||
ENDIF(CLucene_FIND_VERSION)
|
||||
|
||||
IF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
|
||||
INCLUDE(${PROJECT_CMAKE}/CLuceneConfig.cmake)
|
||||
|
@@ -38,14 +38,14 @@ else(PHONON_FOUND)
|
||||
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR})
|
||||
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
|
||||
|
||||
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
_phonon_find_version()
|
||||
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY AND NOT PHONON_VERSION VERSION_LESS ${Phonon_FIND_VERSION})
|
||||
set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
|
||||
set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
|
||||
set(PHONON_FOUND TRUE)
|
||||
_phonon_find_version()
|
||||
else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY AND NOT PHONON_VERSION VERSION_LESS ${Phonon_FIND_VERSION})
|
||||
set(PHONON_FOUND FALSE)
|
||||
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY AND NOT PHONON_VERSION VERSION_LESS ${Phonon_FIND_VERSION})
|
||||
|
||||
if(PHONON_FOUND)
|
||||
if(NOT PHONON_FIND_QUIETLY)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 7.3 KiB |
@@ -5,6 +5,7 @@
|
||||
<file>./data/images/back-pressed.png</file>
|
||||
<file>./data/images/back-rest.png</file>
|
||||
<file>./data/images/cover-shadow.png</file>
|
||||
<file>./data/images/filter.png</file>
|
||||
<file>./data/images/loved.png</file>
|
||||
<file>./data/images/not-loved.png</file>
|
||||
<file>./data/images/no-album-art-placeholder.png</file>
|
||||
|
@@ -66,7 +66,7 @@ PipelineStatusView::PipelineStatusView( AnimatedSplitter* parent )
|
||||
void
|
||||
PipelineStatusView::onPipelineUpdate( const query_ptr& query )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
tDebug() << Q_FUNC_INFO << query.isNull();
|
||||
|
||||
QTreeWidgetItem* ti = m_tree->invisibleRootItem()->child( 0 );
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include "diagnosticsdialog.h"
|
||||
#include "ui_diagnosticsdialog.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sip/SipHandler.h>
|
||||
#include <network/servent.h>
|
||||
#include <sourcelist.h>
|
||||
@@ -54,6 +56,11 @@ void DiagnosticsDialog::updateLogView()
|
||||
.arg( QDateTime::currentDateTime().toString() )
|
||||
);
|
||||
|
||||
// network
|
||||
log.append(
|
||||
"TOMAHAWK-VERSION: " TOMAHAWK_VERSION "\n\n\n"
|
||||
);
|
||||
|
||||
// network
|
||||
log.append(
|
||||
"NETWORK:\n"
|
||||
|
@@ -346,6 +346,10 @@ bool
|
||||
GlobalActionManager::doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems )
|
||||
{
|
||||
if( parts.size() && parts[ 0 ] == "track" ) {
|
||||
|
||||
if( queueSpotify( parts, queryItems ) )
|
||||
return true;
|
||||
|
||||
QPair< QString, QString > pair;
|
||||
|
||||
QString title, artist, album, urlStr;
|
||||
@@ -394,6 +398,28 @@ GlobalActionManager::doQueueAdd( const QStringList& parts, const QList< QPair< Q
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalActionManager::queueSpotify( const QStringList& , const QList< QPair< QString, QString > >& queryItems )
|
||||
{
|
||||
QString url;
|
||||
|
||||
QPair< QString, QString > pair;
|
||||
foreach( pair, queryItems ) {
|
||||
if( pair.first == "spotifyURL" )
|
||||
url = pair.second;
|
||||
else if( pair.first == "spotifyURI" )
|
||||
url = pair.second;
|
||||
}
|
||||
|
||||
if( url.isEmpty() )
|
||||
return false;
|
||||
|
||||
openSpotifyLink( url );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GlobalActionManager::handleSearchCommand( const QUrl& url )
|
||||
{
|
||||
@@ -581,6 +607,9 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
||||
}
|
||||
|
||||
if( parts[ 0 ] == "track" ) {
|
||||
if( playSpotify( url ) )
|
||||
return true;
|
||||
|
||||
QPair< QString, QString > pair;
|
||||
QString title, artist, album, urlStr;
|
||||
foreach( pair, url.queryItems() ) {
|
||||
@@ -607,6 +636,29 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalActionManager::playSpotify( const QUrl& url )
|
||||
{
|
||||
if( !url.hasQueryItem( "spotifyURI" ) && !url.hasQueryItem( "spotifyURL" ) )
|
||||
return false;
|
||||
|
||||
QString spotifyUrl = url.hasQueryItem( "spotifyURI" ) ? url.queryItemValue( "spotifyURI" ) : url.queryItemValue( "spotifyURL" );
|
||||
SpotifyParser* p = new SpotifyParser( spotifyUrl, this );
|
||||
connect( p, SIGNAL( track( Tomahawk::query_ptr ) ), this, SLOT( spotifyToPlay( Tomahawk::query_ptr ) ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GlobalActionManager::spotifyToPlay( const query_ptr& q )
|
||||
{
|
||||
Pipeline::instance()->resolve( q, true );
|
||||
|
||||
m_waitingToPlay = q;
|
||||
connect( q.data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( waitingForResolved( bool ) ) );
|
||||
}
|
||||
|
||||
|
||||
bool GlobalActionManager::handleBookmarkCommand(const QUrl& url)
|
||||
{
|
||||
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||
|
@@ -77,6 +77,8 @@ private slots:
|
||||
|
||||
void xspfCreated( const QByteArray& xspf );
|
||||
void expandedUrls( QStringList );
|
||||
|
||||
void spotifyToPlay( const Tomahawk::query_ptr& );
|
||||
private:
|
||||
explicit GlobalActionManager( QObject* parent = 0 );
|
||||
void doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahawk::query_ptr& q );
|
||||
@@ -93,6 +95,9 @@ private:
|
||||
bool handleOpenCommand(const QUrl& url );
|
||||
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||
|
||||
bool playSpotify( const QUrl& url );
|
||||
bool queueSpotify( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||
|
||||
/// handle parsing mime data
|
||||
void handleTrackUrls( const QString& urls );
|
||||
QList< Tomahawk::query_ptr > tracksFromQueryList( const QMimeData* d );
|
||||
|
@@ -291,10 +291,7 @@ Pipeline::shunt( const query_ptr& q )
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Reached end of pipeline for:" << q->toString();
|
||||
setQIDState( q, 0 );
|
||||
|
||||
q->onResolvingFinished();
|
||||
}
|
||||
|
||||
shuntNext();
|
||||
|
@@ -151,6 +151,20 @@ ArtistView::onItemActivated( const QModelIndex& index )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArtistView::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QTreeView::keyPressEvent( event );
|
||||
|
||||
if ( !model() )
|
||||
return;
|
||||
|
||||
if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return )
|
||||
{
|
||||
onItemActivated( currentIndex() );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArtistView::paintEvent( QPaintEvent* event )
|
||||
|
@@ -74,6 +74,7 @@ protected:
|
||||
virtual void resizeEvent( QResizeEvent* event );
|
||||
|
||||
void paintEvent( QPaintEvent* event );
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
|
||||
private slots:
|
||||
void onFilterChanged( const QString& filter );
|
||||
|
@@ -137,12 +137,13 @@ DynamicModel::trackResolveFinished( bool success )
|
||||
|
||||
Query* q = qobject_cast<Query*>( sender() );
|
||||
|
||||
qDebug() << "Got resolveFinished in DynamicModel" << q->track() << q->artist();
|
||||
if( !m_waitingFor.contains( q ) )
|
||||
tDebug() << "Got resolveFinished in DynamicModel" << q->track() << q->artist();
|
||||
if ( !m_waitingFor.contains( q ) )
|
||||
return;
|
||||
|
||||
if( !q->playable() ) {
|
||||
qDebug() << "Got not playable or resolved track:" << q->track() << q->artist() << m_lastResolvedRow << m_currentAttempts;
|
||||
if ( !q->playable() )
|
||||
{
|
||||
tDebug() << "Got not playable or resolved track:" << q->track() << q->artist() << m_lastResolvedRow << m_currentAttempts;
|
||||
m_currentAttempts++;
|
||||
|
||||
int curAttempts = m_startingAfterFailed ? m_currentAttempts - 20 : m_currentAttempts; // if we just failed, m_currentAttempts includes those failures
|
||||
@@ -154,7 +155,8 @@ DynamicModel::trackResolveFinished( bool success )
|
||||
emit trackGenerationFailure( tr( "Could not find a playable track.\n\nPlease change the filters or try again." ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
qDebug() << "Got successful resolved track:" << q->track() << q->artist() << m_lastResolvedRow << m_currentAttempts;
|
||||
|
||||
if( m_currentAttempts > 0 ) {
|
||||
|
@@ -91,7 +91,6 @@ class DLLEXPORT DynamicPlaylist : public Playlist
|
||||
public:
|
||||
virtual ~DynamicPlaylist();
|
||||
|
||||
|
||||
static Tomahawk::dynplaylist_ptr load( const QString& guid );
|
||||
|
||||
/// Generate an empty dynamic playlist with default generator
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
virtual ~DynamicWidget();
|
||||
|
||||
void loadDynamicPlaylist( const dynplaylist_ptr& playlist );
|
||||
dynplaylist_ptr playlist() { return m_playlist; }
|
||||
|
||||
virtual PlaylistInterface* playlistInterface() const;
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include "topbar.h"
|
||||
#include "ui_topbar.h"
|
||||
|
||||
#include "searchbutton.h"
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
#include <QRadioButton>
|
||||
#include <QFile>
|
||||
@@ -48,10 +50,12 @@ TopBar::TopBar( QWidget* parent )
|
||||
connect( ui->filterEdit, SIGNAL( textChanged( QString ) ), SIGNAL( filterTextChanged( QString ) ) );
|
||||
|
||||
ui->filterEdit->setStyleSheet( "QLineEdit { border: 1px solid gray; border-radius: 6px; margin-right: 2px; }" );
|
||||
ui->filterEdit->setInactiveText( tr( "Filter" ) );
|
||||
#ifdef Q_WS_MAC
|
||||
ui->filterEdit->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
#endif
|
||||
ui->filterEdit->setInactiveText( tr( "Filter" ) );
|
||||
|
||||
ui->filterEdit->searchButton()->setImage( QImage( RESPATH "images/filter.png" ) );
|
||||
|
||||
// initialise dudes
|
||||
for( int i = 0; i < MAXDUDES; ++i )
|
||||
|
@@ -127,8 +127,8 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
|
||||
}
|
||||
}
|
||||
|
||||
emit resultsAdded( newresults );
|
||||
checkResults();
|
||||
emit resultsAdded( newresults );
|
||||
}
|
||||
|
||||
|
||||
@@ -169,9 +169,12 @@ Query::removeResult( const Tomahawk::result_ptr& result )
|
||||
void
|
||||
Query::onResolvingFinished()
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "Finished resolving." << toString();
|
||||
m_resolveFinished = true;
|
||||
emit resolvingFinished( m_solved );
|
||||
tDebug() << "Finished resolving:" << toString();
|
||||
if ( !m_resolveFinished )
|
||||
{
|
||||
m_resolveFinished = true;
|
||||
emit resolvingFinished( m_solved );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +327,7 @@ Query::checkResults()
|
||||
emit solvedStateChanged( false );
|
||||
}
|
||||
|
||||
if( becameSolved )
|
||||
if ( becameSolved )
|
||||
emit solvedStateChanged( true );
|
||||
}
|
||||
|
||||
|
@@ -104,6 +104,11 @@ AnimatedSplitter::onSizeChanged( const QSize& size )
|
||||
if ( i == m_greedyIndex )
|
||||
{
|
||||
j = height() - size.height();
|
||||
for ( int x = 0; x < count(); x++ )
|
||||
{
|
||||
if ( x != i && x != wi )
|
||||
j -= widget( x )->height();
|
||||
}
|
||||
}
|
||||
else if ( i == wi )
|
||||
{
|
||||
@@ -145,7 +150,7 @@ AnimatedWidget::AnimatedWidget( AnimatedSplitter* parent )
|
||||
, m_isHidden( false )
|
||||
{
|
||||
m_timeLine = new QTimeLine( ANIMATION_TIME, this );
|
||||
m_timeLine->setUpdateInterval( 5 );
|
||||
m_timeLine->setUpdateInterval( 20 );
|
||||
m_timeLine->setEasingCurve( QEasingCurve::OutBack );
|
||||
|
||||
connect( m_timeLine, SIGNAL( frameChanged( int ) ), SLOT( onAnimationStep( int ) ) );
|
||||
|
@@ -621,6 +621,8 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
|
||||
}
|
||||
|
||||
m_stack->setCurrentWidget( page->widget() );
|
||||
page->widget()->setFocus();
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
|
@@ -31,11 +31,7 @@ HeaderLabel::HeaderLabel( QWidget* parent )
|
||||
{
|
||||
QFont f( font() );
|
||||
f.setBold( true );
|
||||
f.setPointSize( 11 );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
f.setPointSize( f.pointSize() - 2 );
|
||||
#endif
|
||||
f.setPixelSize( 12 );
|
||||
|
||||
setFont( f );
|
||||
setFixedHeight( sizeHint().height() + 8 );
|
||||
|
@@ -56,6 +56,8 @@ NewPlaylistWidget::NewPlaylistWidget( QWidget* parent )
|
||||
ui->suggestionsView->overlay()->setEnabled( false );
|
||||
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( updateSuggestions() ) );
|
||||
|
||||
ui->titleEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,9 +34,6 @@
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||
virtual bool isTemporaryPage() const { return true; }
|
||||
|
||||
virtual QString title() const { return tr( "Search" ); }
|
||||
virtual QString title() const { return QString( tr( "Search: %1" ) ).arg( m_search ); }
|
||||
virtual QString description() const { return tr( "Results for '%1'" ).arg( m_search ); }
|
||||
|
||||
virtual bool showStatsBar() const { return false; }
|
||||
|
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -20,11 +19,11 @@
|
||||
|
||||
#include "welcomeplaylistmodel.h"
|
||||
|
||||
#include <tomahawksettings.h>
|
||||
#include <audio/audioengine.h>
|
||||
#include <sourcelist.h>
|
||||
#include "tomahawksettings.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "sourcelist.h"
|
||||
#include "utils/logger.h"
|
||||
#include <dynamic/DynamicPlaylist.h>
|
||||
#include "dynamic/DynamicPlaylist.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@@ -159,6 +159,10 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
ui->lineEditLastfmPassword->setText(s->lastFmPassword() );
|
||||
connect( ui->pushButtonTestLastfmLogin, SIGNAL( clicked( bool) ), this, SLOT( testLastFmLogin() ) );
|
||||
|
||||
#ifdef Q_WS_MAC // FIXME
|
||||
ui->pushButtonTestLastfmLogin->setVisible( false );
|
||||
#endif
|
||||
|
||||
// SCRIPT RESOLVER
|
||||
ui->removeScript->setEnabled( false );
|
||||
ResolverConfigDelegate* del = new ResolverConfigDelegate( this );
|
||||
|
@@ -180,6 +180,20 @@ PlaylistItem::setData( const QVariant& v, bool role )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
PlaylistItem::activateCurrent()
|
||||
{
|
||||
if( ViewManager::instance()->pageForPlaylist( m_playlist ) == ViewManager::instance()->currentPage() )
|
||||
{
|
||||
model()->linkSourceItemToPage( this, ViewManager::instance()->currentPage() );
|
||||
emit selectRequest( this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
DynamicPlaylistItem::DynamicPlaylistItem( SourcesModel* mdl, SourceTreeItem* parent, const dynplaylist_ptr& pl, int index )
|
||||
: PlaylistItem( mdl, parent, pl.staticCast< Playlist >(), index )
|
||||
@@ -312,3 +326,18 @@ DynamicPlaylistItem::icon() const
|
||||
return QIcon( RESPATH "images/automatic-playlist.png" );
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DynamicPlaylistItem::activateCurrent()
|
||||
{
|
||||
if( ViewManager::instance()->pageForDynPlaylist( m_dynplaylist ) == ViewManager::instance()->currentPage() )
|
||||
{
|
||||
model()->linkSourceItemToPage( this, ViewManager::instance()->currentPage() );
|
||||
emit selectRequest( this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,8 @@ public:
|
||||
virtual bool setData(const QVariant& v, bool role);
|
||||
virtual int peerSortValue() const;
|
||||
|
||||
virtual bool activateCurrent();
|
||||
|
||||
protected:
|
||||
void setLoaded( bool loaded );
|
||||
|
||||
@@ -65,6 +67,7 @@ public:
|
||||
virtual int peerSortValue() const;
|
||||
virtual QIcon icon() const;
|
||||
|
||||
virtual bool activateCurrent();
|
||||
private slots:
|
||||
void onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision revision );
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "utils/logger.h"
|
||||
#include "globalactionmanager.h"
|
||||
#include "items/playlistitems.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -281,10 +282,37 @@ SourcesModel::viewPageActivated( Tomahawk::ViewPage* page )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_viewPageDelayedCacheItem = page;
|
||||
// HACK
|
||||
// try to find it if it is a playlist. not pretty at all.... but this happens when ViewManager loads a playlist or dynplaylist NOT from the sidebar but from somewhere else
|
||||
// we don't know which sourcetreeitem is related to it, so we have to find it. we also don't know if this page is a playlist or dynplaylist or not, but we can't check as we can't
|
||||
// include DynamicWidget.h here (so can't dynamic_cast).
|
||||
// this could also be fixed by keeping a master list of playlists/sourcetreeitems... but that's even uglier i think. this is only called the first time a certain viewpage is clicked from external
|
||||
// sources.
|
||||
if( activatePlaylistPage( page, m_rootItem ) )
|
||||
m_viewPageDelayedCacheItem = page;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SourcesModel::activatePlaylistPage( ViewPage* p, SourceTreeItem* i )
|
||||
{
|
||||
if( !i )
|
||||
return false;
|
||||
|
||||
if( qobject_cast< PlaylistItem* >( i ) &&
|
||||
qobject_cast< PlaylistItem* >( i )->activateCurrent() )
|
||||
return true;
|
||||
|
||||
bool ret = false;
|
||||
for( int k = 0; k < i->children().size(); k++ )
|
||||
{
|
||||
if( activatePlaylistPage( p, i->children().at( k ) ) )
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourcesModel::loadSources()
|
||||
@@ -328,7 +356,8 @@ SourcesModel::itemUpdated()
|
||||
return;
|
||||
|
||||
QModelIndex idx = indexFromItem( item );
|
||||
emit dataChanged( idx, idx );
|
||||
if( idx.isValid() )
|
||||
emit dataChanged( idx, idx );
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +458,11 @@ SourcesModel::indexFromItem( SourceTreeItem* item ) const
|
||||
QList< int > childIndexList;
|
||||
SourceTreeItem* curItem = item;
|
||||
while( curItem != m_rootItem ) {
|
||||
childIndexList << rowForItem( curItem );
|
||||
int row = rowForItem( curItem );
|
||||
if( row < 0 ) // something went wrong, bail
|
||||
return QModelIndex();
|
||||
|
||||
childIndexList << row;
|
||||
|
||||
curItem = curItem->parent();
|
||||
}
|
||||
@@ -448,6 +481,9 @@ SourcesModel::indexFromItem( SourceTreeItem* item ) const
|
||||
int
|
||||
SourcesModel::rowForItem( SourceTreeItem* item ) const
|
||||
{
|
||||
if( !item || !item->parent() || !item->parent()->children().contains( item ) )
|
||||
return -1;
|
||||
|
||||
return item->parent()->children().indexOf( item );
|
||||
}
|
||||
|
||||
|
@@ -113,6 +113,7 @@ private slots:
|
||||
private:
|
||||
SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const;
|
||||
int rowForItem( SourceTreeItem* item ) const;
|
||||
bool activatePlaylistPage( Tomahawk::ViewPage* p, SourceTreeItem* i );
|
||||
|
||||
SourceTreeItem* m_rootItem;
|
||||
|
||||
|
Reference in New Issue
Block a user