|
|
|
@ -16,35 +16,12 @@ namespace CSVPrefs
|
|
|
|
|
{
|
|
|
|
|
KeyBindingPage::KeyBindingPage(CSMPrefs::Category& category, QWidget* parent)
|
|
|
|
|
: PageBase(category, parent)
|
|
|
|
|
, mTopWidget(0)
|
|
|
|
|
, mStackedLayout(0)
|
|
|
|
|
, mPageLayout(0)
|
|
|
|
|
, mPageSelector(0)
|
|
|
|
|
{
|
|
|
|
|
// Need one widget for scroll area
|
|
|
|
|
QWidget* topWidget = new QWidget();
|
|
|
|
|
QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
|
|
|
|
|
|
|
|
|
|
QWidget* resetAll = new QPushButton("Reset all to default", this);
|
|
|
|
|
connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory()));
|
|
|
|
|
topLayout->addWidget(resetAll);
|
|
|
|
|
|
|
|
|
|
// Allows switching between "pages"
|
|
|
|
|
QWidget* stackedWidget = new QWidget();
|
|
|
|
|
mStackedLayout = new QStackedLayout(stackedWidget);
|
|
|
|
|
|
|
|
|
|
mPageSelector = new QComboBox();
|
|
|
|
|
connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int)));
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(mPageSelector);
|
|
|
|
|
topLayout->addWidget(stackedWidget);
|
|
|
|
|
topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
|
|
|
|
|
|
|
|
|
// Add each option
|
|
|
|
|
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
|
|
|
|
addSetting (*iter);
|
|
|
|
|
|
|
|
|
|
setWidgetResizable(true);
|
|
|
|
|
setWidget(topWidget);
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KeyBindingPage::addSetting(CSMPrefs::Setting *setting)
|
|
|
|
@ -91,4 +68,41 @@ namespace CSVPrefs
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KeyBindingPage::refresh()
|
|
|
|
|
{
|
|
|
|
|
delete mTopWidget;
|
|
|
|
|
|
|
|
|
|
// reinitialize
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KeyBindingPage::init()
|
|
|
|
|
{
|
|
|
|
|
// Need one widget for scroll area
|
|
|
|
|
mTopWidget = new QWidget();
|
|
|
|
|
QVBoxLayout* topLayout = new QVBoxLayout(mTopWidget);
|
|
|
|
|
|
|
|
|
|
QWidget* resetAll = new QPushButton("Reset all to default", this);
|
|
|
|
|
connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory()));
|
|
|
|
|
topLayout->addWidget(resetAll);
|
|
|
|
|
|
|
|
|
|
// Allows switching between "pages"
|
|
|
|
|
QWidget* stackedWidget = new QWidget();
|
|
|
|
|
mStackedLayout = new QStackedLayout(stackedWidget);
|
|
|
|
|
|
|
|
|
|
mPageSelector = new QComboBox();
|
|
|
|
|
connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int)));
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(mPageSelector);
|
|
|
|
|
topLayout->addWidget(stackedWidget);
|
|
|
|
|
topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
|
|
|
|
|
|
|
|
|
// Add each option
|
|
|
|
|
for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter)
|
|
|
|
|
addSetting (*iter);
|
|
|
|
|
|
|
|
|
|
setWidgetResizable(true);
|
|
|
|
|
setWidget(mTopWidget);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|