2012-11-24 12:17:21 +00:00
|
|
|
#include "subview.hpp"
|
|
|
|
|
2015-05-17 12:31:53 +00:00
|
|
|
#include <QEvent>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <apps/opencs/model/world/universalid.hpp>
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
bool CSVDoc::SubView::event(QEvent* event)
|
2015-05-17 12:31:53 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
if (event->type() == QEvent::ShortcutOverride)
|
2015-05-17 12:31:53 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
2015-05-17 12:31:53 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
if (keyEvent->key() == Qt::Key_W && keyEvent->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier))
|
2015-05-17 12:31:53 +00:00
|
|
|
emit closeRequest();
|
2022-09-22 18:26:05 +00:00
|
|
|
return true;
|
2015-05-17 12:31:53 +00:00
|
|
|
}
|
2015-12-15 09:40:00 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
return QDockWidget::event(event);
|
2015-05-17 12:31:53 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
CSVDoc::SubView::SubView(const CSMWorld::UniversalId& id)
|
|
|
|
: mUniversalId(id)
|
2012-11-24 12:17:21 +00:00
|
|
|
{
|
|
|
|
/// \todo add a button to the title bar that clones this sub view
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
|
2014-09-12 14:45:21 +00:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2012-11-24 12:17:21 +00:00
|
|
|
}
|
|
|
|
|
2012-12-11 12:22:43 +00:00
|
|
|
CSMWorld::UniversalId CSVDoc::SubView::getUniversalId() const
|
2012-11-24 12:17:21 +00:00
|
|
|
{
|
|
|
|
return mUniversalId;
|
|
|
|
}
|
2013-06-15 11:40:18 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSVDoc::SubView::setStatusBar(bool show) {}
|
2014-03-02 12:29:02 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSVDoc::SubView::useHint(const std::string& hint) {}
|
2014-03-12 12:04:40 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSVDoc::SubView::setUniversalId(const CSMWorld::UniversalId& id)
|
2014-03-12 12:04:40 +00:00
|
|
|
{
|
|
|
|
mUniversalId = id;
|
2022-09-22 18:26:05 +00:00
|
|
|
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
|
|
|
|
emit universalIdChanged(mUniversalId);
|
2014-04-23 03:19:53 +00:00
|
|
|
}
|
2014-09-23 07:01:08 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSVDoc::SubView::closeEvent(QCloseEvent* event)
|
2014-09-23 07:01:08 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
emit updateSubViewIndices(this);
|
2014-09-23 07:01:08 +00:00
|
|
|
}
|
2014-10-25 16:13:56 +00:00
|
|
|
|
2014-10-27 07:57:18 +00:00
|
|
|
std::string CSVDoc::SubView::getTitle() const
|
|
|
|
{
|
|
|
|
return mUniversalId.toString();
|
|
|
|
}
|
|
|
|
|
2014-10-25 16:13:56 +00:00
|
|
|
void CSVDoc::SubView::closeRequest()
|
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
emit closeRequest(this);
|
2014-10-31 10:50:57 +00:00
|
|
|
}
|