1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00
OpenMW/apps/opencs/view/prefs/pagebase.cpp
2022-09-22 21:35:26 +03:00

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();
}