Modify the input method of bitrate. Bug fix

This commit is contained in:
Zhang Xiang 2021-07-05 20:50:26 +08:00
commit d787c3a9d4
12 changed files with 167 additions and 115 deletions

View file

@ -5,19 +5,10 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ***********************************************************
# Qt Package finding
# ***********************************************************
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED) find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network LinguistTools REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network LinguistTools REQUIRED)
# *********************************************************** if(MSVC)
# Cross-platform settings
# ***********************************************************
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# FFmpeg cannot be compiled natively by MSVC version < 12.0 (2013) # FFmpeg cannot be compiled natively by MSVC version < 12.0 (2013)
if(MSVC_VERSION LESS 1800) if(MSVC_VERSION LESS 1800)
message(FATAL_ERROR "[QtScrcpy] FATAL ERROR: MSVC version is older than 12.0 (2013).") message(FATAL_ERROR "[QtScrcpy] FATAL ERROR: MSVC version is older than 12.0 (2013).")
@ -25,7 +16,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif() endif()
@ -145,6 +135,7 @@ if(WIN32)
endif() endif()
set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/bin/x64") set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/bin/x64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # Compiler is 32-bit elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # Compiler is 32-bit
message(STATUS "[QtScrcpy] 32-bit compiler detected.") message(STATUS "[QtScrcpy] 32-bit compiler detected.")
@ -173,17 +164,17 @@ if(WIN32)
) )
endforeach() endforeach()
# If MinGW is used, it is not appropriate to link static MSVC libs.
# Instead, we link DLLs directly
if(MSVC) if(MSVC)
message(STATUS "[QtScrcpy] Microsoft Visual C++ is used.") message(STATUS "[QtScrcpy] Microsoft Visual C++ is used.")
link_directories(${QS_LIB_PATH}) target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE ${QS_LIB_PATH})
set(QS_EXTERNAL_LIBS_FFMPEG set(QS_EXTERNAL_LIBS_FFMPEG
avformat avformat
avcodec avcodec
avutil avutil
swscale swscale
) )
# If MinGW is used, it is not appropriate to link static MSVC libs.
# Instead, we link DLLs directly
elseif(MINGW) elseif(MINGW)
message(STATUS "[QtScrcpy] MinGW GCC is used.") message(STATUS "[QtScrcpy] MinGW GCC is used.")
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE target_link_options(${CMAKE_PROJECT_NAME} PRIVATE

View file

@ -1,4 +1,4 @@
#ifndef DEVICE_H #ifndef DEVICE_H
#define DEVICE_H #define DEVICE_H
#include <QElapsedTimer> #include <QElapsedTimer>
@ -30,7 +30,7 @@ public:
QString serial = ""; // 设备序列号 QString serial = ""; // 设备序列号
quint16 localPort = 27183; // reverse时本地监听端口 quint16 localPort = 27183; // reverse时本地监听端口
quint16 maxSize = 720; // 视频分辨率 quint16 maxSize = 720; // 视频分辨率
quint32 bitRate = 8000000; // 视频比特率 quint32 bitRate = 2000000; // 视频比特率
quint32 maxFps = 60; // 视频最大帧率 quint32 maxFps = 60; // 视频最大帧率
bool closeScreen = false; // 启动时自动息屏 bool closeScreen = false; // 启动时自动息屏
bool useReverse = true; // true:先使用adb reverse失败后自动使用adb forwardfalse:直接使用adb forward bool useReverse = true; // true:先使用adb reverse失败后自动使用adb forwardfalse:直接使用adb forward

View file

@ -98,6 +98,7 @@ Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog)
Dialog::~Dialog() Dialog::~Dialog()
{ {
qDebug() << "~Dialog()";
updateBootConfig(false); updateBootConfig(false);
m_deviceManage.disconnectAllDevice(); m_deviceManage.disconnectAllDevice();
delete ui; delete ui;
@ -108,14 +109,9 @@ void Dialog::initUI()
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint); setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
ui->bitRateBox->addItem("2000000"); setWindowTitle(Config::getInstance().getTitle());
ui->bitRateBox->addItem("6000000");
ui->bitRateBox->addItem("8000000"); ui->bitRateEdit->setValidator(new QIntValidator(1, 99999, this));
ui->bitRateBox->addItem("10000000");
ui->bitRateBox->addItem("20000000");
ui->bitRateBox->addItem("50000000");
ui->bitRateBox->addItem("100000000");
ui->bitRateBox->addItem("200000000");
ui->maxSizeBox->addItem("640"); ui->maxSizeBox->addItem("640");
ui->maxSizeBox->addItem("720"); ui->maxSizeBox->addItem("720");
@ -156,7 +152,16 @@ void Dialog::updateBootConfig(bool toView)
if (toView) { if (toView) {
UserBootConfig config = Config::getInstance().getUserBootConfig(); UserBootConfig config = Config::getInstance().getUserBootConfig();
ui->bitRateBox->setCurrentIndex(config.bitRateIndex); if(config.bitRate == 0) {
ui->bitRateBox->setCurrentText("Mbps");
} else if(config.bitRate % 1000000 == 0) {
ui->bitRateEdit->setText(QString::number(config.bitRate / 1000000));
ui->bitRateBox->setCurrentText("Mbps");
} else {
ui->bitRateEdit->setText(QString::number(config.bitRate / 1000));
ui->bitRateBox->setCurrentText("Kbps");
}
ui->maxSizeBox->setCurrentIndex(config.maxSizeIndex); ui->maxSizeBox->setCurrentIndex(config.maxSizeIndex);
ui->formatBox->setCurrentIndex(config.recordFormatIndex); ui->formatBox->setCurrentIndex(config.recordFormatIndex);
ui->recordPathEdt->setText(config.recordPath); ui->recordPathEdt->setText(config.recordPath);
@ -173,7 +178,7 @@ void Dialog::updateBootConfig(bool toView)
} else { } else {
UserBootConfig config; UserBootConfig config;
config.bitRateIndex = ui->bitRateBox->currentIndex(); config.bitRate = getBitRate();
config.maxSizeIndex = ui->maxSizeBox->currentIndex(); config.maxSizeIndex = ui->maxSizeBox->currentIndex();
config.recordFormatIndex = ui->formatBox->currentIndex(); config.recordFormatIndex = ui->formatBox->currentIndex();
config.recordPath = ui->recordPathEdt->text(); config.recordPath = ui->recordPathEdt->text();
@ -187,7 +192,6 @@ 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::getInstance().setUserBootConfig(config); Config::getInstance().setUserBootConfig(config);
} }
} }
@ -235,7 +239,6 @@ void Dialog::slotActivated(QSystemTrayIcon::ActivationReason reason)
switch (reason) { switch (reason) {
case QSystemTrayIcon::Trigger: case QSystemTrayIcon::Trigger:
this->show(); this->show();
m_hideIcon->hide();
break; break;
default: default:
break; break;
@ -278,13 +281,12 @@ void Dialog::on_startServerBtn_clicked()
} }
} }
quint32 bitRate = ui->bitRateBox->currentText().trimmed().toUInt();
// this is ok that "native" toUshort is 0 // this is ok that "native" toUshort is 0
quint16 videoSize = ui->maxSizeBox->currentText().trimmed().toUShort(); quint16 videoSize = ui->maxSizeBox->currentText().trimmed().toUShort();
Device::DeviceParams params; Device::DeviceParams params;
params.serial = ui->serialBox->currentText().trimmed(); params.serial = ui->serialBox->currentText().trimmed();
params.maxSize = videoSize; params.maxSize = videoSize;
params.bitRate = bitRate; params.bitRate = getBitRate();
// on devices with Android >= 10, the capture frame rate can be limited // on devices with Android >= 10, the capture frame rate can be limited
params.maxFps = static_cast<quint32>(Config::getInstance().getMaxFps()); params.maxFps = static_cast<quint32>(Config::getInstance().getMaxFps());
params.recordFileName = absFilePath; params.recordFileName = absFilePath;
@ -621,3 +623,9 @@ void Dialog::on_serialBox_currentIndexChanged(const QString &arg1)
{ {
ui->userNameEdt->setText(Config::getInstance().getNickName(arg1)); ui->userNameEdt->setText(Config::getInstance().getNickName(arg1));
} }
quint32 Dialog::getBitRate()
{
return ui->bitRateEdit->text().trimmed().toUInt() *
(ui->bitRateBox->currentText() == QString("Mbps") ? 1000000 : 1000);
}

View file

@ -32,47 +32,26 @@ public:
private slots: private slots:
void on_updateDevice_clicked(); void on_updateDevice_clicked();
void on_startServerBtn_clicked(); void on_startServerBtn_clicked();
void on_stopServerBtn_clicked(); void on_stopServerBtn_clicked();
void on_wirelessConnectBtn_clicked(); void on_wirelessConnectBtn_clicked();
void on_startAdbdBtn_clicked(); void on_startAdbdBtn_clicked();
void on_getIPBtn_clicked(); void on_getIPBtn_clicked();
void on_wirelessDisConnectBtn_clicked(); void on_wirelessDisConnectBtn_clicked();
void on_selectRecordPathBtn_clicked(); void on_selectRecordPathBtn_clicked();
void on_recordPathEdt_textChanged(const QString &arg1); void on_recordPathEdt_textChanged(const QString &arg1);
void on_adbCommandBtn_clicked(); void on_adbCommandBtn_clicked();
void on_stopAdbBtn_clicked(); void on_stopAdbBtn_clicked();
void on_clearOut_clicked(); void on_clearOut_clicked();
void on_stopAllServerBtn_clicked(); void on_stopAllServerBtn_clicked();
void on_refreshGameScriptBtn_clicked(); void on_refreshGameScriptBtn_clicked();
void on_applyScriptBtn_clicked(); void on_applyScriptBtn_clicked();
void on_recordScreenCheck_clicked(bool checked); void on_recordScreenCheck_clicked(bool checked);
void on_usbConnectBtn_clicked(); void on_usbConnectBtn_clicked();
void on_wifiConnectBtn_clicked(); void on_wifiConnectBtn_clicked();
void on_connectedPhoneList_itemDoubleClicked(QListWidgetItem *item); void on_connectedPhoneList_itemDoubleClicked(QListWidgetItem *item);
void on_updateNameBtn_clicked(); void on_updateNameBtn_clicked();
void on_useSingleModeCheck_clicked(); void on_useSingleModeCheck_clicked();
void on_serialBox_currentIndexChanged(const QString &arg1); void on_serialBox_currentIndexChanged(const QString &arg1);
private: private:
@ -85,6 +64,7 @@ private:
void slotShow(); void slotShow();
void slotActivated(QSystemTrayIcon::ActivationReason reason); void slotActivated(QSystemTrayIcon::ActivationReason reason);
int findDeviceFromeSerialBox(bool wifi); int findDeviceFromeSerialBox(bool wifi);
quint32 getBitRate();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>500</width>
<height>769</height> <height>749</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -18,7 +18,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>500</width> <width>565</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -133,23 +133,115 @@
</property> </property>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>bit rate:</string> <string>bit rate:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="bitRateBox"> <widget class="QLineEdit" name="bitRateEdit">
<property name="toolTip"> <property name="sizePolicy">
<string/> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="currentText"> <property name="minimumSize">
<string/> <size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>2</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="bitRateBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
<property name="currentText">
<string notr="true">Mbps</string>
</property>
<property name="placeholderText">
<string notr="true"/>
</property>
<item>
<property name="text">
<string notr="true">Mbps</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Kbps</string>
</property>
</item>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>max size:</string> <string>max size:</string>
</property> </property>
@ -162,16 +254,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>record format</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="formatBox"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -190,6 +272,16 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>record format</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="formatBox"/>
</item>
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -200,19 +292,6 @@
<item> <item>
<widget class="QComboBox" name="lockOrientationBox"/> <widget class="QComboBox" name="lockOrientationBox"/>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -792,19 +871,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

