mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
feat: trying to make ghost mode toggle in tray
This commit is contained in:
parent
a1aac455db
commit
e218f6da78
5 changed files with 36 additions and 1 deletions
|
@ -3889,4 +3889,4 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_IDCopiedToast" = "ID copied to clipboard.";
|
||||
"ayu_DrawerGhostModeToggle" = "Ghost Mode";
|
||||
"ayu_OpenFromTray" = "Open Ayugram";
|
||||
"ayu_QuitFromTray" = "Quit Ayugram";
|
||||
"ayu_QuitFromTray" = "Quit Ayugram";
|
||||
|
|
|
@ -153,6 +153,14 @@ namespace AyuSettings {
|
|||
GIFConfirmation = val;
|
||||
}
|
||||
|
||||
bool AyuGramSettings::getGhostModeValue() {
|
||||
return (!sendReadPackets
|
||||
&& !sendOnlinePackets
|
||||
&& !sendUploadProgress
|
||||
&& sendOfflinePacketAfterOnline);
|
||||
}
|
||||
|
||||
|
||||
rpl::producer<QString> get_deletedMarkReactive() {
|
||||
return deletedMarkReactive.value();
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ namespace AyuSettings {
|
|||
|
||||
void set_stickerConfirmation(bool val);
|
||||
void set_GIFConfirmation(bool val);
|
||||
|
||||
bool getGhostModeValue();
|
||||
};
|
||||
|
||||
AyuGramSettings &getInstance();
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <ayu/ayu_settings.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -88,6 +89,29 @@ void Tray::rebuildMenu() {
|
|||
[=] { toggleSoundNotifications(); });
|
||||
}
|
||||
|
||||
auto turnGhostModeText = _textUpdates.events(
|
||||
) | rpl::map([=] {
|
||||
auto settings = AyuSettings::AyuGramSettings();
|
||||
bool ghostModeEnabled = settings.getGhostModeValue();
|
||||
|
||||
return ghostModeEnabled
|
||||
? tr::ayu_DisableGhostMode(tr::now)
|
||||
: tr::ayu_EnableGhostMode(tr::now);
|
||||
});
|
||||
|
||||
_tray.addAction(rpl::single(QString("Toggle ghost mode")), [=] {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
bool ghostMode = (bool) AyuSettings::get_ghostModeEnabled();
|
||||
|
||||
settings->set_sendReadPackets(!ghostMode);
|
||||
settings->set_sendOnlinePackets(!ghostMode);
|
||||
settings->set_sendUploadProgress(!ghostMode);
|
||||
|
||||
settings->set_sendOfflinePacketAfterOnline(ghostMode);
|
||||
|
||||
AyuSettings::save();
|
||||
});
|
||||
|
||||
_tray.addAction(tr::ayu_QuitFromTray(), [] { Core::Quit(); });
|
||||
|
||||
updateMenuText();
|
||||
|
|
|
@ -69,6 +69,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_info.h" // infoTopBarMenu
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
#include "tray.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QScreen>
|
||||
|
|
Loading…
Add table
Reference in a new issue