mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 15:45:33 +00:00
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);
|
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);
|
emit stateChanged (getState(), this);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
CSMWorld::UniversalId verify();
|
CSMWorld::UniversalId verify (const CSMWorld::UniversalId& reportId = CSMWorld::UniversalId());
|
||||||
|
|
||||||
CSMWorld::UniversalId newSearch();
|
CSMWorld::UniversalId newSearch();
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
|
|
||||||
// check the number of pathgrid points
|
// check the number of pathgrid points
|
||||||
if (pathgrid.mData.mS2 > static_cast<int>(pathgrid.mPoints.size()))
|
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()))
|
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<CSMTools::Point> pointList(pathgrid.mPoints.size());
|
||||||
std::vector<int> duplList;
|
std::vector<int> duplList;
|
||||||
|
@ -51,7 +51,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "has a duplicate edge between points" << pathgrid.mEdges[i].mV0
|
ss << "has a duplicate edge between points" << pathgrid.mEdges[i].mV0
|
||||||
<< " and " << pathgrid.mEdges[i].mV1;
|
<< " 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << " has an edge connecting a non-existent point " << pathgrid.mEdges[i].mV0;
|
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;
|
std::ostringstream ss;
|
||||||
ss << " has has less edges than expected for point " << i;
|
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)
|
else if (pathgrid.mPoints[i].mConnectionNum < pointList[i].mConnectionNum)
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << " has has more edges than expected for point " << i;
|
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
|
// check that edges are bidirectional
|
||||||
|
@ -101,7 +101,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << " has a missing edge between points " << i << " and " << pointList[i].mOtherIndex[j];
|
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
|
<< ") x=" << pathgrid.mPoints[i].mX
|
||||||
<< ", y=" << pathgrid.mPoints[i].mY
|
<< ", y=" << pathgrid.mPoints[i].mY
|
||||||
<< ", z=" << pathgrid.mPoints[i].mZ;
|
<< ", 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);
|
duplList.push_back(i);
|
||||||
break;
|
break;
|
||||||
|
@ -143,7 +143,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
<< ") x=" << pathgrid.mPoints[i].mX
|
<< ") x=" << pathgrid.mPoints[i].mX
|
||||||
<< ", y=" << pathgrid.mPoints[i].mY
|
<< ", y=" << pathgrid.mPoints[i].mY
|
||||||
<< ", z=" << pathgrid.mPoints[i].mZ;
|
<< ", 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)
|
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")
|
if (value.at (0)=="Ignore")
|
||||||
mWarningMode = Mode_Ignore;
|
mWarningMode = Mode_Ignore;
|
||||||
|
|
|
@ -146,14 +146,19 @@ CSMTools::Tools::~Tools()
|
||||||
delete iter->second;
|
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));
|
int reportNumber = reportId.getType()==CSMWorld::UniversalId::Type_VerificationResults ?
|
||||||
mActiveReports[CSMDoc::State_Verifying] = mNextReportNumber-1;
|
reportId.getIndex() : mNextReportNumber++;
|
||||||
|
|
||||||
|
if (mReports.find (reportNumber)==mReports.end())
|
||||||
|
mReports.insert (std::make_pair (reportNumber, new ReportModel));
|
||||||
|
|
||||||
|
mActiveReports[CSMDoc::State_Verifying] = reportNumber;
|
||||||
|
|
||||||
getVerifier()->start();
|
getVerifier()->start();
|
||||||
|
|
||||||
return CSMWorld::UniversalId (CSMWorld::UniversalId::Type_VerificationResults, mNextReportNumber-1);
|
return CSMWorld::UniversalId (CSMWorld::UniversalId::Type_VerificationResults, reportNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::UniversalId CSMTools::Tools::newSearch()
|
CSMWorld::UniversalId CSMTools::Tools::newSearch()
|
||||||
|
|
|
@ -57,8 +57,11 @@ namespace CSMTools
|
||||||
|
|
||||||
virtual ~Tools();
|
virtual ~Tools();
|
||||||
|
|
||||||
CSMWorld::UniversalId runVerifier();
|
/// \param reportId If a valid VerificationResults ID, run verifier for the
|
||||||
///< \return ID of the report for this verification run
|
/// 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.
|
/// Return ID of the report for this search.
|
||||||
CSMWorld::UniversalId newSearch();
|
CSMWorld::UniversalId newSearch();
|
||||||
|
|
|
@ -4,12 +4,23 @@
|
||||||
#include "reporttable.hpp"
|
#include "reporttable.hpp"
|
||||||
|
|
||||||
CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
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&)),
|
connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)),
|
||||||
SIGNAL (focusId (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)
|
void CSVTools::ReportSubView::setEditLock (bool locked)
|
||||||
|
@ -21,3 +32,15 @@ void CSVTools::ReportSubView::updateUserSetting (const QString &name, const QStr
|
||||||
{
|
{
|
||||||
mTable->updateUserSetting (name, list);
|
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
|
Q_OBJECT
|
||||||
|
|
||||||
ReportTable *mTable;
|
ReportTable *mTable;
|
||||||
|
CSMDoc::Document& mDocument;
|
||||||
|
int mRefreshState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -28,6 +30,10 @@ namespace CSVTools
|
||||||
virtual void setEditLock (bool locked);
|
virtual void setEditLock (bool locked);
|
||||||
|
|
||||||
virtual void updateUserSetting (const QString &, const QStringList &);
|
virtual void updateUserSetting (const QString &, const QStringList &);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void refreshRequest();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,10 @@ void CSVTools::ReportTable::contextMenuEvent (QContextMenuEvent *event)
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
menu.addAction (mReplaceAction);
|
menu.addAction (mReplaceAction);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mRefreshAction)
|
||||||
|
menu.addAction (mRefreshAction);
|
||||||
|
|
||||||
menu.exec (event->globalPos());
|
menu.exec (event->globalPos());
|
||||||
}
|
}
|
||||||
|
@ -134,8 +136,10 @@ void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
||||||
const CSMWorld::UniversalId& id, bool richTextDescription, QWidget *parent)
|
const CSMWorld::UniversalId& id, bool richTextDescription, int refreshState,
|
||||||
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id))
|
QWidget *parent)
|
||||||
|
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id)),
|
||||||
|
mRefreshAction (0), mRefreshState (refreshState)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||||
|
@ -171,6 +175,14 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
||||||
connect (mReplaceAction, SIGNAL (triggered()), this, SIGNAL (replaceRequest()));
|
connect (mReplaceAction, SIGNAL (triggered()), this, SIGNAL (replaceRequest()));
|
||||||
addAction (mReplaceAction);
|
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::NoModifier, Action_Edit));
|
||||||
mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_Remove));
|
mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_Remove));
|
||||||
mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_EditAndRemove));
|
mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_EditAndRemove));
|
||||||
|
@ -287,3 +299,9 @@ void CSVTools::ReportTable::clear()
|
||||||
{
|
{
|
||||||
mModel->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 *mShowAction;
|
||||||
QAction *mRemoveAction;
|
QAction *mRemoveAction;
|
||||||
QAction *mReplaceAction;
|
QAction *mReplaceAction;
|
||||||
|
QAction *mRefreshAction;
|
||||||
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
||||||
|
int mRefreshState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -49,8 +51,11 @@ namespace CSVTools
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \param richTextDescription Use rich text in the description column.
|
/// \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,
|
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;
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
||||||
|
|
||||||
|
@ -71,11 +76,17 @@ namespace CSVTools
|
||||||
|
|
||||||
void removeSelection();
|
void removeSelection();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void stateChanged (int state, CSMDoc::Document *document);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
||||||
|
|
||||||
void replaceRequest();
|
void replaceRequest();
|
||||||
|
|
||||||
|
void refreshRequest();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue