projectexplorer.cpp 95.5 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
con's avatar
con committed
9
** No Commercial Usage
10
**
con's avatar
con committed
11
12
13
14
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
con's avatar
con committed
25
26
27
28
29
30
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
con's avatar
con committed
31
**
32
**************************************************************************/
hjk's avatar
hjk committed
33

34
#include "projectexplorer.h"
Tobias Hunger's avatar
Tobias Hunger committed
35

Tobias Hunger's avatar
Tobias Hunger committed
36
37
#include "buildsteplist.h"
#include "deployconfiguration.h"
38
#include "project.h"
39
#include "projectexplorersettings.h"
Tobias Hunger's avatar
Tobias Hunger committed
40
41
#include "target.h"
#include "targetsettingspanel.h"
42
#include "copytaskhandler.h"
43
#include "showineditortaskhandler.h"
44
#include "vcsannotatetaskhandler.h"
45
#include "localapplicationruncontrol.h"
con's avatar
con committed
46
47
48
49
#include "allprojectsfilter.h"
#include "allprojectsfind.h"
#include "buildmanager.h"
#include "buildsettingspropertiespage.h"
50
#include "currentprojectfind.h"
con's avatar
con committed
51
52
#include "currentprojectfilter.h"
#include "customexecutablerunconfiguration.h"
53
54
#include "editorsettingspropertiespage.h"
#include "dependenciespanel.h"
con's avatar
con committed
55
56
57
58
59
60
61
62
63
#include "foldernavigationwidget.h"
#include "iprojectmanager.h"
#include "metatypedeclarations.h"
#include "nodesvisitor.h"
#include "outputwindow.h"
#include "persistentsettings.h"
#include "pluginfilefactory.h"
#include "processstep.h"
#include "projectexplorerconstants.h"
64
#include "customwizard.h"
con's avatar
con committed
65
66
67
68
69
70
71
#include "projectfilewizardextension.h"
#include "projecttreewidget.h"
#include "projectwindow.h"
#include "removefiledialog.h"
#include "runsettingspropertiespage.h"
#include "scriptwrappers.h"
#include "session.h"
72
#include "projectnodes.h"
con's avatar
con committed
73
#include "sessiondialog.h"
Tobias Hunger's avatar
Tobias Hunger committed
74
#include "target.h"
75
#include "projectexplorersettingspage.h"
76
77
#include "projectwelcomepage.h"
#include "projectwelcomepagewidget.h"
78
#include "corelistenercheckingforrunningbuild.h"
79
#include "buildconfiguration.h"
80
#include "miniprojecttargetselector.h"
dt's avatar
dt committed
81
#include "taskhub.h"
82
83
#include "publishing/ipublishingwizardfactory.h"
#include "publishing/publishingwizardselectiondialog.h"
con's avatar
con committed
84
85

#include <coreplugin/coreconstants.h>
86
87
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
88
#include <coreplugin/imode.h>
con's avatar
con committed
89
90
#include <coreplugin/mimedatabase.h>
#include <coreplugin/modemanager.h>
91
#include <coreplugin/actionmanager/actionmanager.h>
92
93
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
94
#include <coreplugin/uniqueidmanager.h>
con's avatar
con committed
95
96
97
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/ieditorfactory.h>
98
#include <coreplugin/editormanager/iexternaleditor.h>
con's avatar
con committed
99
100
101
102
#include <coreplugin/findplaceholder.h>
#include <coreplugin/basefilewizard.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/iversioncontrol.h>
103
#include <welcome/welcomemode.h>
104
#include <extensionsystem/pluginmanager.h>
105
#include <find/searchresultwindow.h>
106
#include <utils/consoleprocess.h>
hjk's avatar
hjk committed
107
#include <utils/qtcassert.h>
108
#include <utils/parameteraction.h>
109
#include <utils/stringutils.h>
con's avatar
con committed
110

111
#include <QtCore/QtPlugin>
hjk's avatar
hjk committed
112
#include <QtCore/QDateTime>
con's avatar
con committed
113
114
#include <QtCore/QDebug>
#include <QtCore/QSettings>
hjk's avatar
hjk committed
115

con's avatar
con committed
116
117
#include <QtGui/QAction>
#include <QtGui/QApplication>
hjk's avatar
hjk committed
118
119
120
#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
121
#include <QtGui/QMainWindow>
122
#include <QtGui/QWizard>
con's avatar
con committed
123

124
125
Q_DECLARE_METATYPE(Core::IEditorFactory*)
Q_DECLARE_METATYPE(Core::IExternalEditor*)
con's avatar
con committed
126
127
128
129
130

namespace {
bool debug = false;
}

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
namespace ProjectExplorer {

struct ProjectExplorerPluginPrivate {
    ProjectExplorerPluginPrivate();

