Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
aea19425
Commit
aea19425
authored
Dec 08, 2009
by
con
Browse files
StatusBarWidget instead of IView, get rid of one level of abstraction.
Merge IView and BaseView into a single class StatusBarWidget.
parent
fd73952e
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/coreplugin.pro
View file @
aea19425
...
...
@@ -56,7 +56,7 @@ SOURCES += mainwindow.cpp \
scriptmanager
/
scriptmanager
.
cpp
\
scriptmanager
/
qworkbench_wrapper
.
cpp
\
basemode
.
cpp
\
baseview
.
cpp
\
statusbarwidget
.
cpp
\
coreplugin
.
cpp
\
variablemanager
.
cpp
\
modemanager
.
cpp
\
...
...
@@ -128,7 +128,6 @@ HEADERS += mainwindow.h \
ioutputpane
.
h
\
coreconstants
.
h
\
iversioncontrol
.
h
\
iview
.
h
\
ifilewizardextension
.
h
\
icorelistener
.
h
\
versiondialog
.
h
\
...
...
@@ -138,7 +137,7 @@ HEADERS += mainwindow.h \
scriptmanager
/
scriptmanager_p
.
h
\
core_global
.
h
\
basemode
.
h
\
baseview
.
h
\
statusbarwidget
.
h
\
coreplugin
.
h
\
variablemanager
.
h
\
modemanager
.
h
\
...
...
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
aea19425
...
...
@@ -46,7 +46,6 @@
#include
<coreplugin/actionmanager/actionmanager.h>
#include
<coreplugin/editormanager/ieditorfactory.h>
#include
<coreplugin/editormanager/iexternaleditor.h>
#include
<coreplugin/baseview.h>
#include
<coreplugin/imode.h>
#include
<coreplugin/settingsdatabase.h>
#include
<coreplugin/variablemanager.h>
...
...
@@ -164,7 +163,6 @@ struct EditorManagerPrivate {
QAction
*
m_gotoOtherSplitAction
;
Internal
::
OpenEditorsWindow
*
m_windowPopup
;
Core
::
BaseView
*
m_openEditorsView
;
Internal
::
EditorClosingCoreListener
*
m_coreListener
;
QMap
<
QString
,
QVariant
>
m_editorStates
;
...
...
src/plugins/coreplugin/iview.h
deleted
100644 → 0
View file @
fd73952e
/**************************************************************************
**
** 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://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef IVIEW_H
#define IVIEW_H
#include
"core_global.h"
#include
<coreplugin/icontext.h>
namespace
Core
{
class
CORE_EXPORT
IView
:
public
IContext
{
Q_OBJECT
public:
enum
ViewPosition
{
First
=
0
,
Second
=
1
,
Third
=
2
};
IView
(
QObject
*
parent
=
0
)
:
IContext
(
parent
)
{}
virtual
~
IView
()
{}
virtual
const
char
*
uniqueViewName
()
const
=
0
;
virtual
ViewPosition
defaultPosition
()
const
=
0
;
};
}
// namespace Core
#endif // IVIEW_H
src/plugins/coreplugin/mainwindow.cpp
View file @
aea19425
...
...
@@ -60,7 +60,7 @@
#include
"navigationwidget.h"
#include
"rightpane.h"
#include
"editormanager/ieditorfactory.h"
#include
"
baseview
.h"
#include
"
statusbarwidget
.h"
#include
"basefilewizard.h"
#include
"ioutputpane.h"
...
...
@@ -323,10 +323,9 @@ bool MainWindow::init(QString *errorMessage)
// Add widget to the bottom, we create the view here instead of inside the
// OutputPaneManager, since the ViewManager needs to be initilized before
m_outputView
=
new
Core
::
BaseView
;
m_outputView
->
setUniqueViewName
(
"OutputWindow"
);
m_outputView
=
new
Core
::
StatusBarWidget
;
m_outputView
->
setWidget
(
OutputPaneManager
::
instance
()
->
buttonsWidget
());
m_outputView
->
set
Default
Position
(
Core
::
IView
::
Second
);
m_outputView
->
setPosition
(
Core
::
StatusBarWidget
::
Second
);
pm
->
addObject
(
m_outputView
);
return
true
;
}
...
...
src/plugins/coreplugin/mainwindow.h
View file @
aea19425
...
...
@@ -48,7 +48,7 @@ namespace Core {
class
ActionManager
;
class
BaseMode
;
class
BaseView
;
class
StatusBarWidget
;
class
EditorManager
;
class
FileManager
;
class
IContext
;
...
...
@@ -195,7 +195,7 @@ private:
FancyTabWidget
*
m_modeStack
;
NavigationWidget
*
m_navigationWidget
;
RightPaneWidget
*
m_rightPaneWidget
;
Core
::
BaseView
*
m_outputView
;
Core
::
StatusBarWidget
*
m_outputView
;
VersionDialog
*
m_versionDialog
;
IContext
*
m_activeContext
;
...
...
src/plugins/coreplugin/progressmanager/progressmanager.cpp
View file @
aea19425
...
...
@@ -29,7 +29,6 @@
#include
"progressmanager_p.h"
#include
"progressview.h"
#include
"baseview.h"
#include
"coreconstants.h"
#include
"icore.h"
#include
"uniqueidmanager.h"
...
...
src/plugins/coreplugin/
baseview
.cpp
→
src/plugins/coreplugin/
statusbarwidget
.cpp
View file @
aea19425
...
...
@@ -27,65 +27,53 @@
**
**************************************************************************/
#include
"
baseview
.h"
#include
"
statusbarwidget
.h"
#include
<QtGui/QWidget>
using
namespace
Core
;
BaseView
::
BaseView
(
QObject
*
parent
)
:
IView
(
parent
),
m_viewName
(
""
),
StatusBarWidget
::
StatusBarWidget
(
QObject
*
parent
)
:
IContext
(
parent
),
m_widget
(
0
),
m_context
(
QList
<
int
>
()),
m_defaultPosition
(
IView
::
First
)
m_defaultPosition
(
StatusBarWidget
::
First
)
{
}
BaseView
::~
BaseView
()
StatusBarWidget
::~
StatusBarWidget
()
{
delete
m_widget
;
}
QList
<
int
>
BaseView
::
context
()
const
QList
<
int
>
StatusBarWidget
::
context
()
const
{
return
m_context
;
}
QWidget
*
BaseView
::
widget
()
QWidget
*
StatusBarWidget
::
widget
()
{
return
m_widget
;
}
const
char
*
BaseView
::
uniqueViewName
()
const
{
return
m_viewName
;
}
IView
::
ViewPosition
BaseView
::
defaultPosition
()
const
StatusBarWidget
::
StatusBarPosition
StatusBarWidget
::
position
()
const
{
return
m_defaultPosition
;
}
void
BaseView
::
setUniqueViewName
(
const
char
*
name
)
{
m_viewName
=
name
;
}
QWidget
*
BaseView
::
setWidget
(
QWidget
*
widget
)
QWidget
*
StatusBarWidget
::
setWidget
(
QWidget
*
widget
)
{
QWidget
*
oldWidget
=
m_widget
;
m_widget
=
widget
;
return
oldWidget
;
}
void
BaseView
::
setContext
(
const
QList
<
int
>
&
context
)
void
StatusBarWidget
::
setContext
(
const
QList
<
int
>
&
context
)
{
m_context
=
context
;
}
void
BaseView
::
setDefaultPosition
(
IView
::
View
Position
position
)
void
StatusBarWidget
::
setPosition
(
StatusBarWidget
::
StatusBar
Position
position
)
{
m_defaultPosition
=
position
;
}
...
...
src/plugins/coreplugin/
baseview
.h
→
src/plugins/coreplugin/
statusbarwidget
.h
View file @
aea19425
...
...
@@ -27,40 +27,39 @@
**
**************************************************************************/
#ifndef
BASEVIEW
_H
#define
BASEVIEW
_H
#ifndef
STATUSBARWIDGET
_H
#define
STATUSBARWIDGET
_H
#include
"core_global.h"
#include
"i
view
.h"
#include
"i
context
.h"
#include
<QtCore/QPointer>
namespace
Core
{
class
CORE_EXPORT
BaseView
:
public
I
View
class
CORE_EXPORT
StatusBarWidget
:
public
I
Context
{
Q_OBJECT
public:
BaseView
(
QObject
*
parent
=
0
);
~
BaseView
();
enum
StatusBarPosition
{
First
=
0
,
Second
=
1
,
Third
=
2
};
StatusBarWidget
(
QObject
*
parent
=
0
);
~
StatusBarWidget
();
QList
<
int
>
context
()
const
;
QWidget
*
widget
();
const
char
*
uniqueViewName
()
const
;
IView
::
ViewPosition
defaultPosition
()
const
;
StatusBarWidget
::
StatusBarPosition
position
()
const
;
void
setUniqueViewName
(
const
char
*
name
);
QWidget
*
setWidget
(
QWidget
*
widget
);
void
setContext
(
const
QList
<
int
>
&
context
);
void
set
Default
Position
(
IView
::
View
Position
position
);
void
setPosition
(
StatusBarWidget
::
StatusBar
Position
position
);
private:
const
char
*
m_viewName
;
QPointer
<
QWidget
>
m_widget
;
QList
<
int
>
m_context
;
IView
::
View
Position
m_defaultPosition
;
StatusBarWidget
::
StatusBar
Position
m_defaultPosition
;
};
}
// namespace Core
#endif //
BASEVIEW
_H
#endif //
STATUSBARWIDGET
_H
src/plugins/coreplugin/viewmanager.cpp
View file @
aea19425
...
...
@@ -32,7 +32,7 @@
#include
"coreconstants.h"
#include
"mainwindow.h"
#include
"uniqueidmanager.h"
#include
"
iview
.h"
#include
"
statusbarwidget
.h"
#include
<coreplugin/actionmanager/actionmanager.h>
#include
<coreplugin/actionmanager/command.h>
...
...
@@ -77,22 +77,21 @@ void ViewManager::init()
void
ViewManager
::
objectAdded
(
QObject
*
obj
)
{
IView
*
view
=
Aggregation
::
query
<
IView
>
(
obj
);
StatusBarWidget
*
view
=
Aggregation
::
query
<
StatusBarWidget
>
(
obj
);
if
(
!
view
)
return
;
QWidget
*
viewWidget
=
0
;
viewWidget
=
view
->
widget
();
m_statusBarWidgets
.
at
(
view
->
defaultP
osition
())
->
layout
()
->
addWidget
(
viewWidget
);
m_statusBarWidgets
.
at
(
view
->
p
osition
())
->
layout
()
->
addWidget
(
viewWidget
);
m_viewMap
.
insert
(
view
,
viewWidget
);
viewWidget
->
setObjectName
(
view
->
uniqueViewName
());
m_mainWnd
->
addContextObject
(
view
);
}
void
ViewManager
::
aboutToRemoveObject
(
QObject
*
obj
)
{
IView
*
view
=
Aggregation
::
query
<
IView
>
(
obj
);
StatusBarWidget
*
view
=
Aggregation
::
query
<
StatusBarWidget
>
(
obj
);
if
(
!
view
)
return
;
m_mainWnd
->
removeContextObject
(
view
);
...
...
@@ -108,14 +107,3 @@ void ViewManager::saveSettings(QSettings *settings)
{
settings
->
setValue
(
QLatin1String
(
"ViewGroup_Default"
),
m_mainWnd
->
saveState
());
}
IView
*
ViewManager
::
view
(
const
QString
&
id
)
{
QList
<
IView
*>
list
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
IView
>
();
foreach
(
IView
*
view
,
list
)
{
if
(
view
->
uniqueViewName
()
==
id
)
return
view
;
}
return
0
;
}
src/plugins/coreplugin/viewmanager.h
View file @
aea19425
...
...
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
namespace
Core
{
class
IView
;
class
StatusBarWidget
;
namespace
Internal
{
...
...
@@ -62,13 +62,12 @@ public:
void
extensionsInitalized
();
void
saveSettings
(
QSettings
*
settings
);
IView
*
view
(
const
QString
&
id
);
private
slots
:
void
objectAdded
(
QObject
*
obj
);
void
aboutToRemoveObject
(
QObject
*
obj
);
private:
QMap
<
Core
::
IView
*
,
QWidget
*>
m_viewMap
;
QMap
<
Core
::
StatusBarWidget
*
,
QWidget
*>
m_viewMap
;
MainWindow
*
m_mainWnd
;
QList
<
QWidget
*>
m_statusBarWidgets
;
...
...
src/plugins/locator/locatorplugin.cpp
View file @
aea19425
...
...
@@ -41,7 +41,7 @@
#include
<QtCore/QFuture>
#include
<QtCore/QFutureWatcher>
#include
<coreplugin/
baseview
.h>
#include
<coreplugin/
statusbarwidget
.h>
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/settingsdatabase.h>
#include
<coreplugin/icore.h>
...
...
@@ -95,12 +95,11 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
m_locatorWidget
=
new
LocatorWidget
(
this
);
m_locatorWidget
->
setEnabled
(
false
);
Core
::
BaseView
*
view
=
new
Core
::
BaseView
;
view
->
setUniqueViewName
(
"Locator"
);
Core
::
StatusBarWidget
*
view
=
new
Core
::
StatusBarWidget
;
view
->
setWidget
(
m_locatorWidget
);
view
->
setContext
(
QList
<
int
>
()
<<
core
->
uniqueIDManager
()
->
uniqueIdentifier
(
QLatin1String
(
"LocatorWidget"
)));
view
->
set
Default
Position
(
Core
::
IView
::
First
);
view
->
setPosition
(
Core
::
StatusBarWidget
::
First
);
addAutoReleasedObject
(
view
);
const
QString
actionId
=
QLatin1String
(
"QtCreator.Locate"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment