1 /* 2 SPDX-FileCopyrightText: 2009 Andrea s Pakulat <apaku@gmx.de> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #include "launchconfigurationtype.h" 8 9 #include "ilauncher.h" 10 11 namespace KDevelop 12 { 13 14 class LaunchConfigurationTypePrivate 15 { 16 public: 17 QList<ILauncher*> starters; 18 }; 19 LaunchConfigurationType()20LaunchConfigurationType::LaunchConfigurationType() 21 : d_ptr(new LaunchConfigurationTypePrivate) 22 { 23 } 24 ~LaunchConfigurationType()25LaunchConfigurationType::~LaunchConfigurationType() 26 { 27 Q_D(LaunchConfigurationType); 28 29 qDeleteAll(d->starters); 30 } 31 32 addLauncher(ILauncher * starter)33void LaunchConfigurationType::addLauncher( ILauncher* starter ) 34 { 35 Q_D(LaunchConfigurationType); 36 37 if( !d->starters.contains( starter ) ) 38 { 39 d->starters.append( starter ); 40 } 41 } removeLauncher(ILauncher * starter)42void LaunchConfigurationType::removeLauncher( ILauncher* starter ) 43 { 44 Q_D(LaunchConfigurationType); 45 46 d->starters.removeAll( starter ); 47 } 48 launchers() const49QList<ILauncher*> LaunchConfigurationType::launchers() const 50 { 51 Q_D(const LaunchConfigurationType); 52 53 return d->starters; 54 } 55 launcherForId(const QString & id) const56ILauncher* LaunchConfigurationType::launcherForId(const QString& id) const 57 { 58 Q_D(const LaunchConfigurationType); 59 60 for (ILauncher* l : qAsConst(d->starters)) { 61 if( l->id() == id ) { 62 return l; 63 } 64 } 65 return nullptr; 66 } 67 68 } 69 70