mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-06 18:35:52 +00:00
add custom keys configuration
This commit is contained in:
@ -52,6 +52,37 @@ AWFormatterHelper::~AWFormatterHelper()
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterHelper::initItems()
|
||||
{
|
||||
installDirectories();
|
||||
initFormatters();
|
||||
initKeys();
|
||||
}
|
||||
|
||||
|
||||
bool AWFormatterHelper::writeItems(
|
||||
const QHash<QString, QString> &_configuration) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Write configuration" << _configuration;
|
||||
|
||||
QString fileName = QString("%1/%2")
|
||||
.arg(QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericDataLocation))
|
||||
.arg(m_filePath);
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
qCInfo(LOG_AW) << "Configuration file" << fileName;
|
||||
|
||||
settings.beginGroup("Formatters");
|
||||
for (auto &key : _configuration.keys())
|
||||
settings.setValue(key, _configuration[key]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
||||
return (settings.status() == QSettings::NoError);
|
||||
}
|
||||
|
||||
|
||||
QString AWFormatterHelper::convert(const QVariant &_value,
|
||||
const QString &_name) const
|
||||
{
|
||||
@ -78,14 +109,6 @@ QHash<QString, QString> AWFormatterHelper::getFormatters() const
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterHelper::initItems()
|
||||
{
|
||||
installDirectories();
|
||||
initFormatters();
|
||||
initKeys();
|
||||
}
|
||||
|
||||
|
||||
QList<AbstractExtItem *> AWFormatterHelper::items() const
|
||||
{
|
||||
QList<AbstractExtItem *> converted;
|
||||
@ -128,29 +151,6 @@ bool AWFormatterHelper::removeUnusedFormatters(const QStringList &_keys) const
|
||||
}
|
||||
|
||||
|
||||
bool AWFormatterHelper::writeFormatters(
|
||||
const QHash<QString, QString> &_configuration) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Write configuration" << _configuration;
|
||||
|
||||
QString fileName = QString("%1/%2")
|
||||
.arg(QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericDataLocation))
|
||||
.arg(m_filePath);
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
qCInfo(LOG_AW) << "Configuration file" << fileName;
|
||||
|
||||
settings.beginGroup("Formatters");
|
||||
for (auto &key : _configuration.keys())
|
||||
settings.setValue(key, _configuration[key]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
||||
return (settings.status() == QSettings::NoError);
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterHelper::editItems()
|
||||
{
|
||||
repaintList();
|
||||
|
Reference in New Issue
Block a user