View file

@ -12,7 +12,6 @@
#include "stream.h" #include "stream.h"
static Dialog *g_mainDlg = Q_NULLPTR; static Dialog *g_mainDlg = Q_NULLPTR;
static QtMessageHandler g_oldMessageHandler = Q_NULLPTR; static QtMessageHandler g_oldMessageHandler = Q_NULLPTR;
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg); void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
void installTranslator(); void installTranslator();
@ -104,8 +103,7 @@ int main(int argc, char *argv[])
file.close(); file.close();
} }
g_mainDlg = new Dialog; g_mainDlg = new Dialog {};
g_mainDlg->setWindowTitle(Config::getInstance().getTitle());
g_mainDlg->show(); g_mainDlg->show();
qInfo() << QObject::tr("This software is completely open source and free. Use it at your own risk. You can download it at the " qInfo() << QObject::tr("This software is completely open source and free. Use it at your own risk. You can download it at the "
@ -113,6 +111,7 @@ int main(int argc, char *argv[])
qInfo() << QString("QtScrcpy %1 <https://github.com/barry-ran/QtScrcpy>").arg(QCoreApplication::applicationVersion()); qInfo() << QString("QtScrcpy %1 <https://github.com/barry-ran/QtScrcpy>").arg(QCoreApplication::applicationVersion());
int ret = a.exec(); int ret = a.exec();
delete g_mainDlg;
#if defined(Q_OS_WIN32) || defined(Q_OS_OSX) #if defined(Q_OS_WIN32) || defined(Q_OS_OSX)
MouseTap::getInstance()->quitMouseEventTap(); MouseTap::getInstance()->quitMouseEventTap();
@ -173,12 +172,12 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
g_oldMessageHandler(type, context, msg); g_oldMessageHandler(type, context, msg);
} }
// qt log info big than warning? // Is Qt log level higher than warning?
float fLogLevel = 1.0f * g_msgType; float fLogLevel = g_msgType;
if (QtInfoMsg == g_msgType) { if (QtInfoMsg == g_msgType) {
fLogLevel = QtDebugMsg + 0.5f; fLogLevel = QtDebugMsg + 0.5f;
} }
float fLogLevel2 = 1.0f * type; float fLogLevel2 = type;
if (QtInfoMsg == type) { if (QtInfoMsg == type) {
fLogLevel2 = QtDebugMsg + 0.5f; fLogLevel2 = QtDebugMsg + 0.5f;
} }

