1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 22:38:33 +01:00

* Show current track in window title.

This commit is contained in:
Christian Muehlhaeuser 2010-11-11 06:35:33 +01:00
parent 56af0f5542
commit 7a51516092
2 changed files with 34 additions and 1 deletions

View File

@ -143,6 +143,10 @@ TomahawkWindow::setupSignals()
connect( playlistManager(), SIGNAL( shuffleModeChanged( bool ) ),
m_audioControls, SLOT( onShuffleModeChanged( bool ) ) );
// <From AudioEngine>
connect( (QObject*)APP->audioEngine(), SIGNAL( loading( const Tomahawk::result_ptr& ) ),
SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
// <Menu Items>
connect( ui->actionPreferences, SIGNAL( triggered() ),
SLOT( showSettingsDialog() ) );
@ -282,3 +286,26 @@ TomahawkWindow::createPlaylist()
QString creator = "someone"; // FIXME
Playlist::create( author, id, name, info, creator, false /* shared */ );
}
void
TomahawkWindow::onPlaybackLoading( const Tomahawk::result_ptr& result )
{
m_currentTrack = result;
setWindowTitle( m_windowTitle );
}
void
TomahawkWindow::setWindowTitle( const QString& title )
{
m_windowTitle = title;
if ( m_currentTrack.isNull() )
QMainWindow::setWindowTitle( title );
else
{
QString s = m_currentTrack->artist() + " - " + m_currentTrack->track();
QMainWindow::setWindowTitle( s + " - " + title );
}
}

View File

@ -32,6 +32,8 @@ public:
AudioControls* audioControls() { return m_audioControls; }
QStackedWidget* playlistStack();
void setWindowTitle( const QString& title );
signals:
void settingsChanged();
@ -48,6 +50,8 @@ private slots:
void rescanCollectionManually();
void addPeerManually();
void onPlaybackLoading( const Tomahawk::result_ptr& result );
private:
void loadSettings();
void saveSettings();
@ -57,8 +61,10 @@ private:
TopBar* m_topbar;
AudioControls* m_audioControls;
PlaylistManager* m_playlistManager;
QNetworkAccessManager m_nam;
Tomahawk::result_ptr m_currentTrack;
QString m_windowTitle;
};
#endif // TOMAHAWKWINDOW_H