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