Added ability to copy last result to clipboard from ResultDialog.
This commit is contained in:
parent
283b596ef1
commit
54f809707c
@ -71,6 +71,7 @@ Manager::Manager (QObject *parent) :
|
|||||||
connect (this, SIGNAL (settingsEdited ()), resultDialog_, SLOT (applySettings ()));
|
connect (this, SIGNAL (settingsEdited ()), resultDialog_, SLOT (applySettings ()));
|
||||||
connect (resultDialog_, SIGNAL (requestRecognize (ProcessingItem)),
|
connect (resultDialog_, SIGNAL (requestRecognize (ProcessingItem)),
|
||||||
this, SIGNAL (requestRecognize (ProcessingItem)));
|
this, SIGNAL (requestRecognize (ProcessingItem)));
|
||||||
|
connect (resultDialog_, SIGNAL (requestClipboard ()), SLOT (copyLastToClipboard ()));
|
||||||
|
|
||||||
|
|
||||||
connect (trayIcon_, SIGNAL (activated (QSystemTrayIcon::ActivationReason)),
|
connect (trayIcon_, SIGNAL (activated (QSystemTrayIcon::ActivationReason)),
|
||||||
|
@ -11,7 +11,7 @@ ResultDialog::ResultDialog (const LanguageHelper &dictionary, QWidget *parent) :
|
|||||||
QDialog (parent),
|
QDialog (parent),
|
||||||
ui (new Ui::ResultDialog),
|
ui (new Ui::ResultDialog),
|
||||||
dictionary_ (dictionary), isShowAtCapturePos_ (true),
|
dictionary_ (dictionary), isShowAtCapturePos_ (true),
|
||||||
contextMenu_ (NULL), recognizeSubMenu_ (NULL) {
|
contextMenu_ (NULL), recognizeSubMenu_ (NULL), clipboardAction_ (NULL) {
|
||||||
ui->setupUi (this);
|
ui->setupUi (this);
|
||||||
setWindowFlags (Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint |
|
setWindowFlags (Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint |
|
||||||
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||||
@ -37,6 +37,7 @@ void ResultDialog::applySettings () {
|
|||||||
void ResultDialog::createContextMenu () {
|
void ResultDialog::createContextMenu () {
|
||||||
contextMenu_ = new QMenu ();
|
contextMenu_ = new QMenu ();
|
||||||
recognizeSubMenu_ = contextMenu_->addMenu (tr ("Распознать другой язык"));
|
recognizeSubMenu_ = contextMenu_->addMenu (tr ("Распознать другой язык"));
|
||||||
|
clipboardAction_ = contextMenu_->addAction (tr ("Скопировать в буфер"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResultDialog::eventFilter (QObject *object, QEvent *event) {
|
bool ResultDialog::eventFilter (QObject *object, QEvent *event) {
|
||||||
@ -52,6 +53,9 @@ bool ResultDialog::eventFilter (QObject *object, QEvent *event) {
|
|||||||
item.ocrLanguage = dictionary_.ocrUiToCode (action->text ());
|
item.ocrLanguage = dictionary_.ocrUiToCode (action->text ());
|
||||||
emit requestRecognize (item);
|
emit requestRecognize (item);
|
||||||
}
|
}
|
||||||
|
else if (action == clipboardAction_) {
|
||||||
|
emit requestClipboard ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hide ();
|
hide ();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ class ResultDialog : public QDialog {
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestRecognize (ProcessingItem item);
|
void requestRecognize (ProcessingItem item);
|
||||||
|
void requestClipboard (); // Assume that slot will be called immediately.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const ProcessingItem &item () const;
|
const ProcessingItem &item () const;
|
||||||
@ -38,6 +39,7 @@ class ResultDialog : public QDialog {
|
|||||||
bool isShowAtCapturePos_;
|
bool isShowAtCapturePos_;
|
||||||
QMenu *contextMenu_;
|
QMenu *contextMenu_;
|
||||||
QMenu *recognizeSubMenu_;
|
QMenu *recognizeSubMenu_;
|
||||||
|
QAction *clipboardAction_;
|
||||||
ProcessingItem item_;
|
ProcessingItem item_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user