Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
f68d6cf0
Commit
f68d6cf0
authored
Jan 26, 2009
by
hjk
Browse files
Fixes: rename OutputPane into OutputPaneManager
RevBy: dt Details: also clean up the class interface a bit
parent
a0a4cec8
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/mainwindow.cpp
View file @
f68d6cf0
...
...
@@ -131,7 +131,6 @@ MainWindow::MainWindow() :
m_versionDialog
(
0
),
m_activeContext
(
0
),
m_pluginManager
(
0
),
m_outputPane
(
new
OutputPane
(
m_globalContext
)),
m_outputMode
(
0
),
m_generalSettings
(
new
GeneralSettings
),
m_shortcutSettings
(
new
ShortcutSettings
),
...
...
@@ -150,6 +149,8 @@ MainWindow::MainWindow() :
#endif
m_toggleSideBarButton
(
new
QToolButton
)
{
OutputPaneManager
::
create
();
setWindowTitle
(
tr
(
"Qt Creator"
));
qApp
->
setWindowIcon
(
QIcon
(
":/core/images/qtcreator_logo_128.png"
));
setDockNestingEnabled
(
true
);
...
...
@@ -247,9 +248,9 @@ MainWindow::~MainWindow()
//because they might trigger stuff that tries to access data from editorwindow, like removeContextWidget
// All modes are now gone
delete
OutputPane
::
instance
();
OutputPane
Manager
::
destroy
();
// Now that the OutputPane is gone, is a good time to delete the view
// Now that the OutputPane
Manager
is gone, is a good time to delete the view
m_pluginManager
->
removeObject
(
m_outputView
);
delete
m_outputView
;
...
...
@@ -299,14 +300,15 @@ bool MainWindow::init(ExtensionSystem::PluginManager *pm, QString *)
outputModeWidget
->
layout
()
->
addWidget
(
new
Core
::
FindToolBarPlaceHolder
(
m_outputMode
));
outputModeWidget
->
setFocusProxy
(
oph
);
m_outputMode
->
setContext
(
m_
outputPane
->
c
ontext
()
);
m_outputMode
->
setContext
(
m_
globalC
ontext
);
m_pluginManager
->
addObject
(
m_outputMode
);
m_pluginManager
->
addObject
(
m_generalSettings
);
m_pluginManager
->
addObject
(
m_shortcutSettings
);
// Add widget to the bottom, we create the view here instead of inside the OutputPane, since
// the ViewManager needs to be initilized before
m_outputView
=
new
Core
::
BaseView
(
"OutputWindow.Buttons"
,
m_outputPane
->
buttonsWidget
(),
QList
<
int
>
(),
Core
::
IView
::
Second
);
// 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
(
"OutputWindow.Buttons"
,
OutputPaneManager
::
instance
()
->
buttonsWidget
(),
QList
<
int
>
(),
Core
::
IView
::
Second
);
m_pluginManager
->
addObject
(
m_outputView
);
return
true
;
}
...
...
@@ -318,7 +320,7 @@ void MainWindow::extensionsInitialized()
m_viewManager
->
extensionsInitalized
();
m_messageManager
->
init
(
m_pluginManager
);
m_o
utputPane
->
init
(
m_pluginManager
);
O
utputPane
Manager
::
instance
()
->
init
(
);
m_actionManager
->
initialize
();
readSettings
();
...
...
@@ -756,7 +758,7 @@ void MainWindow::setFocusToEditor()
if
(
focusWidget
&&
focusWidget
==
qApp
->
focusWidget
())
{
if
(
FindToolBarPlaceHolder
::
getCurrent
())
FindToolBarPlaceHolder
::
getCurrent
()
->
hide
();
m_o
utputPane
->
slotHide
();
O
utputPane
Manager
::
instance
()
->
slotHide
();
RightPaneWidget
::
instance
()
->
setShown
(
false
);
}
}
...
...
src/plugins/coreplugin/mainwindow.h
View file @
f68d6cf0
...
...
@@ -80,13 +80,12 @@ class CoreImpl;
class
FancyTabWidget
;
class
GeneralSettings
;
class
NavigationWidget
;
class
OutputPane
;
class
ProgressManagerPrivate
;
class
ShortcutSettings
;
class
ViewManager
;
class
VersionDialog
;
class
CORE_EXPORT
MainWindow
:
public
QMainWindow
class
CORE_EXPORT
MainWindow
:
public
QMainWindow
{
Q_OBJECT
...
...
@@ -198,7 +197,6 @@ private:
ExtensionSystem
::
PluginManager
*
m_pluginManager
;
OutputPane
*
m_outputPane
;
BaseMode
*
m_outputMode
;
GeneralSettings
*
m_generalSettings
;
ShortcutSettings
*
m_shortcutSettings
;
...
...
src/plugins/coreplugin/outputpane.cpp
View file @
f68d6cf0
...
...
@@ -81,7 +81,7 @@ private:
OutputPanePlaceHolder
*
OutputPanePlaceHolder
::
m_current
=
0
;
OutputPanePlaceHolder
::
OutputPanePlaceHolder
(
Core
::
IMode
*
mode
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_mode
(
mode
),
m_closeable
(
true
)
:
QWidget
(
parent
),
m_mode
(
mode
),
m_closeable
(
true
)
{
setVisible
(
false
);
setLayout
(
new
QVBoxLayout
);
...
...
@@ -98,8 +98,8 @@ OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QWidget *parent)
OutputPanePlaceHolder
::~
OutputPanePlaceHolder
()
{
if
(
m_current
==
this
)
{
OutputPane
::
instance
()
->
setParent
(
0
);
OutputPane
::
instance
()
->
hide
();
OutputPane
Manager
::
instance
()
->
setParent
(
0
);
OutputPane
Manager
::
instance
()
->
hide
();
}
}
...
...
@@ -117,45 +117,54 @@ void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
{
if
(
m_current
==
this
)
{
m_current
=
0
;
OutputPane
::
instance
()
->
setParent
(
0
);
OutputPane
::
instance
()
->
hide
();
OutputPane
::
instance
()
->
updateStatusButtons
(
false
);
OutputPane
Manager
::
instance
()
->
setParent
(
0
);
OutputPane
Manager
::
instance
()
->
hide
();
OutputPane
Manager
::
instance
()
->
updateStatusButtons
(
false
);
}
if
(
m_mode
==
mode
)
{
m_current
=
this
;
layout
()
->
addWidget
(
OutputPane
::
instance
());
OutputPane
::
instance
()
->
show
();
OutputPane
::
instance
()
->
updateStatusButtons
(
isVisible
());
OutputPane
::
instance
()
->
setCloseable
(
m_closeable
);
layout
()
->
addWidget
(
OutputPane
Manager
::
instance
());
OutputPane
Manager
::
instance
()
->
show
();
OutputPane
Manager
::
instance
()
->
updateStatusButtons
(
isVisible
());
OutputPane
Manager
::
instance
()
->
setCloseable
(
m_closeable
);
}
}
////
// OutputPane
// OutputPane
Manager
////
OutputPane
*
OutputPane
::
m_instance
=
0
;
static
OutputPane
Manager
*
m_instance
=
0
;
OutputPane
*
OutputPane
::
instance
()
void
OutputPaneManager
::
create
()
{
m_instance
=
new
OutputPaneManager
;
}
void
OutputPaneManager
::
destroy
()
{
delete
m_instance
;
m_instance
=
0
;
}
OutputPaneManager
*
OutputPaneManager
::
instance
()
{
return
m_instance
;
}
void
OutputPane
::
updateStatusButtons
(
bool
visible
)
void
OutputPane
Manager
::
updateStatusButtons
(
bool
visible
)
{
int
idx
=
m_widgetComboBox
->
itemData
(
m_widgetComboBox
->
currentIndex
()).
toInt
();
if
(
m_buttons
.
value
(
idx
))
m_buttons
.
value
(
idx
)
->
setChecked
(
visible
);
}
OutputPane
::
OutputPane
(
const
QList
<
int
>
&
context
,
QWidget
*
parent
)
:
OutputPane
Manager
::
OutputPane
Manager
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_context
(
context
),
m_widgetComboBox
(
new
QComboBox
),
m_clearButton
(
new
QToolButton
),
m_closeButton
(
new
QToolButton
),
m_closeAction
(
0
),
m_pluginManager
(
0
),
m_lastIndex
(
-
1
),
m_outputWidgetPane
(
new
QStackedWidget
),
m_opToolBarWidgets
(
new
QStackedWidget
)
...
...
@@ -191,24 +200,19 @@ OutputPane::OutputPane(const QList<int> &context, QWidget *parent) :
#else
m_buttonsWidget
->
layout
()
->
setSpacing
(
4
);
#endif
m_instance
=
this
;
}
OutputPane
::~
OutputPane
()
OutputPane
Manager
::~
OutputPane
Manager
()
{
m_instance
=
0
;
}
QWidget
*
OutputPane
::
buttonsWidget
()
QWidget
*
OutputPane
Manager
::
buttonsWidget
()
{
return
m_buttonsWidget
;
}
void
OutputPane
::
init
(
ExtensionSystem
::
PluginManager
*
pm
)
void
OutputPane
Manager
::
init
()
{
m_pluginManager
=
pm
;
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
ActionContainer
*
mwindow
=
am
->
actionContainer
(
Constants
::
M_WINDOW
);
...
...
@@ -217,7 +221,8 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm)
mwindow
->
addMenu
(
mpanes
,
Constants
::
G_WINDOW_PANES
);
mpanes
->
menu
()
->
setTitle
(
tr
(
"Output &Panes"
));
QList
<
IOutputPane
*>
panes
=
m_pluginManager
->
getObjects
<
IOutputPane
>
();
QList
<
IOutputPane
*>
panes
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
IOutputPane
>
();
QMultiMap
<
int
,
IOutputPane
*>
sorted
;
foreach
(
IOutputPane
*
outPane
,
panes
)
sorted
.
insertMulti
(
outPane
->
priorityInStatusBar
(),
outPane
);
...
...
@@ -251,7 +256,7 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm)
actionId
.
remove
(
QLatin1Char
(
' '
));
QAction
*
action
=
new
QAction
(
outPane
->
name
(),
this
);
Command
*
cmd
=
am
->
registerAction
(
action
,
actionId
,
m_context
);
Command
*
cmd
=
am
->
registerAction
(
action
,
actionId
,
QList
<
int
>
()
<<
Constants
::
C_GLOBAL_ID
);
if
(
outPane
->
priorityInStatusBar
()
!=
-
1
)
{
#ifdef Q_OS_MAC
cmd
->
setDefaultKeySequence
(
QKeySequence
(
"Ctrl+"
+
QString
::
number
(
shortcutNumber
)));
...
...
@@ -281,7 +286,7 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm)
changePage
();
}
void
OutputPane
::
shortcutTriggered
()
void
OutputPane
Manager
::
shortcutTriggered
()
{
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
());
if
(
action
&&
m_actions
.
contains
(
action
))
{
...
...
@@ -305,7 +310,7 @@ void OutputPane::shortcutTriggered()
}
}
void
OutputPane
::
buttonTriggered
()
void
OutputPane
Manager
::
buttonTriggered
()
{
QPushButton
*
button
=
qobject_cast
<
QPushButton
*>
(
sender
());
QMap
<
int
,
QPushButton
*>::
const_iterator
it
,
end
;
...
...
@@ -327,7 +332,7 @@ void OutputPane::buttonTriggered()
}
}
void
OutputPane
::
updateToolTip
()
void
OutputPane
Manager
::
updateToolTip
()
{
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
());
if
(
action
)
{
...
...
@@ -337,7 +342,7 @@ void OutputPane::updateToolTip()
}
}
void
OutputPane
::
slotHide
()
void
OutputPane
Manager
::
slotHide
()
{
if
(
OutputPanePlaceHolder
::
m_current
)
{
OutputPanePlaceHolder
::
m_current
->
setVisible
(
false
);
...
...
@@ -350,7 +355,7 @@ void OutputPane::slotHide()
}
}
int
OutputPane
::
findIndexForPage
(
IOutputPane
*
out
)
int
OutputPane
Manager
::
findIndexForPage
(
IOutputPane
*
out
)
{
if
(
!
out
)
return
-
1
;
...
...
@@ -370,7 +375,7 @@ int OutputPane::findIndexForPage(IOutputPane *out)
return
-
1
;
}
void
OutputPane
::
ensurePageVisible
(
int
idx
)
void
OutputPane
Manager
::
ensurePageVisible
(
int
idx
)
{
if
(
m_widgetComboBox
->
itemData
(
m_widgetComboBox
->
currentIndex
()).
toInt
()
!=
idx
)
{
m_widgetComboBox
->
setCurrentIndex
(
m_widgetComboBox
->
findData
(
idx
));
...
...
@@ -380,13 +385,13 @@ void OutputPane::ensurePageVisible(int idx)
}
void
OutputPane
::
showPage
(
bool
focus
)
void
OutputPane
Manager
::
showPage
(
bool
focus
)
{
int
idx
=
findIndexForPage
(
qobject_cast
<
IOutputPane
*>
(
sender
()));
showPage
(
idx
,
focus
);
}
void
OutputPane
::
showPage
(
int
idx
,
bool
focus
)
void
OutputPane
Manager
::
showPage
(
int
idx
,
bool
focus
)
{
IOutputPane
*
out
=
m_pageMap
.
value
(
idx
);
if
(
idx
>
-
1
)
{
...
...
@@ -405,7 +410,7 @@ void OutputPane::showPage(int idx, bool focus)
}
}
void
OutputPane
::
togglePage
(
bool
focus
)
void
OutputPane
Manager
::
togglePage
(
bool
focus
)
{
int
idx
=
findIndexForPage
(
qobject_cast
<
IOutputPane
*>
(
sender
()));
if
(
OutputPanePlaceHolder
::
m_current
...
...
@@ -417,23 +422,23 @@ void OutputPane::togglePage(bool focus)
}
}
void
OutputPane
::
setCloseable
(
bool
b
)
void
OutputPane
Manager
::
setCloseable
(
bool
b
)
{
m_closeAction
->
setVisible
(
b
);
}
bool
OutputPane
::
closeable
()
bool
OutputPane
Manager
::
closeable
()
{
return
m_closeButton
->
isVisibleTo
(
m_closeButton
->
parentWidget
());
}
void
OutputPane
::
focusInEvent
(
QFocusEvent
*
e
)
void
OutputPane
Manager
::
focusInEvent
(
QFocusEvent
*
e
)
{
if
(
m_outputWidgetPane
->
currentWidget
())
m_outputWidgetPane
->
currentWidget
()
->
setFocus
(
e
->
reason
());
}
void
OutputPane
::
changePage
()
void
OutputPane
Manager
::
changePage
()
{
if
(
m_outputWidgetPane
->
count
()
<=
0
)
return
;
...
...
@@ -470,7 +475,7 @@ void OutputPane::changePage()
m_lastIndex
=
idx
;
}
void
OutputPane
::
clearPage
()
void
OutputPane
Manager
::
clearPage
()
{
if
(
m_pageMap
.
contains
(
m_outputWidgetPane
->
currentIndex
()))
m_pageMap
.
value
(
m_outputWidgetPane
->
currentIndex
())
->
clearContents
();
...
...
src/plugins/coreplugin/outputpane.h
View file @
f68d6cf0
...
...
@@ -47,21 +47,20 @@ class QStackedWidget;
class
QPushButton
;
QT_END_NAMESPACE
namespace
ExtensionSystem
{
class
PluginManager
;
}
namespace
Core
{
class
IMode
;
class
IOutputPane
;
namespace
Internal
{
class
OutputPane
;
class
OutputPaneManager
;
class
MainWindow
;
}
class
CORE_EXPORT
OutputPanePlaceHolder
:
public
QWidget
{
friend
class
Core
::
Internal
::
OutputPane
;
// needs to set m_visible and thus access m_current
friend
class
Core
::
Internal
::
OutputPane
Manager
;
// needs to set m_visible and thus access m_current
Q_OBJECT
public:
OutputPanePlaceHolder
(
Core
::
IMode
*
mode
,
QWidget
*
parent
=
0
);
...
...
@@ -80,17 +79,13 @@ private:
namespace
Internal
{
class
OutputPane
:
public
QWidget
class
OutputPaneManager
:
public
QWidget
{
Q_OBJECT
public:
OutputPane
(
const
QList
<
int
>
&
context
,
QWidget
*
parent
=
0
);
~
OutputPane
();
void
init
(
ExtensionSystem
::
PluginManager
*
pm
);
static
OutputPane
*
instance
();
const
QList
<
int
>
&
context
()
const
{
return
m_context
;
}
void
init
();
static
OutputPaneManager
*
instance
();
void
setCloseable
(
bool
b
);
bool
closeable
();
QWidget
*
buttonsWidget
();
...
...
@@ -103,7 +98,7 @@ public slots:
protected:
void
focusInEvent
(
QFocusEvent
*
e
);
private
slots
:
;
private
slots
:
void
changePage
();
void
showPage
(
bool
focus
);
void
togglePage
(
bool
focus
);
...
...
@@ -112,17 +107,23 @@ private slots:;
void
buttonTriggered
();
private:
// the only class that is allowed to create and destroy
friend
class
MainWindow
;
static
void
create
();
static
void
destroy
();
OutputPaneManager
(
QWidget
*
parent
=
0
);
~
OutputPaneManager
();
void
showPage
(
int
idx
,
bool
focus
);
void
ensurePageVisible
(
int
idx
);
int
findIndexForPage
(
IOutputPane
*
out
);
const
QList
<
int
>
m_context
;
QComboBox
*
m_widgetComboBox
;
QToolButton
*
m_clearButton
;
QToolButton
*
m_closeButton
;
QAction
*
m_closeAction
;
ExtensionSystem
::
PluginManager
*
m_pluginManager
;
QMap
<
int
,
Core
::
IOutputPane
*>
m_pageMap
;
int
m_lastIndex
;
...
...
@@ -132,7 +133,7 @@ private:
QMap
<
int
,
QPushButton
*>
m_buttons
;
QMap
<
QAction
*
,
int
>
m_actions
;
static
OutputPane
*
m_instance
;
static
OutputPane
Manager
*
m_instance
;
};
}
// namespace Internal
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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