replaced redundant CSMTools::ReportModel::Line struct with CSMDoc::Message struct

pull/35/head
Marc Zinnschlag 10 years ago
parent 9a102f81c8
commit 0e21c61297

@ -1,15 +1,16 @@
#include "messages.hpp"
CSMDoc::Message::Message (const CSMWorld::UniversalId& id, const std::string& message,
const std::string& hint)
: mId (id), mMessage (message), mHint (hint)
{}
void CSMDoc::Messages::add (const CSMWorld::UniversalId& id, const std::string& message,
const std::string& hint)
{
Message data;
data.mId = id;
data.mMessage = message;
data.mHint = hint;
mMessages.push_back (data);
mMessages.push_back (Message (id, message, hint));
}
void CSMDoc::Messages::push_back (const std::pair<CSMWorld::UniversalId, std::string>& data)

@ -8,16 +8,22 @@
namespace CSMDoc
{
struct Message
{
CSMWorld::UniversalId mId;
std::string mMessage;
std::string mHint;
Message (const CSMWorld::UniversalId& id, const std::string& message,
const std::string& hint);
};
class Messages
{
public:
struct Message
{
CSMWorld::UniversalId mId;
std::string mMessage;
std::string mHint;
};
// \deprecated Use CSMDoc::Message directly instead.
typedef CSMDoc::Message Message;
typedef std::vector<Message> Collection;

@ -6,11 +6,6 @@
#include "../world/columns.hpp"
CSMTools::ReportModel::Line::Line (const CSMWorld::UniversalId& id, const std::string& message,
const std::string& hint)
: mId (id), mMessage (message), mHint (hint)
{}
CSMTools::ReportModel::ReportModel (bool fieldColumn)
{
if (fieldColumn)
@ -137,14 +132,14 @@ void CSMTools::ReportModel::add (const CSMWorld::UniversalId& id, const std::str
{
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
mRows.push_back (Line (id, message, hint));
mRows.push_back (CSMDoc::Message (id, message, hint));
endInsertRows();
}
void CSMTools::ReportModel::flagAsReplaced (int index)
{
Line& line = mRows.at (index);
CSMDoc::Message& line = mRows.at (index);
std::string hint = line.mHint;
if (hint.empty() || hint[0]!='R')

@ -6,6 +6,8 @@
#include <QAbstractTableModel>
#include "../doc/messages.hpp"
#include "../world/universalid.hpp"
namespace CSMTools
@ -14,17 +16,7 @@ namespace CSMTools
{
Q_OBJECT
struct Line
{
Line (const CSMWorld::UniversalId& id, const std::string& message,
const std::string& hint);
CSMWorld::UniversalId mId;
std::string mMessage;
std::string mHint;
};
std::vector<Line> mRows;
std::vector<CSMDoc::Messages::Message> mRows;
// Fixed columns
enum Columns

Loading…
Cancel
Save