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