projectexplorer.cpp 95 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 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
**
9
** Commercial Usage
10
**
11
12
13
14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
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
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

30
#include "projectexplorer.h"
Tobias Hunger's avatar
Tobias Hunger committed
31

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

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

107
#include <QtCore/QtPlugin>
hjk's avatar
hjk committed
108
#include <QtCore/QDateTime>
con's avatar
con committed
109
110
#include <QtCore/QDebug>
#include <QtCore/QSettings>
hjk's avatar
hjk committed
111

con's avatar
con committed
112
113
#include <QtGui/QAction>
#include <QtGui/QApplication>
hjk's avatar
hjk committed
114
115
116
#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
117
#include <QtGui/QMainWindow>
118
#include <QtGui/QWizard>
con's avatar
con committed
119

120
121
Q_DECLARE_METATYPE(Core::IEditorFactory*);
Q_DECLARE_METATYPE(Core::IExternalEditor*);
con's avatar
con committed
122
123
124
125
126

namespace {
bool debug = false;
}

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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;
144
    Utils::ParameterAction *m_unloadAction;
145
146
    QAction *m_clearSession;
    QAction *m_buildProjectOnlyAction;
147
    Utils::ParameterAction *m_buildAction;
148
    Utils::ParameterAction *m_buildActionContextMenu;
149
150
    QAction *m_buildSessionAction;
    QAction *m_rebuildProjectOnlyAction;
151
    Utils::ParameterAction *m_rebuildAction;
152
    Utils::ParameterAction *m_rebuildActionContextMenu;
153
154
    QAction *m_rebuildSessionAction;
    QAction *m_cleanProjectOnlyAction;
Tobias Hunger's avatar
Tobias Hunger committed
155
156
157
158
    QAction *m_deployProjectOnlyAction;
    Utils::ParameterAction *m_deployAction;
    Utils::ParameterAction *m_deployActionContextMenu;
    QAction *m_deploySessionAction;
159
    Utils::ParameterAction *m_publishAction;
160
    Utils::ParameterAction *m_cleanAction;
161
    Utils::ParameterAction *m_cleanActionContextMenu;
162
163
164
165
166
167
    QAction *m_cleanSessionAction;
    QAction *m_runAction;
    QAction *m_runActionContextMenu;
    QAction *m_cancelBuildAction;
    QAction *m_addNewFileAction;
    QAction *m_addExistingFilesAction;
168
    QAction *m_addNewSubprojectAction;
169
    QAction *m_removeFileAction;
170
    QAction *m_removeProjectAction;
171
    QAction *m_deleteFileAction;
172
    QAction *m_renameFileAction;
dt's avatar
dt committed
173
174
175
    QAction *m_openFileAction;
    QAction *m_showInGraphicalShell;
    QAction *m_openTerminalHere;
176
    QAction *m_setStartupProjectAction;
177
    QAction *m_projectSelectorAction;
178
    QAction *m_projectSelectorActionMenu;
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

    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;
197
    RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
198
199
    QString m_runMode;
    QString m_projectFilterString;
200
    Internal::MiniProjectTargetSelector * m_targetSelector;
201
    Internal::ProjectExplorerSettings m_projectExplorerSettings;
202
    Internal::ProjectWelcomePage *m_welcomePage;
203
204

    Core::BaseMode * m_projectsMode;
205
206
207
208
209
210
};

ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
    m_currentProject(0),
    m_currentNode(0),
    m_delayedRunConfiguration(0),
211
    m_projectsMode(0)
212
213
214
215
216
{
}

}  // namespace ProjectExplorer

con's avatar
con committed
217
218
219
220
221
222
223
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;


ProjectExplorerPlugin *ProjectExplorerPlugin::m_instance = 0;

ProjectExplorerPlugin::ProjectExplorerPlugin()
224
    : d(new ProjectExplorerPluginPrivate)
con's avatar
con committed
225
226
227
228
229
230
{
    m_instance = this;
}

ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
231
232
    removeObject(d->m_welcomePage);
    delete d->m_welcomePage;
con's avatar
con committed
233
    removeObject(this);
234
    delete d;
con's avatar
con committed
235
236
237
238
239
240
241
}

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

242
243
244
245
246
247
bool ProjectExplorerPlugin::parseArguments(const QStringList &arguments, QString * /* error */)
{
    CustomWizard::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
    return true;
}

