Find out when devices get connected / disconnected.

And adapt the device selection list.
This commit is contained in:
con
2009-07-31 16:49:26 +02:00
parent 0870d28108
commit 036e220700
13 changed files with 233 additions and 29 deletions

View File

@@ -77,7 +77,8 @@ SOURCES += mainwindow.cpp \
editormanager/ieditor.cpp \
dialogs/ioptionspage.cpp \
dialogs/iwizard.cpp \
settingsdatabase.cpp
settingsdatabase.cpp \
eventfilteringmainwindow.cpp
HEADERS += mainwindow.h \
editmode.h \
tabpositionindicator.h \
@@ -154,21 +155,20 @@ HEADERS += mainwindow.h \
sidebar.h \
fileiconprovider.h \
mimedatabase.h \
settingsdatabase.h
settingsdatabase.h \
eventfilteringmainwindow.h
FORMS += dialogs/newdialog.ui \
dialogs/settingsdialog.ui \
dialogs/shortcutsettings.ui \
dialogs/saveitemsdialog.ui \
dialogs/openwithdialog.ui \
editormanager/openeditorsview.ui \
generalsettings.ui
generalsettings.ui
RESOURCES += core.qrc \
fancyactionbar.qrc
unix:!macx {
unix:!macx {
images.files = images/qtcreator_logo_*.png
images.path = /share/pixmaps
INSTALLS += images
}
OTHER_FILES += Core.pluginspec

View File

@@ -0,0 +1,53 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "eventfilteringmainwindow.h"
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#include <QtDebug>
using namespace Core::Internal;
EventFilteringMainWindow::EventFilteringMainWindow()
{
}
#ifdef Q_OS_WIN
bool EventFilteringMainWindow::winEvent(MSG *msg, long *result)
{
if (msg->message == WM_DEVICECHANGE) {
emit deviceChange();
*result = TRUE;
}
return false;
}
#endif

View File

@@ -0,0 +1,62 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef EVENTFILTERINGMAINWINDOW_H
#define EVENTFILTERINGMAINWINDOW_H
#include <QtGui/QMainWindow>
namespace Core {
namespace Internal {
/*!
* This class only exists because we can't include windows.h in mainwindow.cpp
* because windows defines an IContext...
*/
class EventFilteringMainWindow : public QMainWindow
{
Q_OBJECT
public:
EventFilteringMainWindow();
#ifdef Q_OS_WIN
protected:
bool winEvent(MSG *message, long *result);
#endif
signals:
void deviceChange();
};
} // Internal
} // Core
#endif // EVENTFILTERINGMAINWINDOW_H

View File

@@ -106,7 +106,7 @@ static const char *uriListMimeFormatC = "text/uri-list";
enum { debugMainWindow = 0 };
MainWindow::MainWindow() :
QMainWindow(),
EventFilteringMainWindow(),
m_coreImpl(new CoreImpl(this)),
m_uniqueIDManager(new UniqueIDManager()),
m_globalContext(QList<int>() << Constants::C_GLOBAL_ID),
@@ -1254,3 +1254,4 @@ void MainWindow::setFullScreen(bool on)
//statusBar()->show();
}
}

View File

@@ -32,7 +32,8 @@
#include "core_global.h"
#include <QtGui/QMainWindow>
#include "eventfilteringmainwindow.h"
#include <QtCore/QMap>
#include <QtCore/QList>
#include <QtCore/QSet>
@@ -79,7 +80,7 @@ class ShortcutSettings;
class ViewManager;
class VersionDialog;
class CORE_EXPORT MainWindow : public QMainWindow
class CORE_EXPORT MainWindow : public EventFilteringMainWindow
{
Q_OBJECT