mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 00:12:06 +02:00
Merge remote branch 'origin/master' into dynamic
This commit is contained in:
commit
77120e8ac8
@ -40,8 +40,6 @@ namespace Tomahawk
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
class TomahawkWindow;
|
||||
class PlaylistManager;
|
||||
#include <QStackedWidget>
|
||||
#endif
|
||||
|
||||
|
||||
@ -85,6 +83,7 @@ private:
|
||||
QList<Tomahawk::collection_ptr> m_collections;
|
||||
QList<TomahawkPlugin*> m_plugins;
|
||||
|
||||
Database* m_database;
|
||||
AudioEngine* m_audioEngine;
|
||||
SipHandler* m_sipHandler;
|
||||
Servent* m_servent;
|
||||
|
@ -127,6 +127,7 @@ set( libSources
|
||||
|
||||
widgets/newplaylistwidget.cpp
|
||||
widgets/welcomewidget.cpp
|
||||
widgets/overlaywidget.cpp
|
||||
widgets/infowidgets/sourceinfowidget.cpp
|
||||
)
|
||||
|
||||
@ -246,6 +247,7 @@ set( libHeaders
|
||||
|
||||
widgets/newplaylistwidget.h
|
||||
widgets/welcomewidget.h
|
||||
widgets/overlaywidget.h
|
||||
widgets/infowidgets/sourceinfowidget.h
|
||||
)
|
||||
|
||||
|
@ -69,8 +69,6 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
||||
QList< int > tracks = lib->searchTable( "track", trackname, 10 );
|
||||
QList< int > albums = lib->searchTable( "album", albumname, 10 );
|
||||
|
||||
//qDebug() << "searchTable calls duration:" << timer.elapsed() << "ms";
|
||||
|
||||
if( artists.length() == 0 || tracks.length() == 0 )
|
||||
{
|
||||
//qDebug() << "No candidates found in first pass, aborting resolve" << artistname << trackname;
|
||||
@ -145,7 +143,7 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
||||
{
|
||||
//qDebug() << "Skipping result for offline sourceid:" << files_query.value( 13 ).toUInt();
|
||||
// will happen for valid sources which are offline (and thus not in the sourcelist)
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
m.insert( "url", QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "sourcelist.h"
|
||||
|
||||
#include "portfwdthread.h"
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -82,30 +83,38 @@ Servent::startListening( QHostAddress ha, bool upnp, int port )
|
||||
}
|
||||
|
||||
// --lanhack means to advertise your LAN IP over jabber as if it were externallyVisible
|
||||
if( qApp->arguments().contains( "--lanhack" ) )
|
||||
switch( TomahawkSettings::instance()->externalAddressMode() )
|
||||
{
|
||||
QList<QHostAddress> ifs = QNetworkInterface::allAddresses();
|
||||
foreach( QHostAddress ha, ifs )
|
||||
{
|
||||
if( ha.toString() == "127.0.0.1" ) continue;
|
||||
if( ha.toString().contains( ":" ) ) continue; //ipv6
|
||||
case TomahawkSettings::Lan:
|
||||
foreach( QHostAddress ha, QNetworkInterface::allAddresses() )
|
||||
{
|
||||
if( ha.toString() == "127.0.0.1" ) continue;
|
||||
if( ha.toString().contains( ":" ) ) continue; //ipv6
|
||||
|
||||
m_externalAddress = ha;
|
||||
m_externalPort = m_port;
|
||||
qDebug() << "LANHACK: set external address to lan address" << ha.toString();
|
||||
m_externalAddress = ha;
|
||||
m_externalPort = m_port;
|
||||
qDebug() << "LANHACK: set external address to lan address" << ha.toString();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( upnp )
|
||||
{
|
||||
// TODO check if we have a public/internet IP on this machine directly
|
||||
m_portfwd = new PortFwdThread( m_port );
|
||||
connect( m_portfwd, SIGNAL( externalAddressDetected( QHostAddress, unsigned int ) ),
|
||||
SLOT( setExternalAddress( QHostAddress, unsigned int ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
emit ready();
|
||||
|
||||
case TomahawkSettings::DynDns:
|
||||
qDebug() << "External address mode set to dyndns...";
|
||||
m_externalHostname = TomahawkSettings::instance()->externalHostname();
|
||||
m_externalPort = TomahawkSettings::instance()->externalPort();
|
||||
qDebug() << m_externalHostname << m_externalPort;
|
||||
break;
|
||||
|
||||
case TomahawkSettings::Upnp:
|
||||
// TODO check if we have a public/internet IP on this machine directly
|
||||
qDebug() << "External address mode set to upnp....";
|
||||
m_portfwd = new PortFwdThread( m_port );
|
||||
connect( m_portfwd, SIGNAL( externalAddressDetected( QHostAddress, unsigned int ) ),
|
||||
SLOT( setExternalAddress( QHostAddress, unsigned int ) ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
emit ready();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -4,7 +4,7 @@
|
||||
// port for servent to listen on
|
||||
#define DEFAULT_LISTEN_PORT 50210
|
||||
// time before new connection terminates if no auth received
|
||||
#define AUTH_TIMEOUT 15000
|
||||
#define AUTH_TIMEOUT 180000
|
||||
|
||||
#include <QObject>
|
||||
#include <QTcpServer>
|
||||
@ -90,8 +90,8 @@ public:
|
||||
void connectToPeer( const QString& ha, int port, const QString &key, Connection* conn );
|
||||
void reverseOfferRequest( ControlConnection* orig_conn, const QString& key, const QString& theirkey );
|
||||
|
||||
bool visibleExternally() const { return m_externalPort > 0 && !m_externalAddress.isNull(); }
|
||||
QHostAddress externalAddress() const { return m_externalAddress; }
|
||||
bool visibleExternally() const { return !m_externalHostname.isNull() || (m_externalPort > 0 && !m_externalAddress.isNull()); }
|
||||
QString externalAddress() const { return !m_externalHostname.isNull() ? m_externalHostname : m_externalAddress.toString(); }
|
||||
int externalPort() const { return m_externalPort; }
|
||||
|
||||
QSharedPointer<QIODevice> remoteIODeviceFactory( const Tomahawk::result_ptr& );
|
||||
@ -142,6 +142,7 @@ private:
|
||||
QMap< QString, QPointer<Connection> > m_offers;
|
||||
int m_port, m_externalPort;
|
||||
QHostAddress m_externalAddress;
|
||||
QString m_externalHostname;
|
||||
|
||||
// currently active file transfers:
|
||||
QList< FileTransferConnection* > m_ftsessions;
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "playlist/collectionproxymodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -69,3 +71,17 @@ CollectionView::onCustomContextMenu( const QPoint& pos )
|
||||
|
||||
m_itemMenu.exec( mapToGlobal( pos ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionView::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
TrackView::paintEvent( event );
|
||||
QPainter painter( viewport() );
|
||||
|
||||
if ( !model()->trackCount() )
|
||||
{
|
||||
overlay()->setText( tr( "This collection is empty." ) );
|
||||
overlay()->paint( &painter );
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ private slots:
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent* event );
|
||||
void paintEvent( QPaintEvent* event );
|
||||
|
||||
private:
|
||||
void setupMenus();
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "playlist/playlistproxymodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -105,3 +107,17 @@ PlaylistView::deleteItems()
|
||||
{
|
||||
proxyModel()->removeIndexes( selectedIndexes() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistView::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
TrackView::paintEvent( event );
|
||||
QPainter painter( viewport() );
|
||||
|
||||
if ( !model()->trackCount() )
|
||||
{
|
||||
overlay()->setText( tr( "This playlist is currently empty. Add some tracks to it and enjoy the music!" ) );
|
||||
overlay()->paint( &painter );
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
void paintEvent( QPaintEvent* event );
|
||||
|
||||
private slots:
|
||||
void onCustomContextMenu( const QPoint& pos );
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
|
||||
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
|
||||
|
||||
virtual QString filter() const { return filterRegExp().pattern(); }
|
||||
virtual void setFilter( const QString& pattern );
|
||||
|
||||
virtual PlaylistInterface::RepeatMode repeatMode() const { return m_repeatMode; }
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
#include "trackheader.h"
|
||||
#include "playlistmanager.h"
|
||||
@ -23,6 +24,7 @@ TrackView::TrackView( QWidget* parent )
|
||||
, m_proxyModel( 0 )
|
||||
, m_delegate( 0 )
|
||||
, m_header( new TrackHeader( this ) )
|
||||
, m_overlay( new OverlayWidget( this ) )
|
||||
, m_resizing( false )
|
||||
{
|
||||
setSortingEnabled( false );
|
||||
@ -54,6 +56,8 @@ TrackView::TrackView( QWidget* parent )
|
||||
TrackView::~TrackView()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
delete m_overlay;
|
||||
}
|
||||
|
||||
|
||||
@ -245,11 +249,18 @@ void
|
||||
TrackView::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
QTreeView::paintEvent( event );
|
||||
QPainter painter( viewport() );
|
||||
|
||||
if ( !proxyModel()->filter().isEmpty() && !proxyModel()->trackCount() &&
|
||||
model()->trackCount() )
|
||||
{
|
||||
m_overlay->setText( tr( "Sorry, your filter '%1' did not match any results." ).arg( proxyModel()->filter() ) );
|
||||
m_overlay->paint( &painter );
|
||||
}
|
||||
|
||||
if ( m_dragging )
|
||||
{
|
||||
// draw drop indicator
|
||||
QPainter painter( viewport() );
|
||||
{
|
||||
// draw indicator for inserting items
|
||||
QBrush blendedBrush = viewOptions().palette.brush( QPalette::Normal, QPalette::Highlight );
|
||||
|
@ -12,6 +12,7 @@ class PlaylistInterface;
|
||||
class TrackHeader;
|
||||
class TrackModel;
|
||||
class TrackProxyModel;
|
||||
class OverlayWidget;
|
||||
|
||||
class DLLEXPORT TrackView : public QTreeView
|
||||
{
|
||||
@ -23,10 +24,11 @@ public:
|
||||
|
||||
void setProxyModel( TrackProxyModel* model );
|
||||
|
||||
TrackModel* model() { return m_model; }
|
||||
TrackProxyModel* proxyModel() { return m_proxyModel; }
|
||||
PlaylistItemDelegate* delegate() { return m_delegate; }
|
||||
TrackHeader* header() { return m_header; }
|
||||
TrackModel* model() const { return m_model; }
|
||||
TrackProxyModel* proxyModel() const { return m_proxyModel; }
|
||||
PlaylistItemDelegate* delegate() const { return m_delegate; }
|
||||
TrackHeader* header() const { return m_header; }
|
||||
OverlayWidget* overlay() const { return m_overlay; }
|
||||
|
||||
void setModel( TrackModel* model );
|
||||
|
||||
@ -61,6 +63,7 @@ private:
|
||||
TrackProxyModel* m_proxyModel;
|
||||
PlaylistItemDelegate* m_delegate;
|
||||
TrackHeader* m_header;
|
||||
OverlayWidget* m_overlay;
|
||||
|
||||
bool m_resizing;
|
||||
bool m_dragging;
|
||||
|
@ -297,17 +297,41 @@ TomahawkSettings::setJabberPassword( const QString& pw )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TomahawkSettings::upnpEnabled() const
|
||||
TomahawkSettings::ExternalAddressMode
|
||||
TomahawkSettings::externalAddressMode() const
|
||||
{
|
||||
return value( "network/upnp", true ).toBool();
|
||||
return (TomahawkSettings::ExternalAddressMode) value( "network/external-address-mode", TomahawkSettings::Upnp ).toInt();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setUPnPEnabled( bool enable )
|
||||
TomahawkSettings::setExternalAddressMode( ExternalAddressMode externalAddressMode )
|
||||
{
|
||||
setValue( "network/upnp", enable );
|
||||
setValue( "network/external-address-mode", externalAddressMode );
|
||||
}
|
||||
|
||||
QString
|
||||
TomahawkSettings::externalHostname() const
|
||||
{
|
||||
return value( "network/external-hostname" ).toString();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setExternalHostname(const QString& externalHostname)
|
||||
{
|
||||
setValue( "network/external-hostname", externalHostname );
|
||||
}
|
||||
|
||||
int
|
||||
TomahawkSettings::externalPort() const
|
||||
{
|
||||
return value( "network/external-port" ).toInt();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setExternalPort(int externalPort)
|
||||
{
|
||||
setValue( "network/external-port", externalPort);
|
||||
}
|
||||
|
||||
|
||||
@ -328,14 +352,14 @@ TomahawkSettings::setLastFmPassword( const QString& password )
|
||||
QByteArray
|
||||
TomahawkSettings::lastFmSessionKey() const
|
||||
{
|
||||
return value( "lastfm/sessionkey" ).toByteArray();
|
||||
return value( "lastfm/session" ).toByteArray();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setLastFmSessionKey( const QByteArray& key )
|
||||
{
|
||||
setValue( "lastfm/sessionkey", key );
|
||||
setValue( "lastfm/session", key );
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,11 +55,18 @@ public:
|
||||
void setJabberPort( int port );
|
||||
|
||||
/// Network settings
|
||||
enum ExternalAddressMode { Lan, DynDns, Upnp };
|
||||
ExternalAddressMode externalAddressMode() const;
|
||||
void setExternalAddressMode(ExternalAddressMode externalAddressMode);
|
||||
|
||||
bool httpEnabled() const; /// true by default
|
||||
void setHttpEnabled( bool enable );
|
||||
|
||||
bool upnpEnabled() const; /// true by default
|
||||
void setUPnPEnabled( bool enable );
|
||||
|
||||
QString externalHostname() const;
|
||||
void setExternalHostname( const QString& externalHostname );
|
||||
|
||||
int externalPort() const;
|
||||
void setExternalPort( int externalPort );
|
||||
|
||||
QString proxyHost() const;
|
||||
void setProxyHost( const QString &host );
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "database/databasecommand_alltracks.h"
|
||||
#include "database/databasecommand_allalbums.h"
|
||||
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
|
||||
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
@ -19,6 +21,7 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
|
||||
ui->setupUi( this );
|
||||
|
||||
ui->sourceLabel->setText( source->friendlyName() );
|
||||
ui->historyView->overlay()->setEnabled( false );
|
||||
|
||||
m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
|
||||
ui->recentCollectionView->setModel( m_recentCollectionModel );
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "playlist/playlistmodel.h"
|
||||
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
#include "pipeline.h"
|
||||
#include "utils/xspfloader.h"
|
||||
|
||||
@ -23,17 +25,20 @@ NewPlaylistWidget::NewPlaylistWidget( QWidget* parent )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
QPushButton* saveButton = new QPushButton( tr( "&Create Playlist" ) );
|
||||
saveButton->setDefault( true );
|
||||
m_saveButton = new QPushButton( tr( "&Create Playlist" ) );
|
||||
m_saveButton->setDefault( true );
|
||||
m_saveButton->setEnabled( false );
|
||||
|
||||
ui->buttonBox->addButton( saveButton, QDialogButtonBox::AcceptRole );
|
||||
ui->buttonBox->addButton( m_saveButton, QDialogButtonBox::AcceptRole );
|
||||
|
||||
connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( tagChanged() ) );
|
||||
connect( ui->titleEdit, SIGNAL( textChanged( QString ) ), SLOT( onTitleChanged( QString ) ) );
|
||||
connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( onTagChanged() ) );
|
||||
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( savePlaylist() ) );
|
||||
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
|
||||
|
||||
m_suggestionsModel = new PlaylistModel( ui->suggestionsView );
|
||||
ui->suggestionsView->setModel( m_suggestionsModel );
|
||||
ui->suggestionsView->overlay()->setEnabled( false );
|
||||
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( updateSuggestions() ) );
|
||||
}
|
||||
@ -62,7 +67,14 @@ NewPlaylistWidget::changeEvent( QEvent* e )
|
||||
|
||||
|
||||
void
|
||||
NewPlaylistWidget::tagChanged()
|
||||
NewPlaylistWidget::onTitleChanged( const QString& title )
|
||||
{
|
||||
m_saveButton->setEnabled( !title.isEmpty() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NewPlaylistWidget::onTagChanged()
|
||||
{
|
||||
m_tag = ui->tagEdit->text();
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QPushButton;
|
||||
class PlaylistModel;
|
||||
|
||||
namespace Ui
|
||||
@ -32,7 +33,9 @@ signals:
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
private slots:
|
||||
void tagChanged();
|
||||
void onTitleChanged( const QString& title );
|
||||
void onTagChanged();
|
||||
|
||||
void updateSuggestions();
|
||||
void suggestionsFound();
|
||||
|
||||
@ -47,6 +50,7 @@ private:
|
||||
|
||||
QTimer m_filterTimer;
|
||||
QString m_tag;
|
||||
QPushButton* m_saveButton;
|
||||
};
|
||||
|
||||
#endif // NEWPLAYLISTWIDGET_H
|
||||
|
115
src/libtomahawk/widgets/overlaywidget.cpp
Normal file
115
src/libtomahawk/widgets/overlaywidget.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
#include "overlaywidget.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
#define CORNER_ROUNDNESS 32.0
|
||||
#define FADEIN_DURATION 500
|
||||
#define FONT_SIZE 18
|
||||
#define OPACITY 0.80
|
||||
|
||||
|
||||
OverlayWidget::OverlayWidget( QAbstractItemView* parent )
|
||||
: QWidget() // this is on purpose!
|
||||
, m_parent( parent )
|
||||
{
|
||||
resize( 380, 220 );
|
||||
setAttribute( Qt::WA_TranslucentBackground, true );
|
||||
}
|
||||
|
||||
|
||||
OverlayWidget::~OverlayWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OverlayWidget::setOpacity( qreal opacity )
|
||||
{
|
||||
m_opacity = opacity;
|
||||
m_parent->reset();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OverlayWidget::setText( const QString& text )
|
||||
{
|
||||
if ( text == m_text )
|
||||
return;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
QPropertyAnimation* animation = new QPropertyAnimation( this, "opacity" );
|
||||
animation->setDuration( FADEIN_DURATION );
|
||||
animation->setStartValue( 0.00 );
|
||||
animation->setEndValue( OPACITY );
|
||||
animation->start();
|
||||
}
|
||||
else
|
||||
m_opacity = OPACITY;
|
||||
|
||||
m_text = text;
|
||||
m_pixmap = QPixmap();
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
OverlayWidget::pixmap()
|
||||
{
|
||||
if ( m_pixmap.isNull() )
|
||||
{
|
||||
QPixmap p( contentsRect().size() );
|
||||
p.fill( Qt::transparent );
|
||||
render( &p );
|
||||
|
||||
m_pixmap = p;
|
||||
}
|
||||
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OverlayWidget::paint( QPainter* painter )
|
||||
{
|
||||
if ( !isEnabled() )
|
||||
return;
|
||||
|
||||
pixmap(); // cache the image
|
||||
|
||||
QRect center( QPoint( ( painter->viewport().width() - m_pixmap.width() ) / 2,
|
||||
( painter->viewport().height() - m_pixmap.height() ) / 2 ), m_pixmap.size() );
|
||||
|
||||
painter->save();
|
||||
painter->setOpacity( m_opacity );
|
||||
painter->drawPixmap( center, m_pixmap );
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OverlayWidget::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
QPainter p( this );
|
||||
QRect r = contentsRect();
|
||||
|
||||
p.setBackgroundMode( Qt::TransparentMode );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
p.setPen( palette().shadow().color() );
|
||||
p.setBrush( palette().shadow() );
|
||||
|
||||
p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS );
|
||||
|
||||
QTextOption to( Qt::AlignCenter );
|
||||
to.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );
|
||||
|
||||
QFont f( font() );
|
||||
f.setPixelSize( FONT_SIZE );
|
||||
f.setBold( true );
|
||||
|
||||
p.setFont( f );
|
||||
p.setPen( palette().light().color() );
|
||||
p.drawText( r.adjusted( 16, 16, -16, -16 ), text(), to );
|
||||
}
|
40
src/libtomahawk/widgets/overlaywidget.h
Normal file
40
src/libtomahawk/widgets/overlaywidget.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef OVERLAYWIDGET_H
|
||||
#define OVERLAYWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemView>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT OverlayWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity )
|
||||
|
||||
public:
|
||||
OverlayWidget( QAbstractItemView* parent );
|
||||
~OverlayWidget();
|
||||
|
||||
QPixmap pixmap();
|
||||
|
||||
qreal opacity() const { return m_opacity; }
|
||||
void setOpacity( qreal opacity );
|
||||
|
||||
QString text() const { return m_text; }
|
||||
void setText( const QString& text );
|
||||
|
||||
void paint( QPainter* painter );
|
||||
|
||||
protected:
|
||||
// void changeEvent( QEvent* e );
|
||||
void paintEvent( QPaintEvent* event );
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
QPixmap m_pixmap;
|
||||
qreal m_opacity;
|
||||
|
||||
QAbstractItemView* m_parent;
|
||||
};
|
||||
|
||||
#endif // WELCOMEWIDGET_H
|
@ -6,6 +6,8 @@
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "playlist/playlistmodel.h"
|
||||
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
#include "sourcelist.h"
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
@ -19,7 +21,9 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
, ui( new Ui::WelcomeWidget )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
|
||||
ui->tracksView->overlay()->setEnabled( false );
|
||||
|
||||
m_tracksModel = new PlaylistModel( ui->tracksView );
|
||||
ui->tracksView->setModel( m_tracksModel );
|
||||
|
@ -28,8 +28,16 @@ Scrobbler::Scrobbler( QObject* parent )
|
||||
, m_reachedScrobblePoint( false )
|
||||
, m_authJob( 0 )
|
||||
{
|
||||
lastfm::ws::ApiKey = "2aa1089093868876bba20b0482b9cef9";
|
||||
lastfm::ws::SharedSecret = "a7085ef81d7b46fe6ffe11c15b85902f";
|
||||
/*
|
||||
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
|
||||
Your secret is ba80f1df6d27ae63e9cb1d33ccf2052f
|
||||
*/
|
||||
|
||||
// Flush session key cache
|
||||
TomahawkSettings::instance()->setLastFmSessionKey( QByteArray() );
|
||||
|
||||
lastfm::ws::ApiKey = "7194b85b6d1f424fe1668173a78c0c4a";
|
||||
lastfm::ws::SharedSecret = "ba80f1df6d27ae63e9cb1d33ccf2052f";
|
||||
lastfm::ws::Username = TomahawkSettings::instance()->lastFmUsername();
|
||||
|
||||
m_pw = TomahawkSettings::instance()->lastFmPassword();
|
||||
@ -192,7 +200,7 @@ Scrobbler::onAuthenticated()
|
||||
TomahawkSettings::instance()->setLastFmSessionKey( lastfm::ws::SessionKey.toLatin1() );
|
||||
|
||||
if( TomahawkSettings::instance()->scrobblingEnabled() )
|
||||
m_scrobbler = new lastfm::Audioscrobbler( "tst" );
|
||||
m_scrobbler = new lastfm::Audioscrobbler( "thk" );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -223,7 +231,7 @@ Scrobbler::createScrobbler()
|
||||
{
|
||||
lastfm::ws::SessionKey = TomahawkSettings::instance()->lastFmSessionKey();
|
||||
|
||||
m_scrobbler = new lastfm::Audioscrobbler( "tst" );
|
||||
m_scrobbler = new lastfm::Audioscrobbler( "thk" );
|
||||
m_scrobbler->moveToThread( thread() );
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public slots:
|
||||
void onAuthenticated();
|
||||
|
||||
private:
|
||||
void scrobble( );
|
||||
void scrobble();
|
||||
void createScrobbler();
|
||||
|
||||
lastfm::MutableTrack m_track;
|
||||
|
@ -39,7 +39,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
ui->checkBoxHttp->setChecked( s->httpEnabled() );
|
||||
ui->checkBoxUpnp->setChecked( s->upnpEnabled() );
|
||||
ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp );
|
||||
|
||||
// JABBER
|
||||
ui->checkBoxJabberAutoConnect->setChecked( s->jabberAutoConnect() );
|
||||
@ -99,7 +99,7 @@ SettingsDialog::~SettingsDialog()
|
||||
}
|
||||
|
||||
s->setHttpEnabled( ui->checkBoxHttp->checkState() == Qt::Checked );
|
||||
s->setUPnPEnabled( ui->checkBoxUpnp->checkState() == Qt::Checked );
|
||||
s->setExternalAddressMode(ui->checkBoxUpnp->checkState() == Qt::Checked ? TomahawkSettings::Upnp : TomahawkSettings::Lan);
|
||||
|
||||
s->setJabberAutoConnect( ui->checkBoxJabberAutoConnect->checkState() == Qt::Checked );
|
||||
s->setJabberUsername( ui->jabberUsername->text() );
|
||||
@ -201,9 +201,9 @@ SettingsDialog::testLastFmLogin()
|
||||
{
|
||||
#ifndef NO_LIBLASTFM
|
||||
ui->pushButtonTestLastfmLogin->setEnabled( false );
|
||||
ui->pushButtonTestLastfmLogin->setText( "Testing..." );
|
||||
ui->pushButtonTestLastfmLogin->setText( "Testing..." );
|
||||
|
||||
QString authToken = md5( ( ui->lineEditLastfmUsername->text() + md5( ui->lineEditLastfmPassword->text().toUtf8() ) ).toUtf8() );
|
||||
QString authToken = md5( ( ui->lineEditLastfmUsername->text() + md5( ui->lineEditLastfmPassword->text().toUtf8() ) ).toUtf8() );
|
||||
|
||||
// now authenticate w/ last.fm and get our session key
|
||||
QMap<QString, QString> query;
|
||||
|
@ -129,7 +129,7 @@ SipHandler::onPeerOnline( const QString& jid )
|
||||
|
||||
Servent::instance()->registerOffer( key, conn );
|
||||
m["visible"] = true;
|
||||
m["ip"] = Servent::instance()->externalAddress().toString();
|
||||
m["ip"] = Servent::instance()->externalAddress();
|
||||
m["port"] = Servent::instance()->externalPort();
|
||||
m["key"] = key;
|
||||
m["uniqname"] = nodeid;
|
||||
@ -181,7 +181,7 @@ SipHandler::onMessage( const QString& from, const QString& msg )
|
||||
if ( m.value( "visible" ).toBool() )
|
||||
{
|
||||
if( !Servent::instance()->visibleExternally() ||
|
||||
Servent::instance()->externalAddress().toString() <= m.value( "ip" ).toString() )
|
||||
Servent::instance()->externalAddress() <= m.value( "ip" ).toString() )
|
||||
{
|
||||
qDebug() << "Initiate connection to" << from;
|
||||
Servent::instance()->connectToPeer( m.value( "ip" ).toString(),
|
||||
|
@ -105,10 +105,11 @@ SourceTreeView::setupMenus()
|
||||
if ( readonly )
|
||||
{
|
||||
m_deletePlaylistAction->setEnabled( !readonly );
|
||||
m_renamePlaylistAction->setEnabled( !readonly );
|
||||
}
|
||||
|
||||
connect( m_renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
||||
connect( m_loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
||||
connect( m_renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
||||
connect( m_deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) );
|
||||
}
|
||||
|
||||
@ -141,7 +142,6 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
qDebug() << "SourceTreeItem toggled:" << item->source()->userName();
|
||||
|
||||
PlaylistManager::instance()->show( item->source()->collection() );
|
||||
// APP->playlistManager()->show( item->source() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,15 +116,11 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
#endif
|
||||
|
||||
#ifndef NO_LIBLASTFM
|
||||
m_scrobbler = 0;
|
||||
#endif
|
||||
|
||||
qDebug() << "TomahawkApp thread:" << this->thread();
|
||||
setOrganizationName( "Tomahawk" );
|
||||
setOrganizationDomain( "tomahawk.org" );
|
||||
setApplicationName( "Player" );
|
||||
setApplicationVersion( "1.0" ); // FIXME: last.fm "tst" auth requires 1.0 version according to docs, will change when we get our own identifier
|
||||
setApplicationVersion( "0.0.0" );
|
||||
registerMetaTypes();
|
||||
setupLogfile();
|
||||
|
||||
@ -163,7 +159,8 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
#endif
|
||||
|
||||
// Set up proxy
|
||||
if( TomahawkSettings::instance()->proxyType() != QNetworkProxy::NoProxy && !TomahawkSettings::instance()->proxyHost().isEmpty() )
|
||||
if( TomahawkSettings::instance()->proxyType() != QNetworkProxy::NoProxy &&
|
||||
!TomahawkSettings::instance()->proxyHost().isEmpty() )
|
||||
{
|
||||
qDebug() << "Setting proxy to saved values";
|
||||
TomahawkUtils::setProxy( new QNetworkProxy( static_cast<QNetworkProxy::ProxyType>(TomahawkSettings::instance()->proxyType()), TomahawkSettings::instance()->proxyHost(), TomahawkSettings::instance()->proxyPort(), TomahawkSettings::instance()->proxyUsername(), TomahawkSettings::instance()->proxyPassword() ) );
|
||||
@ -217,6 +214,8 @@ TomahawkApp::~TomahawkApp()
|
||||
delete m_mainwindow;
|
||||
delete m_audioEngine;
|
||||
#endif
|
||||
|
||||
delete m_database;
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +295,7 @@ TomahawkApp::setupDatabase()
|
||||
}
|
||||
|
||||
qDebug() << "Using database:" << dbpath;
|
||||
new Database( dbpath, this );
|
||||
m_database = new Database( dbpath, this );
|
||||
Pipeline::instance()->databaseReady();
|
||||
}
|
||||
|
||||
@ -405,7 +404,7 @@ TomahawkApp::setupSIP()
|
||||
m_xmppBot = new XMPPBot( this );
|
||||
|
||||
m_sipHandler->connect();
|
||||
// m_sipHandler->setProxy( m_proxy );
|
||||
// m_sipHandler->setProxy( *TomahawkUtils::proxy() );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user