mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 07:35:12 +00:00
Always show experimental settings
This commit is contained in:
@@ -264,5 +264,6 @@
|
|||||||
"ktg_jump_to_date_button": "Jump",
|
"ktg_jump_to_date_button": "Jump",
|
||||||
"ktg_jump_to_beginning": "Jump to beginning",
|
"ktg_jump_to_beginning": "Jump to beginning",
|
||||||
"ktg_show_calendar": "Show calendar",
|
"ktg_show_calendar": "Show calendar",
|
||||||
|
"ktg_in_app_update_disabled": "In-app updater is disabled.",
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
@@ -264,5 +264,6 @@
|
|||||||
"ktg_jump_to_date_button": "Перейти",
|
"ktg_jump_to_date_button": "Перейти",
|
||||||
"ktg_jump_to_beginning": "Перейти в начало",
|
"ktg_jump_to_beginning": "Перейти в начало",
|
||||||
"ktg_show_calendar": "Показать календарь",
|
"ktg_show_calendar": "Показать календарь",
|
||||||
|
"ktg_in_app_update_disabled": "Обновление внутри приложения отключено.",
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
@@ -86,12 +86,9 @@ bool HasUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetupUpdate(
|
void SetupUpdate(
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
Fn<void(Type)> showOther) {
|
Fn<void(Type)> showOther) {
|
||||||
if (!HasUpdate()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto texts = Ui::CreateChild<rpl::event_stream<QString>>(
|
const auto texts = Ui::CreateChild<rpl::event_stream<QString>>(
|
||||||
container.get());
|
container.get());
|
||||||
const auto downloading = Ui::CreateChild<rpl::event_stream<bool>>(
|
const auto downloading = Ui::CreateChild<rpl::event_stream<bool>>(
|
||||||
@@ -114,29 +111,48 @@ void SetupUpdate(
|
|||||||
container,
|
container,
|
||||||
object_ptr<Ui::VerticalLayout>(container)));
|
object_ptr<Ui::VerticalLayout>(container)));
|
||||||
const auto inner = options->entity();
|
const auto inner = options->entity();
|
||||||
const auto install = cAlphaVersion() ? nullptr : AddButton(
|
const auto install = (cAlphaVersion() || !HasUpdate()) ? nullptr : AddButton(
|
||||||
inner,
|
inner,
|
||||||
tr::lng_settings_install_beta(),
|
tr::lng_settings_install_beta(),
|
||||||
st::settingsButton).get();
|
st::settingsButton).get();
|
||||||
|
|
||||||
if (showOther) {
|
if (showOther) {
|
||||||
const auto experimental = inner->add(
|
const auto experimental = container->add(
|
||||||
object_ptr<Ui::SlideWrap<Button>>(
|
|
||||||
inner,
|
|
||||||
object_ptr<Button>(
|
object_ptr<Button>(
|
||||||
inner,
|
container,
|
||||||
tr::lng_settings_experimental(),
|
tr::lng_settings_experimental(),
|
||||||
st::settingsButton)));
|
st::settingsButton));
|
||||||
if (!install) {
|
experimental->setClickedCallback([=] {
|
||||||
experimental->toggle(true, anim::type::instant);
|
|
||||||
} else {
|
|
||||||
experimental->toggleOn(install->toggledValue());
|
|
||||||
}
|
|
||||||
experimental->entity()->setClickedCallback([=] {
|
|
||||||
showOther(Type::Experimental);
|
showOther(Type::Experimental);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::combine(
|
||||||
|
toggle->widthValue(),
|
||||||
|
label->widthValue()
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
label->moveToLeft(
|
||||||
|
st::settingsUpdateStatePosition.x(),
|
||||||
|
st::settingsUpdateStatePosition.y());
|
||||||
|
}, label->lifetime());
|
||||||
|
label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
||||||
|
if (!HasUpdate()) {
|
||||||
|
texts->fire_copy(version);
|
||||||
|
auto &lifetime = container->lifetime();
|
||||||
|
const auto toggles = lifetime.make_state<rpl::event_stream<bool>>();
|
||||||
|
toggle->toggleOn(toggles->events_starting_with(false));
|
||||||
|
toggle->toggledChanges(
|
||||||
|
) | rpl::start_with_next([=](bool value) {
|
||||||
|
if (value) {
|
||||||
|
toggles->fire_copy(false);
|
||||||
|
controller->showToast(ktr("ktg_in_app_update_disabled"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}, container->lifetime());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto check = AddButton(
|
const auto check = AddButton(
|
||||||
inner,
|
inner,
|
||||||
tr::lng_settings_check_now(),
|
tr::lng_settings_check_now(),
|
||||||
@@ -151,16 +167,6 @@ void SetupUpdate(
|
|||||||
update->moveToLeft(0, 0);
|
update->moveToLeft(0, 0);
|
||||||
}, update->lifetime());
|
}, update->lifetime());
|
||||||
|
|
||||||
rpl::combine(
|
|
||||||
toggle->widthValue(),
|
|
||||||
label->widthValue()
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
label->moveToLeft(
|
|
||||||
st::settingsUpdateStatePosition.x(),
|
|
||||||
st::settingsUpdateStatePosition.y());
|
|
||||||
}, label->lifetime());
|
|
||||||
label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
||||||
|
|
||||||
const auto showDownloadProgress = [=](int64 ready, int64 total) {
|
const auto showDownloadProgress = [=](int64 ready, int64 total) {
|
||||||
texts->fire(tr::lng_settings_downloading_update(
|
texts->fire(tr::lng_settings_downloading_update(
|
||||||
tr::now,
|
tr::now,
|
||||||
@@ -742,15 +748,16 @@ void Advanced::setupContent(not_null<Window::SessionController*> controller) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto addUpdate = [&] {
|
const auto addUpdate = [&] {
|
||||||
if (HasUpdate()) {
|
addDivider();
|
||||||
addDivider();
|
AddSkip(content);
|
||||||
AddSkip(content);
|
AddSubsectionTitle(content, tr::lng_settings_version_info());
|
||||||
AddSubsectionTitle(content, tr::lng_settings_version_info());
|
SetupUpdate(
|
||||||
SetupUpdate(content, [=](Type type) {
|
&controller->window(),
|
||||||
|
content,
|
||||||
|
[=](Type type) {
|
||||||
_showOther.fire_copy(type);
|
_showOther.fire_copy(type);
|
||||||
});
|
});
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if (!cAutoUpdate()) {
|
if (!cAutoUpdate()) {
|
||||||
addUpdate();
|
addUpdate();
|
||||||
|
@@ -25,6 +25,7 @@ void SetupConnectionType(
|
|||||||
not_null<Ui::VerticalLayout*> container);
|
not_null<Ui::VerticalLayout*> container);
|
||||||
bool HasUpdate();
|
bool HasUpdate();
|
||||||
void SetupUpdate(
|
void SetupUpdate(
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
Fn<void(Type)> showOther);
|
Fn<void(Type)> showOther);
|
||||||
void SetupSystemIntegrationContent(
|
void SetupSystemIntegrationContent(
|
||||||
|
@@ -69,7 +69,7 @@ object_ptr<Ui::RpWidget> CreateIntroSettings(
|
|||||||
if (HasUpdate()) {
|
if (HasUpdate()) {
|
||||||
AddDivider(result);
|
AddDivider(result);
|
||||||
AddSkip(result);
|
AddSkip(result);
|
||||||
SetupUpdate(result, nullptr);
|
SetupUpdate(window, result, nullptr);
|
||||||
AddSkip(result);
|
AddSkip(result);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user