summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
new file mode 100644

index 00000000..d128631d --- /dev/null +++ b/src/timeline/InputBar.cpp
@@ -0,0 +1,46 @@ +#include "InputBar.h" + +#include <QClipboard> +#include <QGuiApplication> +#include <QMimeData> + +#include "Logging.h" + +bool +InputBar::paste(bool fromMouse) +{ + const QMimeData *md = nullptr; + + if (fromMouse) { + if (QGuiApplication::clipboard()->supportsSelection()) { + md = QGuiApplication::clipboard()->mimeData(QClipboard::Selection); + } + } else { + md = QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard); + } + + if (!md) + return false; + + if (md->hasImage()) { + return true; + } else { + nhlog::ui()->debug("formats: {}", md->formats().join(", ").toStdString()); + return false; + } +} + +void +InputBar::updateState(int selectionStart_, int selectionEnd_, int cursorPosition_, QString text_) +{ + selectionStart = selectionStart_; + selectionEnd = selectionEnd_; + cursorPosition = cursorPosition_; + text = text_; +} + +void +InputBar::send() +{ + nhlog::ui()->debug("Send: {}", text.toStdString()); +}