mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-09-25 18:59:06 +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>
|
<source>stop audio</source>
|
||||||
<translation>stop audio</translation>
|
<translation>stop audio</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>auto update</source>
|
||||||
|
<translation>autp update</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
Binary file not shown.
|
@ -285,5 +285,9 @@
|
||||||
<source>stop audio</source>
|
<source>stop audio</source>
|
||||||
<translation>停止音频</translation>
|
<translation>停止音频</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>auto update</source>
|
||||||
|
<translation>自动刷新</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
|
@ -30,6 +30,16 @@ Dialog::Dialog(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initUI();
|
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) {
|
connect(&m_adb, &qsc::AdbProcess::adbProcessResult, this, [this](qsc::AdbProcess::ADB_EXEC_RESULT processResult) {
|
||||||
QString log = "";
|
QString log = "";
|
||||||
bool newLine = true;
|
bool newLine = true;
|
||||||
|
@ -145,12 +155,6 @@ void Dialog::initUI()
|
||||||
ui->lockOrientationBox->addItem("180");
|
ui->lockOrientationBox->addItem("180");
|
||||||
ui->lockOrientationBox->addItem("270");
|
ui->lockOrientationBox->addItem("270");
|
||||||
ui->lockOrientationBox->setCurrentIndex(0);
|
ui->lockOrientationBox->setCurrentIndex(0);
|
||||||
|
|
||||||
updateBootConfig(true);
|
|
||||||
|
|
||||||
on_useSingleModeCheck_clicked();
|
|
||||||
|
|
||||||
on_updateDevice_clicked();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::updateBootConfig(bool toView)
|
void Dialog::updateBootConfig(bool toView)
|
||||||
|
@ -181,6 +185,7 @@ void Dialog::updateBootConfig(bool toView)
|
||||||
ui->closeScreenCheck->setChecked(config.autoOffScreen);
|
ui->closeScreenCheck->setChecked(config.autoOffScreen);
|
||||||
ui->stayAwakeCheck->setChecked(config.keepAlive);
|
ui->stayAwakeCheck->setChecked(config.keepAlive);
|
||||||
ui->useSingleModeCheck->setChecked(config.simpleMode);
|
ui->useSingleModeCheck->setChecked(config.simpleMode);
|
||||||
|
ui->autoUpdatecheckBox->setChecked(config.autoUpdateDevice);
|
||||||
} else {
|
} else {
|
||||||
UserBootConfig config;
|
UserBootConfig config;
|
||||||
|
|
||||||
|
@ -198,6 +203,7 @@ void Dialog::updateBootConfig(bool toView)
|
||||||
config.framelessWindow = ui->framelessCheck->isChecked();
|
config.framelessWindow = ui->framelessCheck->isChecked();
|
||||||
config.keepAlive = ui->stayAwakeCheck->isChecked();
|
config.keepAlive = ui->stayAwakeCheck->isChecked();
|
||||||
config.simpleMode = ui->useSingleModeCheck->isChecked();
|
config.simpleMode = ui->useSingleModeCheck->isChecked();
|
||||||
|
config.autoUpdateDevice = ui->autoUpdatecheckBox->isChecked();
|
||||||
Config::getInstance().setUserBootConfig(config);
|
Config::getInstance().setUserBootConfig(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -711,3 +717,12 @@ void Dialog::on_installSndcpyBtn_clicked()
|
||||||
}
|
}
|
||||||
m_audioOutput.installonly(ui->serialBox->currentText(), 28200);
|
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 <QMenu>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
#include "adbprocess.h"
|
#include "adbprocess.h"
|
||||||
|
@ -64,6 +65,8 @@ private slots:
|
||||||
|
|
||||||
void on_installSndcpyBtn_clicked();
|
void on_installSndcpyBtn_clicked();
|
||||||
|
|
||||||
|
void on_autoUpdatecheckBox_toggled(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkAdbRun();
|
bool checkAdbRun();
|
||||||
void initUI();
|
void initUI();
|
||||||
|
@ -87,6 +90,7 @@ private:
|
||||||
QAction *m_showWindow;
|
QAction *m_showWindow;
|
||||||
QAction *m_quit;
|
QAction *m_quit;
|
||||||
AudioOutput m_audioOutput;
|
AudioOutput m_audioOutput;
|
||||||
|
QTimer m_autoUpdatetimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOG_H
|
#endif // DIALOG_H
|
||||||
|
|
|
@ -100,17 +100,34 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_10">
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
<property name="sizePolicy">
|
<property name="topMargin">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<number>0</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Double click to connect:</string>
|
<widget class="QLabel" name="label_10">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
</widget>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Double click to connect:</string>
|
||||||
|
</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>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="connectedPhoneList">
|
<widget class="QListWidget" name="connectedPhoneList">
|
||||||
|
|
|
@ -87,6 +87,9 @@
|
||||||
#define COMMON_SIMPLE_MODE_KEY "SimpleMode"
|
#define COMMON_SIMPLE_MODE_KEY "SimpleMode"
|
||||||
#define COMMON_SIMPLE_MODE_DEF false
|
#define COMMON_SIMPLE_MODE_DEF false
|
||||||
|
|
||||||
|
#define COMMON_AUTO_UPDATE_DEVICE_KEY "AutoUpdateDevice"
|
||||||
|
#define COMMON_AUTO_UPDATE_DEVICE_DEF true
|
||||||
|
|
||||||
// device config
|
// device config
|
||||||
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
|
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
|
||||||
#define SERIAL_WINDOW_RECT_KEY_Y "WindowRectY"
|
#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_AUTO_OFF_SCREEN_KEY, config.autoOffScreen);
|
||||||
m_userData->setValue(COMMON_KEEP_ALIVE_KEY, config.keepAlive);
|
m_userData->setValue(COMMON_KEEP_ALIVE_KEY, config.keepAlive);
|
||||||
m_userData->setValue(COMMON_SIMPLE_MODE_KEY, config.simpleMode);
|
m_userData->setValue(COMMON_SIMPLE_MODE_KEY, config.simpleMode);
|
||||||
|
m_userData->setValue(COMMON_AUTO_UPDATE_DEVICE_KEY, config.autoUpdateDevice);
|
||||||
m_userData->endGroup();
|
m_userData->endGroup();
|
||||||
m_userData->sync();
|
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.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.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.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();
|
m_userData->endGroup();
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ struct UserBootConfig
|
||||||
bool framelessWindow = false;
|
bool framelessWindow = false;
|
||||||
bool keepAlive = false;
|
bool keepAlive = false;
|
||||||
bool simpleMode = false;
|
bool simpleMode = false;
|
||||||
|
bool autoUpdateDevice = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue