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
a9645059
Commit
a9645059
authored
May 18, 2010
by
kh1
Browse files
We need to keep the action around, not the command.
Fixes broken enabled/ disabled qemu start button behavior.
parent
239a9571
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp
View file @
a9645059
...
...
@@ -65,7 +65,7 @@ MaemoManager::MaemoManager()
,
m_runConfigurationFactory
(
new
MaemoRunConfigurationFactory
(
this
))
,
m_packageCreationFactory
(
new
MaemoPackageCreationFactory
(
this
))
,
m_settingsPage
(
new
MaemoSettingsPage
(
this
))
,
m_qemu
Command
(
0
)
,
m_qemu
Action
(
0
)
{
Q_ASSERT
(
!
m_instance
);
...
...
@@ -139,30 +139,28 @@ MaemoManager::addQemuSimulatorStarter(Project *project)
{
if
(
projects
.
contains
(
project
))
return
;
projects
.
insert
(
project
);
if
(
m_qemu
Command
)
{
m_qemu
Command
->
a
ction
()
->
setVisible
(
true
);
if
(
m_qemu
Action
)
{
m_qemu
A
ction
->
setVisible
(
true
);
return
;
}
m_qemuAction
=
new
QAction
(
"Maemo Emulator"
,
this
);
m_qemuAction
->
setEnabled
(
false
);
m_qemuAction
->
setIcon
(
icon
.
pixmap
(
iconSize
));
m_qemuAction
->
setToolTip
(
tr
(
"Start Maemo Emulator"
));
connect
(
m_qemuAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
triggered
()));
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
();
Core
::
ModeManager
*
modeManager
=
core
->
modeManager
();
Core
::
ActionManager
*
actionManager
=
core
->
actionManager
();
Core
::
Command
*
qemuCommand
=
actionManager
->
registerAction
(
m_qemuAction
,
"MaemoEmulator"
,
QList
<
int
>
()
<<
Core
::
Constants
::
C_GLOBAL_ID
);
qemuCommand
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
qemuCommand
->
setAttribute
(
Core
::
Command
::
CA_UpdateIcon
);
QAction
*
action
=
new
QAction
(
"Maemo Emulator"
,
this
);
action
->
setIcon
(
icon
.
pixmap
(
iconSize
));
action
->
setToolTip
(
tr
(
"Start Maemo Emulator"
));
m_qemuCommand
=
actionManager
->
registerAction
(
action
,
"MaemoEmulator"
,
QList
<
int
>
()
<<
Core
::
Constants
::
C_GLOBAL_ID
);
modeManager
->
addAction
(
m_qemuCommand
,
1
);
action
->
setEnabled
(
false
);
m_qemuCommand
->
action
()
->
setEnabled
(
false
);
m_qemuCommand
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
m_qemuCommand
->
setAttribute
(
Core
::
Command
::
CA_UpdateIcon
);
connect
(
m_qemuCommand
->
action
(),
SIGNAL
(
triggered
()),
this
,
SLOT
(
triggered
()));
Core
::
ModeManager
*
modeManager
=
core
->
modeManager
();
modeManager
->
addAction
(
qemuCommand
,
1
);
}
void
...
...
@@ -170,16 +168,16 @@ MaemoManager::removeQemuSimulatorStarter(Project *project)
{
if
(
projects
.
contains
(
project
))
{
projects
.
remove
(
project
);
if
(
projects
.
isEmpty
()
&&
m_qemu
Command
)
m_qemu
Command
->
a
ction
()
->
setVisible
(
false
);
if
(
projects
.
isEmpty
()
&&
m_qemu
Action
)
m_qemu
A
ction
->
setVisible
(
false
);
}
}
void
MaemoManager
::
setQemuSimulatorStarterEnabled
(
bool
enable
)
{
if
(
m_qemu
Command
)
m_qemu
Command
->
a
ction
()
->
setEnabled
(
enable
);
if
(
m_qemu
Action
)
m_qemu
A
ction
->
setEnabled
(
enable
);
}
void
...
...
@@ -191,7 +189,7 @@ MaemoManager::triggered()
void
MaemoManager
::
updateQemuSimulatorStarter
(
bool
running
)
{
if
(
m_qemu
Command
)
{
if
(
m_qemu
Action
)
{
QIcon
::
State
state
=
QIcon
::
Off
;
QString
toolTip
(
tr
(
"Start Maemo Emulator"
));
if
(
running
)
{
...
...
@@ -199,9 +197,8 @@ MaemoManager::updateQemuSimulatorStarter(bool running)
toolTip
=
tr
(
"Stop Maemo Emulator"
);
}
QAction
*
action
=
m_qemuCommand
->
action
();
action
->
setToolTip
(
toolTip
);
action
->
setIcon
(
icon
.
pixmap
(
iconSize
,
QIcon
::
Normal
,
state
));
m_qemuAction
->
setToolTip
(
toolTip
);
m_qemuAction
->
setIcon
(
icon
.
pixmap
(
iconSize
,
QIcon
::
Normal
,
state
));
}
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
View file @
a9645059
...
...
@@ -35,13 +35,8 @@
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class
QAction
;
QT_END_NAMESPACE
QT_FORWARD_DECLARE_CLASS
(
QAction
);
namespace
Core
{
class
Command
;
}
namespace
ProjectExplorer
{
class
Project
;
class
ToolChain
;
...
...
@@ -95,7 +90,7 @@ private:
QIcon
icon
;
int
m_runCount
;
QSet
<
Project
*>
projects
;
Core
::
Command
*
m_qemu
Command
;
QAction
*
m_qemu
Action
;
};
}
// 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