You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/apps/opencs/view/prefs/pagebase.cpp

41 lines
859 B
C++

#include "pagebase.hpp"
#include <QContextMenuEvent>
#include <QMenu>
#include "../../model/prefs/category.hpp"
#include "../../model/prefs/state.hpp"
CSVPrefs::PageBase::PageBase(CSMPrefs::Category& category, QWidget* parent)
: QScrollArea(parent)
, mCategory(category)
{
}
CSMPrefs::Category& CSVPrefs::PageBase::getCategory()
{
return mCategory;
}
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();
}