mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add "show-peer-id-below-about" option.
This commit is contained in:
parent
597816db09
commit
625ae87eea
4 changed files with 38 additions and 0 deletions
|
@ -644,6 +644,17 @@ bool OpenExternalLink(
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CopyPeerId(
|
||||||
|
Window::SessionController *controller,
|
||||||
|
const Match &match,
|
||||||
|
const QVariant &context) {
|
||||||
|
TextUtilities::SetClipboardText(TextForMimeData{ match->captured(1) });
|
||||||
|
if (controller) {
|
||||||
|
controller->showToast(tr::lng_text_copied(tr::now));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ExportTestChatTheme(
|
void ExportTestChatTheme(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<const Data::CloudTheme*> theme) {
|
not_null<const Data::CloudTheme*> theme) {
|
||||||
|
@ -985,6 +996,10 @@ const std::vector<LocalUrlHandler> &InternalUrlHandlers() {
|
||||||
u"^url:(.+)$"_q,
|
u"^url:(.+)$"_q,
|
||||||
OpenExternalLink
|
OpenExternalLink
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
u"^copy:(.+)$"_q,
|
||||||
|
CopyPeerId
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "info/profile/info_profile_values.h"
|
#include "info/profile/info_profile_values.h"
|
||||||
|
|
||||||
|
#include "base/options.h"
|
||||||
#include "info/profile/info_profile_badge.h"
|
#include "info/profile/info_profile_badge.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
|
@ -37,6 +38,12 @@ namespace {
|
||||||
|
|
||||||
using UpdateFlag = Data::PeerUpdate::Flag;
|
using UpdateFlag = Data::PeerUpdate::Flag;
|
||||||
|
|
||||||
|
base::options::toggle ShowPeerIdBelowAbout({
|
||||||
|
.id = kOptionShowPeerIdBelowAbout,
|
||||||
|
.name = "Show Peer IDs in Profile",
|
||||||
|
.description = "Show peer IDs from API below their Bio / Description.",
|
||||||
|
});
|
||||||
|
|
||||||
auto PlainAboutValue(not_null<PeerData*> peer) {
|
auto PlainAboutValue(not_null<PeerData*> peer) {
|
||||||
return peer->session().changes().peerFlagsValue(
|
return peer->session().changes().peerFlagsValue(
|
||||||
peer,
|
peer,
|
||||||
|
@ -87,6 +94,8 @@ void StripExternalLinks(TextWithEntities &text) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
const char kOptionShowPeerIdBelowAbout[] = "show-peer-id-below-about";
|
||||||
|
|
||||||
rpl::producer<QString> NameValue(not_null<PeerData*> peer) {
|
rpl::producer<QString> NameValue(not_null<PeerData*> peer) {
|
||||||
return peer->session().changes().peerFlagsValue(
|
return peer->session().changes().peerFlagsValue(
|
||||||
peer,
|
peer,
|
||||||
|
@ -209,6 +218,16 @@ TextWithEntities AboutWithEntities(
|
||||||
if (stripExternal) {
|
if (stripExternal) {
|
||||||
StripExternalLinks(result);
|
StripExternalLinks(result);
|
||||||
}
|
}
|
||||||
|
if (ShowPeerIdBelowAbout.value()) {
|
||||||
|
using namespace Ui::Text;
|
||||||
|
if (!result.empty()) {
|
||||||
|
result.append("\n");
|
||||||
|
}
|
||||||
|
result.append(Italic(u"id: "_q));
|
||||||
|
const auto raw = peer->id.value & PeerId::kChatTypeMask;
|
||||||
|
const auto id = QString::number(raw);
|
||||||
|
result.append(Link(Italic(id), "internal:copy:" + id));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ enum class SharedMediaType : signed char;
|
||||||
|
|
||||||
namespace Info::Profile {
|
namespace Info::Profile {
|
||||||
|
|
||||||
|
extern const char kOptionShowPeerIdBelowAbout[];
|
||||||
|
|
||||||
inline auto ToSingleLine() {
|
inline auto ToSingleLine() {
|
||||||
return rpl::map([](const QString &text) {
|
return rpl::map([](const QString &text) {
|
||||||
return TextUtilities::SingleLine(text);
|
return TextUtilities::SingleLine(text);
|
||||||
|
|
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/launcher.h"
|
#include "core/launcher.h"
|
||||||
#include "chat_helpers/tabbed_panel.h"
|
#include "chat_helpers/tabbed_panel.h"
|
||||||
#include "dialogs/dialogs_widget.h"
|
#include "dialogs/dialogs_widget.h"
|
||||||
|
#include "info/profile/info_profile_values.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "media/player/media_player_instance.h"
|
#include "media/player/media_player_instance.h"
|
||||||
|
@ -141,6 +142,7 @@ void SetupExperimental(
|
||||||
addToggle(Dialogs::kOptionForumHideChatsList);
|
addToggle(Dialogs::kOptionForumHideChatsList);
|
||||||
addToggle(Core::kOptionFractionalScalingEnabled);
|
addToggle(Core::kOptionFractionalScalingEnabled);
|
||||||
addToggle(Window::kOptionViewProfileInChatsListContextMenu);
|
addToggle(Window::kOptionViewProfileInChatsListContextMenu);
|
||||||
|
addToggle(Info::Profile::kOptionShowPeerIdBelowAbout);
|
||||||
addToggle(Ui::GL::kOptionAllowLinuxNvidiaOpenGL);
|
addToggle(Ui::GL::kOptionAllowLinuxNvidiaOpenGL);
|
||||||
addToggle(Ui::kOptionUseSmallMsgBubbleRadius);
|
addToggle(Ui::kOptionUseSmallMsgBubbleRadius);
|
||||||
addToggle(Media::Player::kOptionDisableAutoplayNext);
|
addToggle(Media::Player::kOptionDisableAutoplayNext);
|
||||||
|
|
Loading…
Add table
Reference in a new issue