2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Allow switching off debug logs in closed alpha.

This commit is contained in:
John Preston
2018-09-27 16:36:27 +03:00
parent 18b74b9045
commit 9b449a1d26
4 changed files with 39 additions and 13 deletions

View File

@@ -450,14 +450,35 @@ void WriteInstallBetaVersionsSetting() {
}
}
void WorkingDirReady() {
QString DebugModeSettingPath() {
return cWorkingDir() + qsl("tdata/withdebug");
}
void WriteDebugModeSetting() {
QFile f(DebugModeSettingPath());
if (f.open(QIODevice::WriteOnly)) {
f.write(Logs::DebugEnabled() ? "1" : "0");
}
}
void ComputeTestMode() {
if (QFile(cWorkingDir() + qsl("tdata/withtestmode")).exists()) {
cSetTestMode(true);
}
if (!Logs::DebugEnabled()
&& QFile(cWorkingDir() + qsl("tdata/withdebug")).exists()) {
Logs::SetDebugEnabled(true);
}
void ComputeDebugMode() {
Logs::SetDebugEnabled(cAlphaVersion() != 0);
const auto debugModeSettingPath = DebugModeSettingPath();
if (QFile(debugModeSettingPath).exists()) {
QFile f(debugModeSettingPath);
if (f.open(QIODevice::ReadOnly)) {
Logs::SetDebugEnabled(f.read(1) != "0");
}
}
}
void ComputeInstallBetaVersions() {
const auto installBetaSettingPath = InstallBetaVersionsSettingPath();
if (cAlphaVersion()) {
cSetInstallBetaVersion(false);
@@ -469,9 +490,9 @@ void WorkingDirReady() {
} else if (AppBetaVersion) {
WriteInstallBetaVersionsSetting();
}
}
srand((int32)time(NULL));
void ComputeUserTag() {
SandboxUserTag = 0;
QFile usertag(cWorkingDir() + qsl("tdata/usertag"));
if (usertag.open(QIODevice::ReadOnly)) {
@@ -492,6 +513,15 @@ void WorkingDirReady() {
}
}
void WorkingDirReady() {
srand((int32)time(NULL));
ComputeTestMode();
ComputeDebugMode();
ComputeInstallBetaVersions();
ComputeUserTag();
}
void start() {
SandboxData = std::make_unique<internal::Data>();
}