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