248
bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
con's avatar
con committed
249
{
250
251
    if (!parseArguments(arguments, error))
        return false;
dt's avatar
dt committed
252
253
254
    addObject(this);

    addAutoReleasedObject(new TaskHub);
255

256
257
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();
258
    connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
con's avatar
con committed
259

260
    d->m_welcomePage = new ProjectWelcomePage;
261
    connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
262
    addObject(d->m_welcomePage);
con's avatar
con committed
263

hjk's avatar
hjk committed
264
265
    connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
            this, SLOT(setCurrentFile(QString)));
con's avatar
con committed
266

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

269
    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
con's avatar
con committed
270
            this, SIGNAL(fileListChanged()));
271
    connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
con's avatar
con committed
272
            this, SLOT(invalidateProject(ProjectExplorer::Project *)));
273
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
con's avatar
con committed
274
            this, SIGNAL(fileListChanged()));
275
    connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
con's avatar
con committed
276
            this, SLOT(startupProjectChanged()));
277
278
    connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
            this, SLOT(updateActions()));
con's avatar
con committed
279

280
    d->m_proWindow = new ProjectWindow;
con's avatar
con committed
281

282
    Core::Context globalcontext(Core::Constants::C_GLOBAL);
283
    Core::Context pecontext(Constants::C_PROJECTEXPLORER);
dt's avatar
dt committed
284
    Core::Context projecTreeContext(Constants::C_PROJECT_TREE);
con's avatar
con committed
285

286
287
288
289
290
291
    d->m_projectsMode = new Core::BaseMode;
    d->m_projectsMode->setDisplayName(tr("Projects"));
    d->m_projectsMode->setId(QLatin1String(Constants::MODE_SESSION));
    d->m_projectsMode->setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")));
    d->m_projectsMode->setPriority(Constants::P_MODE_SESSION);
    d->m_projectsMode->setWidget(d->m_proWindow);
292
    d->m_projectsMode->setContext(pecontext);
293
    d->m_projectsMode->setEnabled(session()->startupProject());
Daniel Molkentin's avatar
Daniel Molkentin committed
294
    d->m_projectsMode->setContextHelpId(QLatin1String("Managing Projects"));
295
    addAutoReleasedObject(d->m_projectsMode);
296
    d->m_proWindow->layout()->addWidget(new Core::FindToolBarPlaceHolder(d->m_proWindow));
con's avatar
con committed
297

298
    addAutoReleasedObject(new CopyTaskHandler);
299
    addAutoReleasedObject(new ShowInEditorTaskHandler);
300
    addAutoReleasedObject(new VcsAnnotateTaskHandler);
301

302
303
    d->m_buildManager = new BuildManager(this);
    connect(d->m_buildManager, SIGNAL(buildStateChanged(ProjectExplorer::Project *)),
con's avatar
con committed
304
            this, SLOT(buildStateChanged(ProjectExplorer::Project *)));
305
    connect(d->m_buildManager, SIGNAL(buildQueueFinished(bool)),
con's avatar
con committed
306
307
            this, SLOT(buildQueueFinished(bool)));

308
    addAutoReleasedObject(new CoreListener);
con's avatar
con committed
309

310
311
312
313
    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
314

315
    AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this);
con's avatar
con committed
316
317
    addAutoReleasedObject(allProjectsFilter);

318
    CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this);
con's avatar
con committed
319
320
321
322
323
    addAutoReleasedObject(currentProjectFilter);

    addAutoReleasedObject(new BuildSettingsPanelFactory);
    addAutoReleasedObject(new RunSettingsPanelFactory);
    addAutoReleasedObject(new EditorSettingsPanelFactory);
324
    addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
con's avatar
con committed
325
326
327
328

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

329
    AllProjectsFind *allProjectsFind = new AllProjectsFind(this,
330
        Find::SearchResultWindow::instance());
con's avatar
con committed
331
332
    addAutoReleasedObject(allProjectsFind);

333
    CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this,
334
        Find::SearchResultWindow::instance());
con's avatar
con committed
335
336
    addAutoReleasedObject(currentProjectFind);

337
    addAutoReleasedObject(new LocalApplicationRunControlFactory);
con's avatar
con committed
338
339
    addAutoReleasedObject(new CustomExecutableRunConfigurationFactory);

340
    addAutoReleasedObject(new ProjectFileWizardExtension);
con's avatar
con committed
341

342
343
344
    // Settings page
    addAutoReleasedObject(new ProjectExplorerSettingsPage);

con's avatar
con committed
345
    // context menus
346
    Core::ActionContainer *msessionContextMenu =
