2015-12-08 16:21:58 +00:00
|
|
|
#include "page.hpp"
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <apps/opencs/view/prefs/pagebase.hpp>
|
|
|
|
|
2015-12-08 16:21:58 +00:00
|
|
|
#include <QGridLayout>
|
2023-11-10 12:28:10 +00:00
|
|
|
#include <QLabel>
|
2015-12-08 16:21:58 +00:00
|
|
|
|
|
|
|
#include "../../model/prefs/category.hpp"
|
|
|
|
#include "../../model/prefs/setting.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)
|
|
|
|
{
|
2023-11-10 12:28:10 +00:00
|
|
|
const CSMPrefs::SettingWidgets widgets = setting->makeWidgets(this);
|
2015-12-08 16:21:58 +00:00
|
|
|
|
|
|
|
int next = mGrid->rowCount();
|
|
|
|
|
2023-11-10 12:28:10 +00:00
|
|
|
if (widgets.mLabel != nullptr && widgets.mInput != nullptr)
|
2015-12-08 16:21:58 +00:00
|
|
|
{
|
2023-11-10 12:28:10 +00:00
|
|
|
mGrid->addWidget(widgets.mLabel, next, 0);
|
|
|
|
mGrid->addWidget(widgets.mInput, next, 1);
|
2015-12-08 16:21:58 +00:00
|
|
|
}
|
2023-11-10 12:28:10 +00:00
|
|
|
else if (widgets.mInput != nullptr)
|
2015-12-08 16:21:58 +00:00
|
|
|
{
|
2023-11-10 12:28:10 +00:00
|
|
|
mGrid->addWidget(widgets.mInput, next, 0, 1, 2);
|
2015-12-08 16:21:58 +00:00
|
|
|
}
|
|
|
|
}
|