forked from qt-creator/qt-creator
Core: Merge mainwindow and icore file pairs
So far the main window acted a bit like ICore's pimpl. Aim at making that a bit more similar to other places. The files are kept for now to not have to adjust #includes all over the place and there's some hope to move code back there. Change-Id: I150e2dd0971bfab44cba89e0c51bb3f37062b8d3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
#include "core_global.h"
|
||||
#include "icontext.h"
|
||||
|
||||
#include <utils/appmainwindow.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/qtcsettings.h>
|
||||
|
||||
@@ -17,6 +18,7 @@
|
||||
#include <functional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QColor;
|
||||
class QMainWindow;
|
||||
class QPrinter;
|
||||
class QStatusBar;
|
||||
@@ -26,25 +28,25 @@ QT_END_NAMESPACE
|
||||
namespace Utils { class InfoBar; }
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Context;
|
||||
class IDocument;
|
||||
class IWizardFactory;
|
||||
class NewDialog;
|
||||
|
||||
namespace Internal {
|
||||
class MainWindow;
|
||||
class MainWindowPrivate;
|
||||
} // Internal
|
||||
|
||||
class NewDialog;
|
||||
|
||||
class CORE_EXPORT ICore : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class Internal::MainWindow;
|
||||
friend class Internal::MainWindowPrivate;
|
||||
friend class IWizardFactory;
|
||||
|
||||
explicit ICore(Internal::MainWindow *mw);
|
||||
ICore();
|
||||
~ICore() override;
|
||||
|
||||
public:
|
||||
@@ -154,9 +156,63 @@ public:
|
||||
|
||||
static void saveSettings(SaveSettingsReason reason);
|
||||
static void setNewDialogFactory(const std::function<NewDialog *(QWidget *)> &newFactory);
|
||||
|
||||
private:
|
||||
static void updateNewItemDialogState();
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class MainWindow : public Utils::AppMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow() override;
|
||||
|
||||
void init();
|
||||
void extensionsInitialized();
|
||||
void aboutToShutdown();
|
||||
|
||||
IContext *contextObject(QWidget *widget) const;
|
||||
void addContextObject(IContext *context);
|
||||
void removeContextObject(IContext *context);
|
||||
|
||||
static IDocument *openFiles(const Utils::FilePaths &filePaths,
|
||||
ICore::OpenFilesFlags flags,
|
||||
const Utils::FilePath &workingDirectory = {});
|
||||
|
||||
QPrinter *printer() const;
|
||||
IContext *currentContextObject() const;
|
||||
QStatusBar *statusBar() const;
|
||||
Utils::InfoBar *infoBar() const;
|
||||
|
||||
void updateAdditionalContexts(const Context &remove, const Context &add,
|
||||
ICore::ContextPriority priority);
|
||||
|
||||
void setOverrideColor(const QColor &color);
|
||||
|
||||
QStringList additionalAboutInformation() const;
|
||||
void clearAboutInformation();
|
||||
void appendAboutInformation(const QString &line);
|
||||
|
||||
void addPreCloseListener(const std::function<bool()> &listener);
|
||||
|
||||
void saveSettings();
|
||||
|
||||
void restart();
|
||||
|
||||
void restartTrimmer();
|
||||
|
||||
public slots:
|
||||
static void openFileWith();
|
||||
void exit();
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace Core
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,81 +3,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icontext.h"
|
||||
#include "icore.h"
|
||||
|
||||
#include <utils/appmainwindow.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QColor;
|
||||
class QPrinter;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class InfoBar; }
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IDocument;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class MainWindowPrivate;
|
||||
|
||||
class MainWindow : public Utils::AppMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow() override;
|
||||
|
||||
void init();
|
||||
void extensionsInitialized();
|
||||
void aboutToShutdown();
|
||||
|
||||
IContext *contextObject(QWidget *widget) const;
|
||||
void addContextObject(IContext *context);
|
||||
void removeContextObject(IContext *context);
|
||||
|
||||
static IDocument *openFiles(const Utils::FilePaths &filePaths,
|
||||
ICore::OpenFilesFlags flags,
|
||||
const Utils::FilePath &workingDirectory = {});
|
||||
|
||||
QPrinter *printer() const;
|
||||
IContext *currentContextObject() const;
|
||||
QStatusBar *statusBar() const;
|
||||
Utils::InfoBar *infoBar() const;
|
||||
|
||||
void updateAdditionalContexts(const Context &remove, const Context &add,
|
||||
ICore::ContextPriority priority);
|
||||
|
||||
void setOverrideColor(const QColor &color);
|
||||
|
||||
QStringList additionalAboutInformation() const;
|
||||
void clearAboutInformation();
|
||||
void appendAboutInformation(const QString &line);
|
||||
|
||||
void addPreCloseListener(const std::function<bool()> &listener);
|
||||
|
||||
void saveSettings();
|
||||
|
||||
void restart();
|
||||
|
||||
void restartTrimmer();
|
||||
|
||||
public slots:
|
||||
static void openFileWith();
|
||||
void exit();
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
MainWindowPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
Reference in New Issue
Block a user