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.
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
9 years ago
|
#include "settingsform.h"
|
||
|
#include "ui_settingsform.h"
|
||
|
|
||
|
#include "settingsservice.h"
|
||
|
#include "context.h"
|
||
|
#include "iplugin.h"
|
||
|
#include "iform.h"
|
||
|
|
||
|
SettingsForm::SettingsForm(QWidget *parent) :
|
||
|
QDialog(parent),
|
||
|
ui(new Ui::SettingsForm)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
|
||
|
foreach (IPlugin *plugin, Context::instance().plugins()) {
|
||
|
if (plugin->settingsUi() != NULL)
|
||
|
{
|
||
|
SettingsService srv(plugin->pluginId());
|
||
|
IForm *tab = qobject_cast<IForm*>(plugin->settingsUi());
|
||
|
|
||
|
if (tab != NULL)
|
||
|
{
|
||
|
tab->loadEntity();
|
||
|
ui->tabWidget->addTab(tab, QIcon(), plugin->settingsTabLabel());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
SettingsForm::~SettingsForm()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
void SettingsForm::on_buttonBox_accepted()
|
||
|
{
|
||
|
accept();
|
||
|
}
|
||
|
|
||
|
void SettingsForm::accept()
|
||
|
{
|
||
|
for (int i = 0; i < ui->tabWidget->count(); i++)
|
||
|
{
|
||
|
IForm *tab = qobject_cast<IForm*>(ui->tabWidget->widget(i));
|
||
|
if (tab != NULL)
|
||
|
{
|
||
|
tab->saveRecord();
|
||
|
}
|
||
|
}
|
||
|
QDialog::accept();
|
||
|
}
|
||
|
|
||
|
void SettingsForm::on_buttonBox_rejected()
|
||
|
{
|
||
|
reject();
|
||
|
}
|