diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 3f44a994..d2d33ea5 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -220,7 +220,7 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c #endif } - Tools::wait(m_plugin->initialTimeout()); + Tools::wait(qMax(100, config()->get("AutoTypeStartDelay", 500).toInt())); if (!window) { window = m_plugin->activeWindow(); @@ -365,7 +365,7 @@ bool AutoType::parseActions(const QString& actionSequence, const Entry* entry, Q { QString tmpl; bool inTmpl = false; - m_autoTypeDelay = config()->get("AutoTypeDelay").toInt(); + m_autoTypeDelay = qMax(config()->get("AutoTypeDelay").toInt(), 0); QString sequence = actionSequence; sequence.replace("{{}", "{LEFTBRACE}"); diff --git a/src/autotype/AutoTypePlatformPlugin.h b/src/autotype/AutoTypePlatformPlugin.h index 2945e98c..96e947a0 100644 --- a/src/autotype/AutoTypePlatformPlugin.h +++ b/src/autotype/AutoTypePlatformPlugin.h @@ -33,7 +33,6 @@ public: virtual bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0; virtual void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0; virtual int platformEventFilter(void* event) = 0; - virtual int initialTimeout() = 0; virtual bool raiseWindow(WId window) = 0; virtual void unload() {} diff --git a/src/autotype/mac/AutoTypeMac.cpp b/src/autotype/mac/AutoTypeMac.cpp index ffd3c227..d8fcf6d7 100644 --- a/src/autotype/mac/AutoTypeMac.cpp +++ b/src/autotype/mac/AutoTypeMac.cpp @@ -154,11 +154,6 @@ AutoTypeExecutor* AutoTypePlatformMac::createExecutor() return new AutoTypeExecutorMac(this); } -int AutoTypePlatformMac::initialTimeout() -{ - return 500; -} - // // Activate window by process id // diff --git a/src/autotype/mac/AutoTypeMac.h b/src/autotype/mac/AutoTypeMac.h index c554fa6e..d2c22478 100644 --- a/src/autotype/mac/AutoTypeMac.h +++ b/src/autotype/mac/AutoTypeMac.h @@ -42,7 +42,6 @@ public: bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; int platformEventFilter(void* event) override; - int initialTimeout() override; bool raiseWindow(WId pid) override; AutoTypeExecutor* createExecutor() override; diff --git a/src/autotype/test/AutoTypeTest.cpp b/src/autotype/test/AutoTypeTest.cpp index 0eaf7160..e2ae7c69 100644 --- a/src/autotype/test/AutoTypeTest.cpp +++ b/src/autotype/test/AutoTypeTest.cpp @@ -103,11 +103,6 @@ void AutoTypePlatformTest::addActionKey(AutoTypeKey* action) m_actionChars.append(keyToString(action->key)); } -int AutoTypePlatformTest::initialTimeout() -{ - return 0; -} - bool AutoTypePlatformTest::raiseWindow(WId window) { Q_UNUSED(window); diff --git a/src/autotype/test/AutoTypeTest.h b/src/autotype/test/AutoTypeTest.h index d9a86c3d..d434c4d3 100644 --- a/src/autotype/test/AutoTypeTest.h +++ b/src/autotype/test/AutoTypeTest.h @@ -42,7 +42,6 @@ public: bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; int platformEventFilter(void* event) override; - int initialTimeout() override; bool raiseWindow(WId window) override; AutoTypeExecutor* createExecutor() override; diff --git a/src/autotype/windows/AutoTypeWindows.cpp b/src/autotype/windows/AutoTypeWindows.cpp index 3ff2343b..bcb610f0 100644 --- a/src/autotype/windows/AutoTypeWindows.cpp +++ b/src/autotype/windows/AutoTypeWindows.cpp @@ -109,11 +109,6 @@ AutoTypeExecutor* AutoTypePlatformWin::createExecutor() return new AutoTypeExecutorWin(this); } -int AutoTypePlatformWin::initialTimeout() -{ - return 500; -} - // // Set foreground window // diff --git a/src/autotype/windows/AutoTypeWindows.h b/src/autotype/windows/AutoTypeWindows.h index 88b9a9fd..6d38a250 100644 --- a/src/autotype/windows/AutoTypeWindows.h +++ b/src/autotype/windows/AutoTypeWindows.h @@ -39,7 +39,6 @@ public: bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; int platformEventFilter(void* event) override; - int initialTimeout() override; bool raiseWindow(WId window) override; AutoTypeExecutor* createExecutor() override; diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp index 1946c888..cd5e8acd 100644 --- a/src/autotype/xcb/AutoTypeXCB.cpp +++ b/src/autotype/xcb/AutoTypeXCB.cpp @@ -844,12 +844,6 @@ void AutoTypeExecutorX11::execClearField(AutoTypeClearField* action = nullptr) nanosleep(&ts, nullptr); } - -int AutoTypePlatformX11::initialTimeout() -{ - return 500; -} - bool AutoTypePlatformX11::raiseWindow(WId window) { if (m_atomNetActiveWindow == None) { diff --git a/src/autotype/xcb/AutoTypeXCB.h b/src/autotype/xcb/AutoTypeXCB.h index 600e001a..4f1d9a3d 100644 --- a/src/autotype/xcb/AutoTypeXCB.h +++ b/src/autotype/xcb/AutoTypeXCB.h @@ -51,7 +51,6 @@ public: bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) override; int platformEventFilter(void* event) override; - int initialTimeout() override; bool raiseWindow(WId window) override; AutoTypeExecutor* createExecutor() override; diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 461ab1f7..614aee0c 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -135,6 +135,7 @@ void Config::init(const QString& fileName) m_defaults.insert("AutoTypeEntryTitleMatch", true); m_defaults.insert("AutoTypeEntryURLMatch", true); m_defaults.insert("AutoTypeDelay", 25); + m_defaults.insert("AutoTypeStartDelay", 500); m_defaults.insert("UseGroupIconOnEntryCreation", true); m_defaults.insert("IgnoreGroupExpansion", true); m_defaults.insert("security/clearclipboard", true); diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 56b1b2a3..30cc11e5 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -152,6 +152,7 @@ void SettingsWidget::loadSettings() } m_generalUi->autoTypeShortcutWidget->setAttribute(Qt::WA_MacShowFocusRect, true); m_generalUi->autoTypeDelaySpinBox->setValue(config()->get("AutoTypeDelay").toInt()); + m_generalUi->autoTypeStartDelaySpinBox->setValue(config()->get("AutoTypeStartDelay").toInt()); } @@ -227,6 +228,7 @@ void SettingsWidget::saveSettings() config()->set("GlobalAutoTypeModifiers", static_cast(m_generalUi->autoTypeShortcutWidget->modifiers())); config()->set("AutoTypeDelay", m_generalUi->autoTypeDelaySpinBox->value()); + config()->set("AutoTypeStartDelay", m_generalUi->autoTypeStartDelaySpinBox->value()); } config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked()); config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value()); diff --git a/src/gui/SettingsWidgetGeneral.ui b/src/gui/SettingsWidgetGeneral.ui index 5ed952f1..2d94892f 100644 --- a/src/gui/SettingsWidgetGeneral.ui +++ b/src/gui/SettingsWidgetGeneral.ui @@ -26,7 +26,7 @@ - 0 + 1 @@ -404,7 +404,7 @@ 10 - + Global Auto-Type shortcut @@ -420,14 +420,14 @@ - - + + - Auto-Type delay + Auto-Type typing delay - + @@ -442,13 +442,48 @@ - 999 + 1000 25 + + + + Auto-Type start delay + + + + + + + + 0 + 0 + + + + ms + + + + + + 100 + + + 10000 + + + 100 + + + 500 + + +