mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +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;
|
||||
setWindowTitle (QString::fromUtf8(mUniversalId.toString().c_str()));
|
||||
emit universalIdChanged (mUniversalId);
|
||||
}
|
||||
|
||||
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace CSVDoc
|
|||
|
||||
void updateSubViewIndicies (SubView *view = 0);
|
||||
|
||||
void universalIdChanged (const CSMWorld::UniversalId& universalId);
|
||||
|
||||
protected slots:
|
||||
|
||||
void closeRequest();
|
||||
|
|
|
@ -714,7 +714,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
|
|||
this, SLOT (requestFocus (const std::string&)));
|
||||
|
||||
// button bar
|
||||
RecordButtonBar *buttons = new RecordButtonBar (getTable(), mBottom,
|
||||
RecordButtonBar *buttons = new RecordButtonBar (id, getTable(), mBottom,
|
||||
&getCommandDispatcher(), this);
|
||||
|
||||
// layout
|
||||
|
@ -724,16 +724,10 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
|
|||
// connections
|
||||
connect (buttons, SIGNAL (nextId()), this, SLOT (nextId()));
|
||||
connect (buttons, SIGNAL (prevId()), this, SLOT (prevId()));
|
||||
connect (buttons, SIGNAL (cloneRequest()), this, SLOT (cloneRequest()));
|
||||
connect (buttons, SIGNAL (showPreview()), this, SLOT (showPreview()));
|
||||
connect (buttons, SIGNAL (viewRecord()), this, SLOT (viewRecord()));
|
||||
}
|
||||
|
||||
void CSVWorld::DialogueSubView::cloneRequest()
|
||||
{
|
||||
mBottom->cloneRequest (getCurrentId(),
|
||||
static_cast<CSMWorld::UniversalId::Type> (getTable().
|
||||
data (getTable().getModelIndex(getCurrentId(), 2)).toInt()));
|
||||
connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)),
|
||||
buttons, SLOT (universalIdChanged (const CSMWorld::UniversalId&)));
|
||||
}
|
||||
|
||||
void CSVWorld::DialogueSubView::prevId()
|
||||
|
|
|
@ -231,8 +231,6 @@ namespace CSVWorld
|
|||
|
||||
private slots:
|
||||
|
||||
void cloneRequest();
|
||||
|
||||
void nextId();
|
||||
|
||||
void prevId();
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
|
||||
#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)
|
||||
: QWidget (parent), mTable (table), mBottom (bottomBox), mCommandDispatcher (commandDispatcher)
|
||||
: QWidget (parent), mId (id), mTable (table), mBottom (bottomBox),
|
||||
mCommandDispatcher (commandDispatcher)
|
||||
{
|
||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
||||
buttonsLayout->setContentsMargins (0, 0, 0, 0);
|
||||
|
@ -81,7 +83,7 @@ CSVWorld::RecordButtonBar::RecordButtonBar (CSMWorld::IdTable& table, TableBotto
|
|||
else
|
||||
{
|
||||
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()));
|
||||
|
@ -98,3 +100,25 @@ CSVWorld::RecordButtonBar::RecordButtonBar (CSMWorld::IdTable& table, TableBotto
|
|||
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 "../../model/world/universalid.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class IdTable;
|
||||
|
@ -27,15 +29,25 @@ namespace CSVWorld
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
CSMWorld::UniversalId mId;
|
||||
CSMWorld::IdTable& mTable;
|
||||
TableBottomBox *mBottom;
|
||||
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
||||
|
||||
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);
|
||||
|
||||
public slots:
|
||||
|
||||
void universalIdChanged (const CSMWorld::UniversalId& id);
|
||||
|
||||
private slots:
|
||||
|
||||
void cloneRequest();
|
||||
|
||||
signals:
|
||||
|
||||
void showPreview();
|
||||
|
@ -45,9 +57,6 @@ namespace CSVWorld
|
|||
void nextId();
|
||||
|
||||
void prevId();
|
||||
|
||||
void cloneRequest();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue