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
599b2121
Commit
599b2121
authored
May 27, 2009
by
dt
Browse files
Add environment widget to the custom executable runconfiguration.
parent
10151809
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
View file @
599b2121
...
...
@@ -75,7 +75,6 @@ private:
void
setUserEnvironmentChanges
(
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
);
QList
<
ProjectExplorer
::
EnvironmentItem
>
userEnvironmentChanges
()
const
;
RunMode
m_runMode
;
QString
m_target
;
QString
m_workingDirectory
;
...
...
src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
View file @
599b2121
...
...
@@ -63,10 +63,8 @@ public:
};
CustomExecutableConfigurationWidget
::
CustomExecutableConfigurationWidget
(
CustomExecutableRunConfiguration
*
rc
)
:
m_ignoreChange
(
false
)
:
m_ignoreChange
(
false
)
,
m_runConfiguration
(
rc
)
{
m_runConfiguration
=
rc
;
QFormLayout
*
layout
=
new
QFormLayout
;
layout
->
setMargin
(
0
);
...
...
@@ -88,7 +86,14 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
m_useTerminalCheck
=
new
QCheckBox
(
tr
(
"Run in &Terminal"
),
this
);
layout
->
addRow
(
QString
(),
m_useTerminalCheck
);
setLayout
(
layout
);
m_environmentWidget
=
new
EnvironmentWidget
(
this
);
m_environmentWidget
->
setBaseEnvironment
(
rc
->
baseEnvironment
());
m_environmentWidget
->
setUserChanges
(
rc
->
userEnvironmentChanges
());
QVBoxLayout
*
vbox
=
new
QVBoxLayout
(
this
);
vbox
->
addLayout
(
layout
);
vbox
->
addWidget
(
m_environmentWidget
);
changed
();
connect
(
m_userName
,
SIGNAL
(
textEdited
(
QString
)),
...
...
@@ -103,8 +108,32 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
this
,
SLOT
(
termToggled
(
bool
)));
connect
(
m_runConfiguration
,
SIGNAL
(
changed
()),
this
,
SLOT
(
changed
()));
connect
(
m_environmentWidget
,
SIGNAL
(
userChangesUpdated
()),
this
,
SLOT
(
userChangesUpdated
()));
connect
(
m_runConfiguration
,
SIGNAL
(
baseEnvironmentChanged
()),
this
,
SLOT
(
baseEnvironmentChanged
()));
connect
(
m_runConfiguration
,
SIGNAL
(
userEnvironmentChangesChanged
(
QList
<
ProjectExplorer
::
EnvironmentItem
>
)),
this
,
SLOT
(
userEnvironmentChangesChanged
()));
}
void
CustomExecutableConfigurationWidget
::
userChangesUpdated
()
{
m_runConfiguration
->
setUserEnvironmentChanges
(
m_environmentWidget
->
userChanges
());
}
void
CustomExecutableConfigurationWidget
::
baseEnvironmentChanged
()
{
m_environmentWidget
->
setBaseEnvironment
(
m_runConfiguration
->
baseEnvironment
());
}
void
CustomExecutableConfigurationWidget
::
userEnvironmentChangesChanged
()
{
m_environmentWidget
->
setUserChanges
(
m_runConfiguration
->
userEnvironmentChanges
());
}
void
CustomExecutableConfigurationWidget
::
setExecutable
()
{
m_ignoreChange
=
true
;
...
...
@@ -158,6 +187,13 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
{
m_workingDirectory
=
"$BUILDDIR"
;
setName
(
tr
(
"Custom Executable"
));
connect
(
pro
,
SIGNAL
(
activeBuildConfigurationChanged
()),
this
,
SIGNAL
(
baseEnvironmentChanged
()));
connect
(
pro
,
SIGNAL
(
environmentChanged
(
QString
)),
this
,
SIGNAL
(
baseEnvironmentChanged
()));
}
CustomExecutableRunConfiguration
::~
CustomExecutableRunConfiguration
()
...
...
@@ -241,11 +277,37 @@ QStringList CustomExecutableRunConfiguration::commandLineArguments() const
return
m_cmdArguments
;
}
Environment
CustomExecutableRunConfiguration
::
environment
()
const
ProjectExplorer
::
Environment
CustomExecutableRunConfiguration
::
baseEnvironment
()
const
{
// TODO use either System Environment
// build environment
// or empty
//Environment env = Environment(QProcess::systemEnvironment());
QString
config
=
project
()
->
activeBuildConfiguration
();
ProjectExplorer
::
Environment
env
=
project
()
->
environment
(
project
()
->
activeBuildConfiguration
());
return
env
;
}
ProjectExplorer
::
Environment
CustomExecutableRunConfiguration
::
environment
()
const
{
ProjectExplorer
::
Environment
env
=
baseEnvironment
();
env
.
modify
(
userEnvironmentChanges
());
return
env
;
}
QList
<
ProjectExplorer
::
EnvironmentItem
>
CustomExecutableRunConfiguration
::
userEnvironmentChanges
()
const
{
return
project
()
->
environment
(
project
()
->
activeBuildConfiguration
())
;
return
m_userEnvironmentChanges
;
}
void
CustomExecutableRunConfiguration
::
setUserEnvironmentChanges
(
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
)
{
if
(
m_userEnvironmentChanges
!=
diff
)
{
m_userEnvironmentChanges
=
diff
;
emit
userEnvironmentChangesChanged
(
diff
);
}
}
void
CustomExecutableRunConfiguration
::
save
(
PersistentSettingsWriter
&
writer
)
const
{
...
...
@@ -255,6 +317,7 @@ void CustomExecutableRunConfiguration::save(PersistentSettingsWriter &writer) co
writer
.
saveValue
(
"UseTerminal"
,
m_runMode
==
Console
);
writer
.
saveValue
(
"UserSetName"
,
m_userSetName
);
writer
.
saveValue
(
"UserName"
,
m_userName
);
writer
.
saveValue
(
"UserEnvironmentChanges"
,
ProjectExplorer
::
EnvironmentItem
::
toStringList
(
m_userEnvironmentChanges
));
ApplicationRunConfiguration
::
save
(
writer
);
}
...
...
@@ -266,6 +329,7 @@ void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &r
m_runMode
=
reader
.
restoreValue
(
"UseTerminal"
).
toBool
()
?
Console
:
Gui
;
m_userSetName
=
reader
.
restoreValue
(
"UserSetName"
).
toBool
();
m_userName
=
reader
.
restoreValue
(
"UserName"
).
toString
();
m_userEnvironmentChanges
=
ProjectExplorer
::
EnvironmentItem
::
fromStringList
(
reader
.
restoreValue
(
"UserEnvironmentChanges"
).
toStringList
());
ApplicationRunConfiguration
::
restore
(
reader
);
}
...
...
src/plugins/projectexplorer/customexecutablerunconfiguration.h
View file @
599b2121
...
...
@@ -33,6 +33,7 @@
#include
"applicationrunconfiguration.h"
#include
<utils/pathchooser.h>
#include
<projectexplorer/environmenteditmodel.h>
#include
<QtGui/QToolButton>
...
...
@@ -91,7 +92,15 @@ public:
signals:
void
changed
();
void
baseEnvironmentChanged
();
void
userEnvironmentChangesChanged
(
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
);
private:
ProjectExplorer
::
Environment
baseEnvironment
()
const
;
void
setUserEnvironmentChanges
(
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
);
QList
<
ProjectExplorer
::
EnvironmentItem
>
userEnvironmentChanges
()
const
;
void
setExecutable
(
const
QString
&
executable
);
void
setCommandLineArguments
(
const
QString
&
commandLineArguments
);
void
setWorkingDirectory
(
const
QString
&
workingDirectory
);
...
...
@@ -103,6 +112,7 @@ private:
RunMode
m_runMode
;
bool
m_userSetName
;
QString
m_userName
;
QList
<
ProjectExplorer
::
EnvironmentItem
>
m_userEnvironmentChanges
;
};
class
CustomExecutableRunConfigurationFactory
:
public
IRunConfigurationFactory
...
...
@@ -137,6 +147,10 @@ private slots:
void
setWorkingDirectory
();
void
termToggled
(
bool
);
void
userChangesUpdated
();
void
baseEnvironmentChanged
();
void
userEnvironmentChangesChanged
();
private:
bool
m_ignoreChange
;
CustomExecutableRunConfiguration
*
m_runConfiguration
;
...
...
@@ -145,6 +159,7 @@ private:
QLineEdit
*
m_commandLineArgumentsLineEdit
;
Core
::
Utils
::
PathChooser
*
m_workingDirectory
;
QCheckBox
*
m_useTerminalCheck
;
ProjectExplorer
::
EnvironmentWidget
*
m_environmentWidget
;
};
}
// namespace Internal
...
...
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