Make emote popup remember last position (#1580)

* Use existing moveTo to ensure window stay within desktop geometry
This commit is contained in:
mmb L
2020-04-13 19:15:51 +08:00
committed by GitHub
parent 6f926e7d77
commit ebfcb49e8c
4 changed files with 34 additions and 0 deletions
+19
View File
@@ -274,6 +274,16 @@ Window *WindowManager::windowAt(int index)
return this->windows_.at(index);
}
QPoint WindowManager::emotePopupPos()
{
return this->emotePopupPos_;
}
void WindowManager::setEmotePopupPos(QPoint pos)
{
this->emotePopupPos_ = pos;
}
void WindowManager::initialize(Settings &settings, Paths &paths)
{
assertInGuiThread();
@@ -401,6 +411,10 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
}
window.show();
QJsonObject emote_popup_obj = window_obj.value("emotePopup").toObject();
this->emotePopupPos_ = QPoint(emote_popup_obj.value("x").toInt(),
emote_popup_obj.value("y").toInt());
if (window_obj.value("state") == "minimized")
{
window.setWindowState(Qt::WindowMinimized);
@@ -478,6 +492,11 @@ void WindowManager::save()
window_obj.insert("width", rect.width());
window_obj.insert("height", rect.height());
QJsonObject emote_popup_obj;
emote_popup_obj.insert("x", this->emotePopupPos_.x());
emote_popup_obj.insert("y", this->emotePopupPos_.y());
window_obj.insert("emotePopup", emote_popup_obj);
// window tabs
QJsonArray tabs_arr;