Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
b6fda5be
Commit
b6fda5be
authored
15 years ago
by
dt
Browse files
Options
Downloads
Patches
Plain Diff
Progress so far
parent
0f3d8b65
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/debugger/debuggeruiswitcher.cpp
+17
-38
17 additions, 38 deletions
src/plugins/debugger/debuggeruiswitcher.cpp
src/plugins/debugger/debuggeruiswitcher.h
+6
-4
6 additions, 4 deletions
src/plugins/debugger/debuggeruiswitcher.h
with
23 additions
and
42 deletions
src/plugins/debugger/debuggeruiswitcher.cpp
+
17
−
38
View file @
b6fda5be
...
@@ -36,7 +36,6 @@ using namespace Debugger::Internal;
...
@@ -36,7 +36,6 @@ using namespace Debugger::Internal;
DebuggerUISwitcher
*
DebuggerUISwitcher
::
m_instance
=
0
;
DebuggerUISwitcher
*
DebuggerUISwitcher
::
m_instance
=
0
;
DebuggerUISwitcher
::
DebuggerUISwitcher
(
Core
::
BaseMode
*
mode
,
QObject
*
parent
)
:
QObject
(
parent
),
DebuggerUISwitcher
::
DebuggerUISwitcher
(
Core
::
BaseMode
*
mode
,
QObject
*
parent
)
:
QObject
(
parent
),
m_model
(
new
QStandardItemModel
(
this
)),
m_toolbarStack
(
new
QStackedWidget
),
m_toolbarStack
(
new
QStackedWidget
),
m_languageActionGroup
(
new
QActionGroup
(
this
)),
m_languageActionGroup
(
new
QActionGroup
(
this
)),
m_activeLanguage
(
-
1
),
m_activeLanguage
(
-
1
),
...
@@ -77,11 +76,7 @@ void DebuggerUISwitcher::addMenuAction(Core::Command *command, const QString &gr
...
@@ -77,11 +76,7 @@ void DebuggerUISwitcher::addMenuAction(Core::Command *command, const QString &gr
void
DebuggerUISwitcher
::
setActiveLanguage
(
const
QString
&
langName
)
void
DebuggerUISwitcher
::
setActiveLanguage
(
const
QString
&
langName
)
{
{
QModelIndex
idx
=
modelIndexForLanguage
(
langName
);
changeDebuggerUI
(
langName
);
if
(
!
idx
.
isValid
())
return
;
changeDebuggerUI
(
idx
.
row
());
}
}
...
@@ -163,9 +158,8 @@ DebuggerUISwitcher *DebuggerUISwitcher::instance()
...
@@ -163,9 +158,8 @@ DebuggerUISwitcher *DebuggerUISwitcher::instance()
void
DebuggerUISwitcher
::
addLanguage
(
const
QString
&
langName
)
void
DebuggerUISwitcher
::
addLanguage
(
const
QString
&
langName
)
{
{
QStandardItem
*
item
=
new
QStandardItem
(
langName
);
m_toolBars
.
insert
(
langName
,
0
);
m_languages
.
append
(
langName
);
m_model
->
appendRow
(
item
);
Core
::
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
Core
::
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
QAction
*
langChange
=
new
QAction
(
langName
,
this
);
QAction
*
langChange
=
new
QAction
(
langName
,
this
);
...
@@ -185,23 +179,21 @@ void DebuggerUISwitcher::langChangeTriggered()
...
@@ -185,23 +179,21 @@ void DebuggerUISwitcher::langChangeTriggered()
{
{
QObject
*
sdr
=
sender
();
QObject
*
sdr
=
sender
();
QAction
*
act
=
qobject_cast
<
QAction
*>
(
sdr
);
QAction
*
act
=
qobject_cast
<
QAction
*>
(
sdr
);
changeDebuggerUI
(
modelIndexForLanguage
(
act
->
text
()).
row
());
changeDebuggerUI
(
act
->
text
());
}
}
void
DebuggerUISwitcher
::
changeDebuggerUI
(
int
langId
)
void
DebuggerUISwitcher
::
changeDebuggerUI
(
const
QString
&
langName
)
{
{
if
(
m_changingUI
)
if
(
m_changingUI
)
return
;
return
;
m_changingUI
=
true
;
m_changingUI
=
true
;
// id
int
langId
=
m_languages
.
indexOf
(
langName
);
QModelIndex
idx
=
m_model
->
index
(
langId
,
0
);
if
(
langId
!=
m_activeLanguage
)
{
if
(
langId
!=
m_activeLanguage
)
{
m_languageActionGroup
->
actions
()[
langId
]
->
setChecked
(
true
);
m_languageActionGroup
->
actions
()[
langId
]
->
setChecked
(
true
);
m_activeLanguage
=
langId
;
m_activeLanguage
=
langId
;
m_toolbarStack
->
setCurrent
Index
(
m_model
->
data
(
idx
,
StackIndexRole
).
toInt
(
));
m_toolbarStack
->
setCurrent
Widget
(
m_toolBars
.
value
(
langName
));
foreach
(
DebugToolWindow
*
window
,
m_dockWidgets
)
{
foreach
(
DebugToolWindow
*
window
,
m_dockWidgets
)
{
if
(
window
->
m_languageId
!=
langId
)
{
if
(
window
->
m_languageId
!=
langId
)
{
...
@@ -224,31 +216,18 @@ void DebuggerUISwitcher::changeDebuggerUI(int langId)
...
@@ -224,31 +216,18 @@ void DebuggerUISwitcher::changeDebuggerUI(int langId)
menuitem
.
second
->
setVisible
(
false
);
menuitem
.
second
->
setVisible
(
false
);
}
}
}
}
m_languageMenu
->
menu
()
->
setTitle
(
tr
(
"Language"
)
+
" ("
+
idx
.
data
().
toString
()
+
")"
);
m_languageMenu
->
menu
()
->
setTitle
(
tr
(
"Language"
)
+
" ("
+
langName
+
")"
);
emit
languageChanged
(
idx
.
data
().
toString
()
);
emit
languageChanged
(
langName
);
}
}
m_changingUI
=
false
;
m_changingUI
=
false
;
}
}
QModelIndex
DebuggerUISwitcher
::
modelIndexForLanguage
(
const
QString
&
languageName
)
{
QList
<
QStandardItem
*>
items
=
m_model
->
findItems
(
languageName
);
if
(
items
.
length
()
!=
1
)
return
QModelIndex
();
return
m_model
->
indexFromItem
(
items
.
at
(
0
));
}
void
DebuggerUISwitcher
::
setToolbar
(
const
QString
&
langName
,
QWidget
*
widget
)
void
DebuggerUISwitcher
::
setToolbar
(
const
QString
&
langName
,
QWidget
*
widget
)
{
{
QModelIndex
modelIdx
=
modelIndexForLanguage
(
langName
);
Q_ASSERT
(
m_toolBars
.
contains
(
langName
));
if
(
!
modelIdx
.
isValid
())
m_toolBars
[
langName
]
=
widget
;
return
;
m_toolbarStack
->
addWidget
(
widget
);
int
stackIdx
=
m_toolbarStack
->
addWidget
(
widget
);
m_model
->
setData
(
modelIdx
,
stackIdx
,
StackIndexRole
);
}
}
DebuggerMainWindow
*
DebuggerUISwitcher
::
mainWindow
()
const
DebuggerMainWindow
*
DebuggerUISwitcher
::
mainWindow
()
const
...
@@ -311,13 +290,13 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const QString &langName, QWidg
...
@@ -311,13 +290,13 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const QString &langName, QWidg
QDockWidget
*
dockWidget
=
m_mainWindow
->
addDockForWidget
(
widget
);
QDockWidget
*
dockWidget
=
m_mainWindow
->
addDockForWidget
(
widget
);
m_mainWindow
->
addDockWidget
(
area
,
dockWidget
);
m_mainWindow
->
addDockWidget
(
area
,
dockWidget
);
DebugToolWindow
*
window
=
new
DebugToolWindow
;
DebugToolWindow
*
window
=
new
DebugToolWindow
;
window
->
m_languageId
=
m
odelIndexForLanguage
(
langName
)
.
row
()
;
window
->
m_languageId
=
m
_languages
.
indexOf
(
langName
);
window
->
m_dockWidget
=
dockWidget
;
window
->
m_dockWidget
=
dockWidget
;
window
->
m_visible
=
visibleByDefault
;
window
->
m_visible
=
visibleByDefault
;
m_dockWidgets
.
append
(
window
);
m_dockWidgets
.
append
(
window
);
if
(
m
odelIndexForLanguage
(
langName
)
.
row
()
!=
m_activeLanguage
)
if
(
m
_languages
.
indexOf
(
langName
)
!=
m_activeLanguage
)
dockWidget
->
hide
();
dockWidget
->
hide
();
Core
::
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
Core
::
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
...
@@ -325,7 +304,7 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const QString &langName, QWidg
...
@@ -325,7 +304,7 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const QString &langName, QWidg
"Debugger."
+
dockWidget
->
objectName
(),
m_debuggercontext
);
"Debugger."
+
dockWidget
->
objectName
(),
m_debuggercontext
);
m_viewsMenu
->
addAction
(
cmd
);
m_viewsMenu
->
addAction
(
cmd
);
m_viewsMenuItems
.
append
(
qMakePair
(
m
odelIndexForLanguage
(
langName
)
.
row
()
,
dockWidget
->
toggleViewAction
()));
m_viewsMenuItems
.
append
(
qMakePair
(
m
_languages
.
indexOf
(
langName
),
dockWidget
->
toggleViewAction
()));
return
dockWidget
;
return
dockWidget
;
}
}
...
@@ -392,14 +371,14 @@ void DebuggerUISwitcher::initialize()
...
@@ -392,14 +371,14 @@ void DebuggerUISwitcher::initialize()
readSettings
();
readSettings
();
if
(
m_activeLanguage
==
-
1
)
{
if
(
m_activeLanguage
==
-
1
)
{
changeDebuggerUI
(
0
);
changeDebuggerUI
(
m_languages
.
first
()
);
}
}
hideInactiveWidgets
();
hideInactiveWidgets
();
}
}
void
DebuggerUISwitcher
::
resetDebuggerLayout
()
void
DebuggerUISwitcher
::
resetDebuggerLayout
()
{
{
emit
dockArranged
(
m_
model
->
index
(
m_activeLanguage
,
0
).
data
().
toString
(
));
emit
dockArranged
(
m_
languages
.
at
(
m_activeLanguage
));
}
}
}
}
This diff is collapsed.
Click to expand it.
src/plugins/debugger/debuggeruiswitcher.h
+
6
−
4
View file @
b6fda5be
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
#include
<coreplugin/basemode.h>
#include
<coreplugin/basemode.h>
#include
<QtCore/QObject>
#include
<QtCore/QObject>
#include
<QtGui/QStandardItemModel>
#include
<QtCore/QList>
#include
<QtCore/QList>
#include
<QtCore/QMap>
namespace
Core
{
namespace
Core
{
class
ActionContainer
;
class
ActionContainer
;
...
@@ -73,7 +73,7 @@ signals:
...
@@ -73,7 +73,7 @@ signals:
private
slots
:
private
slots
:
void
modeChanged
(
Core
::
IMode
*
mode
);
void
modeChanged
(
Core
::
IMode
*
mode
);
void
changeDebuggerUI
(
int
langId
);
void
changeDebuggerUI
(
const
QString
&
langName
);
void
resetDebuggerLayout
();
void
resetDebuggerLayout
();
void
langChangeTriggered
();
void
langChangeTriggered
();
...
@@ -82,7 +82,6 @@ private:
...
@@ -82,7 +82,6 @@ private:
void
createViewsMenuItems
();
void
createViewsMenuItems
();
void
readSettings
();
void
readSettings
();
void
writeSettings
()
const
;
void
writeSettings
()
const
;
QModelIndex
modelIndexForLanguage
(
const
QString
&
langName
);
QWidget
*
createContents
(
Core
::
BaseMode
*
mode
);
QWidget
*
createContents
(
Core
::
BaseMode
*
mode
);
QWidget
*
createMainWindow
(
Core
::
BaseMode
*
mode
);
QWidget
*
createMainWindow
(
Core
::
BaseMode
*
mode
);
...
@@ -90,7 +89,10 @@ private:
...
@@ -90,7 +89,10 @@ private:
typedef
QPair
<
int
,
QAction
*
>
ViewsMenuItems
;
typedef
QPair
<
int
,
QAction
*
>
ViewsMenuItems
;
QList
<
ViewsMenuItems
>
m_viewsMenuItems
;
QList
<
ViewsMenuItems
>
m_viewsMenuItems
;
QList
<
Internal
::
DebugToolWindow
*
>
m_dockWidgets
;
QList
<
Internal
::
DebugToolWindow
*
>
m_dockWidgets
;
QStandardItemModel
*
m_model
;
QMap
<
QString
,
QWidget
*>
m_toolBars
;
QStringList
m_languages
;
QStackedWidget
*
m_toolbarStack
;
QStackedWidget
*
m_toolbarStack
;
DebuggerMainWindow
*
m_mainWindow
;
DebuggerMainWindow
*
m_mainWindow
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment