|
|
|
@ -40,27 +40,10 @@ SettingsWidget::SettingsWidget(QWidget* parent)
@@ -40,27 +40,10 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
|
|
|
|
// block all signals during initialization, including child widgets
|
|
|
|
|
blockSignals(true); |
|
|
|
|
|
|
|
|
|
body = new QWidget(); |
|
|
|
|
QVBoxLayout* bodyLayout = new QVBoxLayout(); |
|
|
|
|
body->setLayout(bodyLayout); |
|
|
|
|
|
|
|
|
|
head = new QWidget(this); |
|
|
|
|
QHBoxLayout* headLayout = new QHBoxLayout(); |
|
|
|
|
head->setLayout(headLayout); |
|
|
|
|
|
|
|
|
|
imgLabel = new QLabel(); |
|
|
|
|
headLayout->addWidget(imgLabel); |
|
|
|
|
|
|
|
|
|
nameLabel = new QLabel(); |
|
|
|
|
QFont bold; |
|
|
|
|
bold.setBold(true); |
|
|
|
|
nameLabel->setFont(bold); |
|
|
|
|
headLayout->addWidget(nameLabel); |
|
|
|
|
headLayout->addStretch(1); |
|
|
|
|
|
|
|
|
|
settingsWidgets = new QTabWidget(this); |
|
|
|
|
settingsWidgets->setTabPosition(QTabWidget::North); |
|
|
|
|
|
|
|
|
|
bodyLayout->addWidget(settingsWidgets); |
|
|
|
|
|
|
|
|
|
GeneralForm* gfrm = new GeneralForm(this); |
|
|
|
@ -88,8 +71,7 @@ SettingsWidget::~SettingsWidget()
@@ -88,8 +71,7 @@ SettingsWidget::~SettingsWidget()
|
|
|
|
|
|
|
|
|
|
void SettingsWidget::setBodyHeadStyle(QString style) |
|
|
|
|
{ |
|
|
|
|
head->setStyle(QStyleFactory::create(style)); |
|
|
|
|
body->setStyle(QStyleFactory::create(style)); |
|
|
|
|
settingsWidgets->setStyle(QStyleFactory::create(style)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SettingsWidget::showAbout() |
|
|
|
@ -99,9 +81,9 @@ void SettingsWidget::showAbout()
@@ -99,9 +81,9 @@ void SettingsWidget::showAbout()
|
|
|
|
|
|
|
|
|
|
bool SettingsWidget::isShown() const |
|
|
|
|
{ |
|
|
|
|
if (body->isVisible()) |
|
|
|
|
if (settingsWidgets->isVisible()) |
|
|
|
|
{ |
|
|
|
|
body->window()->windowHandle()->alert(0); |
|
|
|
|
settingsWidgets->window()->windowHandle()->alert(0); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -110,25 +92,18 @@ bool SettingsWidget::isShown() const
@@ -110,25 +92,18 @@ bool SettingsWidget::isShown() const
|
|
|
|
|
|
|
|
|
|
void SettingsWidget::show(ContentLayout* contentLayout) |
|
|
|
|
{ |
|
|
|
|
contentLayout->mainContent->layout()->addWidget(body); |
|
|
|
|
contentLayout->mainHead->layout()->addWidget(head); |
|
|
|
|
body->show(); |
|
|
|
|
head->show(); |
|
|
|
|
contentLayout->mainContent->layout()->addWidget(settingsWidgets); |
|
|
|
|
settingsWidgets->show(); |
|
|
|
|
onTabChanged(settingsWidgets->currentIndex()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SettingsWidget::onTabChanged(int index) |
|
|
|
|
{ |
|
|
|
|
this->settingsWidgets->setCurrentIndex(index); |
|
|
|
|
GenericForm* currentWidget = static_cast<GenericForm*>(this->settingsWidgets->widget(index)); |
|
|
|
|
nameLabel->setText(currentWidget->getFormName()); |
|
|
|
|
imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation)); |
|
|
|
|
settingsWidgets->setCurrentIndex(index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SettingsWidget::retranslateUi() |
|
|
|
|
{ |
|
|
|
|
GenericForm* currentWidget = static_cast<GenericForm*>(settingsWidgets->currentWidget()); |
|
|
|
|
nameLabel->setText(currentWidget->getFormName()); |
|
|
|
|
for (size_t i=0; i<cfgForms.size(); i++) |
|
|
|
|
for (size_t i = 0; i < cfgForms.size(); i++) |
|
|
|
|
settingsWidgets->setTabText(i, cfgForms[i]->getFormName()); |
|
|
|
|
} |
|
|
|
|