summaryrefslogtreecommitdiffstats
path: root/qt-ui/templateedit.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-28 07:27:30 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-28 07:27:30 -0700
commitf2e2be0f67146941d9a05815db2d1335a975765e (patch)
tree31813fc61ad44048baf72cd71e016b521bd6afbe /qt-ui/templateedit.cpp
parent7d0c6f895d813b366a3c9ff5b26ed3db1b2fba02 (diff)
parent01645d64b91b29878d6927dcf7cd5c2381e0bfaa (diff)
downloadsubsurface-f2e2be0f67146941d9a05815db2d1335a975765e.tar.gz
Merge branch 'custom-print' of github.com:neolit123/subsurface
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r--qt-ui/templateedit.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp
index 6a6328f64..6df11ea79 100644
--- a/qt-ui/templateedit.cpp
+++ b/qt-ui/templateedit.cpp
@@ -21,13 +21,7 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions,
ui->colorpalette->setCurrentIndex(templateOptions->color_palette_index);
ui->linespacing->setValue(templateOptions->line_spacing);
- if (printOptions->p_template == print_options::ONE_DIVE) {
- grantlee_template = TemplateLayout::readTemplate("one_dive.html");
- } else if (printOptions->p_template == print_options::TWO_DIVE) {
- grantlee_template = TemplateLayout::readTemplate("two_dives.html");
- } else if (printOptions->p_template == print_options::CUSTOM) {
- grantlee_template = TemplateLayout::readTemplate("custom.html");
- }
+ grantlee_template = TemplateLayout::readTemplate(printOptions->p_template);
// gui
btnGroup = new QButtonGroup;
@@ -98,10 +92,13 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index)
{
newTemplateOptions.color_palette_index = index;
switch (newTemplateOptions.color_palette_index) {
- case 0: // almond
+ case ALMOND: // almond
newTemplateOptions.color_palette = almond_colors;
break;
- case 1: // custom
+ case BLUESHADES: // blueshades
+ newTemplateOptions.color_palette = blueshades_colors;
+ break;
+ case CUSTOM: // custom
newTemplateOptions.color_palette = custom_colors;
break;
}
@@ -118,10 +115,10 @@ void TemplateEdit::saveSettings()
if (msgBox.exec() == QMessageBox::Save) {
memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options));
if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) {
- printOptions->p_template = print_options::CUSTOM;
+ printOptions->p_template = "custom.html";
TemplateLayout::writeTemplate("custom.html", ui->plainTextEdit->toPlainText());
}
- if (templateOptions->color_palette_index == 1) {
+ if (templateOptions->color_palette_index == 2) {
custom_colors = templateOptions->color_palette;
}
}
@@ -150,10 +147,14 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
{
// reset custom colors palette
switch (newTemplateOptions.color_palette_index) {
- case 0: // almond
+ case ALMOND: // almond
newTemplateOptions.color_palette = almond_colors;
custom_colors = newTemplateOptions.color_palette;
break;
+ case BLUESHADES: // blueshades
+ newTemplateOptions.color_palette = blueshades_colors;
+ custom_colors = newTemplateOptions.color_palette;
+ break;
}
//change selected color
@@ -180,6 +181,6 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
newTemplateOptions.color_palette.color5 = color;
break;
}
- newTemplateOptions.color_palette_index = 1;
+ newTemplateOptions.color_palette_index = CUSTOM;
updatePreview();
}