1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 15:23:58 +00:00
openmw/apps/opencs/view/prefs/pagebase.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
859 B
C++
Raw Normal View History

2015-12-08 11:04:45 +00:00
#include "pagebase.hpp"
2017-05-11 07:46:51 +00:00
#include <QContextMenuEvent>
#include <QMenu>
2015-12-08 11:04:45 +00:00
#include "../../model/prefs/category.hpp"
2017-05-11 07:46:51 +00:00
#include "../../model/prefs/state.hpp"
2015-12-08 11:04:45 +00:00
CSVPrefs::PageBase::PageBase(CSMPrefs::Category& category, QWidget* parent)
: QScrollArea(parent)
, mCategory(category)
2015-12-08 16:21:58 +00:00
{
}
2015-12-08 11:04:45 +00:00
CSMPrefs::Category& CSVPrefs::PageBase::getCategory()
{
return mCategory;
}
2017-05-11 07:46:51 +00:00
void CSVPrefs::PageBase::contextMenuEvent(QContextMenuEvent* e)
{
QMenu* menu = new QMenu();
menu->addAction("Reset category to default", this, SLOT(resetCategory()));
menu->addAction("Reset all to default", this, SLOT(resetAll()));
menu->exec(e->globalPos());
delete menu;
}
void CSVPrefs::PageBase::resetCategory()
{
CSMPrefs::State::get().resetCategory(getCategory().getKey());
}
void CSVPrefs::PageBase::resetAll()
{
CSMPrefs::State::get().resetAll();
}