2012-11-24 12:17:21 +00:00
|
|
|
#include "subview.hpp"
|
|
|
|
|
2014-09-23 07:01:08 +00:00
|
|
|
#include "view.hpp"
|
|
|
|
|
2015-05-17 12:31:53 +00:00
|
|
|
#include <QShortcut>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
|
|
|
bool CSVDoc::SubView::event (QEvent *event)
|
|
|
|
{
|
|
|
|
if (event->type()==QEvent::ShortcutOverride)
|
|
|
|
{
|
|
|
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *> (event);
|
|
|
|
|
|
|
|
if (keyEvent->key()==Qt::Key_W && keyEvent->modifiers()==(Qt::ShiftModifier | Qt::ControlModifier))
|
|
|
|
emit closeRequest();
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-15 09:40:00 +00:00
|
|
|
|
2015-05-17 12:31:53 +00:00
|
|
|
return QDockWidget::event (event);
|
|
|
|
}
|
|
|
|
|
2014-10-12 21:42:44 +00:00
|
|
|
CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id)
|
2014-10-27 08:51:55 +00:00
|
|
|
: mUniversalId (id)
|
2012-11-24 12:17:21 +00:00
|
|
|
{
|
|
|
|
/// \todo add a button to the title bar that clones this sub view
|
|
|
|
|
2014-03-21 10:56:48 +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
|
|
|
|
2014-03-02 12:29:02 +00:00
|
|
|
void CSVDoc::SubView::setStatusBar (bool show) {}
|
|
|
|
|
2014-03-12 12:04:40 +00:00
|
|
|
void CSVDoc::SubView::useHint (const std::string& hint) {}
|
|
|
|
|
|
|
|
void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id)
|
|
|
|
{
|
|
|
|
mUniversalId = id;
|
2015-03-16 14:45:41 +00:00
|
|
|
setWindowTitle (QString::fromUtf8(mUniversalId.toString().c_str()));
|
2015-06-27 11:47:07 +00:00
|
|
|
emit universalIdChanged (mUniversalId);
|
2014-04-23 03:19:53 +00:00
|
|
|
}
|
2014-09-23 07:01:08 +00:00
|
|
|
|
|
|
|
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
|
|
|
{
|
2016-02-01 11:12:14 +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()
|
|
|
|
{
|
|
|
|
emit closeRequest (this);
|
2014-10-31 10:50:57 +00:00
|
|
|
}
|