    QMenu *m_sessionContextMenu;
    QMenu *m_sessionMenu;
    QMenu *m_projectMenu;
    QMenu *m_subProjectMenu;
    QMenu *m_folderMenu;
    QMenu *m_fileMenu;
    QMenu *m_openWithMenu;

    QMultiMap<int, QObject*> m_actionMap;
    QAction *m_sessionManagerAction;
    QAction *m_newAction;
    QAction *m_loadAction;
148
    Utils::ParameterAction *m_unloadAction;
149
150
    QAction *m_clearSession;
    QAction *m_buildProjectOnlyAction;
151
    Utils::ParameterAction *m_buildAction;
152
    Utils::ParameterAction *m_buildActionContextMenu;
153
154
    QAction *m_buildSessionAction;
    QAction *m_rebuildProjectOnlyAction;
155
    Utils::ParameterAction *m_rebuildAction;
156
    Utils::ParameterAction *m_rebuildActionContextMenu;
157
158
    QAction *m_rebuildSessionAction;
    QAction *m_cleanProjectOnlyAction;
Tobias Hunger's avatar
Tobias Hunger committed
159
160
161
162
    QAction *m_deployProjectOnlyAction;
    Utils::ParameterAction *m_deployAction;
    Utils::ParameterAction *m_deployActionContextMenu;
    QAction *m_deploySessionAction;
163
    Utils::ParameterAction *m_publishAction;
164
    Utils::ParameterAction *m_cleanAction;
165
    Utils::ParameterAction *m_cleanActionContextMenu;
166
167
168
169
170
171
    QAction *m_cleanSessionAction;
    QAction *m_runAction;
    QAction *m_runActionContextMenu;
    QAction *m_cancelBuildAction;
    QAction *m_addNewFileAction;
    QAction *m_addExistingFilesAction;
172
    QAction *m_addNewSubprojectAction;
173
    QAction *m_removeFileAction;
174
    QAction *m_removeProjectAction;
175
    QAction *m_deleteFileAction;
176
    QAction *m_renameFileAction;
dt's avatar
dt committed
177
178
179
    QAction *m_openFileAction;
    QAction *m_showInGraphicalShell;
    QAction *m_openTerminalHere;
180
    QAction *m_setStartupProjectAction;
181
    QAction *m_projectSelectorAction;
182
    QAction *m_projectSelectorActionMenu;
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

    Internal::ProjectWindow *m_proWindow;
    SessionManager *m_session;
    QString m_sessionToRestoreAtStartup;

    Project *m_currentProject;
    Node *m_currentNode;

    BuildManager *m_buildManager;

    QList<Internal::ProjectFileFactory*> m_fileFactories;
    QStringList m_profileMimeTypes;
    Internal::OutputPane *m_outputPane;

    QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
    static const int m_maxRecentProjects = 7;

    QString m_lastOpenDirectory;
201
    RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
202
203
    QString m_runMode;
    QString m_projectFilterString;
204
    Internal::MiniProjectTargetSelector * m_targetSelector;
205
    Internal::ProjectExplorerSettings m_projectExplorerSettings;
206
    Internal::ProjectWelcomePage *m_welcomePage;
207

208
    Core::IMode *m_projectsMode;
209
210
211
212
213
214
};

ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
    m_currentProject(0),
    m_currentNode(0),
    m_delayedRunConfiguration(0),
215
    m_projectsMode(0)
216
217
218
{
}

219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
class ProjectsMode : public Core::IMode
{
public:
    ProjectsMode(QWidget *proWindow) : m_widget(proWindow) {}

    QString displayName() const { return tr("Projects"); }
    QIcon icon() const { return QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")); }
    int priority() const { return Constants::P_MODE_SESSION; }
    QWidget *widget() { return m_widget; }
    QString id() const { return QLatin1String(Constants::MODE_SESSION); }
    QString type() const { return QString(); }
    Core::Context context() const { return Core::Context(Constants::C_PROJECTEXPLORER); }
    QString contextHelpId() const { return QLatin1String("Managing Projects"); }

private:
    QWidget *m_widget;
    QIcon m_icon;
};

238
239
}  // namespace ProjectExplorer

con's avatar
con committed
240
241
242
243
244
245
246
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;


ProjectExplorerPlugin *ProjectExplorerPlugin::m_instance = 0;

ProjectExplorerPlugin::ProjectExplorerPlugin()
247
    : d(new ProjectExplorerPluginPrivate)
con's avatar
con committed
248
249
250
251
252
253
{
    m_instance = this;
}

ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
254
255
    removeObject(d->m_welcomePage);
    delete d->m_welcomePage;
con's avatar
con committed
256
    removeObject(this);
257
    delete d;
con's avatar
con committed
258
259
260
261
262
263
264
}

ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
{
    return m_instance;
}

265
266
267
268
269
270
bool ProjectExplorerPlugin::parseArguments(const QStringList &arguments, QString * /* error */)
{
    CustomWizard::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
    return true;
}

271
bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
con's avatar
con committed
272
{
273
274
    if (!parseArguments(arguments, error))
        return false;
dt's avatar
dt committed
275
276
277
    addObject(this);

    addAutoReleasedObject(new TaskHub);
278

279
280
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();
281
    connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
con's avatar
con committed
282

283
    d->m_welcomePage = new ProjectWelcomePage;
284
    connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
285
    addObject(d->m_welcomePage);
con's avatar
con committed
286

hjk's avatar
hjk committed
287
288
    connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
            this, SLOT(setCurrentFile(QString)));
con's avatar
con committed
289

290
    d->m_session = new SessionManager(this);
con's avatar
con committed
291

292
    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
con's avatar
con committed
293
            this, SIGNAL(fileListChanged()));
294
    connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
con's avatar
con committed
295
            this, SLOT(invalidateProject(ProjectExplorer::Project *)));
296
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
con's avatar
con committed
297
            this, SIGNAL(fileListChanged()));
298
    connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
con's avatar
con committed
299
            this, SLOT(startupProjectChanged()));
300
301
    connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
            this, SLOT(updateActions()));
con's avatar
con committed
302

303
    d->m_proWindow = new ProjectWindow;
con's avatar
con committed
304

305
    Core::Context globalcontext(Core::Constants::C_GLOBAL);
dt's avatar
dt committed
306
    Core::Context projecTreeContext(Constants::C_PROJECT_TREE);
con's avatar
con committed
307

308
    d->m_projectsMode = new ProjectsMode(d->m_proWindow);
309
310
    d->m_projectsMode->setEnabled(session()->startupProject());
    addAutoReleasedObject(d->m_projectsMode);
311
    d->m_proWindow->layout()->addWidget(new Core::FindToolBarPlaceHolder(d->m_proWindow));
con's avatar
con committed
312

313
    addAutoReleasedObject(new CopyTaskHandler);
314
    addAutoReleasedObject(new ShowInEditorTaskHandler);
315
    addAutoReleasedObject(new VcsAnnotateTaskHandler);
316

317
318
    d->m_buildManager = new BuildManager(this);
    connect(d->m_buildManager, SIGNAL(buildStateChanged(ProjectExplorer::Project *)),
con's avatar
con committed
319
            this, SLOT(buildStateChanged(ProjectExplorer::Project *)));
320
    connect(d->m_buildManager, SIGNAL(buildQueueFinished(bool)),
con's avatar
con committed
321
322
            this, SLOT(buildQueueFinished(bool)));

323
    addAutoReleasedObject(new CoreListener);
con's avatar
con committed
324

325
326
327
328
    d->m_outputPane = new OutputPane;
    addAutoReleasedObject(d->m_outputPane);
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
            d->m_outputPane, SLOT(projectRemoved()));
con's avatar
con committed
329

330
    AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this);
con's avatar
con committed
331
332
    addAutoReleasedObject(allProjectsFilter);

333
    CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this);
con's avatar
con committed
334
335
336
337
338
    addAutoReleasedObject(currentProjectFilter);

    addAutoReleasedObject(new BuildSettingsPanelFactory);
    addAutoReleasedObject(new RunSettingsPanelFactory);
    addAutoReleasedObject(new EditorSettingsPanelFactory);
339
    addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
con's avatar
con committed
340
341
342
343

    ProcessStepFactory *processStepFactory = new ProcessStepFactory;
    addAutoReleasedObject(processStepFactory);

344
    AllProjectsFind *allProjectsFind = new AllProjectsFind(this,
345
        Find::SearchResultWindow::instance());
con's avatar
con committed
346
347
    addAutoReleasedObject(allProjectsFind);

348
    CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this,
349
        Find::SearchResultWindow::instance());
con's avatar
con committed
350
351
    addAutoReleasedObject(currentProjectFind);

352
    addAutoReleasedObject(new LocalApplicationRunControlFactory);
con's avatar
con committed
353
354
    addAutoReleasedObject(new CustomExecutableRunConfigurationFactory);

355
    addAutoReleasedObject(new ProjectFileWizardExtension);
con's avatar
con committed
356

357
358
359
    // Settings page
    addAutoReleasedObject(new ProjectExplorerSettingsPage);

con's avatar
con committed
360
    // context menus
361
    Core::ActionContainer *msessionContextMenu =
con's avatar
con committed
362
        am->createMenu(Constants::M_SESSIONCONTEXT);
dt's avatar
dt committed
363
    Core::ActionContainer *mprojectContextMenu =
con's avatar
con committed
364
        am->createMenu(Constants::M_PROJECTCONTEXT);
dt's avatar
dt committed
365
    Core::ActionContainer *msubProjectContextMenu =
con's avatar
con committed
366
        am->createMenu(Constants::M_SUBPROJECTCONTEXT);
dt's avatar
dt committed
367
    Core::ActionContainer *mfolderContextMenu =
con's avatar
con committed
368
        am->createMenu(Constants::M_FOLDERCONTEXT);
dt's avatar
dt committed
369
    Core::ActionContainer *mfileContextMenu =
con's avatar
con committed
370
371
        am->createMenu(Constants::M_FILECONTEXT);

372
    d->m_sessionContextMenu = msessionContextMenu->menu();
dt's avatar
dt committed
373
374
375
376
    d->m_projectMenu = mprojectContextMenu->menu();
    d->m_subProjectMenu = msubProjectContextMenu->menu();
    d->m_folderMenu = mfolderContextMenu->menu();
    d->m_fileMenu = mfileContextMenu->menu();
con's avatar
con committed
377

378
    Core::ActionContainer *mfile =
con's avatar
con committed
379
        am->actionContainer(Core::Constants::M_FILE);
380
    Core::ActionContainer *menubar =
con's avatar
con committed
381
382
383
        am->actionContainer(Core::Constants::MENU_BAR);

    // mode manager (for fancy actions)
384
    Core::ModeManager *modeManager = core->modeManager();
con's avatar
con committed
385
386

    // build menu
387
    Core::ActionContainer *mbuild =
con's avatar
con committed
388
        am->createMenu(Constants::M_BUILDPROJECT);
389
    mbuild->menu()->setTitle(tr("&Build"));
con's avatar
con committed
390
391
392
    menubar->addMenu(mbuild, Core::Constants::G_VIEW);

    // debug menu
393
    Core::ActionContainer *mdebug =
con's avatar
con committed
394
        am->createMenu(Constants::M_DEBUG);
395
    mdebug->menu()->setTitle(tr("&Debug"));
con's avatar
con committed
396
397
    menubar->addMenu(mdebug, Core::Constants::G_VIEW);

398
399
400
401
    Core::ActionContainer *mstartdebugging =
        am->createMenu(Constants::M_DEBUG_STARTDEBUGGING);
    mstartdebugging->menu()->setTitle(tr("&Start Debugging"));
    mdebug->addMenu(mstartdebugging, Core::Constants::G_DEFAULT_ONE);
con's avatar
con committed
402
403
404
405
406
407
408
409
410

    //
    // Groups
    //

    mbuild->appendGroup(Constants::G_BUILD_SESSION);
    mbuild->appendGroup(Constants::G_BUILD_PROJECT);
    mbuild->appendGroup(Constants::G_BUILD_OTHER);
    mbuild->appendGroup(Constants::G_BUILD_CANCEL);
dt's avatar
dt committed
411
    mbuild->appendGroup(Constants::G_BUILD_RUN);
con's avatar
con committed
412
413
414
415
416
417

    msessionContextMenu->appendGroup(Constants::G_SESSION_BUILD);
    msessionContextMenu->appendGroup(Constants::G_SESSION_FILES);
    msessionContextMenu->appendGroup(Constants::G_SESSION_OTHER);
    msessionContextMenu->appendGroup(Constants::G_SESSION_CONFIG);

dt's avatar
dt committed
418
419
420
421
422
423
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_FIRST);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_BUILD);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_RUN);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_FILES);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_OTHER);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_CONFIG);
con's avatar
con committed
424

dt's avatar
dt committed
425
426
427
428
429
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FIRST);
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_BUILD);
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FILES);
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_OTHER);
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_CONFIG);
con's avatar
con committed
430

dt's avatar
dt committed
431
432
433
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_FILES);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_OTHER);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_CONFIG);
con's avatar
con committed
434

dt's avatar
dt committed
435
436
437
    mfileContextMenu->appendGroup(Constants::G_FILE_OPEN);
    mfileContextMenu->appendGroup(Constants::G_FILE_OTHER);
    mfileContextMenu->appendGroup(Constants::G_FILE_CONFIG);
con's avatar
con committed
438
439

    // "open with" submenu
440
    Core::ActionContainer * const openWith =
con's avatar
con committed
441
            am->createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT);
442
    openWith->setOnAllDisabledBehavior(Core::ActionContainer::Show);
443
444
    d->m_openWithMenu = openWith->menu();
    d->m_openWithMenu->setTitle(tr("Open With"));
con's avatar
con committed
445

446
    connect(d->m_openWithMenu, SIGNAL(triggered(QAction *)),
con's avatar
con committed
447
448
449
450
451
452
            this, SLOT(openWithMenuTriggered(QAction *)));

    //
    // Separators
    //

con's avatar
con committed
453
    Core::Command *cmd;
con's avatar
con committed
454
455
456
457
    QAction *sep;

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
458
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Build.Sep"), globalcontext);
con's avatar
con committed
459
460
461
462
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
463
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext);
con's avatar
con committed
464
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
dt's avatar
dt committed
465
466
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
con's avatar
con committed
467
468
469

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
470
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext);
con's avatar
con committed
471
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_CONFIG);
dt's avatar
dt committed
472
473
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_CONFIG);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_CONFIG);
con's avatar
con committed
474
475
476

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
477
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext);
con's avatar
con committed
478
479
480
481
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
482
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext);
con's avatar
con committed
483
484
    mbuild->addAction(cmd, Constants::G_BUILD_OTHER);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER);
