Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/playlistbrowser/PlaylistBrowserView.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 55 | { | |||
---|---|---|---|---|---|
59 | setSelectionBehavior( QAbstractItemView::SelectItems ); | 59 | setSelectionBehavior( QAbstractItemView::SelectItems ); | ||
60 | setDragDropMode( QAbstractItemView::DragDrop ); | 60 | setDragDropMode( QAbstractItemView::DragDrop ); | ||
61 | setAcceptDrops( true ); | 61 | setAcceptDrops( true ); | ||
62 | setEditTriggers( QAbstractItemView::EditKeyPressed ); | 62 | setEditTriggers( QAbstractItemView::EditKeyPressed ); | ||
63 | setMouseTracking( true ); // needed for highlighting provider action icons | 63 | setMouseTracking( true ); // needed for highlighting provider action icons | ||
64 | 64 | | |||
65 | m_createEmptyPlaylistAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), | 65 | m_createEmptyPlaylistAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), | ||
66 | i18n( "Create an Empty Playlist" ), this ); | 66 | i18n( "Create an Empty Playlist" ), this ); | ||
67 | connect( m_createEmptyPlaylistAction, SIGNAL(triggered()), SLOT(slotCreateEmptyPlaylist()) ); | 67 | connect( m_createEmptyPlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotCreateEmptyPlaylist ); | ||
68 | 68 | | |||
69 | m_appendAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), | 69 | m_appendAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), | ||
70 | i18n( "&Add to Playlist" ), this ); | 70 | i18n( "&Add to Playlist" ), this ); | ||
71 | m_appendAction->setProperty( "popupdropper_svg_id", "append" ); | 71 | m_appendAction->setProperty( "popupdropper_svg_id", "append" ); | ||
72 | connect( m_appendAction, SIGNAL(triggered()), this, SLOT(slotAppend()) ); | 72 | connect( m_appendAction, &QAction::triggered, this, &PlaylistBrowserView::slotAppend ); | ||
73 | 73 | | |||
74 | m_loadAction = new QAction( QIcon::fromTheme( "folder-open" ), i18nc( "Replace the currently " | 74 | m_loadAction = new QAction( QIcon::fromTheme( "folder-open" ), i18nc( "Replace the currently " | ||
75 | "loaded tracks with these", "&Replace Playlist" ), this ); | 75 | "loaded tracks with these", "&Replace Playlist" ), this ); | ||
76 | m_loadAction->setProperty( "popupdropper_svg_id", "load" ); | 76 | m_loadAction->setProperty( "popupdropper_svg_id", "load" ); | ||
77 | connect( m_loadAction, SIGNAL(triggered()), this, SLOT(slotLoad()) ); | 77 | connect( m_loadAction, &QAction::triggered, this, &PlaylistBrowserView::slotLoad ); | ||
78 | 78 | | |||
79 | m_setNewAction = new QAction( QIcon::fromTheme( "rating" ), i18nc( "toggle the \"new\" status " | 79 | m_setNewAction = new QAction( QIcon::fromTheme( "rating" ), i18nc( "toggle the \"new\" status " | ||
80 | " of this podcast episode", "&New" ), this ); | 80 | " of this podcast episode", "&New" ), this ); | ||
81 | m_setNewAction->setProperty( "popupdropper_svg_id", "new" ); | 81 | m_setNewAction->setProperty( "popupdropper_svg_id", "new" ); | ||
82 | m_setNewAction->setCheckable( true ); | 82 | m_setNewAction->setCheckable( true ); | ||
83 | connect( m_setNewAction, SIGNAL(triggered(bool)), SLOT(slotSetNew(bool)) ); | 83 | connect( m_setNewAction, &QAction::triggered, this, &PlaylistBrowserView::slotSetNew ); | ||
84 | 84 | | |||
85 | m_renamePlaylistAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), | 85 | m_renamePlaylistAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), | ||
86 | i18n( "&Rename..." ), this ); | 86 | i18n( "&Rename..." ), this ); | ||
87 | m_renamePlaylistAction->setProperty( "popupdropper_svg_id", "edit" ); | 87 | m_renamePlaylistAction->setProperty( "popupdropper_svg_id", "edit" ); | ||
88 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | 88 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | ||
89 | m_renamePlaylistAction->setShortcut( Qt::Key_F2 ); | 89 | m_renamePlaylistAction->setShortcut( Qt::Key_F2 ); | ||
90 | connect( m_renamePlaylistAction, SIGNAL(triggered()), this, SLOT(slotRename()) ); | 90 | connect( m_renamePlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotRename ); | ||
91 | 91 | | |||
92 | m_deletePlaylistAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), | 92 | m_deletePlaylistAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), | ||
93 | i18n( "&Delete..." ), this ); | 93 | i18n( "&Delete..." ), this ); | ||
94 | m_deletePlaylistAction->setProperty( "popupdropper_svg_id", "delete" ); | 94 | m_deletePlaylistAction->setProperty( "popupdropper_svg_id", "delete" ); | ||
95 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | 95 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | ||
96 | m_deletePlaylistAction->setShortcut( Qt::Key_Delete ); | 96 | m_deletePlaylistAction->setShortcut( Qt::Key_Delete ); | ||
97 | connect( m_deletePlaylistAction, SIGNAL(triggered()), SLOT(slotDelete()) ); | 97 | connect( m_deletePlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotDelete ); | ||
98 | 98 | | |||
99 | m_removeTracksAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), | 99 | m_removeTracksAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), | ||
100 | QString( "<placeholder>" ), this ); | 100 | QString( "<placeholder>" ), this ); | ||
101 | m_removeTracksAction->setProperty( "popupdropper_svg_id", "delete" ); | 101 | m_removeTracksAction->setProperty( "popupdropper_svg_id", "delete" ); | ||
102 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | 102 | // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes | ||
103 | m_removeTracksAction->setShortcut( Qt::Key_Delete ); | 103 | m_removeTracksAction->setShortcut( Qt::Key_Delete ); | ||
104 | connect( m_removeTracksAction, SIGNAL(triggered()), SLOT(slotRemoveTracks()) ); | 104 | connect( m_removeTracksAction, &QAction::triggered, this, &PlaylistBrowserView::slotRemoveTracks ); | ||
105 | 105 | | |||
106 | m_exportAction = new QAction( QIcon::fromTheme( "document-export-amarok" ), | 106 | m_exportAction = new QAction( QIcon::fromTheme( "document-export-amarok" ), | ||
107 | i18n( "&Export As..." ), this ); | 107 | i18n( "&Export As..." ), this ); | ||
108 | connect( m_exportAction, SIGNAL(triggered()), this, SLOT(slotExport()) ); | 108 | connect( m_exportAction, &QAction::triggered, this, &PlaylistBrowserView::slotExport ); | ||
109 | 109 | | |||
110 | m_separatorAction = new QAction( this ); | 110 | m_separatorAction = new QAction( this ); | ||
111 | m_separatorAction->setSeparator( true ); | 111 | m_separatorAction->setSeparator( true ); | ||
112 | } | 112 | } | ||
113 | 113 | | |||
114 | void | 114 | void | ||
115 | PlaylistBrowserNS::PlaylistBrowserView::setModel( QAbstractItemModel *model ) | 115 | PlaylistBrowserNS::PlaylistBrowserView::setModel( QAbstractItemModel *model ) | ||
116 | { | 116 | { | ||
117 | if( this->model() ) | 117 | if( this->model() ) | ||
118 | disconnect( this->model(), 0, this, 0 ); | 118 | disconnect( this->model(), 0, this, 0 ); | ||
119 | Amarok::PrettyTreeView::setModel( model ); | 119 | Amarok::PrettyTreeView::setModel( model ); | ||
120 | 120 | | |||
121 | connect( this->model(), SIGNAL(renameIndex(QModelIndex)), SLOT(edit(QModelIndex)) ); | 121 | connect( this->model(), SIGNAL(renameIndex(QModelIndex)), SLOT(edit(QModelIndex)) ); | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | void | 124 | void | ||
125 | PlaylistBrowserNS::PlaylistBrowserView::mouseReleaseEvent( QMouseEvent *event ) | 125 | PlaylistBrowserNS::PlaylistBrowserView::mouseReleaseEvent( QMouseEvent *event ) | ||
126 | { | 126 | { | ||
127 | if( m_pd ) | 127 | if( m_pd ) | ||
128 | { | 128 | { | ||
129 | connect( m_pd, SIGNAL(fadeHideFinished()), m_pd, SLOT(deleteLater()) ); | 129 | connect( m_pd, &PopupDropper::fadeHideFinished, m_pd, &QObject::deleteLater ); | ||
130 | m_pd->hide(); | 130 | m_pd->hide(); | ||
131 | m_pd = 0; | 131 | m_pd = 0; | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | QModelIndex index = indexAt( event->pos() ); | 134 | QModelIndex index = indexAt( event->pos() ); | ||
135 | if( !index.isValid() ) | 135 | if( !index.isValid() ) | ||
136 | { | 136 | { | ||
137 | PrettyTreeView::mouseReleaseEvent( event ); | 137 | PrettyTreeView::mouseReleaseEvent( event ); | ||
Show All 33 Lines | 161 | */ | |||
171 | QTreeView::startDrag( supportedActions ); | 171 | QTreeView::startDrag( supportedActions ); | ||
172 | 172 | | |||
173 | // We keep the items that the actions need to be applied to. | 173 | // We keep the items that the actions need to be applied to. | ||
174 | // Clear the data from all actions now that the PUD has executed. | 174 | // Clear the data from all actions now that the PUD has executed. | ||
175 | resetActionTargets(); | 175 | resetActionTargets(); | ||
176 | 176 | | |||
177 | if( m_pd ) | 177 | if( m_pd ) | ||
178 | { | 178 | { | ||
179 | connect( m_pd, SIGNAL(fadeHideFinished()), m_pd, SLOT(clear()) ); | 179 | connect( m_pd, &PopupDropper::fadeHideFinished, m_pd, &PopupDropper::clear ); | ||
180 | m_pd->hide(); | 180 | m_pd->hide(); | ||
181 | } | 181 | } | ||
182 | m_ongoingDrag = false; | 182 | m_ongoingDrag = false; | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | void | 185 | void | ||
186 | PlaylistBrowserNS::PlaylistBrowserView::keyPressEvent( QKeyEvent *event ) | 186 | PlaylistBrowserNS::PlaylistBrowserView::keyPressEvent( QKeyEvent *event ) | ||
187 | { | 187 | { | ||
▲ Show 20 Lines • Show All 290 Lines • ▼ Show 20 Line(s) | 454 | { | |||
478 | QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); | 478 | QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); | ||
479 | okButton->setDefault(true); | 479 | okButton->setDefault(true); | ||
480 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | 480 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | ||
481 | okButton->setText( i18nc( "%1 is playlist provider pretty name", | 481 | okButton->setText( i18nc( "%1 is playlist provider pretty name", | ||
482 | "Yes, delete from %1.", providerNames.join( ", " ) ) ); | 482 | "Yes, delete from %1.", providerNames.join( ", " ) ) ); | ||
483 | okButton->setDefault(true); | 483 | okButton->setDefault(true); | ||
484 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | 484 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | ||
485 | 485 | | |||
486 | connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); | 486 | connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); | ||
487 | connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); | 487 | connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); | ||
488 | 488 | | |||
489 | QLabel *label = new QLabel( i18np( "Are you sure you want to delete this playlist?", | 489 | QLabel *label = new QLabel( i18np( "Are you sure you want to delete this playlist?", | ||
490 | "Are you sure you want to delete these %1 playlists?", | 490 | "Are you sure you want to delete these %1 playlists?", | ||
491 | m_writableActionPlaylists.count() ), &dialog ); | 491 | m_writableActionPlaylists.count() ), &dialog ); | ||
492 | // TODO: include a text area with all the names of the playlists | 492 | // TODO: include a text area with all the names of the playlists | ||
493 | 493 | | |||
494 | mainLayout->addWidget(label); | 494 | mainLayout->addWidget(label); | ||
495 | mainLayout->addWidget(buttonBox); | 495 | mainLayout->addWidget(buttonBox); | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |