small fixes
This commit is contained in:
parent
accd231c64
commit
ecab473482
@ -265,14 +265,14 @@ private:
|
|||||||
}
|
}
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < textPositionMap.size(); ++i) if (textPositionMap[i].y() > mouse.y() && textPositionMap[i].x() > mouse.x()) break;
|
for (i = 0; i < textPositionMap.size(); ++i) if (textPositionMap[i].y() > mouse.y() && textPositionMap[i].x() > mouse.x()) break;
|
||||||
if (i == textPositionMap.size() || (mouse - textPositionMap[i]).manhattanLength() > font.pointSize() * 2) return dictionaryWindow.hide();
|
if (i == textPositionMap.size() || (mouse - textPositionMap[i]).manhattanLength() > font.pointSize() * 3) return dictionaryWindow.hide();
|
||||||
if (sentence.mid(i) == dictionaryWindow.term) return dictionaryWindow.ShowDefinition();
|
if (sentence.mid(i) == dictionaryWindow.term) return dictionaryWindow.ShowDefinition();
|
||||||
dictionaryWindow.ui.display->setFixedWidth(ui.display->width() * 3 / 4);
|
dictionaryWindow.ui.display->setFixedWidth(ui.display->width() * 3 / 4);
|
||||||
dictionaryWindow.setTerm(sentence.mid(i));
|
dictionaryWindow.setTerm(sentence.mid(i));
|
||||||
int left = i == 0 ? 0 : textPositionMap[i - 1].x(), right = textPositionMap[i].x(),
|
int left = i == 0 ? 0 : textPositionMap[i - 1].x(), right = textPositionMap[i].x(),
|
||||||
x = textPositionMap[i].x() > ui.display->width() / 2 ? -dictionaryWindow.width() + (right * 3 + left) / 4 : (left * 3 + right) / 4, y = 0;
|
x = textPositionMap[i].x() > ui.display->width() / 2 ? -dictionaryWindow.width() + (right * 3 + left) / 4 : (left * 3 + right) / 4, y = 0;
|
||||||
for (auto point : textPositionMap) if (point.y() > y && point.y() < textPositionMap[i].y()) y = point.y();
|
for (auto point : textPositionMap) if (point.y() > y && point.y() < textPositionMap[i].y()) y = point.y();
|
||||||
dictionaryWindow.move(ui.display->mapToGlobal(QPoint(x, y - dictionaryWindow.height() + 1)));
|
dictionaryWindow.move(ui.display->mapToGlobal(QPoint(x, y - dictionaryWindow.height())));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eventFilter(QObject*, QEvent* event) override
|
bool eventFilter(QObject*, QEvent* event) override
|
||||||
|
@ -14,15 +14,22 @@ const char* TRANSLATION_PROVIDER = "Google Translate";
|
|||||||
QStringList languages
|
QStringList languages
|
||||||
{
|
{
|
||||||
"Afrikaans: af",
|
"Afrikaans: af",
|
||||||
"Arabic: ar",
|
|
||||||
"Albanian: sq",
|
"Albanian: sq",
|
||||||
|
"Amharic: am",
|
||||||
|
"Arabic: ar",
|
||||||
|
"Armenian: hy",
|
||||||
|
"Azerbaijani: az",
|
||||||
|
"Basque: eu",
|
||||||
"Belarusian: be",
|
"Belarusian: be",
|
||||||
"Bengali: bn",
|
"Bengali: bn",
|
||||||
"Bosnian: bs",
|
"Bosnian: bs",
|
||||||
"Bulgarian: bg",
|
"Bulgarian: bg",
|
||||||
"Catalan: ca",
|
"Catalan: ca",
|
||||||
"Chinese (simplified): zh-CH",
|
"Cebuano: ceb",
|
||||||
|
"Chichewa: ny",
|
||||||
|
"Chinese (simplified): zh",
|
||||||
"Chinese (traditional): zh-TW",
|
"Chinese (traditional): zh-TW",
|
||||||
|
"Corsican: co",
|
||||||
"Croatian: hr",
|
"Croatian: hr",
|
||||||
"Czech: cs",
|
"Czech: cs",
|
||||||
"Danish: da",
|
"Danish: da",
|
||||||
@ -33,45 +40,87 @@ QStringList languages
|
|||||||
"Filipino: tl",
|
"Filipino: tl",
|
||||||
"Finnish: fi",
|
"Finnish: fi",
|
||||||
"French: fr",
|
"French: fr",
|
||||||
|
"Frisian: fy",
|
||||||
"Galician: gl",
|
"Galician: gl",
|
||||||
|
"Georgian: ka",
|
||||||
"German: de",
|
"German: de",
|
||||||
"Greek: el",
|
"Greek: el",
|
||||||
|
"Gujarati: gu",
|
||||||
|
"Haitian Creole: ht",
|
||||||
|
"Hausa: ha",
|
||||||
|
"Hawaiian: haw",
|
||||||
"Hebrew: iw",
|
"Hebrew: iw",
|
||||||
"Hindi: hi",
|
"Hindi: hi",
|
||||||
|
"Hmong: hmn",
|
||||||
"Hungarian: hu",
|
"Hungarian: hu",
|
||||||
"Icelandic: is",
|
"Icelandic: is",
|
||||||
|
"Igbo: ig",
|
||||||
"Indonesian: id",
|
"Indonesian: id",
|
||||||
"Irish: ga",
|
"Irish: ga",
|
||||||
"Italian: it",
|
"Italian: it",
|
||||||
"Japanese: ja",
|
"Japanese: ja",
|
||||||
"Klingon: tlh",
|
"Javanese: jw",
|
||||||
|
"Kannada: kn",
|
||||||
|
"Kazakh: kk",
|
||||||
|
"Khmer: km",
|
||||||
|
"Kinyarwanda: rw",
|
||||||
"Korean: ko",
|
"Korean: ko",
|
||||||
|
"Kurdish (Kurmanji): ku",
|
||||||
|
"Kyrgyz: ky",
|
||||||
|
"Lao: lo",
|
||||||
"Latin: la",
|
"Latin: la",
|
||||||
"Latvian: lv",
|
"Latvian: lv",
|
||||||
"Lithuanian: lt",
|
"Lithuanian: lt",
|
||||||
|
"Luxembourgish: lb",
|
||||||
"Macedonian: mk",
|
"Macedonian: mk",
|
||||||
|
"Malagasy: mg",
|
||||||
"Malay: ms",
|
"Malay: ms",
|
||||||
|
"Malayalam: ml",
|
||||||
"Maltese: mt",
|
"Maltese: mt",
|
||||||
|
"Maori: mi",
|
||||||
|
"Marathi: mr",
|
||||||
|
"Mongolian: mn",
|
||||||
|
"Myanmar (Burmese): my",
|
||||||
|
"Nepali: ne",
|
||||||
"Norwegian: no",
|
"Norwegian: no",
|
||||||
|
"Odia (Oriya): or",
|
||||||
|
"Pashto: ps",
|
||||||
"Persian: fa",
|
"Persian: fa",
|
||||||
"Polish: pl",
|
"Polish: pl",
|
||||||
"Portuguese: pt",
|
"Portuguese: pt",
|
||||||
|
"Punjabi: pa",
|
||||||
"Romanian: ro",
|
"Romanian: ro",
|
||||||
"Russian: ru",
|
"Russian: ru",
|
||||||
|
"Samoan: sm",
|
||||||
|
"Scots Gaelic: gd",
|
||||||
"Serbian: sr",
|
"Serbian: sr",
|
||||||
|
"Sesotho: st",
|
||||||
|
"Shona: sn",
|
||||||
|
"Sindhi: sd",
|
||||||
|
"Sinhala: si",
|
||||||
"Slovak: sk",
|
"Slovak: sk",
|
||||||
"Slovenian: sl",
|
"Slovenian: sl",
|
||||||
"Somali: so",
|
"Somali: so",
|
||||||
"Spanish: es",
|
"Spanish: es",
|
||||||
|
"Sundanese: su",
|
||||||
"Swahili: sw",
|
"Swahili: sw",
|
||||||
"Swedish: sv",
|
"Swedish: sv",
|
||||||
|
"Tajik: tg",
|
||||||
|
"Tamil: ta",
|
||||||
|
"Tatar: tt",
|
||||||
|
"Telugu: te",
|
||||||
"Thai: th",
|
"Thai: th",
|
||||||
"Turkish: tr",
|
"Turkish: tr",
|
||||||
"Ukranian: uk",
|
"Turkmen: tk",
|
||||||
|
"Ukrainian: uk",
|
||||||
"Urdu: ur",
|
"Urdu: ur",
|
||||||
|
"Uyghur: ug",
|
||||||
|
"Uzbek: uz",
|
||||||
"Vietnamese: vi",
|
"Vietnamese: vi",
|
||||||
"Welsh: cy",
|
"Welsh: cy",
|
||||||
|
"Xhosa: xh",
|
||||||
"Yiddish: yi",
|
"Yiddish: yi",
|
||||||
|
"Yoruba: yo",
|
||||||
"Zulu: zu"
|
"Zulu: zu"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user