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
Marco Bubke
flatpak-qt-creator
Commits
1181765a
Commit
1181765a
authored
Jun 25, 2010
by
hjk
Browse files
cleanup interface of Core::Context
parent
46e55681
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/actionmanager/actionmanager.cpp
View file @
1181765a
...
...
@@ -250,7 +250,7 @@ QList<Command *> ActionManagerPrivate::commands() const
{
// transform list of CommandPrivate into list of Command
QList
<
Command
*>
result
;
foreach
(
Command
*
cmd
,
m_idCmdMap
.
values
())
foreach
(
Command
*
cmd
,
m_idCmdMap
.
values
())
result
<<
cmd
;
return
result
;
}
...
...
@@ -262,7 +262,7 @@ QList<ActionContainerPrivate *> ActionManagerPrivate::containers() const
bool
ActionManagerPrivate
::
hasContext
(
int
context
)
const
{
return
m_context
.
d
.
contains
(
context
);
return
m_context
.
contains
(
context
);
}
void
ActionManagerPrivate
::
setContext
(
const
Context
&
context
)
...
...
@@ -278,8 +278,8 @@ void ActionManagerPrivate::setContext(const Context &context)
bool
ActionManagerPrivate
::
hasContext
(
const
Context
&
context
)
const
{
for
(
int
i
=
0
;
i
<
m_context
.
d
.
count
();
++
i
)
{
if
(
context
.
d
.
contains
(
m_context
.
d
.
at
(
i
)))
for
(
int
i
=
0
;
i
<
m_context
.
size
();
++
i
)
{
if
(
context
.
contains
(
m_context
.
at
(
i
)))
return
true
;
}
return
false
;
...
...
@@ -403,7 +403,7 @@ Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStri
shortcut
->
setParent
(
m_mainWnd
);
sc
->
setShortcut
(
shortcut
);
if
(
context
.
d
.
isEmpty
())
if
(
context
.
isEmpty
())
sc
->
setContext
(
Context
(
0
));
else
sc
->
setContext
(
context
);
...
...
src/plugins/coreplugin/actionmanager/command.cpp
View file @
1181765a
...
...
@@ -336,8 +336,8 @@ QString Shortcut::defaultText() const
bool
Shortcut
::
setCurrentContext
(
const
Core
::
Context
&
context
)
{
foreach
(
int
ctxt
,
m_context
.
d
)
{
if
(
context
.
d
.
contains
(
ctxt
))
{
foreach
(
int
ctxt
,
m_context
)
{
if
(
context
.
contains
(
ctxt
))
{
if
(
!
m_shortcut
->
isEnabled
())
{
m_shortcut
->
setEnabled
(
true
);
emit
activeStateChanged
();
...
...
@@ -487,7 +487,7 @@ static inline QString msgActionWarning(QAction *newAction, int k, QAction *oldAc
void
Action
::
addOverrideAction
(
QAction
*
action
,
const
Core
::
Context
&
context
)
{
if
(
context
.
d
.
isEmpty
())
{
if
(
context
.
isEmpty
())
{
m_contextActionMap
.
insert
(
0
,
action
);
}
else
{
for
(
int
i
=
0
;
i
<
context
.
size
();
++
i
)
{
...
...
src/plugins/coreplugin/designmode.cpp
View file @
1181765a
...
...
@@ -267,7 +267,7 @@ void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode)
void
DesignMode
::
setActiveContext
(
const
Context
&
context
)
{
if
(
d
->
m_activeContext
.
d
==
context
.
d
)
if
(
d
->
m_activeContext
==
context
)
return
;
if
(
ModeManager
::
instance
()
->
currentMode
()
==
this
)
...
...
src/plugins/coreplugin/dialogs/shortcutsettings.cpp
View file @
1181765a
...
...
@@ -393,7 +393,7 @@ void ShortcutSettings::markPossibleCollisions(ShortcutItem *item)
continue
;
}
foreach
(
int
context
,
currentItem
->
m_cmd
->
context
()
.
d
)
{
foreach
(
int
context
,
currentItem
->
m_cmd
->
context
())
{
// conflict if context is identical, OR if one
// of the contexts is the global context
...
...
src/plugins/coreplugin/icontext.h
View file @
1181765a
...
...
@@ -56,7 +56,19 @@ public:
int
size
()
const
{
return
d
.
size
();
}
bool
isEmpty
()
const
{
return
d
.
isEmpty
();
}
int
at
(
int
i
)
const
{
return
d
.
at
(
i
);
}
public:
// FIXME: Make interface slimmer.
typedef
QList
<
int
>::
const_iterator
const_iterator
;
const_iterator
begin
()
const
{
return
d
.
begin
();
}
const_iterator
end
()
const
{
return
d
.
end
();
}
int
indexOf
(
int
c
)
const
{
return
d
.
indexOf
(
c
);
}
void
removeAt
(
int
i
)
{
d
.
removeAt
(
i
);
}
void
prepend
(
int
c
)
{
d
.
prepend
(
c
);
}
void
add
(
const
Context
&
c
)
{
d
+=
c
.
d
;
}
void
add
(
int
c
)
{
d
.
append
(
c
);
}
bool
operator
==
(
const
Context
&
c
)
{
return
d
==
c
.
d
;
}
private:
QList
<
int
>
d
;
};
...
...
src/plugins/coreplugin/mainwindow.cpp
View file @
1181765a
...
...
@@ -1198,21 +1198,21 @@ void MainWindow::writeSettings()
void
MainWindow
::
updateAdditionalContexts
(
const
Context
&
remove
,
const
Context
&
add
)
{
foreach
(
const
int
context
,
remove
.
d
)
{
foreach
(
const
int
context
,
remove
)
{
if
(
context
==
0
)
continue
;
int
index
=
m_additionalContexts
.
d
.
indexOf
(
context
);
int
index
=
m_additionalContexts
.
indexOf
(
context
);
if
(
index
!=
-
1
)
m_additionalContexts
.
d
.
removeAt
(
index
);
m_additionalContexts
.
removeAt
(
index
);
}
foreach
(
const
int
context
,
add
.
d
)
{
foreach
(
const
int
context
,
add
)
{
if
(
context
==
0
)
continue
;
if
(
!
m_additionalContexts
.
d
.
contains
(
context
))
m_additionalContexts
.
d
.
prepend
(
context
);
if
(
!
m_additionalContexts
.
contains
(
context
))
m_additionalContexts
.
prepend
(
context
);
}
updateContext
();
...
...
@@ -1228,15 +1228,15 @@ void MainWindow::updateContext()
Context
contexts
;
if
(
m_activeContext
)
contexts
.
d
+=
m_activeContext
->
context
()
.
d
;
contexts
.
add
(
m_activeContext
->
context
()
)
;
contexts
.
d
+=
m_additionalContexts
.
d
;
contexts
.
add
(
m_additionalContexts
)
;
Context
uniquecontexts
;
for
(
int
i
=
0
;
i
<
contexts
.
d
.
size
();
++
i
)
{
const
int
c
=
contexts
.
d
.
at
(
i
);
if
(
!
uniquecontexts
.
d
.
contains
(
c
))
uniquecontexts
.
d
<<
c
;
for
(
int
i
=
0
;
i
<
contexts
.
size
();
++
i
)
{
const
int
c
=
contexts
.
at
(
i
);
if
(
!
uniquecontexts
.
contains
(
c
))
uniquecontexts
.
add
(
c
)
;
}
m_actionManager
->
setContext
(
uniquecontexts
);
...
...
src/plugins/projectexplorer/projectexplorer.cpp
View file @
1181765a
...
...
@@ -1311,12 +1311,12 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
Core
::
Context
newContext
;
if
(
d
->
m_currentProject
)
{
oldContext
.
d
.
appen
d
(
d
->
m_currentProject
->
projectManager
()
->
projectContext
());
oldContext
.
d
.
appen
d
(
d
->
m_currentProject
->
projectManager
()
->
projectLanguage
());
oldContext
.
a
dd
(
d
->
m_currentProject
->
projectManager
()
->
projectContext
());
oldContext
.
a
dd
(
d
->
m_currentProject
->
projectManager
()
->
projectLanguage
());
}
if
(
project
)
{
newContext
.
d
.
appen
d
(
project
->
projectManager
()
->
projectContext
());
newContext
.
d
.
appen
d
(
project
->
projectManager
()
->
projectLanguage
());
newContext
.
a
dd
(
project
->
projectManager
()
->
projectContext
());
newContext
.
a
dd
(
project
->
projectManager
()
->
projectLanguage
());
}
core
->
updateAdditionalContexts
(
oldContext
,
newContext
);
...
...
src/plugins/qmldesigner/qmldesignerplugin.cpp
View file @
1181765a
...
...
@@ -275,8 +275,8 @@ void BauhausPlugin::contextChanged(Core::IContext *context, const Core::Context
{
Q_UNUSED
(
context
)
foreach
(
int
additionalContext
,
additionalContexts
.
d
)
{
if
(
m_context
->
context
().
d
.
contains
(
additionalContext
))
{
foreach
(
int
additionalContext
,
additionalContexts
)
{
if
(
m_context
->
context
().
contains
(
additionalContext
))
{
m_isActive
=
true
;
m_mainWidget
->
showEditor
(
m_editorManager
->
currentEditor
());
return
;
...
...
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