2015-07-15 09:16:59 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vtapesettings.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 15 7, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-07-15 09:16:59 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-07-15 09:16:59 +02:00
|
|
|
**
|
|
|
|
** 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 "vtapesettings.h"
|
|
|
|
|
2023-06-21 09:24:51 +02:00
|
|
|
#include <QDir>
|
2018-03-14 14:39:15 +01:00
|
|
|
#include <QGlobalStatic>
|
2023-06-21 09:24:51 +02:00
|
|
|
#include <QVariant>
|
|
|
|
|
2023-10-07 17:56:39 +02:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
|
|
|
#include "../vmisc/compatibility.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace Qt::Literals::StringLiterals;
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
namespace
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
|
|
|
|
2023-11-07 10:20:31 +01:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingKnownMeasurementsRecentFileList, ("kmRecentFileList"_L1)) // NOLINT
|
|
|
|
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, ("paths/templates"_L1)) // NOLINT
|
2023-06-22 17:30:43 +02:00
|
|
|
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, ("database/geometry"_L1)) // NOLINT
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, ("searchHistory/tape"_L1)) // NOLINT
|
2023-11-07 10:20:31 +01:00
|
|
|
// NOLINTNEXTLINE
|
2023-11-10 12:01:36 +01:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryKnownMeasurements, ("searchHistory/knownMeasurements"_L1))
|
2021-11-22 14:24:48 +01:00
|
|
|
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties,
|
2023-10-07 17:56:39 +02:00
|
|
|
("searchOptions/tapeUseUnicodeProperties"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-11-07 10:20:31 +01:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMUseUnicodeProperties,
|
|
|
|
("searchOptions/kmUseUnicodeProperties"_L1))
|
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord, ("searchOptions/tapeWholeWord"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-11-07 10:20:31 +01:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMWholeWord, ("searchOptions/kmWholeWord"_L1))
|
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, ("searchOptions/tapeRegexp"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-11-07 10:20:31 +01:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMRegexp, ("searchOptions/kmRegexp"_L1))
|
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase, ("searchOptions/tapeMatchCase"_L1))
|
2023-11-07 10:20:31 +01:00
|
|
|
// NOLINTNEXTLINE
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMMatchCase, ("searchOptions/kmMatchCase"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
QT_WARNING_POP
|
|
|
|
} // namespace
|
2015-12-12 12:11:39 +01:00
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
|
|
|
QObject *parent)
|
2023-06-21 09:24:51 +02:00
|
|
|
: VCommonSettings(format, scope, organization, application, parent)
|
2015-07-15 09:16:59 +02:00
|
|
|
{
|
|
|
|
}
|
2015-07-18 14:39:33 +02:00
|
|
|
|
2023-06-22 17:30:43 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetPathTemplate() const -> QString
|
|
|
|
{
|
2023-10-05 15:51:21 +02:00
|
|
|
return value(*settingPathsTemplates, QDir::homePath()).toString();
|
2023-06-22 17:30:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetPathTemplate(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(*settingPathsTemplates, value);
|
|
|
|
}
|
|
|
|
|
2015-08-01 19:09:10 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2022-08-12 17:50:13 +02:00
|
|
|
auto VTapeSettings::GetDataBaseGeometry() const -> QByteArray
|
2015-08-01 19:09:10 +02:00
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
return value(*settingDataBaseGeometry).toByteArray();
|
2015-08-01 19:09:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
setValue(*settingDataBaseGeometry, value);
|
2015-08-01 19:09:10 +02:00
|
|
|
}
|
2021-11-22 14:24:48 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetTapeSearchHistory() const -> QStringList
|
|
|
|
{
|
|
|
|
return value(*settingSearchHistoryTape).toStringList();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetTapeSearchHistory(const QStringList &history)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchHistoryTape, history);
|
|
|
|
}
|
|
|
|
|
2023-11-07 10:20:31 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetKMSearchHistory() const -> QStringList
|
|
|
|
{
|
2023-11-10 12:01:36 +01:00
|
|
|
return value(*settingSearchHistoryKnownMeasurements).toStringList();
|
2023-11-07 10:20:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetKMSearchHistory(const QStringList &history)
|
|
|
|
{
|
2023-11-10 12:01:36 +01:00
|
|
|
setValue(*settingSearchHistoryKnownMeasurements, history);
|
2023-11-07 10:20:31 +01:00
|
|
|
}
|
|
|
|
|
2021-11-22 14:24:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetTapeSearchOptionUseUnicodeProperties() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsTapeUseUnicodeProperties, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetTapeSearchOptionUseUnicodeProperties(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsTapeUseUnicodeProperties, value);
|
|
|
|
}
|
|
|
|
|
2023-11-07 10:20:31 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetKMSearchOptionUseUnicodeProperties() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsKMUseUnicodeProperties, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetKMSearchOptionUseUnicodeProperties(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsKMUseUnicodeProperties, value);
|
|
|
|
}
|
|
|
|
|
2021-11-22 14:24:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetTapeSearchOptionWholeWord() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsTapeWholeWord, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetTapeSearchOptionWholeWord(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsTapeWholeWord, value);
|
|
|
|
}
|
|
|
|
|
2023-11-07 10:20:31 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetKMSearchOptionWholeWord() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsKMWholeWord, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetKMSearchOptionWholeWord(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsKMWholeWord, value);
|
|
|
|
}
|
|
|
|
|
2021-11-22 14:24:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetTapeSearchOptionRegexp() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsTapeRegexp, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetTapeSearchOptionRegexp(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsTapeRegexp, value);
|
|
|
|
}
|
|
|
|
|
2023-11-07 10:20:31 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetKMSearchOptionRegexp() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsKMRegexp, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetKMSearchOptionRegexp(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsKMRegexp, value);
|
|
|
|
}
|
|
|
|
|
2021-11-22 14:24:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetTapeSearchOptionMatchCase() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsTapeMatchCase, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetTapeSearchOptionMatchCase(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsTapeMatchCase, value);
|
|
|
|
}
|
2023-11-07 10:20:31 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetKMSearchOptionMatchCase() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingSearchOptionsKMMatchCase, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetKMSearchOptionMatchCase(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingSearchOptionsKMMatchCase, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VTapeSettings::GetRecentKMFileList() const -> QStringList
|
|
|
|
{
|
|
|
|
const QStringList files = value(*settingKnownMeasurementsRecentFileList).toStringList();
|
|
|
|
QStringList cleared;
|
|
|
|
|
|
|
|
for (const auto &f : files)
|
|
|
|
{
|
|
|
|
if (QFileInfo::exists(f))
|
|
|
|
{
|
|
|
|
cleared.append(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cleared;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTapeSettings::SetRecentKMFileList(const QStringList &value)
|
|
|
|
{
|
|
|
|
setValue(*settingKnownMeasurementsRecentFileList, value);
|
|
|
|
}
|