mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
display load error messages in loading window
This commit is contained in:
parent
aadaf7827d
commit
95d24492de
7 changed files with 39 additions and 0 deletions
|
@ -35,6 +35,8 @@ CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& con
|
|||
this, SIGNAL (nextRecord (CSMDoc::Document *)));
|
||||
connect (this, SIGNAL (cancelLoading (CSMDoc::Document *)),
|
||||
&mLoader, SLOT (abortLoading (CSMDoc::Document *)));
|
||||
connect (&mLoader, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&)),
|
||||
this, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&)));
|
||||
}
|
||||
|
||||
CSMDoc::DocumentManager::~DocumentManager()
|
||||
|
|
|
@ -79,6 +79,8 @@ namespace CSMDoc
|
|||
void nextRecord (CSMDoc::Document *document);
|
||||
|
||||
void cancelLoading (CSMDoc::Document *document);
|
||||
|
||||
void loadMessage (CSMDoc::Document *document, const std::string& message);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,10 @@ void CSMDoc::Loader::load()
|
|||
|
||||
for (CSMDoc::Stage::Messages::const_iterator iter (messages.begin());
|
||||
iter!=messages.end(); ++iter)
|
||||
{
|
||||
document->getReport (log)->add (iter->first, iter->second);
|
||||
emit loadMessage (document, iter->second);
|
||||
}
|
||||
|
||||
emit nextRecord (document);
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ namespace CSMDoc
|
|||
///< \note This signal is only given once per group of records. The group size is
|
||||
/// approximately the total number of records divided by the steps value of the
|
||||
/// previous nextStage signal.
|
||||
|
||||
void loadMessage (CSMDoc::Document *document, const std::string& message);
|
||||
///< Non-critical load error or warning
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <QCursor>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
||||
|
@ -58,6 +59,11 @@ CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document)
|
|||
|
||||
layout->addWidget (mError);
|
||||
|
||||
// other messages
|
||||
mMessages = new QListWidget (this);
|
||||
|
||||
layout->addWidget (mMessages);
|
||||
|
||||
// buttons
|
||||
mButtons = new QDialogButtonBox (QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
|
||||
|
@ -97,6 +103,11 @@ void CSVDoc::LoadingDocument::abort (const std::string& error)
|
|||
mButtons->setStandardButtons (QDialogButtonBox::Close);
|
||||
}
|
||||
|
||||
void CSVDoc::LoadingDocument::addMessage (const std::string& message)
|
||||
{
|
||||
new QListWidgetItem (QString::fromUtf8 (message.c_str()), mMessages);
|
||||
}
|
||||
|
||||
void CSVDoc::LoadingDocument::cancel()
|
||||
{
|
||||
if (!mAborted)
|
||||
|
@ -169,3 +180,11 @@ void CSVDoc::Loader::nextRecord (CSMDoc::Document *document)
|
|||
if (iter!=mDocuments.end())
|
||||
iter->second->nextRecord();
|
||||
}
|
||||
|
||||
void CSVDoc::Loader::loadMessage (CSMDoc::Document *document, const std::string& message)
|
||||
{
|
||||
std::map<CSMDoc::Document *, LoadingDocument *>::iterator iter = mDocuments.find (document);
|
||||
|
||||
if (iter!=mDocuments.end())
|
||||
iter->second->addMessage (message);
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
class QLabel;
|
||||
class QProgressBar;
|
||||
class QDialogButtonBox;
|
||||
class QListWidget;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ namespace CSVDoc
|
|||
bool mAborted;
|
||||
QDialogButtonBox *mButtons;
|
||||
QLabel *mError;
|
||||
QListWidget *mMessages;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -44,6 +46,8 @@ namespace CSVDoc
|
|||
|
||||
void abort (const std::string& error);
|
||||
|
||||
void addMessage (const std::string& message);
|
||||
|
||||
private slots:
|
||||
|
||||
void cancel();
|
||||
|
@ -85,6 +89,8 @@ namespace CSVDoc
|
|||
void nextStage (CSMDoc::Document *document, const std::string& name, int steps);
|
||||
|
||||
void nextRecord (CSMDoc::Document *document);
|
||||
|
||||
void loadMessage (CSMDoc::Document *document, const std::string& message);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,10 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
&mDocumentManager, SIGNAL (nextRecord (CSMDoc::Document *)),
|
||||
&mLoader, SLOT (nextRecord (CSMDoc::Document *)));
|
||||
|
||||
connect (
|
||||
&mDocumentManager, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&)),
|
||||
&mLoader, SLOT (loadMessage (CSMDoc::Document *, const std::string&)));
|
||||
|
||||
connect (
|
||||
&mLoader, SIGNAL (cancel (CSMDoc::Document *)),
|
||||
&mDocumentManager, SIGNAL (cancelLoading (CSMDoc::Document *)));
|
||||
|
|
Loading…
Reference in a new issue