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:
parent
56af0f5542
commit
7a51516092
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user