dt's avatar
dt committed
485
486
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_OTHER);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_OTHER);
con's avatar
con committed
487
488
489

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
490
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext);
con's avatar
con committed
491
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
dt's avatar
dt committed
492
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
con's avatar
con committed
493
494
495

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
496
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext);
con's avatar
con committed
497
498
499
500
501
502
503
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    //
    // Actions
    //

    // new session action
504
505
    d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
    cmd = am->registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
con's avatar
con committed
506
507
508
    cmd->setDefaultKeySequence(QKeySequence());

    // new action
509
510
    d->m_newAction = new QAction(tr("New Project..."), this);
    cmd = am->registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext);
con's avatar
con committed
511
512
513
514
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N")));
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // open action
515
516
    d->m_loadAction = new QAction(tr("Load Project..."), this);
    cmd = am->registerAction(d->m_loadAction, Constants::LOAD, globalcontext);
517
#ifndef Q_WS_MAC
con's avatar
con committed
518
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O")));
519
#endif
con's avatar
con committed
520
521
522
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // Default open action
523
524
    d->m_openFileAction = new QAction(tr("Open File"), this);
    cmd = am->registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
dt's avatar
dt committed
525
526
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
con's avatar
con committed
527

528
    d->m_showInGraphicalShell = new QAction(FolderNavigationWidget::msgGraphicalShellAction(), this);
529
    cmd = am->registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
dt's avatar
dt committed
530
531
532
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
533

534
    d->m_openTerminalHere = new QAction(FolderNavigationWidget::msgTerminalAction(), this);
535
    cmd = am->registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
dt's avatar
dt committed
536
537
538
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
539

con's avatar
con committed
540
    // Open With menu
dt's avatar
dt committed
541
    mfileContextMenu->addMenu(openWith, ProjectExplorer::Constants::G_FILE_OPEN);
con's avatar
con committed
542

mae's avatar
mae committed
543
    // recent projects menu
544
    Core::ActionContainer *mrecent =
mae's avatar
mae committed
545
        am->createMenu(Constants::M_RECENTPROJECTS);
546
    mrecent->menu()->setTitle(tr("Recent P&rojects"));
547
    mrecent->setOnAllDisabledBehavior(Core::ActionContainer::Show);
mae's avatar
mae committed
548
549
550
551
    mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN);
    connect(mfile->menu(), SIGNAL(aboutToShow()),
        this, SLOT(updateRecentProjectMenu()));

dt's avatar
dt committed
552
    // XXX same action?
con's avatar
con committed
553
    // unload action
554
555
    d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
                                                      Utils::ParameterAction::EnabledWithParameter, this);
556
    cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext);
con's avatar
con committed
557
    cmd->setAttribute(Core::Command::CA_UpdateText);
558
    cmd->setDefaultText(d->m_unloadAction->text());
con's avatar
con committed
559
560
561
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    // unload session action
562
563
    d->m_clearSession = new QAction(tr("Close All Projects"), this);
    cmd = am->registerAction(d->m_clearSession, Constants::CLEARSESSION, globalcontext);
con's avatar
con committed
564
565
566
567
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // session menu
568
    Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION);
569
    msession->menu()->setTitle(tr("Session"));
570
    msession->setOnAllDisabledBehavior(Core::ActionContainer::Show);
con's avatar
con committed
571
    mfile->addMenu(msession, Core::Constants::G_FILE_PROJECT);
572
    d->m_sessionMenu = msession->menu();
con's avatar
con committed
573
574
575
576
577
578
    connect(mfile->menu(), SIGNAL(aboutToShow()),
            this, SLOT(updateSessionMenu()));

    // build session action
    QIcon buildIcon(Constants::ICON_BUILD);
    buildIcon.addFile(Constants::ICON_BUILD_SMALL);
579
580
    d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
    cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
con's avatar
con committed
581
582
583
584
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B")));
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
    // Add to mode bar
585
    modeManager->addAction(cmd->action(), Constants::P_ACTION_BUILDSESSION);
con's avatar
con committed
586
587
588
589

    // rebuild session action
    QIcon rebuildIcon(Constants::ICON_REBUILD);
    rebuildIcon.addFile(Constants::ICON_REBUILD_SMALL);
590
591
    d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this);
    cmd = am->registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext);
con's avatar
con committed
592
593
594
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

Tobias Hunger's avatar
Tobias Hunger committed
595
596
597
598
599
600
    // deploy session
    d->m_deploySessionAction = new QAction(tr("Deploy All"), this);
    cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext);
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

