2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Move some code around.

Move logs:SignalHandlers to core/crash_reports:CrashReports.
Move all pre-launch windows to core/crash_report_window module.
Move some global code to core/launcher:Launcher.
It should replace settings / platform_specific module in some way.
This commit is contained in:
John Preston
2017-12-11 18:45:29 +04:00
parent 9d4558de2b
commit 97c15865a5
48 changed files with 2873 additions and 2373 deletions

View File

@@ -20,8 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
void InitFromCommandLine(int argc, char *argv[]);
extern bool gDebug;
inline bool cDebug() {
#if defined _DEBUG
@@ -55,8 +53,6 @@ inline bool rtl() {
return cRtl();
}
DeclareReadSetting(QString, Arguments);
DeclareSetting(bool, AlphaVersion);
DeclareSetting(uint64, BetaVersion);
DeclareSetting(uint64, RealBetaVersion);
@@ -169,15 +165,13 @@ DeclareRefSetting(EmojiColorVariants, EmojiVariants);
class DocumentData;
typedef QList<QPair<DocumentData*, int16> > RecentStickerPackOld;
typedef QVector<QPair<uint64, ushort> > RecentStickerPreload;
typedef QVector<QPair<DocumentData*, ushort> > RecentStickerPack;
typedef QList<QPair<DocumentData*, int16>> RecentStickerPackOld;
typedef QVector<QPair<uint64, ushort>> RecentStickerPreload;
typedef QVector<QPair<DocumentData*, ushort>> RecentStickerPack;
DeclareSetting(RecentStickerPreload, RecentStickersPreload);
DeclareRefSetting(RecentStickerPack, RecentStickers);
RecentStickerPack &cGetRecentStickers();
typedef QList<QPair<QString, ushort> > RecentHashtagPack;
typedef QList<QPair<QString, ushort>> RecentHashtagPack;
DeclareRefSetting(RecentHashtagPack, RecentWriteHashtags);
DeclareSetting(RecentHashtagPack, RecentSearchHashtags);
@@ -203,41 +197,6 @@ inline bool passcodeCanTry() {
return dt >= 30000;
}
inline void incrementRecentHashtag(RecentHashtagPack &recent, const QString &tag) {
RecentHashtagPack::iterator i = recent.begin(), e = recent.end();
for (; i != e; ++i) {
if (i->first == tag) {
++i->second;
if (qAbs(i->second) > 0x4000) {
for (RecentHashtagPack::iterator j = recent.begin(); j != e; ++j) {
if (j->second > 1) {
j->second /= 2;
} else if (j->second > 0) {
j->second = 1;
}
}
}
for (; i != recent.begin(); --i) {
if (qAbs((i - 1)->second) > qAbs(i->second)) {
break;
}
qSwap(*i, *(i - 1));
}
break;
}
}
if (i == e) {
while (recent.size() >= 64) recent.pop_back();
recent.push_back(qMakePair(tag, 1));
for (i = recent.end() - 1; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) {
break;
}
qSwap(*i, *(i - 1));
}
}
}
DeclareSetting(QStringList, SendPaths);
DeclareSetting(QString, StartUrl);
@@ -271,5 +230,3 @@ DeclareSetting(int32, AutoDownloadPhoto);
DeclareSetting(int32, AutoDownloadAudio);
DeclareSetting(int32, AutoDownloadGif);
DeclareSetting(bool, AutoPlayGif);
void settingsParseArgs(int argc, char *argv[]);