mirror of https://github.com/procxx/kepka.git
Use external video player by hidden setting (#3021)
Signed-off-by: Behnam Emamian <emamian@persianprocess.com> (github: BehnamEmamian)
This commit is contained in:
parent
e071e2cf6f
commit
54c409d967
|
@ -559,6 +559,7 @@ enum {
|
||||||
dbiNotificationsCorner = 0x46,
|
dbiNotificationsCorner = 0x46,
|
||||||
dbiTheme = 0x47,
|
dbiTheme = 0x47,
|
||||||
dbiDialogsWidthRatio = 0x48,
|
dbiDialogsWidthRatio = 0x48,
|
||||||
|
dbiUseExternalVideoPlayer = 0x49,
|
||||||
|
|
||||||
dbiEncryptedWithSalt = 333,
|
dbiEncryptedWithSalt = 333,
|
||||||
dbiEncrypted = 444,
|
dbiEncrypted = 444,
|
||||||
|
@ -928,6 +929,14 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version) {
|
||||||
cSetSendToMenu(v == 1);
|
cSetSendToMenu(v == 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case dbiUseExternalVideoPlayer: {
|
||||||
|
qint32 v;
|
||||||
|
stream >> v;
|
||||||
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
|
cSetUseExternalVideoPlayer(v == 1);
|
||||||
|
} break;
|
||||||
|
|
||||||
case dbiSoundNotify: {
|
case dbiSoundNotify: {
|
||||||
qint32 v;
|
qint32 v;
|
||||||
stream >> v;
|
stream >> v;
|
||||||
|
@ -1656,6 +1665,7 @@ void _writeUserSettings() {
|
||||||
data.stream << quint32(dbiModerateMode) << qint32(Global::ModerateModeEnabled() ? 1 : 0);
|
data.stream << quint32(dbiModerateMode) << qint32(Global::ModerateModeEnabled() ? 1 : 0);
|
||||||
data.stream << quint32(dbiAutoPlay) << qint32(cAutoPlayGif() ? 1 : 0);
|
data.stream << quint32(dbiAutoPlay) << qint32(cAutoPlayGif() ? 1 : 0);
|
||||||
data.stream << quint32(dbiDialogsWidthRatio) << qint32(snap(qRound(Global::DialogsWidthRatio() * 1000000), 0, 1000000));
|
data.stream << quint32(dbiDialogsWidthRatio) << qint32(snap(qRound(Global::DialogsWidthRatio() * 1000000), 0, 1000000));
|
||||||
|
data.stream << quint32(dbiUseExternalVideoPlayer) << qint32(cUseExternalVideoPlayer());
|
||||||
|
|
||||||
{
|
{
|
||||||
RecentEmojisPreload v(cRecentEmojisPreload());
|
RecentEmojisPreload v(cRecentEmojisPreload());
|
||||||
|
|
|
@ -51,6 +51,7 @@ bool gStartMinimized = false;
|
||||||
bool gStartInTray = false;
|
bool gStartInTray = false;
|
||||||
bool gAutoStart = false;
|
bool gAutoStart = false;
|
||||||
bool gSendToMenu = false;
|
bool gSendToMenu = false;
|
||||||
|
bool gUseExternalVideoPlayer = false;
|
||||||
bool gAutoUpdate = true;
|
bool gAutoUpdate = true;
|
||||||
TWindowPos gWindowPos;
|
TWindowPos gWindowPos;
|
||||||
LaunchMode gLaunchMode = LaunchModeNormal;
|
LaunchMode gLaunchMode = LaunchModeNormal;
|
||||||
|
|
|
@ -69,6 +69,7 @@ DeclareSetting(bool, AutoStart);
|
||||||
DeclareSetting(bool, StartMinimized);
|
DeclareSetting(bool, StartMinimized);
|
||||||
DeclareSetting(bool, StartInTray);
|
DeclareSetting(bool, StartInTray);
|
||||||
DeclareSetting(bool, SendToMenu);
|
DeclareSetting(bool, SendToMenu);
|
||||||
|
DeclareSetting(bool, UseExternalVideoPlayer);
|
||||||
enum LaunchMode {
|
enum LaunchMode {
|
||||||
LaunchModeNormal = 0,
|
LaunchModeNormal = 0,
|
||||||
LaunchModeAutoStart,
|
LaunchModeAutoStart,
|
||||||
|
|
|
@ -88,6 +88,14 @@ void fillCodes() {
|
||||||
main->getDifference();
|
main->getDifference();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Codes.insert(qsl("videoplayer"), []() {
|
||||||
|
auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?");
|
||||||
|
Ui::show(Box<ConfirmBox>(text, [] {
|
||||||
|
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
||||||
|
Local::writeUserSettings();
|
||||||
|
Ui::hideLayer();
|
||||||
|
}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void codesFeedString(const QString &text) {
|
void codesFeedString(const QString &text) {
|
||||||
|
|
|
@ -99,10 +99,14 @@ void MainWindow::showPhoto(PhotoData *photo, PeerData *peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showDocument(DocumentData *doc, HistoryItem *item) {
|
void MainWindow::showDocument(DocumentData *doc, HistoryItem *item) {
|
||||||
if (_mediaView->isHidden()) Ui::hideLayer(true);
|
if (cUseExternalVideoPlayer() && doc->isVideo()) {
|
||||||
_mediaView->showDocument(doc, item);
|
QDesktopServices::openUrl(QUrl("file:///" + doc->location(false).fname));
|
||||||
_mediaView->activateWindow();
|
} else {
|
||||||
_mediaView->setFocus();
|
if (_mediaView->isHidden()) Ui::hideLayer(true);
|
||||||
|
_mediaView->showDocument(doc, item);
|
||||||
|
_mediaView->activateWindow();
|
||||||
|
_mediaView->setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::ui_isMediaViewShown() {
|
bool MainWindow::ui_isMediaViewShown() {
|
||||||
|
|
Loading…
Reference in New Issue