forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
feeb9ea8b0
10 changed files with 91 additions and 25 deletions
|
@ -2369,9 +2369,9 @@ void CSMDoc::Document::save()
|
|||
emit stateChanged (getState(), this);
|
||||
}
|
||||
|
||||
CSMWorld::UniversalId CSMDoc::Document::verify()
|
||||
CSMWorld::UniversalId CSMDoc::Document::verify (const CSMWorld::UniversalId& reportId)
|
||||
{
|
||||
CSMWorld::UniversalId id = mTools.runVerifier();
|
||||
CSMWorld::UniversalId id = mTools.runVerifier (reportId);
|
||||
emit stateChanged (getState(), this);
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace CSMDoc
|
|||
|
||||
void save();
|
||||
|
||||
CSMWorld::UniversalId verify();
|
||||
CSMWorld::UniversalId verify (const CSMWorld::UniversalId& reportId = CSMWorld::UniversalId());
|
||||
|
||||
CSMWorld::UniversalId newSearch();
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
|
||||
// check the number of pathgrid points
|
||||
if (pathgrid.mData.mS2 > static_cast<int>(pathgrid.mPoints.size()))
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + " has less points than expected"));
|
||||
messages.add (id, pathgrid.mId + " has less points than expected", "", CSMDoc::Message::Severity_Error);
|
||||
else if (pathgrid.mData.mS2 > static_cast<int>(pathgrid.mPoints.size()))
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + " has more points than expected"));
|
||||
messages.add (id, pathgrid.mId + " has more points than expected", "", CSMDoc::Message::Severity_Error);
|
||||
|
||||
std::vector<CSMTools::Point> pointList(pathgrid.mPoints.size());
|
||||
std::vector<int> duplList;
|
||||
|
@ -51,7 +51,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
std::ostringstream ss;
|
||||
ss << "has a duplicate edge between points" << pathgrid.mEdges[i].mV0
|
||||
<< " and " << pathgrid.mEdges[i].mV1;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
{
|
||||
std::ostringstream ss;
|
||||
ss << " has an edge connecting a non-existent point " << pathgrid.mEdges[i].mV0;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,13 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
{
|
||||
std::ostringstream ss;
|
||||
ss << " has has less edges than expected for point " << i;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
else if (pathgrid.mPoints[i].mConnectionNum < pointList[i].mConnectionNum)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << " has has more edges than expected for point " << i;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
// check that edges are bidirectional
|
||||
|
@ -101,7 +101,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
{
|
||||
std::ostringstream ss;
|
||||
ss << " has a missing edge between points " << i << " and " << pointList[i].mOtherIndex[j];
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
<< ") x=" << pathgrid.mPoints[i].mX
|
||||
<< ", y=" << pathgrid.mPoints[i].mY
|
||||
<< ", z=" << pathgrid.mPoints[i].mZ;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Warning);
|
||||
|
||||
duplList.push_back(i);
|
||||
break;
|
||||
|
@ -143,7 +143,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
<< ") x=" << pathgrid.mPoints[i].mX
|
||||
<< ", y=" << pathgrid.mPoints[i].mY
|
||||
<< ", z=" << pathgrid.mPoints[i].mZ;
|
||||
messages.push_back (std::make_pair (id, pathgrid.mId + ss.str()));
|
||||
messages.add (id, pathgrid.mId + ss.str(), "", CSMDoc::Message::Severity_Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void CSMTools::ScriptCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
|
||||
void CSMTools::ScriptCheckStage::updateUserSetting (const QString& name, const QStringList& value)
|
||||
{
|
||||
if (name=="script-editor/warnings")
|
||||
if (name=="script-editor/warnings" && !value.isEmpty())
|
||||
{
|
||||
if (value.at (0)=="Ignore")
|
||||
mWarningMode = Mode_Ignore;
|
||||
|
|
|
@ -146,14 +146,19 @@ CSMTools::Tools::~Tools()
|
|||
delete iter->second;
|
||||
}
|
||||
|
||||
CSMWorld::UniversalId CSMTools::Tools::runVerifier()
|
||||
CSMWorld::UniversalId CSMTools::Tools::runVerifier (const CSMWorld::UniversalId& reportId)
|
||||
{
|
||||
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
||||
mActiveReports[CSMDoc::State_Verifying] = mNextReportNumber-1;
|
||||
int reportNumber = reportId.getType()==CSMWorld::UniversalId::Type_VerificationResults ?
|
||||
reportId.getIndex() : mNextReportNumber++;
|
||||
|
||||
if (mReports.find (reportNumber)==mReports.end())
|
||||
mReports.insert (std::make_pair (reportNumber, new ReportModel));
|
||||
|
||||
mActiveReports[CSMDoc::State_Verifying] = reportNumber;
|
||||
|
||||
getVerifier()->start();
|
||||
|
||||
return CSMWorld::UniversalId (CSMWorld::UniversalId::Type_VerificationResults, mNextReportNumber-1);
|
||||
return CSMWorld::UniversalId (CSMWorld::UniversalId::Type_VerificationResults, reportNumber);
|
||||
}
|
||||
|
||||
CSMWorld::UniversalId CSMTools::Tools::newSearch()
|
||||
|
|
|
@ -57,8 +57,11 @@ namespace CSMTools
|
|||
|
||||
virtual ~Tools();
|
||||
|
||||
CSMWorld::UniversalId runVerifier();
|
||||
///< \return ID of the report for this verification run
|
||||
/// \param reportId If a valid VerificationResults ID, run verifier for the
|
||||
/// specified report instead of creating a new one.
|
||||
///
|
||||
/// \return ID of the report for this verification run
|
||||
CSMWorld::UniversalId runVerifier (const CSMWorld::UniversalId& reportId = CSMWorld::UniversalId());
|
||||
|
||||
/// Return ID of the report for this search.
|
||||
CSMWorld::UniversalId newSearch();
|
||||
|
|
|
@ -4,12 +4,23 @@
|
|||
#include "reporttable.hpp"
|
||||
|
||||
CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||
: CSVDoc::SubView (id)
|
||||
: CSVDoc::SubView (id), mDocument (document), mRefreshState (0)
|
||||
{
|
||||
setWidget (mTable = new ReportTable (document, id, false, this));
|
||||
if (id.getType()==CSMWorld::UniversalId::Type_VerificationResults)
|
||||
mRefreshState = CSMDoc::State_Verifying;
|
||||
|
||||
setWidget (mTable = new ReportTable (document, id, false, mRefreshState, this));
|
||||
|
||||
connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)),
|
||||
SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)));
|
||||
|
||||
if (mRefreshState==CSMDoc::State_Verifying)
|
||||
{
|
||||
connect (mTable, SIGNAL (refreshRequest()), this, SLOT (refreshRequest()));
|
||||
|
||||
connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)),
|
||||
mTable, SLOT (stateChanged (int, CSMDoc::Document *)));
|
||||
}
|
||||
}
|
||||
|
||||
void CSVTools::ReportSubView::setEditLock (bool locked)
|
||||
|
@ -21,3 +32,15 @@ void CSVTools::ReportSubView::updateUserSetting (const QString &name, const QStr
|
|||
{
|
||||
mTable->updateUserSetting (name, list);
|
||||
}
|
||||
|
||||
void CSVTools::ReportSubView::refreshRequest()
|
||||
{
|
||||
if (!(mDocument.getState() & mRefreshState))
|
||||
{
|
||||
if (mRefreshState==CSMDoc::State_Verifying)
|
||||
{
|
||||
mTable->clear();
|
||||
mDocument.verify (getUniversalId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace CSVTools
|
|||
Q_OBJECT
|
||||
|
||||
ReportTable *mTable;
|
||||
CSMDoc::Document& mDocument;
|
||||
int mRefreshState;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -28,6 +30,10 @@ namespace CSVTools
|
|||
virtual void setEditLock (bool locked);
|
||||
|
||||
virtual void updateUserSetting (const QString &, const QStringList &);
|
||||
|
||||
private slots:
|
||||
|
||||
void refreshRequest();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,10 @@ void CSVTools::ReportTable::contextMenuEvent (QContextMenuEvent *event)
|
|||
|
||||
if (found)
|
||||
menu.addAction (mReplaceAction);
|
||||
|
||||
}
|
||||
|
||||
if (mRefreshAction)
|
||||
menu.addAction (mRefreshAction);
|
||||
|
||||
menu.exec (event->globalPos());
|
||||
}
|
||||
|
@ -134,8 +136,10 @@ void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
|
|||
}
|
||||
|
||||
CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
||||
const CSMWorld::UniversalId& id, bool richTextDescription, QWidget *parent)
|
||||
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id))
|
||||
const CSMWorld::UniversalId& id, bool richTextDescription, int refreshState,
|
||||
QWidget *parent)
|
||||
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id)),
|
||||
mRefreshAction (0), mRefreshState (refreshState)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||
|
@ -171,6 +175,14 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
|||
connect (mReplaceAction, SIGNAL (triggered()), this, SIGNAL (replaceRequest()));
|
||||
addAction (mReplaceAction);
|
||||
|
||||
if (mRefreshState)
|
||||
{
|
||||
mRefreshAction = new QAction (tr ("Refresh"), this);
|
||||
mRefreshAction->setEnabled (!(mDocument.getState() & mRefreshState));
|
||||
connect (mRefreshAction, SIGNAL (triggered()), this, SIGNAL (refreshRequest()));
|
||||
addAction (mRefreshAction);
|
||||
}
|
||||
|
||||
mDoubleClickActions.insert (std::make_pair (Qt::NoModifier, Action_Edit));
|
||||
mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_Remove));
|
||||
mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_EditAndRemove));
|
||||
|
@ -287,3 +299,9 @@ void CSVTools::ReportTable::clear()
|
|||
{
|
||||
mModel->clear();
|
||||
}
|
||||
|
||||
void CSVTools::ReportTable::stateChanged (int state, CSMDoc::Document *document)
|
||||
{
|
||||
if (mRefreshAction)
|
||||
mRefreshAction->setEnabled (!(state & mRefreshState));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ namespace CSVTools
|
|||
QAction *mShowAction;
|
||||
QAction *mRemoveAction;
|
||||
QAction *mReplaceAction;
|
||||
QAction *mRefreshAction;
|
||||
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
||||
int mRefreshState;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -49,8 +51,11 @@ namespace CSVTools
|
|||
public:
|
||||
|
||||
/// \param richTextDescription Use rich text in the description column.
|
||||
/// \param refreshState Document state to check for refresh function. If value is
|
||||
/// 0 no refresh function exists. If the document current has the specified state
|
||||
/// the refresh function is disabled.
|
||||
ReportTable (CSMDoc::Document& document, const CSMWorld::UniversalId& id,
|
||||
bool richTextDescription, QWidget *parent = 0);
|
||||
bool richTextDescription, int refreshState = 0, QWidget *parent = 0);
|
||||
|
||||
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
||||
|
||||
|
@ -71,11 +76,17 @@ namespace CSVTools
|
|||
|
||||
void removeSelection();
|
||||
|
||||
public slots:
|
||||
|
||||
void stateChanged (int state, CSMDoc::Document *document);
|
||||
|
||||
signals:
|
||||
|
||||
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
||||
|
||||
void replaceRequest();
|
||||
|
||||
void refreshRequest();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue