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