Commit 0c5a853e authored by Jekyll Wu's avatar Jekyll Wu

Add helper method createTempProfile() to reduce duplicated code.

parent 709445ce
......@@ -90,8 +90,7 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
connect( _ui->tabWidget , SIGNAL(currentChanged(int)) , this ,
SLOT(preparePage(int)) );
_tempProfile = Profile::Ptr(new Profile);
_tempProfile->setHidden(true);
createTempProfile();
}
EditProfileDialog::~EditProfileDialog()
{
......@@ -113,8 +112,8 @@ void EditProfileDialog::save()
_previewedProperties.remove(iter.key());
}
_tempProfile = Profile::Ptr(new Profile);
_tempProfile->setHidden(true);
createTempProfile();
enableButtonApply(false);
}
void EditProfileDialog::reject()
......@@ -178,8 +177,7 @@ void EditProfileDialog::setProfile(Profile::Ptr profile)
if ( _tempProfile )
{
_tempProfile = Profile::Ptr(new Profile);
_tempProfile->setHidden(true);
createTempProfile();
}
}
const Profile::Ptr EditProfileDialog::lookupProfile() const
......@@ -823,6 +821,12 @@ void EditProfileDialog::updateTransparencyWarning()
}
}
void EditProfileDialog::createTempProfile()
{
_tempProfile = Profile::Ptr(new Profile);
_tempProfile->setHidden(true);
}
void EditProfileDialog::updateTempProfileProperty(Profile::Property property, const QVariant & value)
{
_tempProfile->setProperty(property, value);
......
......@@ -212,6 +212,10 @@ private:
// always come after the preview operation.
void updateTempProfileProperty(Profile::Property, const QVariant& value);
// helper method for creating an empty & hidden profile and assigning
// it to _tempProfile.
void createTempProfile();
// Enable or disable apply button, used only within
// updateTempProfileProperty().
void updateButtonApply();
......
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