Commit 75a57f79 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Remove FallbackProfile class - use method instead

Simplify code and avoid possible constructor calling virtual methods.
parent be5c66a0
......@@ -145,8 +145,7 @@ void Profile::fillTableWithDefaultNames()
filledDefaults = true;
}
FallbackProfile::FallbackProfile()
: Profile()
void Profile::useFallback()
{
// Fallback settings
setProperty(Name, i18nc("Name of the default/builtin profile", "Default"));
......
......@@ -285,6 +285,13 @@ public:
*/
void clone(Ptr profile, bool differentOnly = true);
/**
* A profile which contains a number of default settings for various
* properties. This can be used as a parent for other profiles or a
* fallback in case a profile cannot be loaded from disk.
*/
void useFallback();
/**
* Changes the parent profile. When calling the property() method,
* if the specified property has not been set for this profile,
......@@ -604,17 +611,6 @@ inline QVariant Profile::property(Property aProperty) const
}
}
/**
* A profile which contains a number of default settings for various
* properties. This can be used as a parent for other profiles or a
* fallback in case a profile cannot be loaded from disk.
*/
class FallbackProfile : public Profile
{
public:
FallbackProfile();
};
/**
* A composite profile which allows a group of profiles to be treated as one.
* When setting a property, the new value is applied to all profiles in the
......
......@@ -72,7 +72,8 @@ ProfileManager::ProfileManager()
, _loadedFavorites(false)
{
//load fallback profile
_fallbackProfile = Profile::Ptr(new FallbackProfile);
_fallbackProfile = Profile::Ptr(new Profile());
_fallbackProfile->useFallback();
addProfile(_fallbackProfile);
// lookup the default profile specified in <App>rc
......
......@@ -225,5 +225,16 @@ void ProfileTest::testProfileFileNames()
delete writer;
}
void ProfileTest::testFallbackProfile()
{
// create a new profile
Profile* fallback = new Profile();
fallback->useFallback();
QCOMPARE(fallback->property<QString>(Profile::Name), QString("Default"));
QCOMPARE(fallback->property<QString>(Profile::Path), QString("FALLBACK/"));
delete fallback;
}
QTEST_GUILESS_MAIN(ProfileTest)
......@@ -34,6 +34,7 @@ private slots:
void testClone();
void testProfileGroup();
void testProfileFileNames();
void testFallbackProfile();
};
}
......
Markdown is supported
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