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

temp downgrade to Qt 5.4 on OS X (Qt 5.5 does not support OS X 10.7)

This commit is contained in:
John Preston
2015-07-28 15:47:21 +02:00
parent aaf347432b
commit b0d67a65a8
11 changed files with 424 additions and 389 deletions

View File

@@ -217,7 +217,7 @@ void Application::updateGotCurrent() {
if (updates.exists()) {
QFileInfoList list = updates.entryInfoList(QDir::Files);
for (QFileInfoList::iterator i = list.begin(), e = list.end(); i != e; ++i) {
if (QRegularExpression("^(tupdate|tmacupd|tlinuxupd|tlinux32upd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
if (QRegularExpression("^(tupdate|tmacupd|tmac32upd|tlinuxupd|tlinux32upd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
QFile(i->absoluteFilePath()).remove();
}
}
@@ -514,7 +514,7 @@ void Application::startUpdateCheck(bool forceWait) {
if (updates.exists()) {
QFileInfoList list = updates.entryInfoList(QDir::Files);
for (QFileInfoList::iterator i = list.begin(), e = list.end(); i != e; ++i) {
if (QRegularExpression("^(tupdate|tmacupd|tlinuxupd|tlinux32upd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
if (QRegularExpression("^(tupdate|tmacupd|tmac32upd|tlinuxupd|tlinux32upd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
sendRequest = true;
}
}
@@ -524,7 +524,11 @@ void Application::startUpdateCheck(bool forceWait) {
if (sendRequest) {
QUrl url(cUpdateURL());
if (DevChannel) url.setQuery("dev=1");
if (cDevVersion()) {
url.setQuery(qsl("version=%1&dev=1").arg(AppVersion));
} else {
url.setQuery(qsl("version=%1").arg(AppVersion));
}
QString u = url.toString();
QNetworkRequest checkVersion(url);
if (updateReply) updateReply->deleteLater();
@@ -654,9 +658,9 @@ void Application::checkMapVersion() {
psRegisterCustomScheme();
if (Local::oldMapVersion()) {
QString versionFeatures;
if (DevChannel && Local::oldMapVersion() < 8041) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Pretty phone number formatting\n\xe2\x80\x94 Fixed shared contacts display\n\xe2\x80\x94 Fix KDE crash, use Qt tray icon in all Linux systems");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!DevChannel && Local::oldMapVersion() < 8042) {
if (cDevVersion() && Local::oldMapVersion() < 8042) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Dev version will now get updated to stable as well");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!cDevVersion() && Local::oldMapVersion() < 8043) {
versionFeatures = lang(lng_new_version_minor).trimmed();
}
if (!versionFeatures.isEmpty()) {

View File

@@ -256,15 +256,28 @@ void UpdateDownloader::unpackUpdate() {
return fatalFail();
}
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(DevChannel ? UpdatesPublicDevKey : UpdatesPublicKey), -1), 0, 0, 0);
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(DevVersion ? UpdatesPublicDevKey : UpdatesPublicKey), -1), 0, 0, 0);
if (!pbKey) {
LOG(("Update Error: cant read public rsa key!"));
return fatalFail();
}
if (RSA_verify(NID_sha1, (const uchar*)(compressed.constData() + hSigLen), hShaLen, (const uchar*)(compressed.constData()), hSigLen, pbKey) != 1) { // verify signature
RSA_free(pbKey);
LOG(("Update Error: bad RSA signature of update file!"));
return fatalFail();
if (cDevVersion()) { // try other public key, if we are in dev version
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(DevVersion ? UpdatesPublicKey : UpdatesPublicDevKey), -1), 0, 0, 0);
if (!pbKey) {
LOG(("Update Error: cant read public rsa key!"));
return fatalFail();
}
if (RSA_verify(NID_sha1, (const uchar*)(compressed.constData() + hSigLen), hShaLen, (const uchar*)(compressed.constData()), hSigLen, pbKey) != 1) { // verify signature
RSA_free(pbKey);
LOG(("Update Error: bad RSA signature of update file!"));
return fatalFail();
}
} else {
LOG(("Update Error: bad RSA signature of update file!"));
return fatalFail();
}
}
RSA_free(pbKey);

View File

@@ -24,7 +24,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
AboutBox::AboutBox() :
_done(this, lang(lng_about_done), st::aboutCloseButton),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (DevChannel ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) {
resizeMaxHeight(st::aboutWidth, st::aboutHeight);

View File

@@ -19,7 +19,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
static const int32 AppVersion = 8042;
static const wchar_t *AppVersionStr = L"0.8.42";
static const bool DevChannel = false;
static const bool DevVersion = false;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";

View File

@@ -232,6 +232,9 @@ void logsInit() {
logsInitDebug();
cSetDebug(true);
}
if (!cDevVersion() && QFile(cWorkingDir() + qsl("tdata/devversion")).exists()) {
cSetDevVersion(true);
}
QDir().setCurrent(cWorkingDir());
}

View File

@@ -79,6 +79,15 @@ int main(int argc, char *argv[]) {
DEBUG_LOG(("Application Info: Telegram done, result: %1").arg(result));
if (cRestartingUpdate()) {
if (DevVersion) {
LOG(("Writing 'withdebug' file before launching the Updater!"));
QFile f(cWorkingDir() + qsl("tdata/withdebug"));
if (!f.exists() && f.open(QIODevice::WriteOnly)) {
f.write("1");
f.close();
}
}
DEBUG_LOG(("Application Info: executing updater to install update.."));
psExecUpdater();
} else if (cRestarting()) {

View File

@@ -25,6 +25,7 @@ Qt::LayoutDirection gLangDir = Qt::LeftToRight;
mtpDcOptions gDcOptions;
bool gDevVersion = DevVersion;
bool gTestMode = false;
bool gDebug = false;
bool gManyInstance = false;
@@ -159,10 +160,13 @@ int gOtherOnline = 0;
float64 gSongVolume = 0.9;
void settingsParseArgs(int argc, char *argv[]) {
#ifdef Q_OS_MAC
gCustomNotifies = (QSysInfo::macVersion() < QSysInfo::MV_10_8);
#else
gCustomNotifies = true;
#ifdef Q_OS_MAC
if (QSysInfo::macVersion() < QSysInfo::MV_10_8) {
gUpdateURL = QUrl(qsl("http://tdesktop.com/mac32/tupdates/current"));
} else {
gCustomNotifies = false;
}
#endif
memset_rand(&gInstance, sizeof(gInstance));
gExeDir = psCurrentExeDirectory(argc, argv);

View File

@@ -64,6 +64,8 @@ struct mtpDcOption {
typedef QMap<int, mtpDcOption> mtpDcOptions;
DeclareSetting(mtpDcOptions, DcOptions);
DeclareSetting(bool, DevVersion);
DeclareSetting(bool, TestMode);
DeclareSetting(QString, LoggedPhoneNumber);
DeclareReadSetting(uint32, ConnectionsInSession);

View File

@@ -236,7 +236,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
connect(&_dpiAutoScale, SIGNAL(changed()), this, SLOT(onScaleAuto()));
connect(&_dpiSlider, SIGNAL(changed(int32)), this, SLOT(onScaleChange()));
_curVersionText = lng_settings_current_version(lt_version, QString::fromWCharArray(AppVersionStr) + (DevChannel ? " dev" : "")) + ' ';
_curVersionText = lng_settings_current_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : "")) + ' ';
_curVersionWidth = st::linkFont->m.width(_curVersionText);
_newVersionText = lang(lng_settings_update_ready) + ' ';
_newVersionWidth = st::linkFont->m.width(_newVersionText);