parent
7d84bd2f7b
commit
4f195f5629
@ -12,7 +12,8 @@ CaptureArea::CaptureArea(const QRect &rect, const Settings &settings)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskPtr CaptureArea::task(const QPixmap &pixmap) const
|
TaskPtr CaptureArea::task(const QPixmap &pixmap,
|
||||||
|
const QPoint &pixmapOffset) const
|
||||||
{
|
{
|
||||||
if (pixmap.isNull() || !isValid())
|
if (pixmap.isNull() || !isValid())
|
||||||
return {};
|
return {};
|
||||||
@ -21,7 +22,7 @@ TaskPtr CaptureArea::task(const QPixmap &pixmap) const
|
|||||||
task->generation = generation_;
|
task->generation = generation_;
|
||||||
task->useHunspell = useHunspell_;
|
task->useHunspell = useHunspell_;
|
||||||
task->captured = pixmap.copy(rect_);
|
task->captured = pixmap.copy(rect_);
|
||||||
task->capturePoint = rect_.topLeft();
|
task->capturePoint = pixmapOffset + rect_.topLeft();
|
||||||
task->sourceLanguage = sourceLanguage_;
|
task->sourceLanguage = sourceLanguage_;
|
||||||
if (task->sourceLanguage.isEmpty())
|
if (task->sourceLanguage.isEmpty())
|
||||||
task->error += QObject::tr("No source language set");
|
task->error += QObject::tr("No source language set");
|
||||||
|
@ -11,7 +11,7 @@ class CaptureArea
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CaptureArea(const QRect& rect, const Settings& settings);
|
CaptureArea(const QRect& rect, const Settings& settings);
|
||||||
TaskPtr task(const QPixmap& pixmap) const;
|
TaskPtr task(const QPixmap& pixmap, const QPoint& pixmapOffset) const;
|
||||||
|
|
||||||
void setGeneration(uint generation);
|
void setGeneration(uint generation);
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
@ -339,7 +339,7 @@ void CaptureAreaSelector::customize(const std::shared_ptr<CaptureArea> &area)
|
|||||||
edited_ = area;
|
edited_ = area;
|
||||||
editor_->show();
|
editor_->show();
|
||||||
const auto topLeft = service::geometry::cornerAtPoint(
|
const auto topLeft = service::geometry::cornerAtPoint(
|
||||||
area->rect().center(), editor_->size(), geometry());
|
area->rect().center(), editor_->size(), QRect({}, size()));
|
||||||
editor_->move(topLeft);
|
editor_->move(topLeft);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ void Capturer::selected(const CaptureArea &area)
|
|||||||
selector_->hide();
|
selector_->hide();
|
||||||
|
|
||||||
SOFT_ASSERT(!pixmap_.isNull(), return manager_.captureCanceled())
|
SOFT_ASSERT(!pixmap_.isNull(), return manager_.captureCanceled())
|
||||||
auto task = area.task(pixmap_);
|
auto task = area.task(pixmap_, pixmapOffset_);
|
||||||
if (task)
|
if (task)
|
||||||
manager_.captured(task);
|
manager_.captured(task);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user