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