Skip to content

Commit 1f219c1

Browse files
committed
Add screenCapturable support
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
1 parent 4fd3054 commit 1f219c1

File tree

17 files changed

+110
-30
lines changed

17 files changed

+110
-30
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
- name: Install Qt
5050
uses: jurplel/install-qt-action@v4
5151
with:
52-
version: '6.5.3'
52+
version: '6.8.1'
5353
modules: 'qtwebsockets qtserialport qtmultimedia'
54-
aqtversion: ==3.1.7
54+
aqtversion: '==3.1.20'
5555

5656
- name: Install prerequisites
5757
run: |
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
git fetch --tags --force
8686
sed -i 's/--long --dirty/--long/g' ./tools/generate_info.sh
87-
sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.5.3\/gcc_64/g' build_deb.sh
87+
sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.8.1\/gcc_64/g' build_deb.sh
8888
sed -i 's/LIBSSH2_DIR=\/libssh2/LIBSSH2_DIR=\/usr\/local\/output/g' ./lib/qtssh/qtssh.pri
8989
mkdir prebuilt_plugins
9090
python3 ./.github/scripts/get_plugin.py ./.github/scripts/plugin_list.json ./prebuilt_plugins

.github/workflows/linux_appimage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
- name: Install Qt
5050
uses: jurplel/install-qt-action@v4
5151
with:
52-
version: '6.5.3'
52+
version: '6.8.1'
5353
modules: 'qtwebsockets qtserialport qtmultimedia'
54-
aqtversion: ==3.1.7
54+
aqtversion: '==3.1.20'
5555

5656
- name: Install prerequisites
5757
run: |
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
git fetch --tags --force
8686
sed -i 's/--long --dirty/--long/g' ./tools/generate_info.sh
87-
sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.5.3\/gcc_64/g' build_AppImage.sh
87+
sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.8.1\/gcc_64/g' build_AppImage.sh
8888
sed -i 's/LIBSSH2_DIR=\/libssh2/LIBSSH2_DIR=\/usr\/local\/output/g' ./lib/qtssh/qtssh.pri
8989
mkdir prebuilt_plugins
9090
python3 ./.github/scripts/get_plugin.py ./.github/scripts/plugin_list.json ./prebuilt_plugins

.github/workflows/macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
- name: Install Qt
5050
uses: jurplel/install-qt-action@v4
5151
with:
52-
version: '6.5.3'
52+
version: '6.8.1'
5353
modules: 'qtwebsockets qtserialport qtmultimedia'
54-
aqtversion: ==3.1.7
54+
aqtversion: '==3.1.20'
5555

5656
- name: Install prerequisites
5757
run: |
@@ -76,7 +76,7 @@ jobs:
7676
run: |
7777
git fetch --tags --force
7878
sed -i'.original' -e 's/--long --dirty/--long/g' ./tools/generate_info.sh
79-
sed -i'.original' -e 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.5.3\/macos/g' build_dmg.sh
79+
sed -i'.original' -e 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.8.1\/macos/g' build_dmg.sh
8080
sed -i'.original' -e 's/LIBSSH2_DIR=\/libssh2/LIBSSH2_DIR=\/usr\/local\/output/g' ./lib/qtssh/qtssh.pri
8181
mkdir prebuilt_plugins
8282
python3 ./.github/scripts/get_plugin.py ./.github/scripts/plugin_list.json ./prebuilt_plugins

.github/workflows/macos_arm64.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
- name: Install Qt
5050
uses: jurplel/install-qt-action@v4
5151
with:
52-
version: '6.5.3'
52+
version: '6.8.1'
5353
modules: 'qtwebsockets qtserialport qtmultimedia'
54-
aqtversion: ==3.1.7
54+
aqtversion: '==3.1.20'
5555

