2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** 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
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company 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 12:01:29 +01:00
|
|
|
|
|
|
|
|
#ifndef ICORE_H
|
|
|
|
|
#define ICORE_H
|
|
|
|
|
|
|
|
|
|
#include "core_global.h"
|
2012-12-29 00:15:49 +01:00
|
|
|
#include "id.h"
|
2010-01-14 14:14:39 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QSettings>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QPrinter;
|
2010-01-21 21:12:40 +01:00
|
|
|
class QStatusBar;
|
2012-07-19 15:31:22 +04:00
|
|
|
class QWidget;
|
2009-01-19 12:39:20 +01:00
|
|
|
template <class T> class QList;
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
2014-05-02 17:38:42 +02:00
|
|
|
class IWizardFactory;
|
2010-06-25 12:56:16 +02:00
|
|
|
class Context;
|
2009-01-19 12:39:20 +01:00
|
|
|
class IContext;
|
2009-01-13 14:16:36 +01:00
|
|
|
class ProgressManager;
|
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
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
namespace Internal { class MainWindow; }
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
class CORE_EXPORT ICore : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
friend class Internal::MainWindow;
|
2015-05-29 15:55:49 +02:00
|
|
|
friend class IWizardFactory;
|
|
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
explicit ICore(Internal::MainWindow *mw);
|
|
|
|
|
~ICore();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
public:
|
2012-01-24 15:36:40 +01:00
|
|
|
// This should only be used to acccess the signals, so it could
|
|
|
|
|
// theoretically return an QObject *. For source compatibility
|
|
|
|
|
// it returns a ICore.
|
2009-01-20 11:52:04 +01:00
|
|
|
static ICore *instance();
|
|
|
|
|
|
2014-06-27 15:15:09 +02:00
|
|
|
static bool isNewItemDialogRunning();
|
2012-01-18 23:25:34 +01:00
|
|
|
static 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
|
|
|
|
2015-02-23 11:07:38 +01:00
|
|
|
static bool showOptionsDialog(Id page, QWidget *parent = 0);
|
2014-02-20 14:52:10 +01:00
|
|
|
static QString msgShowOptionsDialog();
|
2014-06-23 10:39:01 +02:00
|
|
|
static QString msgShowOptionsDialogToolTip();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-01-18 23:25:34 +01:00
|
|
|
static bool showWarningWithOptions(const QString &title, const QString &text,
|
2009-10-08 17:23:27 +02:00
|
|
|
const QString &details = QString(),
|
2012-12-29 01:31:08 +01:00
|
|
|
Id settingsId = Id(),
|
2012-01-18 23:25:34 +01:00
|
|
|
QWidget *parent = 0);
|
|
|
|
|
|
|
|
|
|
static QSettings *settings(QSettings::Scope scope = QSettings::UserScope);
|
|
|
|
|
static SettingsDatabase *settingsDatabase();
|
|
|
|
|
static QPrinter *printer();
|
|
|
|
|
static QString userInterfaceLanguage();
|
|
|
|
|
|
|
|
|
|
static QString resourcePath();
|
|
|
|
|
static QString userResourcePath();
|
2013-06-13 15:50:19 +02:00
|
|
|
static QString documentationPath();
|
2013-10-02 16:09:23 +02:00
|
|
|
static QString libexecPath();
|
2012-01-18 23:25:34 +01:00
|
|
|
|
2013-05-24 16:45:49 +02:00
|
|
|
static QString versionString();
|
|
|
|
|
static QString buildCompatibilityString();
|
|
|
|
|
|
2012-07-19 15:31:22 +04:00
|
|
|
static QWidget *mainWindow();
|
2014-01-06 10:36:40 +01:00
|
|
|
static QWidget *dialogParent();
|
2012-01-18 23:25:34 +01:00
|
|
|
static QStatusBar *statusBar();
|
2013-04-15 12:53:34 +02:00
|
|
|
/* Raises and activates the window for the widget. This contains workarounds for X11. */
|
|
|
|
|
static void raiseWindow(QWidget *widget);
|
2012-01-18 23:25:34 +01:00
|
|
|
|
|
|
|
|
static IContext *currentContextObject();
|
2010-03-22 18:05:22 +01:00
|
|
|
// Adds and removes additional active contexts, these contexts are appended
|
|
|
|
|
// to the currently active contexts.
|
2012-01-18 23:25:34 +01:00
|
|
|
static void updateAdditionalContexts(const Context &remove, const Context &add);
|
2014-11-16 11:47:18 +02:00
|
|
|
static void addAdditionalContext(const Context &context);
|
|
|
|
|
static void removeAdditionalContext(const Context &context);
|
2012-01-18 23:25:34 +01:00
|
|
|
static void addContextObject(IContext *context);
|
|
|
|
|
static void removeContextObject(IContext *context);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2014-07-17 17:04:02 +02:00
|
|
|
// manages the minimize, zoom and fullscreen actions for the window
|
|
|
|
|
static void registerWindow(QWidget *window, const Context &context);
|
|
|
|
|
|
2010-10-19 13:07:19 +02:00
|
|
|
enum OpenFilesFlags {
|
|
|
|
|
None = 0,
|
|
|
|
|
SwitchMode = 1,
|
2015-03-05 17:43:11 -07:00
|
|
|
CanContainLineAndColumnNumbers = 2,
|
2010-10-19 13:07:19 +02:00
|
|
|
/// Stop loading once the first file fails to load
|
|
|
|
|
StopOnLoadFail = 4
|
|
|
|
|
};
|
2012-01-18 23:25:34 +01:00
|
|
|
static void openFiles(const QStringList &fileNames, OpenFilesFlags flags = None);
|
|
|
|
|
|
2014-03-07 14:14:57 +01:00
|
|
|
public slots:
|
2012-08-17 09:09:15 +02:00
|
|
|
static void saveSettings();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
2009-06-12 18:06:34 +02:00
|
|
|
void coreAboutToOpen();
|
2008-12-02 12:01:29 +01:00
|
|
|
void coreOpened();
|
2014-06-27 15:15:09 +02:00
|
|
|
void newItemDialogRunningChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
void saveSettingsRequested();
|
2009-01-12 14:41:24 +01:00
|
|
|
void optionsDialogRequested();
|
2008-12-02 12:01:29 +01:00
|
|
|
void coreAboutToClose();
|
2013-05-07 19:03:22 +02:00
|
|
|
void contextAboutToChange(const QList<Core::IContext *> &context);
|
2015-09-22 09:17:59 +02:00
|
|
|
void contextChanged(const Core::Context &context);
|
2014-11-14 09:53:44 +02:00
|
|
|
void themeChanged();
|
2015-05-29 13:24:02 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-09-23 14:06:29 +02:00
|
|
|
static void validateNewItemDialogIsRunning();
|
2015-05-29 13:24:02 +02:00
|
|
|
static void newItemDialogOpened();
|
|
|
|
|
static void newItemDialogClosed();
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
|
|
2008-12-02 14:09:21 +01:00
|
|
|
#endif // ICORE_H
|