mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
Merge branch 'master' into proxytesting
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 15 KiB |
@@ -420,7 +420,8 @@ IF( APPLE )
|
||||
|
||||
SET( libSources ${libSources}
|
||||
infosystem/infoplugins/mac/adium.mm
|
||||
infosystem/infoplugins/mac/adiumplugin.cpp )
|
||||
infosystem/infoplugins/mac/adiumplugin.cpp
|
||||
utils/tomahawkutils_mac.mm )
|
||||
|
||||
SET( libHeaders ${libHeaders}
|
||||
infosystem/infoplugins/mac/adium.h
|
||||
@@ -433,6 +434,8 @@ IF( APPLE )
|
||||
${COREFOUNDATION_LIBRARY}
|
||||
${FOUNDATION_LIBRARY}
|
||||
${SCRIPTINGBRIDGE_LIBRARY}
|
||||
|
||||
/System/Library/Frameworks/AppKit.framework
|
||||
)
|
||||
ENDIF( APPLE )
|
||||
|
||||
|
@@ -520,10 +520,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
if ( newState == Phonon::PlayingState )
|
||||
setState( Playing );
|
||||
|
||||
if ( !m_expectStop )
|
||||
return;
|
||||
m_expectStop = false;
|
||||
|
||||
if ( oldState == Phonon::PlayingState )
|
||||
{
|
||||
qint64 duration = m_mediaObject->totalTime() > 0 ? m_mediaObject->totalTime() : m_currentTrack->duration() * 1000;
|
||||
@@ -533,7 +529,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
case Phonon::PausedState:
|
||||
{
|
||||
stopped = ( duration - 1000 < m_mediaObject->currentTime() );
|
||||
|
||||
if ( !stopped )
|
||||
setState( Paused );
|
||||
|
||||
@@ -548,8 +543,9 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( stopped )
|
||||
if ( stopped && m_expectStop )
|
||||
{
|
||||
m_expectStop = false;
|
||||
qDebug() << "Loading next track.";
|
||||
loadNextTrack();
|
||||
}
|
||||
|
@@ -668,12 +668,18 @@ GlobalActionManager::showPlaylist()
|
||||
void
|
||||
GlobalActionManager::waitingForResolved( bool success )
|
||||
{
|
||||
if( m_waitingToPlay.data() != sender() )
|
||||
{
|
||||
m_waitingToPlay.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if( success && !m_waitingToPlay.isNull() && !m_waitingToPlay->results().isEmpty() ) { // play it!
|
||||
// AudioEngine::instance()->playItem( AudioEngine::instance()->playlist(), m_waitingToPlay->results().first() );
|
||||
AudioEngine::instance()->play();
|
||||
}
|
||||
|
||||
m_waitingToPlay.clear();
|
||||
m_waitingToPlay.clear();
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
|
@@ -209,7 +209,7 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
|
||||
}
|
||||
else
|
||||
{
|
||||
new FuncTimeout( 500, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
|
||||
new FuncTimeout( 50, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ Pipeline::shuntNext()
|
||||
}
|
||||
|
||||
setQIDState( q, rc );
|
||||
new FuncTimeout( 500, boost::bind( &Pipeline::shunt, this, q ), this );
|
||||
new FuncTimeout( 50, boost::bind( &Pipeline::shunt, this, q ), this );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -38,8 +38,7 @@ AlbumItemDelegate::AlbumItemDelegate( QAbstractItemView* parent, AlbumProxyModel
|
||||
, m_model( proxy )
|
||||
{
|
||||
m_shadowPixmap = QPixmap( RESPATH "images/cover-shadow.png" );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" );
|
||||
}
|
||||
|
||||
|
||||
@@ -62,18 +61,20 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
initStyleOption( &opt, QModelIndex() );
|
||||
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
if ( option.state & QStyle::State_Selected )
|
||||
{
|
||||
opt.palette.setColor( QPalette::Text, opt.palette.color( QPalette::HighlightedText ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
painter->save();
|
||||
|
||||
// painter->setRenderHint( QPainter::Antialiasing );
|
||||
// painter->drawPixmap( option.rect.adjusted( 4, 4, -4, -38 ), m_shadowPixmap );
|
||||
|
||||
QPixmap cover = item->cover.isNull() ? m_defaultCover : item->cover;
|
||||
painter->drawPixmap( option.rect.adjusted( 6, 4, -6, -41 ), cover );
|
||||
QRect r = option.rect.adjusted( 6, 4, -6, -41 );
|
||||
painter->drawPixmap( r, cover.scaled( r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
painter->setPen( opt.palette.color( QPalette::Text ) );
|
||||
|
||||
QTextOption to;
|
||||
|
@@ -25,7 +25,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>InfoBar</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,1,0,0,0">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
|
@@ -67,7 +67,7 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
|
||||
{
|
||||
int style = index.data( TrackModel::StyleRole ).toInt();
|
||||
if ( style == TrackModel::Short )
|
||||
size.setHeight( 48 );
|
||||
size.setHeight( 44 );
|
||||
}
|
||||
|
||||
return size;
|
||||
@@ -198,7 +198,7 @@ PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem&
|
||||
painter->setPen( opt.palette.text().color() );
|
||||
|
||||
QRect ir = r.adjusted( 4, 0, -option.rect.width() + option.rect.height() - 8 + r.left(), 0 );
|
||||
painter->drawPixmap( ir, pixmap );
|
||||
painter->drawPixmap( ir, pixmap.scaled( ir.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
//painter->drawPixmap( ir, item->cover );
|
||||
|
||||
QFont boldFont = opt.font;
|
||||
|
@@ -52,6 +52,8 @@ void SearchLineEdit::init()
|
||||
addWidget(m_clearButton, RightSide);
|
||||
m_clearButton->hide();
|
||||
|
||||
setWidgetSpacing(5);
|
||||
|
||||
updateTextMargins();
|
||||
setInactiveText(tr("Search"));
|
||||
}
|
||||
|
@@ -40,8 +40,7 @@ TreeItemDelegate::TreeItemDelegate( ArtistView* parent, TreeProxyModel* proxy )
|
||||
, m_model( proxy )
|
||||
{
|
||||
m_nowPlayingIcon = QPixmap( RESPATH "images/now-playing-speaker.png" );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" );
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +134,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
// painter->drawPixmap( r, QPixmap( RESPATH "images/cover-shadow.png" ) );
|
||||
|
||||
QPixmap cover = item->cover.isNull() ? m_defaultCover : item->cover;
|
||||
painter->drawPixmap( r, cover );
|
||||
painter->drawPixmap( r, cover.scaled( r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
|
||||
QTextOption to;
|
||||
to.setAlignment( Qt::AlignVCenter );
|
||||
|
@@ -447,6 +447,17 @@ TomahawkSettings::setVerboseNotifications( bool notifications )
|
||||
setValue( "ui/notifications/verbose", notifications );
|
||||
}
|
||||
|
||||
bool
|
||||
TomahawkSettings::showOfflineSources() const
|
||||
{
|
||||
return value( "collection/sources/showoffline", false ).toBool();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setShowOfflineSources( bool show )
|
||||
{
|
||||
setValue( "collection/sources/showoffline", show );
|
||||
}
|
||||
|
||||
QByteArray
|
||||
TomahawkSettings::playlistColumnSizes( const QString& playlistid ) const
|
||||
|
@@ -71,6 +71,10 @@ public:
|
||||
bool verboseNotifications() const;
|
||||
void setVerboseNotifications( bool notifications );
|
||||
|
||||
// Collection Stuff
|
||||
bool showOfflineSources() const;
|
||||
void setShowOfflineSources( bool show );
|
||||
|
||||
/// Playlist stuff
|
||||
QByteArray playlistColumnSizes( const QString& playlistid ) const;
|
||||
void setPlaylistColumnSizes( const QString& playlistid, const QByteArray& state );
|
||||
|
@@ -460,5 +460,11 @@ setNam( QNetworkAccessManager* nam )
|
||||
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
void
|
||||
bringToFront() {
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
} // ns
|
||||
|
@@ -80,6 +80,9 @@ namespace TomahawkUtils
|
||||
|
||||
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
||||
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
||||
|
||||
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
||||
DLLEXPORT void bringToFront();
|
||||
}
|
||||
|
||||
#endif // TOMAHAWKUTILS_H
|
||||
|
13
src/libtomahawk/utils/tomahawkutils_mac.mm
Normal file
13
src/libtomahawk/utils/tomahawkutils_mac.mm
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "tomahawkutils.h"
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
namespace TomahawkUtils
|
||||
{
|
||||
|
||||
void
|
||||
bringToFront() {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
}
|
@@ -240,10 +240,10 @@ ViewManager::show( const Tomahawk::album_ptr& album )
|
||||
{
|
||||
view = new PlaylistView();
|
||||
PlaylistModel* model = new PlaylistModel();
|
||||
model->append( album );
|
||||
view->setPlaylistModel( model );
|
||||
view->setFrameShape( QFrame::NoFrame );
|
||||
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
model->append( album );
|
||||
|
||||
m_albumViews.insert( album, view );
|
||||
}
|
||||
|
@@ -14,9 +14,18 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="3,3">
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label">
|
||||
@@ -26,11 +35,15 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PlaylistView" name="topHits"/>
|
||||
<widget class="PlaylistView" name="topHits">
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_2">
|
||||
@@ -40,11 +53,15 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ArtistView" name="relatedArtists"/>
|
||||
<widget class="ArtistView" name="relatedArtists">
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -63,6 +80,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PlaylistView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>playlist/playlistview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HeaderLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
@@ -73,11 +95,6 @@
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">artistview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PlaylistView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">playlistview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@@ -68,14 +68,14 @@ QtScriptResolverHelper::compress( const QString& data )
|
||||
|
||||
|
||||
QString
|
||||
QtScriptResolverHelper::readCompressed(const QString& fileName)
|
||||
QtScriptResolverHelper::readCompressed( const QString& fileName )
|
||||
{
|
||||
return compress( readRaw( fileName ) );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
QtScriptResolverHelper::readBase64(const QString& fileName)
|
||||
QtScriptResolverHelper::readBase64( const QString& fileName )
|
||||
{
|
||||
return readRaw( fileName ).toBase64();
|
||||
}
|
||||
@@ -91,7 +91,8 @@ QtScriptResolverHelper::resolverData()
|
||||
}
|
||||
|
||||
|
||||
void QtScriptResolverHelper::log(const QString& message)
|
||||
void
|
||||
QtScriptResolverHelper::log( const QString& message )
|
||||
{
|
||||
qDebug() << m_scriptPath << ":" << message;
|
||||
}
|
||||
@@ -104,6 +105,14 @@ QtScriptResolverHelper::setResolverConfig( QVariantMap config )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptEngine::javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID )
|
||||
{
|
||||
qDebug() << "JAVASCRIPT:" << m_scriptPath << message << lineNumber << sourceID;
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
|
||||
|
||||
QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
||||
: Tomahawk::ExternalResolver( scriptPath )
|
||||
, m_ready( false )
|
||||
@@ -118,7 +127,8 @@ QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Failed loading JavaScript resolver:" << scriptPath;
|
||||
m_error = Tomahawk::ExternalResolver::FileNotFound;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -132,6 +142,7 @@ QtScriptResolver::~QtScriptResolver()
|
||||
delete m_engine;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QtScriptResolver::reload()
|
||||
{
|
||||
@@ -145,6 +156,7 @@ QtScriptResolver::reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QtScriptResolver::init()
|
||||
{
|
||||
@@ -176,13 +188,13 @@ QtScriptResolver::init()
|
||||
resolverInit();
|
||||
|
||||
QVariantMap m = resolverSettings();
|
||||
m_name = m.value( "name" ).toString();
|
||||
m_weight = m.value( "weight", 0 ).toUInt();
|
||||
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
||||
m_name = m.value( "name" ).toString();
|
||||
m_weight = m.value( "weight", 0 ).toUInt();
|
||||
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
||||
|
||||
// load config widget and apply settings
|
||||
loadUi();
|
||||
QVariantMap config = resolverUserConfig();
|
||||
QVariantMap config = resolverUserConfig();
|
||||
fillDataInWidgets( config );
|
||||
|
||||
qDebug() << Q_FUNC_INFO << m_name << m_weight << m_timeout;
|
||||
@@ -191,32 +203,31 @@ QtScriptResolver::init()
|
||||
Tomahawk::Pipeline::instance()->addResolver( this );
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::ExternalResolver::ErrorState
|
||||
QtScriptResolver::error() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
// qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
||||
QMetaObject::invokeMethod( this, "resolve", Qt::QueuedConnection, Q_ARG(Tomahawk::query_ptr, query) );
|
||||
return;
|
||||
}
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << query->toString();
|
||||
QString eval;
|
||||
|
||||
if ( !query->isFullTextQuery() )
|
||||
{
|
||||
eval = QString( RESOLVER_LEGACY_CODE2 "resolver.resolve( '%1', '%2', '%3', '%4' );" )
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->artist().replace( "'", "\\'" ) )
|
||||
.arg( query->album().replace( "'", "\\'" ) )
|
||||
.arg( query->track().replace( "'", "\\'" ) );
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->artist().replace( "'", "\\'" ) )
|
||||
.arg( query->album().replace( "'", "\\'" ) )
|
||||
.arg( query->track().replace( "'", "\\'" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -225,9 +236,9 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
||||
"} else {"
|
||||
" resolve( '%1', '', '', '%2' );"
|
||||
"}"
|
||||
)
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->fullTextQuery().replace( "'", "\\'" ) );
|
||||
)
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->fullTextQuery().replace( "'", "\\'" ) );
|
||||
}
|
||||
|
||||
QList< Tomahawk::result_ptr > results;
|
||||
|
@@ -50,7 +50,7 @@ public slots:
|
||||
QString compress( const QString& data );
|
||||
QVariantMap resolverData();
|
||||
|
||||
void log( const QString& message);
|
||||
void log( const QString& message );
|
||||
bool fakeEnv() { return false; }
|
||||
|
||||
private:
|
||||
@@ -86,8 +86,7 @@ public slots:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID )
|
||||
{ qDebug() << "JAVASCRIPT:" << m_scriptPath << message << lineNumber << sourceID; Q_ASSERT(false);}
|
||||
virtual void javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID );
|
||||
|
||||
private:
|
||||
QtScriptResolver* m_parent;
|
||||
|
@@ -44,21 +44,12 @@ SourcesProxyModel::SourcesProxyModel( SourcesModel* model, QObject* parent )
|
||||
|
||||
|
||||
void
|
||||
SourcesProxyModel::showOfflineSources()
|
||||
SourcesProxyModel::showOfflineSources( bool offlineSourcesShown )
|
||||
{
|
||||
m_filtered = false;
|
||||
m_filtered = !offlineSourcesShown;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourcesProxyModel::hideOfflineSources()
|
||||
{
|
||||
m_filtered = true;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SourcesProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
|
||||
{
|
||||
|
@@ -31,8 +31,7 @@ public:
|
||||
explicit SourcesProxyModel( SourcesModel* model, QObject* parent = 0 );
|
||||
|
||||
public slots:
|
||||
void showOfflineSources();
|
||||
void hideOfflineSources();
|
||||
void showOfflineSources( bool offlineSourcesShown );
|
||||
|
||||
void selectRequested( const QModelIndex& );
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "sourcetree/items/collectionitem.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "sourceplaylistinterface.h"
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
@@ -110,7 +111,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
connect( this, SIGNAL( expanded( QModelIndex ) ), this, SLOT( onItemExpanded( QModelIndex ) ) );
|
||||
// connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );
|
||||
|
||||
hideOfflineSources();
|
||||
showOfflineSources( TomahawkSettings::instance()->showOfflineSources() );
|
||||
|
||||
// Light-blue sourcetree on osx
|
||||
#ifdef Q_WS_MAC
|
||||
@@ -199,19 +200,11 @@ SourceTreeView::setupMenus()
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::showOfflineSources()
|
||||
SourceTreeView::showOfflineSources( bool offlineSourcesShown )
|
||||
{
|
||||
m_proxyModel->showOfflineSources();
|
||||
m_proxyModel->showOfflineSources( offlineSourcesShown );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::hideOfflineSources()
|
||||
{
|
||||
m_proxyModel->hideOfflineSources();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
|
@@ -38,8 +38,7 @@ public:
|
||||
explicit SourceTreeView( QWidget* parent = 0 );
|
||||
|
||||
public slots:
|
||||
void showOfflineSources();
|
||||
void hideOfflineSources();
|
||||
void showOfflineSources( bool offlineSourcesShown );
|
||||
|
||||
void renamePlaylist();
|
||||
signals:
|
||||
|
@@ -250,6 +250,8 @@ TomahawkApp::init()
|
||||
|
||||
Tomahawk::setApplicationHandler( this );
|
||||
increaseMaxFileDescriptors();
|
||||
|
||||
setQuitOnLastWindowClosed( false );
|
||||
#endif
|
||||
|
||||
// Connect up shortcuts
|
||||
@@ -570,7 +572,7 @@ void
|
||||
TomahawkApp::activate()
|
||||
{
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
mainWindow()->show();
|
||||
TomahawkUtils::bringToFront();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -578,6 +580,7 @@ TomahawkApp::activate()
|
||||
bool
|
||||
TomahawkApp::loadUrl( const QString& url )
|
||||
{
|
||||
activate();
|
||||
if ( url.startsWith( "tomahawk://" ) )
|
||||
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
||||
else
|
||||
|
@@ -95,10 +95,10 @@ public:
|
||||
Tomahawk::ExternalResolver* resolverForPath( const QString& scriptPath );
|
||||
|
||||
// PlatformInterface
|
||||
virtual void activate();
|
||||
virtual bool loadUrl( const QString& url );
|
||||
|
||||
public slots:
|
||||
virtual void activate();
|
||||
void instanceStarted( KDSingleApplicationGuard::Instance );
|
||||
|
||||
private slots:
|
||||
|
@@ -30,6 +30,7 @@
|
||||
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
: QSystemTrayIcon( parent )
|
||||
, m_currentAnimationFrame( 0 )
|
||||
, m_showWindowAction( 0 )
|
||||
{
|
||||
QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
|
||||
setIcon( icon );
|
||||
@@ -45,6 +46,15 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
m_prevAction = m_contextMenu->addAction( tr( "Previous Track" ) );
|
||||
m_nextAction = m_contextMenu->addAction( tr( "Next Track" ) );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||
m_contextMenu->addSeparator();
|
||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction->setData( true );
|
||||
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
|
||||
#endif
|
||||
|
||||
m_contextMenu->addSeparator();
|
||||
m_quitAction = m_contextMenu->addAction( tr( "Quit" ) );
|
||||
|
||||
@@ -69,6 +79,33 @@ TomahawkTrayIcon::~TomahawkTrayIcon()
|
||||
delete m_contextMenu;
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::setShowHideWindow( bool show )
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
m_showWindowAction->setText( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction->setData( show );
|
||||
} else {
|
||||
m_showWindowAction->setText( tr( "Show Tomahawk Window" ) );
|
||||
}
|
||||
m_showWindowAction->setData( show );
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::showWindow()
|
||||
{
|
||||
if( !m_showWindowAction->data().toBool() )
|
||||
{
|
||||
APP->mainWindow()->show();
|
||||
APP->mainWindow()->raise();
|
||||
|
||||
setShowHideWindow( true );
|
||||
} else {
|
||||
APP->mainWindow()->hide();
|
||||
setShowHideWindow( false );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::setResult( const Tomahawk::result_ptr& result )
|
||||
|
@@ -33,12 +33,15 @@ public:
|
||||
TomahawkTrayIcon( QObject* parent );
|
||||
virtual bool event( QEvent* e );
|
||||
|
||||
void setShowHideWindow( bool show = true );
|
||||
|
||||
public slots:
|
||||
void setResult( const Tomahawk::result_ptr& result );
|
||||
|
||||
private slots:
|
||||
void onAnimationTimer();
|
||||
void onActivated( QSystemTrayIcon::ActivationReason reason );
|
||||
void showWindow();
|
||||
|
||||
private:
|
||||
void refreshToolTip();
|
||||
@@ -57,6 +60,8 @@ private:
|
||||
QAction* m_prevAction;
|
||||
QAction* m_nextAction;
|
||||
QAction* m_quitAction;
|
||||
|
||||
QAction* m_showWindowAction;
|
||||
};
|
||||
|
||||
#endif // TOMAHAWK_TRAYICON_H
|
||||
|
@@ -160,13 +160,11 @@ TomahawkWindow::saveSettings()
|
||||
void
|
||||
TomahawkWindow::applyPlatformTweaks()
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
// HACK QtCurve causes an infinite loop on startup. This is because setStyle calls setPalette, which calls ensureBaseStyle,
|
||||
// which loads QtCurve. QtCurve calls setPalette, which creates an infinite loop. The UI will look like CRAP with QtCurve, but
|
||||
// the user is asking for it explicitly... so he's gonna be stuck with an ugly UI.
|
||||
if ( !QString( qApp->style()->metaObject()->className() ).toLower().contains( "qtcurve" ) )
|
||||
qApp->setStyle( new ProxyStyle() );
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
setUnifiedTitleAndToolBarOnMac( true );
|
||||
@@ -208,6 +206,9 @@ TomahawkWindow::setupSideBar()
|
||||
ui->splitter->setStretchFactor( 1, 3 );
|
||||
ui->splitter->setCollapsible( 1, false );
|
||||
ui->splitter->setHandleWidth( 1 );
|
||||
|
||||
ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -300,8 +301,7 @@ TomahawkWindow::setupSignals()
|
||||
connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() ));
|
||||
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
||||
connect( ui->actionExit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
|
||||
connect( ui->actionHideOfflineSources, SIGNAL( triggered() ), m_sourcetree, SLOT( hideOfflineSources() ) );
|
||||
connect( ui->actionShowOfflineSources, SIGNAL( triggered() ), m_sourcetree, SLOT( showOfflineSources() ) );
|
||||
connect( ui->actionShowOfflineSources, SIGNAL( triggered() ), SLOT( showOfflineSources() ) );
|
||||
|
||||
connect( ui->actionPlay, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) );
|
||||
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
@@ -362,6 +362,8 @@ TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
m_trayIcon->setShowHideWindow( false );
|
||||
#endif
|
||||
|
||||
e->accept();
|
||||
@@ -476,6 +478,13 @@ TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkWindow::showOfflineSources()
|
||||
{
|
||||
m_sourcetree->showOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
||||
TomahawkSettings::instance()->setShowOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::loadSpiff()
|
||||
@@ -669,7 +678,7 @@ void
|
||||
TomahawkWindow::onSearch()
|
||||
{
|
||||
ViewManager::instance()->show( new SearchWidget( m_searchWidget->searchEdit->text(), this ) );
|
||||
m_searchWidget->searchEdit->setText( QString() );
|
||||
m_searchWidget->searchEdit->clear();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -71,6 +71,7 @@ public slots:
|
||||
void rescanCollectionManually();
|
||||
void pluginMenuAdded(QMenu*);
|
||||
void pluginMenuRemoved(QMenu*);
|
||||
void showOfflineSources();
|
||||
|
||||
private slots:
|
||||
void onSipConnected();
|
||||
|
@@ -35,7 +35,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>20</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
@@ -56,7 +56,6 @@
|
||||
<addaction name="actionRescanCollection"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShowOfflineSources"/>
|
||||
<addaction name="actionHideOfflineSources"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
@@ -164,6 +163,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowOfflineSources">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Offline Sources</string>
|
||||
</property>
|
||||
|
Reference in New Issue
Block a user