mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-21 20:15:04 +00:00
feat: add some userdate
This commit is contained in:
parent
fd63fae6d1
commit
058339b2f4
4 changed files with 95 additions and 5 deletions
|
@ -83,7 +83,7 @@ void Dialog::initUI()
|
|||
ui->bitRateBox->addItem("6000000");
|
||||
ui->bitRateBox->addItem("8000000");
|
||||
ui->bitRateBox->addItem("10000000");
|
||||
ui->bitRateBox->setCurrentIndex(2);
|
||||
ui->bitRateBox->setCurrentIndex(Config::getInstance().getBitRateIndex());
|
||||
|
||||
ui->maxSizeBox->addItem("640");
|
||||
ui->maxSizeBox->addItem("720");
|
||||
|
@ -91,13 +91,14 @@ void Dialog::initUI()
|
|||
ui->maxSizeBox->addItem("1280");
|
||||
ui->maxSizeBox->addItem("1920");
|
||||
ui->maxSizeBox->addItem(tr("original"));
|
||||
ui->maxSizeBox->setCurrentIndex(2);
|
||||
ui->maxSizeBox->setCurrentIndex(Config::getInstance().getMaxSizeIndex());
|
||||
|
||||
ui->formatBox->addItem("mp4");
|
||||
ui->formatBox->addItem("mkv");
|
||||
ui->formatBox->setCurrentIndex(Config::getInstance().getRecordFormatIndex());
|
||||
|
||||
ui->recordPathEdt->setText(Config::getInstance().getRecordPath());
|
||||
}
|
||||
}
|
||||
|
||||
void Dialog::execAdbCmd()
|
||||
{
|
||||
|
@ -358,3 +359,18 @@ void Dialog::on_recordScreenCheck_clicked(bool checked)
|
|||
ui->recordScreenCheck->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Dialog::on_bitRateBox_activated(int index)
|
||||
{
|
||||
Config::getInstance().setBitRateIndex(index);
|
||||
}
|
||||
|
||||
void Dialog::on_maxSizeBox_activated(int index)
|
||||
{
|
||||
Config::getInstance().setMaxSizeIndex(index);
|
||||
}
|
||||
|
||||
void Dialog::on_formatBox_activated(int index)
|
||||
{
|
||||
Config::getInstance().setRecordFormatIndex(index);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,12 @@ private slots:
|
|||
|
||||
void on_recordScreenCheck_clicked(bool checked);
|
||||
|
||||
void on_bitRateBox_activated(int index);
|
||||
|
||||
void on_maxSizeBox_activated(int index);
|
||||
|
||||
void on_formatBox_activated(int index);
|
||||
|
||||
private:
|
||||
bool checkAdbRun();
|
||||
void initUI();
|
||||
|
|
|
@ -35,6 +35,17 @@
|
|||
#define COMMON_RECORD_KEY "RecordPath"
|
||||
#define COMMON_RECORD_DEF ""
|
||||
|
||||
#define COMMON_BITRATE_INDEX_KEY "BitRateIndex"
|
||||
#define COMMON_BITRATE_INDEX_DEF 2
|
||||
|
||||
#define COMMON_MAX_SIZE_INDEX_KEY "MaxSizeIndex"
|
||||
#define COMMON_MAX_SIZE_INDEX_DEF 2
|
||||
|
||||
#define COMMON_RECORD_FORMAT_INDEX_KEY "RecordFormatIndex"
|
||||
#define COMMON_RECORD_FORMAT_INDEX_DEF 0
|
||||
|
||||
// 最大尺寸 录制格式
|
||||
|
||||
QString Config::s_configPath = "";
|
||||
|
||||
Config::Config(QObject *parent) : QObject(parent)
|
||||
|
@ -80,6 +91,54 @@ void Config::setRecordPath(const QString &path)
|
|||
m_userData->endGroup();
|
||||
}
|
||||
|
||||
int Config::getBitRateIndex()
|
||||
{
|
||||
int bitRateIndex;
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
bitRateIndex = m_userData->value(COMMON_BITRATE_INDEX_KEY, COMMON_BITRATE_INDEX_DEF).toInt();
|
||||
m_userData->endGroup();
|
||||
return bitRateIndex;
|
||||
}
|
||||
|
||||
void Config::setBitRateIndex(int bitRateIndex)
|
||||
{
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
m_userData->setValue(COMMON_BITRATE_INDEX_KEY, bitRateIndex);
|
||||
m_userData->endGroup();
|
||||
}
|
||||
|
||||
int Config::getMaxSizeIndex()
|
||||
{
|
||||
int maxSizeIndex;
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
maxSizeIndex = m_userData->value(COMMON_MAX_SIZE_INDEX_KEY, COMMON_MAX_SIZE_INDEX_DEF).toInt();
|
||||
m_userData->endGroup();
|
||||
return maxSizeIndex;
|
||||
}
|
||||
|
||||
void Config::setMaxSizeIndex(int maxSizeIndex)
|
||||
{
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
m_userData->setValue(COMMON_MAX_SIZE_INDEX_KEY, maxSizeIndex);
|
||||
m_userData->endGroup();
|
||||
}
|
||||
|
||||
int Config::getRecordFormatIndex()
|
||||
{
|
||||
int recordFormatIndex;
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
recordFormatIndex = m_userData->value(COMMON_RECORD_FORMAT_INDEX_KEY, COMMON_RECORD_FORMAT_INDEX_DEF).toInt();
|
||||
m_userData->endGroup();
|
||||
return recordFormatIndex;
|
||||
}
|
||||
|
||||
void Config::setRecordFormatIndex(int recordFormatIndex)
|
||||
{
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
m_userData->setValue(COMMON_RECORD_FORMAT_INDEX_KEY, recordFormatIndex);
|
||||
m_userData->endGroup();
|
||||
}
|
||||
|
||||
QString Config::getServerVersion()
|
||||
{
|
||||
QString server;
|
||||
|
|
|
@ -10,9 +10,8 @@ class Config : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
static Config& getInstance();
|
||||
// config
|
||||
QString getTitle();
|
||||
QString getRecordPath();
|
||||
void setRecordPath(const QString& path);
|
||||
QString getServerVersion();
|
||||
int getMaxFps();
|
||||
int getDesktopOpenGL();
|
||||
|
@ -21,6 +20,16 @@ public:
|
|||
QString getPushFilePath();
|
||||
QString getServerPath();
|
||||
|
||||
// user data
|
||||
QString getRecordPath();
|
||||
void setRecordPath(const QString& path);
|
||||
int getBitRateIndex();
|
||||
void setBitRateIndex(int bitRateIndex);
|
||||
int getMaxSizeIndex();
|
||||
void setMaxSizeIndex(int maxSizeIndex);
|
||||
int getRecordFormatIndex();
|
||||
void setRecordFormatIndex(int recordFormatIndex);
|
||||
|
||||
private:
|
||||
explicit Config(QObject *parent = nullptr);
|
||||
const QString& getConfigPath();
|
||||
|
|
Loading…
Add table
Reference in a new issue