Commit 50f87107 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Use a type alias for the Profile Property map

parent a27a22ff
......@@ -220,7 +220,7 @@ void Profile::useBuiltin()
}
Profile::Profile(const Profile::Ptr &parent)
: _propertyValues(QHash<Property, QVariant>())
: _propertyValues(PropertyMap())
, _parent(parent)
, _hidden(false)
{
......@@ -270,7 +270,7 @@ bool Profile::isEmpty() const
return _propertyValues.isEmpty();
}
QHash<Profile::Property, QVariant> Profile::setProperties() const
Profile::PropertyMap Profile::setProperties() const
{
return _propertyValues;
}
......
......@@ -366,6 +366,8 @@ public:
Q_ENUM(Property)
using PropertyMap = QHash<Property, QVariant>;
/**
* Constructs a new profile
*
......@@ -430,7 +432,7 @@ public:
virtual bool isPropertySet(Property p) const;
/** Returns a map of the properties set in this Profile instance. */
virtual QHash<Property, QVariant> setProperties() const;
virtual PropertyMap setProperties() const;
/** Returns true if no properties have been set in this Profile instance. */
bool isEmpty() const;
......@@ -795,7 +797,7 @@ private:
// returns true if the property can be inherited
static bool canInheritProperty(Property p);
QHash<Property, QVariant> _propertyValues;
PropertyMap _propertyValues;
Ptr _parent;
bool _hidden;
......
......@@ -18,9 +18,9 @@
using namespace Konsole;
QHash<Profile::Property, QVariant> ProfileCommandParser::parse(const QString &input)
Profile::PropertyMap ProfileCommandParser::parse(const QString &input)
{
QHash<Profile::Property, QVariant> changes;
Profile::PropertyMap changes;
// regular expression to parse profile change requests.
//
......
......@@ -44,7 +44,7 @@ public:
* and assigned values and returns a table of
* properties and values.
*/
QHash<Profile::Property, QVariant> parse(const QString &input);
Profile::PropertyMap parse(const QString &input);
};
}
......
......@@ -267,7 +267,7 @@ QString ProfileManager::saveProfile(const Profile::Ptr &profile)
return newPath;
}
void ProfileManager::changeProfile(Profile::Ptr profile, QHash<Profile::Property, QVariant> propertyMap, bool persistent)
void ProfileManager::changeProfile(Profile::Ptr profile, Profile::PropertyMap propertyMap, bool persistent)
{
Q_ASSERT(profile);
......
......@@ -132,7 +132,7 @@ public:
* set this to false if you want to preview possible changes to a profile but do not
* wish to make them permanent.
*/
void changeProfile(Profile::Ptr profile, QHash<Profile::Property, QVariant> propertyMap, bool persistent = true);
void changeProfile(Profile::Ptr profile, Profile::PropertyMap propertyMap, bool persistent = true);
/**
* Sets the @p profile as the default profile for creating new sessions
......
......@@ -312,7 +312,7 @@ void SessionManager::sessionProfileCommandReceived(Session *session, const QStri
}
ProfileCommandParser parser;
QHash<Profile::Property, QVariant> changes = parser.parse(text);
Profile::PropertyMap changes = parser.parse(text);
Profile::Ptr newProfile;
if (!_sessionRuntimeProfiles.contains(session)) {
......
......@@ -1043,7 +1043,7 @@ void EditProfileDialog::unpreviewAll()
_delayedPreviewTimer->stop();
_delayedPreviewProperties.clear();
QHash<Profile::Property, QVariant> map;
Profile::PropertyMap map;
QHashIterator<int, QVariant> iter(_previewedProperties);
while (iter.hasNext()) {
iter.next();
......@@ -1064,7 +1064,7 @@ void EditProfileDialog::unpreview(int property)
return;
}
QHash<Profile::Property, QVariant> map;
Profile::PropertyMap map;
map.insert(static_cast<Profile::Property>(property), _previewedProperties[property]);
ProfileManager::instance()->changeProfile(_profile, map, false);
......@@ -1092,7 +1092,7 @@ void EditProfileDialog::delayedPreviewActivate()
void EditProfileDialog::preview(int property, const QVariant &value)
{
QHash<Profile::Property, QVariant> map;
Profile::PropertyMap map;
map.insert(static_cast<Profile::Property>(property), value);
_delayedPreviewProperties.remove(property);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment