blob: ec2ed7120bc388a53e6ee0ded36312edffcaaf2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* Copyright (C) 2022 The Qt Company Ltd.
*
* SPDX-License-Identifier: GPL-3.0-only WITH Qt-GPL-exception-1.0
*/
#include "commonsetup.h"
#include "utils.h"
#include <iostream>
#include <string>
#include <map>
enum settings_file_result {
e_settings_ok = 0,
e_general_file_error = 1,
e_file_not_present = 2,
e_no_settings_tag = 3,
e_no_defaults = 4,
e_file_invalid_content = 5
};
enum settings_owner_type {
e_set_type_daemon = 0,
e_set_type_moc = 1,
e_set_type_licensetool = 2,
e_set_type_other = 3
};
class LicdSetup
{
public:
explicit LicdSetup(int type, const std::string &callerBinaryPath = "");
~LicdSetup() {}
std::string get(const std::string &item);
void set(const std::string &item, const std::string &value);
int initSettings();
private:
std::string m_filepath;
std::string m_tag;
std::map<std::string, std::string> m_settings;
int m_setType;
int getUserInfo();
int getDaemonInfo();
std::string parseSettingTag(const std::string &binPath);
int createUserSettingsFile();
int appendNewSection(const std::string &content);
std::string getTaggedSettingsSkeleton();
std::string getQtAppDataLocation();
std::string getUserFileSkeleton();
};
|