core: qPref replace COPY_TXT with copy_txt in qPrefPrivate

Add copy_txt function to qPrefPrivate class
Remove macro COPY_TXT from qPrefPrivate.h
Replace use of COPY_TXT with copy_txt in qPref classes

copy_txt is only once, COPY_TXT was expanded approx. 160 times, so
this commit saves space (and removes a macro).

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-07-18 20:47:59 +02:00 committed by Dirk Hohndel
parent 597aa75348
commit f1648d297b
4 changed files with 17 additions and 15 deletions

View file

@ -35,8 +35,8 @@ void qPrefCloudStorage::set_cloud_base_url(const QString& value)
if (value != prefs.cloud_base_url) {
// only free and set if not default
if (prefs.cloud_base_url != default_prefs.cloud_base_url) {
COPY_TXT(cloud_base_url, value);
COPY_TXT(cloud_git_url, QString(prefs.cloud_base_url) + "/git");
qPrefPrivate::copy_txt(&prefs.cloud_base_url, value);
qPrefPrivate::copy_txt(&prefs.cloud_git_url, QString(prefs.cloud_base_url) + "/git");
}
disk_cloud_base_url(true);
@ -55,7 +55,7 @@ void qPrefCloudStorage::set_cloud_git_url(const QString& value)
if (value != prefs.cloud_git_url) {
// only free and set if not default
if (prefs.cloud_git_url != default_prefs.cloud_git_url) {
COPY_TXT(cloud_git_url, value);
qPrefPrivate::copy_txt(&prefs.cloud_git_url, value);
}
disk_cloud_git_url(true);
emit cloud_git_url_changed(value);
@ -73,7 +73,7 @@ void qPrefCloudStorage::set_cloud_storage_newpassword(const QString& value)
if (value == prefs.cloud_storage_newpassword)
return;
COPY_TXT(cloud_storage_newpassword, value);
qPrefPrivate::copy_txt(&prefs.cloud_storage_newpassword, value);
// NOT saved on disk, because it is only temporary
emit cloud_storage_newpassword_changed(value);
@ -83,7 +83,7 @@ GET_PREFERENCE_TXT(CloudStorage, cloud_storage_password);
void qPrefCloudStorage::set_cloud_storage_password(const QString& value)
{
if (value != prefs.cloud_storage_password) {
COPY_TXT(cloud_storage_password,value);
qPrefPrivate::copy_txt(&prefs.cloud_storage_password, value);
disk_cloud_storage_password(true);
emit cloud_storage_password_changed(value);
}