mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 16:15:13 +00:00
Fixed font updating after restart
This commit is contained in:
@@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
bool _debug = false;
|
bool _debug = false;
|
||||||
|
|
||||||
wstring updaterName, updaterDir, updateTo, exeName, customWorkingDir, customKeyFile;
|
wstring updaterName, updaterDir, updateTo, exeName, customWorkingDir, customKeyFile, mainFont, semiboldFont, monospacedFont;
|
||||||
|
|
||||||
bool equal(const wstring &a, const wstring &b) {
|
bool equal(const wstring &a, const wstring &b) {
|
||||||
return !_wcsicmp(a.c_str(), b.c_str());
|
return !_wcsicmp(a.c_str(), b.c_str());
|
||||||
@@ -339,7 +339,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
|||||||
LPWSTR *args;
|
LPWSTR *args;
|
||||||
int argsCount;
|
int argsCount;
|
||||||
|
|
||||||
bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false;
|
bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false, semiboldisbold = false;
|
||||||
args = CommandLineToArgvW(GetCommandLine(), &argsCount);
|
args = CommandLineToArgvW(GetCommandLine(), &argsCount);
|
||||||
if (args) {
|
if (args) {
|
||||||
for (int i = 1; i < argsCount; ++i) {
|
for (int i = 1; i < argsCount; ++i) {
|
||||||
@@ -381,6 +381,14 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (equal(args[i], L"-mainfont") && ++i < argsCount) {
|
||||||
|
mainFont = args[i];
|
||||||
|
} else if (equal(args[i], L"-semiboldfont") && ++i < argsCount) {
|
||||||
|
semiboldFont = args[i];
|
||||||
|
} else if (equal(args[i], L"-semiboldisbold")) {
|
||||||
|
semiboldisbold = true;
|
||||||
|
} else if (equal(args[i], L"-monospacefont") && ++i < argsCount) {
|
||||||
|
monospacedFont = args[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exeName.empty()) {
|
if (exeName.empty()) {
|
||||||
@@ -434,6 +442,16 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
|||||||
if (!customKeyFile.empty()) {
|
if (!customKeyFile.empty()) {
|
||||||
targs += L" -key \"" + customKeyFile + L"\"";
|
targs += L" -key \"" + customKeyFile + L"\"";
|
||||||
}
|
}
|
||||||
|
if (!mainFont.empty()) {
|
||||||
|
targs += L" -mainfont \"" + mainFont + L"\"";
|
||||||
|
}
|
||||||
|
if (!semiboldFont.empty()) {
|
||||||
|
targs += L" -semiboldfont \"" + semiboldFont + L"\"";
|
||||||
|
}
|
||||||
|
if (semiboldisbold) targs += L" -semiboldisbold";
|
||||||
|
if (!monospacedFont.empty()) {
|
||||||
|
targs += L" -monospacefont \"" + monospacedFont + L"\"";
|
||||||
|
}
|
||||||
writeLog(L"Result arguments: " + targs);
|
writeLog(L"Result arguments: " + targs);
|
||||||
|
|
||||||
bool executed = false;
|
bool executed = false;
|
||||||
|
@@ -46,6 +46,9 @@ string updaterName;
|
|||||||
string workDir;
|
string workDir;
|
||||||
string exeName;
|
string exeName;
|
||||||
string exePath;
|
string exePath;
|
||||||
|
string mainFont;
|
||||||
|
string semiboldFont;
|
||||||
|
string monospacedFont;
|
||||||
|
|
||||||
FILE *_logFile = 0;
|
FILE *_logFile = 0;
|
||||||
void openLog() {
|
void openLog() {
|
||||||
@@ -341,6 +344,7 @@ int main(int argc, char *argv[]) {
|
|||||||
bool testmode = false;
|
bool testmode = false;
|
||||||
bool externalupdater = false;
|
bool externalupdater = false;
|
||||||
bool customWorkingDir = false;
|
bool customWorkingDir = false;
|
||||||
|
bool semiboldIsBold = false;
|
||||||
|
|
||||||
char *key = 0;
|
char *key = 0;
|
||||||
char *workdir = 0;
|
char *workdir = 0;
|
||||||
@@ -369,6 +373,14 @@ int main(int argc, char *argv[]) {
|
|||||||
exeName = argv[i];
|
exeName = argv[i];
|
||||||
} else if (equal(argv[i], "-exepath") && ++i < argc) {
|
} else if (equal(argv[i], "-exepath") && ++i < argc) {
|
||||||
exePath = argv[i];
|
exePath = argv[i];
|
||||||
|
} else if (equal(argv[i], "-mainfont") && ++i < argc) {
|
||||||
|
mainFont = argv[i];
|
||||||
|
} else if (equal(argv[i], "-semiboldfont") && ++i < argc) {
|
||||||
|
semiboldFont = argv[i];
|
||||||
|
} else if (equal(argv[i], "-semiboldisbold")) {
|
||||||
|
semiboldIsBold = true;
|
||||||
|
} else if (equal(argv[i], "-monospacefont") && ++i < argc) {
|
||||||
|
mainFont = argv[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exeName.empty() || exeName.find('/') != string::npos) {
|
if (exeName.empty() || exeName.find('/') != string::npos) {
|
||||||
@@ -465,6 +477,19 @@ int main(int argc, char *argv[]) {
|
|||||||
push("-workdir");
|
push("-workdir");
|
||||||
push(workdir);
|
push(workdir);
|
||||||
}
|
}
|
||||||
|
if (!mainFont.empty()) {
|
||||||
|
push("-mainfont");
|
||||||
|
push(mainFont);
|
||||||
|
}
|
||||||
|
if (!semiboldFont.empty()) {
|
||||||
|
push("-semiboldfont");
|
||||||
|
push(semiboldFont);
|
||||||
|
}
|
||||||
|
if (semiboldIsBold) push("-semiboldisbold");
|
||||||
|
if (!monospacedFont.empty()) {
|
||||||
|
push("-monospacefont");
|
||||||
|
push(monospacedFont);
|
||||||
|
}
|
||||||
|
|
||||||
auto args = vector<char*>();
|
auto args = vector<char*>();
|
||||||
for (auto &arg : values) {
|
for (auto &arg : values) {
|
||||||
|
@@ -11,6 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
NSString *appName = @"Telegram.app";
|
NSString *appName = @"Telegram.app";
|
||||||
NSString *appDir = nil;
|
NSString *appDir = nil;
|
||||||
NSString *workDir = nil;
|
NSString *workDir = nil;
|
||||||
|
NSString *mainFont = nil;
|
||||||
|
NSString *semiboldFont = nil;
|
||||||
|
NSString *monospacedFont = nil;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
BOOL _debug = YES;
|
BOOL _debug = YES;
|
||||||
@@ -90,7 +93,7 @@ int main(int argc, const char * argv[]) {
|
|||||||
|
|
||||||
openLog();
|
openLog();
|
||||||
pid_t procId = 0;
|
pid_t procId = 0;
|
||||||
BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO;
|
BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO, semiboldIsBold = NO;
|
||||||
BOOL customWorkingDir = NO;
|
BOOL customWorkingDir = NO;
|
||||||
NSString *key = nil;
|
NSString *key = nil;
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
@@ -122,6 +125,20 @@ int main(int argc, const char * argv[]) {
|
|||||||
customWorkingDir = YES;
|
customWorkingDir = YES;
|
||||||
} else if ([@"-key" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
} else if ([@"-key" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
if (++i < argc) key = [NSString stringWithUTF8String:argv[i]];
|
if (++i < argc) key = [NSString stringWithUTF8String:argv[i]];
|
||||||
|
} else if ([@"-mainfont" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
if (++i < argc) {
|
||||||
|
mainFont = [NSString stringWithUTF8String:argv[i]];
|
||||||
|
}
|
||||||
|
} else if ([@"-semiboldfont" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
if (++i < argc) {
|
||||||
|
semiboldFont = [NSString stringWithUTF8String:argv[i]];
|
||||||
|
}
|
||||||
|
} else if ([@"-semiboldisbold" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
semiboldIsBold = YES;
|
||||||
|
} else if ([@"-monospacefont" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
if (++i < argc) {
|
||||||
|
monospacedFont = [NSString stringWithUTF8String:argv[i]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!workDir) {
|
if (!workDir) {
|
||||||
@@ -265,6 +282,19 @@ int main(int argc, const char * argv[]) {
|
|||||||
[args addObject:@"-workdir"];
|
[args addObject:@"-workdir"];
|
||||||
[args addObject:workDir];
|
[args addObject:workDir];
|
||||||
}
|
}
|
||||||
|
if (mainFont) {
|
||||||
|
[args addObject:@"-mainfont"];
|
||||||
|
[args addObject:mainFont];
|
||||||
|
}
|
||||||
|
if (semiboldFont) {
|
||||||
|
[args addObject:@"-semiboldfont"];
|
||||||
|
[args addObject:semiboldFont];
|
||||||
|
}
|
||||||
|
if (semiboldIsBold) [args addObject:@"-semiboldisbold"];
|
||||||
|
if (monospacedFont) {
|
||||||
|
[args addObject:@"-monospacefont"];
|
||||||
|
[args addObject:monospacedFont];
|
||||||
|
}
|
||||||
writeLog([[NSArray arrayWithObjects:@"Running application '", appPath, @"' with args '", [args componentsJoinedByString:@"' '"], @"'..", nil] componentsJoinedByString:@""]);
|
writeLog([[NSArray arrayWithObjects:@"Running application '", appPath, @"' with args '", [args componentsJoinedByString:@"' '"], @"'..", nil] componentsJoinedByString:@""]);
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
|
Reference in New Issue
Block a user