Remember Popped-up Chat Size (#5635)
This commit is contained in:
+14
-2
@@ -18,6 +18,7 @@
|
||||
#include "singletons/Updates.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/InitUpdateButton.hpp"
|
||||
#include "util/RapidJsonSerializeQSize.hpp"
|
||||
#include "widgets/AccountSwitchPopup.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
#include "widgets/dialogs/switcher/QuickSwitcherPopup.hpp"
|
||||
@@ -75,7 +76,13 @@ Window::Window(WindowType type, QWidget *parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
this->resize(int(300 * this->scale()), int(500 * this->scale()));
|
||||
auto lastPopup = getSettings()->lastPopupSize.getValue();
|
||||
if (lastPopup.isEmpty())
|
||||
{
|
||||
// The size in the setting was invalid, use the default value
|
||||
lastPopup = getSettings()->lastPopupSize.getDefaultValue();
|
||||
}
|
||||
this->resize(lastPopup.width(), lastPopup.height());
|
||||
}
|
||||
|
||||
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
|
||||
@@ -142,7 +149,12 @@ void Window::closeEvent(QCloseEvent *)
|
||||
getApp()->getWindows()->save();
|
||||
getApp()->getWindows()->closeAll();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
QRect rect = this->getBounds();
|
||||
QSize newSize(rect.width(), rect.height());
|
||||
getSettings()->lastPopupSize.setValue(newSize);
|
||||
}
|
||||
// Ensure selectedWindow_ is never an invalid pointer.
|
||||
// WindowManager will return the main window if no window is pointed to by
|
||||
// `selectedWindow_`.
|
||||
|
||||
Reference in New Issue
Block a user