Fix representer actions when show result as tooltip
This commit is contained in:
parent
c5b57d1d7a
commit
4fb3af6cbf
@ -107,6 +107,8 @@ void Manager::updateSettings()
|
|||||||
setupProxy(*settings_);
|
setupProxy(*settings_);
|
||||||
setupUpdates(*settings_);
|
setupUpdates(*settings_);
|
||||||
|
|
||||||
|
tray_->setTaskActionsEnabled(false);
|
||||||
|
|
||||||
models_->update(settings_->tessdataPath);
|
models_->update(settings_->tessdataPath);
|
||||||
|
|
||||||
tray_->updateSettings();
|
tray_->updateSettings();
|
||||||
|
@ -26,6 +26,12 @@ Representer::~Representer() = default;
|
|||||||
|
|
||||||
void Representer::showLast()
|
void Representer::showLast()
|
||||||
{
|
{
|
||||||
|
if (settings_.resultShowType == ResultMode::Tooltip) {
|
||||||
|
SOFT_ASSERT(lastTooltipTask_, return );
|
||||||
|
showTooltip(lastTooltipTask_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SOFT_ASSERT(!widgets_.empty(), return );
|
SOFT_ASSERT(!widgets_.empty(), return );
|
||||||
for (auto &widget : widgets_) {
|
for (auto &widget : widgets_) {
|
||||||
SOFT_ASSERT(widget->task(), continue);
|
SOFT_ASSERT(widget->task(), continue);
|
||||||
@ -38,6 +44,12 @@ void Representer::showLast()
|
|||||||
|
|
||||||
void Representer::clipboardLast()
|
void Representer::clipboardLast()
|
||||||
{
|
{
|
||||||
|
if (settings_.resultShowType == ResultMode::Tooltip) {
|
||||||
|
SOFT_ASSERT(lastTooltipTask_, return );
|
||||||
|
clipboardText(lastTooltipTask_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SOFT_ASSERT(!widgets_.empty(), return );
|
SOFT_ASSERT(!widgets_.empty(), return );
|
||||||
SOFT_ASSERT(widgets_.front()->task(), return );
|
SOFT_ASSERT(widgets_.front()->task(), return );
|
||||||
clipboardText(widgets_.front()->task());
|
clipboardText(widgets_.front()->task());
|
||||||
@ -70,6 +82,7 @@ void Representer::hide()
|
|||||||
|
|
||||||
void Representer::updateSettings()
|
void Representer::updateSettings()
|
||||||
{
|
{
|
||||||
|
lastTooltipTask_.reset();
|
||||||
if (widgets_.empty())
|
if (widgets_.empty())
|
||||||
return;
|
return;
|
||||||
for (auto &w : widgets_) w->updateSettings();
|
for (auto &w : widgets_) w->updateSettings();
|
||||||
@ -128,12 +141,16 @@ bool Representer::eventFilter(QObject * /*watched*/, QEvent *event)
|
|||||||
|
|
||||||
void Representer::showTooltip(const TaskPtr &task)
|
void Representer::showTooltip(const TaskPtr &task)
|
||||||
{
|
{
|
||||||
|
SOFT_ASSERT(task, return );
|
||||||
|
lastTooltipTask_ = task;
|
||||||
|
|
||||||
auto message = task->recognized + " - " + task->translated;
|
auto message = task->recognized + " - " + task->translated;
|
||||||
tray_.showInformation(message);
|
tray_.showInformation(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Representer::showWidget(const TaskPtr &task)
|
void Representer::showWidget(const TaskPtr &task)
|
||||||
{
|
{
|
||||||
|
SOFT_ASSERT(task, return );
|
||||||
generation_ = task->generation;
|
generation_ = task->generation;
|
||||||
|
|
||||||
auto index = 0u;
|
auto index = 0u;
|
||||||
|
@ -40,4 +40,5 @@ private:
|
|||||||
Generation generation_{};
|
Generation generation_{};
|
||||||
std::vector<std::unique_ptr<ResultWidget>> widgets_;
|
std::vector<std::unique_ptr<ResultWidget>> widgets_;
|
||||||
std::unique_ptr<ResultEditor> editor_;
|
std::unique_ptr<ResultEditor> editor_;
|
||||||
|
TaskPtr lastTooltipTask_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user