mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Added option for chat names in titles of single peer windows.
This commit is contained in:
parent
e2205c7251
commit
cc0b1b1d54
3 changed files with 24 additions and 6 deletions
|
@ -138,6 +138,7 @@ void SetupExperimental(
|
|||
addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick);
|
||||
addToggle(Window::kOptionViewProfileInChatsListContextMenu);
|
||||
addToggle(Dialogs::kOptionCtrlClickChatNewWindow);
|
||||
addToggle(Window::kOptionShowChatNameInNewWindow);
|
||||
addToggle(Ui::GL::kOptionAllowLinuxNvidiaOpenGL);
|
||||
addToggle(Ui::kOptionUseSmallMsgBubbleRadius);
|
||||
addToggle(Media::Player::kOptionDisableAutoplayNext);
|
||||
|
|
|
@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "base/options.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/crc32hash.h"
|
||||
#include "ui/toast/toast.h"
|
||||
|
@ -48,8 +49,16 @@ namespace {
|
|||
|
||||
constexpr auto kSaveWindowPositionTimeout = crl::time(1000);
|
||||
|
||||
base::options::toggle ShowChatNameInNewWindow({
|
||||
.id = kOptionShowChatNameInNewWindow,
|
||||
.name = "Show chat name in title of separated windows",
|
||||
.description = "",
|
||||
});
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kOptionShowChatNameInNewWindow[] = "show-chat-name-in-new-window";
|
||||
|
||||
const QImage &Logo() {
|
||||
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
|
||||
return result;
|
||||
|
@ -798,12 +807,18 @@ void MainWindow::updateUnreadCounter() {
|
|||
}
|
||||
|
||||
const auto counter = Core::App().unreadBadge();
|
||||
const auto additionalName = singlePeer()
|
||||
? u" %1 %2"_q.arg(QChar(8212), singlePeer()->name())
|
||||
: QString();
|
||||
setTitle(((counter > 0)
|
||||
? u"Telegram (%1)"_q.arg(counter)
|
||||
: u"Telegram"_q) + additionalName);
|
||||
if (ShowChatNameInNewWindow.value()) {
|
||||
const auto additionalName = singlePeer()
|
||||
? u" %1 %2"_q.arg(QChar(8212), singlePeer()->name())
|
||||
: QString();
|
||||
setTitle(((counter > 0)
|
||||
? u"Telegram (%1)"_q.arg(counter)
|
||||
: u"Telegram"_q) + additionalName);
|
||||
} else {
|
||||
setTitle((counter > 0)
|
||||
? u"Telegram (%1)"_q.arg(counter)
|
||||
: u"Telegram"_q);
|
||||
}
|
||||
|
||||
Core::App().tray().updateIconCounters();
|
||||
unreadCounterChangedHook();
|
||||
|
|
|
@ -55,6 +55,8 @@ struct CounterLayerArgs {
|
|||
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
|
||||
[[nodiscard]] QImage WithSmallCounter(QImage image, CounterLayerArgs &&args);
|
||||
|
||||
extern const char kOptionShowChatNameInNewWindow[];
|
||||
|
||||
class MainWindow : public Ui::RpWindow {
|
||||
public:
|
||||
explicit MainWindow(not_null<Controller*> controller);
|
||||
|
|
Loading…
Add table
Reference in a new issue