Use a type alias for the Profile Property map

wilder
Ahmad Samir 4 years ago
parent a27a22ff08
commit 50f87107bd
  1. 4
      src/profile/Profile.cpp
  2. 6
      src/profile/Profile.h
  3. 4
      src/profile/ProfileCommandParser.cpp
  4. 2
      src/profile/ProfileCommandParser.h
  5. 2
      src/profile/ProfileManager.cpp
  6. 2
      src/profile/ProfileManager.h
  7. 2
      src/session/SessionManager.cpp
  8. 6
      src/widgets/EditProfileDialog.cpp

@ -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);

Loading…
Cancel
Save