mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
bug bashing
This commit is contained in:
parent
45279d26dc
commit
8ac4a072a9
@ -88,7 +88,9 @@ struct PrettyWindow : QDialog, Localizer
|
|||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent*) override
|
void timerEvent(QTimerEvent*) override
|
||||||
{
|
{
|
||||||
if (autoHide && !hidden && geometry().contains(QCursor::pos()))
|
if (autoHide && geometry().contains(QCursor::pos()))
|
||||||
|
{
|
||||||
|
if (!hidden)
|
||||||
{
|
{
|
||||||
if (backgroundColor.alphaF() > 0.05) backgroundColor.setAlphaF(0.05);
|
if (backgroundColor.alphaF() > 0.05) backgroundColor.setAlphaF(0.05);
|
||||||
if (outliner->color.alphaF() > 0.05) outliner->color.setAlphaF(0.05);
|
if (outliner->color.alphaF() > 0.05) outliner->color.setAlphaF(0.05);
|
||||||
@ -96,6 +98,8 @@ protected:
|
|||||||
if (hiddenTextColor.alphaF() > 0.05) hiddenTextColor.setAlphaF(0.05);
|
if (hiddenTextColor.alphaF() > 0.05) hiddenTextColor.setAlphaF(0.05);
|
||||||
ui.display->setPalette(QPalette(hiddenTextColor, {}, {}, {}, {}, {}, {}));
|
ui.display->setPalette(QPalette(hiddenTextColor, {}, {}, {}, {}, {}, {}));
|
||||||
hidden = true;
|
hidden = true;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (hidden)
|
else if (hidden)
|
||||||
{
|
{
|
||||||
@ -103,6 +107,7 @@ protected:
|
|||||||
outliner->color.setAlpha(settings.value(OUTLINE_COLOR).value<QColor>().alpha());
|
outliner->color.setAlpha(settings.value(OUTLINE_COLOR).value<QColor>().alpha());
|
||||||
ui.display->setPalette(QPalette(settings.value(TEXT_COLOR).value<QColor>(), {}, {}, {}, {}, {}, {}));
|
ui.display->setPalette(QPalette(settings.value(TEXT_COLOR).value<QColor>(), {}, {}, {}, {}, {}, {}));
|
||||||
hidden = false;
|
hidden = false;
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +248,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void DisplaySentence()
|
void DisplaySentence()
|
||||||
{
|
{
|
||||||
|
if (sentenceHistory.empty()) return;
|
||||||
QString sentence = sentenceHistory[historyIndex];
|
QString sentence = sentenceHistory[historyIndex];
|
||||||
if (sentence.contains(u8"\x200b \n"))
|
if (sentence.contains(u8"\x200b \n"))
|
||||||
if (!showOriginal) sentence = sentence.split(u8"\x200b \n")[1];
|
if (!showOriginal) sentence = sentence.split(u8"\x200b \n")[1];
|
||||||
@ -254,8 +260,9 @@ private:
|
|||||||
ui.display->width(),
|
ui.display->width(),
|
||||||
QFontMetrics(ui.display->font(), ui.display).boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence).height()
|
QFontMetrics(ui.display->font(), ui.display).boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence).height()
|
||||||
);
|
);
|
||||||
|
//resize(width(), QFontMetrics(ui.display->font(), ui.display).boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence).height() + 22);
|
||||||
}
|
}
|
||||||
else if (locked)
|
else if (sizeLock)
|
||||||
{
|
{
|
||||||
QFontMetrics fontMetrics(ui.display->font(), ui.display);
|
QFontMetrics fontMetrics(ui.display->font(), ui.display);
|
||||||
int low = 0, high = sentence.size(), last = 0;
|
int low = 0, high = sentence.size(), last = 0;
|
||||||
@ -284,13 +291,13 @@ private:
|
|||||||
|
|
||||||
void SetPositionLock(bool locked)
|
void SetPositionLock(bool locked)
|
||||||
{
|
{
|
||||||
settings.setValue(POSITION_LOCK, this->locked = locked);
|
settings.setValue(POSITION_LOCK, posLock = locked);
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetSizeLock(bool locked)
|
void SetSizeLock(bool locked)
|
||||||
{
|
{
|
||||||
setSizeGripEnabled(!locked);
|
setSizeGripEnabled(!locked);
|
||||||
settings.setValue(SIZE_LOCK, locked);
|
settings.setValue(SIZE_LOCK, sizeLock = locked);
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetCenteredText(bool centeredText)
|
void SetCenteredText(bool centeredText)
|
||||||
@ -410,7 +417,7 @@ private:
|
|||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent* event) override
|
void mouseMoveEvent(QMouseEvent* event) override
|
||||||
{
|
{
|
||||||
if (!locked) move(pos() + event->globalPos() - oldPos);
|
if (!posLock) move(pos() + event->globalPos() - oldPos);
|
||||||
oldPos = event->globalPos();
|
oldPos = event->globalPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +429,7 @@ private:
|
|||||||
DisplaySentence();
|
DisplaySentence();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool locked, centeredText, autoResize, showOriginal, showOriginalAfterTranslation, useDictionary, clickThrough;
|
bool sizeLock, posLock, centeredText, autoResize, showOriginal, showOriginalAfterTranslation, useDictionary, clickThrough;
|
||||||
QPoint oldPos;
|
QPoint oldPos;
|
||||||
|
|
||||||
class
|
class
|
||||||
|
Loading…
x
Reference in New Issue
Block a user