2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Add install beta toggle to Settings > Advanced.

This commit is contained in:
John Preston
2018-09-26 18:30:42 +03:00
parent 971d0efda9
commit 131f7ec5bb
4 changed files with 62 additions and 25 deletions

View File

@@ -439,6 +439,17 @@ bool CheckAlphaVersionDir() {
return true;
}
QString InstallBetaVersionsSettingPath() {
return cWorkingDir() + qsl("tdata/devversion");
}
void WriteInstallBetaVersionsSetting() {
QFile f(InstallBetaVersionsSettingPath());
if (f.open(QIODevice::WriteOnly)) {
f.write(cInstallBetaVersion() ? "1" : "0");
}
}
void WorkingDirReady() {
if (QFile(cWorkingDir() + qsl("tdata/withtestmode")).exists()) {
cSetTestMode(true);
@@ -447,19 +458,16 @@ void WorkingDirReady() {
&& QFile(cWorkingDir() + qsl("tdata/withdebug")).exists()) {
Logs::SetDebugEnabled(true);
}
const auto installBetaPath = cWorkingDir() + qsl("tdata/devversion");
const auto installBetaSettingPath = InstallBetaVersionsSettingPath();
if (cAlphaVersion()) {
cSetInstallBetaVersion(false);
} else if (QFile(installBetaPath).exists()) {
QFile f(installBetaPath);
} else if (QFile(installBetaSettingPath).exists()) {
QFile f(installBetaSettingPath);
if (f.open(QIODevice::ReadOnly)) {
cSetInstallBetaVersion(f.read(1) != "0");
}
} else if (AppBetaVersion) {
QFile f(installBetaPath);
if (f.open(QIODevice::WriteOnly)) {
f.write(cInstallBetaVersion() ? "1" : "0");
}
WriteInstallBetaVersionsSetting();
}
srand((int32)time(NULL));