refs #475, allow to load DB data from disk.

* Will allow to load data if DB is not accessible / available
* Also allows to save, so a special set can be saved for testing/forensic.
* fixed status bar, as received data no longer means DB is alive
This commit is contained in:
Klaus Basan
2015-09-30 05:05:03 +02:00
committed by Mathew Sutcliffe
parent 326a465b54
commit aa653e0d85
11 changed files with 379 additions and 25 deletions

View File

@@ -7,11 +7,12 @@
* contained in the LICENSE file.
*/
#include "ui_datainfoareacomponent.h"
#include "blackgui/components/logcomponent.h"
#include "blackgui/components/datainfoareacomponent.h"
#include "blackcore/webdataservices.h"
#include "ui_datainfoareacomponent.h"
#include "blackmisc/icons.h"
#include "blackmisc/logmessage.h"
using namespace BlackMisc;
using namespace BlackGui;
@@ -73,6 +74,37 @@ namespace BlackGui
this->ui->comp_DbLiveries->setProvider(provider);
this->ui->comp_DbModels->setProvider(provider);
this->ui->comp_Countries->setProvider(provider);
CWebDataServicesAware::setProvider(provider);
}
bool CDataInfoAreaComponent::writeDbDataToResourceDir() const
{
bool s = hasProvider() &&
this->writeDbDataToDisk(CProject::getSwiftStaticDbFilesDir());
if (s)
{
CLogMessage(this).info("Written DB data");
}
else
{
CLogMessage(this).error("Cannot write DB data");
}
return s;
}
bool CDataInfoAreaComponent::readDbDataFromResourceDir()
{
bool s = hasProvider() &&
this->readDbDataFromDisk(CProject::getSwiftStaticDbFilesDir());
if (s)
{
CLogMessage(this).info("Read DB data");
}
else
{
CLogMessage(this).error("Failed to load DB data");
}
return s;
}
QSize CDataInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const