forked from qt-creator/qt-creator
Move EventFilteringMainWindow to utils
Also rename it to AppMainWindow. We add some more functionality to it in following patches. Change-Id: I752ccd07759eaaf6a2e96ec758e35b595bf788a2 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "eventfilteringmainwindow.h"
|
||||
#include "appmainwindow.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
@@ -40,8 +40,7 @@
|
||||
#include <QEvent>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
namespace Utils {
|
||||
|
||||
/* The notification signal is delayed by using a custom event
|
||||
* as otherwise device removal is not detected properly
|
||||
@@ -52,13 +51,13 @@ public:
|
||||
explicit DeviceNotifyEvent(int id) : QEvent(static_cast<QEvent::Type>(id)) {}
|
||||
};
|
||||
|
||||
EventFilteringMainWindow::EventFilteringMainWindow() :
|
||||
AppMainWindow::AppMainWindow() :
|
||||
m_deviceEventId(QEvent::registerEventType(QEvent::User + 2))
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool EventFilteringMainWindow::event(QEvent *event)
|
||||
bool AppMainWindow::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == m_deviceEventId) {
|
||||
event->accept();
|
||||
@@ -68,7 +67,7 @@ bool EventFilteringMainWindow::event(QEvent *event)
|
||||
return QMainWindow::event(event);
|
||||
}
|
||||
|
||||
bool EventFilteringMainWindow::winEvent(MSG *msg, long *result)
|
||||
bool AppMainWindow::winEvent(MSG *msg, long *result)
|
||||
{
|
||||
if (msg->message == WM_DEVICECHANGE) {
|
||||
if (msg->wParam & 0x7 /* DBT_DEVNODES_CHANGED */) {
|
||||
@@ -80,6 +79,5 @@ bool EventFilteringMainWindow::winEvent(MSG *msg, long *result)
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
} // namespace Utils
|
||||
|
@@ -30,28 +30,24 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef EVENTFILTERINGMAINWINDOW_H
|
||||
#define EVENTFILTERINGMAINWINDOW_H
|
||||
#ifndef APPMAINWINDOW_H
|
||||
#define APPMAINWINDOW_H
|
||||
|
||||
#include "utils_global.h"
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
namespace Utils {
|
||||
|
||||
/*!
|
||||
* This class only exists because we can't include windows.h in mainwindow.cpp
|
||||
* because windows defines an IContext...
|
||||
*/
|
||||
|
||||
class EventFilteringMainWindow : public QMainWindow
|
||||
class QTCREATOR_UTILS_EXPORT AppMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EventFilteringMainWindow();
|
||||
AppMainWindow();
|
||||
|
||||
signals:
|
||||
void deviceChange();
|
||||
@@ -66,7 +62,6 @@ private:
|
||||
const int m_deviceEventId;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // Core
|
||||
} // Utils
|
||||
|
||||
#endif // EVENTFILTERINGMAINWINDOW_H
|
||||
#endif // APPMAINWINDOW_H
|
@@ -96,7 +96,8 @@ SOURCES += $$PWD/environment.cpp \
|
||||
$$PWD/completingtextedit.cpp \
|
||||
$$PWD/json.cpp \
|
||||
$$PWD/portlist.cpp \
|
||||
$$PWD/tcpportsgatherer.cpp
|
||||
$$PWD/tcpportsgatherer.cpp \
|
||||
$$PWD/appmainwindow.cpp
|
||||
|
||||
win32 {
|
||||
SOURCES += \
|
||||
@@ -209,7 +210,8 @@ HEADERS += \
|
||||
$$PWD/multitask.h \
|
||||
$$PWD/runextensions.h \
|
||||
$$PWD/portlist.h \
|
||||
$$PWD/tcpportsgatherer.h
|
||||
$$PWD/tcpportsgatherer.h \
|
||||
$$PWD/appmainwindow.h
|
||||
|
||||
FORMS += $$PWD/filewizardpage.ui \
|
||||
$$PWD/projectintropage.ui \
|
||||
|
@@ -57,6 +57,8 @@ DynamicLibrary {
|
||||
"fancylineedit.h",
|
||||
"fancymainwindow.cpp",
|
||||
"fancymainwindow.h",
|
||||
"appmainwindow.h",
|
||||
"appmainwindow.cpp",
|
||||
"fileinprojectfinder.cpp",
|
||||
"fileinprojectfinder.h",
|
||||
"filenamevalidatinglineedit.h",
|
||||
|
@@ -75,7 +75,6 @@ SOURCES += mainwindow.cpp \
|
||||
dialogs/ioptionspage.cpp \
|
||||
dialogs/iwizard.cpp \
|
||||
settingsdatabase.cpp \
|
||||
eventfilteringmainwindow.cpp \
|
||||
imode.cpp \
|
||||
editormanager/systemeditor.cpp \
|
||||
designmode.cpp \
|
||||
@@ -170,7 +169,6 @@ HEADERS += mainwindow.h \
|
||||
fileiconprovider.h \
|
||||
mimedatabase.h \
|
||||
settingsdatabase.h \
|
||||
eventfilteringmainwindow.h \
|
||||
editormanager/systemeditor.h \
|
||||
designmode.h \
|
||||
editortoolbar.h \
|
||||
|
@@ -46,8 +46,6 @@ QtcPlugin {
|
||||
"editmode.h",
|
||||
"editortoolbar.cpp",
|
||||
"editortoolbar.h",
|
||||
"eventfilteringmainwindow.cpp",
|
||||
"eventfilteringmainwindow.h",
|
||||
"externaltool.cpp",
|
||||
"externaltool.h",
|
||||
"externaltoolmanager.h",
|
||||
|
@@ -126,7 +126,7 @@ using namespace Core::Internal;
|
||||
enum { debugMainWindow = 0 };
|
||||
|
||||
MainWindow::MainWindow() :
|
||||
EventFilteringMainWindow(),
|
||||
Utils::AppMainWindow(),
|
||||
m_coreImpl(new ICore(this)),
|
||||
m_additionalContexts(Constants::C_GLOBAL),
|
||||
m_settings(ExtensionSystem::PluginManager::instance()->settings()),
|
||||
|
@@ -33,10 +33,11 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "eventfilteringmainwindow.h"
|
||||
#include "icontext.h"
|
||||
#include "icore.h"
|
||||
|
||||
#include <utils/appmainwindow.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QColor>
|
||||
|
||||
@@ -80,7 +81,7 @@ class StatusBarManager;
|
||||
class VersionDialog;
|
||||
class SystemEditor;
|
||||
|
||||
class MainWindow : public EventFilteringMainWindow
|
||||
class MainWindow : public Utils::AppMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
Reference in New Issue
Block a user