mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-13 12:31:52 +02:00
* Added home button to toolbar and linked it to PlaylistManager's showWelcomePage().
This commit is contained in:
parent
fa6a2533d0
commit
f9c4eac734
BIN
data/images/home.png
Normal file
BIN
data/images/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
@ -70,6 +70,7 @@
|
||||
<file>./data/images/volume-slider-level.png</file>
|
||||
<file>./data/images/echonest_logo.png</file>
|
||||
<file>./data/images/loading-animation.gif</file>
|
||||
<file>./data/images/home.png</file>
|
||||
<file>./data/topbar-radiobuttons.css</file>
|
||||
<file>./data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>./data/icons/tomahawk-icon-32x32.png</file>
|
||||
|
@ -104,7 +104,7 @@ ControlConnection::registerSource()
|
||||
void
|
||||
ControlConnection::setupDbSyncConnection( bool ondemand )
|
||||
{
|
||||
if( m_dbsyncconn != NULL || ! m_registered )
|
||||
if( m_dbsyncconn != NULL || !m_registered )
|
||||
return;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << ondemand << m_source->id();
|
||||
@ -115,12 +115,6 @@ ControlConnection::setupDbSyncConnection( bool ondemand )
|
||||
qDebug() << "Connecting to DBSync offer from peer...";
|
||||
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( finished() ),
|
||||
m_dbsyncconn, SLOT( deleteLater() ) );
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( destroyed( QObject* ) ),
|
||||
SLOT( dbSyncConnFinished( QObject* ) ), Qt::DirectConnection );
|
||||
|
||||
m_servent->createParallelConnection( this, m_dbsyncconn, m_dbconnkey );
|
||||
m_dbconnkey.clear();
|
||||
}
|
||||
@ -129,12 +123,6 @@ ControlConnection::setupDbSyncConnection( bool ondemand )
|
||||
qDebug() << "Offering a DBSync key to peer...";
|
||||
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( finished() ),
|
||||
m_dbsyncconn, SLOT( deleteLater()) );
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( destroyed(QObject* ) ),
|
||||
SLOT( dbSyncConnFinished( QObject* ) ), Qt::DirectConnection );
|
||||
|
||||
QString key = uuid();
|
||||
m_servent->registerOffer( key, m_dbsyncconn );
|
||||
QVariantMap m;
|
||||
@ -142,6 +130,12 @@ ControlConnection::setupDbSyncConnection( bool ondemand )
|
||||
m.insert( "key", key );
|
||||
sendMsg( m );
|
||||
}
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( finished() ),
|
||||
m_dbsyncconn, SLOT( deleteLater() ) );
|
||||
|
||||
connect( m_dbsyncconn, SIGNAL( destroyed( QObject* ) ),
|
||||
SLOT( dbSyncConnFinished( QObject* ) ), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ DBSyncConnection::trigger()
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
// if we're still setting up the connection, do nothing - we sync on first connect anyway:
|
||||
if ( !this->isRunning() )
|
||||
if ( !isRunning() )
|
||||
return;
|
||||
|
||||
QMetaObject::invokeMethod( this, "sendMsg", Qt::QueuedConnection,
|
||||
|
@ -707,8 +707,8 @@ Servent::triggerDBSync()
|
||||
QList<source_ptr> sources = SourceList::instance()->sources();
|
||||
foreach( const source_ptr& src, sources )
|
||||
{
|
||||
// local src doesnt have a control connection, skip it:
|
||||
if( src.isNull() || src->isLocal() )
|
||||
// skip local source
|
||||
if ( src.isNull() || src->isLocal() )
|
||||
continue;
|
||||
|
||||
if ( src->controlConnection() ) // source online?
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define IMAGE_HEIGHT 64
|
||||
|
||||
|
||||
InfoBar::InfoBar( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
@ -58,7 +60,7 @@ InfoBar::setDescription( const QString& s )
|
||||
void
|
||||
InfoBar::setPixmap( const QPixmap& p )
|
||||
{
|
||||
ui->imageLabel->setPixmap( p.scaledToHeight( ui->imageLabel->height(), Qt::SmoothTransformation ) );
|
||||
ui->imageLabel->setPixmap( p.scaledToHeight( IMAGE_HEIGHT, Qt::SmoothTransformation ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "infobar/infobar.h"
|
||||
#include "topbar/topbar.h"
|
||||
#include "widgets/infowidgets/sourceinfowidget.h"
|
||||
#include "widgets/welcomewidget.h"
|
||||
|
||||
#include "collectionmodel.h"
|
||||
#include "collectionflatmodel.h"
|
||||
@ -42,6 +43,7 @@ PlaylistManager::instance()
|
||||
PlaylistManager::PlaylistManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_widget( new QWidget() )
|
||||
, m_welcomeWidget( new WelcomeWidget() )
|
||||
, m_currentInterface( 0 )
|
||||
, m_currentMode( 0 )
|
||||
, m_superCollectionVisible( true )
|
||||
@ -100,7 +102,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
m_widget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_widget->layout()->setMargin( 0 );
|
||||
m_widget->layout()->setSpacing( 0 );
|
||||
|
||||
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||
|
||||
connect( m_topbar, SIGNAL( filterTextChanged( QString ) ),
|
||||
@ -424,14 +426,16 @@ PlaylistManager::show( QWidget* widget, const QString& title, const QString& des
|
||||
{
|
||||
unlinkPlaylist();
|
||||
|
||||
connect( widget, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ) );
|
||||
if ( m_stack->indexOf( widget ) < 0 )
|
||||
{
|
||||
connect( widget, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ) );
|
||||
m_stack->addWidget( widget );
|
||||
}
|
||||
|
||||
m_stack->addWidget( widget );
|
||||
m_stack->setCurrentWidget( widget );
|
||||
|
||||
m_infobar->setCaption( title );
|
||||
m_infobar->setDescription( desc );
|
||||
m_infobar->setPixmap( pixmap );
|
||||
m_infobar->setPixmap( pixmap.isNull() ? QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ) : pixmap );
|
||||
|
||||
m_queueView->show();
|
||||
m_superCollectionVisible = false;
|
||||
@ -483,6 +487,14 @@ PlaylistManager::showSuperCollection()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistManager::showWelcomePage()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
show( m_welcomeWidget, tr( "Welcome to Tomahawk!" ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistManager::setTableMode()
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ class TrackView;
|
||||
class SourceInfoWidget;
|
||||
class InfoBar;
|
||||
class TopBar;
|
||||
class WelcomeWidget;
|
||||
|
||||
namespace Tomahawk {
|
||||
class DynamicWidget;
|
||||
@ -56,9 +57,6 @@ public:
|
||||
|
||||
bool show( QWidget* widget, const QString& title = QString(), const QString& desc = QString(), const QPixmap& pixmap = QPixmap() );
|
||||
|
||||
bool showSuperCollection();
|
||||
void showCurrentTrack();
|
||||
|
||||
signals:
|
||||
void numSourcesChanged( unsigned int sources );
|
||||
void numTracksChanged( unsigned int tracks );
|
||||
@ -73,7 +71,12 @@ signals:
|
||||
|
||||
void playClicked();
|
||||
void pauseClicked();
|
||||
|
||||
public slots:
|
||||
bool showSuperCollection();
|
||||
void showWelcomePage();
|
||||
void showCurrentTrack();
|
||||
|
||||
void setTreeMode();
|
||||
void setTableMode();
|
||||
void setAlbumMode();
|
||||
@ -115,7 +118,8 @@ private:
|
||||
AlbumModel* m_superAlbumModel;
|
||||
AlbumView* m_superAlbumView;
|
||||
CollectionFlatModel* m_superCollectionFlatModel;
|
||||
CollectionView* m_superCollectionView;
|
||||
CollectionView* m_superCollectionView;
|
||||
WelcomeWidget* m_welcomeWidget;
|
||||
|
||||
QList< Tomahawk::collection_ptr > m_superCollections;
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "utils/widgetdragfilter.h"
|
||||
#include "utils/xspfloader.h"
|
||||
#include "widgets/newplaylistwidget.h"
|
||||
#include "widgets/welcomewidget.h"
|
||||
|
||||
#include "audiocontrols.h"
|
||||
#include "settingsdialog.h"
|
||||
@ -115,12 +114,15 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
ui->splitter->setCollapsible( 1, false );
|
||||
ui->splitter->setHandleWidth( 1 );
|
||||
|
||||
/* QToolBar* toolbar = addToolBar( "TomahawkToolbar" );
|
||||
QToolBar* toolbar = addToolBar( "TomahawkToolbar" );
|
||||
toolbar->setObjectName( "TomahawkToolbar" );
|
||||
toolbar->addWidget( m_topbar );
|
||||
toolbar->setMovable( false );
|
||||
toolbar->setFloatable( false );
|
||||
toolbar->installEventFilter( new WidgetDragFilter( toolbar ) );*/
|
||||
toolbar->setIconSize( QSize( 32, 32 ) );
|
||||
toolbar->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
|
||||
toolbar->installEventFilter( new WidgetDragFilter( toolbar ) );
|
||||
|
||||
toolbar->addAction( QIcon( RESPATH "images/home.png" ), tr( "Home" ), PlaylistManager::instance(), SLOT( showWelcomePage() ) );
|
||||
|
||||
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
||||
|
||||
@ -135,8 +137,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
|
||||
loadSettings();
|
||||
setupSignals();
|
||||
|
||||
PlaylistManager::instance()->show( new WelcomeWidget(), tr( "Welcome to Tomahawk!" ), QString(), QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
PlaylistManager::instance()->showWelcomePage();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user