summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-16 11:39:27 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-20 15:29:05 +0300
commit599920c6cfd87a213634097045e29f592390438b (patch)
tree9aef92cc51509e0d923353fdd14a931bce44eb69
parentd2bc70a570dbed5182f9ff110b8ff948d6b7bfd1 (diff)
downloadsubsurface-599920c6cfd87a213634097045e29f592390438b.tar.gz
Printing: export grayscale filter value to template
Export grayscale value to Grantlee template, So we must declare print_options as QMetatype. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-rw-r--r--templatelayout.cpp2
-rw-r--r--templatelayout.h11
2 files changed, 13 insertions, 0 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp
index 79508d6db..fec57cb2a 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -47,6 +47,7 @@ QString TemplateLayout::generate()
Grantlee::registerMetaType<Dive>();
Grantlee::registerMetaType<template_options>();
+ Grantlee::registerMetaType<print_options>();
QVariantHash mapping;
QVariantList diveList;
@@ -64,6 +65,7 @@ QString TemplateLayout::generate()
}
mapping.insert("dives", diveList);
mapping.insert("template_options", QVariant::fromValue(*templateOptions));
+ mapping.insert("print_options", QVariant::fromValue(*PrintOptions));
Grantlee::Context c(mapping);
diff --git a/templatelayout.h b/templatelayout.h
index 85a4699da..e37e9e868 100644
--- a/templatelayout.h
+++ b/templatelayout.h
@@ -79,6 +79,7 @@ public:
Q_DECLARE_METATYPE(Dive)
Q_DECLARE_METATYPE(template_options)
+Q_DECLARE_METATYPE(print_options)
GRANTLEE_BEGIN_LOOKUP(Dive)
if (property == "number")
@@ -136,4 +137,14 @@ if (property == "font") {
}
GRANTLEE_END_LOOKUP
+GRANTLEE_BEGIN_LOOKUP(print_options)
+if (property == "grayscale") {
+ if (object.color_selected) {
+ return "";
+ } else {
+ return "-webkit-filter: grayscale(100%)";
+ }
+}
+GRANTLEE_END_LOOKUP
+
#endif