2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
2010-06-25 12:56:16 +02:00
|
|
|
#include "icontext.h"
|
2010-09-23 12:32:22 +02:00
|
|
|
#include "icore.h"
|
2014-06-27 15:15:09 +02:00
|
|
|
#include "dialogs/newdialog.h"
|
2009-07-31 16:49:26 +02:00
|
|
|
|
2012-03-13 16:20:06 +01:00
|
|
|
#include <utils/appmainwindow.h>
|
2014-09-12 12:52:34 +02:00
|
|
|
#include <utils/fileutils.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
|
|
|
|
|
|
|
|
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-01-13 13:39:31 +01:00
|
|
|
class ActionManager;
|
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;
|
|
|
|
|
class MimeDatabase;
|
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 {
|
|
|
|
|
|
2009-01-13 13:07:29 +01:00
|
|
|
class ActionManagerPrivate;
|
2008-12-02 12:01:29 +01:00
|
|
|
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;
|
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);
|
|
|
|
|
void addContextObject(IContext *contex);
|
|
|
|
|
void removeContextObject(IContext *contex);
|
|
|
|
|
|
2013-03-11 18:15:49 +02:00
|
|
|
Core::IDocument *openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags);
|
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;
|
|
|
|
|
|
2010-06-25 12:56:16 +02:00
|
|
|
void updateAdditionalContexts(const Context &remove, const Context &add);
|
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);
|
|
|
|
|
|
2014-06-27 15:15:09 +02:00
|
|
|
bool isNewItemDialogRunning() const;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void windowActivated();
|
2014-06-27 15:15:09 +02:00
|
|
|
void newItemDialogRunningChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void newFile();
|
|
|
|
|
void openFileWith();
|
|
|
|
|
void exit();
|
|
|
|
|
|
2010-09-16 16:30:05 +02:00
|
|
|
void showNewItemDialog(const QString &title,
|
2014-05-02 17:38:42 +02:00
|
|
|
const QList<IWizardFactory *> &factories,
|
2012-04-02 14:55:56 +02:00
|
|
|
const QString &defaultLocation = QString(),
|
|
|
|
|
const QVariantMap &extraVariables = QVariantMap());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-12-29 19:16:14 +01:00
|
|
|
bool showOptionsDialog(Id category = Id(), 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 00:15:49 +01:00
|
|
|
Id settingsCategory = Id(),
|
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 changeEvent(QEvent *e);
|
|
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void openFile();
|
|
|
|
|
void aboutToShowRecentFiles();
|
|
|
|
|
void openRecentFile();
|
|
|
|
|
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();
|
2014-09-12 12:52:34 +02:00
|
|
|
void openDroppedFiles(const QList<Utils::FileDropSupport::FileSpec> &files);
|
2014-01-12 09:08:18 +02:00
|
|
|
void restoreWindowState();
|
2014-06-27 15:15:09 +02:00
|
|
|
void newItemDialogFinished();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
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();
|
|
|
|
|
void writeSettings();
|
|
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
ICore *m_coreImpl;
|
2010-06-25 12:56:16 +02:00
|
|
|
Context m_additionalContexts;
|
2009-05-19 19:20:53 +02:00
|
|
|
SettingsDatabase *m_settingsDatabase;
|
2008-12-02 12:01:29 +01:00
|
|
|
mutable QPrinter *m_printer;
|
2014-07-17 17:04:02 +02:00
|
|
|
WindowSupport *m_windowSupport;
|
2012-05-24 13:49:06 +02:00
|
|
|
ActionManager *m_actionManager;
|
2008-12-02 12:01:29 +01:00
|
|
|
EditorManager *m_editorManager;
|
2011-01-21 10:58:06 +01:00
|
|
|
ExternalToolManager *m_externalToolManager;
|
2008-12-02 12:01:29 +01:00
|
|
|
MessageManager *m_messageManager;
|
2009-01-13 13:54:45 +01:00
|
|
|
ProgressManagerPrivate *m_progressManager;
|
2014-09-12 14:25:51 +02:00
|
|
|
JsExpander *m_jsExpander;
|
2010-12-07 17:34:43 +01:00
|
|
|
VcsManager *m_vcsManager;
|
2009-12-09 11:05:18 +01:00
|
|
|
StatusBarManager *m_statusBarManager;
|
2008-12-02 12:01:29 +01:00
|
|
|
ModeManager *m_modeManager;
|
|
|
|
|
MimeDatabase *m_mimeDatabase;
|
2010-06-11 13:11:37 +02:00
|
|
|
HelpManager *m_helpManager;
|
2008-12-02 12:01:29 +01:00
|
|
|
FancyTabWidget *m_modeStack;
|
|
|
|
|
NavigationWidget *m_navigationWidget;
|
|
|
|
|
RightPaneWidget *m_rightPaneWidget;
|
2009-12-08 19:14:39 +01:00
|
|
|
Core::StatusBarWidget *m_outputView;
|
2008-12-03 17:38:53 +01:00
|
|
|
VersionDialog *m_versionDialog;
|
2014-06-27 15:15:09 +02:00
|
|
|
QPointer<NewDialog> m_newDialog;
|
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;
|
|
|
|
|
|
|
|
|
|
GeneralSettings *m_generalSettings;
|
|
|
|
|
ShortcutSettings *m_shortcutSettings;
|
2011-01-06 18:26:09 +01:00
|
|
|
ToolSettings *m_toolSettings;
|
2011-02-22 15:11:50 +01:00
|
|
|
MimeTypeSettings *m_mimeTypeSettings;
|
2010-02-22 14:28:37 +01:00
|
|
|
SystemEditor *m_systemEditor;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// actions
|
2014-02-28 17:33:48 +01:00
|
|
|
QAction *m_focusToEditor;
|
2008-12-02 12:01:29 +01:00
|
|
|
QAction *m_newAction;
|
|
|
|
|
QAction *m_openAction;
|
|
|
|
|
QAction *m_openWithAction;
|
|
|
|
|
QAction *m_saveAllAction;
|
|
|
|
|
QAction *m_exitAction;
|
|
|
|
|
QAction *m_optionsAction;
|
|
|
|
|
QAction *m_toggleSideBarAction;
|
2013-04-11 12:22:10 +02:00
|
|
|
QAction *m_toggleModeSelectorAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QToolButton *m_toggleSideBarButton;
|
2009-11-25 18:44:54 +01:00
|
|
|
QColor m_overrideColor;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Core
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|