Reading settings file causes crash.

This commit is contained in:
Roman Telezhynskyi 2023-02-13 19:54:17 +02:00
parent 6aaa20010d
commit 4a82ea8687
5 changed files with 4 additions and 26 deletions

View File

@ -1672,7 +1672,6 @@ void VPMainWindow::ReadSettings()
if (settings->status() == QSettings::NoError) if (settings->status() == QSettings::NoError)
{ {
restoreGeometry(settings->GetGeometry()); restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion()); restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon // Text under tool buton icon
@ -1698,7 +1697,6 @@ void VPMainWindow::WriteSettings()
{ {
VPSettings *settings = VPApplication::VApp()->PuzzleSettings(); VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetGeometry(saveGeometry()); settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion())); settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetPropertiesActive(ui->dockWidgetProperties->isEnabled()); settings->SetDockWidgetPropertiesActive(ui->dockWidgetProperties->isEnabled());

View File

@ -3611,7 +3611,6 @@ void TMainWindow::ReadSettings()
if (settings->status() == QSettings::NoError) if (settings->status() == QSettings::NoError)
{ {
restoreGeometry(settings->GetGeometry()); restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion()); restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon // Text under tool buton icon
@ -3631,7 +3630,6 @@ void TMainWindow::WriteSettings()
{ {
VTapeSettings *settings = MApplication::VApp()->TapeSettings(); VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetGeometry(saveGeometry()); settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion())); settings->SetToolbarsState(saveState(AppVersion()));
settings->SetTapeSearchOptionMatchCase(m_search->IsMatchCase()); settings->SetTapeSearchOptionMatchCase(m_search->IsMatchCase());

View File

@ -5204,7 +5204,6 @@ void MainWindow::ReadSettings()
if (settings->status() == QSettings::NoError) if (settings->status() == QSettings::NoError)
{ {
restoreGeometry(settings->GetGeometry()); restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion()); restoreState(settings->GetToolbarsState(), AppVersion());
m_groupsActive = settings->IsDockWidgetGroupsActive(); m_groupsActive = settings->IsDockWidgetGroupsActive();
@ -5249,7 +5248,6 @@ void MainWindow::WriteSettings()
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetGeometry(saveGeometry()); settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion())); settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isVisible()); settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isVisible());

View File

@ -46,10 +46,10 @@
#include <QTextCodec> #include <QTextCodec>
#endif #endif
#include "../vmisc/def.h" #include "def.h"
#include "../vmisc/defglobal.h" #include "defglobal.h"
#include "../vmisc/compatibility.h" #include "compatibility.h"
#include "../vmisc/literals.h" #include "literals.h"
const int VCommonSettings::defaultScrollingDuration = 300; const int VCommonSettings::defaultScrollingDuration = 300;
const int VCommonSettings::scrollingDurationMin = 100; const int VCommonSettings::scrollingDurationMin = 100;
@ -120,7 +120,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralWindowState, (QLatin1String("windowState"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDarkMode, (QLatin1String("configuration/dark_mode"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDarkMode, (QLatin1String("configuration/dark_mode"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) // NOLINT
@ -755,18 +754,6 @@ void VCommonSettings::SetGeometry(const QByteArray &value)
setValue(*settingGeneralGeometry, value); setValue(*settingGeneralGeometry, value);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VCommonSettings::GetWindowState() const -> QByteArray
{
return value(*settingGeneralWindowState).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetWindowState(const QByteArray &value)
{
setValue(*settingGeneralWindowState, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCommonSettings::GetToolbarsState() const -> QByteArray auto VCommonSettings::GetToolbarsState() const -> QByteArray
{ {

View File

@ -140,9 +140,6 @@ public:
auto GetGeometry() const -> QByteArray; auto GetGeometry() const -> QByteArray;
void SetGeometry(const QByteArray &value); void SetGeometry(const QByteArray &value);
auto GetWindowState() const -> QByteArray;
void SetWindowState(const QByteArray &value);
auto GetToolbarsState() const -> QByteArray; auto GetToolbarsState() const -> QByteArray;
void SetToolbarsState(const QByteArray &value); void SetToolbarsState(const QByteArray &value);