con's avatar
con committed
347
        am->createMenu(Constants::M_SESSIONCONTEXT);
dt's avatar
dt committed
348
    Core::ActionContainer *mprojectContextMenu =
con's avatar
con committed
349
        am->createMenu(Constants::M_PROJECTCONTEXT);
dt's avatar
dt committed
350
    Core::ActionContainer *msubProjectContextMenu =
con's avatar
con committed
351
        am->createMenu(Constants::M_SUBPROJECTCONTEXT);
dt's avatar
dt committed
352
    Core::ActionContainer *mfolderContextMenu =
con's avatar
con committed
353
        am->createMenu(Constants::M_FOLDERCONTEXT);
dt's avatar
dt committed
354
    Core::ActionContainer *mfileContextMenu =
con's avatar
con committed
355
356
        am->createMenu(Constants::M_FILECONTEXT);

357
    d->m_sessionContextMenu = msessionContextMenu->menu();
dt's avatar
dt committed
358
359
360
361
    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
362

363
    Core::ActionContainer *mfile =
con's avatar
con committed
364
        am->actionContainer(Core::Constants::M_FILE);
365
    Core::ActionContainer *menubar =
con's avatar
con committed
366
367
368
        am->actionContainer(Core::Constants::MENU_BAR);

    // mode manager (for fancy actions)
369
    Core::ModeManager *modeManager = core->modeManager();
con's avatar
con committed
370
371

    // build menu
372
    Core::ActionContainer *mbuild =
con's avatar
con committed
373
        am->createMenu(Constants::M_BUILDPROJECT);
374
    mbuild->menu()->setTitle(tr("&Build"));
con's avatar
con committed
375
376
377
    menubar->addMenu(mbuild, Core::Constants::G_VIEW);

    // debug menu
378
    Core::ActionContainer *mdebug =
con's avatar
con committed
379
        am->createMenu(Constants::M_DEBUG);
380
    mdebug->menu()->setTitle(tr("&Debug"));
con's avatar
con committed
381
382
    menubar->addMenu(mdebug, Core::Constants::G_VIEW);

383
384
385
386
    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
387
388
389
390
391
392
393
394
395

    //
    // 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
396
    mbuild->appendGroup(Constants::G_BUILD_RUN);
con's avatar
con committed
397
398
399
400
401
402

    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
403
404
405
406
407
408
    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
409

dt's avatar
dt committed
410
411
412
413
414
    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
415

dt's avatar
dt committed
416
417
418
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_FILES);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_OTHER);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_CONFIG);
con's avatar
con committed
419

dt's avatar
dt committed
420
421
422
    mfileContextMenu->appendGroup(Constants::G_FILE_OPEN);
    mfileContextMenu->appendGroup(Constants::G_FILE_OTHER);
    mfileContextMenu->appendGroup(Constants::G_FILE_CONFIG);
con's avatar
con committed
423
424

    // "open with" submenu
425
    Core::ActionContainer * const openWith =
con's avatar
con committed
426
            am->createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT);
427
    openWith->setEmptyAction(Core::ActionContainer::EA_None);
428
429
    d->m_openWithMenu = openWith->menu();
    d->m_openWithMenu->setTitle(tr("Open With"));
con's avatar
con committed
430

431
    connect(d->m_openWithMenu, SIGNAL(triggered(QAction *)),
con's avatar
con committed
432
433
434
435
436
437
            this, SLOT(openWithMenuTriggered(QAction *)));

    //
    // Separators
    //

con's avatar
con committed
438
    Core::Command *cmd;
con's avatar
con committed
439
440
441
442
    QAction *sep;

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
443
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Build.Sep"), globalcontext);
con's avatar
con committed
444
445
446
447
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
448
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext);
con's avatar
con committed
449
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
dt's avatar
dt committed
450
451
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
con's avatar
con committed
452
453
454

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
455
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext);
con's avatar
con committed
456
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_CONFIG);
dt's avatar
dt committed
457
458
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_CONFIG);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_CONFIG);
con's avatar
con committed
459
460
461

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
462
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext);
con's avatar
con committed
463
464
465
466
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
467
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext);
con's avatar
con committed
468
469
    mbuild->addAction(cmd, Constants::G_BUILD_OTHER);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER);
dt's avatar
dt committed
470
471
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_OTHER);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_OTHER);
con's avatar
con committed
472
473
474

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
475
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext);
con's avatar
con committed
476
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
dt's avatar
dt committed
477
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
con's avatar
con committed
478
479
480

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
481
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext);
con's avatar
con committed
482
483
484
485
486
487
488
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    //
    // Actions
    //

    // new session action
