Added status check for settings read/write operations.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2018-09-09 12:39:19 +03:00
parent 2858122d9d
commit 8a3d50520f
2 changed files with 50 additions and 22 deletions

View File

@ -2797,15 +2797,23 @@ void TMainWindow::MeasurementGUI()
void TMainWindow::ReadSettings()
{
const VTapeSettings *settings = qApp->TapeSettings();
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Text under tool buton icon
ToolBarStyles();
if (settings->status() == QSettings::NoError)
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Stack limit
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
// Text under tool buton icon
ToolBarStyles();
// 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.");
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -3700,21 +3700,29 @@ void MainWindow::ReadSettings()
{
qCDebug(vMainWindow, "Reading settings.");
const VSettings *settings = qApp->ValentinaSettings();
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Scene antialiasing
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
if (settings->status() == QSettings::NoError)
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Stack limit
qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
// Scene antialiasing
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
// Text under tool buton icon
ToolBarStyles();
// Stack limit
qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible();
isDockGroupsVisible = ui->dockWidgetGroups->isVisible();
// Text under tool buton icon
ToolBarStyles();
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.");
}
}
//---------------------------------------------------------------------------------------------------------------------