mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix: prevent unnecessary layout saves (#4201)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
edd4789bf7
commit
188782ddca
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Unversioned
|
||||
|
||||
- Bugfix: Fixed unnecessary saving of windows layout. (#4201)
|
||||
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)
|
||||
|
||||
## 2.4.0
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
namespace chatterino {
|
||||
|
||||
AccountSwitchPopup::AccountSwitchPopup(QWidget *parent)
|
||||
: BaseWindow({BaseWindow::TopMost, BaseWindow::Frameless}, parent)
|
||||
: BaseWindow({BaseWindow::TopMost, BaseWindow::Frameless,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
this->setWindowFlag(Qt::Popup);
|
||||
|
|
|
@ -540,7 +540,11 @@ void BaseWindow::resizeEvent(QResizeEvent *)
|
|||
{
|
||||
// Queue up save because: Window resized
|
||||
#ifdef CHATTERINO
|
||||
if (!flags_.has(DisableLayoutSave))
|
||||
{
|
||||
getApp()->windows->queueSave();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//this->moveIntoDesktopRect(this);
|
||||
|
@ -572,7 +576,10 @@ void BaseWindow::moveEvent(QMoveEvent *event)
|
|||
{
|
||||
// Queue up save because: Window position changed
|
||||
#ifdef CHATTERINO
|
||||
if (!flags_.has(DisableLayoutSave))
|
||||
{
|
||||
getApp()->windows->queueSave();
|
||||
}
|
||||
#endif
|
||||
|
||||
BaseWidget::moveEvent(event);
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
FramelessDraggable = 16,
|
||||
DontFocus = 32,
|
||||
Dialog = 64,
|
||||
DisableLayoutSave = 128,
|
||||
};
|
||||
|
||||
enum ActionOnFocusLoss { Nothing, Delete, Close, Hide };
|
||||
|
|
|
@ -23,7 +23,10 @@ namespace {
|
|||
} // namespace
|
||||
|
||||
DraggablePopup::DraggablePopup(bool closeAutomatically, QWidget *parent)
|
||||
: BaseWindow(closeAutomatically ? popupFlagsCloseAutomatically : popupFlags,
|
||||
: BaseWindow(
|
||||
closeAutomatically
|
||||
? popupFlagsCloseAutomatically | BaseWindow::DisableLayoutSave
|
||||
: popupFlags | BaseWindow::DisableLayoutSave,
|
||||
parent)
|
||||
, lifetimeHack_(std::make_shared<bool>(false))
|
||||
, dragTimer_(this)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
namespace chatterino {
|
||||
|
||||
FramelessEmbedWindow::FramelessEmbedWindow()
|
||||
: BaseWindow(BaseWindow::Frameless)
|
||||
: BaseWindow({BaseWindow::Frameless, BaseWindow::DisableLayoutSave})
|
||||
{
|
||||
this->split_ = new Split((QWidget *)nullptr);
|
||||
auto layout = new QHBoxLayout;
|
||||
|
|
|
@ -22,7 +22,9 @@ TooltipWidget *TooltipWidget::instance()
|
|||
}
|
||||
|
||||
TooltipWidget::TooltipWidget(BaseWidget *parent)
|
||||
: BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus}, parent)
|
||||
: BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
, displayImage_(new QLabel())
|
||||
, displayText_(new QLabel())
|
||||
{
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
namespace chatterino {
|
||||
|
||||
ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent)
|
||||
: BasePopup(BaseWindow::EnableCustomFrame, parent)
|
||||
: BasePopup({BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
, color_()
|
||||
, dialogConfirmed_(false)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace chatterino {
|
||||
|
||||
NotificationPopup::NotificationPopup()
|
||||
: BaseWindow(BaseWindow::Frameless)
|
||||
: BaseWindow({BaseWindow::Frameless, BaseWindow::DisableLayoutSave})
|
||||
, channel_(std::make_shared<Channel>("notifications", Channel::Type::None))
|
||||
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace chatterino {
|
||||
|
||||
QualityPopup::QualityPopup(const QString &channelURL, QStringList options)
|
||||
: BasePopup({},
|
||||
: BasePopup({BaseWindow::DisableLayoutSave},
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())))
|
||||
, channelURL_(channelURL)
|
||||
{
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
namespace chatterino {
|
||||
|
||||
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
: BaseWindow(
|
||||
{BaseWindow::Flags::EnableCustomFrame, BaseWindow::Flags::Dialog},
|
||||
: BaseWindow({BaseWindow::Flags::EnableCustomFrame,
|
||||
BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
, selectedChannel_(Channel::getEmpty())
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
namespace chatterino {
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: BaseWindow(
|
||||
{BaseWindow::Flags::DisableCustomScaling, BaseWindow::Flags::Dialog},
|
||||
: BaseWindow({BaseWindow::Flags::DisableCustomScaling,
|
||||
BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
{
|
||||
this->setObjectName("SettingsDialog");
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace chatterino {
|
|||
|
||||
UpdateDialog::UpdateDialog()
|
||||
: BaseWindow({BaseWindow::Frameless, BaseWindow::TopMost,
|
||||
BaseWindow::EnableCustomFrame})
|
||||
BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave})
|
||||
{
|
||||
auto layout =
|
||||
LayoutCreator<UpdateDialog>(this).setLayoutType<QVBoxLayout>();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace chatterino {
|
||||
|
||||
WelcomeDialog::WelcomeDialog()
|
||||
: BaseWindow(BaseWindow::EnableCustomFrame)
|
||||
: BaseWindow({BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave})
|
||||
{
|
||||
this->setWindowTitle("Chatterino quick setup");
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace {
|
|||
const QSize QuickSwitcherPopup::MINIMUM_SIZE(500, 300);
|
||||
|
||||
QuickSwitcherPopup::QuickSwitcherPopup(QWidget *parent)
|
||||
: BasePopup(FlagsEnum<BaseWindow::Flags>{BaseWindow::Flags::Frameless,
|
||||
BaseWindow::Flags::TopMost},
|
||||
: BasePopup({BaseWindow::Flags::Frameless, BaseWindow::Flags::TopMost,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
, switcherModel_(this)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ ChannelPtr SearchPopup::filter(const QString &text, const QString &channelName,
|
|||
}
|
||||
|
||||
SearchPopup::SearchPopup(QWidget *parent, Split *split)
|
||||
: BasePopup({}, parent)
|
||||
: BasePopup({BaseWindow::DisableLayoutSave}, parent)
|
||||
, split_(split)
|
||||
{
|
||||
this->initLayout();
|
||||
|
|
|
@ -204,8 +204,9 @@ void AboutPage::addLicense(QFormLayout *form, const QString &name,
|
|||
auto *b = new QLabel("<a href=\"" + licenseLink + "\">show license</a>");
|
||||
QObject::connect(
|
||||
b, &QLabel::linkActivated, [parent = this, name, licenseLink] {
|
||||
auto window =
|
||||
new BasePopup(BaseWindow::Flags::EnableCustomFrame, parent);
|
||||
auto window = new BasePopup({BaseWindow::Flags::EnableCustomFrame,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent);
|
||||
window->setWindowTitle("Chatterino - License for " + name);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
auto layout = new QVBoxLayout();
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace {
|
|||
|
||||
InputCompletionPopup::InputCompletionPopup(QWidget *parent)
|
||||
: BasePopup({BasePopup::EnableCustomFrame, BasePopup::Frameless,
|
||||
BasePopup::DontFocus},
|
||||
BasePopup::DontFocus, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
, model_(this)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue