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
d9f97aa1
Commit
d9f97aa1
authored
Jan 14, 2009
by
con
Browse files
Fixes: - Command --> CommandPrivate
Details: - Preparation for ICommand rename
parent
1e4c48a1
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/actionmanager/actioncontainer.cpp
View file @
d9f97aa1
...
...
@@ -34,7 +34,7 @@
#include "actioncontainer_p.h"
#include "actionmanager_p.h"
#include "command.h"
#include "command
_p
.h"
#include "coreimpl.h"
#include "coreconstants.h"
...
...
@@ -171,7 +171,7 @@ void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
ActionManagerPrivate
*
am
=
ActionManagerPrivate
::
instance
();
Action
*
a
=
static_cast
<
Action
*>
(
action
);
if
(
a
->
stateFlags
()
&
Command
::
CS_PreLocation
)
{
if
(
a
->
stateFlags
()
&
Command
Private
::
CS_PreLocation
)
{
QList
<
CommandLocation
>
locs
=
a
->
locations
();
for
(
int
i
=
0
;
i
<
locs
.
size
();
++
i
)
{
if
(
ActionContainer
*
aci
=
am
->
actionContainer
(
locs
.
at
(
i
).
m_container
))
{
...
...
@@ -179,7 +179,7 @@ void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
ac
->
addAction
(
action
,
locs
.
at
(
i
).
m_position
,
false
);
}
}
a
->
setStateFlags
(
a
->
stateFlags
()
|
Command
::
CS_Initialized
);
a
->
setStateFlags
(
a
->
stateFlags
()
|
Command
Private
::
CS_Initialized
);
}
else
{
UniqueIDManager
*
idmanager
=
CoreImpl
::
instance
()
->
uniqueIDManager
();
int
grpid
=
idmanager
->
uniqueIdentifier
(
Constants
::
G_DEFAULT_TWO
);
...
...
@@ -239,8 +239,8 @@ bool ActionContainerPrivate::canAddAction(ICommand *action) const
if
(
action
->
type
()
!=
ICommand
::
CT_OverridableAction
)
return
false
;
Command
*
cmd
=
static_cast
<
Command
*>
(
action
);
if
(
cmd
->
stateFlags
()
&
Command
::
CS_Initialized
)
Command
Private
*
cmd
=
static_cast
<
Command
Private
*>
(
action
);
if
(
cmd
->
stateFlags
()
&
Command
Private
::
CS_Initialized
)
return
false
;
return
true
;
...
...
src/plugins/coreplugin/actionmanager/actionmanager.cpp
View file @
d9f97aa1
...
...
@@ -34,7 +34,7 @@
#include "actionmanager_p.h"
#include "mainwindow.h"
#include "actioncontainer_p.h"
#include "command.h"
#include "command
_p
.h"
#include "uniqueidmanager.h"
#include <coreplugin/coreconstants.h>
...
...
@@ -233,7 +233,7 @@ QList<int> ActionManagerPrivate::defaultGroups() const
return
m_defaultGroups
;
}
QList
<
Command
*>
ActionManagerPrivate
::
commands
()
const
QList
<
Command
Private
*>
ActionManagerPrivate
::
commands
()
const
{
return
m_idCmdMap
.
values
();
}
...
...
@@ -322,7 +322,7 @@ ICommand *ActionManagerPrivate::registerOverridableAction(QAction *action, const
{
OverrideableAction
*
a
=
0
;
const
int
uid
=
m_mainWnd
->
uniqueIDManager
()
->
uniqueIdentifier
(
id
);
if
(
Command
*
c
=
m_idCmdMap
.
value
(
uid
,
0
))
{
if
(
Command
Private
*
c
=
m_idCmdMap
.
value
(
uid
,
0
))
{
if
(
c
->
type
()
!=
ICommand
::
CT_OverridableAction
)
{
qWarning
()
<<
"registerAction: id"
<<
id
<<
"is registered with a different command type."
;
return
c
;
...
...
@@ -368,7 +368,7 @@ ICommand *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStr
{
Shortcut
*
sc
=
0
;
int
uid
=
m_mainWnd
->
uniqueIDManager
()
->
uniqueIdentifier
(
id
);
if
(
Command
*
c
=
m_idCmdMap
.
value
(
uid
,
0
))
{
if
(
Command
Private
*
c
=
m_idCmdMap
.
value
(
uid
,
0
))
{
if
(
c
->
type
()
!=
ICommand
::
CT_Shortcut
)
{
qWarning
()
<<
"registerShortcut: id"
<<
id
<<
"is registered with a different command type."
;
return
c
;
...
...
@@ -476,7 +476,7 @@ void ActionManagerPrivate::saveSettings(QSettings *settings)
const
IdCmdMap
::
const_iterator
cmdcend
=
m_idCmdMap
.
constEnd
();
for
(
IdCmdMap
::
const_iterator
j
=
m_idCmdMap
.
constBegin
();
j
!=
cmdcend
;
++
j
)
{
const
int
id
=
j
.
key
();
Command
*
cmd
=
j
.
value
();
Command
Private
*
cmd
=
j
.
value
();
QKeySequence
key
=
cmd
->
keySequence
();
if
(
key
!=
cmd
->
defaultKeySequence
())
{
const
QString
sid
=
m_mainWnd
->
uniqueIDManager
()
->
stringForUniqueIdentifier
(
id
);
...
...
src/plugins/coreplugin/actionmanager/actionmanager_p.h
View file @
d9f97aa1
...
...
@@ -58,7 +58,7 @@ namespace Internal {
class
ActionContainerPrivate
;
class
MainWindow
;
class
Command
;
class
Command
Private
;
class
ActionManagerPrivate
:
public
Core
::
ActionManager
{
...
...
@@ -74,7 +74,7 @@ public:
void
saveSettings
(
QSettings
*
settings
);
QList
<
int
>
defaultGroups
()
const
;
QList
<
Command
*>
commands
()
const
;
QList
<
Command
Private
*>
commands
()
const
;
QList
<
ActionContainerPrivate
*>
containers
()
const
;
bool
hasContext
(
int
context
)
const
;
...
...
@@ -104,7 +104,7 @@ private:
static
ActionManagerPrivate
*
m_instance
;
QList
<
int
>
m_defaultGroups
;
typedef
QHash
<
int
,
Command
*>
IdCmdMap
;
typedef
QHash
<
int
,
Command
Private
*>
IdCmdMap
;
IdCmdMap
m_idCmdMap
;
typedef
QHash
<
int
,
ActionContainerPrivate
*>
IdContainerMap
;
...
...
src/plugins/coreplugin/actionmanager/command.cpp
View file @
d9f97aa1
...
...
@@ -35,7 +35,7 @@
#include <QtGui/QAction>
#include <QtGui/QShortcut>
#include "command.h"
#include "command
_p
.h"
/*!
\class Core::ICommand
...
...
@@ -105,170 +105,111 @@
using
namespace
Core
::
Internal
;
/*!
\class Command
\ingroup qwb
\inheaderfile command.h
*/
/*!
\enum Command::CommandState
\class CommandPrivate
\inheaderfile command_p.h
\internal
*/
/*!
\fn Command::Command(CommandType type, int id)
*/
Command
::
Command
(
CommandType
type
,
int
id
)
CommandPrivate
::
CommandPrivate
(
CommandType
type
,
int
id
)
:
m_type
(
type
),
m_id
(
id
)
{
}
/*!
\fn virtual Command::~Command()
*/
/*!
...
*/
void
Command
::
setStateFlags
(
int
state
)
void
CommandPrivate
::
setStateFlags
(
int
state
)
{
m_type
|=
(
state
&
CS_Mask
);
}
/*!
...
*/
int
Command
::
stateFlags
()
const
int
CommandPrivate
::
stateFlags
()
const
{
return
(
m_type
&
CS_Mask
);
}
/*!
\fn virtual QString Command::name() const
*/
/*!
...
*/
void
Command
::
setCategory
(
const
QString
&
name
)
void
CommandPrivate
::
setCategory
(
const
QString
&
name
)
{
m_category
=
name
;
}
/*!
...
*/
QString
Command
::
category
()
const
QString
CommandPrivate
::
category
()
const
{
if
(
m_category
.
isEmpty
())
return
QObject
::
tr
(
"Other"
);
return
m_category
;
}
/*!
...
*/
void
Command
::
setDefaultKeySequence
(
const
QKeySequence
&
key
)
void
CommandPrivate
::
setDefaultKeySequence
(
const
QKeySequence
&
key
)
{
m_defaultKey
=
key
;
}
/*!
...
*/
QKeySequence
Command
::
defaultKeySequence
()
const
QKeySequence
CommandPrivate
::
defaultKeySequence
()
const
{
return
m_defaultKey
;
}
void
Command
::
setDefaultText
(
const
QString
&
text
)
void
Command
Private
::
setDefaultText
(
const
QString
&
text
)
{
m_defaultText
=
text
;
}
QString
Command
::
defaultText
()
const
QString
Command
Private
::
defaultText
()
const
{
return
m_defaultText
;
}
/*!
...
*/
int
Command
::
id
()
const
int
CommandPrivate
::
id
()
const
{
return
m_id
;
}
/*!
...
*/
Command
::
CommandType
Command
::
type
()
const
CommandPrivate
::
CommandType
CommandPrivate
::
type
()
const
{
return
(
CommandType
)(
m_type
&
CT_Mask
);
}
/*!
...
*/
QAction
*
Command
::
action
()
const
QAction
*
CommandPrivate
::
action
()
const
{
return
0
;
}
/*!
...
*/
QShortcut
*
Command
::
shortcut
()
const
QShortcut
*
CommandPrivate
::
shortcut
()
const
{
return
0
;
}
/*!
...
*/
void
Command
::
setAttribute
(
CommandAttribute
attr
)
void
CommandPrivate
::
setAttribute
(
CommandAttribute
attr
)
{
m_type
|=
attr
;
}
/*!
...
*/
void
Command
::
removeAttribute
(
CommandAttribute
attr
)
void
CommandPrivate
::
removeAttribute
(
CommandAttribute
attr
)
{
m_type
&=
~
attr
;
}
/*!
...
*/
bool
Command
::
hasAttribute
(
CommandAttribute
attr
)
const
bool
CommandPrivate
::
hasAttribute
(
CommandAttribute
attr
)
const
{
return
(
m_type
&
attr
);
}
QString
Command
::
stringWithAppendedShortcut
(
const
QString
&
str
)
const
QString
Command
Private
::
stringWithAppendedShortcut
(
const
QString
&
str
)
const
{
return
QString
(
"%1 <span style=
\"
color: gray; font-size: small
\"
>%2</span>"
).
arg
(
str
).
arg
(
keySequence
().
toString
(
QKeySequence
::
NativeText
));
}
/*!
\fn virtual bool Command::setCurrentContext(const QList<int> &context) = 0
*/
// ---------- Shortcut ------------
/*!
\class Shortcut
\ingroup qwb
\inheaderfile command.h
*/
/*!
...
*/
Shortcut
::
Shortcut
(
int
id
)
:
Command
(
CT_Shortcut
,
id
),
m_shortcut
(
0
)
:
Command
Private
(
CT_Shortcut
,
id
),
m_shortcut
(
0
)
{
}
...
...
@@ -322,7 +263,7 @@ QList<int> Shortcut::context() const
void
Shortcut
::
setDefaultKeySequence
(
const
QKeySequence
&
key
)
{
setKeySequence
(
key
);
Command
::
setDefaultKeySequence
(
key
);
Command
Private
::
setDefaultKeySequence
(
key
);
}
void
Shortcut
::
setKeySequence
(
const
QKeySequence
&
key
)
...
...
@@ -374,14 +315,13 @@ bool Shortcut::isActive() const
/*!
\class Action
\ingroup qwb
\inheaderfile command.h
*/
/*!
...
*/
Action
::
Action
(
CommandType
type
,
int
id
)
:
Command
(
type
,
id
),
m_action
(
0
)
:
Command
Private
(
type
,
id
),
m_action
(
0
)
{
}
...
...
@@ -439,7 +379,7 @@ QList<CommandLocation> Action::locations() const
void
Action
::
setDefaultKeySequence
(
const
QKeySequence
&
key
)
{
setKeySequence
(
key
);
Command
::
setDefaultKeySequence
(
key
);
Command
Private
::
setDefaultKeySequence
(
key
);
}
void
Action
::
setKeySequence
(
const
QKeySequence
&
key
)
...
...
@@ -467,7 +407,6 @@ QKeySequence Action::keySequence() const
/*!
\class OverrideableAction
\ingroup qwb
\inheaderfile command.h
*/
/*!
...
...
src/plugins/coreplugin/actionmanager/command.h
→
src/plugins/coreplugin/actionmanager/command
_p
.h
View file @
d9f97aa1
...
...
@@ -31,8 +31,8 @@
**
***************************************************************************/
#ifndef COMMAND_H
#define COMMAND_H
#ifndef COMMAND_
P_
H
#define COMMAND_
P_
H
#include "icommand.h"
#include "actionmanager_p.h"
...
...
@@ -45,7 +45,7 @@
namespace
Core
{
namespace
Internal
{
class
Command
:
public
Core
::
ICommand
class
Command
Private
:
public
Core
::
ICommand
{
Q_OBJECT
public:
...
...
@@ -56,8 +56,8 @@ public:
CS_Mask
=
0xFF0000
};
Command
(
CommandType
type
,
int
id
);
virtual
~
Command
()
{}
Command
Private
(
CommandType
type
,
int
id
);
virtual
~
Command
Private
()
{}
void
setStateFlags
(
int
state
);
int
stateFlags
()
const
;
...
...
@@ -95,7 +95,7 @@ protected:
QString
m_defaultText
;
};
class
Shortcut
:
public
Command
class
Shortcut
:
public
Command
Private
{
Q_OBJECT
public:
...
...
@@ -124,7 +124,7 @@ private:
QString
m_defaultText
;
};
class
Action
:
public
Command
class
Action
:
public
Command
Private
{
Q_OBJECT
public:
...
...
@@ -176,4 +176,4 @@ private:
}
// namespace Internal
}
// namespace Core
#endif // COMMAND_H
#endif // COMMAND_
P_
H
src/plugins/coreplugin/actionmanager/commandsfile.cpp
View file @
d9f97aa1
...
...
@@ -34,7 +34,7 @@
#include "coreimpl.h"
#include "commandsfile.h"
#include "shortcutsettings.h"
#include "command.h"
#include "command
_p
.h"
#include <coreplugin/uniqueidmanager.h>
...
...
src/plugins/coreplugin/coreplugin.pro
View file @
d9f97aa1
...
...
@@ -102,7 +102,7 @@ HEADERS += mainwindow.h \
actionmanager
/
actionmanager
.
h
\
actionmanager
/
icommand
.
h
\
actionmanager
/
actionmanager_p
.
h
\
actionmanager
/
command
.
h
\
actionmanager
/
command
_p
.
h
\
actionmanager
/
actioncontainer_p
.
h
\
actionmanager
/
commandsfile
.
h
\
dialogs
/
saveitemsdialog
.
h
\
...
...
src/plugins/coreplugin/dialogs/shortcutsettings.cpp
View file @
d9f97aa1
...
...
@@ -34,7 +34,7 @@
#include "shortcutsettings.h"
#include "ui_shortcutsettings.h"
#include "actionmanager_p.h"
#include "command.h"
#include "command
_p
.h"
#include "coreconstants.h"
#include "coreimpl.h"
#include "commandsfile.h"
...
...
@@ -285,10 +285,10 @@ void ShortcutSettings::initialize()
UniqueIDManager
*
uidm
=
CoreImpl
::
instance
()
->
uniqueIDManager
();
QList
<
Command
*>
cmds
=
m_am
->
commands
();
QList
<
Command
Private
*>
cmds
=
m_am
->
commands
();
for
(
int
i
=
0
;
i
<
cmds
.
size
();
++
i
)
{
Command
*
c
=
cmds
.
at
(
i
);
if
(
c
->
hasAttribute
(
Command
::
CA_NonConfigureable
))
Command
Private
*
c
=
cmds
.
at
(
i
);
if
(
c
->
hasAttribute
(
Command
Private
::
CA_NonConfigureable
))
continue
;
if
(
c
->
action
()
&&
c
->
action
()
->
isSeparator
())
continue
;
...
...
@@ -313,7 +313,7 @@ void ShortcutSettings::initialize()
item
->
setText
(
0
,
uidm
->
stringForUniqueIdentifier
(
c
->
id
()));
if
(
c
->
action
())
{
QString
text
=
c
->
hasAttribute
(
Command
::
CA_UpdateText
)
&&
!
c
->
defaultText
().
isNull
()
?
c
->
defaultText
()
:
c
->
action
()
->
text
();
QString
text
=
c
->
hasAttribute
(
Command
Private
::
CA_UpdateText
)
&&
!
c
->
defaultText
().
isNull
()
?
c
->
defaultText
()
:
c
->
action
()
->
text
();
s
->
m_key
=
c
->
action
()
->
shortcut
();
item
->
setText
(
1
,
text
);
}
else
{
...
...
src/plugins/coreplugin/dialogs/shortcutsettings.h
View file @
d9f97aa1
...
...
@@ -52,7 +52,6 @@ class ICommand;
namespace
Internal
{
class
ActionManagerPrivate
;
class
Command
;
class
MainWindow
;
struct
ShortcutItem
...
...
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