diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp
index 794accf..5388a1d 100644
--- a/QtScrcpy/dialog.cpp
+++ b/QtScrcpy/dialog.cpp
@@ -106,6 +106,9 @@ void Dialog::on_startServerBtn_clicked()
// this is ok that "native" toUshort is 0
quint16 videoSize = ui->videoSizeBox->currentText().trimmed().toUShort();
m_videoForm = new VideoForm(ui->serialBox->currentText().trimmed(), videoSize, bitRate, absFilePath);
+ if (ui->alwaysTopCheck->isChecked()) {
+ m_videoForm->staysOnTop();
+ }
outLog("start server...", false);
}
@@ -222,3 +225,16 @@ void Dialog::on_recordPathEdt_textChanged(const QString &arg1)
{
ui->recordPathEdt->setToolTip(arg1);
}
+
+void Dialog::on_alwaysTopCheck_stateChanged(int arg1)
+{
+ if (!m_videoForm) {
+ return;
+ }
+
+ if (Qt::Checked == arg1) {
+ m_videoForm->staysOnTop(true);
+ } else {
+ m_videoForm->staysOnTop(false);
+ }
+}
diff --git a/QtScrcpy/dialog.h b/QtScrcpy/dialog.h
index 524977c..1d81f8d 100644
--- a/QtScrcpy/dialog.h
+++ b/QtScrcpy/dialog.h
@@ -41,6 +41,8 @@ private slots:
void on_recordPathEdt_textChanged(const QString &arg1);
+ void on_alwaysTopCheck_stateChanged(int arg1);
+
private:
bool checkAdbRun();
void initUI();
diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui
index 663f655..e05a5bb 100644
--- a/QtScrcpy/dialog.ui
+++ b/QtScrcpy/dialog.ui
@@ -158,17 +158,13 @@
Config
- -
-
-
- record save path:
-
-
+
-
+
- -
-
+
-
+
- record format:
+ video size:
@@ -179,13 +175,6 @@
- -
-
-
- bit rate:
-
-
-
-
@@ -196,15 +185,19 @@
- -
-
+
-
+
- video size:
+ bit rate:
- -
-
+
-
+
+
+ record save path:
+
+
-
@@ -220,6 +213,23 @@
+ -
+
+
+ record format:
+
+
+
+ -
+
+
+ always top
+
+
+ true
+
+
+
diff --git a/QtScrcpy/videoform.cpp b/QtScrcpy/videoform.cpp
index adb8624..bae531a 100644
--- a/QtScrcpy/videoform.cpp
+++ b/QtScrcpy/videoform.cpp
@@ -28,9 +28,7 @@ VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate, co
m_bitRate(bitRate)
{
ui->setupUi(this);
- initUI();
-
- setWindowFlag(Qt::WindowStaysOnTopHint);
+ initUI();
m_server = new Server();
m_frames.init();
@@ -356,6 +354,22 @@ void VideoForm::postTextInput(const QString& text)
m_inputConvert.sendControlEvent(controlEvent);
}
+void VideoForm::staysOnTop(bool top)
+{
+ bool needShow = false;
+ if (isVisible()) {
+ needShow = true;
+ }
+ if (top) {
+ setWindowFlag(Qt::WindowStaysOnTopHint);
+ } else {
+ setWindowFlag(Qt::WindowStaysOnTopHint, false);
+ }
+ if (needShow) {
+ show();
+ }
+}
+
void VideoForm::postGoHome()
{
postKeyCodeClick(AKEYCODE_HOME);
diff --git a/QtScrcpy/videoform.h b/QtScrcpy/videoform.h
index fe048c9..233451d 100644
--- a/QtScrcpy/videoform.h
+++ b/QtScrcpy/videoform.h
@@ -38,6 +38,8 @@ public:
void postTurnOn();
void postTextInput(const QString& text);
+ void staysOnTop(bool top = true);
+
private:
void updateShowSize(const QSize &newSize);
void updateStyleSheet(bool vertical);