2012-12-11 15:35:47 +01:00
|
|
|
#include "reportsubview.hpp"
|
|
|
|
|
2014-12-06 13:01:55 +01:00
|
|
|
#include "reporttable.hpp"
|
2013-09-22 13:54:01 +02:00
|
|
|
|
2022-08-19 19:19:42 +02:00
|
|
|
#include "../../model/doc/document.hpp"
|
2022-09-22 21:26:05 +03:00
|
|
|
#include "../../model/doc/state.hpp"
|
2022-08-19 19:19:42 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
CSVTools::ReportSubView::ReportSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
|
|
|
: CSVDoc::SubView(id)
|
|
|
|
, mDocument(document)
|
|
|
|
, mRefreshState(0)
|
2012-12-11 15:35:47 +01:00
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
if (id.getType() == CSMWorld::UniversalId::Type_VerificationResults)
|
2015-06-25 12:03:40 +02:00
|
|
|
mRefreshState = CSMDoc::State_Verifying;
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
setWidget(mTable = new ReportTable(document, id, false, mRefreshState, this));
|
|
|
|
|
|
|
|
connect(mTable, &ReportTable::editRequest, this, &ReportSubView::focusId);
|
2013-09-22 13:54:01 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
if (mRefreshState == CSMDoc::State_Verifying)
|
2015-06-25 13:05:57 +02:00
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
connect(mTable, &ReportTable::refreshRequest, this, &ReportSubView::refreshRequest);
|
2015-06-25 13:05:57 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
connect(&document, &CSMDoc::Document::stateChanged, mTable, &ReportTable::stateChanged);
|
2015-06-25 13:05:57 +02:00
|
|
|
}
|
2012-12-11 15:35:47 +01:00
|
|
|
}
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
void CSVTools::ReportSubView::setEditLock(bool locked)
|
2012-12-11 15:35:47 +01:00
|
|
|
{
|
|
|
|
// ignored. We don't change document state anyway.
|
2012-12-12 22:36:20 +01:00
|
|
|
}
|
|
|
|
|
2015-06-25 12:03:40 +02:00
|
|
|
void CSVTools::ReportSubView::refreshRequest()
|
|
|
|
{
|
|
|
|
if (!(mDocument.getState() & mRefreshState))
|
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
if (mRefreshState == CSMDoc::State_Verifying)
|
2015-06-25 12:03:40 +02:00
|
|
|
{
|
|
|
|
mTable->clear();
|
2022-09-22 21:26:05 +03:00
|
|
|
mDocument.verify(getUniversalId());
|
2015-06-25 12:03:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|