mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-09-25 10:49:00 +00:00
feat: auto update device
This commit is contained in:
parent
8bef579494
commit
d77355a20d
9 changed files with 66 additions and 16 deletions
Binary file not shown.
|
@ -285,5 +285,9 @@
|
|||
<source>stop audio</source>
|
||||
<translation>stop audio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>auto update</source>
|
||||
<translation>autp update</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
Binary file not shown.
|
@ -285,5 +285,9 @@
|
|||
<source>stop audio</source>
|
||||
<translation>停止音频</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>auto update</source>
|
||||
<translation>自动刷新</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <QMenu>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QListWidget>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
#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
|
||||
|
|
|
@ -99,6 +99,11 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
|
@ -112,6 +117,18 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoUpdatecheckBox">
|
||||
<property name="text">
|
||||
<string>auto update</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="connectedPhoneList">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ struct UserBootConfig
|
|||
bool framelessWindow = false;
|
||||
bool keepAlive = false;
|
||||
bool simpleMode = false;
|
||||
bool autoUpdateDevice = true;
|
||||
};
|
||||
|
||||
class QSettings;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue