mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Add language and scale settings.
This commit is contained in:
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "messenger.h"
|
||||
#include "lang/lang_instance.h"
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "styles/style_boxes.h"
|
||||
@@ -150,3 +151,27 @@ void LanguageBox::refreshLanguages() {
|
||||
}
|
||||
_inner->setSelected(currentIndex);
|
||||
}
|
||||
|
||||
base::binary_guard LanguageBox::Show() {
|
||||
auto result = base::binary_guard();
|
||||
|
||||
const auto manager = Messenger::Instance().langCloudManager();
|
||||
if (manager->languageList().isEmpty()) {
|
||||
auto guard = std::make_shared<base::binary_guard>();
|
||||
std::tie(result, *guard) = base::make_binary_guard();
|
||||
auto alive = std::make_shared<std::unique_ptr<base::Subscription>>(
|
||||
std::make_unique<base::Subscription>());
|
||||
**alive = manager->languageListChanged().add_subscription([=] {
|
||||
const auto show = guard->alive();
|
||||
*alive = nullptr;
|
||||
if (show) {
|
||||
Ui::show(Box<LanguageBox>());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Ui::show(Box<LanguageBox>());
|
||||
}
|
||||
manager->requestLanguageList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "base/binary_guard.h"
|
||||
|
||||
namespace Ui {
|
||||
class RadiobuttonGroup;
|
||||
@@ -21,6 +22,8 @@ public:
|
||||
LanguageBox(QWidget*) {
|
||||
}
|
||||
|
||||
static base::binary_guard Show();
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
|
Reference in New Issue
Block a user