mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
implement automatic applying
This commit is contained in:
parent
cf47eca15f
commit
bc8fafe5f9
@ -74,6 +74,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||
Globals::g_settingsData = Settings::readSettings();
|
||||
|
||||
Utils::setModelAssignableSettings(*model, Globals::g_settingsData.assignableSettings);
|
||||
|
||||
if (Globals::g_settingsData.autoApplyProfile)
|
||||
model->applyChanges();
|
||||
|
||||
Utils::writeAssignableDefaults(*model);
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,12 @@ DeviceBrowser::DeviceBrowser(DeviceModel &model, QWidget *parent)
|
||||
|
||||
connect(m_settings, &Settings::settingsSaved, [=](auto data) {
|
||||
Globals::g_mainStack->setCurrentWidget(this);
|
||||
// No-op when data.assignableSettings is empty
|
||||
Utils::setModelAssignableSettings(
|
||||
*Globals::g_deviceModel, data.assignableSettings);
|
||||
|
||||
if (data.autoApplyProfile && data.currentProfile.has_value())
|
||||
m_deviceModel.applyChanges();
|
||||
});
|
||||
}
|
||||
Globals::g_mainStack->setCurrentWidget(m_settings);
|
||||
|
@ -101,7 +101,7 @@ void Settings::setUIState(SettingsData data) {
|
||||
SettingsData Settings::fromUIState() {
|
||||
std::optional<QString> currentProfile = std::nullopt;
|
||||
|
||||
if (m_profileView->currentItem()) {
|
||||
if (m_profileView->currentItem() && m_useProfile->isChecked()) {
|
||||
auto data = m_profileView->currentItem()->data(Qt::DisplayRole);
|
||||
if (data.isValid())
|
||||
currentProfile = data.toString();
|
||||
|
Loading…
Reference in New Issue
Block a user