con's avatar
con committed
601
602
603
    // clean session
    QIcon cleanIcon(Constants::ICON_CLEAN);
    cleanIcon.addFile(Constants::ICON_CLEAN_SMALL);
604
605
    d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this);
    cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext);
con's avatar
con committed
606
607
608
609
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

    // build action
610
    d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
611
                                                     Utils::ParameterAction::AlwaysEnabled, this);
612
    cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext);
613
    cmd->setAttribute(Core::Command::CA_UpdateText);
614
    cmd->setDefaultText(d->m_buildAction->text());
con's avatar
con committed
615
616
617
618
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B")));
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

    // rebuild action
619
    d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
620
                                                       Utils::ParameterAction::AlwaysEnabled, this);
621
    cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext);
622
    cmd->setAttribute(Core::Command::CA_UpdateText);
623
    cmd->setDefaultText(d->m_rebuildAction->text());
con's avatar
con committed
624
625
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

Tobias Hunger's avatar
Tobias Hunger committed
626
627
628
629
630
631
632
633
    // deploy action
    d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""),
                                                     Utils::ParameterAction::AlwaysEnabled, this);
    cmd = am->registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext);
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_deployAction->text());
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

634
635
636
637
638
639
640
641
    // Publish action
    d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."),
                                                    Utils::ParameterAction::AlwaysEnabled, this);
    cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext);
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_publishAction->text());
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

con's avatar
con committed
642
    // clean action
643
    d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
644
                                                     Utils::ParameterAction::AlwaysEnabled, this);
645
    cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext);
646
    cmd->setAttribute(Core::Command::CA_UpdateText);
647
    cmd->setDefaultText(d->m_cleanAction->text());
con's avatar
con committed
648
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);
649
650
651
652

    // build action (context menu)
    d->m_buildActionContextMenu = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
                                                             Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
653
    cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext);
654
655
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_buildActionContextMenu->text());
dt's avatar
dt committed
656
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
657
658
659
660

    // rebuild action (context menu)
    d->m_rebuildActionContextMenu = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
                                                               Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
661
    cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext);
662
663
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_rebuildActionContextMenu->text());
dt's avatar
dt committed
664
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
665

Tobias Hunger's avatar
Tobias Hunger committed
666
667
668
    // deploy action (context menu)
    d->m_deployActionContextMenu = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""),
                                                              Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
669
    cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext);
Tobias Hunger's avatar
Tobias Hunger committed
670
671
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_deployActionContextMenu->text());
dt's avatar
dt committed
672
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
Tobias Hunger's avatar
Tobias Hunger committed
673

674
675
676
    // clean action (context menu)
    d->m_cleanActionContextMenu = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
                                                             Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
677
    cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext);
678
679
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_cleanActionContextMenu->text());
dt's avatar
dt committed
680
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
con's avatar
con committed
681

682
    // build without dependencies action
683
684
    d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this);
    cmd = am->registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext);
685

686
    // rebuild without dependencies action
687
688
    d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this);
    cmd = am->registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext);
689

Tobias Hunger's avatar
Tobias Hunger committed
690
691
692
693
    // deploy without dependencies action
    d->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this);
    cmd = am->registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext);

694
    // clean without dependencies action
695
696
    d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this);
    cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext);
697

con's avatar
con committed
698
699
700
    // run action
    QIcon runIcon(Constants::ICON_RUN);
    runIcon.addFile(Constants::ICON_RUN_SMALL);
701
702
    d->m_runAction = new QAction(runIcon, tr("Run"), this);
    cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext);
703
704
    cmd->setAttribute(Core::Command::CA_UpdateText);

con's avatar
con committed
705
706
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
707

708
    modeManager->addAction(cmd->action(), Constants::P_ACTION_RUN);
con's avatar
con committed
709

710
    d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
dt's avatar
dt committed
711
712
    cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
713

con's avatar
con committed
714
    // cancel build action
715
716
    d->m_cancelBuildAction = new QAction(tr("Cancel Build"), this);
    cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext);
con's avatar
con committed
717
718
719
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    // add new file action
720
721
    d->m_addNewFileAction = new QAction(tr("Add New..."), this);
    cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
dt's avatar
dt committed
722
723
724
725
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
726
727

    // add existing file action
728
729
    d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this);
    cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES,
dt's avatar
dt committed
730
731
732
733
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
734

735
736
737
    // new subproject action
    d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this);
    cmd = am->registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT,
dt's avatar
dt committed
738
739
740
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
741
742

    // unload project again, in right position
dt's avatar
dt committed
743
    mprojectContextMenu->addAction(am->command(Constants::UNLOAD), Constants::G_PROJECT_FILES);
744

con's avatar
con committed
745
    // remove file action
746
747
    d->m_removeFileAction = new QAction(tr("Remove File..."), this);
    cmd = am->registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE,
