2014-11-22 17:15:47 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vsettings.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 22 11, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2014 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vsettings.h"
|
|
|
|
|
|
|
|
#include <QDir>
|
2014-11-28 19:33:28 +01:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QLocale>
|
2015-01-28 15:46:41 +01:00
|
|
|
#include <QApplication>
|
2014-11-22 17:15:47 +01:00
|
|
|
|
|
|
|
const QString VSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
|
|
|
|
const QString VSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
|
|
|
|
const QString VSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
|
|
|
|
const QString VSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
|
|
|
|
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
|
|
|
|
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
|
|
|
|
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
|
2015-02-25 23:27:09 +01:00
|
|
|
const QString VSettings::SettingConfigurationConfirmItemDeletion= QStringLiteral("configuration/confirm_item_deletion");
|
2014-11-22 17:15:47 +01:00
|
|
|
|
|
|
|
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
|
2015-01-28 15:46:41 +01:00
|
|
|
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
|
2014-11-22 17:15:47 +01:00
|
|
|
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
|
2015-01-26 15:08:09 +01:00
|
|
|
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout");
|
2014-11-22 17:15:47 +01:00
|
|
|
|
|
|
|
const QString VSettings::SettingPatternUser = QStringLiteral("pattern/user");
|
|
|
|
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
|
|
|
|
const QString VSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
|
|
|
|
|
|
|
|
const QString VSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
|
|
|
|
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
|
|
|
|
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
|
|
|
|
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
|
|
|
|
|
|
|
|
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
|
|
|
|
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
|
|
|
|
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy");
|
|
|
|
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
|
|
|
|
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort");
|
|
|
|
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser");
|
|
|
|
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass");
|
|
|
|
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username");
|
|
|
|
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword");
|
|
|
|
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword");
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
|
|
|
QObject *parent)
|
|
|
|
:QSettings(format, scope, organization, application, parent)
|
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetOsSeparator() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationOsSeparator, 1).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetOsSeparator(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationOsSeparator, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetAutosaveState() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationAutosaveState, 1).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetAutosaveState(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationAutosaveState, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
int VSettings::GetAutosaveTime() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
bool ok = false;
|
|
|
|
int val = value(SettingConfigurationAutosaveTime, 1).toInt(&ok);
|
|
|
|
if (ok == false)
|
|
|
|
{
|
|
|
|
qDebug()<<"Could not convert value"<<value(SettingConfigurationAutosaveTime, 1)
|
|
|
|
<<"to int. Return default value for autosave time"<<1<<"minutes.";
|
|
|
|
val = 1;
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetAutosaveTime(const int &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationAutosaveTime, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetSendReportState() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationSendReportState, 1).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetSendReportState(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationSendReportState, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetLocale() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationLocale, QLocale::system().name()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetLocale(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationLocale, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetUnit() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationUnit, "cm").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetUnit(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationUnit, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetLabelLanguage() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingConfigurationLabelLanguage, QLocale::system().bcp47Name()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetLabelLanguage(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationLabelLanguage, value);
|
|
|
|
}
|
|
|
|
|
2015-02-25 23:27:09 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VSettings::GetConfirmItemDelete() const
|
|
|
|
{
|
|
|
|
return value(SettingConfigurationConfirmItemDeletion, 1).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetConfirmItemDelete(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingConfigurationConfirmItemDeletion, value);
|
|
|
|
}
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetPathIndividualMeasurements() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingPathsIndividualMeasurements, QDir::homePath()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetPathIndividualMeasurements(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPathsIndividualMeasurements, value);
|
|
|
|
}
|
|
|
|
|
2015-01-28 15:46:41 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VSettings::GetPathStandardMeasurements() const
|
|
|
|
{
|
|
|
|
return value(SettingPathsStandardMeasurements, StandardTablesPath()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetPathStandardMeasurements(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPathsStandardMeasurements, value);
|
|
|
|
}
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetPathPattern() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingPathsPattern, QDir::homePath()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetPathPattern(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPathsPattern, value);
|
|
|
|
}
|
|
|
|
|
2015-01-26 15:08:09 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VSettings::GetPathLayout() const
|
|
|
|
{
|
|
|
|
return value(SettingPathsLayout, QDir::homePath()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetPathLayout(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPathsLayout, value);
|
|
|
|
}
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetUser() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
QString user;
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
user = value(SettingPatternUser, QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
|
|
|
#else
|
|
|
|
user = value(SettingPatternUser, QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
|
|
|
|
#endif
|
|
|
|
return user;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetUser(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPatternUser, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetGraphicalOutput() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingPatternGraphicalOutput, 1).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetGraphicalOutput(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPatternGraphicalOutput, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
int VSettings::GetUndoCount() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
bool ok = false;
|
|
|
|
int val = value(SettingPatternUndo, 0).toInt(&ok);
|
|
|
|
if (ok == false)
|
|
|
|
{
|
|
|
|
qDebug()<<"Could not convert value"<<value(SettingPatternUndo, 0)
|
|
|
|
<<"to int. Return default value for undo counts 0 (no limit).";
|
|
|
|
val = 0;
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetUndoCount(const int &value)
|
|
|
|
{
|
|
|
|
setValue(SettingPatternUndo, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QStringList VSettings::GetRecentFileList() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingGeneralRecentFileList).toStringList();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetRecentFileList(const QStringList &value)
|
|
|
|
{
|
|
|
|
setValue(SettingGeneralRecentFileList, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QStringList VSettings::GetRestoreFileList() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingGeneralRestoreFileList).toStringList();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetRestoreFileList(const QStringList &value)
|
|
|
|
{
|
|
|
|
setValue(SettingGeneralRestoreFileList, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QByteArray VSettings::GetGeometry() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingGeneralGeometry).toByteArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetGeometry(const QByteArray &value)
|
|
|
|
{
|
|
|
|
setValue(SettingGeneralGeometry, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QByteArray VSettings::GetWindowState() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingGeneralWindowState).toByteArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetWindowState(const QByteArray &value)
|
|
|
|
{
|
|
|
|
setValue(SettingGeneralWindowState, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetServer() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityServer, "community.valentina-project.org").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetServer(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityServer, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetServerSecure() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityServerSecure, 0).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetServerSecure(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityServerSecure, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetProxy() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityUseProxy, 0).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetProxy(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityUseProxy, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetProxyAddress() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityProxyAddress).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetProxyAddress(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityProxyAddress, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetProxyPort() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityProxyPort).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetProxyPort(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityProxyPort, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetProxyUser() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityProxyUser).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetProxyUser(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityProxyUser, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetProxyPass() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityProxyPass).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetProxyPass(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityProxyPass, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetUsername() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityUsername).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetUsername(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityUsername, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
bool VSettings::GetSavePassword() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunitySavePassword, 0).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetSavePassword(const bool &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunitySavePassword, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
QString VSettings::GetUserPassword() const
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
return value(SettingCommunityUserPassword).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VSettings::SetUserPassword(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(SettingCommunityUserPassword, value);
|
|
|
|
}
|
2015-01-28 15:46:41 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VSettings::StandardTablesPath()
|
|
|
|
{
|
|
|
|
const QString stPath = QStringLiteral("/tables/standard");
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
return QApplication::applicationDirPath() + stPath;
|
|
|
|
#elif defined(Q_OS_MAC)
|
|
|
|
QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath);
|
|
|
|
if (dirBundle.exists())
|
|
|
|
{
|
|
|
|
return dirBundle.absolutePath();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
|
|
|
if (dir.exists())
|
|
|
|
{
|
|
|
|
return dir.absolutePath();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QStringLiteral("/usr/share/valentina/tables/standard");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else // Unix
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
return QApplication::applicationDirPath() + stPath;
|
|
|
|
#else
|
|
|
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
|
|
|
if (dir.exists())
|
|
|
|
{
|
|
|
|
return dir.absolutePath();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QStringLiteral("/usr/share/valentina/tables/standard");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|