diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-08-07 09:54:09 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-08-15 15:02:30 +0300 |
commit | 1dbe10fe278650430beca638976ea7df3b5c76fd (patch) | |
tree | 012d141cf23cc0c410a2894ce040c0402e2e1d8b | |
parent | 1a2f154cf49041a223e5801328beb68cb8b42442 (diff) | |
download | subsurface-1dbe10fe278650430beca638976ea7df3b5c76fd.tar.gz |
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 <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
-rw-r--r-- | qt-ui/printdialog.cpp | 33 | ||||
-rw-r--r-- | qt-ui/printoptions.h | 4 | ||||
-rw-r--r-- | qt-ui/templateedit.cpp | 8 | ||||
-rw-r--r-- | qt-ui/templateedit.ui | 58 | ||||
-rw-r--r-- | templatelayout.h | 2 |
5 files changed, 80 insertions, 25 deletions
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 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> + <layout class="QHBoxLayout" name="horizontalLayout_13"> <item> - <widget class="QLabel" name="label_7"> + <widget class="QLabel" name="label_6"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -357,7 +357,7 @@ </sizepolicy> </property> <property name="text"> - <string>Text 1</string> + <string>Table cells 2</string> </property> </widget> </item> @@ -387,9 +387,9 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_9"> + <layout class="QHBoxLayout" name="horizontalLayout_7"> <item> - <widget class="QLabel" name="label_11"> + <widget class="QLabel" name="label_7"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -397,7 +397,7 @@ </sizepolicy> </property> <property name="text"> - <string>Text 2</string> + <string>Text 1</string> </property> </widget> </item> @@ -427,9 +427,9 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> + <layout class="QHBoxLayout" name="horizontalLayout_9"> <item> - <widget class="QLabel" name="label_4"> + <widget class="QLabel" name="label_11"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -437,7 +437,7 @@ </sizepolicy> </property> <property name="text"> - <string>Borders</string> + <string>Text 2</string> </property> </widget> </item> @@ -467,6 +467,46 @@ </layout> </item> <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Borders</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="colorLable6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>color6</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="editButton6"> + <property name="text"> + <string>Edit</string> + </property> + </widget> + </item> + </layout> + </item> + <item> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/templatelayout.h b/templatelayout.h index 1bb08d25d..07e3ae060 100644 --- a/templatelayout.h +++ b/templatelayout.h @@ -165,6 +165,8 @@ if (property == "font") { return object.color_palette.color4.name(); } else if (property == "color5") { return object.color_palette.color5.name(); +} else if (property == "color6") { + return object.color_palette.color6.name(); } GRANTLEE_END_LOOKUP |