Making showing chat IDs optional

This commit is contained in:
Eric Kotato 2019-10-04 17:26:05 +03:00
parent 4cd61812f9
commit 3d2ae1a844
5 changed files with 40 additions and 27 deletions

View file

@ -10,5 +10,6 @@
// },
// "sticker_height": 256,
// "big_emoji_outline": true,
// "always_show_scheduled": false
// "always_show_scheduled": false,
// "show_chat_id": false
}

View file

@ -172,6 +172,11 @@ bool Manager::readCustomFile() {
if (settingsAlwaysShowScheduledIterator != settingsFonts.constEnd() && (*settingsAlwaysShowScheduledIterator).isBool()) {
cSetAlwaysShowScheduled((*settingsAlwaysShowScheduledIterator).toBool());
}
const auto settingsShowChatIdIterator = settings.constFind(qsl("show_chat_id"));
if (settingsShowChatIdIterator != settingsFonts.constEnd() && (*settingsShowChatIdIterator).isBool()) {
cSetShowChatId((*settingsShowChatIdIterator).toBool());
}
return true;
}
@ -202,6 +207,7 @@ void Manager::writeDefaultFile() {
settings.insert(qsl("sticker_height"), cStickerHeight());
settings.insert(qsl("big_emoji_outline"), cBigEmojiOutline());
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
settings.insert(qsl("show_chat_id"), cShowChatId());
auto document = QJsonDocument();
document.setObject(settings);

View file

@ -255,16 +255,18 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
return result;
};
if (const auto user = _peer->asUser()) {
if (user->isBot()) {
addInfoOneLine(
tr::ktg_profile_bot_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_user_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
if (cShowChatId()) {
if (user->isBot()) {
addInfoOneLine(
tr::ktg_profile_bot_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_user_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
}
}
if (user->session().supportMode()) {
@ -295,21 +297,23 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
[=] { window->show(Box(EditContactBox, window, user)); },
tracker);
} else {
if (_peer->isChat()) {
addInfoOneLine(
tr::ktg_profile_group_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else if (_peer->isMegagroup()) {
addInfoOneLine(
tr::ktg_profile_supergroup_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_channel_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
if (cShowChatId()) {
if (_peer->isChat()) {
addInfoOneLine(
tr::ktg_profile_group_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else if (_peer->isMegagroup()) {
addInfoOneLine(
tr::ktg_profile_supergroup_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_channel_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
}
}
auto linkText = LinkValue(

View file

@ -212,4 +212,5 @@ bool gSemiboldFontIsBold = false;
int gStickerHeight = 256;
bool gBigEmojiOutline = true;
bool gAlwaysShowScheduled = false;
bool gAlwaysShowScheduled = false;
bool gShowChatId = false;

View file

@ -187,3 +187,4 @@ DeclareSetting(QString, MonospaceFont);
DeclareSetting(int, StickerHeight);
DeclareSetting(bool, BigEmojiOutline);
DeclareSetting(bool, AlwaysShowScheduled);
DeclareSetting(bool, ShowChatId);