forked from teamnwah/openmw-tes3coop
added load error log
This commit is contained in:
parent
6eff5ecaad
commit
aadaf7827d
10 changed files with 53 additions and 18 deletions
|
@ -3,7 +3,10 @@
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "../tools/reportmodel.hpp"
|
||||||
|
|
||||||
#include "document.hpp"
|
#include "document.hpp"
|
||||||
|
#include "state.hpp"
|
||||||
|
|
||||||
CSMDoc::Loader::Stage::Stage() : mFile (0), mRecordsLeft (false) {}
|
CSMDoc::Loader::Stage::Stage() : mFile (0), mRecordsLeft (false) {}
|
||||||
|
|
||||||
|
@ -48,13 +51,20 @@ void CSMDoc::Loader::load()
|
||||||
{
|
{
|
||||||
if (iter->second.mRecordsLeft)
|
if (iter->second.mRecordsLeft)
|
||||||
{
|
{
|
||||||
|
CSMDoc::Stage::Messages messages;
|
||||||
for (int i=0; i<batchingSize; ++i) // do not flood the system with update signals
|
for (int i=0; i<batchingSize; ++i) // do not flood the system with update signals
|
||||||
if (document->getData().continueLoading())
|
if (document->getData().continueLoading (messages))
|
||||||
{
|
{
|
||||||
iter->second.mRecordsLeft = false;
|
iter->second.mRecordsLeft = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSMWorld::UniversalId log (CSMWorld::UniversalId::Type_LoadErrorLog, 0);
|
||||||
|
|
||||||
|
for (CSMDoc::Stage::Messages::const_iterator iter (messages.begin());
|
||||||
|
iter!=messages.end(); ++iter)
|
||||||
|
document->getReport (log)->add (iter->first, iter->second);
|
||||||
|
|
||||||
emit nextRecord (document);
|
emit nextRecord (document);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,17 +3,18 @@
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
{
|
{
|
||||||
enum State
|
enum State
|
||||||
{
|
{
|
||||||
State_Modified = 1,
|
State_Modified = 1,
|
||||||
State_Locked = 2,
|
State_Locked = 2,
|
||||||
State_Operation = 4,
|
State_Operation = 4,
|
||||||
|
|
||||||
State_Saving = 8,
|
State_Saving = 8,
|
||||||
State_Verifying = 16,
|
State_Verifying = 16,
|
||||||
State_Compiling = 32, // not implemented yet
|
State_Compiling = 32, // not implemented yet
|
||||||
State_Searching = 64 // not implemented yet
|
State_Searching = 64, // not implemented yet
|
||||||
};
|
State_Loading = 128 // pseudo-state; can not be encountered in a loaded document
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -88,6 +88,9 @@ CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
||||||
|
|
||||||
CSMTools::Tools::Tools (CSMWorld::Data& data) : mData (data), mVerifier (0), mNextReportNumber (0)
|
CSMTools::Tools::Tools (CSMWorld::Data& data) : mData (data), mVerifier (0), mNextReportNumber (0)
|
||||||
{
|
{
|
||||||
|
// index 0: load error log
|
||||||
|
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
||||||
|
mActiveReports.insert (std::make_pair (CSMDoc::State_Loading, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMTools::Tools::~Tools()
|
CSMTools::Tools::~Tools()
|
||||||
|
@ -134,7 +137,8 @@ int CSMTools::Tools::getRunningOperations() const
|
||||||
|
|
||||||
CSMTools::ReportModel *CSMTools::Tools::getReport (const CSMWorld::UniversalId& id)
|
CSMTools::ReportModel *CSMTools::Tools::getReport (const CSMWorld::UniversalId& id)
|
||||||
{
|
{
|
||||||
if (id.getType()!=CSMWorld::UniversalId::Type_VerificationResults)
|
if (id.getType()!=CSMWorld::UniversalId::Type_VerificationResults &&
|
||||||
|
id.getType()!=CSMWorld::UniversalId::Type_LoadErrorLog)
|
||||||
throw std::logic_error ("invalid request for report model: " + id.toString());
|
throw std::logic_error ("invalid request for report model: " + id.toString());
|
||||||
|
|
||||||
return mReports.at (id.getIndex());
|
return mReports.at (id.getIndex());
|
||||||
|
|
|
@ -505,7 +505,7 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base
|
||||||
return mReader->getRecordCount();
|
return mReader->getRecordCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSMWorld::Data::continueLoading()
|
bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages)
|
||||||
{
|
{
|
||||||
if (!mReader)
|
if (!mReader)
|
||||||
throw std::logic_error ("can't continue loading, because no load has been started");
|
throw std::logic_error ("can't continue loading, because no load has been started");
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include "../filter/filter.hpp"
|
#include "../filter/filter.hpp"
|
||||||
|
|
||||||
|
#include "../doc/stage.hpp"
|
||||||
|
|
||||||
#include "idcollection.hpp"
|
#include "idcollection.hpp"
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
#include "cell.hpp"
|
#include "cell.hpp"
|
||||||
|
@ -185,7 +187,7 @@ namespace CSMWorld
|
||||||
///
|
///
|
||||||
///< \return estimated number of records
|
///< \return estimated number of records
|
||||||
|
|
||||||
bool continueLoading();
|
bool continueLoading (CSMDoc::Stage::Messages& messages);
|
||||||
///< \return Finished?
|
///< \return Finished?
|
||||||
|
|
||||||
bool hasId (const std::string& id) const;
|
bool hasId (const std::string& id) const;
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace
|
||||||
static const TypeData sIndexArg[] =
|
static const TypeData sIndexArg[] =
|
||||||
{
|
{
|
||||||
{ CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_VerificationResults, "Verification Results", 0 },
|
{ CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_VerificationResults, "Verification Results", 0 },
|
||||||
|
{ CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_LoadErrorLog, "Load Error Log", 0 },
|
||||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
|
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,10 +97,11 @@ namespace CSMWorld
|
||||||
Type_JournalInfos,
|
Type_JournalInfos,
|
||||||
Type_JournalInfo,
|
Type_JournalInfo,
|
||||||
Type_Scene,
|
Type_Scene,
|
||||||
Type_Preview
|
Type_Preview,
|
||||||
|
Type_LoadErrorLog
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { NumberOfTypes = Type_Scene+1 };
|
enum { NumberOfTypes = Type_LoadErrorLog+1 };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,12 @@
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
#include "../world/subviews.hpp"
|
|
||||||
#include "../tools/subviews.hpp"
|
|
||||||
#include "../../model/settings/usersettings.hpp"
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
|
#include "../world/subviews.hpp"
|
||||||
|
|
||||||
|
#include "../tools/subviews.hpp"
|
||||||
|
|
||||||
#include "viewmanager.hpp"
|
#include "viewmanager.hpp"
|
||||||
#include "operations.hpp"
|
#include "operations.hpp"
|
||||||
#include "subview.hpp"
|
#include "subview.hpp"
|
||||||
|
@ -47,6 +50,10 @@ void CSVDoc::View::setupFileMenu()
|
||||||
connect (mVerify, SIGNAL (triggered()), this, SLOT (verify()));
|
connect (mVerify, SIGNAL (triggered()), this, SLOT (verify()));
|
||||||
file->addAction (mVerify);
|
file->addAction (mVerify);
|
||||||
|
|
||||||
|
QAction *loadErrors = new QAction (tr ("Load Error Log"), this);
|
||||||
|
connect (loadErrors, SIGNAL (triggered()), this, SLOT (loadErrorLog()));
|
||||||
|
file->addAction (loadErrors);
|
||||||
|
|
||||||
QAction *close = new QAction (tr ("&Close"), this);
|
QAction *close = new QAction (tr ("&Close"), this);
|
||||||
connect (close, SIGNAL (triggered()), this, SLOT (close()));
|
connect (close, SIGNAL (triggered()), this, SLOT (close()));
|
||||||
file->addAction(close);
|
file->addAction(close);
|
||||||
|
@ -502,3 +509,8 @@ void CSVDoc::View::toggleShowStatusBar (bool show)
|
||||||
subView->setStatusBar (show);
|
subView->setStatusBar (show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::View::loadErrorLog()
|
||||||
|
{
|
||||||
|
addSubView (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_LoadErrorLog, 0));
|
||||||
|
}
|
||||||
|
|
|
@ -179,6 +179,8 @@ namespace CSVDoc
|
||||||
void addJournalInfosSubView();
|
void addJournalInfosSubView();
|
||||||
|
|
||||||
void toggleShowStatusBar (bool show);
|
void toggleShowStatusBar (bool show);
|
||||||
|
|
||||||
|
void loadErrorLog();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,6 @@ void CSVTools::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
{
|
{
|
||||||
manager.add (CSMWorld::UniversalId::Type_VerificationResults,
|
manager.add (CSMWorld::UniversalId::Type_VerificationResults,
|
||||||
new CSVDoc::SubViewFactory<ReportSubView>);
|
new CSVDoc::SubViewFactory<ReportSubView>);
|
||||||
|
manager.add (CSMWorld::UniversalId::Type_LoadErrorLog,
|
||||||
|
new CSVDoc::SubViewFactory<ReportSubView>);
|
||||||
}
|
}
|
Loading…
Reference in a new issue