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

fixed conflict with apple libraries, langs support added to xcode project

This commit is contained in:
John Preston
2014-12-20 01:03:50 +03:00
parent 0990a66f3c
commit 837f32d443
8 changed files with 64 additions and 52 deletions

View File

@@ -1600,7 +1600,7 @@ namespace App {
case dbiLang: {
qint32 v;
configStream >> v;
if (v == langTestlang || (v >= 0 && v < langCount)) {
if (v == languageTestlang || (v >= 0 && v < languageCount)) {
cSetLang(v);
}
} break;

View File

@@ -129,10 +129,10 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
cSetIntRetinaFactor(int32(cRetinaFactor()));
}
if (cLang() < langTestlang) {
if (cLang() < languageTestlang) {
cSetLang(languageId());
}
if (cLang() == langTestlang) {
if (cLang() == languageTestlang) {
if (QFileInfo(TestLangFile).exists()) {
LangLoaderPlain loader(TestLangFile);
cSetLangErrors(loader.errors());
@@ -142,9 +142,9 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
LOG(("Lang load warnings: %1").arg(loader.warnings()));
}
} else {
cSetLang(langEnglish);
cSetLang(languageEnglish);
}
} else if (cLang() > langEnglish && cLang() < langCount) {
} else if (cLang() > languageEnglish && cLang() < languageCount) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[cLang()] + qsl(".strings"));
if (!loader.errors().isEmpty()) {
LOG(("Lang load errors: %1").arg(loader.errors()));
@@ -854,12 +854,12 @@ QString Application::language() {
int32 Application::languageId() {
QByteArray l = language().toLatin1();
for (int32 i = 0; i < langCount; ++i) {
for (int32 i = 0; i < languageCount; ++i) {
if (l == LanguageCodes[i]) {
return i;
}
}
return langEnglish;
return languageEnglish;
}
MainWidget *Application::main() {

View File

@@ -29,20 +29,20 @@ LanguageBox::LanguageBox() :
_done(this, lang(lng_about_done), st::langsCloseButton),
_hiding(false), a_opacity(0, 1) {
bool haveTestLang = QFileInfo(TestLangFile).exists() || (cLang() == langTestlang);
bool haveTestLang = QFileInfo(TestLangFile).exists() || (cLang() == languageTestlang);
_width = st::langsWidth;
_height = st::addContactTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + (langCount + (haveTestLang ? 1 : 0)) * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height();
_height = st::addContactTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + (languageCount + (haveTestLang ? 1 : 0)) * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height();
int32 y = st::addContactTitleHeight + st::langsPadding.top();
_langs.reserve(langCount + (haveTestLang ? 1 : 0));
_langs.reserve(languageCount + (haveTestLang ? 1 : 0));
if (haveTestLang) {
_langs.push_back(new FlatRadiobutton(this, qsl("lang"), langTestlang, TestLangFile, (cLang() == langTestlang), st::langButton));
_langs.push_back(new FlatRadiobutton(this, qsl("lang"), languageTestlang, TestLangFile, (cLang() == languageTestlang), st::langButton));
_langs.back()->move(st::langsPadding.left() + st::langPadding.left(), y + st::langPadding.top());
y += st::langPadding.top() + _langs.back()->height() + st::langPadding.bottom();
connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange()));
}
for (int32 i = 0; i < langCount; ++i) {
for (int32 i = 0; i < languageCount; ++i) {
LangLoaderResult result;
if (i) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lng_language_name));
@@ -138,7 +138,7 @@ void LanguageBox::onChange() {
if (langId > 0) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_continue));
result = loader.found();
} else if (langId == langTestlang) {
} else if (langId == languageTestlang) {
LangLoaderPlain loader(TestLangFile, LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_continue));
result = loader.found();
}

View File

@@ -28,13 +28,13 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
IntroSteps::IntroSteps(IntroWidget *parent) : IntroStage(parent),
_intro(this, lang(lng_intro), st::introLabel, st::introLabelTextStyle),
_next(this, lang(lng_start_msgs), st::btnIntroNext),
_changeLang(this, QString()) {
_changeLang(this, QString()),
_next(this, lang(lng_start_msgs), st::btnIntroNext) {
_changeLang.hide();
if (cLang() == langEnglish) {
if (cLang() == languageEnglish) {
int32 l = App::app()->languageId();
if (l != langEnglish) {
if (l != languageEnglish) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[l] + qsl(".strings"), LangLoaderRequest(lng_switch_to_this));
QString text = loader.found().value(lng_switch_to_this);
if (!text.isEmpty()) {
@@ -45,7 +45,7 @@ _changeLang(this, QString()) {
}
} else {
_changeLang.setText(langOriginal(lng_switch_to_this));
parent->langChangeTo(langEnglish);
parent->langChangeTo(languageEnglish);
_changeLang.show();
}

View File

@@ -18,13 +18,13 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#pragma once
enum Languages {
langTestlang = -1,
languageTestlang = -1,
langEnglish = 0,
langItalian,
// langSpanish,
languageEnglish = 0,
languageItalian,
// languageSpanish,
langCount
languageCount
};
static const char *LanguageCodes[] = {

View File

@@ -642,8 +642,9 @@ BOOL _execUpdater(BOOL update = YES) {
}
path = [path stringByAppendingString:@"/Contents/Frameworks/Updater"];
NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:@"-workpath", QNSString(cWorkingDir()).s(), @"-tosettings", @"-procid", nil];
NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:@"-workpath", QNSString(cWorkingDir()).s(), @"-procid", nil];
[args addObject:[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]];
if (cRestartingToSettings()) [args addObject:@"-tosettings"];
if (!update) [args addObject:@"-noupdate"];
if (cFromAutoStart()) [args addObject:@"-autostart"];
if (cDebug()) [args addObject:@"-debug"];