diff --git a/QtScrcpy/res/i18n/en_US.qm b/QtScrcpy/res/i18n/en_US.qm
index f0d5294..ffb6372 100644
Binary files a/QtScrcpy/res/i18n/en_US.qm and b/QtScrcpy/res/i18n/en_US.qm differ
diff --git a/QtScrcpy/res/i18n/en_US.ts b/QtScrcpy/res/i18n/en_US.ts
index d51a414..c8787cf 100644
--- a/QtScrcpy/res/i18n/en_US.ts
+++ b/QtScrcpy/res/i18n/en_US.ts
@@ -285,5 +285,9 @@
stop audio
stop audio
+
+ auto update
+ autp update
+
diff --git a/QtScrcpy/res/i18n/zh_CN.qm b/QtScrcpy/res/i18n/zh_CN.qm
index 801fd70..a505d6d 100644
Binary files a/QtScrcpy/res/i18n/zh_CN.qm and b/QtScrcpy/res/i18n/zh_CN.qm differ
diff --git a/QtScrcpy/res/i18n/zh_CN.ts b/QtScrcpy/res/i18n/zh_CN.ts
index 43a45c5..093c35d 100644
--- a/QtScrcpy/res/i18n/zh_CN.ts
+++ b/QtScrcpy/res/i18n/zh_CN.ts
@@ -285,5 +285,9 @@
stop audio
停止音频
+
+ auto update
+ 自动刷新
+
diff --git a/QtScrcpy/ui/dialog.cpp b/QtScrcpy/ui/dialog.cpp
index 35b1884..6b0e84a 100644
--- a/QtScrcpy/ui/dialog.cpp
+++ b/QtScrcpy/ui/dialog.cpp
@@ -30,6 +30,16 @@ Dialog::Dialog(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
ui->setupUi(this);
initUI();
+ updateBootConfig(true);
+
+ on_useSingleModeCheck_clicked();
+ on_updateDevice_clicked();
+
+ connect(&m_autoUpdatetimer, &QTimer::timeout, this, &Dialog::on_updateDevice_clicked);
+ if (ui->autoUpdatecheckBox->isChecked()) {
+ m_autoUpdatetimer.start(5000);
+ }
+
connect(&m_adb, &qsc::AdbProcess::adbProcessResult, this, [this](qsc::AdbProcess::ADB_EXEC_RESULT processResult) {
QString log = "";
bool newLine = true;
@@ -145,12 +155,6 @@ void Dialog::initUI()
ui->lockOrientationBox->addItem("180");
ui->lockOrientationBox->addItem("270");
ui->lockOrientationBox->setCurrentIndex(0);
-
- updateBootConfig(true);
-
- on_useSingleModeCheck_clicked();
-
- on_updateDevice_clicked();
}
void Dialog::updateBootConfig(bool toView)
@@ -181,6 +185,7 @@ void Dialog::updateBootConfig(bool toView)
ui->closeScreenCheck->setChecked(config.autoOffScreen);
ui->stayAwakeCheck->setChecked(config.keepAlive);
ui->useSingleModeCheck->setChecked(config.simpleMode);
+ ui->autoUpdatecheckBox->setChecked(config.autoUpdateDevice);
} else {
UserBootConfig config;
@@ -198,6 +203,7 @@ void Dialog::updateBootConfig(bool toView)
config.framelessWindow = ui->framelessCheck->isChecked();
config.keepAlive = ui->stayAwakeCheck->isChecked();
config.simpleMode = ui->useSingleModeCheck->isChecked();
+ config.autoUpdateDevice = ui->autoUpdatecheckBox->isChecked();
Config::getInstance().setUserBootConfig(config);
}
}
@@ -711,3 +717,12 @@ void Dialog::on_installSndcpyBtn_clicked()
}
m_audioOutput.installonly(ui->serialBox->currentText(), 28200);
}
+
+void Dialog::on_autoUpdatecheckBox_toggled(bool checked)
+{
+ if (checked) {
+ m_autoUpdatetimer.start(5000);
+ } else {
+ m_autoUpdatetimer.stop();
+ }
+}
diff --git a/QtScrcpy/ui/dialog.h b/QtScrcpy/ui/dialog.h
index a42142d..860c87e 100644
--- a/QtScrcpy/ui/dialog.h
+++ b/QtScrcpy/ui/dialog.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include "adbprocess.h"
@@ -64,6 +65,8 @@ private slots:
void on_installSndcpyBtn_clicked();
+ void on_autoUpdatecheckBox_toggled(bool checked);
+
private:
bool checkAdbRun();
void initUI();
@@ -87,6 +90,7 @@ private:
QAction *m_showWindow;
QAction *m_quit;
AudioOutput m_audioOutput;
+ QTimer m_autoUpdatetimer;
};
#endif // DIALOG_H
diff --git a/QtScrcpy/ui/dialog.ui b/QtScrcpy/ui/dialog.ui
index c8f7683..569e769 100644
--- a/QtScrcpy/ui/dialog.ui
+++ b/QtScrcpy/ui/dialog.ui
@@ -100,17 +100,34 @@
-
-
-
-
- 0
- 0
-
+
+
+ 0
-
- Double click to connect:
-
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Double click to connect:
+
+
+
+ -
+
+
+ auto update
+
+
+ true
+
+
+
+
-
diff --git a/QtScrcpy/util/config.cpp b/QtScrcpy/util/config.cpp
index d1716cf..8212b76 100644
--- a/QtScrcpy/util/config.cpp
+++ b/QtScrcpy/util/config.cpp
@@ -87,6 +87,9 @@
#define COMMON_SIMPLE_MODE_KEY "SimpleMode"
#define COMMON_SIMPLE_MODE_DEF false
+#define COMMON_AUTO_UPDATE_DEVICE_KEY "AutoUpdateDevice"
+#define COMMON_AUTO_UPDATE_DEVICE_DEF true
+
// device config
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
#define SERIAL_WINDOW_RECT_KEY_Y "WindowRectY"
@@ -145,6 +148,7 @@ void Config::setUserBootConfig(const UserBootConfig &config)
m_userData->setValue(COMMON_AUTO_OFF_SCREEN_KEY, config.autoOffScreen);
m_userData->setValue(COMMON_KEEP_ALIVE_KEY, config.keepAlive);
m_userData->setValue(COMMON_SIMPLE_MODE_KEY, config.simpleMode);
+ m_userData->setValue(COMMON_AUTO_UPDATE_DEVICE_KEY, config.autoUpdateDevice);
m_userData->endGroup();
m_userData->sync();
}
@@ -167,6 +171,7 @@ UserBootConfig Config::getUserBootConfig()
config.autoOffScreen = m_userData->value(COMMON_AUTO_OFF_SCREEN_KEY, COMMON_AUTO_OFF_SCREEN_DEF).toBool();
config.keepAlive = m_userData->value(COMMON_KEEP_ALIVE_KEY, COMMON_KEEP_ALIVE_DEF).toBool();
config.simpleMode = m_userData->value(COMMON_SIMPLE_MODE_KEY, COMMON_SIMPLE_MODE_DEF).toBool();
+ config.autoUpdateDevice = m_userData->value(COMMON_AUTO_UPDATE_DEVICE_KEY, COMMON_AUTO_UPDATE_DEVICE_DEF).toBool();
m_userData->endGroup();
return config;
}
diff --git a/QtScrcpy/util/config.h b/QtScrcpy/util/config.h
index 0eeea83..137e375 100644
--- a/QtScrcpy/util/config.h
+++ b/QtScrcpy/util/config.h
@@ -21,6 +21,7 @@ struct UserBootConfig
bool framelessWindow = false;
bool keepAlive = false;
bool simpleMode = false;
+ bool autoUpdateDevice = true;
};
class QSettings;