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
abeb4504
Commit
abeb4504
authored
Jul 20, 2009
by
dt
Browse files
Show a summary widget instead of the full blown environment model.
Hides the gory details, and in most cases the user doesn't care anyway.
parent
7c57f260
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp
View file @
abeb4504
...
...
@@ -38,7 +38,6 @@ bool debug = false;
using
namespace
CMakeProjectManager
;
using
namespace
CMakeProjectManager
::
Internal
;
using
ProjectExplorer
::
EnvironmentModel
;
CMakeBuildEnvironmentWidget
::
CMakeBuildEnvironmentWidget
(
CMakeProject
*
project
)
:
BuildStepConfigWidget
(),
m_pro
(
project
)
...
...
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
View file @
abeb4504
...
...
@@ -39,7 +39,7 @@
#include <QtGui/QLineEdit>
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/Q
RadioButton
>
#include <QtGui/Q
ComboBox
>
#include <QtGui/QToolButton>
using
namespace
CMakeProjectManager
;
...
...
@@ -263,15 +263,24 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
box
->
setLayout
(
boxLayout
);
box
->
setFlat
(
true
);
QFormLayout
*
formlayout
=
new
QFormLayout
();
QLabel
*
label
=
new
QLabel
(
tr
(
"Base environment for this runconfiguration:"
),
this
);
boxLayout
->
addWidget
(
label
);
m_cleanEnvironmentRadioButton
=
new
QRadioButton
(
"Clean Environment"
,
box
);
m_systemEnvironmentRadioButton
=
new
QRadioButton
(
"System Environment"
,
box
);
m_buildEnvironmentRadioButton
=
new
QRadioButton
(
"Build Environment"
,
box
);
boxLayout
->
addWidget
(
m_cleanEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_systemEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_buildEnvironmentRadioButton
);
m_baseEnvironmentComboBox
=
new
QComboBox
(
box
);
m_baseEnvironmentComboBox
->
addItems
(
QStringList
()
<<
tr
(
"Clean Environment"
)
<<
tr
(
"System Environment"
)
<<
tr
(
"Build Environment"
));
formlayout
->
addRow
(
label
,
m_baseEnvironmentComboBox
);
boxLayout
->
addLayout
(
formlayout
);
label
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setCurrentIndex
(
m_cmakeRunConfiguration
->
baseEnvironmentBase
());
connect
(
m_baseEnvironmentComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
baseEnvironmentComboBoxChanged
(
int
)));
connect
(
m_workingDirectoryEdit
,
SIGNAL
(
changed
(
QString
)),
this
,
SLOT
(
setWorkingDirectory
()));
...
...
@@ -279,25 +288,20 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
connect
(
resetButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
resetWorkingDirectory
()));
if
(
cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
CleanEnvironmentBase
)
m_cleanEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
SystemEnvironmentBase
)
m_systemEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
BuildEnvironmentBase
)
m_buildEnvironmentRadioButton
->
setChecked
(
true
);
connect
(
m_cleanEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_systemEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_buildEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
m_environmentWidget
=
new
ProjectExplorer
::
EnvironmentWidget
(
this
);
m_environmentWidget
->
setBaseEnvironment
(
m_cmakeRunConfiguration
->
baseEnvironment
());
m_environmentWidget
->
setUserChanges
(
m_cmakeRunConfiguration
->
userEnvironmentChanges
());
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
m_baseEnvironmentComboBox
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
m_baseEnvironmentComboBox
,
SLOT
(
show
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
label
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
label
,
SLOT
(
show
()));
boxLayout
->
addWidget
(
m_environmentWidget
);
QVBoxLayout
*
vbx
=
new
QVBoxLayout
(
this
);
...
...
@@ -343,15 +347,10 @@ void CMakeRunConfigurationWidget::userChangesUpdated()
m_cmakeRunConfiguration
->
setUserEnvironmentChanges
(
m_environmentWidget
->
userChanges
());
}
void
CMakeRunConfigurationWidget
::
baseEnvironment
RadioButtonChanged
(
)
void
CMakeRunConfigurationWidget
::
baseEnvironment
ComboBoxChanged
(
int
index
)
{
m_ignoreChange
=
true
;
if
(
m_cleanEnvironmentRadioButton
->
isChecked
())
m_cmakeRunConfiguration
->
setBaseEnvironmentBase
(
CMakeRunConfiguration
::
CleanEnvironmentBase
);
else
if
(
m_systemEnvironmentRadioButton
->
isChecked
())
m_cmakeRunConfiguration
->
setBaseEnvironmentBase
(
CMakeRunConfiguration
::
SystemEnvironmentBase
);
else
if
(
m_buildEnvironmentRadioButton
->
isChecked
())
m_cmakeRunConfiguration
->
setBaseEnvironmentBase
(
CMakeRunConfiguration
::
BuildEnvironmentBase
);
m_cmakeRunConfiguration
->
setBaseEnvironmentBase
(
CMakeRunConfiguration
::
BaseEnvironmentBase
(
index
));
m_environmentWidget
->
setBaseEnvironment
(
m_cmakeRunConfiguration
->
baseEnvironment
());
m_ignoreChange
=
false
;
...
...
@@ -362,13 +361,7 @@ void CMakeRunConfigurationWidget::baseEnvironmentChanged()
if
(
m_ignoreChange
)
return
;
if
(
m_cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
CleanEnvironmentBase
)
m_cleanEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
m_cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
SystemEnvironmentBase
)
m_systemEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
m_cmakeRunConfiguration
->
baseEnvironmentBase
()
==
CMakeRunConfiguration
::
BuildEnvironmentBase
)
m_buildEnvironmentRadioButton
->
setChecked
(
true
);
m_baseEnvironmentComboBox
->
setCurrentIndex
(
m_cmakeRunConfiguration
->
baseEnvironmentBase
());
m_environmentWidget
->
setBaseEnvironment
(
m_cmakeRunConfiguration
->
baseEnvironment
());
}
...
...
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
View file @
abeb4504
...
...
@@ -37,7 +37,7 @@
#include <utils/pathchooser.h>
QT_BEGIN_NAMESPACE
class
Q
RadioButton
;
class
Q
ComboBox
;
QT_END_NAMESPACE
namespace
CMakeProjectManager
{
...
...
@@ -81,7 +81,9 @@ signals:
private
slots
:
void
setArguments
(
const
QString
&
newText
);
private:
enum
BaseEnvironmentBase
{
CleanEnvironmentBase
,
SystemEnvironmentBase
,
BuildEnvironmentBase
};
enum
BaseEnvironmentBase
{
CleanEnvironmentBase
=
0
,
SystemEnvironmentBase
=
1
,
BuildEnvironmentBase
=
2
};
void
setBaseEnvironmentBase
(
BaseEnvironmentBase
env
);
BaseEnvironmentBase
baseEnvironmentBase
()
const
;
ProjectExplorer
::
Environment
baseEnvironment
()
const
;
...
...
@@ -111,16 +113,15 @@ private slots:
void
setWorkingDirectory
();
void
resetWorkingDirectory
();
private
slots
:
void
baseEnvironment
RadioButtonChanged
(
);
void
baseEnvironment
ComboBoxChanged
(
int
index
);
void
workingDirectoryChanged
(
const
QString
&
workingDirectory
);
private:
bool
m_ignoreChange
;
CMakeRunConfiguration
*
m_cmakeRunConfiguration
;
Core
::
Utils
::
PathChooser
*
m_workingDirectoryEdit
;
QComboBox
*
m_baseEnvironmentComboBox
;
ProjectExplorer
::
EnvironmentWidget
*
m_environmentWidget
;
QRadioButton
*
m_cleanEnvironmentRadioButton
;
QRadioButton
*
m_systemEnvironmentRadioButton
;
QRadioButton
*
m_buildEnvironmentRadioButton
;
};
class
CMakeRunConfigurationFactory
:
public
ProjectExplorer
::
IRunConfigurationFactory
...
...
src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
View file @
abeb4504
...
...
@@ -43,7 +43,7 @@
#include <QtGui/QToolButton>
#include <QtGui/QFileDialog>
#include <QtGui/QGroupBox>
#include <QtGui/Q
RadioButton
>
#include <QtGui/Q
ComboBox
>
#include <QDialogButtonBox>
using
namespace
ProjectExplorer
;
...
...
@@ -93,35 +93,39 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
box
->
setLayout
(
boxLayout
);
box
->
setFlat
(
true
);
QFormLayout
*
formlayout
=
new
QFormLayout
();
QLabel
*
label
=
new
QLabel
(
tr
(
"Base environment for this runconfiguration:"
),
this
);
boxLayout
->
addWidget
(
label
);
m_cleanEnvironmentRadioButton
=
new
QRadioButton
(
"Clean Environment"
,
box
);
m_systemEnvironmentRadioButton
=
new
QRadioButton
(
"System Environment"
,
box
);
m_buildEnvironmentRadioButton
=
new
QRadioButton
(
"Build Environment"
,
box
);
boxLayout
->
addWidget
(
m_cleanEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_systemEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_buildEnvironmentRadioButton
);
if
(
rc
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
CleanEnvironmentBase
)
m_cleanEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
rc
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
SystemEnvironmentBase
)
m_systemEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
rc
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
BuildEnvironmentBase
)
m_buildEnvironmentRadioButton
->
setChecked
(
true
);
connect
(
m_cleanEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_systemEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_buildEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
m_baseEnvironmentComboBox
=
new
QComboBox
(
box
);
m_baseEnvironmentComboBox
->
addItems
(
QStringList
()
<<
tr
(
"Clean Environment"
)
<<
tr
(
"System Environment"
)
<<
tr
(
"Build Environment"
));
formlayout
->
addRow
(
label
,
m_baseEnvironmentComboBox
);
boxLayout
->
addLayout
(
formlayout
);
label
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setCurrentIndex
(
rc
->
baseEnvironmentBase
());
connect
(
m_baseEnvironmentComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
baseEnvironmentComboBoxChanged
(
int
)));
m_environmentWidget
=
new
EnvironmentWidget
(
this
);
m_environmentWidget
->
setBaseEnvironment
(
rc
->
baseEnvironment
());
m_environmentWidget
->
setUserChanges
(
rc
->
userEnvironmentChanges
());
boxLayout
->
addWidget
(
m_environmentWidget
);
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
m_baseEnvironmentComboBox
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
m_baseEnvironmentComboBox
,
SLOT
(
show
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
label
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
label
,
SLOT
(
show
()));
QVBoxLayout
*
vbox
=
new
QVBoxLayout
(
this
);
vbox
->
addLayout
(
layout
);
vbox
->
addWidget
(
box
);
...
...
@@ -155,15 +159,10 @@ void CustomExecutableConfigurationWidget::userChangesUpdated()
m_runConfiguration
->
setUserEnvironmentChanges
(
m_environmentWidget
->
userChanges
());
}
void
CustomExecutableConfigurationWidget
::
baseEnvironment
RadioButtonChanged
(
)
void
CustomExecutableConfigurationWidget
::
baseEnvironment
ComboBoxChanged
(
int
index
)
{
m_ignoreChange
=
true
;
if
(
m_cleanEnvironmentRadioButton
->
isChecked
())
m_runConfiguration
->
setBaseEnvironmentBase
(
CustomExecutableRunConfiguration
::
CleanEnvironmentBase
);
else
if
(
m_systemEnvironmentRadioButton
->
isChecked
())
m_runConfiguration
->
setBaseEnvironmentBase
(
CustomExecutableRunConfiguration
::
SystemEnvironmentBase
);
else
if
(
m_buildEnvironmentRadioButton
->
isChecked
())
m_runConfiguration
->
setBaseEnvironmentBase
(
CustomExecutableRunConfiguration
::
BuildEnvironmentBase
);
m_runConfiguration
->
setBaseEnvironmentBase
(
CustomExecutableRunConfiguration
::
BaseEnvironmentBase
(
index
));
m_environmentWidget
->
setBaseEnvironment
(
m_runConfiguration
->
baseEnvironment
());
m_ignoreChange
=
false
;
...
...
@@ -174,13 +173,7 @@ void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
if
(
m_ignoreChange
)
return
;
if
(
m_runConfiguration
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
CleanEnvironmentBase
)
m_cleanEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
m_runConfiguration
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
SystemEnvironmentBase
)
m_systemEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
m_runConfiguration
->
baseEnvironmentBase
()
==
CustomExecutableRunConfiguration
::
BuildEnvironmentBase
)
m_buildEnvironmentRadioButton
->
setChecked
(
true
);
m_baseEnvironmentComboBox
->
setCurrentIndex
(
CustomExecutableRunConfiguration
::
BaseEnvironmentBase
(
m_runConfiguration
->
baseEnvironmentBase
()));
m_environmentWidget
->
setBaseEnvironment
(
m_runConfiguration
->
baseEnvironment
());
}
...
...
src/plugins/projectexplorer/customexecutablerunconfiguration.h
View file @
abeb4504
...
...
@@ -40,7 +40,7 @@
QT_BEGIN_NAMESPACE
class
QCheckBox
;
class
QLineEdit
;
class
Q
RadioButton
;
class
Q
ComboBox
;
QT_END_NAMESPACE
namespace
ProjectExplorer
{
...
...
@@ -101,7 +101,9 @@ signals:
private:
enum
BaseEnvironmentBase
{
CleanEnvironmentBase
,
SystemEnvironmentBase
,
BuildEnvironmentBase
};
enum
BaseEnvironmentBase
{
CleanEnvironmentBase
=
0
,
SystemEnvironmentBase
=
1
,
BuildEnvironmentBase
=
2
};
void
setBaseEnvironmentBase
(
BaseEnvironmentBase
env
);
BaseEnvironmentBase
baseEnvironmentBase
()
const
;
ProjectExplorer
::
Environment
baseEnvironment
()
const
;
...
...
@@ -158,7 +160,7 @@ private slots:
void
userChangesUpdated
();
void
baseEnvironmentChanged
();
void
userEnvironmentChangesChanged
();
void
baseEnvironment
RadioButtonChanged
(
);
void
baseEnvironment
ComboBoxChanged
(
int
index
);
private:
bool
m_ignoreChange
;
CustomExecutableRunConfiguration
*
m_runConfiguration
;
...
...
@@ -168,9 +170,7 @@ private:
Core
::
Utils
::
PathChooser
*
m_workingDirectory
;
QCheckBox
*
m_useTerminalCheck
;
ProjectExplorer
::
EnvironmentWidget
*
m_environmentWidget
;
QRadioButton
*
m_cleanEnvironmentRadioButton
;
QRadioButton
*
m_systemEnvironmentRadioButton
;
QRadioButton
*
m_buildEnvironmentRadioButton
;
QComboBox
*
m_baseEnvironmentComboBox
;
};
}
// namespace Internal
...
...
src/plugins/projectexplorer/environmenteditmodel.cpp
View file @
abeb4504
...
...
@@ -424,19 +424,42 @@ void EnvironmentModel::setUserChanges(QList<EnvironmentItem> list)
////
EnvironmentWidget
::
EnvironmentWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
:
Q
Stacked
Widget
(
parent
)
{
m_model
=
new
EnvironmentModel
();
m_model
->
setMergedEnvironments
(
true
);
connect
(
m_model
,
SIGNAL
(
userChangesUpdated
()),
this
,
SIGNAL
(
userChangesUpdated
()));
QHBoxLayout
*
horizontalLayout
=
new
QHBoxLayout
(
this
);
m_summaryPage
=
new
QWidget
();
addWidget
(
m_summaryPage
);
QVBoxLayout
*
vbox
=
new
QVBoxLayout
(
m_summaryPage
);
m_summaryText
=
new
QLabel
(
this
);
m_summaryText
->
setText
(
""
);
vbox
->
addWidget
(
m_summaryText
);
QPushButton
*
detailsButton
=
new
QPushButton
(
this
);
detailsButton
->
setText
(
tr
(
"Show Details"
));
QHBoxLayout
*
hdetailsButtonLayout
=
new
QHBoxLayout
();
hdetailsButtonLayout
->
addWidget
(
detailsButton
);
hdetailsButtonLayout
->
addSpacerItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
));
vbox
->
addLayout
(
hdetailsButtonLayout
);
connect
(
detailsButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
switchToDetails
()));
m_detailsPage
=
new
QWidget
();
//addWidget(m_detailsPage);
QVBoxLayout
*
vbox2
=
new
QVBoxLayout
(
m_detailsPage
);
QHBoxLayout
*
horizontalLayout
=
new
QHBoxLayout
();
m_environmentTreeView
=
new
QTreeView
(
this
);
m_environmentTreeView
->
setRootIsDecorated
(
false
);
m_environmentTreeView
->
setHeaderHidden
(
false
);
m_environmentTreeView
->
setModel
(
m_model
);
m_environmentTreeView
->
header
()
->
resizeSection
(
0
,
250
);
m_environmentTreeView
->
setMinimumHeight
(
400
);
horizontalLayout
->
addWidget
(
m_environmentTreeView
);
QVBoxLayout
*
verticalLayout_2
=
new
QVBoxLayout
();
...
...
@@ -462,6 +485,18 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent)
QSpacerItem
*
verticalSpacer
=
new
QSpacerItem
(
20
,
40
,
QSizePolicy
::
Minimum
,
QSizePolicy
::
Expanding
);
verticalLayout_2
->
addItem
(
verticalSpacer
);
horizontalLayout
->
addLayout
(
verticalLayout_2
);
vbox2
->
addLayout
(
horizontalLayout
);
QHBoxLayout
*
hbox
=
new
QHBoxLayout
();
QPushButton
*
summaryButton
=
new
QPushButton
(
this
);
summaryButton
->
setText
(
tr
(
"Hide Details"
));
hbox
->
addWidget
(
summaryButton
);
connect
(
summaryButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
switchToSummary
()));
hbox
->
addSpacerItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
));
vbox2
->
addLayout
(
hbox
);
connect
(
m_model
,
SIGNAL
(
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)),
this
,
SLOT
(
updateButtons
()));
...
...
@@ -480,10 +515,30 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent)
EnvironmentWidget
::~
EnvironmentWidget
()
{
delete
m_summaryPage
;
delete
m_detailsPage
;
delete
m_model
;
m_model
=
0
;
}
void
EnvironmentWidget
::
switchToDetails
()
{
addWidget
(
m_detailsPage
);
setCurrentWidget
(
m_detailsPage
);
removeWidget
(
m_summaryPage
);
emit
switchedToDetails
();
}
void
EnvironmentWidget
::
switchToSummary
()
{
updateSummaryText
();
addWidget
(
m_summaryPage
);
setCurrentWidget
(
m_summaryPage
);
removeWidget
(
m_detailsPage
);
emit
switchedToSummary
();
}
void
EnvironmentWidget
::
setBaseEnvironment
(
const
ProjectExplorer
::
Environment
&
env
)
{
m_model
->
setBaseEnvironment
(
env
);
...
...
@@ -507,6 +562,24 @@ QList<EnvironmentItem> EnvironmentWidget::userChanges() const
void
EnvironmentWidget
::
setUserChanges
(
QList
<
EnvironmentItem
>
list
)
{
m_model
->
setUserChanges
(
list
);
updateSummaryText
();
}
void
EnvironmentWidget
::
updateSummaryText
()
{
QString
text
;
const
QList
<
EnvironmentItem
>
&
list
=
m_model
->
userChanges
();
foreach
(
const
EnvironmentItem
&
item
,
list
)
{
if
(
!
text
.
isEmpty
())
text
.
append
(
"<br>"
);
if
(
item
.
unset
)
text
.
append
(
tr
(
"Unset <b>%1</b>"
).
arg
(
item
.
name
));
else
text
.
append
(
tr
(
"Set <b>%1</b> to <b>%2</b>"
).
arg
(
item
.
name
,
item
.
value
));
}
if
(
text
.
isEmpty
())
text
=
tr
(
"No changes to Environment"
);
m_summaryText
->
setText
(
text
);
}
void
EnvironmentWidget
::
updateButtons
()
...
...
src/plugins/projectexplorer/environmenteditmodel.h
View file @
abeb4504
...
...
@@ -39,10 +39,12 @@
#include <QtGui/QCheckBox>
#include <QtGui/QTreeView>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QStackedWidget>
namespace
ProjectExplorer
{
class
PROJECTEXPLORER_EXPORT
EnvironmentModel
:
public
QAbstractItemModel
class
EnvironmentModel
:
public
QAbstractItemModel
{
Q_OBJECT
public:
...
...
@@ -87,8 +89,7 @@ private:
bool
m_mergedEnvironments
;
};
class
PROJECTEXPLORER_EXPORT
EnvironmentWidget
:
public
QWidget
class
PROJECTEXPLORER_EXPORT
EnvironmentWidget
:
public
QStackedWidget
{
Q_OBJECT
public:
...
...
@@ -105,9 +106,13 @@ public:
public
slots
:
void
updateButtons
();
void
switchToSummary
();
void
switchToDetails
();
signals:
void
userChangesUpdated
();
void
switchedToDetails
();
void
switchedToSummary
();
private
slots
:
void
editEnvironmentButtonClicked
();
...
...
@@ -117,12 +122,18 @@ private slots:
void
environmentCurrentIndexChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
private:
void
updateSummaryText
();
EnvironmentModel
*
m_model
;
QWidget
*
m_summaryPage
;
QWidget
*
m_detailsPage
;
QLabel
*
m_summaryText
;
QTreeView
*
m_environmentTreeView
;
QPushButton
*
m_editButton
;
QPushButton
*
m_addButton
;
QPushButton
*
m_removeButton
;
QPushButton
*
m_unsetButton
;
};
}
// namespace ProjectExplorer
...
...
src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp
View file @
abeb4504
...
...
@@ -38,7 +38,6 @@ bool debug = false;
using
namespace
Qt4ProjectManager
;
using
namespace
Qt4ProjectManager
::
Internal
;
using
ProjectExplorer
::
EnvironmentModel
;
Qt4BuildEnvironmentWidget
::
Qt4BuildEnvironmentWidget
(
Qt4Project
*
project
)
:
BuildStepConfigWidget
(),
m_pro
(
project
)
...
...
@@ -48,12 +47,20 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
m_clearSystemEnvironmentCheckBox
=
new
QCheckBox
(
this
);
m_clearSystemEnvironmentCheckBox
->
setText
(
"Clear system environment"
);
vbox
->
addWidget
(
m_clearSystemEnvironmentCheckBox
);
m_clearSystemEnvironmentCheckBox
->
setVisible
(
false
);
m_buildEnvironmentWidget
=
new
ProjectExplorer
::
EnvironmentWidget
(
this
);
vbox
->
addWidget
(
m_buildEnvironmentWidget
);
connect
(
m_buildEnvironmentWidget
,
SIGNAL
(
userChangesUpdated
()),
this
,
SLOT
(
environmentModelUserChangesUpdated
()));
connect
(
m_buildEnvironmentWidget
,
SIGNAL
(
switchedToDetails
()),
m_clearSystemEnvironmentCheckBox
,
SLOT
(
show
()));
connect
(
m_buildEnvironmentWidget
,
SIGNAL
(
switchedToSummary
()),
m_clearSystemEnvironmentCheckBox
,
SLOT
(
hide
()));
connect
(
m_clearSystemEnvironmentCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
clearSystemEnvironmentCheckBoxClicked
(
bool
)));
}
...
...
src/plugins/qt4projectmanager/qt4runconfiguration.cpp
View file @
abeb4504
...
...
@@ -48,7 +48,7 @@
#include <QtGui/QCheckBox>
#include <QtGui/QToolButton>
#include <QtGui/QGroupBox>
#include <QtGui/Q
RadioButton
>
#include <QtGui/Q
ComboBox
>
using
namespace
Qt4ProjectManager
::
Internal
;
using
namespace
Qt4ProjectManager
;
...
...
@@ -159,36 +159,28 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
this
,
SLOT
(
usingDyldImageSuffixToggled
(
bool
)));
#endif
QGroupBox
*
box
=
new
QGroupBox
(
tr
(
"Environment"
),
this
);
QVBoxLayout
*
boxLayout
=
new
QVBoxLayout
();
box
->
setLayout
(
boxLayout
);
box
->
setFlat
(
true
);
QFormLayout
*
formlayout
=
new
QFormLayout
();
QLabel
*
label
=
new
QLabel
(
tr
(
"Base environment for this runconfiguration:"
),
this
);
boxLayout
->
addWidget
(
label
);
m_cleanEnvironmentRadioButton
=
new
QRadioButton
(
"Clean Environment"
,
box
);
m_systemEnvironmentRadioButton
=
new
QRadioButton
(
"System Environment"
,
box
);
m_buildEnvironmentRadioButton
=
new
QRadioButton
(
"Build Environment"
,
box
);
boxLayout
->
addWidget
(
m_cleanEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_systemEnvironmentRadioButton
);
boxLayout
->
addWidget
(
m_buildEnvironmentRadioButton
);
if
(
qt4RunConfiguration
->
baseEnvironmentBase
()
==
Qt4RunConfiguration
::
CleanEnvironmentBase
)
m_cleanEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
qt4RunConfiguration
->
baseEnvironmentBase
()
==
Qt4RunConfiguration
::
SystemEnvironmentBase
)
m_systemEnvironmentRadioButton
->
setChecked
(
true
);
else
if
(
qt4RunConfiguration
->
baseEnvironmentBase
()
==
Qt4RunConfiguration
::
BuildEnvironmentBase
)
m_buildEnvironmentRadioButton
->
setChecked
(
true
);
connect
(
m_cleanEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_systemEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
connect
(
m_buildEnvironmentRadioButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
baseEnvironmentRadioButtonChanged
()));
m_baseEnvironmentComboBox
=
new
QComboBox
(
box
);
m_baseEnvironmentComboBox
->
addItems
(
QStringList
()
<<
tr
(
"Clean Environment"
)
<<
tr
(
"System Environment"
)
<<
tr
(
"Build Environment"
));
formlayout
->
addRow
(
label
,
m_baseEnvironmentComboBox
);
boxLayout
->
addLayout
(
formlayout
);
label
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setVisible
(
false
);
m_baseEnvironmentComboBox
->
setCurrentIndex
(
qt4RunConfiguration
->
baseEnvironmentBase
());
connect
(
m_baseEnvironmentComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
baseEnvironmentComboBoxChanged
(
int
)));
m_environmentWidget
=
new
ProjectExplorer
::
EnvironmentWidget
(
this
);
m_environmentWidget
->
setBaseEnvironment
(
m_qt4RunConfiguration
->
baseEnvironment
());
...
...
@@ -196,6 +188,16 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
m_environmentWidget
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
);
boxLayout
->
addWidget
(
m_environmentWidget
);
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
m_baseEnvironmentComboBox
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
m_baseEnvironmentComboBox
,
SLOT
(
show
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToSummary
()),
label
,
SLOT
(
hide
()));
connect
(
m_environmentWidget
,
SIGNAL
(
switchedToDetails
()),
label
,
SLOT
(
show
()));
QVBoxLayout
*
vbox
=
new
QVBoxLayout
(
this
);
vbox
->
addLayout
(
toplayout
);
vbox
->
addWidget
(
box
);
...
...
@@ -237,15 +239,10 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
this
,
SLOT
(
baseEnvironmentChanged
()));
}
void
Qt4RunConfigurationWidget
::
baseEnvironment
RadioButtonChanged
(
)