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 *menu = new QMenu ();
|
||||
captureAction_ = menu->addAction (tr ("Захват"), this, SLOT (capture ()));
|
||||
QMenu *translateMenu = menu->addMenu (tr ("Перевод"));
|
||||
repeatAction_ = translateMenu->addAction (tr ("Повторить"), this,
|
||||
QMenu *translateMenu = menu->addMenu (tr ("Результат"));
|
||||
repeatAction_ = translateMenu->addAction (tr ("Показать"), this,
|
||||
SLOT (showLast ()));
|
||||
clipboardAction_ = translateMenu->addAction (tr ("Скопировать"), this,
|
||||
clipboardAction_ = translateMenu->addAction (tr ("В буфер"), this,
|
||||
SLOT (copyLastToClipboard ()));
|
||||
menu->addAction (tr ("Настройки"), this, SLOT (settings ()));
|
||||
menu->addAction (tr ("О программе"), this, SLOT (about ()));
|
||||
@ -215,10 +215,13 @@ void Manager::showLast () {
|
||||
void Manager::copyLastToClipboard () {
|
||||
if (lastItem_.isValid ()) {
|
||||
QClipboard *clipboard = QApplication::clipboard ();
|
||||
QString message = lastItem_.recognized + " - " + lastItem_.translated;
|
||||
QString message = lastItem_.recognized;
|
||||
if (!lastItem_.translated.isEmpty ()) {
|
||||
message += " - " + lastItem_.translated;
|
||||
}
|
||||
clipboard->setText (message);
|
||||
trayIcon_->showMessage (tr ("Перевод"),
|
||||
tr ("Последний перевод был скопирован в буфер обмена."),
|
||||
trayIcon_->showMessage (tr ("Результат"),
|
||||
tr ("Последний результат был скопирован в буфер обмена."),
|
||||
QSystemTrayIcon::Information);
|
||||
}
|
||||
}
|
||||
@ -231,7 +234,7 @@ void Manager::showResult (ProcessingItem item) {
|
||||
}
|
||||
else {
|
||||
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->recognizeLabel->setText (item.recognized);
|
||||
ui->translateLabel->setText (item.translated);
|
||||
bool gotTranslation = !item.translated.isEmpty ();
|
||||
ui->translateLabel->setVisible (gotTranslation);
|
||||
ui->translateLine->setVisible (gotTranslation);
|
||||
|
||||
show ();
|
||||
adjustSize ();
|
||||
|
@ -14,7 +14,16 @@
|
||||
<string>Результат</string>
|
||||
</property>
|
||||
<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>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@ -29,7 +38,16 @@
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<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>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@ -49,7 +67,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<widget class="Line" name="recognizeLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -69,7 +87,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="translateLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user