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