2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-29 05:37:45 +00:00

[Improvement] Settings three-dots menu improvements

This commit is contained in:
RadRussianRus 2022-09-10 20:21:52 +03:00 committed by Eric Kotato
parent bb09cc9387
commit 727b35b961
4 changed files with 21 additions and 1 deletions

View File

@ -28,6 +28,8 @@
"ktg_mac_menu_show": "Show Kotatogram",
"ktg_settings_kotato": "Kotatogram Settings",
"ktg_user_status_unaccessible": "account inaccessible",
"ktg_settings_show_json_settings": "Show settings file",
"ktg_settings_restart": "Restart Kotatogram",
"ktg_settings_chats": "Chats",
"ktg_settings_sticker_height": "Sticker height: {pixels}px",
"ktg_settings_sticker_scale_both": "Apply to sticker width",

View File

@ -33,6 +33,7 @@ https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
#include "lang/lang_keys.h"
#include "core/update_checker.h"
#include "core/application.h"
#include "core/file_utilities.h"
#include "storage/localstorage.h"
#include "data/data_session.h"
#include "data/data_cloud_themes.h"
@ -43,6 +44,7 @@ https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
#include "styles/style_settings.h"
#include "ui/platform/ui_platform_utility.h"
#include "ui/vertical_list.h"
#include "styles/style_menu_icons.h"
namespace Settings {
@ -590,6 +592,19 @@ void SetupKotatoOther(
Ui::AddSkip(container);
}
void KotatoTopBarOptions(const Ui::Menu::MenuCallback &addAction) {
const auto customSettingsFile = cWorkingDir() + "tdata/kotato-settings-custom.json";
addAction(
ktr("ktg_settings_show_json_settings"),
[=] { File::ShowInFolder(customSettingsFile); },
&st::menuIconSettings);
addAction(
ktr("ktg_settings_restart"),
[] { Core::Restart(); },
&st::menuIconRestore);
}
Kotato::Kotato(
QWidget *parent,
not_null<Window::SessionController*> controller)
@ -603,7 +618,7 @@ rpl::producer<QString> Kotato::title() {
}
void Kotato::fillTopBarMenu(const Ui::Menu::MenuCallback &addAction) {
const auto window = &_controller->window();
KotatoTopBarOptions(addAction);
}
void Kotato::setupContent(not_null<Window::SessionController*> controller) {

View File

@ -23,6 +23,8 @@ void SetupKotatoSystem(
not_null<Ui::VerticalLayout*> container);
void SetupKotatoOther(not_null<Ui::VerticalLayout*> container);
void KotatoTopBarOptions(const Ui::Menu::MenuCallback &addAction);
class Kotato : public Section<Kotato> {
public:
Kotato(

View File

@ -697,6 +697,7 @@ void Main::fillTopBarMenu(const Ui::Menu::MenuCallback &addAction) {
[=] { showOther(Information::Id()); },
&st::menuIconInfo);
}
KotatoTopBarOptions(addAction);
const auto window = &_controller->window();
addAction({
.text = tr::lng_settings_logout(tr::now),