489
490
    d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
    cmd = am->registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
con's avatar
con committed
491
492
493
    cmd->setDefaultKeySequence(QKeySequence());

    // new action
494
495
    d->m_newAction = new QAction(tr("New Project..."), this);
    cmd = am->registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext);
con's avatar
con committed
496
497
498
499
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N")));
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // open action
500
501
    d->m_loadAction = new QAction(tr("Load Project..."), this);
    cmd = am->registerAction(d->m_loadAction, Constants::LOAD, globalcontext);
502
#ifndef Q_WS_MAC
con's avatar
con committed
503
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O")));
504
#endif
con's avatar
con committed
505
506
507
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // Default open action
508
509
    d->m_openFileAction = new QAction(tr("Open File"), this);
    cmd = am->registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
dt's avatar
dt committed
510
511
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
con's avatar
con committed
512

513
    d->m_showInGraphicalShell = new QAction(FolderNavigationWidget::msgGraphicalShellAction(), this);
514
    cmd = am->registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
dt's avatar
dt committed
515
516
517
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
518

519
    d->m_openTerminalHere = new QAction(FolderNavigationWidget::msgTerminalAction(), this);
520
    cmd = am->registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
dt's avatar
dt committed
521
522
523
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
524

con's avatar
con committed
525
    // Open With menu
dt's avatar
dt committed
526
    mfileContextMenu->addMenu(openWith, ProjectExplorer::Constants::G_FILE_OPEN);
con's avatar
con committed
527

mae's avatar
mae committed
528
    // recent projects menu
529
    Core::ActionContainer *mrecent =
mae's avatar
mae committed
530
        am->createMenu(Constants::M_RECENTPROJECTS);
531
    mrecent->menu()->setTitle(tr("Recent P&rojects"));
532
    mrecent->setEmptyAction(Core::ActionContainer::EA_None);
mae's avatar
mae committed
533
534
535
536
    mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN);
    connect(mfile->menu(), SIGNAL(aboutToShow()),
        this, SLOT(updateRecentProjectMenu()));

dt's avatar
dt committed
537
    // XXX same action?
con's avatar
con committed
538
    // unload action
539
540
    d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
                                                      Utils::ParameterAction::EnabledWithParameter, this);
541
    cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext);
con's avatar
con committed
542
    cmd->setAttribute(Core::Command::CA_UpdateText);
543
    cmd->setDefaultText(d->m_unloadAction->text());
con's avatar
con committed
544
545
546
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    // unload session action
547
548
    d->m_clearSession = new QAction(tr("Close All Projects"), this);
    cmd = am->registerAction(d->m_clearSession, Constants::CLEARSESSION, globalcontext);
con's avatar
con committed
549
550
551
552
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // session menu
553
    Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION);
554
    msession->menu()->setTitle(tr("Session"));
555
    msession->setEmptyAction(Core::ActionContainer::EA_None);
con's avatar
con committed
556
    mfile->addMenu(msession, Core::Constants::G_FILE_PROJECT);
557
    d->m_sessionMenu = msession->menu();
con's avatar
con committed
558
559
560
561
562
563
    connect(mfile->menu(), SIGNAL(aboutToShow()),
            this, SLOT(updateSessionMenu()));

    // build session action
    QIcon buildIcon(Constants::ICON_BUILD);
    buildIcon.addFile(Constants::ICON_BUILD_SMALL);
564
565
    d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
    cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
con's avatar
con committed
566
567
568
569
    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
570
    modeManager->addAction(cmd, Constants::P_ACTION_BUILDSESSION);
con's avatar
con committed
571
572
573
574

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

Tobias Hunger's avatar
Tobias Hunger committed
580
581
582
583
584
585
    // 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
586
587
588
    // clean session
    QIcon cleanIcon(Constants::ICON_CLEAN);
    cleanIcon.addFile(Constants::ICON_CLEAN_SMALL);
589
590
    d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this);
    cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext);
con's avatar
con committed
591
592
593
594
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

    // build action
595
    d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
596
                                                     Utils::ParameterAction::AlwaysEnabled, this);
597
    cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext);
598
    cmd->setAttribute(Core::Command::CA_UpdateText);
599
    cmd->setDefaultText(d->m_buildAction->text());
con's avatar
con committed
600
601
602
603
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B")));
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

    // rebuild action
604
    d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
