UI: Form windows should be deleted on close

This commit is contained in:
Nodir Temirkhodjaev 2024-10-01 12:17:12 +05:00
parent 0ebb70eb6e
commit 43893f60ed
5 changed files with 3 additions and 22 deletions

View File

@ -27,9 +27,6 @@ public:
virtual WindowCode windowCode() const { return WindowNone; } virtual WindowCode windowCode() const { return WindowNone; }
bool deleteOnClose() const override { return m_deleteOnClose; }
void setDeleteOnClose(bool v) { m_deleteOnClose = v; }
bool excludeFromCapture() const { return m_excludeFromCapture; } bool excludeFromCapture() const { return m_excludeFromCapture; }
void setExcludeFromCapture(bool v); void setExcludeFromCapture(bool v);
@ -46,7 +43,6 @@ private:
void setupWindowCapture(IniUser *iniUser, const QString &iniGroup); void setupWindowCapture(IniUser *iniUser, const QString &iniGroup);
private: private:
bool m_deleteOnClose : 1 = false;
bool m_excludeFromCapture : 1 = false; bool m_excludeFromCapture : 1 = false;
WidgetWindowStateWatcher *m_stateWatcher = nullptr; WidgetWindowStateWatcher *m_stateWatcher = nullptr;

View File

@ -94,7 +94,7 @@ GraphWindow::GraphWindow(QWidget *parent) : FormWindow(parent)
bool GraphWindow::deleteOnClose() const bool GraphWindow::deleteOnClose() const
{ {
return !iniUser()->graphWindowHideOnClose() || FormWindow::deleteOnClose(); return !iniUser()->graphWindowHideOnClose();
} }
ConfManager *GraphWindow::confManager() const ConfManager *GraphWindow::confManager() const

View File

@ -41,13 +41,6 @@ void OptionsWindow::selectTab(int index)
m_mainPage->selectTab(index); m_mainPage->selectTab(index);
} }
void OptionsWindow::cancelChanges()
{
if (ctrl()->confToEdit() && ctrl()->anyEdited()) {
ctrl()->resetEdited();
}
}
void OptionsWindow::saveWindowState(bool /*wasVisible*/) void OptionsWindow::saveWindowState(bool /*wasVisible*/)
{ {
iniUser()->setOptWindowGeometry(stateWatcher()->geometry()); iniUser()->setOptWindowGeometry(stateWatcher()->geometry());

View File

@ -24,8 +24,6 @@ public:
void selectTab(int index); void selectTab(int index);
void cancelChanges();
void saveWindowState(bool wasVisible) override; void saveWindowState(bool wasVisible) override;
void restoreWindowState() override; void restoreWindowState() override;

View File

@ -428,7 +428,6 @@ void WindowManager::showOptionsWindow()
void WindowManager::closeOptionsWindow() void WindowManager::closeOptionsWindow()
{ {
if (closeWindow(m_optWindow)) { if (closeWindow(m_optWindow)) {
m_optWindow->cancelChanges();
m_optWindow = nullptr; m_optWindow = nullptr;
} }
} }
@ -438,16 +437,11 @@ void WindowManager::reloadOptionsWindow(const QString &reason)
if (!m_optWindow) if (!m_optWindow)
return; return;
const bool wasVisible = m_optWindow->isVisible();
// Unsaved changes are lost // Unsaved changes are lost
m_optWindow->setDeleteOnClose(true);
closeOptionsWindow(); closeOptionsWindow();
if (wasVisible) { // Show after new conf initialization
// Show after new conf initialization QMetaObject::invokeMethod(this, &WindowManager::showOptionsWindow, Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &WindowManager::showOptionsWindow, Qt::QueuedConnection);
}
showTrayMessage(reason); showTrayMessage(reason);
} }