From 2bcb9a23450f2813f8e4ab44fa42a17df1f9fd07 Mon Sep 17 00:00:00 2001 From: Randy Truong Date: Tue, 24 Dec 2024 22:18:41 -0600 Subject: [PATCH] feat: created a default keyboard loader function --- src/mainwindowcontroller.cpp | 10 +++++++--- src/mainwindowcontroller.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mainwindowcontroller.cpp b/src/mainwindowcontroller.cpp index 17e85f0..43e6b6f 100644 --- a/src/mainwindowcontroller.cpp +++ b/src/mainwindowcontroller.cpp @@ -180,14 +180,12 @@ void MainWindowController::init() { connect(&connection, &HIDConnection::keyboardsScanComplete, this, [this](){ - QSettings settings; qInfo() << "Apply default profile"; for (int i = 0 ; i < m_connectedKeyboards->keyboards().size(); i++) { - m_keyboardConfiguratorController->load(i); - m_keyboardConfiguratorController->applyDefaultProfile(); + loadKeyboardWithDefaultProfile(i); } }, Qt::SingleShotConnection); } @@ -280,6 +278,12 @@ void MainWindowController::refreshKeyboards() emit HIDConnection::getInstance().refreshKeyboards(m_connectedKeyboards); } +void MainWindowController::loadKeyboardWithDefaultProfile(const int &index) { + m_keyboardConfiguratorController->load(index); + + m_keyboardConfiguratorController->applyDefaultProfile(); +} + void MainWindowController::loadKeyboard(const int &index) { m_keyboardConfiguratorController->load(index); diff --git a/src/mainwindowcontroller.h b/src/mainwindowcontroller.h index 7d50cb0..a029456 100644 --- a/src/mainwindowcontroller.h +++ b/src/mainwindowcontroller.h @@ -109,6 +109,7 @@ public slots: void init(); void quit(); void refreshKeyboards(); + void loadKeyboardWithDefaultProfile(const int &index); void loadKeyboard(const int& index); void setInterruptClose(const bool& interruptClose); void closeInterrupted();