Skip to content

Commit

Permalink
feat: created a default keyboard loader function
Browse files Browse the repository at this point in the history
  • Loading branch information
randyttruong committed Dec 25, 2024
1 parent 503cdc3 commit 2bcb9a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mainwindowcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/mainwindowcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2bcb9a2

Please sign in to comment.