5656
- name: Install prerequisites
5757
run: |
@@ -76,7 +76,7 @@ jobs:
7676
run: |
7777
git fetch --tags --force
7878
sed -i'.original' -e 's/--long --dirty/--long/g' ./tools/generate_info.sh
79-
sed -i'.original' -e 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.5.3\/macos/g' build_dmg.sh
79+
sed -i'.original' -e 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.8.1\/macos/g' build_dmg.sh
8080
sed -i'.original' -e 's/LIBSSH2_DIR=\/libssh2/LIBSSH2_DIR=\/usr\/local\/output/g' ./lib/qtssh/qtssh.pri
8181
mkdir prebuilt_plugins
8282
python3 ./.github/scripts/get_plugin.py ./.github/scripts/plugin_list.json ./prebuilt_plugins

.github/workflows/windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
uses: jurplel/install-qt-action@v4
5151
with:
5252
arch: win64_mingw
53-
version: '6.5.3'
53+
version: '6.8.1'
5454
modules: 'qtwebsockets qtserialport qtmultimedia'
55-
aqtversion: ==3.1.7
55+
aqtversion: '==3.1.19'
5656

5757
- name: Install cmake
5858
uses: crazy-max/ghaction-chocolatey@v3
@@ -118,7 +118,7 @@ jobs:
118118
run: |
119119
git fetch --tags --force
120120
./tools/sed/sed.exe -i 's/--long --dirty/--long/g' ./tools/generate_info.ps1
121-
./tools/sed/sed.exe -i "s/QT_DIR=C:\/Qt\/Qt6.2.0\/6.2.0\/mingw81_32\/bin/QT_DIR=%Qt5_Dir%/g" ./build_setup.bat
121+
./tools/sed/sed.exe -i "s/QT_DIR=C:\/Qt\/Qt6.2.0\/6.2.0\/mingw81_32\/bin/QT_DIR=%QT_ROOT_DIR%\/bin/g" ./build_setup.bat
122122
./tools/sed/sed.exe -i "s/QT_TOOLS_DIR=C:\/Qt\/Qt6.2.0\/Tools\/mingw810_32\/bin/QT_TOOLS_DIR=C:\/ProgramData\/Chocolatey\/lib\/mingw\/tools\/install\/mingw64\/bin/g" ./build_setup.bat
123123
./tools/sed/sed.exe -i "s/mingw32-make -j8/mingw32-make -j1/g" ./build_setup.bat
124124
./tools/sed/sed.exe -i "s/WINPTY_DIR=D:\\quardCRT\\depend\\winpty/WINPTY_DIR=D:\\winpty/g" ./lib/ptyqt/ptyqt.pri

.github/workflows/windows_msvc.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ on:
4040
workflow_dispatch:
4141

4242
jobs:
43-
windows_msvc2019:
43+
windows_msvc2022:
4444
runs-on: windows-2022
4545

4646
steps:
@@ -49,10 +49,10 @@ jobs:
4949
- name: Install Qt
5050
uses: jurplel/install-qt-action@v4
5151
with:
52-
arch: 'win64_msvc2019_64'
53-
version: '6.5.3'
52+
arch: 'win64_msvc2022_64'
53+
version: '6.8.1'
5454
modules: 'qtwebsockets qtserialport qtmultimedia'
55-
aqtversion: '==3.1.7'
55+
aqtversion: '==3.1.19'
5656

5757
- name: Install cmake
5858
uses: crazy-max/ghaction-chocolatey@v3
@@ -81,7 +81,6 @@ jobs:
8181
uses: ilammy/msvc-dev-cmd@v1
8282
with:
8383
arch: x64
84-
toolset: 14.29
8584

