1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 20:00:13 +02: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 ) ), connect( playlistManager(), SIGNAL( shuffleModeChanged( bool ) ),
m_audioControls, SLOT( onShuffleModeChanged( 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> // <Menu Items>
connect( ui->actionPreferences, SIGNAL( triggered() ), connect( ui->actionPreferences, SIGNAL( triggered() ),
SLOT( showSettingsDialog() ) ); SLOT( showSettingsDialog() ) );
@@ -282,3 +286,26 @@ TomahawkWindow::createPlaylist()
QString creator = "someone"; // FIXME QString creator = "someone"; // FIXME
Playlist::create( author, id, name, info, creator, false /* shared */ ); 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; } AudioControls* audioControls() { return m_audioControls; }
QStackedWidget* playlistStack(); QStackedWidget* playlistStack();
void setWindowTitle( const QString& title );
signals: signals:
void settingsChanged(); void settingsChanged();
@@ -48,6 +50,8 @@ private slots:
void rescanCollectionManually(); void rescanCollectionManually();
void addPeerManually(); void addPeerManually();
void onPlaybackLoading( const Tomahawk::result_ptr& result );
private: private:
void loadSettings(); void loadSettings();
void saveSettings(); void saveSettings();
@@ -57,8 +61,10 @@ private:
TopBar* m_topbar; TopBar* m_topbar;
AudioControls* m_audioControls; AudioControls* m_audioControls;
PlaylistManager* m_playlistManager; PlaylistManager* m_playlistManager;
QNetworkAccessManager m_nam; QNetworkAccessManager m_nam;
Tomahawk::result_ptr m_currentTrack;
QString m_windowTitle;
}; };
#endif // TOMAHAWKWINDOW_H #endif // TOMAHAWKWINDOW_H