mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Move some more actions to the action collection, and remove some
unnecessary member variables from sourcetreeview.
This commit is contained in:
@@ -38,14 +38,22 @@ ActionCollection::ActionCollection( QObject *parent )
|
|||||||
void
|
void
|
||||||
ActionCollection::initActions()
|
ActionCollection::initActions()
|
||||||
{
|
{
|
||||||
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
|
||||||
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
|
||||||
|
m_actionCollection[ "latchOn" ] = latchOn;
|
||||||
|
QAction *latchOff = new QAction( tr( "&Stop Listening Along" ), this );
|
||||||
|
latchOff->setIcon( QIcon( RESPATH "images/headphones-off.png" ) );
|
||||||
|
m_actionCollection[ "latchOff" ] = latchOff;
|
||||||
|
|
||||||
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
||||||
QAction *privacyToggle = new QAction( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
QAction *privacyToggle = new QAction( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
||||||
privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
|
privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
|
||||||
privacyToggle->setIconVisibleInMenu( isPublic );
|
privacyToggle->setIconVisibleInMenu( isPublic );
|
||||||
m_actionCollection[ "togglePrivacy" ] = privacyToggle;
|
m_actionCollection[ "togglePrivacy" ] = privacyToggle;
|
||||||
|
|
||||||
|
m_actionCollection[ "loadPlaylist"] = new QAction( tr( "&Load Playlist" ), this );
|
||||||
|
m_actionCollection[ "renamePlaylist"] = new QAction( tr( "&Rename Playlist" ), this );
|
||||||
|
m_actionCollection[ "copyPlaylist"] = new QAction( tr( "&Copy Playlist Link" ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -18,15 +18,15 @@
|
|||||||
|
|
||||||
#include "sourcetreeview.h"
|
#include "sourcetreeview.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QContextMenuEvent>
|
#include <QtGui/QContextMenuEvent>
|
||||||
#include <QDragEnterEvent>
|
#include <QtGui/QDragEnterEvent>
|
||||||
#include <QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QStyledItemDelegate>
|
#include <QtGui/QStyledItemDelegate>
|
||||||
#include <QSize>
|
#include <QtCore/QSize>
|
||||||
#include <QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
|
||||||
#include "actioncollection.h"
|
#include "actioncollection.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
@@ -167,12 +167,14 @@ SourceTreeView::setupMenus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_loadPlaylistAction = m_playlistMenu.addAction( tr( "&Load Playlist" ) );
|
QAction *loadPlaylistAction = ActionCollection::instance()->getAction( "loadPlaylist" );
|
||||||
m_renamePlaylistAction = m_playlistMenu.addAction( tr( "&Rename Playlist" ) );
|
m_playlistMenu.addAction( loadPlaylistAction );
|
||||||
|
QAction *renamePlaylistAction = ActionCollection::instance()->getAction( "renamePlaylist" );
|
||||||
|
m_playlistMenu.addAction( renamePlaylistAction );
|
||||||
m_playlistMenu.addSeparator();
|
m_playlistMenu.addSeparator();
|
||||||
|
|
||||||
m_copyPlaylistAction = m_playlistMenu.addAction( tr( "&Copy Link" ) );
|
QAction *copyPlaylistAction = m_playlistMenu.addAction( tr( "&Copy Link" ) );
|
||||||
m_deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) );
|
QAction *deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) );
|
||||||
|
|
||||||
QString addToText = QString( "Add to my %1" );
|
QString addToText = QString( "Add to my %1" );
|
||||||
if ( type == SourcesModel::StaticPlaylist )
|
if ( type == SourcesModel::StaticPlaylist )
|
||||||
@@ -182,21 +184,21 @@ SourceTreeView::setupMenus()
|
|||||||
else if ( type == SourcesModel::Station )
|
else if ( type == SourcesModel::Station )
|
||||||
addToText = addToText.arg( "Stations" );
|
addToText = addToText.arg( "Stations" );
|
||||||
|
|
||||||
m_addToLocalAction = m_roPlaylistMenu.addAction( tr( addToText.toUtf8(), "Adds the given playlist, dynamic playlist, or station to the users's own list" ) );
|
QAction *addToLocalAction = m_roPlaylistMenu.addAction( tr( addToText.toUtf8(), "Adds the given playlist, dynamic playlist, or station to the users's own list" ) );
|
||||||
|
|
||||||
m_roPlaylistMenu.addAction( m_copyPlaylistAction );
|
m_roPlaylistMenu.addAction( copyPlaylistAction );
|
||||||
m_deletePlaylistAction->setEnabled( !readonly );
|
deletePlaylistAction->setEnabled( !readonly );
|
||||||
m_renamePlaylistAction->setEnabled( !readonly );
|
renamePlaylistAction->setEnabled( !readonly );
|
||||||
m_addToLocalAction->setEnabled( readonly );
|
addToLocalAction->setEnabled( readonly );
|
||||||
|
|
||||||
if ( type == SourcesModel::StaticPlaylist )
|
if ( type == SourcesModel::StaticPlaylist )
|
||||||
m_copyPlaylistAction->setText( tr( "&Export Playlist" ) );
|
copyPlaylistAction->setText( tr( "&Export Playlist" ) );
|
||||||
|
|
||||||
connect( m_loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
||||||
connect( m_renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
||||||
connect( m_deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) );
|
connect( deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) );
|
||||||
connect( m_copyPlaylistAction, SIGNAL( triggered() ), SLOT( copyPlaylistLink() ) );
|
connect( copyPlaylistAction, SIGNAL( triggered() ), SLOT( copyPlaylistLink() ) );
|
||||||
connect( m_addToLocalAction, SIGNAL( triggered() ), SLOT( addToLocal() ) );
|
connect( addToLocalAction, SIGNAL( triggered() ), SLOT( addToLocal() ) );
|
||||||
connect( latchOnAction, SIGNAL( triggered() ), SLOT( latchOnOrCatchUp() ), Qt::QueuedConnection );
|
connect( latchOnAction, SIGNAL( triggered() ), SLOT( latchOnOrCatchUp() ), Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,8 +22,8 @@
|
|||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "sourceplaylistinterface.h"
|
#include "sourceplaylistinterface.h"
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
#include <QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
|
||||||
class CollectionModel;
|
class CollectionModel;
|
||||||
class PlaylistModel;
|
class PlaylistModel;
|
||||||
@@ -104,13 +104,6 @@ private:
|
|||||||
QMenu m_roPlaylistMenu;
|
QMenu m_roPlaylistMenu;
|
||||||
QMenu m_latchMenu;
|
QMenu m_latchMenu;
|
||||||
QMenu m_privacyMenu;
|
QMenu m_privacyMenu;
|
||||||
QAction* m_loadPlaylistAction;
|
|
||||||
QAction* m_renamePlaylistAction;
|
|
||||||
QAction* m_deletePlaylistAction;
|
|
||||||
QAction* m_copyPlaylistAction;
|
|
||||||
QAction* m_addToLocalAction;
|
|
||||||
QAction* m_latchOnAction;
|
|
||||||
QAction* m_latchOffAction;
|
|
||||||
|
|
||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
QRect m_dropRect;
|
QRect m_dropRect;
|
||||||
|
Reference in New Issue
Block a user