Better support of only OCR mode (cosmetic).
This commit is contained in:
parent
bf6eea7f8e
commit
6d57198471
17
Manager.cpp
17
Manager.cpp
@ -80,10 +80,10 @@ Manager::Manager (QObject *parent) :
|
|||||||
QMenu * Manager::trayContextMenu () {
|
QMenu * Manager::trayContextMenu () {
|
||||||
QMenu *menu = new QMenu ();
|
QMenu *menu = new QMenu ();
|
||||||
captureAction_ = menu->addAction (tr ("Захват"), this, SLOT (capture ()));
|
captureAction_ = menu->addAction (tr ("Захват"), this, SLOT (capture ()));
|
||||||
QMenu *translateMenu = menu->addMenu (tr ("Перевод"));
|
QMenu *translateMenu = menu->addMenu (tr ("Результат"));
|
||||||
repeatAction_ = translateMenu->addAction (tr ("Повторить"), this,
|
repeatAction_ = translateMenu->addAction (tr ("Показать"), this,
|
||||||
SLOT (showLast ()));
|
SLOT (showLast ()));
|
||||||
clipboardAction_ = translateMenu->addAction (tr ("Скопировать"), this,
|
clipboardAction_ = translateMenu->addAction (tr ("В буфер"), this,
|
||||||
SLOT (copyLastToClipboard ()));
|
SLOT (copyLastToClipboard ()));
|
||||||
menu->addAction (tr ("Настройки"), this, SLOT (settings ()));
|
menu->addAction (tr ("Настройки"), this, SLOT (settings ()));
|
||||||
menu->addAction (tr ("О программе"), this, SLOT (about ()));
|
menu->addAction (tr ("О программе"), this, SLOT (about ()));
|
||||||
@ -215,10 +215,13 @@ void Manager::showLast () {
|
|||||||
void Manager::copyLastToClipboard () {
|
void Manager::copyLastToClipboard () {
|
||||||
if (lastItem_.isValid ()) {
|
if (lastItem_.isValid ()) {
|
||||||
QClipboard *clipboard = QApplication::clipboard ();
|
QClipboard *clipboard = QApplication::clipboard ();
|
||||||
QString message = lastItem_.recognized + " - " + lastItem_.translated;
|
QString message = lastItem_.recognized;
|
||||||
|
if (!lastItem_.translated.isEmpty ()) {
|
||||||
|
message += " - " + lastItem_.translated;
|
||||||
|
}
|
||||||
clipboard->setText (message);
|
clipboard->setText (message);
|
||||||
trayIcon_->showMessage (tr ("Перевод"),
|
trayIcon_->showMessage (tr ("Результат"),
|
||||||
tr ("Последний перевод был скопирован в буфер обмена."),
|
tr ("Последний результат был скопирован в буфер обмена."),
|
||||||
QSystemTrayIcon::Information);
|
QSystemTrayIcon::Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +234,7 @@ void Manager::showResult (ProcessingItem item) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString message = item.recognized + " - " + item.translated;
|
QString message = item.recognized + " - " + item.translated;
|
||||||
trayIcon_->showMessage (tr ("Перевод"), message, QSystemTrayIcon::Information);
|
trayIcon_->showMessage (tr ("Результат"), message, QSystemTrayIcon::Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ void ResultDialog::showResult (ProcessingItem item) {
|
|||||||
ui->sourceLabel->setPixmap (item.source);
|
ui->sourceLabel->setPixmap (item.source);
|
||||||
ui->recognizeLabel->setText (item.recognized);
|
ui->recognizeLabel->setText (item.recognized);
|
||||||
ui->translateLabel->setText (item.translated);
|
ui->translateLabel->setText (item.translated);
|
||||||
|
bool gotTranslation = !item.translated.isEmpty ();
|
||||||
|
ui->translateLabel->setVisible (gotTranslation);
|
||||||
|
ui->translateLine->setVisible (gotTranslation);
|
||||||
|
|
||||||
show ();
|
show ();
|
||||||
adjustSize ();
|
adjustSize ();
|
||||||
|
@ -14,7 +14,16 @@
|
|||||||
<string>Результат</string>
|
<string>Результат</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -29,7 +38,16 @@
|
|||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -49,7 +67,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="Line" name="line_2">
|
<widget class="Line" name="recognizeLine">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -69,7 +87,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="translateLine">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user