view button

actorid
Marek Kochanowicz 11 years ago
parent 8f3103ce65
commit ea9b6fa37e

@ -405,21 +405,30 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
buttonsLayout->addWidget(nextButton, 1);
buttonsLayout->addStretch(2);
QToolButton* previewButton = new QToolButton(mainWidget);
QToolButton* cloneButton = new QToolButton(mainWidget);
QToolButton* addButton = new QToolButton(mainWidget);
QToolButton* deleteButton = new QToolButton(mainWidget);
QToolButton* revertButton = new QToolButton(mainWidget);
previewButton->setEnabled(mTable->hasPreview());
if (mTable->hasPreview())
{
QToolButton* previewButton = new QToolButton(mainWidget);
buttonsLayout->addWidget(previewButton);
connect(previewButton, SIGNAL(clicked()), this, SLOT(showPreview()));
}
if (mTable->getViewing()!=CSMWorld::IdTable::Viewing_None)
{
QToolButton* viewButton = new QToolButton(mainWidget);
buttonsLayout->addWidget(viewButton);
connect(viewButton, SIGNAL(clicked()), this, SLOT(viewRecord()));
}
buttonsLayout->addWidget(previewButton);
buttonsLayout->addWidget(cloneButton);
buttonsLayout->addWidget(addButton);
buttonsLayout->addWidget(deleteButton);
buttonsLayout->addWidget(revertButton);
connect(previewButton, SIGNAL(clicked()), this, SLOT(showPreview()));
connect(nextButton, SIGNAL(clicked()), this, SLOT(nextId()));
connect(prevButton, SIGNAL(clicked()), this, SLOT(prevId()));
connect(cloneButton, SIGNAL(clicked()), this, SLOT(cloneRequest()));
@ -624,8 +633,19 @@ void CSVWorld::DialogueSubView::cloneRequest ()
void CSVWorld::DialogueSubView::showPreview ()
{
if (mTable->hasPreview())
if (mTable->hasPreview() && mRow < mTable->rowCount())
{
emit focusId(CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Preview, mTable->data(mTable->index (mRow, 0)).toString().toStdString()), "");
}
}
void CSVWorld::DialogueSubView::viewRecord()
{
if (mRow < mTable->rowCount())
{
std::pair<CSMWorld::UniversalId, std::string> params = mTable->view (mRow);
if (params.first.getType()!=CSMWorld::UniversalId::Type_None)
emit focusId (params.first, params.second);
}
}

@ -187,6 +187,8 @@ namespace CSVWorld
void showPreview();
void viewRecord();
void revertRecord();
void deleteRecord();

Loading…
Cancel
Save