settings.h 3.05 KB
Newer Older
1
/*
Karel Slaný's avatar
Karel Slaný committed
2
 * Copyright (C) 2014-2018 CZ.NIC
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * This program 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.
 *
 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * In addition, as a special exception, the copyright holders give
 * permission to link the code of portions of this program with the
 * OpenSSL library under certain conditions as described in each
 * individual source file, and distribute linked combinations including
 * the two.
 */

24
#pragma once
25 26 27 28

#include <QSettings>
#include <QString>

29
#include "src/datovka_shared/settings/pin.h"
30 31 32 33 34

/*
 * This class hold and manage global settings data of Datovka.
 * Class is initialized as global instance here.
 */
35
class Settings : public PinSettings {
36 37 38 39 40 41 42 43 44

public:
	/*!
	 * @brief Constructor.
	 */
	Settings(void);

	/*!
	 * @brief Load data from supplied settings.
45 46
	 *
	 * @param[in] settings Settings structure to be read.
47
	 */
48
	void loadFromSettings(const QSettings &settings);
49 50 51

	/*!
	 * @brief Store data to settings structure.
52 53
	 *
	 * @param[out] settings Settings structure to be updated.
54
	 */
55
	void saveToSettings(QSettings &settings) const;
56 57 58

	/*!
	 * @brief Full path to settings file.
59
	 *
60 61 62 63 64
	 * @return Full path to settings file or empty string on error.
	 */
	static
	QString settingsPath(void);

65 66 67 68 69 70 71 72
	/*!
	 * @brief Set last update time from string.
	 *
	 * @param[in] str Time in ISO 8601 format.
	 */
	void setLastUpdate(const QString &str);

	/*!
73 74 75
	 * @brief Return current time as a string.
	 *
	 * @return Current time as stored by this structure.
76
	 */
77 78
	static
	QString nowStr(void);
79 80 81 82 83 84 85 86 87 88

	/*!
	 * @brief Returns last update time string.
	 *
	 * @return Hours minutes and seconds if last update performed today,
	 *     date if last update performed yesterday or earlier,
	 *     empty string if no time could be determined.
	 */
	QString lastUpdateStr(void) const;

89 90 91
	/*!
	 * @brief Holds global settings data.
	 */
92 93 94 95 96 97
	QString language; /*!< Application language. */
	int fontSize; /*!< Application font size (scale). */
	bool downloadOnlyNewMsgs; /*!< Download new messages only (not long term storage). */
	bool downloadCompleteMsgs; /*!< Download complete messages. */
	int msgLifeTimeInDays; /*!< Message life time in days. */
	int fileLifeTimeInDays; /*!< File life time in days. */
98
	int pinInactTimeoutInSecs; /*!< Inactivity locking interval. */
99 100
	QString dbsLocation; /*!< Path to databses location. */
	int zfoDbSizeMBs; /*!< Zfo database max size in MB. */
101
	int debugVerbosityLevel; /*!< Application debug verbosity level. */
Martin Straka's avatar
Martin Straka committed
102
	int logVerbosityLevel; /*!< Application log verbosity level. */
103 104 105

private:
	QString m_lastUpdate;
106
};