Commands: implemented run commands by shortcut key

This commit is contained in:
f4exb 2018-01-05 10:28:32 +01:00
parent b82e667240
commit 5c3938753c
1 changed files with 16 additions and 1 deletions

View File

@ -1542,5 +1542,20 @@ void MainWindow::focusHasChanged(QWidget *oldWidget __attribute__((unused)), QWi
void MainWindow::commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release)
{
qDebug("MainWindow::commandKeyPressed: key: %x mod: %x %s", (int) key, (int) keyModifiers, release ? "release" : "press");
//qDebug("MainWindow::commandKeyPressed: key: %x mod: %x %s", (int) key, (int) keyModifiers, release ? "release" : "press");
int currentDeviceSetIndex = ui->tabInputsSelect->currentIndex();
for (int i = 0; i < m_settings.getCommandCount(); ++i)
{
const Command* command = m_settings.getCommand(i);
if (command->getAssociateKey()
&& (command->getRelease() == release)
&& (command->getKey() == key)
&& (command->getKeyModifiers() == keyModifiers))
{
Command* command_mod = const_cast<Command*>(command);
command_mod->run(m_apiServer->getHost(), m_apiServer->getPort(), currentDeviceSetIndex);
}
}
}