dt's avatar
dt committed
748
                       projecTreeContext);
749
    cmd->setDefaultKeySequence(QKeySequence::Delete);
dt's avatar
dt committed
750
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
con's avatar
con committed
751

Friedemann Kleint's avatar
Friedemann Kleint committed
752
753
    //: Remove project from parent profile (Project explorer view); will not physically delete any files.
    d->m_removeProjectAction = new QAction(tr("Remove Project..."), this);
754
    cmd = am->registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT,
dt's avatar
dt committed
755
756
                       projecTreeContext);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
757

dt's avatar
dt committed
758
    // delete file action
759
760
    d->m_deleteFileAction = new QAction(tr("Delete File..."), this);
    cmd = am->registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE,
dt's avatar
dt committed
761
                             projecTreeContext);
762
    cmd->setDefaultKeySequence(QKeySequence::Delete);
dt's avatar
dt committed
763
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
764

dt's avatar
dt committed
765
    // renamefile action
766
767
    d->m_renameFileAction = new QAction(tr("Rename"), this);
    cmd = am->registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE,
dt's avatar
dt committed
768
769
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
dt's avatar
dt committed
770
771
772
773
    // Not yet used by anyone, so hide for now
//    mfolder->addAction(cmd, Constants::G_FOLDER_FILES);
//    msubProject->addAction(cmd, Constants::G_FOLDER_FILES);
//    mproject->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
774

775
776
777
    // set startup project action
    d->m_setStartupProjectAction = new QAction(tr("Set as Startup Project"), this);
    cmd = am->registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP,
dt's avatar
dt committed
778
779
                             projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FIRST);
780

781
782
    // target selector
    d->m_projectSelectorAction = new QAction(this);
783
    d->m_projectSelectorAction->setCheckable(true);
784
785
786
    d->m_projectSelectorAction->setEnabled(false);
    QWidget *mainWindow = Core::ICore::instance()->mainWindow();
    d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow);
787
    connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show()));
788
    modeManager->addProjectSelector(d->m_projectSelectorAction);
789
790
791
792
793
794

    d->m_projectSelectorActionMenu = new QAction(this);
    d->m_projectSelectorActionMenu->setEnabled(false);
    d->m_projectSelectorActionMenu->setText(tr("Open Build/Run Target Selector..."));
    connect(d->m_projectSelectorActionMenu, SIGNAL(triggered()), d->m_targetSelector, SLOT(show()));
    cmd = am->registerAction(d->m_projectSelectorActionMenu, ProjectExplorer::Constants::SELECTTARGET,
Tobias Hunger's avatar
Tobias Hunger committed
795
796
                       globalcontext);
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T")));
797
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
798
799
800
801
802
803
804
805
806
807

    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
            d->m_targetSelector, SLOT(addProject(ProjectExplorer::Project*)));
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
            d->m_targetSelector, SLOT(removeProject(ProjectExplorer::Project*)));
    connect(d->m_targetSelector, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
            this, SLOT(setStartupProject(ProjectExplorer::Project*)));
    connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
            d->m_targetSelector, SLOT(changeStartupProject(ProjectExplorer::Project*)));

808
    connect(core, SIGNAL(saveSettingsRequested()),
con's avatar
con committed
809
810
        this, SLOT(savePersistentSettings()));

hjk's avatar
hjk committed
811
812
    addAutoReleasedObject(new ProjectTreeWidgetFactory);
    addAutoReleasedObject(new FolderNavigationWidgetFactory);
con's avatar
con committed
813

814
815
816
817
818
    if (QSettings *s = core->settings()) {
        const QStringList fileNames = s->value("ProjectExplorer/RecentProjects/FileNames").toStringList();
        const QStringList displayNames = s->value("ProjectExplorer/RecentProjects/DisplayNames").toStringList();
        if (fileNames.size() == displayNames.size()) {
            for (int i = 0; i < fileNames.size(); ++i) {
819
                if (QFileInfo(fileNames.at(i)).isFile())
820
                    d->m_recentProjects.append(qMakePair(fileNames.at(i), displayNames.at(i)));
821
822
823
824
            }
        }
    }

