2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-25 12:56:16 +02:00
|
|
|
#include "icontext.h"
|
2010-09-23 12:32:22 +02:00
|
|
|
#include "icore.h"
|
2009-07-31 16:49:26 +02:00
|
|
|
|
2012-03-13 16:20:06 +01:00
|
|
|
#include <utils/appmainwindow.h>
|
2015-06-04 12:35:59 +02:00
|
|
|
#include <utils/dropsupport.h>
|
2012-03-13 16:20:06 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMap>
|
|
|
|
|
#include <QColor>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-08-26 14:39:15 +02:00
|
|
|
#include <functional>
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSettings;
|
2009-10-01 16:38:08 +02:00
|
|
|
class QPrinter;
|
|
|
|
|
class QToolButton;
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
2009-12-08 19:14:39 +01:00
|
|
|
class StatusBarWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
class EditorManager;
|
2011-01-21 10:58:06 +01:00
|
|
|
class ExternalToolManager;
|
2012-02-14 16:43:51 +01:00
|
|
|
class DocumentManager;
|
2010-06-11 13:11:37 +02:00
|
|
|
class HelpManager;
|
2013-03-11 18:15:49 +02:00
|
|
|
class IDocument;
|
2014-05-02 17:38:42 +02:00
|
|
|
class IWizardFactory;
|
2014-09-12 14:25:51 +02:00
|
|
|
class JsExpander;
|
2008-12-02 12:01:29 +01:00
|
|
|
class MessageManager;
|
2008-12-02 14:09:21 +01:00
|
|
|
class ModeManager;
|
2009-01-13 14:16:36 +01:00
|
|
|
class ProgressManager;
|
2010-08-13 10:10:43 +02:00
|
|
|
class NavigationWidget;
|
2008-12-02 14:09:21 +01:00
|
|
|
class RightPaneWidget;
|
2009-05-19 19:20:53 +02:00
|
|
|
class SettingsDatabase;
|
2010-12-07 17:34:43 +01:00
|
|
|
class VcsManager;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class FancyTabWidget;
|
2008-12-02 14:09:21 +01:00
|
|
|
class GeneralSettings;
|
2009-01-13 13:54:45 +01:00
|
|
|
class ProgressManagerPrivate;
|
2008-12-02 14:09:21 +01:00
|
|
|
class ShortcutSettings;
|
2011-01-06 18:26:09 +01:00
|
|
|
class ToolSettings;
|
2011-02-22 15:11:50 +01:00
|
|
|
class MimeTypeSettings;
|
2009-12-09 11:05:18 +01:00
|
|
|
class StatusBarManager;
|
2008-12-03 17:38:53 +01:00
|
|
|
class VersionDialog;
|
2014-07-17 17:04:02 +02:00
|
|
|
class WindowSupport;
|
2010-02-22 14:28:37 +01:00
|
|
|
class SystemEditor;
|
2015-08-14 13:25:31 +02:00
|
|
|
class SystemSettings;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-03-13 16:20:06 +01:00
|
|
|
class MainWindow : public Utils::AppMainWindow
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MainWindow();
|
|
|
|
|
~MainWindow();
|
|
|
|
|
|
2009-01-26 14:25:03 +01:00
|
|
|
bool init(QString *errorMessage);
|
2008-12-02 12:01:29 +01:00
|
|
|
void extensionsInitialized();
|
2010-04-28 16:59:03 +02:00
|
|
|
void aboutToShutdown();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
IContext *contextObject(QWidget *widget);
|
2014-11-16 10:52:41 +02:00
|
|
|
void addContextObject(IContext *context);
|
|
|
|
|
void removeContextObject(IContext *context);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-03-09 10:59:58 +02:00
|
|
|
IDocument *openFiles(const QStringList &fileNames,
|
|
|
|
|
ICore::OpenFilesFlags flags,
|
|
|
|
|
const QString &workingDirectory = QString());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-05-19 19:20:53 +02:00
|
|
|
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual QPrinter *printer() const;
|
|
|
|
|
IContext * currentContextObject() const;
|
|
|
|
|
QStatusBar *statusBar() const;
|
|
|
|
|
|
2015-08-07 17:21:38 +02:00
|
|
|
void updateAdditionalContexts(const Context &remove, const Context &add,
|
|
|
|
|
ICore::ContextPriority priority);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void setSuppressNavigationWidget(bool suppress);
|
|
|
|
|
|
2009-11-25 18:44:54 +01:00
|
|
|
void setOverrideColor(const QColor &color);
|
|
|
|
|
|
2015-10-02 15:15:38 +02:00
|
|
|
QStringList additionalAboutInformation() const;
|
|
|
|
|
void appendAboutInformation(const QString &line);
|
|
|
|
|
|
2015-08-26 14:39:15 +02:00
|
|
|
void addPreCloseListener(const std::function<bool()> &listener);
|
|
|
|
|
|
2016-09-06 09:06:56 +02:00
|
|
|
void saveSettings();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public slots:
|
|
|
|
|
void openFileWith();
|
|
|
|
|
void exit();
|
|
|
|
|
|
2015-02-23 11:07:38 +01:00
|
|
|
bool showOptionsDialog(Id page = Id(), QWidget *parent = 0);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-08 17:23:27 +02:00
|
|
|
bool showWarningWithOptions(const QString &title, const QString &text,
|
|
|
|
|
const QString &details = QString(),
|
2012-12-29 01:31:08 +01:00
|
|
|
Id settingsId = Id(),
|
2009-10-08 17:23:27 +02:00
|
|
|
QWidget *parent = 0);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2009-02-10 10:56:22 +01:00
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-02-02 09:10:54 +02:00
|
|
|
private:
|
2008-12-02 12:01:29 +01:00
|
|
|
void openFile();
|
|
|
|
|
void aboutToShowRecentFiles();
|
|
|
|
|
void setFocusToEditor();
|
|
|
|
|
void saveAll();
|
|
|
|
|
void aboutQtCreator();
|
|
|
|
|
void aboutPlugins();
|
|
|
|
|
void updateFocusWidget(QWidget *old, QWidget *now);
|
2009-01-20 15:38:51 +01:00
|
|
|
void setSidebarVisible(bool visible);
|
2008-12-03 17:38:53 +01:00
|
|
|
void destroyVersionDialog();
|
2015-06-04 12:35:59 +02:00
|
|
|
void openDroppedFiles(const QList<Utils::DropSupport::FileSpec> &files);
|
2014-01-12 09:08:18 +02:00
|
|
|
void restoreWindowState();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-05-07 19:03:22 +02:00
|
|
|
void updateContextObject(const QList<IContext *> &context);
|
2010-03-22 18:05:22 +01:00
|
|
|
void updateContext();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void registerDefaultContainers();
|
|
|
|
|
void registerDefaultActions();
|
|
|
|
|
|
|
|
|
|
void readSettings();
|
2016-09-06 09:06:56 +02:00
|
|
|
void saveWindowSettings();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-01-24 14:25:11 +01:00
|
|
|
ICore *m_coreImpl = nullptr;
|
2015-10-02 15:15:38 +02:00
|
|
|
QStringList m_aboutInformation;
|
2015-08-07 17:21:38 +02:00
|
|
|
Context m_highPrioAdditionalContexts;
|
|
|
|
|
Context m_lowPrioAdditionalContexts;
|
2017-01-24 14:25:11 +01:00
|
|
|
SettingsDatabase *m_settingsDatabase = nullptr;
|
|
|
|
|
mutable QPrinter *m_printer = nullptr;
|
|
|
|
|
WindowSupport *m_windowSupport = nullptr;
|
|
|
|
|
EditorManager *m_editorManager = nullptr;
|
|
|
|
|
ExternalToolManager *m_externalToolManager = nullptr;
|
|
|
|
|
MessageManager *m_messageManager = nullptr;
|
|
|
|
|
ProgressManagerPrivate *m_progressManager = nullptr;
|
|
|
|
|
JsExpander *m_jsExpander = nullptr;
|
|
|
|
|
VcsManager *m_vcsManager = nullptr;
|
|
|
|
|
StatusBarManager *m_statusBarManager = nullptr;
|
|
|
|
|
ModeManager *m_modeManager = nullptr;
|
|
|
|
|
HelpManager *m_helpManager = nullptr;
|
|
|
|
|
FancyTabWidget *m_modeStack = nullptr;
|
|
|
|
|
NavigationWidget *m_navigationWidget = nullptr;
|
|
|
|
|
RightPaneWidget *m_rightPaneWidget = nullptr;
|
|
|
|
|
StatusBarWidget *m_outputView = nullptr;
|
|
|
|
|
VersionDialog *m_versionDialog = nullptr;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-05-07 19:03:22 +02:00
|
|
|
QList<IContext *> m_activeContext;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QMap<QWidget *, IContext *> m_contextWidgets;
|
|
|
|
|
|
2017-01-24 14:25:11 +01:00
|
|
|
GeneralSettings *m_generalSettings = nullptr;
|
|
|
|
|
SystemSettings *m_systemSettings = nullptr;
|
|
|
|
|
ShortcutSettings *m_shortcutSettings = nullptr;
|
|
|
|
|
ToolSettings *m_toolSettings = nullptr;
|
|
|
|
|
MimeTypeSettings *m_mimeTypeSettings = nullptr;
|
|
|
|
|
SystemEditor *m_systemEditor = nullptr;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// actions
|
2017-01-24 14:25:11 +01:00
|
|
|
QAction *m_focusToEditor = nullptr;
|
|
|
|
|
QAction *m_newAction = nullptr;
|
|
|
|
|
QAction *m_openAction = nullptr;
|
|
|
|
|
QAction *m_openWithAction = nullptr;
|
|
|
|
|
QAction *m_saveAllAction = nullptr;
|
|
|
|
|
QAction *m_exitAction = nullptr;
|
|
|
|
|
QAction *m_optionsAction = nullptr;
|
|
|
|
|
QAction *m_toggleSideBarAction = nullptr;
|
|
|
|
|
QAction *m_toggleModeSelectorAction = nullptr;
|
|
|
|
|
QAction *m_themeAction = nullptr;
|
|
|
|
|
|
|
|
|
|
QToolButton *m_toggleSideBarButton = nullptr;
|
2009-11-25 18:44:54 +01:00
|
|
|
QColor m_overrideColor;
|
2015-08-26 14:39:15 +02:00
|
|
|
QList<std::function<bool()>> m_preCloseListeners;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Core
|