Added status check for settings read/write operations.
--HG-- branch : release
This commit is contained in:
parent
2858122d9d
commit
8a3d50520f
|
@ -2797,6 +2797,9 @@ void TMainWindow::MeasurementGUI()
|
|||
void TMainWindow::ReadSettings()
|
||||
{
|
||||
const VTapeSettings *settings = qApp->TapeSettings();
|
||||
|
||||
if (settings->status() == QSettings::NoError)
|
||||
{
|
||||
restoreGeometry(settings->GetGeometry());
|
||||
restoreState(settings->GetWindowState());
|
||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||
|
@ -2806,6 +2809,11 @@ void TMainWindow::ReadSettings()
|
|||
|
||||
// Stack limit
|
||||
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Cannot read settings from a malformed INI file.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2815,6 +2823,12 @@ void TMainWindow::WriteSettings()
|
|||
settings->SetGeometry(saveGeometry());
|
||||
settings->SetWindowState(saveState());
|
||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
||||
settings->sync();
|
||||
if (settings->status() == QSettings::AccessError)
|
||||
{
|
||||
qWarning() << tr("Cannot save settings. Access denied.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -3700,6 +3700,9 @@ void MainWindow::ReadSettings()
|
|||
{
|
||||
qCDebug(vMainWindow, "Reading settings.");
|
||||
const VSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
if (settings->status() == QSettings::NoError)
|
||||
{
|
||||
restoreGeometry(settings->GetGeometry());
|
||||
restoreState(settings->GetWindowState());
|
||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||
|
@ -3715,6 +3718,11 @@ void MainWindow::ReadSettings()
|
|||
|
||||
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible();
|
||||
isDockGroupsVisible = ui->dockWidgetGroups->isVisible();
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Cannot read settings from a malformed INI file.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3725,10 +3733,16 @@ void MainWindow::WriteSettings()
|
|||
{
|
||||
ActionDraw(true);
|
||||
|
||||
VSettings *setings = qApp->ValentinaSettings();
|
||||
setings->SetGeometry(saveGeometry());
|
||||
setings->SetWindowState(saveState());
|
||||
setings->SetToolbarsState(saveState(APP_VERSION));
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetGeometry(saveGeometry());
|
||||
settings->SetWindowState(saveState());
|
||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
||||
settings->sync();
|
||||
if (settings->status() == QSettings::AccessError)
|
||||
{
|
||||
qWarning() << tr("Cannot save settings. Access denied.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user