| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@kde.org> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#include "GlobalCurrentTrackActions.h" |
| 18 |
|
| 19 |
|
| 20 |
namespace The |
| 21 |
{ |
| 22 |
static GlobalCurrentTrackActions* s_GlobalCurrentTrackActions_instance = 0; |
| 23 |
|
| 24 |
GlobalCurrentTrackActions* globalCurrentTrackActions() |
| 25 |
{ |
| 26 |
if( !s_GlobalCurrentTrackActions_instance ) |
| 27 |
s_GlobalCurrentTrackActions_instance = new GlobalCurrentTrackActions(); |
| 28 |
|
| 29 |
return s_GlobalCurrentTrackActions_instance; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
GlobalCurrentTrackActions::GlobalCurrentTrackActions() |
| 35 |
{} |
| 36 |
|
| 37 |
|
| 38 |
GlobalCurrentTrackActions::~GlobalCurrentTrackActions() |
| 39 |
{} |
| 40 |
|
| 41 |
void GlobalCurrentTrackActions::addAction( QAction * action ) |
| 42 |
{ |
| 43 |
m_actions.append( action ); |
| 44 |
} |
| 45 |
|
| 46 |
QList< QAction * > GlobalCurrentTrackActions::actions() |
| 47 |
{ |
| 48 |
// Here we filter out dangling pointers to already destroyed QActions |
| 49 |
|
| 50 |
QList<QAction*> validActions; |
| 51 |
|
| 52 |
foreach( QAction* action, m_actions ) |
| 53 |
validActions.append( action ); |
| 54 |
|
| 55 |
return validActions; |
| 56 |
} |