ScreenTranslator/src/settings.h

83 lines
1.8 KiB
C
Raw Normal View History

2020-02-21 00:45:53 +07:00
#pragma once
2013-11-24 19:43:37 +07:00
2020-02-21 00:45:53 +07:00
#include "stfwd.h"
2013-11-24 19:43:37 +07:00
#include <QColor>
2020-03-18 01:32:36 +07:00
#include <QDateTime>
2020-02-21 00:45:53 +07:00
#include <QStringList>
2013-11-24 19:43:37 +07:00
2020-02-21 00:45:53 +07:00
#include <chrono>
2021-04-16 01:49:24 +07:00
#include <map>
2013-11-24 19:43:37 +07:00
2020-02-21 00:45:53 +07:00
enum class ResultMode { Widget, Tooltip };
2013-11-24 19:43:37 +07:00
2020-02-21 00:45:53 +07:00
struct Substitution {
QString source;
QString target;
};
2021-04-16 01:49:24 +07:00
using Substitutions = std::multimap<LanguageId, Substitution>;
2013-11-24 19:43:37 +07:00
2020-03-07 00:53:53 +07:00
enum class ProxyType { Disabled, System, Socks5, Http };
enum class TesseractVersion { Optimized, Compatible };
2020-02-21 00:45:53 +07:00
class Settings
{
public:
void save() const;
2020-02-21 00:45:53 +07:00
void load();
2013-11-24 19:43:37 +07:00
2020-03-21 17:03:58 +07:00
void saveLastUpdateCheck();
2020-03-15 19:30:24 +07:00
bool isPortable() const;
void setPortable(bool isPortable);
2020-02-21 00:45:53 +07:00
QString captureHotkey{"Ctrl+Alt+Z"};
QString repeatCaptureHotkey{"Ctrl+Alt+S"};
QString showLastHotkey{"Ctrl+Alt+X"};
QString clipboardHotkey{"Ctrl+Alt+C"};
QString captureLockedHotkey{"Ctrl+Alt+Q"};
2013-11-24 19:43:37 +07:00
2020-03-09 15:29:51 +07:00
bool showMessageOnStart{true};
2020-03-20 02:35:42 +07:00
bool runAtSystemStart{false};
2020-03-09 15:29:51 +07:00
2020-03-07 00:53:53 +07:00
ProxyType proxyType{ProxyType::System};
QString proxyHostName;
2020-02-21 00:45:53 +07:00
int proxyPort{8080};
2020-03-07 00:53:53 +07:00
QString proxyUser;
QString proxyPassword;
2020-02-21 00:45:53 +07:00
bool proxySavePassword{false};
2013-11-24 19:43:37 +07:00
2020-03-18 01:32:36 +07:00
int autoUpdateIntervalDays{0};
QDateTime lastUpdateCheck;
2020-03-08 17:49:15 +07:00
2020-04-09 03:17:23 +07:00
bool useHunspell{false};
QString hunspellDir;
2020-02-21 00:45:53 +07:00
Substitutions userSubstitutions;
2020-03-08 17:49:15 +07:00
bool useUserSubstitutions{true};
2020-02-21 00:45:53 +07:00
2020-04-04 00:47:49 +07:00
bool writeTrace{false};
2020-02-21 00:45:53 +07:00
QString tessdataPath;
2020-02-21 00:45:53 +07:00
QString sourceLanguage{"eng"};
TesseractVersion tesseractVersion{TesseractVersion::Optimized};
2020-02-21 00:45:53 +07:00
bool doTranslation{true};
bool ignoreSslErrors{false};
LanguageId targetLanguage{"rus"};
std::chrono::seconds translationTimeout{15};
QString translatorsDir;
2020-02-21 00:45:53 +07:00
QStringList translators{"google.js"};
ResultMode resultShowType{ResultMode::Widget}; // dialog
2020-03-20 01:47:46 +07:00
QString fontFamily;
int fontSize{11};
QColor fontColor{Qt::black};
QColor backgroundColor{Qt::lightGray};
bool showRecognized{true};
bool showCaptured{true};
2020-03-15 19:30:24 +07:00
private:
bool isPortable_{false};
2020-02-21 00:45:53 +07:00
};