825
    if (QSettings *s = core->settings()) {
Tobias Hunger's avatar
Tobias Hunger committed
826
827
        d->m_projectExplorerSettings.buildBeforeDeploy = s->value("ProjectExplorer/Settings/BuildBeforeDeploy", true).toBool();
        d->m_projectExplorerSettings.deployBeforeRun = s->value("ProjectExplorer/Settings/DeployBeforeRun", true).toBool();
828
829
        d->m_projectExplorerSettings.saveBeforeBuild = s->value("ProjectExplorer/Settings/SaveBeforeBuild", false).toBool();
        d->m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool();
830
        d->m_projectExplorerSettings.showRunOutput = s->value("ProjectExplorer/Settings/ShowRunOutput", true).toBool();
831
        d->m_projectExplorerSettings.cleanOldAppOutput = s->value("ProjectExplorer/Settings/CleanOldAppOutput", false).toBool();
832
        d->m_projectExplorerSettings.wrapAppOutput = s->value("ProjectExplorer/Settings/WrapAppOutput", true).toBool();
833
        d->m_projectExplorerSettings.useJom = s->value("ProjectExplorer/Settings/UseJom", true).toBool();
834
        d->m_projectExplorerSettings.autorestoreLastSession = s->value("ProjectExplorer/Settings/AutoRestoreLastSession", false).toBool();
835
        d->m_projectExplorerSettings.prompToStopRunControl = s->value("ProjectExplorer/Settings/PromptToStopRunControl", false).toBool();
836
837
838
        d->m_projectExplorerSettings.environmentId = QUuid(s->value("ProjectExplorer/Settings/EnvironmentId").toString());
        if (d->m_projectExplorerSettings.environmentId.isNull())
            d->m_projectExplorerSettings.environmentId = QUuid::createUuid();
839
    }
840

841
842
843
844
845
    connect(d->m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(showSessionManager()));
    connect(d->m_newAction, SIGNAL(triggered()), this, SLOT(newProject()));
    connect(d->m_loadAction, SIGNAL(triggered()), this, SLOT(loadAction()));
    connect(d->m_buildProjectOnlyAction, SIGNAL(triggered()), this, SLOT(buildProjectOnly()));
    connect(d->m_buildAction, SIGNAL(triggered()), this, SLOT(buildProject()));
846
    connect(d->m_buildActionContextMenu, SIGNAL(triggered()), this, SLOT(buildProjectContextMenu()));
847
848
849
    connect(d->m_buildSessionAction, SIGNAL(triggered()), this, SLOT(buildSession()));
    connect(d->m_rebuildProjectOnlyAction, SIGNAL(triggered()), this, SLOT(rebuildProjectOnly()));
    connect(d->m_rebuildAction, SIGNAL(triggered()), this, SLOT(rebuildProject()));
850
    connect(d->m_rebuildActionContextMenu, SIGNAL(triggered()), this, SLOT(rebuildProjectContextMenu()));
851
    connect(d->m_rebuildSessionAction, SIGNAL(triggered()), this, SLOT(rebuildSession()));
Tobias Hunger's avatar
Tobias Hunger committed
852
853
854
855
    connect(d->m_deployProjectOnlyAction, SIGNAL(triggered()), this, SLOT(deployProjectOnly()));
    connect(d->m_deployAction, SIGNAL(triggered()), this, SLOT(deployProject()));
    connect(d->m_deployActionContextMenu, SIGNAL(triggered()), this, SLOT(deployProjectContextMenu()));
    connect(d->m_deploySessionAction, SIGNAL(triggered()), this, SLOT(deploySession()));
856
    connect(d->m_publishAction, SIGNAL(triggered()), this, SLOT(publishProject()));
857
858
    connect(d->m_cleanProjectOnlyAction, SIGNAL(triggered()), this, SLOT(cleanProjectOnly()));
    connect(d->m_cleanAction, SIGNAL(triggered()), this, SLOT(cleanProject()));
859
    connect(d->m_cleanActionContextMenu, SIGNAL(triggered()), this, SLOT(cleanProjectContextMenu()));
860
861
862
863
864
865
866
867
    connect(d->m_cleanSessionAction, SIGNAL(triggered()), this, SLOT(cleanSession()));
    connect(d->m_runAction, SIGNAL(triggered()), this, SLOT(runProject()));
    connect(d->m_runActionContextMenu, SIGNAL(triggered()), this, SLOT(runProjectContextMenu()));
    connect(d->m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
    connect(d->m_unloadAction, SIGNAL(triggered()), this, SLOT(unloadProject()));
    connect(d->m_clearSession, SIGNAL(triggered()), this, SLOT(clearSession()));
    connect(d->m_addNewFileAction, SIGNAL(triggered()), this, SLOT(addNewFile()));
    connect(d->m_addExistingFilesAction, SIGNAL(triggered()), this, SLOT(addExistingFiles()));
868
    connect(d->m_addNewSubprojectAction, SIGNAL(triggered()), this, SLOT(addNewSubproject()));
869
    connect(d->m_removeProjectAction, SIGNAL(triggered()), this, SLOT(removeProject()));
870
871
    connect(d->m_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(d->m_showInGraphicalShell, SIGNAL(triggered()), this, SLOT(showInGraphicalShell()));
872
    connect(d->m_openTerminalHere, SIGNAL(triggered()), this, SLOT(openTerminalHere()));
873
    connect(d->m_removeFileAction, SIGNAL(triggered()), this, SLOT(removeFile()));
874
    connect(d->m_deleteFileAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
875
    connect(d->m_renameFileAction, SIGNAL(triggered()), this, SLOT(renameFile()));
dt's avatar