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
Utilities
Konsole
Commits
be1174c9
Commit
be1174c9
authored
Aug 04, 2022
by
Ahmad Samir
Browse files
Add Profile::assignProperties() method that takes a PropertyMap
parent
9bc2211f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/profile/Profile.cpp
View file @
be1174c9
...
...
@@ -280,6 +280,11 @@ void Profile::setProperty(Property p, const QVariant &value)
_propertyValues
.
insert
(
p
,
value
);
}
void
Profile
::
assignProperties
(
const
PropertyMap
&
map
)
{
_propertyValues
.
insert
(
map
);
}
bool
Profile
::
isPropertySet
(
Property
p
)
const
{
return
_propertyValues
.
contains
(
p
);
...
...
src/profile/Profile.h
View file @
be1174c9
...
...
@@ -426,6 +426,10 @@ public:
/** Sets the value of the specified @p property to @p value. */
virtual
void
setProperty
(
Property
p
,
const
QVariant
&
value
);
/** Sets the Porperty/value pairs from @p map on this Profile */
void
assignProperties
(
const
PropertyMap
&
map
);
/** Returns true if the specified property has been set in this Profile
* instance.
*/
...
...
src/profile/ProfileManager.cpp
View file @
be1174c9
...
...
@@ -281,13 +281,15 @@ void ProfileManager::changeProfile(Profile::Ptr profile, Profile::PropertyMap pr
bool
isNameChanged
=
false
;
// Insert the changes into the existing Profile instance
profile
->
assignProperties
(
propertyMap
);
// Check if the name changed
for
(
auto
it
=
propertyMap
.
cbegin
();
it
!=
propertyMap
.
cend
();
++
it
)
{
const
auto
property
=
it
.
key
();
auto
value
=
it
.
value
();
isNameChanged
|=
property
==
Profile
::
Name
||
property
==
Profile
::
UntranslatedName
;
profile
->
setProperty
(
property
,
value
);
if
(
isNameChanged
)
{
break
;
}
}
// when changing a group, iterate through the profiles
...
...
src/session/SessionManager.cpp
View file @
be1174c9
...
...
@@ -322,11 +322,7 @@ void SessionManager::sessionProfileCommandReceived(Session *session, const QStri
newProfile
=
_sessionRuntimeProfiles
[
session
];
}
QHashIterator
<
Profile
::
Property
,
QVariant
>
iter
(
changes
);
while
(
iter
.
hasNext
())
{
iter
.
next
();
newProfile
->
setProperty
(
iter
.
key
(),
iter
.
value
());
}
newProfile
->
assignProperties
(
changes
);
_sessionProfiles
[
session
]
=
newProfile
;
applyProfile
(
newProfile
,
true
);
...
...
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