Binary file not shown.

View file

@ -234,27 +234,27 @@
<message> <message>
<source>warning</source> <source>warning</source>
<translatorcomment>Warning</translatorcomment> <translatorcomment>Warning</translatorcomment>
<translation>Warning</translation> <translation type="vanished">Warning</translation>
</message> </message>
<message> <message>
<source>Quit or set tray?</source> <source>Quit or set tray?</source>
<translatorcomment>Quit or set tray?</translatorcomment> <translatorcomment>Quit or set tray?</translatorcomment>
<translation>Quit or set tray?</translation> <translation type="vanished">Quit or set tray?</translation>
</message> </message>
<message> <message>
<source>Quit</source> <source>Quit</source>
<translatorcomment>Quit</translatorcomment> <translatorcomment>Quit</translatorcomment>
<translation>Quit</translation> <translation type="vanished">Quit</translation>
</message> </message>
<message> <message>
<source>Set tray</source> <source>Set tray</source>
<translatorcomment>Set tray</translatorcomment> <translatorcomment>Set tray</translatorcomment>
<translation>Set tray</translation> <translation type="vanished">Set tray</translation>
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translatorcomment>Cancel</translatorcomment> <translatorcomment>Cancel</translatorcomment>
<translation>Cancel</translation> <translation type="vanished">Cancel</translation>
</message> </message>
<message> <message>
<source>Notice</source> <source>Notice</source>
@ -266,6 +266,10 @@
<translatorcomment>Hidden here!</translatorcomment> <translatorcomment>Hidden here!</translatorcomment>
<translation>Hidden here!</translation> <translation>Hidden here!</translation>
</message> </message>
<message>
<source>2</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>InputConvertGame</name> <name>InputConvertGame</name>

Binary file not shown.

View file

@ -234,27 +234,27 @@
<message> <message>
<source>warning</source> <source>warning</source>
<translatorcomment></translatorcomment> <translatorcomment></translatorcomment>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Quit or set tray?</source> <source>Quit or set tray?</source>
<translatorcomment>退</translatorcomment> <translatorcomment>退</translatorcomment>
<translation>退</translation> <translation type="vanished">退</translation>
</message> </message>
<message> <message>
<source>Quit</source> <source>Quit</source>
<translatorcomment>退</translatorcomment> <translatorcomment>退</translatorcomment>
<translation>退</translation> <translation type="vanished">退</translation>
</message> </message>
<message> <message>
<source>Set tray</source> <source>Set tray</source>
<translatorcomment></translatorcomment> <translatorcomment></translatorcomment>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translatorcomment></translatorcomment> <translatorcomment></translatorcomment>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Notice</source> <source>Notice</source>
@ -266,6 +266,10 @@
<translatorcomment></translatorcomment> <translatorcomment></translatorcomment>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>2</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>InputConvertGame</name> <name>InputConvertGame</name>

View file

@ -48,8 +48,8 @@
#define COMMON_RECORD_KEY "RecordPath" #define COMMON_RECORD_KEY "RecordPath"
#define COMMON_RECORD_DEF "" #define COMMON_RECORD_DEF ""
#define COMMON_BITRATE_INDEX_KEY "BitRateIndex" #define COMMON_BITRATE_KEY "BitRate"
#define COMMON_BITRATE_INDEX_DEF 2 #define COMMON_BITRATE_DEF 2000000
#define COMMON_MAX_SIZE_INDEX_KEY "MaxSizeIndex" #define COMMON_MAX_SIZE_INDEX_KEY "MaxSizeIndex"
#define COMMON_MAX_SIZE_INDEX_DEF 2 #define COMMON_MAX_SIZE_INDEX_DEF 2
@ -132,7 +132,7 @@ void Config::setUserBootConfig(const UserBootConfig &config)
{ {
m_userData->beginGroup(GROUP_COMMON); m_userData->beginGroup(GROUP_COMMON);
m_userData->setValue(COMMON_RECORD_KEY, config.recordPath); m_userData->setValue(COMMON_RECORD_KEY, config.recordPath);
m_userData->setValue(COMMON_BITRATE_INDEX_KEY, config.bitRateIndex); m_userData->setValue(COMMON_BITRATE_KEY, config.bitRate);
m_userData->setValue(COMMON_MAX_SIZE_INDEX_KEY, config.maxSizeIndex); m_userData->setValue(COMMON_MAX_SIZE_INDEX_KEY, config.maxSizeIndex);
m_userData->setValue(COMMON_RECORD_FORMAT_INDEX_KEY, config.recordFormatIndex); m_userData->setValue(COMMON_RECORD_FORMAT_INDEX_KEY, config.recordFormatIndex);
m_userData->setValue(COMMON_FRAMELESS_WINDOW_KEY, config.framelessWindow); m_userData->setValue(COMMON_FRAMELESS_WINDOW_KEY, config.framelessWindow);
@ -154,7 +154,7 @@ UserBootConfig Config::getUserBootConfig()
UserBootConfig config; UserBootConfig config;
m_userData->beginGroup(GROUP_COMMON); m_userData->beginGroup(GROUP_COMMON);
config.recordPath = m_userData->value(COMMON_RECORD_KEY, COMMON_RECORD_DEF).toString(); config.recordPath = m_userData->value(COMMON_RECORD_KEY, COMMON_RECORD_DEF).toString();
config.bitRateIndex = m_userData->value(COMMON_BITRATE_INDEX_KEY, COMMON_BITRATE_INDEX_DEF).toInt(); config.bitRate = m_userData->value(COMMON_BITRATE_KEY, COMMON_BITRATE_DEF).toUInt();
config.maxSizeIndex = m_userData->value(COMMON_MAX_SIZE_INDEX_KEY, COMMON_MAX_SIZE_INDEX_DEF).toInt(); config.maxSizeIndex = m_userData->value(COMMON_MAX_SIZE_INDEX_KEY, COMMON_MAX_SIZE_INDEX_DEF).toInt();
config.recordFormatIndex = m_userData->value(COMMON_RECORD_FORMAT_INDEX_KEY, COMMON_RECORD_FORMAT_INDEX_DEF).toInt(); config.recordFormatIndex = m_userData->value(COMMON_RECORD_FORMAT_INDEX_KEY, COMMON_RECORD_FORMAT_INDEX_DEF).toInt();
config.lockOrientationIndex = m_userData->value(COMMON_LOCK_ORIENTATION_INDEX_KEY, COMMON_LOCK_ORIENTATION_INDEX_DEF).toInt(); config.lockOrientationIndex = m_userData->value(COMMON_LOCK_ORIENTATION_INDEX_KEY, COMMON_LOCK_ORIENTATION_INDEX_DEF).toInt();

View file

@ -8,7 +8,7 @@
struct UserBootConfig struct UserBootConfig
{ {
QString recordPath = ""; QString recordPath = "";
int bitRateIndex = 0; quint32 bitRate = 2000000;
int maxSizeIndex = 0; int maxSizeIndex = 0;
int recordFormatIndex = 0; int recordFormatIndex = 0;
int lockOrientationIndex = 0; int lockOrientationIndex = 0;