From 1dbe10fe278650430beca638976ea7df3b5c76fd Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 7 Aug 2015 09:54:09 +0200 Subject: Printing: add another color in color palettes Add another color 'Table cells 2' to the color palette, make all the backgrounds solid white by default. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Gehad elrobey --- qt-ui/printdialog.cpp | 33 +++++++++++++++------------- qt-ui/printoptions.h | 4 +++- qt-ui/templateedit.cpp | 8 +++++++ qt-ui/templateedit.ui | 58 ++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 78 insertions(+), 25 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index 08fdf7064..0095597fd 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -17,21 +17,24 @@ template_options::color_palette_struct ssrf_colors, almond_colors, blueshades_co PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { // initialize const colors - ssrf_colors.color1 = QColor::fromRgb(0xef, 0xf7, 0xff); - ssrf_colors.color2 = QColor::fromRgb(0xa6, 0xbc, 0xd7); - ssrf_colors.color3 = QColor::fromRgb(0x34, 0x65, 0xa4); - ssrf_colors.color4 = QColor::fromRgb(0x20, 0x4a, 0x87); - ssrf_colors.color5 = QColor::fromRgb(0x17, 0x37, 0x64); - almond_colors.color1 = QColor::fromRgb(243, 234, 207); - almond_colors.color2 = QColor::fromRgb(253, 204, 156); - almond_colors.color3 = QColor::fromRgb(136, 160, 150); - almond_colors.color4 = QColor::fromRgb(187, 171, 139); - almond_colors.color5 = QColor::fromRgb(239, 130, 117); - blueshades_colors.color1 = QColor::fromRgb(182, 192, 206); - blueshades_colors.color2 = QColor::fromRgb(142, 152, 166); - blueshades_colors.color3 = QColor::fromRgb(31, 49, 75); - blueshades_colors.color4 = QColor::fromRgb(21, 45, 84); - blueshades_colors.color5 = QColor::fromRgb(5, 25, 56); + ssrf_colors.color1 = QColor::fromRgb(0xff, 0xff, 0xff); + ssrf_colors.color2 = QColor::fromRgb(0xef, 0xf7, 0xff); + ssrf_colors.color3 = QColor::fromRgb(0xa6, 0xbc, 0xd7); + ssrf_colors.color4 = QColor::fromRgb(0x34, 0x65, 0xa4); + ssrf_colors.color5 = QColor::fromRgb(0x20, 0x4a, 0x87); + ssrf_colors.color6 = QColor::fromRgb(0x17, 0x37, 0x64); + almond_colors.color1 = QColor::fromRgb(255, 255, 255); + almond_colors.color2 = QColor::fromRgb(243, 234, 207); + almond_colors.color3 = QColor::fromRgb(253, 204, 156); + almond_colors.color4 = QColor::fromRgb(136, 160, 150); + almond_colors.color5 = QColor::fromRgb(187, 171, 139); + almond_colors.color6 = QColor::fromRgb(239, 130, 117); + blueshades_colors.color1 = QColor::fromRgb(255, 255, 255); + blueshades_colors.color2 = QColor::fromRgb(182, 192, 206); + blueshades_colors.color3 = QColor::fromRgb(142, 152, 166); + blueshades_colors.color4 = QColor::fromRgb(31, 49, 75); + blueshades_colors.color5 = QColor::fromRgb(21, 45, 84); + blueshades_colors.color6 = QColor::fromRgb(5, 25, 56); // check if the options were previously stored in the settings; if not use some defaults. QSettings s; diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h index 4903da09f..aff8ed1d9 100644 --- a/qt-ui/printoptions.h +++ b/qt-ui/printoptions.h @@ -27,12 +27,14 @@ struct template_options { QColor color3; QColor color4; QColor color5; + QColor color6; bool operator!=(const color_palette_struct &other) const { return other.color1 != color1 || other.color2 != color2 || other.color3 != color3 || other.color4 != color4 - || other.color5 != color5; + || other.color5 != color5 + || other.color6 != color6; } } color_palette; bool operator!=(const template_options &other) const { diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 90ef7e750..e4e6453ac 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -30,6 +30,7 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, btnGroup->addButton(ui->editButton3, 3); btnGroup->addButton(ui->editButton4, 4); btnGroup->addButton(ui->editButton5, 5); + btnGroup->addButton(ui->editButton6, 6); connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(colorSelect(QAbstractButton*))); ui->plainTextEdit->setPlainText(grantlee_template); @@ -60,12 +61,14 @@ void TemplateEdit::updatePreview() ui->colorLable3->setStyleSheet("QLabel { background-color : \"" + newTemplateOptions.color_palette.color3.name() + "\";}"); ui->colorLable4->setStyleSheet("QLabel { background-color : \"" + newTemplateOptions.color_palette.color4.name() + "\";}"); ui->colorLable5->setStyleSheet("QLabel { background-color : \"" + newTemplateOptions.color_palette.color5.name() + "\";}"); + ui->colorLable6->setStyleSheet("QLabel { background-color : \"" + newTemplateOptions.color_palette.color6.name() + "\";}"); ui->colorLable1->setText(newTemplateOptions.color_palette.color1.name()); ui->colorLable2->setText(newTemplateOptions.color_palette.color2.name()); ui->colorLable3->setText(newTemplateOptions.color_palette.color3.name()); ui->colorLable4->setText(newTemplateOptions.color_palette.color4.name()); ui->colorLable5->setText(newTemplateOptions.color_palette.color5.name()); + ui->colorLable6->setText(newTemplateOptions.color_palette.color6.name()); // update critical UI elements ui->colorpalette->setCurrentIndex(newTemplateOptions.color_palette_index); @@ -197,6 +200,11 @@ void TemplateEdit::colorSelect(QAbstractButton *button) if (color.isValid()) { newTemplateOptions.color_palette.color5 = color; } break; + case 6: + color = QColorDialog::getColor(newTemplateOptions.color_palette.color6, this); + if (color.isValid()) { + newTemplateOptions.color_palette.color6 = color; + } break; } newTemplateOptions.color_palette_index = CUSTOM; updatePreview(); diff --git a/qt-ui/templateedit.ui b/qt-ui/templateedit.ui index 238e69290..0a1b18c54 100644 --- a/qt-ui/templateedit.ui +++ b/qt-ui/templateedit.ui @@ -347,9 +347,9 @@ - + - + 0 @@ -357,7 +357,7 @@ - Text 1 + Table cells 2 @@ -387,9 +387,9 @@ - + - + 0 @@ -397,7 +397,7 @@ - Text 2 + Text 1 @@ -427,9 +427,9 @@ - + - + 0 @@ -437,7 +437,7 @@ - Borders + Text 2 @@ -466,6 +466,46 @@ + + + + + + + 0 + 0 + + + + Borders + + + + + + + + 0 + 0 + + + + color6 + + + Qt::AlignCenter + + + + + + + Edit + + + + + -- cgit v1.2.3-70-g09d2