Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 3.04 KB | Hits: 41 | Expires: Never
Copy text to clipboard
  1. diff --git a/kdevplatform/shell/runcontroller.cpp b/kdevplatform/shell/runcontroller.cpp
  2. index 2ac2fa9..35f651f 100644
  3. --- a/kdevplatform/shell/runcontroller.cpp
  4. +++ b/kdevplatform/shell/runcontroller.cpp
  5. @@ -61,6 +61,7 @@ QString RunController::LaunchConfigurationsGroup = "Launch";
  6.  QString RunController::LaunchConfigurationsListEntry = "Launch Configurations";
  7.  static QString CurrentLaunchConfigProjectEntry = "Current Launch Config Project";
  8.  static QString CurrentLaunchConfigNameEntry = "Current Launch Config GroupName";
  9. +static QString ConfiguredFromProjectItemEntry = "Configured from ProjectItem";
  10.  
  11.  typedef QPair<QString, IProject*> Target;
  12.  Q_DECLARE_METATYPE(Target)
  13. @@ -182,15 +183,30 @@ public:
  14.              }
  15.              if (launcher)
  16.              {
  17. -                ILaunchConfiguration* ilaunch = q->createLaunchConfiguration( type,
  18. -                                                                            qMakePair( mode->id(), launcher->id() ),
  19. -                                                                            contextItem->project(),
  20. -                                                                            contextItem->text() );
  21. -                LaunchConfiguration* launch = dynamic_cast<LaunchConfiguration*>( ilaunch );
  22. -                type->configureLaunchFromItem( launch->config(), contextItem );
  23. -                q->setDefaultLaunch(launch);
  24. -                //kDebug() << "created config, launching";
  25.                 q->execute( mode->id(), launch );
  26. +                QStringList itemPath = Core::self()->projectController()->projectModel()->pathFromIndex(contextItem->index());
  27. +                ILaunchConfiguration* ilaunch = 0;
  28. +                foreach (LaunchConfiguration *l, launchConfigurations) {
  29. +                    QStringList path = l->config().readEntry(ConfiguredFromProjectItemEntry, QStringList());
  30. +                    if (path == itemPath) {
  31. +                        //kDebug() << "allready generated ilaunch" << ilaunch;
  32. +                        ilaunch = l;
  33. +                        break;
  34. +                    }
  35. +                }
  36. +                if (!ilaunch) {
  37. +                    ilaunch = q->createLaunchConfiguration( type,
  38. +                                                            qMakePair( mode->id(), launcher->id() ),
  39. +                                                            contextItem->project(),
  40. +                                                            contextItem->text() );
  41. +                    LaunchConfiguration* launch = dynamic_cast<LaunchConfiguration*>( ilaunch );
  42. +                    type->configureLaunchFromItem( launch->config(), contextItem );
  43. +                    launch->config().writeEntry(ConfiguredFromProjectItemEntry, itemPath);
  44. +                    //kDebug() << "created config, launching";
  45. +                } else {
  46. +                    //kDebug() << "reusing generated config, launching";
  47. +                }
  48. +                q->setDefaultLaunch(ilaunch);
  49. +                q->execute( mode->id(), ilaunch );
  50.              }
  51.          }
  52.      }