605
                                                       Utils::ParameterAction::AlwaysEnabled, this);
606
    cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext);
607
    cmd->setAttribute(Core::Command::CA_UpdateText);
608
    cmd->setDefaultText(d->m_rebuildAction->text());
con's avatar
con committed
609
610
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

Tobias Hunger's avatar
Tobias Hunger committed
611
612
613
614
615
616
617
618
    // 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);

619
620
621
622
623
624
625
626
    // 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
627
    // clean action
628
    d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
629
                                                     Utils::ParameterAction::AlwaysEnabled, this);
630
    cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext);
631
    cmd->setAttribute(Core::Command::CA_UpdateText);
632
    cmd->setDefaultText(d->m_cleanAction->text());
con's avatar
con committed
633
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);
634
635
636
637

    // 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
638
    cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext);
639
640
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_buildActionContextMenu->text());
dt's avatar
dt committed
641
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
642
643
644
645

    // 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
646
    cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext);
647
648
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_rebuildActionContextMenu->text());
dt's avatar
dt committed
649
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
650

Tobias Hunger's avatar
Tobias Hunger committed
651
652
653
    // 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
654
    cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext);
Tobias Hunger's avatar
Tobias Hunger committed
655
656
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_deployActionContextMenu->text());
dt's avatar
dt committed
657
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
Tobias Hunger's avatar
Tobias Hunger committed
658

659
660
661
    // 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
662
    cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext);
663
664
    cmd->setAttribute(Core::Command::CA_UpdateText);
    cmd->setDefaultText(d->m_cleanActionContextMenu->text());
dt's avatar
dt committed
665
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
con's avatar
con committed
666

667
    // build without dependencies action
668
669
    d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this);
    cmd = am->registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext);
670

671
    // rebuild without dependencies action
672
673
    d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this);
    cmd = am->registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext);
674

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

679
    // clean without dependencies action
680
681
    d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this);
    cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext);
682

con's avatar
con committed
683
684
685
    // run action
    QIcon runIcon(Constants::ICON_RUN);
    runIcon.addFile(Constants::ICON_RUN_SMALL);
686
687
    d->m_runAction = new QAction(runIcon, tr("Run"), this);
    cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext);
688
689
    cmd->setAttribute(Core::Command::CA_UpdateText);

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

693
    modeManager->addAction(cmd, Constants::P_ACTION_RUN);
con's avatar
con committed
694

695
    d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
dt's avatar
dt committed
696
697
    cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
698

con's avatar
con committed
699
    // cancel build action
700
701
    d->m_cancelBuildAction = new QAction(tr("Cancel Build"), this);
    cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext);
con's avatar
con committed
702
703
704
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    // add new file action
705
706
    d->m_addNewFileAction = new QAction(tr("Add New..."), this);
    cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
dt's avatar
dt committed
707
708
709
710
                       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
711
712

    // add existing file action
713
714
    d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this);
    cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES,
dt's avatar
dt committed
715
716
717
718
                       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
719

720
721
722
    // 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
723
724
725
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
726
727

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

con's avatar
con committed
730
    // remove file action
731
732
    d->m_removeFileAction = new QAction(tr("Remove File..."), this);
    cmd = am->registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE,
dt's avatar
dt committed
733
734
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
con's avatar
con committed
735

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

dt's avatar
dt committed
742
    // delete file action
743
744
    d->m_deleteFileAction = new QAction(tr("Delete File..."), this);
    cmd = am->registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE,
dt's avatar
dt committed
745
746
                             projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
747

dt's avatar
dt committed
748
    // renamefile action
749
750
    d->m_renameFileAction = new QAction(tr("Rename"), this);
    cmd = am->registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE,
dt's avatar
dt committed
751
752
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
dt's avatar
dt committed
753
754
755
756
    // 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
757

758
759
760
    // 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
761
762
                             projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FIRST);
763

764
765
    // target selector
    d->m_projectSelectorAction = new QAction(this);
766
    d->m_projectSelectorAction->setCheckable(true);
767
768
769
    d->m_projectSelectorAction->setEnabled(false);
    QWidget *mainWindow = Core::ICore::instance()->mainWindow();
    d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow);
770
    connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show()));
771
    modeManager->addProjectSelector(d->m_projectSelectorAction);
772
773
774
775
776
777

    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
778
779
                       globalcontext);
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T")));
780
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
781
782
783
784
785
786
787
788
789
790

    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*)));

