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
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
ICore *m_coreImpl;
|
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;
|
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;
|
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;
|
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;
|
2014-11-16 10:52:41 +02:00
|
|
|
StatusBarWidget *m_outputView;
|
2008-12-03 17:38:53 +01:00
|
|
|
VersionDialog *m_versionDialog;
|
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;
|
2015-08-14 13:25:31 +02:00
|
|
|
SystemSettings *m_systemSettings;
|
2008-12-02 12:01:29 +01:00
|
|
|
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;
|
Implement theming for QtCreator
Adds a 'Theme' tab to the environment settings and a '-theme' command
line option.
A theme is a combination of colors, gradients, flags and style
information.
There are two themes:
- 'default': preserves the current default look
- 'dark': uses a more flat for many widgets, dark color theme
for everything
This does not use a stylesheet (too limited), but rather sets
the palette via C++ and modifies drawing behavior.
Overall, the look is more flat (removed some gradients and bevels).
Tested on Ubuntu 14.04 using Qt 5.4 and running on a KDE
Desktop (Oxygen base style).
For a screenshot, see
https://gist.github.com/thorbenk/5ab06bea726de0aa7473
Changes:
- Introduce class Theme, defining the interface how to access theme
specific settings. The class reads a .creatortheme file (INI file, via
QSettings)
- Define named colors in the [Palette] section
(see dark.creatortheme for example usage)
- Use either named colors of AARRGGBB (hex) in the [Colors]
section
- A file ending with .creatortheme may be supplied
to the '-theme' command line option
- A global Theme instance can be accessed via creatorTheme()
- Query colors, gradients, icons and flags from the theme
were possible (TODO: use this in more places...)
- There are very many color roles. It seems better to me
to describe the role clearly, and then to consolidate later
in the actual theme by assigning the same color.
For example, one can set the text color of the output pane button
individualy.
- Many elements are also drawn differently.
For the dark theme, I wanted to have a flatter look.
- Introduce Theme::WidgetStyle enum, for now {Original, Flat}.
- The theme specifies which kind of widget style it wants.
- The drawing code queries the theme's style flag and
switches between the original, gradient based look and
the new, flat look.
- Create some custom icons which look better on dark background
(wip, currently folder/file icons)
- Let ManhattanStyle draw some elements for non-panelwidgets, too
(open/close arrows in QTreeView, custom folder/file icons)
- For the welcomescreen, pass the WelcomeTheme class.
WelcomeTheme exposes theme colors as Q_PROPERTY accessible from
.qml
- Themes can be modified via the 'Themes' tab in the environment
settings.
TODO:
* Unify image handling
* Avoid style name references
* Fix gradients
Change-Id: I92c2050ab0fb327649ea1eff4adec973d2073944
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-10-14 19:09:48 +02:00
|
|
|
QAction *m_themeAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QToolButton *m_toggleSideBarButton;
|
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
|