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
Tobias Hunger
qt-creator
Commits
9f0d403e
Commit
9f0d403e
authored
Mar 26, 2010
by
dt
Browse files
Sync the active target on the projects page with the active target
parent
10809cdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/targetselector.cpp
View file @
9f0d403e
...
...
@@ -43,7 +43,6 @@ void TargetSelector::insertTarget(int index, const QString &name)
Target
target
;
target
.
name
=
name
;
target
.
currentSubIndex
=
0
;
target
.
isActive
=
false
;
m_targets
.
insert
(
index
,
target
);
...
...
@@ -54,15 +53,6 @@ void TargetSelector::insertTarget(int index, const QString &name)
update
();
}
void
TargetSelector
::
markActive
(
int
index
)
{
QTC_ASSERT
(
index
>=
0
&&
index
<
m_targets
.
count
(),
return
);
for
(
int
i
=
0
;
i
<
m_targets
.
count
();
++
i
)
m_targets
[
i
].
isActive
=
(
i
==
index
);
update
();
}
void
TargetSelector
::
removeTarget
(
int
index
)
{
QTC_ASSERT
(
index
>=
0
&&
index
<
m_targets
.
count
(),
return
);
...
...
@@ -218,13 +208,8 @@ void TargetSelector::paintEvent(QPaintEvent *event)
p
.
setPen
(
QColor
(
0
,
0
,
0
));
}
p
.
drawPixmap
(
x
,
1
,
*
pixmap
);
QString
targetName
;
if
(
target
.
isActive
)
targetName
=
QChar
(
'*'
)
+
target
.
name
+
QChar
(
'*'
);
else
targetName
=
target
.
name
;
p
.
drawText
(
x
+
(
TARGET_WIDTH
-
fm
.
width
(
targetName
))
/
2
+
1
,
7
+
fm
.
ascent
(),
targetName
);
p
.
drawText
(
x
+
(
TARGET_WIDTH
-
fm
.
width
(
target
.
name
))
/
2
+
1
,
7
+
fm
.
ascent
(),
target
.
name
);
x
+=
TARGET_WIDTH
;
p
.
drawLine
(
x
,
1
,
x
,
TARGET_HEIGHT
);
++
x
;
...
...
src/plugins/projectexplorer/targetselector.h
View file @
9f0d403e
...
...
@@ -14,7 +14,6 @@ public:
struct
Target
{
QString
name
;
int
currentSubIndex
;
bool
isActive
;
};
explicit
TargetSelector
(
QWidget
*
parent
=
0
);
...
...
@@ -32,7 +31,6 @@ public:
public
slots
:
void
addTarget
(
const
QString
&
name
);
void
insertTarget
(
int
index
,
const
QString
&
name
);
void
markActive
(
int
index
);
void
removeTarget
(
int
index
);
void
setCurrentIndex
(
int
index
);
void
setCurrentSubIndex
(
int
subindex
);
...
...
src/plugins/projectexplorer/targetsettingspanel.cpp
View file @
9f0d403e
...
...
@@ -123,7 +123,6 @@ void TargetSettingsPanelWidget::setupUi()
this
,
SLOT
(
removeTarget
()));
if
(
m_project
->
activeTarget
())
{
m_selector
->
markActive
(
m_targets
.
indexOf
(
m_project
->
activeTarget
()));
m_selector
->
setCurrentIndex
(
m_targets
.
indexOf
(
m_project
->
activeTarget
()));
}
...
...
@@ -137,7 +136,7 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
if
(
subIndex
<
-
1
||
subIndex
>=
2
)
return
;
Target
*
target
(
m_targets
.
at
(
targetIndex
)
)
;
Target
*
target
=
m_targets
.
at
(
targetIndex
);
// Target was not actually changed:
if
(
m_currentTarget
==
target
)
{
...
...
@@ -156,8 +155,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
return
;
}
PanelsWidget
*
buildPanel
(
new
PanelsWidget
(
m_centralWidget
)
)
;
PanelsWidget
*
runPanel
(
new
PanelsWidget
(
m_centralWidget
)
)
;
PanelsWidget
*
buildPanel
=
new
PanelsWidget
(
m_centralWidget
);
PanelsWidget
*
runPanel
=
new
PanelsWidget
(
m_centralWidget
);
foreach
(
ITargetPanelFactory
*
panelFactory
,
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
ITargetPanelFactory
>
())
{
if
(
panelFactory
->
id
()
==
QLatin1String
(
BUILDSETTINGS_PANEL_ID
))
{
...
...
@@ -180,6 +179,9 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
m_panelWidgets
[
0
]
=
buildPanel
;
delete
m_panelWidgets
[
1
];
m_panelWidgets
[
1
]
=
runPanel
;
m_project
->
setActiveTarget
(
target
);
}
void
TargetSettingsPanelWidget
::
addTarget
()
...
...
@@ -238,8 +240,8 @@ void TargetSettingsPanelWidget::activeTargetChanged(ProjectExplorer::Target *tar
Q_ASSERT
(
m_project
==
target
->
project
());
Q_ASSERT
(
m_selector
);
int
index
(
m_targets
.
indexOf
(
target
)
)
;
m_selector
->
markActive
(
index
);
int
index
=
m_targets
.
indexOf
(
target
);
m_selector
->
setCurrentIndex
(
index
);
}
void
TargetSettingsPanelWidget
::
updateTargetAddAndRemoveButtons
()
...
...
src/plugins/projectexplorer/targetsettingswidget.cpp
View file @
9f0d403e
...
...
@@ -41,11 +41,6 @@ void TargetSettingsWidget::insertTarget(int index, const QString &name)
updateTargetSelector
();
}
void
TargetSettingsWidget
::
markActive
(
int
index
)
{
m_targetSelector
->
markActive
(
index
);
}
void
TargetSettingsWidget
::
removeTarget
(
int
index
)
{
m_targetSelector
->
removeTarget
(
index
);
...
...
src/plugins/projectexplorer/targetsettingswidget.h
View file @
9f0d403e
...
...
@@ -31,7 +31,6 @@ public:
public
slots
:
void
addTarget
(
const
QString
&
name
);
void
insertTarget
(
int
index
,
const
QString
&
name
);
void
markActive
(
int
index
);
void
removeTarget
(
int
index
);
void
setCurrentIndex
(
int
index
);
void
setCurrentSubIndex
(
int
index
);
...
...
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