mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
videoplayer cheat code -> experimental setting
This commit is contained in:
parent
01d6cacee5
commit
1f1cd35d57
10 changed files with 19 additions and 22 deletions
|
@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
#include "platform/platform_file_utilities.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/options.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/view/media/history_view_gif.h"
|
||||
|
@ -1312,10 +1313,12 @@ bool DocumentData::useStreamingLoader() const {
|
|||
bool DocumentData::canBeStreamed(HistoryItem *item) const {
|
||||
// Streaming couldn't be used with external player
|
||||
// Maybe someone brave will implement this once upon a time...
|
||||
static const auto &ExternalVideoPlayer = base::options::lookup<bool>(
|
||||
Data::kOptionExternalVideoPlayer);
|
||||
return hasRemoteLocation()
|
||||
&& supportsStreaming()
|
||||
&& (!isVideoFile()
|
||||
|| !cUseExternalVideoPlayer()
|
||||
|| !ExternalVideoPlayer.value()
|
||||
|| (item && !item->allowsForward()));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace Data {
|
|||
|
||||
class DocumentMedia;
|
||||
|
||||
extern const char kOptionExternalVideoPlayer[];
|
||||
|
||||
[[nodiscard]] QString FileExtension(const QString &filepath);
|
||||
// [[nodiscard]] bool IsValidMediaFile(const QString &filepath);
|
||||
[[nodiscard]] bool IsExecutableName(const QString &filepath);
|
||||
|
|
|
@ -29,7 +29,6 @@ bool gStartMinimized = false;
|
|||
bool gStartInTray = false;
|
||||
bool gAutoStart = false;
|
||||
bool gSendToMenu = false;
|
||||
bool gUseExternalVideoPlayer = false;
|
||||
bool gAutoUpdate = true;
|
||||
LaunchMode gLaunchMode = LaunchModeNormal;
|
||||
bool gSeenTrayTooltip = false;
|
||||
|
|
|
@ -38,7 +38,6 @@ DeclareSetting(bool, AutoStart);
|
|||
DeclareSetting(bool, StartMinimized);
|
||||
DeclareSetting(bool, StartInTray);
|
||||
DeclareSetting(bool, SendToMenu);
|
||||
DeclareSetting(bool, UseExternalVideoPlayer);
|
||||
enum LaunchMode {
|
||||
LaunchModeNormal = 0,
|
||||
LaunchModeAutoStart,
|
||||
|
|
|
@ -116,19 +116,6 @@ auto GenerateCodes() {
|
|||
}
|
||||
});
|
||||
});
|
||||
codes.emplace(u"videoplayer"_q, [](SessionController *window) {
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
auto text = cUseExternalVideoPlayer()
|
||||
? u"Use internal video player?"_q
|
||||
: u"Use external video player?"_q;
|
||||
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
||||
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
||||
window->session().saveSettingsDelayed();
|
||||
Ui::hideLayer();
|
||||
} }));
|
||||
});
|
||||
codes.emplace(u"endpoints"_q, [](SessionController *window) {
|
||||
if (!Core::App().domain().started()) {
|
||||
return;
|
||||
|
|
|
@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/notifications_manager.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "storage/localimageloader.h"
|
||||
#include "data/data_document_resolver.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
|
@ -148,6 +149,7 @@ void SetupExperimental(
|
|||
addToggle(kOptionAutoScrollInactiveChat);
|
||||
addToggle(Window::Notifications::kOptionGNotification);
|
||||
addToggle(Core::kOptionFreeType);
|
||||
addToggle(Data::kOptionExternalVideoPlayer);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -192,12 +192,10 @@ bool ReadSetting(
|
|||
cSetSendToMenu(v == 1);
|
||||
} break;
|
||||
|
||||
case dbiUseExternalVideoPlayer: {
|
||||
case dbiUseExternalVideoPlayerOld: {
|
||||
qint32 v;
|
||||
stream >> v;
|
||||
if (!CheckStreamStatus(stream)) return false;
|
||||
|
||||
cSetUseExternalVideoPlayer(v == 1);
|
||||
} break;
|
||||
|
||||
case dbiCacheSettingsOld: {
|
||||
|
|
|
@ -140,7 +140,7 @@ enum {
|
|||
dbiNotificationsCornerOld = 0x46,
|
||||
dbiThemeKeyOld = 0x47,
|
||||
dbiDialogsWidthRatioOld = 0x48,
|
||||
dbiUseExternalVideoPlayer = 0x49,
|
||||
dbiUseExternalVideoPlayerOld = 0x49,
|
||||
dbiDcOptionsOld = 0x4a,
|
||||
dbiMtpAuthorization = 0x4b,
|
||||
dbiLastSeenWarningSeenOld = 0x4c,
|
||||
|
|
|
@ -860,7 +860,6 @@ void Account::writeSessionSettings(Main::SessionSettings *stored) {
|
|||
}
|
||||
|
||||
EncryptedDescriptor data(size);
|
||||
data.stream << quint32(dbiUseExternalVideoPlayer) << qint32(cUseExternalVideoPlayer());
|
||||
data.stream << quint32(dbiCacheSettings) << qint64(_cacheTotalSizeLimit) << qint32(_cacheTotalTimeLimit) << qint64(_cacheBigFileTotalSizeLimit) << qint32(_cacheBigFileTotalTimeLimit);
|
||||
if (!userData.isEmpty()) {
|
||||
data.stream << quint32(dbiSessionSettings) << userData;
|
||||
|
|
Loading…
Add table
Reference in a new issue