diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 3e95382f3..7f14e5b09 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -37,6 +37,7 @@ AutoType* AutoType::m_instance = nullptr; AutoType::AutoType(QObject* parent, bool test) : QObject(parent) , m_inAutoType(false) + , m_autoTypeDelay(0) , m_currentGlobalKey(static_cast(0)) , m_currentGlobalModifiers(0) , m_pluginLoader(new QPluginLoader(this)) @@ -303,6 +304,8 @@ bool AutoType::parseActions(const QString& sequence, const Entry* entry, QList 0) { + QList::iterator i; + i = actions.begin(); + while (i != actions.end()) { + ++i; + if (i != actions.end()) { + i = actions.insert(i, new AutoTypeDelay(m_autoTypeDelay)); + ++i; + } + } + } return true; } @@ -342,6 +355,13 @@ QList AutoType::createActionFromTemplate(const QString& tmpl, c int num = -1; QList list; + QRegExp delayRegEx("delay=(\\d+)", Qt::CaseSensitive, QRegExp::RegExp2); + if (delayRegEx.exactMatch(tmplName)) { + num = delayRegEx.cap(1).toInt(); + m_autoTypeDelay = std::max(0, std::min(num, 10000)); + return list; + } + QRegExp repeatRegEx("(.+) (\\d+)", Qt::CaseSensitive, QRegExp::RegExp2); if (repeatRegEx.exactMatch(tmplName)) { tmplName = repeatRegEx.cap(1); diff --git a/src/autotype/AutoType.h b/src/autotype/AutoType.h index d1c88174c..9799af4f3 100644 --- a/src/autotype/AutoType.h +++ b/src/autotype/AutoType.h @@ -69,6 +69,7 @@ private: bool windowMatches(const QString& windowTitle, const QString& windowPattern); bool m_inAutoType; + int m_autoTypeDelay; Qt::Key m_currentGlobalKey; Qt::KeyboardModifiers m_currentGlobalModifiers; QPluginLoader* m_pluginLoader;