mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: don't name color templates with confusing numbers
Use the color_palette enum instead. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
d41d79b549
commit
ed5afc510e
3 changed files with 16 additions and 10 deletions
|
@ -39,7 +39,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
|
||||||
printOptions.type = print_options::DIVELIST;
|
printOptions.type = print_options::DIVELIST;
|
||||||
templateOptions.font_index = 0;
|
templateOptions.font_index = 0;
|
||||||
templateOptions.font_size = 9;
|
templateOptions.font_size = 9;
|
||||||
templateOptions.color_palette_index = 0;
|
templateOptions.color_palette_index = ALMOND;
|
||||||
templateOptions.line_spacing = 1;
|
templateOptions.line_spacing = 1;
|
||||||
custom_colors = almond_colors;
|
custom_colors = almond_colors;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,13 +70,13 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (templateOptions.color_palette_index) {
|
switch (templateOptions.color_palette_index) {
|
||||||
case 0: // almond
|
case ALMOND: // almond
|
||||||
templateOptions.color_palette = almond_colors;
|
templateOptions.color_palette = almond_colors;
|
||||||
break;
|
break;
|
||||||
case 1: // blueshades
|
case BLUESHADES: // blueshades
|
||||||
templateOptions.color_palette = blueshades_colors;
|
templateOptions.color_palette = blueshades_colors;
|
||||||
break;
|
break;
|
||||||
case 2: // custom
|
case CUSTOM: // custom
|
||||||
templateOptions.color_palette = custom_colors;
|
templateOptions.color_palette = custom_colors;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,12 @@ struct template_options {
|
||||||
|
|
||||||
extern template_options::color_palette_struct almond_colors, blueshades_colors, custom_colors;
|
extern template_options::color_palette_struct almond_colors, blueshades_colors, custom_colors;
|
||||||
|
|
||||||
|
enum color_palette {
|
||||||
|
ALMOND,
|
||||||
|
BLUESHADES,
|
||||||
|
CUSTOM
|
||||||
|
};
|
||||||
|
|
||||||
// should be based on a custom QPrintDialog class
|
// should be based on a custom QPrintDialog class
|
||||||
class PrintOptions : public QWidget {
|
class PrintOptions : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -92,13 +92,13 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
newTemplateOptions.color_palette_index = index;
|
newTemplateOptions.color_palette_index = index;
|
||||||
switch (newTemplateOptions.color_palette_index) {
|
switch (newTemplateOptions.color_palette_index) {
|
||||||
case 0: // almond
|
case ALMOND: // almond
|
||||||
newTemplateOptions.color_palette = almond_colors;
|
newTemplateOptions.color_palette = almond_colors;
|
||||||
break;
|
break;
|
||||||
case 1: // blueshades
|
case BLUESHADES: // blueshades
|
||||||
newTemplateOptions.color_palette = blueshades_colors;
|
newTemplateOptions.color_palette = blueshades_colors;
|
||||||
break;
|
break;
|
||||||
case 2: // custom
|
case CUSTOM: // custom
|
||||||
newTemplateOptions.color_palette = custom_colors;
|
newTemplateOptions.color_palette = custom_colors;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
// reset custom colors palette
|
// reset custom colors palette
|
||||||
switch (newTemplateOptions.color_palette_index) {
|
switch (newTemplateOptions.color_palette_index) {
|
||||||
case 0: // almond
|
case ALMOND: // almond
|
||||||
newTemplateOptions.color_palette = almond_colors;
|
newTemplateOptions.color_palette = almond_colors;
|
||||||
custom_colors = newTemplateOptions.color_palette;
|
custom_colors = newTemplateOptions.color_palette;
|
||||||
break;
|
break;
|
||||||
case 1: // blueshades
|
case BLUESHADES: // blueshades
|
||||||
newTemplateOptions.color_palette = blueshades_colors;
|
newTemplateOptions.color_palette = blueshades_colors;
|
||||||
custom_colors = newTemplateOptions.color_palette;
|
custom_colors = newTemplateOptions.color_palette;
|
||||||
break;
|
break;
|
||||||
|
@ -181,6 +181,6 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
|
||||||
newTemplateOptions.color_palette.color5 = color;
|
newTemplateOptions.color_palette.color5 = color;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
newTemplateOptions.color_palette_index = 2;
|
newTemplateOptions.color_palette_index = CUSTOM;
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue