diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-09-16 22:09:05 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-16 21:18:00 -0700 |
commit | f800c602d61f02379b4639fdb085c0fb4ad18a9a (patch) | |
tree | 96ac5232083d7bb948928bdfa296fdc41492b466 /qt-ui/templateedit.cpp | |
parent | bdedc97036d06cbc864a6edac8c4ac5b9ef9b05d (diff) | |
download | subsurface-f800c602d61f02379b4639fdb085c0fb4ad18a9a.tar.gz |
Printing: Remove braces around single lines in if/then
Remove useless braces around single line if/then.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r-- | qt-ui/templateedit.cpp | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index b3ef5b8ec..267b67ae5 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -22,11 +22,10 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, ui->linespacing->setValue(templateOptions->line_spacing); grantlee_template = TemplateLayout::readTemplate(printOptions->p_template); - if (printOptions->type == print_options::DIVELIST) { + if (printOptions->type == print_options::DIVELIST) grantlee_template = TemplateLayout::readTemplate(printOptions->p_template); - } else if (printOptions->type == print_options::STATISTICS) { + else if (printOptions->type == print_options::STATISTICS) grantlee_template = TemplateLayout::readTemplate(QString::fromUtf8("statistics") + QDir::separator() + printOptions->p_template); - } // gui btnGroup = new QButtonGroup; @@ -80,11 +79,10 @@ void TemplateEdit::updatePreview() // update grantlee template string grantlee_template = TemplateLayout::readTemplate(printOptions->p_template); - if (printOptions->type == print_options::DIVELIST) { + if (printOptions->type == print_options::DIVELIST) grantlee_template = TemplateLayout::readTemplate(printOptions->p_template); - } else if (printOptions->type == print_options::STATISTICS) { + else if (printOptions->type == print_options::STATISTICS) grantlee_template = TemplateLayout::readTemplate(QString::fromUtf8("statistics") + QDir::separator() + printOptions->p_template); - } } void TemplateEdit::on_fontsize_valueChanged(int font_size) @@ -137,9 +135,8 @@ void TemplateEdit::saveSettings() QString message = "Do you want to save your changes?"; bool templateChanged = false; if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) { - if (bundledTemplates.contains(printOptions->p_template) || (printOptions->p_template == "Default.html" && printOptions->type == print_options::STATISTICS)) { + if (bundledTemplates.contains(printOptions->p_template) || (printOptions->p_template == "Default.html" && printOptions->type == print_options::STATISTICS)) message = "You are about to modify a template bundled with Subsurface. Do you want to save your changes?"; - } templateChanged = true; } msgBox.setText(message); @@ -149,15 +146,13 @@ void TemplateEdit::saveSettings() memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options)); if (templateChanged) { TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText()); - if (printOptions->type == print_options::DIVELIST) { + if (printOptions->type == print_options::DIVELIST) TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText()); - } else if (printOptions->type == print_options::STATISTICS) { + else if (printOptions->type == print_options::STATISTICS) TemplateLayout::writeTemplate(QString::fromUtf8("statistics") + QDir::separator() + printOptions->p_template, ui->plainTextEdit->toPlainText()); - } } - if (templateOptions->color_palette_index == CUSTOM) { + if (templateOptions->color_palette_index == CUSTOM) custom_colors = templateOptions->color_palette; - } } } } @@ -203,35 +198,34 @@ void TemplateEdit::colorSelect(QAbstractButton *button) switch (btnGroup->id(button)) { case 1: color = QColorDialog::getColor(newTemplateOptions.color_palette.color1, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color1 = color; - } break; case 2: color = QColorDialog::getColor(newTemplateOptions.color_palette.color2, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color2 = color; - } break; + break; case 3: color = QColorDialog::getColor(newTemplateOptions.color_palette.color3, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color3 = color; - } break; + break; case 4: color = QColorDialog::getColor(newTemplateOptions.color_palette.color4, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color4 = color; - } break; + break; case 5: color = QColorDialog::getColor(newTemplateOptions.color_palette.color5, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color5 = color; - } break; + break; case 6: color = QColorDialog::getColor(newTemplateOptions.color_palette.color6, this); - if (color.isValid()) { + if (color.isValid()) newTemplateOptions.color_palette.color6 = color; - } break; + break; } newTemplateOptions.color_palette_index = CUSTOM; updatePreview(); |