791
    connect(core, SIGNAL(saveSettingsRequested()),
con's avatar
con committed
792
793
        this, SLOT(savePersistentSettings()));

hjk's avatar
hjk committed
794
795
    addAutoReleasedObject(new ProjectTreeWidgetFactory);
    addAutoReleasedObject(new FolderNavigationWidgetFactory);
con's avatar
con committed
796

797
798
799
800
801
    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) {
802
                if (QFileInfo(fileNames.at(i)).isFile())
803
                    d->m_recentProjects.append(qMakePair(fileNames.at(i), displayNames.at(i)));
804
805
806
807
            }
        }
    }

808
    if (QSettings *s = core->settings()) {
Tobias Hunger's avatar
Tobias Hunger committed
809
810
        d->m_projectExplorerSettings.buildBeforeDeploy = s->value("ProjectExplorer/Settings/BuildBeforeDeploy", true).toBool();
        d->m_projectExplorerSettings.deployBeforeRun = s->value("ProjectExplorer/Settings/DeployBeforeRun", true).toBool();
811
812
        d->m_projectExplorerSettings.saveBeforeBuild = s->value("ProjectExplorer/Settings/SaveBeforeBuild", false).toBool();
        d->m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool();
813
        d->m_projectExplorerSettings.cleanOldAppOutput = s->value("ProjectExplorer/Settings/CleanOldAppOutput", false).toBool();
814
        d->m_projectExplorerSettings.wrapAppOutput = s->value("ProjectExplorer/Settings/WrapAppOutput", true).toBool();
815
        d->m_projectExplorerSettings.useJom = s->value("ProjectExplorer/Settings/UseJom", true).toBool();
816
        d->m_projectExplorerSettings.autorestoreLastSession = s->value("ProjectExplorer/Settings/AutoRestoreLastSession", false).toBool();
817
818
819
        d->m_projectExplorerSettings.environmentId = QUuid(s->value("ProjectExplorer/Settings/EnvironmentId").toString());
        if (d->m_projectExplorerSettings.environmentId.isNull())
            d->m_projectExplorerSettings.environmentId = QUuid::createUuid();
820
    }
821

822
823
824
825
826
    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()));
827
    connect(d->m_buildActionContextMenu, SIGNAL(triggered()), this, SLOT(buildProjectContextMenu()));
828
829
830
    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()));
831
    connect(d->m_rebuildActionContextMenu, SIGNAL(triggered()), this, SLOT(rebuildProjectContextMenu()));
832
    connect(d->m_rebuildSessionAction, SIGNAL(triggered()), this, SLOT(rebuildSession()));
Tobias Hunger's avatar
Tobias Hunger committed
833
834
835
836
    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()));
837
    connect(d->m_publishAction, SIGNAL(triggered()), this, SLOT(publishProject()));
838
839
    connect(d->m_cleanProjectOnlyAction, SIGNAL(triggered()), this, SLOT(cleanProjectOnly()));
    connect(d->m_cleanAction, SIGNAL(triggered()), this, SLOT(cleanProject()));
840
    connect(d->m_cleanActionContextMenu, SIGNAL(triggered()), this, SLOT(cleanProjectContextMenu()));
841
842
843
844
845
846
847
848
    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()));
849
    connect(d->m_addNewSubprojectAction, SIGNAL(triggered()), this, SLOT(addNewSubproject()));
850
    connect(d->m_removeProjectAction, SIGNAL(triggered()), this, SLOT(removeProject()));
851
852
    connect(d->m_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(d->m_showInGraphicalShell, SIGNAL(triggered()), this, SLOT(showInGraphicalShell()));
853
    connect(d->m_openTerminalHere, SIGNAL(triggered()), this, SLOT(openTerminalHere()));
854
    connect(d->m_removeFileAction, SIGNAL(triggered()), this, SLOT(removeFile()));
855
    connect(d->m_deleteFileAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
856
    connect(d->m_renameFileAction, SIGNAL(triggered()), this, SLOT(renameFile()));
857
    connect(d->m_setStartupProjectAction, SIGNAL(triggered()), this, SLOT(setStartupProject()));
con's avatar
con committed
858

859
860
    connect(this, SIGNAL(updateRunActions()), this, SLOT(slotUpdateRunActions()));

con's avatar
con committed
861
862
    updateActions();

863
864
    connect(Core::ICore::instance(), SIGNAL(coreAboutToOpen()),
            this, SLOT(determineSessionToRestoreAtStartup()));
865
    connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
con's avatar
con committed
866