From ea9b6fa37e265ac7b896f204f42fa321f962b14f Mon Sep 17 00:00:00 2001 From: Marek Kochanowicz Date: Wed, 19 Mar 2014 12:01:36 +0100 Subject: [PATCH] view button --- apps/opencs/view/world/dialoguesubview.cpp | 30 ++++++++++++++++++---- apps/opencs/view/world/dialoguesubview.hpp | 2 ++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 9f86a8ce3..53e53e0e6 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -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 params = mTable->view (mRow); + + if (params.first.getType()!=CSMWorld::UniversalId::Type_None) + emit focusId (params.first, params.second); + } } \ No newline at end of file diff --git a/apps/opencs/view/world/dialoguesubview.hpp b/apps/opencs/view/world/dialoguesubview.hpp index 8a96e3ec0..5642f46a0 100644 --- a/apps/opencs/view/world/dialoguesubview.hpp +++ b/apps/opencs/view/world/dialoguesubview.hpp @@ -187,6 +187,8 @@ namespace CSVWorld void showPreview(); + void viewRecord(); + void revertRecord(); void deleteRecord();