Skip to content

Commit

Permalink
feat: config simple mode
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ran committed Apr 17, 2021
1 parent b479180 commit 124738c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions QtScrcpy/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void Dialog::updateBootConfig(bool toView)
ui->alwaysTopCheck->setChecked(config.windowOnTop);
ui->closeScreenCheck->setChecked(config.autoOffScreen);
ui->stayAwakeCheck->setChecked(config.keepAlive);
ui->useSingleModeCheck->setChecked(config.simpleMode);
} else {
UserBootConfig config;

Expand All @@ -181,6 +182,7 @@ void Dialog::updateBootConfig(bool toView)
config.autoOffScreen = ui->closeScreenCheck->isChecked();
config.framelessWindow = ui->framelessCheck->isChecked();
config.keepAlive = ui->stayAwakeCheck->isChecked();
config.simpleMode = ui->useSingleModeCheck->isChecked();

Config::getInstance().setUserBootConfig(config);
}
Expand Down
5 changes: 5 additions & 0 deletions QtScrcpy/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
#define COMMON_KEEP_ALIVE_KEY "KeepAlive"
#define COMMON_KEEP_ALIVE_DEF false

#define COMMON_SIMPLE_MODE_KEY "SimpleMode"
#define COMMON_SIMPLE_MODE_DEF false

// device config
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
#define SERIAL_WINDOW_RECT_KEY_Y "WindowRectY"
Expand Down Expand Up @@ -141,6 +144,7 @@ void Config::setUserBootConfig(const UserBootConfig &config)
m_userData->setValue(COMMON_WINDOW_ON_TOP_KEY, config.windowOnTop);
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->endGroup();
m_userData->sync();
}
Expand All @@ -162,6 +166,7 @@ UserBootConfig Config::getUserBootConfig()
config.windowOnTop = m_userData->value(COMMON_WINDOW_ON_TOP_KEY, COMMON_WINDOW_ON_TOP_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.simpleMode = m_userData->value(COMMON_SIMPLE_MODE_KEY, COMMON_SIMPLE_MODE_DEF).toBool();
m_userData->endGroup();
return config;
}
Expand Down
1 change: 1 addition & 0 deletions QtScrcpy/util/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct UserBootConfig
bool autoOffScreen = false;
bool framelessWindow = false;
bool keepAlive = false;
bool simpleMode = false;
};

class QSettings;
Expand Down

0 comments on commit 124738c

Please sign in to comment.