mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-04 17:45:34 +00:00
replaced redundant CSMTools::ReportModel::Line struct with CSMDoc::Message struct
This commit is contained in:
parent
9a102f81c8
commit
0e21c61297
4 changed files with 24 additions and 30 deletions
|
@ -1,15 +1,16 @@
|
||||||
|
|
||||||
#include "messages.hpp"
|
#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,
|
void CSMDoc::Messages::add (const CSMWorld::UniversalId& id, const std::string& message,
|
||||||
const std::string& hint)
|
const std::string& hint)
|
||||||
{
|
{
|
||||||
Message data;
|
mMessages.push_back (Message (id, message, hint));
|
||||||
data.mId = id;
|
|
||||||
data.mMessage = message;
|
|
||||||
data.mHint = hint;
|
|
||||||
|
|
||||||
mMessages.push_back (data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Messages::push_back (const std::pair<CSMWorld::UniversalId, std::string>& data)
|
void CSMDoc::Messages::push_back (const std::pair<CSMWorld::UniversalId, std::string>& data)
|
||||||
|
|
|
@ -8,16 +8,22 @@
|
||||||
|
|
||||||
namespace CSMDoc
|
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
|
class Messages
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct Message
|
// \deprecated Use CSMDoc::Message directly instead.
|
||||||
{
|
typedef CSMDoc::Message Message;
|
||||||
CSMWorld::UniversalId mId;
|
|
||||||
std::string mMessage;
|
|
||||||
std::string mHint;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<Message> Collection;
|
typedef std::vector<Message> Collection;
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
|
|
||||||
#include "../world/columns.hpp"
|
#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)
|
CSMTools::ReportModel::ReportModel (bool fieldColumn)
|
||||||
{
|
{
|
||||||
if (fieldColumn)
|
if (fieldColumn)
|
||||||
|
@ -137,14 +132,14 @@ void CSMTools::ReportModel::add (const CSMWorld::UniversalId& id, const std::str
|
||||||
{
|
{
|
||||||
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
|
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
|
||||||
|
|
||||||
mRows.push_back (Line (id, message, hint));
|
mRows.push_back (CSMDoc::Message (id, message, hint));
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReportModel::flagAsReplaced (int index)
|
void CSMTools::ReportModel::flagAsReplaced (int index)
|
||||||
{
|
{
|
||||||
Line& line = mRows.at (index);
|
CSMDoc::Message& line = mRows.at (index);
|
||||||
std::string hint = line.mHint;
|
std::string hint = line.mHint;
|
||||||
|
|
||||||
if (hint.empty() || hint[0]!='R')
|
if (hint.empty() || hint[0]!='R')
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
|
#include "../doc/messages.hpp"
|
||||||
|
|
||||||
#include "../world/universalid.hpp"
|
#include "../world/universalid.hpp"
|
||||||
|
|
||||||
namespace CSMTools
|
namespace CSMTools
|
||||||
|
@ -14,17 +16,7 @@ namespace CSMTools
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
struct Line
|
std::vector<CSMDoc::Messages::Message> mRows;
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
// Fixed columns
|
// Fixed columns
|
||||||
enum Columns
|
enum Columns
|
||||||
|
|
Loading…
Reference in a new issue