Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ TeSettings.pro.user.98dd4ea
TeSettings.pro.user
*.user
/lib
/build-TeSettings-Desktop_Qt_5_15_2_MSVC2019_64bit
*.stash
/build-TeSettings-Desktop_Qt_6_9_0_MinGW_64_bit
/build-TeSettings-Desktop_Qt_5_15_2_MinGW_64_bit
/build-TeSettings-Desktop_Qt_6_9_1_MinGW_64_bit
14 changes: 6 additions & 8 deletions TeSettings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ QT -= gui
CONFIG += c++17 console
CONFIG -= app_bundle

CONFIG(debug, debug|release) TARGET = TeSettingsd
CONFIG(release, debug|release) TARGET = TeSettings

VERSION = 1.0.3
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += TE_SETTINGS_LIBRARY

CONFIG(debug, debug |release) {
TEMPLATE = app
} else {
DESTDIR = $$PWD/lib/te_settings
TEMPLATE = lib
QMAKE_POST_LINK += cp $$PWD/te_settings/tesettings.h $$PWD/lib/te_settings/tesettings.h
win32: HEADERS += te_settings/te_settingsGlobal.h
}
TEMPLATE = lib
DESTDIR = $$PWD/lib/te_settings
win32: QMAKE_POST_LINK += $$QMAKE_COPY $$system_path($$PWD/te_settings/tesettings.h) $$system_path($$PWD/lib/te_settings/tesettings.h)
else: QMAKE_POST_LINK += cp $$PWD/te_settings/tesettings.h $$PWD/lib/te_settings/tesettings.h


# You can make your code fail to compile if it uses deprecated APIs.
Expand Down
12 changes: 0 additions & 12 deletions te_settings/te_settingsGlobal.h

This file was deleted.

15 changes: 12 additions & 3 deletions te_settings/tesettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ void TeSettings::setValue(QString key, const QVariant &value)
}

auto &params (data_[group].params);
params.insert(key, ParamData {.value = value.toString(), .comment = ""});
ParamData paramData;
paramData.value = value.toString();
paramData.comment = "";
params.insert(key, paramData);
}

void TeSettings::setComment(QString key, const QString &comment)
Expand Down Expand Up @@ -304,7 +307,10 @@ void TeSettings::parseLine(QString &line, const int &lineNum)
// Если ещё нет такой группы
if (!data_.contains(group_))
{
data_.insert(group_, GroupData {.params = {}, .comment = lastComment_});
GroupData groupData;
groupData.params = {};
groupData.comment = lastComment_;
data_.insert(group_, groupData);
lastComment_.clear();
}
}
Expand Down Expand Up @@ -353,7 +359,10 @@ void TeSettings::parseLine(QString &line, const int &lineNum)

const QString key (line.mid(0, equal_idx).trimmed());
const QString value (line.mid(equal_idx + 1).trimmed());
data_[group_].params.insert(key, ParamData {.value = value, .comment = lastComment_});
ParamData paramData;
paramData.value = value;
paramData.comment = lastComment_;
data_[group_].params.insert(key, paramData);
lastComment_.clear();
}
}
Expand Down
7 changes: 6 additions & 1 deletion te_settings/tesettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
#include <QDebug>
#include <QFile>
#include <QMap>
#include <QVariant>

#ifdef Q_OS_WIN
#include "te_settingsGlobal.h"
#if defined(TE_SETTINGS_LIBRARY)
#define TE_SETTINGS_EXPORT Q_DECL_EXPORT
#else
#define TE_SETTINGS_EXPORT Q_DECL_IMPORT
#endif
#endif

// Этот дефайн включает дополнительный вывод для отладки возможных проблем парсинга
Expand Down