8685
- name: Install libssh2
8786
run: |
@@ -111,7 +110,7 @@ jobs:
111110
- name: Upload build asserts
112111
uses: actions/upload-artifact@v4
113112
with:
114-
name: quardCRT_windows_msvc2019
113+
name: quardCRT_windows_msvc2022
115114
path: |
116115
./output/*.exe
117116

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Windows ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/windows.yml?branch=main&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4=)](https://github.com/QQxiaoming/quardCRT/actions/workflows/windows.yml)
22
[![Linux ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/linux.yml?branch=main&logo=linux&logoColor=white)](https://github.com/QQxiaoming/quardCRT/actions/workflows/linux.yml)
3-
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos.yml)
3+
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos_arm64.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos_arm64.yml)
44
[![CodeFactor](https://img.shields.io/codefactor/grade/github/qqxiaoming/quardCRT.svg?logo=codefactor)](https://www.codefactor.io/repository/github/qqxiaoming/quardCRT)
55
[![Documentation Status](https://img.shields.io/readthedocs/quardcrt.svg?logo=readthedocs)](https://quardcrt.readthedocs.io/en/latest/?badge=latest)
66
[![License](https://img.shields.io/github/license/qqxiaoming/quardCRT.svg?colorB=f48041&logo=gnu)](https://github.com/QQxiaoming/quardCRT)

README_ja_JP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Windows ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/windows.yml?branch=main&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4=)](https://github.com/QQxiaoming/quardCRT/actions/workflows/windows.yml)
22
[![Linux ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/linux.yml?branch=main&logo=linux&logoColor=white)](https://github.com/QQxiaoming/quardCRT/actions/workflows/linux.yml)
3-
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos.yml)
3+
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos_arm64.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos_arm64.yml)
44
[![CodeFactor](https://img.shields.io/codefactor/grade/github/qqxiaoming/quardCRT.svg?logo=codefactor)](https://www.codefactor.io/repository/github/qqxiaoming/quardCRT)
55
[![Documentation Status](https://img.shields.io/readthedocs/quardcrt.svg?logo=readthedocs)](https://quardcrt.readthedocs.io/en/latest/?badge=latest)
66
[![License](https://img.shields.io/github/license/qqxiaoming/quardCRT.svg?colorB=f48041&logo=gnu)](https://github.com/QQxiaoming/quardCRT)

README_zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Windows ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/windows.yml?branch=main&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4=)](https://github.com/QQxiaoming/quardCRT/actions/workflows/windows.yml)
22
[![Linux ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/linux.yml?branch=main&logo=linux&logoColor=white)](https://github.com/QQxiaoming/quardCRT/actions/workflows/linux.yml)
3-
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos.yml)
3+
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos_arm64.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos_arm64.yml)
44
[![CodeFactor](https://img.shields.io/codefactor/grade/github/qqxiaoming/quardCRT.svg?logo=codefactor)](https://www.codefactor.io/repository/github/qqxiaoming/quardCRT)
55
[![Documentation Status](https://img.shields.io/readthedocs/quardcrt.svg?logo=readthedocs)](https://quardcrt.readthedocs.io/en/latest/?badge=latest)
66
[![License](https://img.shields.io/github/license/qqxiaoming/quardCRT.svg?colorB=f48041&logo=gnu)](https://github.com/QQxiaoming/quardCRT)

README_zh_HK.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Windows ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/windows.yml?branch=main&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4=)](https://github.com/QQxiaoming/quardCRT/actions/workflows/windows.yml)
22
[![Linux ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/linux.yml?branch=main&logo=linux&logoColor=white)](https://github.com/QQxiaoming/quardCRT/actions/workflows/linux.yml)
3-
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos.yml)
3+
[![Macos ci](https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos_arm64.yml?branch=main&logo=apple)](https://github.com/QQxiaoming/quardCRT/actions/workflows/macos_arm64.yml)
44
[![CodeFactor](https://img.shields.io/codefactor/grade/github/qqxiaoming/quardCRT.svg?logo=codefactor)](https://www.codefactor.io/repository/github/qqxiaoming/quardCRT)
55
[![Documentation Status](https://img.shields.io/readthedocs/quardcrt.svg?logo=readthedocs)](https://quardcrt.readthedocs.io/en/latest/?badge=latest)
66
[![License](https://img.shields.io/github/license/qqxiaoming/quardCRT.svg?colorB=f48041&logo=gnu)](https://github.com/QQxiaoming/quardCRT)

depend/build_fcitx_qt6_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ set -e
33

44
# ubuntu20.04 need install
55
# sudo apt install fcitx-libs-dev qtbase5-private-dev libxkbcommon-dev extra-cmake-modules
6-
# export PATH="~/Qt/6.5.3/gcc_64/bin":$PATH
6+
# export PATH="~/Qt/6.8.1/gcc_64/bin":$PATH
77
# export PATH="~/Qt/Tools/CMake/bin":$PATH
8-
# export Qt6GuiTools_DIR=/home/qqm/Qt/6.5.3/gcc_64
8+
# export Qt6GuiTools_DIR=/home/qqm/Qt/6.8.1/gcc_64
99
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
1010
tar -xzvf fcitx-qt5-1.2.7.tar.gz
1111
cd $SHELL_FOLDER/fcitx-qt5-1.2.7

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ quardCRT
1111
.. image:: https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/linux.yml?branch=main&logo=linux&logoColor=white
1212
:target: https://github.com/QQxiaoming/quardCRT/actions/workflows/linux.yml
1313
:alt: Linux ci
14-
.. image:: https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos.yml?branch=main&logo=apple
15-
:target: https://github.com/QQxiaoming/quardCRT/actions/workflows/macos.yml
14+
.. image:: https://img.shields.io/github/actions/workflow/status/qqxiaoming/quardCRT/macos_arm64.yml?branch=main&logo=apple
15+
:target: https://github.com/QQxiaoming/quardCRT/actions/workflows/macos_arm64.yml
1616
:alt: Macos ci
1717
.. image:: https://img.shields.io/codefactor/grade/github/qqxiaoming/quardCRT.svg?logo=codefactor
1818
:target: https://www.codefactor.io/repository/github/qqxiaoming/quardCRT

lib/QGoodWindow/QGoodWindow/src/qgoodwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ void QGoodWindow::setup()
657657
#endif
658658

659659
#ifdef Q_OS_LINUX
660-
qputenv("XDG_SESSION_TYPE", "xcb");
660+
qputenv("XDG_SESSION_TYPE", "x11");
661661
qputenv("QT_QPA_PLATFORM", "xcb");
662662

663663
int argc = 0;

lib/QGoodWindow/QGoodWindow/src/qgoodwindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace QGoodWindowUtils
4343
{
4444
class NativeEventFilter;
4545
}
46+
#include <windows.h>
4647
#endif
4748

4849
#if defined Q_OS_WIN || defined Q_OS_LINUX

quardCRT.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ win32:{
287287
INCLUDEPATH += $${Python3_DIR}/include
288288
LIBS += -L$${Python3_DIR}/lib -lpython311
289289
}
290+
LIBS += -lmingw32 -mwindows
290291
}
291292
win32-msvc*{
292293
contains(DEFINES, ENABLE_PYTHON) {

src/mainwindow.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ CentralWidget::CentralWidget(QString dir, StartupUIMode mode, QLocale lang, bool
9090
pyRun = new PyRun(this);
9191
#endif
9292

93+
m_mediaCaptureSession = new QMediaCaptureSession(this);
94+
m_windowCapture = new QWindowCapture(this);
95+
m_mediaRecorder = new QMediaRecorder(this);
96+
m_mediaCaptureSession->setWindowCapture(m_windowCapture);
97+
m_mediaCaptureSession->setRecorder(m_mediaRecorder);
98+
m_mediaRecorder->setQuality(QMediaRecorder::HighQuality);
99+
93100
splitter = new QSplitter(Qt::Horizontal,this);
94101
splitter->setHandleWidth(1);
95102
ui->centralwidget->layout()->addWidget(splitter);
@@ -1710,6 +1717,9 @@ void CentralWidget::menuAndToolBarRetranslateUi(void) {
17101717
screenShotAction->setIcon(QFontIcon::icon(QChar(0xf03e)));
17111718
screenShotAction->setStatusTip(tr("Screen shot current screen <Alt+P>"));
17121719
screenShotAction->setShortcut(QKeySequence(Qt::ALT|Qt::Key_P));
1720+
screenCapturableAction->setText(tr("Screen Capturable"));
1721+
screenCapturableAction->setStatusTip(tr("Screen capturable current screen"));
1722+
screenCapturableAction->setShortcut(QKeySequence(Qt::ALT|Qt::Key_G));
17131723
sessionExportAction->setText(tr("Session Export"));
17141724
sessionExportAction->setIcon(QFontIcon::icon(QChar(0xf093)));
17151725
sessionExportAction->setStatusTip(tr("Export current session to a file <Alt+O>"));
@@ -2035,6 +2045,9 @@ void CentralWidget::menuAndToolBarInit(bool disable_plugin) {
20352045
ui->toolBar->addAction(printScreenAction);
20362046
screenShotAction = new QAction(this);
20372047
editMenu->addAction(screenShotAction);
2048+
screenCapturableAction = new QAction(this);
2049+
screenCapturableAction->setCheckable(true);
2050+
editMenu->addAction(screenCapturableAction);
20382051
sessionExportAction = new QAction(this);
20392052
editMenu->addAction(sessionExportAction);
20402053
editMenu->addSeparator();
@@ -2604,6 +2617,7 @@ void CentralWidget::setSessionClassActionEnable(bool enable)
26042617
findAction->setEnabled(enable);
26052618
printScreenAction->setEnabled(enable);
26062619
screenShotAction->setEnabled(enable);
2620+
screenCapturableAction->setEnabled(enable);
26072621
sessionExportAction->setEnabled(enable);
26082622
clearScrollbackAction->setEnabled(enable);
26092623
clearScreenAction->setEnabled(enable);
@@ -2928,6 +2942,48 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
29282942
settings.setValue("Global/Options/ScreenShotPath",QFileInfo(fileName).absolutePath());
29292943
ui->statusBar->showMessage(tr("Screenshot saved to %1").arg(fileName),3000);
29302944
});
2945+
connect(screenCapturableAction,&QAction::triggered,this,[=](){
2946+
if(!screenCapturableAction->isChecked()) {
2947+
m_mediaRecorder->stop();
2948+
m_windowCapture->stop();
2949+
ui->statusBar->showMessage(tr("ScreenCapturable stop."),3000);
2950+
} else {
2951+
QWidget *widget = findCurrentFocusWidget();
2952+
if(widget == nullptr) return;
2953+
2954+
QList<QCapturableWindow> windowList = QWindowCapture::capturableWindows();
2955+
bool find = false;
2956+
foreach(const QCapturableWindow &w, windowList) {
2957+
auto handle = QCapturableWindowPrivate::handle(w);
2958+
if(handle && handle->id == this->mainWindow->winId()) {
2959+
m_windowCapture->setWindow(w);
2960+
find = true;
2961+
break;
2962+
}
2963+
}
2964+
if(!find) {
2965+
screenCapturableAction->setChecked(false);
2966+
return;
2967+
}
2968+
2969+
GlobalSetting settings;
2970+
QString screenCapturablePath = settings.value("Global/Options/ScreenCapturablePath",QDir::homePath()).toString();
2971+
QString willsaveName = screenCapturablePath + "/quartCRT-" + QDateTime::currentDateTime().toString("yyyyMMddhhmmss") + ".mp4";
2972+
QString fileName = FileDialog::getSaveFileName(this,tr("Save Screenshot"),willsaveName,tr("Video Files (*.mp4)"));
2973+
if(fileName.isEmpty()) {
2974+
screenCapturableAction->setChecked(false);
2975+
return;
2976+
}
2977+
if(!fileName.endsWith(".mp4")) fileName.append(".mp4");
2978+
2979+
m_mediaRecorder->setOutputLocation(QUrl::fromLocalFile(fileName));
2980+
m_windowCapture->start();
2981+
m_mediaRecorder->record();
2982+
2983+
settings.setValue("Global/Options/ScreenCapturablePath",QFileInfo(fileName).absolutePath());
2984+
ui->statusBar->showMessage(tr("ScreenCapturable saved to %1").arg(fileName),3000);
2985+
}
2986+
});
29312987
connect(sessionExportAction,&QAction::triggered,this,[=](){
29322988
QWidget *widget = findCurrentFocusWidget();
29332989
if(widget == nullptr) return;

0 commit comments

Comments
 (0)