Refactoring. Hide private static members.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-11 11:16:11 +03:00
parent a3056dc7e2
commit c264b80ea0
6 changed files with 183 additions and 252 deletions

View File

@ -42,35 +42,34 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
const QString VCommonSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements"); const QString settingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VCommonSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements"); const QString settingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
const QString VCommonSettings::SettingPathsTemplates = QStringLiteral("paths/templates"); const QString settingPathsTemplates = QStringLiteral("paths/templates");
const QString VCommonSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator"); const QString settingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString VCommonSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state"); const QString settingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time"); const QString settingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VCommonSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state"); const QString settingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VCommonSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale"); const QString settingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VCommonSettings::SettingPMSystemCode = QStringLiteral("configuration/pmscode"); const QString settingPMSystemCode = QStringLiteral("configuration/pmscode");
const QString VCommonSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit"); const QString settingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VCommonSettings::SettingConfigurationConfirmItemDeletion const QString settingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion");
= QStringLiteral("configuration/confirm_item_deletion"); const QString settingConfigurationToolBarStyle = QStringLiteral("configuration/tool_bar_style");
const QString VCommonSettings::SettingConfigurationToolBarStyle = QStringLiteral("configuration/tool_bar_style");
const QString VCommonSettings::SettingPatternUser = QStringLiteral("pattern/user"); const QString settingPatternUser = QStringLiteral("pattern/user");
const QString VCommonSettings::SettingPatternUndo = QStringLiteral("pattern/undo"); const QString settingPatternUndo = QStringLiteral("pattern/undo");
const QString VCommonSettings::SettingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping"); const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString VCommonSettings::SettingDoublePassmark = QStringLiteral("pattern/doublePassmark"); const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString VCommonSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList"); const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VCommonSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList"); const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry"); const QString settingGeneralGeometry = QStringLiteral("geometry");
const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState"); const QString settingGeneralWindowState = QStringLiteral("windowState");
const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState"); const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize"); const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString VCommonSettings::SettingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion"); const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString VCommonSettings::SettingDateOfLastRemind = QStringLiteral("dateOfLastRemind"); const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
const QString VCommonSettings::SettingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials"); const QString settingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials");
static const QString commonIniFilename = QStringLiteral("common"); static const QString commonIniFilename = QStringLiteral("common");
@ -236,14 +235,14 @@ QString VCommonSettings::GetDefPathIndividualMeasurements()
QString VCommonSettings::GetPathIndividualMeasurements() const QString VCommonSettings::GetPathIndividualMeasurements() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(SettingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString(); return settings.value(settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathIndividualMeasurements(const QString &value) void VCommonSettings::SetPathIndividualMeasurements(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(SettingPathsIndividualMeasurements, value); settings.setValue(settingPathsIndividualMeasurements, value);
settings.sync(); settings.sync();
} }
@ -257,14 +256,14 @@ QString VCommonSettings::GetDefPathStandardMeasurements()
QString VCommonSettings::GetPathStandardMeasurements() const QString VCommonSettings::GetPathStandardMeasurements() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(SettingPathsStandardMeasurements, GetDefPathStandardMeasurements()).toString(); return settings.value(settingPathsStandardMeasurements, GetDefPathStandardMeasurements()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathStandardMeasurements(const QString &value) void VCommonSettings::SetPathStandardMeasurements(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(SettingPathsStandardMeasurements, value); settings.setValue(settingPathsStandardMeasurements, value);
settings.sync(); settings.sync();
} }
@ -278,49 +277,49 @@ QString VCommonSettings::GetDefPathTemplate()
QString VCommonSettings::GetPathTemplate() const QString VCommonSettings::GetPathTemplate() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(SettingPathsTemplates, GetDefPathTemplate()).toString(); return settings.value(settingPathsTemplates, GetDefPathTemplate()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathTemplate(const QString &value) void VCommonSettings::SetPathTemplate(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(SettingPathsTemplates, value); settings.setValue(settingPathsTemplates, value);
settings.sync(); settings.sync();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetOsSeparator() const bool VCommonSettings::GetOsSeparator() const
{ {
return value(SettingConfigurationOsSeparator, 1).toBool(); return value(settingConfigurationOsSeparator, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetOsSeparator(const bool &value) void VCommonSettings::SetOsSeparator(const bool &value)
{ {
setValue(SettingConfigurationOsSeparator, value); setValue(settingConfigurationOsSeparator, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetAutosaveState() const bool VCommonSettings::GetAutosaveState() const
{ {
return value(SettingConfigurationAutosaveState, 1).toBool(); return value(settingConfigurationAutosaveState, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAutosaveState(const bool &value) void VCommonSettings::SetAutosaveState(const bool &value)
{ {
setValue(SettingConfigurationAutosaveState, value); setValue(settingConfigurationAutosaveState, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetAutosaveTime() const int VCommonSettings::GetAutosaveTime() const
{ {
bool ok = false; bool ok = false;
int val = value(SettingConfigurationAutosaveTime, 1).toInt(&ok); int val = value(settingConfigurationAutosaveTime, 1).toInt(&ok);
if (ok == false) if (ok == false)
{ {
qDebug()<<"Could not convert value"<<value(SettingConfigurationAutosaveTime, 1) qDebug()<<"Could not convert value"<<value(settingConfigurationAutosaveTime, 1)
<<"to int. Return default value for autosave time"<<1<<"minutes."; <<"to int. Return default value for autosave time"<<1<<"minutes.";
val = 1; val = 1;
} }
@ -330,79 +329,79 @@ int VCommonSettings::GetAutosaveTime() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAutosaveTime(const int &value) void VCommonSettings::SetAutosaveTime(const int &value)
{ {
setValue(SettingConfigurationAutosaveTime, value); setValue(settingConfigurationAutosaveTime, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetSendReportState() const bool VCommonSettings::GetSendReportState() const
{ {
return value(SettingConfigurationSendReportState, 1).toBool(); return value(settingConfigurationSendReportState, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetSendReportState(const bool &value) void VCommonSettings::SetSendReportState(const bool &value)
{ {
setValue(SettingConfigurationSendReportState, value); setValue(settingConfigurationSendReportState, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetLocale() const QString VCommonSettings::GetLocale() const
{ {
return value(SettingConfigurationLocale, QLocale().name()).toString(); return value(settingConfigurationLocale, QLocale().name()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLocale(const QString &value) void VCommonSettings::SetLocale(const QString &value)
{ {
setValue(SettingConfigurationLocale, value); setValue(settingConfigurationLocale, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPMSystemCode() const QString VCommonSettings::GetPMSystemCode() const
{ {
return value(SettingPMSystemCode, p0_S).toString(); return value(settingPMSystemCode, p0_S).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPMSystemCode(const QString &value) void VCommonSettings::SetPMSystemCode(const QString &value)
{ {
setValue(SettingPMSystemCode, value); setValue(settingPMSystemCode, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetUnit() const QString VCommonSettings::GetUnit() const
{ {
return value(SettingConfigurationUnit, "cm").toString(); return value(settingConfigurationUnit, "cm").toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUnit(const QString &value) void VCommonSettings::SetUnit(const QString &value)
{ {
setValue(SettingConfigurationUnit, value); setValue(settingConfigurationUnit, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetConfirmItemDelete() const bool VCommonSettings::GetConfirmItemDelete() const
{ {
return value(SettingConfigurationConfirmItemDeletion, 1).toBool(); return value(settingConfigurationConfirmItemDeletion, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetConfirmItemDelete(const bool &value) void VCommonSettings::SetConfirmItemDelete(const bool &value)
{ {
setValue(SettingConfigurationConfirmItemDeletion, value); setValue(settingConfigurationConfirmItemDeletion, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetToolBarStyle() const bool VCommonSettings::GetToolBarStyle() const
{ {
return value(SettingConfigurationToolBarStyle, 1).toBool(); return value(settingConfigurationToolBarStyle, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolBarStyle(const bool &value) void VCommonSettings::SetToolBarStyle(const bool &value)
{ {
setValue(SettingConfigurationToolBarStyle, value); setValue(settingConfigurationToolBarStyle, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -412,7 +411,7 @@ QString VCommonSettings::GetUser() const
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
user = value(SettingPatternUser, QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString(); user = value(SettingPatternUser, QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
#else #else
user = value(SettingPatternUser, QString::fromLocal8Bit(qgetenv("USER").constData())).toString(); user = value(settingPatternUser, QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
#endif #endif
return user; return user;
} }
@ -420,17 +419,17 @@ QString VCommonSettings::GetUser() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUser(const QString &value) void VCommonSettings::SetUser(const QString &value)
{ {
setValue(SettingPatternUser, value); setValue(settingPatternUser, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetUndoCount() const int VCommonSettings::GetUndoCount() const
{ {
bool ok = false; bool ok = false;
int val = value(SettingPatternUndo, 0).toInt(&ok); int val = value(settingPatternUndo, 0).toInt(&ok);
if (ok == false) if (ok == false)
{ {
qDebug()<<"Could not convert value"<<value(SettingPatternUndo, 0) qDebug()<<"Could not convert value"<<value(settingPatternUndo, 0)
<<"to int. Return default value for undo counts 0 (no limit)."; <<"to int. Return default value for undo counts 0 (no limit).";
val = 0; val = 0;
} }
@ -440,13 +439,13 @@ int VCommonSettings::GetUndoCount() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUndoCount(const int &value) void VCommonSettings::SetUndoCount(const int &value)
{ {
setValue(SettingPatternUndo, value); setValue(settingPatternUndo, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetRecentFileList() const QStringList VCommonSettings::GetRecentFileList() const
{ {
const QStringList files = value(SettingGeneralRecentFileList).toStringList(); const QStringList files = value(settingGeneralRecentFileList).toStringList();
QStringList cleared; QStringList cleared;
for (int i = 0; i < files.size(); ++i) for (int i = 0; i < files.size(); ++i)
@ -463,81 +462,81 @@ QStringList VCommonSettings::GetRecentFileList() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetRecentFileList(const QStringList &value) void VCommonSettings::SetRecentFileList(const QStringList &value)
{ {
setValue(SettingGeneralRecentFileList, value); setValue(settingGeneralRecentFileList, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetRestoreFileList() const QStringList VCommonSettings::GetRestoreFileList() const
{ {
return value(SettingGeneralRestoreFileList).toStringList(); return value(settingGeneralRestoreFileList).toStringList();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetRestoreFileList(const QStringList &value) void VCommonSettings::SetRestoreFileList(const QStringList &value)
{ {
setValue(SettingGeneralRestoreFileList, value); setValue(settingGeneralRestoreFileList, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetGeometry() const QByteArray VCommonSettings::GetGeometry() const
{ {
return value(SettingGeneralGeometry).toByteArray(); return value(settingGeneralGeometry).toByteArray();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetGeometry(const QByteArray &value) void VCommonSettings::SetGeometry(const QByteArray &value)
{ {
setValue(SettingGeneralGeometry, value); setValue(settingGeneralGeometry, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetWindowState() const QByteArray VCommonSettings::GetWindowState() const
{ {
return value(SettingGeneralWindowState).toByteArray(); return value(settingGeneralWindowState).toByteArray();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetWindowState(const QByteArray &value) void VCommonSettings::SetWindowState(const QByteArray &value)
{ {
setValue(SettingGeneralWindowState, value); setValue(settingGeneralWindowState, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetToolbarsState() const QByteArray VCommonSettings::GetToolbarsState() const
{ {
return value(SettingGeneralToolbarsState).toByteArray(); return value(settingGeneralToolbarsState).toByteArray();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolbarsState(const QByteArray &value) void VCommonSettings::SetToolbarsState(const QByteArray &value)
{ {
setValue(SettingGeneralToolbarsState, value); setValue(settingGeneralToolbarsState, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetPreferenceDialogSize() const QSize VCommonSettings::GetPreferenceDialogSize() const
{ {
return value(SettingPreferenceDialogSize, QSize(0, 0)).toSize(); return value(settingPreferenceDialogSize, QSize(0, 0)).toSize();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPreferenceDialogSize(const QSize& sz) void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
{ {
setValue(SettingPreferenceDialogSize, sz); setValue(settingPreferenceDialogSize, sz);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const int VCommonSettings::GetLatestSkippedVersion() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(SettingLatestSkippedVersion, 0x0).toInt(); return settings.value(settingLatestSkippedVersion, 0x0).toInt();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLatestSkippedVersion(int value) void VCommonSettings::SetLatestSkippedVersion(int value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(SettingLatestSkippedVersion, value); settings.setValue(settingLatestSkippedVersion, value);
settings.sync(); settings.sync();
} }
@ -545,21 +544,21 @@ void VCommonSettings::SetLatestSkippedVersion(int value)
QDate VCommonSettings::GetDateOfLastRemind() const QDate VCommonSettings::GetDateOfLastRemind() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(SettingDateOfLastRemind, QDate(1900, 1, 1)).toDate(); return settings.value(settingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDateOfLastRemind(const QDate &date) void VCommonSettings::SetDateOfLastRemind(const QDate &date)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(SettingDateOfLastRemind, date); settings.setValue(settingDateOfLastRemind, date);
settings.sync(); settings.sync();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetUserDefinedMaterials() const QStringList VCommonSettings::GetUserDefinedMaterials() const
{ {
return value(SettingUserDefinedMaterials).toStringList(); return value(settingUserDefinedMaterials).toStringList();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -567,36 +566,36 @@ void VCommonSettings::AddUserDefinedMaterial(QString qsMaterial)
{ {
QStringList qsl = GetUserDefinedMaterials(); QStringList qsl = GetUserDefinedMaterials();
qsl << qsMaterial; qsl << qsMaterial;
setValue(SettingUserDefinedMaterials, qsl); setValue(settingUserDefinedMaterials, qsl);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::ClearUserDefinedMaterial() void VCommonSettings::ClearUserDefinedMaterial()
{ {
QStringList qsl; QStringList qsl;
setValue(SettingUserDefinedMaterials, qsl); setValue(settingUserDefinedMaterials, qsl);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetForbidWorkpieceFlipping() const bool VCommonSettings::GetForbidWorkpieceFlipping() const
{ {
return value(SettingPatternForbidFlipping, false).toBool(); return value(settingPatternForbidFlipping, false).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetForbidWorkpieceFlipping(bool value) void VCommonSettings::SetForbidWorkpieceFlipping(bool value)
{ {
setValue(SettingPatternForbidFlipping, value); setValue(settingPatternForbidFlipping, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsDoublePassmark() const bool VCommonSettings::IsDoublePassmark() const
{ {
return value(SettingDoublePassmark, false).toBool(); return value(settingDoublePassmark, false).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDoublePassmark(bool value) void VCommonSettings::SetDoublePassmark(bool value)
{ {
setValue(SettingDoublePassmark, value); setValue(settingDoublePassmark, value);
} }

View File

@ -139,35 +139,6 @@ public:
private: private:
Q_DISABLE_COPY(VCommonSettings) Q_DISABLE_COPY(VCommonSettings)
static const QString SettingPathsIndividualMeasurements;
static const QString SettingPathsStandardMeasurements;
static const QString SettingPathsTemplates;
static const QString SettingConfigurationOsSeparator;
static const QString SettingConfigurationAutosaveState;
static const QString SettingConfigurationAutosaveTime;
static const QString SettingConfigurationSendReportState;
static const QString SettingConfigurationLocale;
static const QString SettingPMSystemCode;
static const QString SettingConfigurationUnit;
static const QString SettingConfigurationConfirmItemDeletion;
static const QString SettingConfigurationToolBarStyle;
static const QString SettingPatternUser;
static const QString SettingPatternUndo;
static const QString SettingPatternForbidFlipping;
static const QString SettingDoublePassmark;
static const QString SettingGeneralRecentFileList;
static const QString SettingGeneralRestoreFileList;
static const QString SettingGeneralGeometry;
static const QString SettingGeneralWindowState;
static const QString SettingGeneralToolbarsState;
static const QString SettingPreferenceDialogSize;
static const QString SettingLatestSkippedVersion;
static const QString SettingDateOfLastRemind;
static const QString SettingUserDefinedMaterials;
}; };
#endif // VCOMMONSETTINGS_H #endif // VCOMMONSETTINGS_H

View File

@ -44,38 +44,38 @@
Q_DECLARE_METATYPE(QMarginsF) Q_DECLARE_METATYPE(QMarginsF)
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language"); const QString settingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern"); const QString settingPathsPattern = QStringLiteral("paths/pattern");
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout"); const QString settingPathsLayout = QStringLiteral("paths/layout");
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput"); const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server"); const QString settingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure"); const QString settingCommunityServerSecure = QStringLiteral("community/serverSecure");
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy"); const QString settingCommunityUseProxy = QStringLiteral("community/useProxy");
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress"); const QString settingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort"); const QString settingCommunityProxyPort = QStringLiteral("community/proxyPort");
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser"); const QString settingCommunityProxyUser = QStringLiteral("community/proxyUser");
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass"); const QString settingCommunityProxyPass = QStringLiteral("community/proxyPass");
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username"); const QString settingCommunityUsername = QStringLiteral("community/username");
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword"); const QString settingCommunitySavePassword = QStringLiteral("community/savePassword");
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword"); const QString settingCommunityUserPassword = QStringLiteral("community/userpassword");
const QString VSettings::SettingLayoutWidth = QStringLiteral("layout/width"); const QString settingLayoutWidth = QStringLiteral("layout/width");
const QString VSettings::SettingLayoutSorting = QStringLiteral("layout/sorting"); const QString settingLayoutSorting = QStringLiteral("layout/sorting");
const QString VSettings::SettingLayoutPaperHeight = QStringLiteral("layout/paperHeight"); const QString settingLayoutPaperHeight = QStringLiteral("layout/paperHeight");
const QString VSettings::SettingLayoutPaperWidth = QStringLiteral("layout/paperWidth"); const QString settingLayoutPaperWidth = QStringLiteral("layout/paperWidth");
const QString VSettings::SettingLayoutShift = QStringLiteral("layout/shift"); const QString settingLayoutShift = QStringLiteral("layout/shift");
const QString VSettings::SettingLayoutRotate = QStringLiteral("layout/Rotate"); const QString settingLayoutRotate = QStringLiteral("layout/Rotate");
const QString VSettings::SettingLayoutRotationIncrease = QStringLiteral("layout/rotationIncrease"); const QString settingLayoutRotationIncrease = QStringLiteral("layout/rotationIncrease");
const QString VSettings::SettingLayoutAutoCrop = QStringLiteral("layout/autoCrop"); const QString settingLayoutAutoCrop = QStringLiteral("layout/autoCrop");
const QString VSettings::SettingLayoutSaveLength = QStringLiteral("layout/saveLength"); const QString settingLayoutSaveLength = QStringLiteral("layout/saveLength");
const QString VSettings::SettingLayoutUnitePages = QStringLiteral("layout/unitePages"); const QString settingLayoutUnitePages = QStringLiteral("layout/unitePages");
const QString VSettings::SettingFields = QStringLiteral("layout/fields"); const QString settingFields = QStringLiteral("layout/fields");
const QString VSettings::SettingIgnoreFields = QStringLiteral("layout/ignoreFields"); const QString settingIgnoreFields = QStringLiteral("layout/ignoreFields");
const QString VSettings::SettingStripOptimization = QStringLiteral("layout/stripOptimization"); const QString settingStripOptimization = QStringLiteral("layout/stripOptimization");
const QString VSettings::SettingMultiplier = QStringLiteral("layout/multiplier"); const QString settingMultiplier = QStringLiteral("layout/multiplier");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application, VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
@ -88,13 +88,13 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetLabelLanguage() const QString VSettings::GetLabelLanguage() const
{ {
return value(SettingConfigurationLabelLanguage, QLocale().bcp47Name()).toString(); return value(settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLabelLanguage(const QString &value) void VSettings::SetLabelLanguage(const QString &value)
{ {
setValue(SettingConfigurationLabelLanguage, value); setValue(settingConfigurationLabelLanguage, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -107,14 +107,14 @@ QString VSettings::GetDefPathPattern()
QString VSettings::GetPathPattern() const QString VSettings::GetPathPattern() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
return settings.value(SettingPathsPattern, GetDefPathPattern()).toString(); return settings.value(settingPathsPattern, GetDefPathPattern()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetPathPattern(const QString &value) void VSettings::SetPathPattern(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(SettingPathsPattern, value); settings.setValue(settingPathsPattern, value);
settings.sync(); settings.sync();
} }
@ -128,147 +128,147 @@ QString VSettings::GetDefPathLayout()
QString VSettings::GetPathLayout() const QString VSettings::GetPathLayout() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
return settings.value(SettingPathsLayout, GetDefPathLayout()).toString(); return settings.value(settingPathsLayout, GetDefPathLayout()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetPathLayout(const QString &value) void VSettings::SetPathLayout(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(SettingPathsLayout, value); settings.setValue(settingPathsLayout, value);
settings.sync(); settings.sync();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetGraphicalOutput() const bool VSettings::GetGraphicalOutput() const
{ {
return value(SettingPatternGraphicalOutput, 1).toBool(); return value(settingPatternGraphicalOutput, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetGraphicalOutput(const bool &value) void VSettings::SetGraphicalOutput(const bool &value)
{ {
setValue(SettingPatternGraphicalOutput, value); setValue(settingPatternGraphicalOutput, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetServer() const QString VSettings::GetServer() const
{ {
return value(SettingCommunityServer, "community.valentina-project.org").toString(); return value(settingCommunityServer, "community.valentina-project.org").toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetServer(const QString &value) void VSettings::SetServer(const QString &value)
{ {
setValue(SettingCommunityServer, value); setValue(settingCommunityServer, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetServerSecure() const bool VSettings::GetServerSecure() const
{ {
return value(SettingCommunityServerSecure, 0).toBool(); return value(settingCommunityServerSecure, 0).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetServerSecure(const bool &value) void VSettings::SetServerSecure(const bool &value)
{ {
setValue(SettingCommunityServerSecure, value); setValue(settingCommunityServerSecure, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetProxy() const bool VSettings::GetProxy() const
{ {
return value(SettingCommunityUseProxy, 0).toBool(); return value(settingCommunityUseProxy, 0).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetProxy(const bool &value) void VSettings::SetProxy(const bool &value)
{ {
setValue(SettingCommunityUseProxy, value); setValue(settingCommunityUseProxy, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetProxyAddress() const QString VSettings::GetProxyAddress() const
{ {
return value(SettingCommunityProxyAddress).toString(); return value(settingCommunityProxyAddress).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetProxyAddress(const QString &value) void VSettings::SetProxyAddress(const QString &value)
{ {
setValue(SettingCommunityProxyAddress, value); setValue(settingCommunityProxyAddress, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetProxyPort() const QString VSettings::GetProxyPort() const
{ {
return value(SettingCommunityProxyPort).toString(); return value(settingCommunityProxyPort).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetProxyPort(const QString &value) void VSettings::SetProxyPort(const QString &value)
{ {
setValue(SettingCommunityProxyPort, value); setValue(settingCommunityProxyPort, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetProxyUser() const QString VSettings::GetProxyUser() const
{ {
return value(SettingCommunityProxyUser).toString(); return value(settingCommunityProxyUser).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetProxyUser(const QString &value) void VSettings::SetProxyUser(const QString &value)
{ {
setValue(SettingCommunityProxyUser, value); setValue(settingCommunityProxyUser, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetProxyPass() const QString VSettings::GetProxyPass() const
{ {
return value(SettingCommunityProxyPass).toString(); return value(settingCommunityProxyPass).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetProxyPass(const QString &value) void VSettings::SetProxyPass(const QString &value)
{ {
setValue(SettingCommunityProxyPass, value); setValue(settingCommunityProxyPass, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetUsername() const QString VSettings::GetUsername() const
{ {
return value(SettingCommunityUsername).toString(); return value(settingCommunityUsername).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetUsername(const QString &value) void VSettings::SetUsername(const QString &value)
{ {
setValue(SettingCommunityUsername, value); setValue(settingCommunityUsername, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetSavePassword() const bool VSettings::GetSavePassword() const
{ {
return value(SettingCommunitySavePassword, 0).toBool(); return value(settingCommunitySavePassword, 0).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetSavePassword(const bool &value) void VSettings::SetSavePassword(const bool &value)
{ {
setValue(SettingCommunitySavePassword, value); setValue(settingCommunitySavePassword, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetUserPassword() const QString VSettings::GetUserPassword() const
{ {
return value(SettingCommunityUserPassword).toString(); return value(settingCommunityUserPassword).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetUserPassword(const QString &value) void VSettings::SetUserPassword(const QString &value)
{ {
setValue(SettingCommunityUserPassword, value); setValue(settingCommunityUserPassword, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -276,7 +276,7 @@ qreal VSettings::GetLayoutPaperHeight() const
{ {
const qreal def = UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px); const qreal def = UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px);
bool ok = false; bool ok = false;
const qreal height = value(SettingLayoutPaperHeight, def).toDouble(&ok); const qreal height = value(settingLayoutPaperHeight, def).toDouble(&ok);
if (ok) if (ok)
{ {
return height; return height;
@ -290,7 +290,7 @@ qreal VSettings::GetLayoutPaperHeight() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperHeight(qreal value) void VSettings::SetLayoutPaperHeight(qreal value)
{ {
setValue(SettingLayoutPaperHeight, value); setValue(settingLayoutPaperHeight, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -298,7 +298,7 @@ qreal VSettings::GetLayoutPaperWidth() const
{ {
const qreal def = UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px); const qreal def = UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px);
bool ok = false; bool ok = false;
const qreal width = value(SettingLayoutPaperWidth, def).toDouble(&ok); const qreal width = value(settingLayoutPaperWidth, def).toDouble(&ok);
if (ok) if (ok)
{ {
return width; return width;
@ -312,7 +312,7 @@ qreal VSettings::GetLayoutPaperWidth() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperWidth(qreal value) void VSettings::SetLayoutPaperWidth(qreal value)
{ {
setValue(SettingLayoutPaperWidth, value); setValue(settingLayoutPaperWidth, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -320,7 +320,7 @@ qreal VSettings::GetLayoutShift() const
{ {
const qreal def = GetDefLayoutShift(); const qreal def = GetDefLayoutShift();
bool ok = false; bool ok = false;
const qreal shift = value(SettingLayoutShift, def).toDouble(&ok); const qreal shift = value(settingLayoutShift, def).toDouble(&ok);
if (ok) if (ok)
{ {
return shift; return shift;
@ -340,7 +340,7 @@ qreal VSettings::GetDefLayoutShift()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutShift(qreal value) void VSettings::SetLayoutShift(qreal value)
{ {
setValue(SettingLayoutShift, value); setValue(settingLayoutShift, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -348,7 +348,7 @@ qreal VSettings::GetLayoutWidth() const
{ {
const qreal def = GetDefLayoutWidth(); const qreal def = GetDefLayoutWidth();
bool ok = false; bool ok = false;
const qreal lWidth = value(SettingLayoutWidth, def).toDouble(&ok); const qreal lWidth = value(settingLayoutWidth, def).toDouble(&ok);
if (ok) if (ok)
{ {
return lWidth; return lWidth;
@ -368,13 +368,13 @@ qreal VSettings::GetDefLayoutWidth()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutWidth(qreal value) void VSettings::SetLayoutWidth(qreal value)
{ {
setValue(SettingLayoutWidth, value); setValue(settingLayoutWidth, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMarginsF VSettings::GetFields(const QMarginsF &def) const QMarginsF VSettings::GetFields(const QMarginsF &def) const
{ {
const QVariant val = value(SettingFields, QVariant::fromValue(def)); const QVariant val = value(settingFields, QVariant::fromValue(def));
if (val.canConvert<QMarginsF>()) if (val.canConvert<QMarginsF>())
{ {
return val.value<QMarginsF>(); return val.value<QMarginsF>();
@ -385,7 +385,7 @@ QMarginsF VSettings::GetFields(const QMarginsF &def) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetFields(const QMarginsF &value) void VSettings::SetFields(const QMarginsF &value)
{ {
setValue(SettingFields, QVariant::fromValue(value)); setValue(settingFields, QVariant::fromValue(value));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -393,7 +393,7 @@ Cases VSettings::GetLayoutGroup() const
{ {
const Cases def = GetDefLayoutGroup(); const Cases def = GetDefLayoutGroup();
bool ok = false; bool ok = false;
const int g = value(SettingLayoutSorting, static_cast<int>(def)).toInt(&ok); const int g = value(settingLayoutSorting, static_cast<int>(def)).toInt(&ok);
if (ok) if (ok)
{ {
if (g >= static_cast<int>(Cases::UnknownCase)) if (g >= static_cast<int>(Cases::UnknownCase))
@ -420,13 +420,13 @@ Cases VSettings::GetDefLayoutGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutGroup(const Cases &value) void VSettings::SetLayoutGroup(const Cases &value)
{ {
setValue(SettingLayoutSorting, static_cast<int>(value)); setValue(settingLayoutSorting, static_cast<int>(value));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutRotate() const bool VSettings::GetLayoutRotate() const
{ {
return value(SettingLayoutRotate, GetDefLayoutRotate()).toBool(); return value(settingLayoutRotate, GetDefLayoutRotate()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -438,7 +438,7 @@ bool VSettings::GetDefLayoutRotate()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutRotate(bool value) void VSettings::SetLayoutRotate(bool value)
{ {
setValue(SettingLayoutRotate, value); setValue(settingLayoutRotate, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -446,7 +446,7 @@ int VSettings::GetLayoutRotationIncrease() const
{ {
const int def = GetDefLayoutRotationIncrease(); const int def = GetDefLayoutRotationIncrease();
bool ok = false; bool ok = false;
const int r = value(SettingLayoutRotationIncrease, def).toInt(&ok); const int r = value(settingLayoutRotationIncrease, def).toInt(&ok);
if (ok) if (ok)
{ {
if (not (r >= 1 && r <= 180 && 360 % r == 0)) if (not (r >= 1 && r <= 180 && 360 % r == 0))
@ -473,13 +473,13 @@ int VSettings::GetDefLayoutRotationIncrease()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutRotationIncrease(int value) void VSettings::SetLayoutRotationIncrease(int value)
{ {
setValue(SettingLayoutRotationIncrease, value); setValue(settingLayoutRotationIncrease, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutAutoCrop() const bool VSettings::GetLayoutAutoCrop() const
{ {
return value(SettingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool(); return value(settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -491,13 +491,13 @@ bool VSettings::GetDefLayoutAutoCrop()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutAutoCrop(bool value) void VSettings::SetLayoutAutoCrop(bool value)
{ {
setValue(SettingLayoutAutoCrop, value); setValue(settingLayoutAutoCrop, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutSaveLength() const bool VSettings::GetLayoutSaveLength() const
{ {
return value(SettingLayoutSaveLength, GetDefLayoutSaveLength()).toBool(); return value(settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -509,13 +509,13 @@ bool VSettings::GetDefLayoutSaveLength()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutSaveLength(bool value) void VSettings::SetLayoutSaveLength(bool value)
{ {
setValue(SettingLayoutSaveLength, value); setValue(settingLayoutSaveLength, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutUnitePages() const bool VSettings::GetLayoutUnitePages() const
{ {
return value(SettingLayoutUnitePages, GetDefLayoutUnitePages()).toBool(); return value(settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -527,13 +527,13 @@ bool VSettings::GetDefLayoutUnitePages()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutUnitePages(bool value) void VSettings::SetLayoutUnitePages(bool value)
{ {
setValue(SettingLayoutUnitePages, value); setValue(settingLayoutUnitePages, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetIgnoreAllFields() const bool VSettings::GetIgnoreAllFields() const
{ {
return value(SettingIgnoreFields, GetDefIgnoreAllFields()).toBool(); return value(settingIgnoreFields, GetDefIgnoreAllFields()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -545,13 +545,13 @@ bool VSettings::GetDefIgnoreAllFields()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetIgnoreAllFields(bool value) void VSettings::SetIgnoreAllFields(bool value)
{ {
setValue(SettingIgnoreFields, value); setValue(settingIgnoreFields, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetStripOptimization() const bool VSettings::GetStripOptimization() const
{ {
return value(SettingStripOptimization, GetDefStripOptimization()).toBool(); return value(settingStripOptimization, GetDefStripOptimization()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -563,13 +563,13 @@ bool VSettings::GetDefStripOptimization()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetStripOptimization(bool value) void VSettings::SetStripOptimization(bool value)
{ {
setValue(SettingStripOptimization, value); setValue(settingStripOptimization, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint8 VSettings::GetMultiplier() const quint8 VSettings::GetMultiplier() const
{ {
return static_cast<quint8>(value(SettingMultiplier, GetDefMultiplier()).toUInt()); return static_cast<quint8>(value(settingMultiplier, GetDefMultiplier()).toUInt());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -581,6 +581,6 @@ quint8 VSettings::GetDefMultiplier()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetMultiplier(quint8 value) void VSettings::SetMultiplier(quint8 value)
{ {
setValue(SettingMultiplier, value); setValue(settingMultiplier, value);
} }

View File

@ -153,38 +153,6 @@ public:
private: private:
Q_DISABLE_COPY(VSettings) Q_DISABLE_COPY(VSettings)
static const QString SettingConfigurationLabelLanguage;
static const QString SettingPathsPattern;
static const QString SettingPathsLayout;
static const QString SettingPatternGraphicalOutput;
static const QString SettingCommunityServer;
static const QString SettingCommunityServerSecure;
static const QString SettingCommunityUseProxy;
static const QString SettingCommunityProxyAddress;
static const QString SettingCommunityProxyPort;
static const QString SettingCommunityProxyUser;
static const QString SettingCommunityProxyPass;
static const QString SettingCommunityUsername;
static const QString SettingCommunitySavePassword;
static const QString SettingCommunityUserPassword;
static const QString SettingLayoutWidth;
static const QString SettingLayoutSorting;
static const QString SettingLayoutPaperHeight;
static const QString SettingLayoutPaperWidth;
static const QString SettingLayoutShift;
static const QString SettingLayoutRotate;
static const QString SettingLayoutRotationIncrease;
static const QString SettingLayoutAutoCrop;
static const QString SettingLayoutSaveLength;
static const QString SettingLayoutUnitePages;
static const QString SettingFields;
static const QString SettingIgnoreFields;
static const QString SettingStripOptimization;
static const QString SettingMultiplier;
}; };
#endif // VSETTINGS_H #endif // VSETTINGS_H

View File

@ -34,14 +34,14 @@
#include <QTextCodec> #include <QTextCodec>
#include <QVariant> #include <QVariant>
const QString VTapeSettings::SettingDataBaseGeometry = QStringLiteral("database/geometry"); const QString settingDataBaseGeometry = QStringLiteral("database/geometry");
const QString VTapeSettings::SettingDefHeight = QStringLiteral("gradation/defHeight"); const QString settingDefHeight = QStringLiteral("gradation/defHeight");
const QString VTapeSettings::SettingDefSize = QStringLiteral("gradation/defHeight"); const QString settingDefSize = QStringLiteral("gradation/defHeight");
const QString VTapeSettings::SettingCSVWithHeader = QStringLiteral("csv/withHeader"); const QString settingCSVWithHeader = QStringLiteral("csv/withHeader");
const QString VTapeSettings::SettingCSVCodec = QStringLiteral("csv/withCodec"); const QString settingCSVCodec = QStringLiteral("csv/withCodec");
const QString VTapeSettings::SettingCSVSeparator = QStringLiteral("csv/withSeparator"); const QString settingCSVSeparator = QStringLiteral("csv/withSeparator");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application, VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application,
@ -53,49 +53,49 @@ VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organiza
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QByteArray VTapeSettings::GetDataBaseGeometry() const QByteArray VTapeSettings::GetDataBaseGeometry() const
{ {
return value(SettingDataBaseGeometry).toByteArray(); return value(settingDataBaseGeometry).toByteArray();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDataBaseGeometry(const QByteArray &value) void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
{ {
setValue(SettingDataBaseGeometry, value); setValue(settingDataBaseGeometry, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefHeight(int value) void VTapeSettings::SetDefHeight(int value)
{ {
setValue(SettingDefHeight, value); setValue(settingDefHeight, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefHeight() const int VTapeSettings::GetDefHeight() const
{ {
return value(SettingDefHeight, 176).toInt(); return value(settingDefHeight, 176).toInt();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefSize(int value) void VTapeSettings::SetDefSize(int value)
{ {
setValue(SettingDefSize, value); setValue(settingDefSize, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefSize() const int VTapeSettings::GetDefSize() const
{ {
return value(SettingDefSize, 50).toInt(); return value(settingDefSize, 50).toInt();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetCSVWithHeader(bool withHeader) void VTapeSettings::SetCSVWithHeader(bool withHeader)
{ {
setValue(SettingCSVWithHeader, withHeader); setValue(settingCSVWithHeader, withHeader);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VTapeSettings::GetCSVWithHeader() const bool VTapeSettings::GetCSVWithHeader() const
{ {
return value(SettingCSVWithHeader, GetDefCSVWithHeader()).toBool(); return value(settingCSVWithHeader, GetDefCSVWithHeader()).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -107,13 +107,13 @@ bool VTapeSettings::GetDefCSVWithHeader() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetCSVCodec(int mib) void VTapeSettings::SetCSVCodec(int mib)
{ {
setValue(SettingCSVCodec, mib); setValue(settingCSVCodec, mib);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetCSVCodec() const int VTapeSettings::GetCSVCodec() const
{ {
return value(SettingCSVCodec, GetDefCSVCodec()).toInt(); return value(settingCSVCodec, GetDefCSVCodec()).toInt();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -128,17 +128,17 @@ void VTapeSettings::SetCSVSeparator(const QChar &separator)
switch(separator.toLatin1()) switch(separator.toLatin1())
{ {
case '\t': case '\t':
setValue(SettingCSVSeparator, 0); setValue(settingCSVSeparator, 0);
break; break;
case ';': case ';':
setValue(SettingCSVSeparator, 1); setValue(settingCSVSeparator, 1);
break; break;
case ' ': case ' ':
setValue(SettingCSVSeparator, 2); setValue(settingCSVSeparator, 2);
break; break;
case ',': case ',':
default: default:
setValue(SettingCSVSeparator, 3); setValue(settingCSVSeparator, 3);
break; break;
} }
} }
@ -146,7 +146,7 @@ void VTapeSettings::SetCSVSeparator(const QChar &separator)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QChar VTapeSettings::GetCSVSeparator() const QChar VTapeSettings::GetCSVSeparator() const
{ {
const quint8 separator = static_cast<quint8>(value(SettingCSVSeparator, 3).toUInt()); const quint8 separator = static_cast<quint8>(value(settingCSVSeparator, 3).toUInt());
switch(separator) switch(separator)
{ {
case 0: case 0:

View File

@ -69,13 +69,6 @@ public:
private: private:
Q_DISABLE_COPY(VTapeSettings) Q_DISABLE_COPY(VTapeSettings)
static const QString SettingDataBaseGeometry;
static const QString SettingDefHeight;
static const QString SettingDefSize;
static const QString SettingCSVWithHeader;
static const QString SettingCSVCodec;
static const QString SettingCSVSeparator;
}; };
#endif // VTAPESETTINGS_H #endif // VTAPESETTINGS_H