videoplayer cheat code -> experimental setting

This commit is contained in:
Ilya Fedin
2023-02-25 21:22:36 +04:00
committed by John Preston
parent 01d6cacee5
commit 1f1cd35d57
10 changed files with 19 additions and 22 deletions
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/data_document_resolver.h"
#include "base/options.h"
#include "base/platform/base_platform_info.h"
#include "ui/boxes/confirm_box.h"
#include "core/application.h"
@@ -36,6 +37,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Data {
namespace {
base::options::toggle OptionExternalVideoPlayer({
.id = kOptionExternalVideoPlayer,
.name = "External video player",
});
void ConfirmDontWarnBox(
not_null<Ui::GenericBox*> box,
rpl::producer<TextWithEntities> &&text,
@@ -117,6 +123,8 @@ void LaunchWithWarning(
} // namespace
const char kOptionExternalVideoPlayer[] = "external-video-player";
QString FileExtension(const QString &filepath) {
const auto reversed = ranges::views::reverse(filepath);
const auto last = ranges::find_first_of(reversed, ".\\/");
@@ -241,7 +249,7 @@ void ResolveDocument(
const auto msgId = item ? item->fullId() : FullMsgId();
const auto showDocument = [&] {
if (cUseExternalVideoPlayer()
if (OptionExternalVideoPlayer.value()
&& document->isVideoFile()
&& !document->filepath().isEmpty()) {
File::Launch(document->location(false).fname);