2015-12-08 16:21:58 +00:00
|
|
|
|
|
|
|
#include "page.hpp"
|
|
|
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
|
|
|
#include "../../model/prefs/setting.hpp"
|
|
|
|
#include "../../model/prefs/category.hpp"
|
|
|
|
|
|
|
|
CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent)
|
|
|
|
: PageBase (category, parent)
|
|
|
|
{
|
2017-05-11 07:46:51 +00:00
|
|
|
QWidget *widget = new QWidget (parent);
|
2017-05-08 05:24:28 +00:00
|
|
|
mGrid = new QGridLayout (widget);
|
|
|
|
|
|
|
|
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
|
|
|
addSetting (*iter);
|
|
|
|
|
2017-05-11 07:46:51 +00:00
|
|
|
setWidget (widget);
|
2015-12-08 16:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting)
|
|
|
|
{
|
|
|
|
std::pair<QWidget *, QWidget *> widgets = setting->makeWidgets (this);
|
|
|
|
|
|
|
|
int next = mGrid->rowCount();
|
|
|
|
|
|
|
|
if (widgets.first)
|
|
|
|
{
|
|
|
|
mGrid->addWidget (widgets.first, next, 0);
|
|
|
|
mGrid->addWidget (widgets.second, next, 1);
|
|
|
|
}
|
|
|
|
else if (widgets.second)
|
|
|
|
{
|
2015-12-10 12:28:48 +00:00
|
|
|
mGrid->addWidget (widgets.second, next, 0, 1, 2);
|
2015-12-08 16:21:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mGrid->addWidget (new QWidget (this), next, 0);
|
|
|
|
}
|
|
|
|
}
|