Skip to content

Commit

Permalink
fix: 影院加界面开关处理“全屏时显示倒计时”,开关默认为关
Browse files Browse the repository at this point in the history
影院加界面开关处理“全屏时显示倒计时”,开关默认为关

Task: https://pms.uniontech.com/task-view-369309.html
Log: 影院加界面开关处理“全屏时显示倒计时”,开关默认为关
  • Loading branch information
myk1343 authored and deepin-bot[bot] committed Dec 4, 2024
1 parent 1eb1cdc commit 15ae994
Show file tree
Hide file tree
Showing 14 changed files with 829 additions and 736 deletions.
7 changes: 7 additions & 0 deletions assets/resources/data/GstSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"type": "checkbox",
"default": false
},
{
"key": "showTimeFullScreen",
"name": "",
"type": "checkbox",
"text": "Display countdown in full screen mode",
"default": "false"
},
{
"key": "emptylist",
"name": "",
Expand Down
7 changes: 7 additions & 0 deletions assets/resources/data/lowEffectSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"type": "checkbox",
"default": false
},
{
"key": "showTimeFullScreen",
"name": "",
"type": "checkbox",
"text": "Display countdown in full screen mode",
"default": "false"
},
{
"key": "emptylist",
"name": "",
Expand Down
7 changes: 7 additions & 0 deletions assets/resources/data/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"type": "checkbox",
"default": false
},
{
"key": "showTimeFullScreen",
"name": "",
"type": "checkbox",
"text": "Display countdown in full screen mode",
"default": "false"
},
{
"key": "emptylist",
"name": "",
Expand Down
2 changes: 2 additions & 0 deletions src/backends/mpv/mpv_glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,8 @@ namespace dmr {
#ifdef __x86_64__
QWidget *topWidget = topLevelWidget();
if(topWidget && (topWidget->isFullScreen())) {//全屏状态播放时更新显示进度
QVariant varShow = topWidget->property("showTimeFullScreen");
if(!varShow.isValid() || !varShow.toBool()) return;
QString time_text = QTime::currentTime().toString("hh:mm");
QRect rectTime = QRect(rect().width() - 90, 0, 90, 40);
QPainter painter;
Expand Down
4 changes: 4 additions & 0 deletions src/common/dmr_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Settings::Settings()
emit hwaccelModeChanged(key, value);
else if (key.startsWith("base.play.mute"))
emit baseMuteChanged(key, value);
else if (key.startsWith("base.play.showTimeFullScreen"))
emit showTimeFullScreenChanged(key, value);
else if (key.startsWith("base."))
emit baseChanged(key, value);
else if (key.startsWith("subtitle."))
Expand Down Expand Up @@ -106,6 +108,8 @@ Settings::Settings()
QString Settings::flag2key(Settings::Flag f)
{
switch (f) {
case Settings::Flag::ShowTimeFullScreen:
return "showTimeFullScreen";
case Settings::Flag::ClearWhenQuit:
return "emptylist";
#ifndef __aarch64__
Expand Down
9 changes: 8 additions & 1 deletion src/common/dmr_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ class Settings: public QObject
* @param 配置的值
*/
void hwaccelModeChanged(const QString &, const QVariant &);

/**
* @brief base.play.hwaccel配置值变化后发送的信号
* @param base.play.hwaccel下的某一配置
* @param 配置的值
*/
void showTimeFullScreenChanged(const QString &, const QVariant &);

public:
enum Flag {
ClearWhenQuit,
Expand All @@ -78,6 +84,7 @@ class Settings: public QObject
PreviewOnMouseover,
MultipleInstance,
PauseOnMinimize,
ShowTimeFullScreen,
};
/**
* @brief 获取类单列对象
Expand Down
28 changes: 24 additions & 4 deletions src/common/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,24 @@ MainWindow::MainWindow(QWidget *parent)
m_pPopupWid = new MessageWindow(this);
m_pPopupWid->hide();
defaultplaymodeinit();

m_bShowTime = Settings::get().internalOption("showTimeFullScreen").toBool();
setProperty("showTimeFullScreen", Settings::get().internalOption("showTimeFullScreen"));
connect(&Settings::get(), &Settings::defaultplaymodechanged, this, &MainWindow::slotdefaultplaymodechanged);
connect(&Settings::get(), &Settings::setDecodeModel, this, &MainWindow::onSetDecodeModel,Qt::DirectConnection);
connect(&Settings::get(), &Settings::refreshDecode, this, &MainWindow::onRefreshDecode,Qt::DirectConnection);
connect(&Settings::get(), &Settings::showTimeFullScreenChanged, this, [&](const QString &key, const QVariant &value) {
if(value.isValid()) {
m_bShowTime = value.toBool();
setProperty("showTimeFullScreen", value);
//The X86 platform draws on GiWidget, and the MIPS platform does not need to draw
if (CompositingManager::get().platform() == Platform::Arm64 || CompositingManager::get().platform() == Platform::Alpha) {
if(m_pEngine && (m_pEngine->state() != PlayerEngine::Idle) && isFullScreen()) {
m_pProgIndicator->setVisible(value.toBool());
m_pFullScreenTimeLable->setVisible(value.toBool());
}
}
}
},Qt::DirectConnection);
connect(m_pEngine, &PlayerEngine::onlineStateChanged, this, &MainWindow::checkOnlineState);
connect(&OnlineSubtitle::get(), &OnlineSubtitle::onlineSubtitleStateChanged, this, &MainWindow::checkOnlineSubtitle);
connect(m_pEngine, &PlayerEngine::mpvErrorLogsChanged, this, &MainWindow::checkErrorMpvLogsChanged);
Expand Down Expand Up @@ -1152,7 +1166,9 @@ void MainWindow::onWindowStateChanged()

//The X86 platform draws on GiWidget, and the MIPS platform does not need to draw
if (CompositingManager::get().platform() == Platform::Arm64 || CompositingManager::get().platform() == Platform::Alpha) {
m_pProgIndicator->setVisible(isFullScreen() && m_pEngine && m_pEngine->state() != PlayerEngine::Idle);
if(m_bShowTime) {
m_pProgIndicator->setVisible(isFullScreen() && m_pEngine && m_pEngine->state() != PlayerEngine::Idle);
}
}

#ifndef USE_DXCB
Expand Down Expand Up @@ -2126,7 +2142,9 @@ void MainWindow::requestAction(ActionFactory::ActionKind actionKind, bool bFromU
QRect deskRect = QApplication::desktop()->availableGeometry();
pixelsWidth = qMax(117, pixelsWidth);
m_pFullScreenTimeLable->setGeometry(deskRect.width() - pixelsWidth - 60, 40, pixelsWidth + 60, 36);
m_pFullScreenTimeLable->show();
if(m_bShowTime) {
m_pFullScreenTimeLable->show();
}
}
}
}
Expand Down Expand Up @@ -4347,7 +4365,9 @@ void MainWindow::toggleUIMode()
QRect deskRect = QApplication::desktop()->availableGeometry();
pixelsWidth = qMax(117, pixelsWidth);
m_pFullScreenTimeLable->setGeometry(deskRect.width() - pixelsWidth - 60, 40, pixelsWidth + 60, 36);
m_pFullScreenTimeLable->show();
if(m_bShowTime) {
m_pFullScreenTimeLable->show();
}
}
}
setFocus();
Expand Down
1 change: 1 addition & 0 deletions src/common/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ protected slots:
bool m_bHaveFile; ///导入是否包含文件(用于导入文件或文件夹)
bool m_bMaxByScreenRemoved {false};
QRect m_mwdRect;
bool m_bShowTime {false}; ///全屏显示影片时间信息
};
};

Expand Down
28 changes: 23 additions & 5 deletions src/common/platform/platform_mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,10 @@ Platform_MainWindow::Platform_MainWindow(QWidget *parent)
int pixelsWidth = m_pToolbox->getfullscreentimeLabel()->width() + m_pToolbox->getfullscreentimeLabelend()->width();
pixelsWidth = qMax(117, pixelsWidth);
m_pFullScreenTimeLable->setGeometry(screenGeo.width() + screenGeo.x() - pixelsWidth - 60, 40 + screenGeo.y(), pixelsWidth + 60, 36);
m_pFullScreenTimeLable->show();
m_pProgIndicator->setVisible(true);
if(m_bShowTime) {
m_pFullScreenTimeLable->show();
m_pProgIndicator->setVisible(true);
}
QTimer::singleShot(200, [ = ]() {
activateWindow(); // show other window make mainwindow deactivate
setFocus();
Expand Down Expand Up @@ -987,10 +989,22 @@ Platform_MainWindow::Platform_MainWindow(QWidget *parent)
m_pPopupWid = new Platform_MessageWindow(this);
m_pPopupWid->hide();
defaultplaymodeinit();

m_bShowTime = Settings::get().internalOption("showTimeFullScreen").toBool();
connect(&Settings::get(), &Settings::defaultplaymodechanged, this, &Platform_MainWindow::slotdefaultplaymodechanged);
connect(&Settings::get(), &Settings::setDecodeModel, this, &Platform_MainWindow::onSetDecodeModel,Qt::DirectConnection);
connect(&Settings::get(), &Settings::refreshDecode, this, &Platform_MainWindow::onRefreshDecode,Qt::DirectConnection);
connect(&Settings::get(), &Settings::showTimeFullScreenChanged, this, [&](const QString &key, const QVariant &value) {
if(value.isValid()) {
m_bShowTime = value.toBool();
//The X86 platform draws on GiWidget, and the MIPS platform does not need to draw
if (CompositingManager::get().platform() != Platform::Mips) {
if(m_pEngine && (m_pEngine->state() != PlayerEngine::Idle) && isFullScreen()) {
m_pProgIndicator->setVisible(value.toBool());
m_pFullScreenTimeLable->setVisible(value.toBool());
}
}
}
},Qt::DirectConnection);
connect(m_pEngine, &PlayerEngine::onlineStateChanged, this, &Platform_MainWindow::checkOnlineState);
connect(&OnlineSubtitle::get(), &OnlineSubtitle::onlineSubtitleStateChanged, this, &Platform_MainWindow::checkOnlineSubtitle);
connect(m_pEngine, &PlayerEngine::mpvErrorLogsChanged, this, &Platform_MainWindow::checkErrorMpvLogsChanged);
Expand Down Expand Up @@ -1161,7 +1175,9 @@ void Platform_MainWindow::onWindowStateChanged()
m_pTitlebar->setVisible(false);
}
if (CompositingManager::get().platform() != Platform::Mips)
m_pProgIndicator->setVisible(isFullScreen() && m_pEngine && m_pEngine->state() != PlayerEngine::Idle);
if(m_bShowTime) {
m_pProgIndicator->setVisible(isFullScreen() && m_pEngine && m_pEngine->state() != PlayerEngine::Idle);
}

#ifndef USE_DXCB
m_pTitlebar->move(0, 0);
Expand Down Expand Up @@ -2096,7 +2112,9 @@ void Platform_MainWindow::requestAction(ActionFactory::ActionKind actionKind, bo
int pixelsWidth = m_pToolbox->getfullscreentimeLabel()->width() + m_pToolbox->getfullscreentimeLabelend()->width();
pixelsWidth = qMax(117, pixelsWidth);
m_pFullScreenTimeLable->setGeometry(screenGeo.width() + screenGeo.x() - pixelsWidth - 60, 40 + screenGeo.y(), pixelsWidth + 60, 36);
m_pFullScreenTimeLable->show();
if(m_bShowTime) {
m_pFullScreenTimeLable->show();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/common/platform/platform_mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ protected slots:
bool m_bIsWM {true}; ///是否开启窗口特效
bool m_bMaximized; ///全屏前最大化窗口记录
bool m_bLocked{true};
bool m_bShowTime {false}; ///全屏显示影片时间信息
};
};

Expand Down
1 change: 1 addition & 0 deletions src/common/settings_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

void GenerateSettingTranslate()
{
auto base_play_showTimeFullScreenText = QObject::tr("Display countdown in full screen mode");
auto base_play_addsimilarText = QObject::tr("Auto add similar files to play");
auto base_play_emptylistText = QObject::tr("Clear playlist when exit");
auto base_play_showthumbnailmode = QObject::tr("Show thumbnails in progress bar");
Expand Down
Loading

0 comments on commit 15ae994

Please sign in to comment.