mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
moved code for initiating record cloning from DialogueSubView to RecordButtonBar
This commit is contained in:
parent
7f1129df3b
commit
6769479358
6 changed files with 46 additions and 18 deletions
|
@ -45,6 +45,7 @@ void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id)
|
||||||
{
|
{
|
||||||
mUniversalId = id;
|
mUniversalId = id;
|
||||||
setWindowTitle (QString::fromUtf8(mUniversalId.toString().c_str()));
|
setWindowTitle (QString::fromUtf8(mUniversalId.toString().c_str()));
|
||||||
|
emit universalIdChanged (mUniversalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace CSVDoc
|
||||||
|
|
||||||
void updateSubViewIndicies (SubView *view = 0);
|
void updateSubViewIndicies (SubView *view = 0);
|
||||||
|
|
||||||
|
void universalIdChanged (const CSMWorld::UniversalId& universalId);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
|
|
@ -714,7 +714,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
|
||||||
this, SLOT (requestFocus (const std::string&)));
|
this, SLOT (requestFocus (const std::string&)));
|
||||||
|
|
||||||
// button bar
|
// button bar
|
||||||
RecordButtonBar *buttons = new RecordButtonBar (getTable(), mBottom,
|
RecordButtonBar *buttons = new RecordButtonBar (id, getTable(), mBottom,
|
||||||
&getCommandDispatcher(), this);
|
&getCommandDispatcher(), this);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
|
@ -724,16 +724,10 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
|
||||||
// connections
|
// connections
|
||||||
connect (buttons, SIGNAL (nextId()), this, SLOT (nextId()));
|
connect (buttons, SIGNAL (nextId()), this, SLOT (nextId()));
|
||||||
connect (buttons, SIGNAL (prevId()), this, SLOT (prevId()));
|
connect (buttons, SIGNAL (prevId()), this, SLOT (prevId()));
|
||||||
connect (buttons, SIGNAL (cloneRequest()), this, SLOT (cloneRequest()));
|
|
||||||
connect (buttons, SIGNAL (showPreview()), this, SLOT (showPreview()));
|
connect (buttons, SIGNAL (showPreview()), this, SLOT (showPreview()));
|
||||||
connect (buttons, SIGNAL (viewRecord()), this, SLOT (viewRecord()));
|
connect (buttons, SIGNAL (viewRecord()), this, SLOT (viewRecord()));
|
||||||
}
|
connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)),
|
||||||
|
buttons, SLOT (universalIdChanged (const CSMWorld::UniversalId&)));
|
||||||
void CSVWorld::DialogueSubView::cloneRequest()
|
|
||||||
{
|
|
||||||
mBottom->cloneRequest (getCurrentId(),
|
|
||||||
static_cast<CSMWorld::UniversalId::Type> (getTable().
|
|
||||||
data (getTable().getModelIndex(getCurrentId(), 2)).toInt()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::prevId()
|
void CSVWorld::DialogueSubView::prevId()
|
||||||
|
|
|
@ -231,8 +231,6 @@ namespace CSVWorld
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void cloneRequest();
|
|
||||||
|
|
||||||
void nextId();
|
void nextId();
|
||||||
|
|
||||||
void prevId();
|
void prevId();
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
|
|
||||||
#include "../world/tablebottombox.hpp"
|
#include "../world/tablebottombox.hpp"
|
||||||
|
|
||||||
CSVWorld::RecordButtonBar::RecordButtonBar (CSMWorld::IdTable& table, TableBottomBox *bottomBox,
|
CSVWorld::RecordButtonBar::RecordButtonBar (const CSMWorld::UniversalId& id,
|
||||||
|
CSMWorld::IdTable& table, TableBottomBox *bottomBox,
|
||||||
CSMWorld::CommandDispatcher *commandDispatcher, QWidget *parent)
|
CSMWorld::CommandDispatcher *commandDispatcher, QWidget *parent)
|
||||||
: QWidget (parent), mTable (table), mBottom (bottomBox), mCommandDispatcher (commandDispatcher)
|
: QWidget (parent), mId (id), mTable (table), mBottom (bottomBox),
|
||||||
|
mCommandDispatcher (commandDispatcher)
|
||||||
{
|
{
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
||||||
buttonsLayout->setContentsMargins (0, 0, 0, 0);
|
buttonsLayout->setContentsMargins (0, 0, 0, 0);
|
||||||
|
@ -81,7 +83,7 @@ CSVWorld::RecordButtonBar::RecordButtonBar (CSMWorld::IdTable& table, TableBotto
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connect (addButton, SIGNAL (clicked()), mBottom, SLOT (createRequest()));
|
connect (addButton, SIGNAL (clicked()), mBottom, SLOT (createRequest()));
|
||||||
connect (cloneButton, SIGNAL (clicked()), this, SIGNAL (cloneRequest()));
|
connect (cloneButton, SIGNAL (clicked()), this, SLOT (cloneRequest()));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect (nextButton, SIGNAL (clicked()), this, SIGNAL (nextId()));
|
connect (nextButton, SIGNAL (clicked()), this, SIGNAL (nextId()));
|
||||||
|
@ -98,3 +100,25 @@ CSVWorld::RecordButtonBar::RecordButtonBar (CSMWorld::IdTable& table, TableBotto
|
||||||
connect (deleteButton, SIGNAL (clicked()), mCommandDispatcher, SLOT (executeDelete()));
|
connect (deleteButton, SIGNAL (clicked()), mCommandDispatcher, SLOT (executeDelete()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::RecordButtonBar::universalIdChanged (const CSMWorld::UniversalId& id)
|
||||||
|
{
|
||||||
|
mId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::RecordButtonBar::cloneRequest()
|
||||||
|
{
|
||||||
|
if (mBottom)
|
||||||
|
{
|
||||||
|
int typeColumn = mTable.searchColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
||||||
|
|
||||||
|
if (typeColumn!=-1)
|
||||||
|
{
|
||||||
|
QModelIndex typeIndex = mTable.getModelIndex (mId.getId(), typeColumn);
|
||||||
|
CSMWorld::UniversalId::Type type = static_cast<CSMWorld::UniversalId::Type> (
|
||||||
|
mTable.data (typeIndex).toInt());
|
||||||
|
|
||||||
|
mBottom->cloneRequest (mId.getId(), type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "../../model/world/universalid.hpp"
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class IdTable;
|
class IdTable;
|
||||||
|
@ -27,15 +29,25 @@ namespace CSVWorld
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
CSMWorld::UniversalId mId;
|
||||||
CSMWorld::IdTable& mTable;
|
CSMWorld::IdTable& mTable;
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RecordButtonBar (CSMWorld::IdTable& table, TableBottomBox *bottomBox = 0,
|
RecordButtonBar (const CSMWorld::UniversalId& id,
|
||||||
|
CSMWorld::IdTable& table, TableBottomBox *bottomBox = 0,
|
||||||
CSMWorld::CommandDispatcher *commandDispatcher = 0, QWidget *parent = 0);
|
CSMWorld::CommandDispatcher *commandDispatcher = 0, QWidget *parent = 0);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void universalIdChanged (const CSMWorld::UniversalId& id);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void cloneRequest();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void showPreview();
|
void showPreview();
|
||||||
|
@ -45,9 +57,6 @@ namespace CSVWorld
|
||||||
void nextId();
|
void nextId();
|
||||||
|
|
||||||
void prevId();
|
void prevId();
|
||||||
|
|
||||||
void cloneRequest();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue