]>
Commit | Line | Data |
---|---|---|
5217a5c9 JB |
1 | diff --git a/.gitignore b/.gitignore |
2 | index 12b7315..5803045 100644 | |
3 | --- a/.gitignore | |
4 | +++ b/.gitignore | |
5 | @@ -1,5 +1,6 @@ | |
6 | Makefile | |
7 | *.o | |
8 | +*.a | |
9 | *.so* | |
10 | moc_* | |
11 | qrc_* | |
12 | diff --git a/README.txt b/README.txt | |
13 | index bfa2160..cd92909 100644 | |
14 | --- a/README.txt | |
15 | +++ b/README.txt | |
16 | @@ -2,10 +2,10 @@ gegl-qt: Qt utility library for GEGL. | |
17 | ||
18 | License: LGPLv3+ | |
19 | Maintainer: Jon Nordby <jononor@gmail.com> | |
20 | -Homepage: http://www.gegl.org | |
21 | +Homepage: http://www.gegl.org/gegl-qt | |
22 | Code: http://git.gnome.org/browse/gegl-qt/ | |
23 | Bugtracker: http://bugs.gnome.org, product GEGL (use gegl-qt in title) | |
24 | -Mailinglist: http://blog.gmane.org/gmane.comp.video.gegl.devel | |
25 | +Mailinglist: http://mail.gnome.org/mailman/listinfo/gegl-developer-list | |
26 | ||
27 | == Installing == | |
28 | gegl-qt uses the qmake build system. To install do: | |
29 | @@ -27,6 +27,9 @@ To use gegl-qt in your project, use the provided pkg-config file. | |
30 | See this file, the examples and source code, for now. :) | |
31 | ||
32 | == Features == | |
33 | + | |
34 | +- Support for both Qt4 and Qt5. | |
35 | + | |
36 | === View widgets === | |
37 | - Shows the output of a Gegl graph. | |
38 | - QML, QGraphicsView and QWidget versions are provided. | |
39 | @@ -34,14 +37,14 @@ See this file, the examples and source code, for now. :) | |
40 | - Can do automatic scaling and centering | |
41 | ||
42 | === Gegl display operation === | |
43 | -Allows applications to show a | |
44 | +Allows applications to show a GEGL graph in a window without linking | |
45 | +against a specific UI library. | |
46 | ||
47 | == Purpose & Scope == | |
48 | The purpose of gegl-qt is to make it easy for application developers to | |
49 | use GEGL in applications with Qt based user interfaces. | |
50 | ||
51 | -gegl-qt aims to support Qt4 and both QWidget, QGraphicsView and QML based user interfaces. | |
52 | -Qt5 support will be considered in the future. | |
53 | +gegl-qt aims to support Qt4 and Qt5 for both QWidget, QGraphicsView and QML based user interfaces. | |
54 | ||
55 | == Contributing == | |
56 | To contribute code, please file a bug and attach git-formatted patches there, or link to | |
57 | @@ -61,13 +64,13 @@ Should at happen before or together with the next Gegl release. | |
58 | Need to build and work with whatever is the latest Gegl release. | |
59 | ||
60 | - Do API review | |
61 | -- API documentation | |
62 | + | |
63 | +- Complete Qt5 support | |
64 | ||
65 | - Have a basic set of tests, and good test infrastructure | |
66 | - Distribute a set of basic examples for the provided features | |
67 | -* Missing: use of view->model transformations | |
68 | -* Examples needs to have a description, and be commented | |
69 | -- Add information about gegl-qt to gegl.org website | |
70 | + * Missing: use of view->model transformations | |
71 | + * Examples needs to have a description, and be commented | |
72 | ||
73 | === Later === | |
74 | ||
75 | @@ -77,7 +80,7 @@ Display operation | |
76 | ||
77 | View widgets | |
78 | - Rotation support | |
79 | -- Background and overlay draw support for GeglQtView | |
80 | +- Background and overlay draw support for GeglQt::NodeView | |
81 | ||
82 | QImage IO loader plugin that uses GEGL loaders | |
83 | ||
84 | diff --git a/config.pri b/config.pri | |
85 | index 50c4500..b279869 100644 | |
86 | --- a/config.pri | |
87 | +++ b/config.pri | |
88 | @@ -6,10 +6,10 @@ GEGLQT_VERSION = 0.0.7 | |
89 | GEGLQT_PROJECTBRIEF = "Integration library for using GEGL in Qt based applications" | |
90 | ||
91 | GEGLQT_API_VERSION = 0.1 | |
92 | -GEGLQT_BASELIBNAME = gegl-qt4 | |
93 | +GEGLQT_BASELIBNAME = gegl-qt$$QT_MAJOR_VERSION | |
94 | GEGLQT_LIBNAME = $$GEGLQT_BASELIBNAME-$$GEGLQT_API_VERSION | |
95 | ||
96 | -GEGLQT_QML_API_NAME = GeglQt4 | |
97 | +GEGLQT_QML_API_NAME = GeglQt$$QT_MAJOR_VERSION | |
98 | GEGLQT_QML_API_VERSION_MAJOR = 0 | |
99 | GEGLQT_QML_API_VERSION_MINOR = 1 | |
100 | GEGLQT_QML_API_VERSION = 0.1 | |
101 | @@ -17,6 +17,29 @@ GEGLQT_QML_API_VERSION = 0.1 | |
102 | OBJECTS_DIR = .obj | |
103 | MOC_DIR = .moc | |
104 | ||
105 | +### Hard dependencies ### | |
106 | + | |
107 | +# GEGL | |
108 | +HAVE_GEGL = no | |
109 | +GEGL_PKG = "" | |
110 | + | |
111 | +contains(HAVE_GEGL, no) { | |
112 | + system(pkg-config --exists gegl-0.2) { | |
113 | + HAVE_GEGL = 0.2 | |
114 | + GEGL_PKG = gegl-0.2 | |
115 | + } | |
116 | +} | |
117 | + | |
118 | +contains(HAVE_GEGL, no) { | |
119 | + system(pkg-config --exists gegl) { | |
120 | + HAVE_GEGL = 0.1 | |
121 | + GEGL_PKG = gegl | |
122 | + } | |
123 | +} | |
124 | + | |
125 | +contains(HAVE_GEGL, no):error("Could not find required dependency: GEGL") | |
126 | + | |
127 | +### Options ### | |
128 | # Can be used to specify custom install prefix | |
129 | isEmpty(GEGLQT_INSTALL_PREFIX) { | |
130 | GEGLQT_INSTALL_PREFIX = /usr | |
131 | @@ -29,22 +52,69 @@ isEmpty(GEGLQT_INSTALL_PREFIX) { | |
132 | } | |
133 | ||
134 | # Paths for installing files | |
135 | -GEGL_LIBDIR = $$system(pkg-config --variable libdir gegl) | |
136 | -GEGL_INSTALL_OPERATIONS = $$system(pkg-config --variable pluginsdir gegl) | |
137 | +GEGL_LIBDIR = $$system(pkg-config --variable libdir $$GEGL_PKG) | |
138 | +GEGL_INSTALL_OPERATIONS = $$system(pkg-config --variable pluginsdir $$GEGL_PKG) | |
139 | isEmpty(GEGL_INSTALL_OPERATIONS) { | |
140 | - GEGL_INSTALL_OPERATIONS = $$GEGL_LIBDIR/gegl-0.1/ | |
141 | + GEGL_INSTALL_OPERATIONS = $$GEGL_LIBDIR/gegl-$$HAVE_GEGL/ | |
142 | } | |
143 | ||
144 | -# Optional deps | |
145 | +# | |
146 | +isEmpty(QTDECLARATIVE_INSTALL_PLUGINS) { | |
147 | + QTDECLARATIVE_INSTALL_PLUGINS = $$[QT_INSTALL_IMPORTS] | |
148 | +} | |
149 | + | |
150 | +### Optional deps ### | |
151 | +# QtDeclarative | |
152 | HAVE_QT_DECLARATIVE = yes | |
153 | -!system(pkg-config QtDeclarative){ | |
154 | +contains(QT_MAJOR_VERSION, 5) { | |
155 | + !contains(QT_CONFIG, declarative) { | |
156 | + HAVE_QT_DECLARATIVE = no | |
157 | + } | |
158 | +} else { | |
159 | + !system(pkg-config QtDeclarative) { | |
160 | + HAVE_QT_DECLARATIVE = no | |
161 | + } | |
162 | +} | |
163 | + | |
164 | +# QtQuick1 provides QDeclarativeView and QDeclarativeItem | |
165 | +# On Qt4 it is actually a part of the QtDeclarative module | |
166 | +HAVE_QT_QUICK1 = yes | |
167 | +contains(QT_MAJOR_VERSION, 5) { | |
168 | + !contains(QT_CONFIG, quick1) { | |
169 | + HAVE_QT_QUICK1 = no | |
170 | + } | |
171 | +} else { | |
172 | + !contains(HAVE_QT_DECLARATIVE, yes) { | |
173 | + HAVE_QT_QUICK1 = no | |
174 | + } | |
175 | +} | |
176 | + | |
177 | +# On Qt5, quick or quick1 is required in addition to declarative for "QT" option | |
178 | +# On Qt4, it should only contain declarative | |
179 | +contains(QT_MAJOR_VERSION, 5) { | |
180 | + QT_DECLARATIVE = declarative quick | |
181 | + contains(HAVE_QT_QUICK1, yes) { | |
182 | + QT_DECLARATIVE += quick1 | |
183 | + } | |
184 | +} else { | |
185 | + QT_DECLARATIVE = declarative | |
186 | +} | |
187 | + | |
188 | +contains(HAVE_QT_DECLARATIVE, no) { | |
189 | !build_pass:system(echo "QtDeclarative not found - no QML support") | |
190 | - HAVE_QT_DECLARATIVE = no | |
191 | } | |
192 | ||
193 | -HAVE_PYSIDE = yes | |
194 | -!system(pkg-config pyside){ | |
195 | - !build_pass:system(echo "PySide not found - no Python support") | |
196 | +isEmpty(HAVE_PYSIDE) { | |
197 | + HAVE_PYSIDE = yes | |
198 | + !system(pkg-config pyside){ | |
199 | + !build_pass:system(echo "PySide not found - no Python support") | |
200 | + HAVE_PYSIDE = no | |
201 | + } | |
202 | +} | |
203 | + | |
204 | +# Can go away when PySide supports Qt5 | |
205 | +contains(QT_MAJOR_VERSION, 5) { | |
206 | + !build_pass:system(echo "PySide not supported with Qt 5 - no Python support") | |
207 | HAVE_PYSIDE = no | |
208 | } | |
209 | ||
210 | @@ -62,6 +132,26 @@ isEmpty(PDFLATEX){ | |
211 | HAVE_PDFLATEX = no | |
212 | } | |
213 | ||
214 | +# QtWidgets | |
215 | +HAVE_QT_WIDGETS = yes | |
216 | +contains(QT_MAJOR_VERSION, 5) { | |
217 | + !system(pkg-config QtWidgets) { | |
218 | + HAVE_QT_WIDGETS = no | |
219 | + } | |
220 | +} else { | |
221 | + # Qt4 always has QtWidgets | |
222 | +} | |
223 | + | |
224 | +!contains(HAVE_QT_WIDGETS, yes) { | |
225 | + !build_pass:system(echo "QtWidgets not found - no QtWidgets support") | |
226 | +} | |
227 | + | |
228 | +# On Qt5, widgets is required in addition to gui for "QT" option | |
229 | +# On Qt4, it should be empty | |
230 | +contains(QT_MAJOR_VERSION, 5) { | |
231 | + QT_WIDGETS = widgets | |
232 | +} | |
233 | + | |
234 | GEGLQT_INSTALL_BIN = $$GEGLQT_INSTALL_PREFIX/bin | |
235 | GEGLQT_INSTALL_HEADERS = $$GEGLQT_INSTALL_PREFIX/include | |
236 | GEGLQT_INSTALL_LIBS = $$GEGLQT_INSTALL_PREFIX/lib | |
237 | @@ -90,6 +180,8 @@ SUBST_VARIABLES += \ | |
238 | GEGLQT_DECLARATIVE_PKGCONFIG \ | |
239 | GEGLQT_PROJECTBRIEF \ | |
240 | GEGLQT_PROJECTNAME \ | |
241 | + GEGLQT_IN_PWD \ | |
242 | + GEGL_PKG \ | |
243 | ||
244 | # Generate the specified file from its .in template, and substitute variables | |
245 | # Variables to be substituted in .in files must be of the form @VARIABLE_NAME@ | |
246 | @@ -97,6 +189,8 @@ defineTest(outputFile) { | |
247 | out = $$OUT_PWD/$$1 | |
248 | in = $$PWD/$${1}.in | |
249 | ||
250 | + GEGLQT_IN_PWD = $$IN_PWD | |
251 | + | |
252 | !exists($$in) { | |
253 | error($$in does not exist!) | |
254 | return(false) | |
255 | diff --git a/doc/.gitignore b/doc/.gitignore | |
256 | index 84af060..fe10952 100644 | |
257 | --- a/doc/.gitignore | |
258 | +++ b/doc/.gitignore | |
259 | @@ -1,4 +1,4 @@ | |
260 | Doxyfile | |
261 | html | |
262 | latex | |
263 | - | |
264 | +gegl-qt | |
265 | diff --git a/examples/common/common.pro b/examples/common/common.pro | |
266 | new file mode 100644 | |
267 | index 0000000..e149662 | |
268 | --- /dev/null | |
269 | +++ b/examples/common/common.pro | |
270 | @@ -0,0 +1,17 @@ | |
271 | +include(../../config.pri) | |
272 | + | |
273 | +QT = core | |
274 | +TEMPLATE = lib | |
275 | +CONFIG += staticlib | |
276 | +TARGET = $$GEGLQT_LIBNAME-examples-common | |
277 | + | |
278 | +SOURCES += \ | |
279 | + paint-engine.cpp \ | |
280 | + operations.cpp \ | |
281 | + | |
282 | +HEADERS += \ | |
283 | + paint-engine.h \ | |
284 | + operations.h \ | |
285 | + | |
286 | +CONFIG += link_pkgconfig | |
287 | +PKGCONFIG += $$GEGL_PKG | |
288 | diff --git a/examples/common/operations.cpp b/examples/common/operations.cpp | |
289 | new file mode 100644 | |
290 | index 0000000..61984a3 | |
291 | --- /dev/null | |
292 | +++ b/examples/common/operations.cpp | |
293 | @@ -0,0 +1,260 @@ | |
294 | +#include "operations.h" | |
295 | + | |
296 | +#include <gegl.h> | |
297 | +#include <gegl-plugin.h> // For GeglOperationClass | |
298 | + | |
299 | +enum ValueAttribute { | |
300 | + ValueMax, | |
301 | + ValueDefault, | |
302 | + ValueMin | |
303 | +}; | |
304 | + | |
305 | +QVariant | |
306 | +getValueAttribute(ValueAttribute valueAttribute, GType valueType, GParamSpec *param_spec) | |
307 | +{ | |
308 | + QVariant minValue; | |
309 | + QVariant maxValue; | |
310 | + QVariant defaultValue; | |
311 | + | |
312 | + if (g_type_is_a (valueType, G_TYPE_DOUBLE)) { | |
313 | + const gdouble def = G_PARAM_SPEC_DOUBLE (param_spec)->default_value; | |
314 | + const gdouble min = G_PARAM_SPEC_DOUBLE (param_spec)->minimum; | |
315 | + const gdouble max = G_PARAM_SPEC_DOUBLE (param_spec)->maximum; | |
316 | + | |
317 | + defaultValue = QVariant::fromValue(def); | |
318 | + minValue = QVariant::fromValue(min); | |
319 | + maxValue = QVariant::fromValue(max); | |
320 | + | |
321 | + } else if (g_type_is_a (valueType, G_TYPE_INT)) { | |
322 | + const gint def = G_PARAM_SPEC_INT (param_spec)->default_value; | |
323 | + const gint min = G_PARAM_SPEC_INT (param_spec)->minimum; | |
324 | + const gint max = G_PARAM_SPEC_INT (param_spec)->maximum; | |
325 | + | |
326 | + defaultValue = QVariant::fromValue(def); | |
327 | + minValue = QVariant::fromValue(min); | |
328 | + maxValue = QVariant::fromValue(max); | |
329 | + | |
330 | + } else if (g_type_is_a (valueType, G_TYPE_FLOAT)) { | |
331 | + const gfloat def = G_PARAM_SPEC_FLOAT (param_spec)->default_value; | |
332 | + const gfloat min = G_PARAM_SPEC_FLOAT (param_spec)->minimum; | |
333 | + const gfloat max = G_PARAM_SPEC_FLOAT (param_spec)->maximum; | |
334 | + | |
335 | + defaultValue = QVariant::fromValue(def); | |
336 | + minValue = QVariant::fromValue(min); | |
337 | + maxValue = QVariant::fromValue(max); | |
338 | + | |
339 | + } else if (g_type_is_a (valueType, G_TYPE_BOOLEAN)) { | |
340 | + const gboolean def = G_PARAM_SPEC_BOOLEAN (param_spec)->default_value; | |
341 | + defaultValue = QVariant::fromValue(def); | |
342 | + | |
343 | + } else if (g_type_is_a (valueType, G_TYPE_STRING)) { | |
344 | + const gchar *string = G_PARAM_SPEC_STRING (param_spec)->default_value; | |
345 | + defaultValue = QVariant::fromValue(QString::fromUtf8(string)); | |
346 | + | |
347 | + } else { | |
348 | + // Unknown type | |
349 | + } | |
350 | + | |
351 | + switch (valueAttribute) { | |
352 | + case ValueMax: | |
353 | + return maxValue; | |
354 | + case ValueMin: | |
355 | + return minValue; | |
356 | + case ValueDefault: | |
357 | + default: | |
358 | + return defaultValue; | |
359 | + | |
360 | + } | |
361 | +} | |
362 | + | |
363 | +QMap<QString,OperationProperty *> | |
364 | +getPropertyMap(const QString &operationName) | |
365 | +{ | |
366 | + QMap<QString,OperationProperty *> propertyMap; | |
367 | + | |
368 | + GParamSpec **properties; | |
369 | + guint prop_no; | |
370 | + guint n_properties; | |
371 | + | |
372 | +#if GEGL_MINOR_VERSION >= 2 | |
373 | + properties = gegl_operation_list_properties(operationName.toUtf8(), &n_properties); | |
374 | +#else | |
375 | + properties = gegl_list_properties(operationName.toUtf8(), &n_properties); | |
376 | +#endif | |
377 | + | |
378 | + for (prop_no = 0; prop_no < n_properties; prop_no++) | |
379 | + { | |
380 | + GParamSpec *param_spec = properties[prop_no]; | |
381 | + | |
382 | + QString name = QString::fromUtf8(g_param_spec_get_name(param_spec)); | |
383 | + QString shortDescription = QString::fromUtf8(g_param_spec_get_blurb(param_spec)); | |
384 | + GType valueType = G_PARAM_SPEC_VALUE_TYPE(param_spec); | |
385 | + QVariant minValue = getValueAttribute(ValueMin, valueType, param_spec); | |
386 | + QVariant maxValue = getValueAttribute(ValueMax, valueType, param_spec); | |
387 | + QVariant defaultValue = getValueAttribute(ValueDefault, valueType, param_spec); | |
388 | + | |
389 | + OperationProperty *prop = new OperationProperty(name, shortDescription, | |
390 | + defaultValue, minValue, maxValue); | |
391 | + propertyMap.insert(name, prop); | |
392 | + } | |
393 | + return propertyMap; | |
394 | +} | |
395 | + | |
396 | +/* */ | |
397 | +QList<GeglOperationClass *> * | |
398 | +getOperationsClasses(QList<GeglOperationClass *> *list, GType type) | |
399 | +{ | |
400 | + GeglOperationClass *klass; | |
401 | + GType *classes; | |
402 | + guint no_children; | |
403 | + guint no; | |
404 | + | |
405 | + if (!type) | |
406 | + return list; | |
407 | + | |
408 | + klass = GEGL_OPERATION_CLASS(g_type_class_ref(type)); | |
409 | + if (klass->name != NULL) | |
410 | + list->append(klass); | |
411 | + | |
412 | + classes = g_type_children(type, &no_children); | |
413 | + | |
414 | + for (no=0; no < no_children; no++) { | |
415 | + list = getOperationsClasses(list, classes[no]); | |
416 | + } | |
417 | + if (classes) { | |
418 | + g_free(classes); | |
419 | + } | |
420 | + return list; | |
421 | +} | |
422 | + | |
423 | + | |
424 | +QMap<QString, Operation*> | |
425 | +Operations::all() | |
426 | +{ | |
427 | + QMap<QString, Operation*> operationMap; | |
428 | + | |
429 | + QList<GeglOperationClass *> *operations = new QList<GeglOperationClass *>; | |
430 | + operations = getOperationsClasses(operations, GEGL_TYPE_OPERATION); | |
431 | + | |
432 | + foreach (GeglOperationClass *op_class, *operations) { | |
433 | + QString name = QString::fromUtf8(op_class->name); | |
434 | + | |
435 | +#if GEGL_MINOR_VERSION >= 2 | |
436 | + QString categories = QString::fromUtf8(gegl_operation_get_key(op_class->name, "categories")); | |
437 | + QString description = QString::fromUtf8(gegl_operation_get_key(op_class->name, "description")); | |
438 | +#else | |
439 | + QString categories = QString::fromUtf8(op_class->categories); | |
440 | + QString description = QString::fromUtf8(op_class->description); | |
441 | +#endif | |
442 | + | |
443 | + QStringList categoryList = categories.split(":"); | |
444 | + Operation *operation = new Operation(name, description, categoryList, getPropertyMap(name)); | |
445 | + operationMap.insert(name, operation); | |
446 | + } | |
447 | + | |
448 | + return operationMap; | |
449 | +} | |
450 | + | |
451 | + | |
452 | +/* OperationProperty */ | |
453 | +OperationProperty::OperationProperty(QString name, QString description, QVariant defaultValue, | |
454 | + QVariant minValue, QVariant maxValue) | |
455 | + : QObject() | |
456 | + , mName(name) | |
457 | + , mShortDescription(description) | |
458 | + , mDefaultValue(defaultValue) | |
459 | + , mMinValue(minValue) | |
460 | + , mMaxValue(maxValue) | |
461 | +{ | |
462 | +} | |
463 | + | |
464 | +QString OperationProperty::name() | |
465 | +{ | |
466 | + return mName; | |
467 | +} | |
468 | + | |
469 | +QString OperationProperty::shortDescription() | |
470 | +{ | |
471 | + return mShortDescription; | |
472 | +} | |
473 | + | |
474 | +QVariant OperationProperty::minValue() | |
475 | +{ | |
476 | + return mMinValue; | |
477 | +} | |
478 | + | |
479 | +QVariant OperationProperty::maxValue() | |
480 | +{ | |
481 | + return mMaxValue; | |
482 | +} | |
483 | + | |
484 | +QVariant OperationProperty::defaultValue() | |
485 | +{ | |
486 | + return mDefaultValue; | |
487 | +} | |
488 | + | |
489 | + | |
490 | +/* Operation */ | |
491 | +Operation::Operation(QString name, QString description, | |
492 | + QStringList categoryList, QMap<QString, OperationProperty *> properties) | |
493 | + : QObject() | |
494 | + , mName(name) | |
495 | + , mCategories(categoryList) | |
496 | + , mDescription(description) | |
497 | + , mProperties(properties) | |
498 | +{ | |
499 | +} | |
500 | + | |
501 | +QString Operation::name() | |
502 | +{ | |
503 | + return mName; | |
504 | +} | |
505 | + | |
506 | +QString Operation::description() | |
507 | +{ | |
508 | + return mDescription; | |
509 | +} | |
510 | + | |
511 | +QStringList Operation::categories() | |
512 | +{ | |
513 | + return mCategories; | |
514 | +} | |
515 | + | |
516 | +QObjectList Operation::properties() | |
517 | +{ | |
518 | + QObjectList list; | |
519 | + | |
520 | + QStringList propertyNames = mProperties.keys(); | |
521 | + qSort(propertyNames); | |
522 | + | |
523 | + Q_FOREACH(const QString &propertyName, propertyNames) { | |
524 | + list.append(mProperties.value(propertyName)); | |
525 | + } | |
526 | + | |
527 | + return list; | |
528 | +} | |
529 | + | |
530 | +OperationsBrowser::OperationsBrowser(QObject *parent) | |
531 | + : QObject(parent) | |
532 | +{ | |
533 | + mAllOperations = Operations::all(); | |
534 | +} | |
535 | + | |
536 | +void OperationsBrowser::selectOperation(const QString &operationName) | |
537 | +{ | |
538 | + if (mSelectedOperation == operationName) { | |
539 | + return; | |
540 | + } | |
541 | + mSelectedOperation = operationName; | |
542 | + Q_EMIT selectedOperationChanged(); | |
543 | +} | |
544 | + | |
545 | +Operation *OperationsBrowser::selectedOperation() | |
546 | +{ | |
547 | + return mAllOperations.value(mSelectedOperation); | |
548 | +} | |
549 | + | |
550 | +QStringList OperationsBrowser::availableOperations() | |
551 | +{ | |
552 | + return mAllOperations.keys(); | |
553 | +} | |
554 | diff --git a/examples/common/operations.h b/examples/common/operations.h | |
555 | new file mode 100644 | |
556 | index 0000000..14a4952 | |
557 | --- /dev/null | |
558 | +++ b/examples/common/operations.h | |
559 | @@ -0,0 +1,101 @@ | |
560 | +#ifndef OPERATIONS_H | |
561 | +#define OPERATIONS_H | |
562 | + | |
563 | +#include <QObject> | |
564 | +#include <QtCore> | |
565 | +#include <glib-object.h> | |
566 | + | |
567 | +/* OperationProperty: | |
568 | + * | |
569 | + * Essentially a value-type. Only a QObject in order to use properties, | |
570 | + * to be able to expose such objects to QML. */ | |
571 | +class OperationProperty : public QObject | |
572 | +{ | |
573 | + Q_OBJECT | |
574 | +public: | |
575 | + explicit OperationProperty(QString name, QString description, QVariant defaultValue, | |
576 | + QVariant minValue, QVariant maxValue); | |
577 | + | |
578 | + QString name(); | |
579 | + QString shortDescription(); | |
580 | + | |
581 | + QVariant minValue(); | |
582 | + QVariant maxValue(); | |
583 | + QVariant defaultValue(); | |
584 | + | |
585 | + Q_PROPERTY (QString name READ name CONSTANT) | |
586 | + Q_PROPERTY (QString shortDescription READ shortDescription CONSTANT) | |
587 | + Q_PROPERTY (QVariant defaultValue READ defaultValue CONSTANT) | |
588 | + Q_PROPERTY (QVariant minValue READ minValue CONSTANT) | |
589 | + Q_PROPERTY (QVariant maxValue READ minValue CONSTANT) | |
590 | + | |
591 | +private: | |
592 | + QString mName; | |
593 | + QString mShortDescription; | |
594 | + GType mValueType; | |
595 | + QVariant mDefaultValue; | |
596 | + QVariant mMinValue; | |
597 | + QVariant mMaxValue; | |
598 | +}; | |
599 | + | |
600 | + | |
601 | +/* Operation: | |
602 | + * | |
603 | + * Essentially a value-type. Only a QObject in order to use properties, | |
604 | + * to be able to expose such objects to QML. */ | |
605 | +class Operation : public QObject | |
606 | +{ | |
607 | + Q_OBJECT | |
608 | +public: | |
609 | + explicit Operation(QString name, QString description, QStringList categoryList, | |
610 | + QMap<QString, OperationProperty *> properties); | |
611 | + | |
612 | + QString name(); | |
613 | + QObjectList properties(); | |
614 | + QString description(); | |
615 | + QStringList categories(); | |
616 | + | |
617 | + Q_PROPERTY (QString name READ name CONSTANT) | |
618 | + Q_PROPERTY (QObjectList properties READ properties CONSTANT) | |
619 | + Q_PROPERTY (QString description READ description CONSTANT) | |
620 | + Q_PROPERTY (QStringList categories READ categories CONSTANT) | |
621 | + | |
622 | +private: | |
623 | + QString mName; | |
624 | + GType mType; | |
625 | + QStringList mCategories; | |
626 | + QString mDescription; | |
627 | + QMap<QString, OperationProperty *> mProperties; | |
628 | +}; | |
629 | + | |
630 | + | |
631 | +class Operations | |
632 | +{ | |
633 | + | |
634 | +public: | |
635 | + /* Return all available operations. */ | |
636 | + static QMap<QString, Operation*> all(); | |
637 | +}; | |
638 | + | |
639 | +class OperationsBrowser : public QObject | |
640 | +{ | |
641 | + Q_OBJECT | |
642 | + | |
643 | +public: | |
644 | + explicit OperationsBrowser(QObject *parent = 0); | |
645 | + | |
646 | + Operation *selectedOperation(); | |
647 | + QStringList availableOperations(); | |
648 | + | |
649 | + Q_INVOKABLE void selectOperation(const QString &operationName); | |
650 | + Q_SIGNAL void selectedOperationChanged(); | |
651 | + | |
652 | + Q_PROPERTY (QObject * selectedOperation READ selectedOperation NOTIFY selectedOperationChanged) | |
653 | + Q_PROPERTY (QStringList availableOperations READ availableOperations CONSTANT) | |
654 | + | |
655 | +private: | |
656 | + QString mSelectedOperation; | |
657 | + QMap<QString, Operation*> mAllOperations; | |
658 | +}; | |
659 | + | |
660 | +#endif // OPERATIONS_H | |
661 | diff --git a/examples/common/paint-engine.cpp b/examples/common/paint-engine.cpp | |
662 | new file mode 100644 | |
663 | index 0000000..1baefa2 | |
664 | --- /dev/null | |
665 | +++ b/examples/common/paint-engine.cpp | |
666 | @@ -0,0 +1,104 @@ | |
667 | +/* This file is part of GEGL-QT | |
668 | + * | |
669 | + * GEGL-QT is free software; you can redistribute it and/or | |
670 | + * modify it under the terms of the GNU Lesser General Public | |
671 | + * License as published by the Free Software Foundation; either | |
672 | + * version 3 of the License, or (at your option) any later version. | |
673 | + * | |
674 | + * GEGL-QT is distributed in the hope that it will be useful, | |
675 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
676 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
677 | + * Lesser General Public License for more details. | |
678 | + * | |
679 | + * You should have received a copy of the GNU Lesser General Public | |
680 | + * License along with GEGL-QT; if not, see <http://www.gnu.org/licenses/>. | |
681 | + * | |
682 | + * Copyright (C) 2011 Jon Nordby <jononor@gmail.com> | |
683 | + */ | |
684 | + | |
685 | +#include "paint-engine.h" | |
686 | + | |
687 | +#include <gegl.h> | |
688 | + | |
689 | +/* Just holds the state used by PaintEngine. */ | |
690 | +struct PaintEnginePrivate | |
691 | +{ | |
692 | + GeglNode *graph; | |
693 | + GeglNode *outputNode; | |
694 | + GeglNode *strokeNode; | |
695 | + GeglPath *strokePath; | |
696 | + bool inStroke; | |
697 | +}; | |
698 | + | |
699 | +namespace { | |
700 | + const gchar * const DefaultColor = "black"; | |
701 | + float DefaultHardness = 0.3; | |
702 | + float DefaultLineWidth = 20.0; | |
703 | +} | |
704 | + | |
705 | +/* PaintEngine | |
706 | + * Trivial painting engine implemented using Gegl. | |
707 | + * Is not tied to QML, could be used in any toolkit. */ | |
708 | +PaintEngine::PaintEngine(QObject *parent) | |
709 | + : QObject(parent) | |
710 | + , priv(new PaintEnginePrivate()) | |
711 | +{ | |
712 | + priv->graph = gegl_node_new(); | |
713 | + priv->outputNode = gegl_node_new_child(priv->graph, | |
714 | + "operation", "gegl:nop", NULL); | |
715 | + priv->inStroke = false; | |
716 | + | |
717 | +} | |
718 | + | |
719 | +PaintEngine::~PaintEngine() | |
720 | +{ | |
721 | + g_object_unref(priv->graph); | |
722 | + // Nodes are owned by the graph | |
723 | + delete priv; | |
724 | +} | |
725 | + | |
726 | +QVariant | |
727 | +PaintEngine::outputNode() | |
728 | +{ | |
729 | + return qVariantFromValue(static_cast<void*>(priv->outputNode)); | |
730 | +} | |
731 | + | |
732 | +void | |
733 | +PaintEngine::positionChanged(double x, double y, bool buttonPressed) | |
734 | +{ | |
735 | + if (buttonPressed && !priv->inStroke) { | |
736 | + // Start new stroke | |
737 | + GeglNode *oldStrokeNode = priv->strokeNode; | |
738 | + priv->inStroke = true; | |
739 | + | |
740 | + priv->strokePath = gegl_path_new(); | |
741 | + gegl_path_append (priv->strokePath, 'M', x, y); | |
742 | + | |
743 | + priv->strokeNode = gegl_node_new_child(priv->graph, | |
744 | + "operation", "gegl:path", | |
745 | + "d", priv->strokePath, | |
746 | + "fill-opacity", 0.0, | |
747 | + "stroke", gegl_color_new (DefaultColor), | |
748 | + "stroke-width", DefaultLineWidth, | |
749 | + "stroke-hardness", DefaultHardness, | |
750 | + NULL); | |
751 | + if (oldStrokeNode) { | |
752 | + gegl_node_link_many(oldStrokeNode, priv->strokeNode, NULL); | |
753 | + } | |
754 | + gegl_node_link_many(priv->strokeNode, priv->outputNode, NULL); | |
755 | + | |
756 | + } else if (buttonPressed && priv->inStroke) { | |
757 | + // Add a new point to the stroke | |
758 | + gegl_path_append(priv->strokePath, 'L', x, y, NULL); | |
759 | + | |
760 | + } else if (!buttonPressed && priv->inStroke) { | |
761 | + // End stroke | |
762 | + priv->inStroke = false; | |
763 | + gegl_path_append (priv->strokePath, 'M', x, y); | |
764 | + g_object_unref (priv->strokePath); | |
765 | + | |
766 | + } else if (!buttonPressed && !priv->inStroke) { | |
767 | + // Do nothing | |
768 | + } | |
769 | + | |
770 | +} | |
771 | diff --git a/examples/common/paint-engine.h b/examples/common/paint-engine.h | |
772 | new file mode 100644 | |
773 | index 0000000..ac8751b | |
774 | --- /dev/null | |
775 | +++ b/examples/common/paint-engine.h | |
776 | @@ -0,0 +1,25 @@ | |
777 | +#ifndef QMLPAINTENGINE_H | |
778 | +#define QMLPAINTENGINE_H | |
779 | + | |
780 | +#include <QtCore> | |
781 | + | |
782 | +class PaintEnginePrivate; | |
783 | + | |
784 | +class PaintEngine : public QObject | |
785 | +{ | |
786 | + Q_OBJECT | |
787 | +public: | |
788 | + explicit PaintEngine(QObject *parent = 0); | |
789 | + ~PaintEngine(); | |
790 | + | |
791 | + Q_INVOKABLE QVariant outputNode(); | |
792 | + Q_INVOKABLE void positionChanged(double x, double y, bool buttonPressed); | |
793 | + | |
794 | +private: | |
795 | + void clear(); | |
796 | + | |
797 | +private: | |
798 | + PaintEnginePrivate* priv; | |
799 | +}; | |
800 | + | |
801 | +#endif // QMLPAINTENGINE_H | |
802 | diff --git a/examples/display-operation/display-operation.cpp b/examples/display-operation/display-operation.cpp | |
803 | index 7a1e7a6..046ad39 100644 | |
804 | --- a/examples/display-operation/display-operation.cpp | |
805 | +++ b/examples/display-operation/display-operation.cpp | |
806 | @@ -18,7 +18,7 @@ | |
807 | ||
808 | #include <gegl.h> | |
809 | ||
810 | -#include <QtGui/QApplication> | |
811 | +#include <QApplication> | |
812 | #include <QtCore> | |
813 | ||
814 | int main(int argc, char *argv[]) | |
815 | diff --git a/examples/display-operation/display-operation.pro b/examples/display-operation/display-operation.pro | |
816 | index aafc229..8ad6cf2 100644 | |
817 | --- a/examples/display-operation/display-operation.pro | |
818 | +++ b/examples/display-operation/display-operation.pro | |
819 | @@ -1,12 +1,12 @@ | |
820 | -SOURCES += display-operation.cpp | |
821 | +include(../../config.pri) | |
822 | ||
823 | QT += core gui | |
824 | +contains(HAVE_QT_WIDGETS, yes) { | |
825 | + QT += $$QT_WIDGETS | |
826 | +} | |
827 | ||
828 | -CONFIG += qt | |
829 | - | |
830 | -OBJECTS_DIR = .obj | |
831 | -MOC_DIR = .moc | |
832 | +SOURCES += display-operation.cpp | |
833 | ||
834 | # Does not link against gegl-qt as it is not used directly | |
835 | CONFIG += link_pkgconfig | |
836 | -PKGCONFIG += gegl | |
837 | +PKGCONFIG += $$GEGL_PKG | |
838 | diff --git a/examples/examples-common.pri b/examples/examples-common.pri | |
839 | index f87feac..21ee5a6 100644 | |
840 | --- a/examples/examples-common.pri | |
841 | +++ b/examples/examples-common.pri | |
842 | @@ -3,7 +3,10 @@ isEmpty(GEGLQT_CONFIG):error("config.pri not found") | |
843 | ||
844 | QT += core gui | |
845 | contains(HAVE_QT_DECLARATIVE, yes) { | |
846 | - QT += declarative | |
847 | + QT += $$QT_DECLARATIVE | |
848 | +} | |
849 | +contains(HAVE_QT_WIDGETS, yes) { | |
850 | + QT += $$QT_WIDGETS | |
851 | } | |
852 | ||
853 | CONFIG += qt | |
854 | @@ -19,5 +22,7 @@ isEmpty(USE_EXTERNAL_GEGLQT) { | |
855 | PKGCONFIG += $$GEGLQT_LIBNAME | |
856 | } | |
857 | ||
858 | +LIBS += ../../examples/common/lib$$GEGLQT_LIBNAME-examples-common.a | |
859 | + | |
860 | CONFIG += link_pkgconfig | |
861 | -PKGCONFIG += gegl | |
862 | +PKGCONFIG += $$GEGL_PKG | |
863 | diff --git a/examples/examples.pro b/examples/examples.pro | |
864 | index 0c8ab3e..3f8e47a 100644 | |
865 | --- a/examples/examples.pro | |
866 | +++ b/examples/examples.pro | |
867 | @@ -2,19 +2,29 @@ include(../config.pri) | |
868 | # TODO: install examples | |
869 | ||
870 | TEMPLATE = subdirs | |
871 | -SUBDIRS = \ | |
872 | - qwidget-basic \ | |
873 | - qgv-basic \ | |
874 | - qwidget-transformations \ | |
875 | - qwidget-autotransform \ | |
876 | - display-operation \ | |
877 | +CONFIG += ordered | |
878 | +SUBDIRS += \ | |
879 | + common \ | |
880 | ||
881 | -# Examples that depend on Qt Declarative (optional) | |
882 | -contains(HAVE_QT_DECLARATIVE, yes) { | |
883 | +# Examples that depend on Qt Widgets (optional) | |
884 | +contains(HAVE_QT_WIDGETS, yes) { | |
885 | + SUBDIRS += \ | |
886 | + qwidget-basic \ | |
887 | + qgv-basic \ | |
888 | + qwidget-transformations \ | |
889 | + qwidget-autotransform \ | |
890 | + display-operation \ | |
891 | + | |
892 | +} | |
893 | + | |
894 | +# Examples that depend on Qt Quick1(optional) | |
895 | +contains(HAVE_QT_QUICK1, yes) { | |
896 | SUBDIRS += \ | |
897 | qml-basic \ | |
898 | qml-paint \ | |
899 | - | |
900 | + qml-operations \ | |
901 | } | |
902 | ||
903 | -OTHER_FILES += pyside-basic.py python-nodeviewoptions.py | |
904 | +OTHER_FILES += \ | |
905 | + python/basic.py \ | |
906 | + python/nodeviewoptions.py \ | |
907 | diff --git a/examples/qgv-basic/qgv-basic.cpp b/examples/qgv-basic/qgv-basic.cpp | |
908 | index f6dcc63..8488741 100644 | |
909 | --- a/examples/qgv-basic/qgv-basic.cpp | |
910 | +++ b/examples/qgv-basic/qgv-basic.cpp | |
911 | @@ -20,6 +20,8 @@ | |
912 | ||
913 | #include <QtGui> | |
914 | #include <QtCore> | |
915 | +#include <QGraphicsView> | |
916 | +#include <QApplication> | |
917 | ||
918 | using namespace GeglQt; | |
919 | ||
920 | diff --git a/examples/qml-operations/.gitignore b/examples/qml-operations/.gitignore | |
921 | new file mode 100644 | |
922 | index 0000000..7e5b0d0 | |
923 | --- /dev/null | |
924 | +++ b/examples/qml-operations/.gitignore | |
925 | @@ -0,0 +1 @@ | |
926 | +qml-operations | |
927 | diff --git a/examples/qml-operations/OperationView.qml b/examples/qml-operations/OperationView.qml | |
928 | new file mode 100644 | |
929 | index 0000000..b7acff1 | |
930 | --- /dev/null | |
931 | +++ b/examples/qml-operations/OperationView.qml | |
932 | @@ -0,0 +1,47 @@ | |
933 | +import QtQuick 1.0 | |
934 | + | |
935 | +Rectangle { | |
936 | + | |
937 | + Text { | |
938 | + height: 40 | |
939 | + text: "Available operations" | |
940 | + font.pixelSize: 25 | |
941 | + } | |
942 | + | |
943 | + ListView { | |
944 | + id: operationsView | |
945 | + y: 50 | |
946 | + height: 200 | |
947 | + width: parent.width | |
948 | + model: browser.availableOperations | |
949 | + delegate: operationListDelegate | |
950 | + | |
951 | + //focus: true | |
952 | + } | |
953 | + | |
954 | + Component { | |
955 | + id: operationListDelegate | |
956 | + | |
957 | + Rectangle { | |
958 | + id: operationListDelegateRoot | |
959 | + width: parent.width | |
960 | + height: 15 | |
961 | + | |
962 | + Text { | |
963 | + text: modelData | |
964 | + } | |
965 | + | |
966 | + MouseArea { | |
967 | + anchors.fill: operationListDelegateRoot | |
968 | + onClicked: { | |
969 | + console.log("clickity") | |
970 | + operationsView.currentIndex = index | |
971 | + browser.selectOperation(modelData) | |
972 | + } | |
973 | + } | |
974 | + | |
975 | + } | |
976 | + } | |
977 | + | |
978 | +} | |
979 | + | |
980 | diff --git a/examples/qml-operations/SingleOperationView.qml b/examples/qml-operations/SingleOperationView.qml | |
981 | new file mode 100644 | |
982 | index 0000000..4dd0793 | |
983 | --- /dev/null | |
984 | +++ b/examples/qml-operations/SingleOperationView.qml | |
985 | @@ -0,0 +1,43 @@ | |
986 | +import QtQuick 1.0 | |
987 | + | |
988 | +Rectangle { | |
989 | + id: singleOperationView | |
990 | + | |
991 | + Rectangle { | |
992 | + height: 440 | |
993 | + width: 250 | |
994 | + | |
995 | + Text { | |
996 | + height: 40 | |
997 | + text: "Operation: " + browser.selectedOperation.name | |
998 | + font.pixelSize: 25 | |
999 | + } | |
1000 | + ListView { | |
1001 | + y: 50 | |
1002 | + height: 400 | |
1003 | + width: parent.width | |
1004 | + | |
1005 | + model: browser.selectedOperation.properties | |
1006 | + delegate: propertyDelegate | |
1007 | + | |
1008 | + } | |
1009 | + } | |
1010 | + | |
1011 | + Component { | |
1012 | + id: propertyDelegate | |
1013 | + | |
1014 | + Item { | |
1015 | + height: 80 | |
1016 | + | |
1017 | + Column { | |
1018 | + Text { text: modelData.name } | |
1019 | + Text { text: modelData.shortDescription } | |
1020 | + Text { text: modelData.defaultValue } | |
1021 | + Text { text: modelData.minValue } | |
1022 | + Text { text: modelData.maxValue } | |
1023 | + } | |
1024 | + | |
1025 | + } | |
1026 | + | |
1027 | + } | |
1028 | +} | |
1029 | diff --git a/examples/qml-operations/qml-operations.cpp b/examples/qml-operations/qml-operations.cpp | |
1030 | new file mode 100644 | |
1031 | index 0000000..17ee688 | |
1032 | --- /dev/null | |
1033 | +++ b/examples/qml-operations/qml-operations.cpp | |
1034 | @@ -0,0 +1,54 @@ | |
1035 | +/* This file is part of GEGL-QT | |
1036 | + * | |
1037 | + * GEGL-QT is free software; you can redistribute it and/or | |
1038 | + * modify it under the terms of the GNU Lesser General Public | |
1039 | + * License as published by the Free Software Foundation; either | |
1040 | + * version 3 of the License, or (at your option) any later version. | |
1041 | + * | |
1042 | + * GEGL-QT is distributed in the hope that it will be useful, | |
1043 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
1044 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1045 | + * Lesser General Public License for more details. | |
1046 | + * | |
1047 | + * You should have received a copy of the GNU Lesser General Public | |
1048 | + * License along with GEGL-QT; if not, see <http://www.gnu.org/licenses/>. | |
1049 | + * | |
1050 | + * Copyright (C) 2011 <jononor@gmail.com> | |
1051 | + */ | |
1052 | + | |
1053 | +#include <gegl-qt.h> | |
1054 | + | |
1055 | +#include <QtGui> | |
1056 | +#include <QtCore> | |
1057 | +#include <QtDeclarative> | |
1058 | + | |
1059 | +#include "../common/operations.h" | |
1060 | + | |
1061 | +int main(int argc, char *argv[]) | |
1062 | +{ | |
1063 | + QApplication a(argc, argv); | |
1064 | + gegl_init(&argc, &argv); | |
1065 | + Q_INIT_RESOURCE(qmloperations); | |
1066 | + | |
1067 | + OperationsBrowser browser; | |
1068 | + | |
1069 | + browser.selectOperation(browser.availableOperations().at(2)); | |
1070 | + | |
1071 | + QDeclarativeView view; | |
1072 | + | |
1073 | + view.rootContext()->setContextProperty("browser", &browser); | |
1074 | + | |
1075 | + view.setSource(QUrl("qrc:/qml-operations.qml")); | |
1076 | + view.show(); | |
1077 | + | |
1078 | + int retCode = a.exec(); | |
1079 | + | |
1080 | + // FIXME: free props | |
1081 | + gegl_exit(); | |
1082 | + return retCode; | |
1083 | +} | |
1084 | + | |
1085 | + | |
1086 | + | |
1087 | + | |
1088 | + | |
1089 | diff --git a/examples/qml-operations/qml-operations.pro b/examples/qml-operations/qml-operations.pro | |
1090 | new file mode 100644 | |
1091 | index 0000000..b67e905 | |
1092 | --- /dev/null | |
1093 | +++ b/examples/qml-operations/qml-operations.pro | |
1094 | @@ -0,0 +1,8 @@ | |
1095 | +include(../../config.pri) | |
1096 | +include(../examples-common.pri) | |
1097 | + | |
1098 | +SOURCES += qml-operations.cpp | |
1099 | +RESOURCES += qmloperations.qrc | |
1100 | +OTHER_FILES += qml-operations.qml \ | |
1101 | + OperationView.qml \ | |
1102 | + SingleOperationView.qml | |
1103 | diff --git a/examples/qml-operations/qml-operations.qml b/examples/qml-operations/qml-operations.qml | |
1104 | new file mode 100644 | |
1105 | index 0000000..ee4977f | |
1106 | --- /dev/null | |
1107 | +++ b/examples/qml-operations/qml-operations.qml | |
1108 | @@ -0,0 +1,19 @@ | |
1109 | +import QtQuick 1.0 | |
1110 | +// import GeglQt 0.1 | |
1111 | + | |
1112 | +Rectangle { | |
1113 | + width: 500 | |
1114 | + height: 500 | |
1115 | + | |
1116 | + OperationView { | |
1117 | + id: operationsList | |
1118 | + width: 300 // parent.width / 0.6 | |
1119 | + } | |
1120 | + | |
1121 | + SingleOperationView { | |
1122 | + id: singleOperation | |
1123 | + width: 200 // parent.width / 0.4 | |
1124 | + anchors.left: operationsList.right | |
1125 | + } | |
1126 | + | |
1127 | +} | |
1128 | diff --git a/examples/qml-operations/qmloperations.qrc b/examples/qml-operations/qmloperations.qrc | |
1129 | new file mode 100644 | |
1130 | index 0000000..492a3c4 | |
1131 | --- /dev/null | |
1132 | +++ b/examples/qml-operations/qmloperations.qrc | |
1133 | @@ -0,0 +1,7 @@ | |
1134 | +<RCC> | |
1135 | + <qresource prefix="/"> | |
1136 | + <file>qml-operations.qml</file> | |
1137 | + <file>SingleOperationView.qml</file> | |
1138 | + <file>OperationView.qml</file> | |
1139 | + </qresource> | |
1140 | +</RCC> | |
1141 | diff --git a/examples/qml-paint/qml-paint-engine.cpp b/examples/qml-paint/qml-paint-engine.cpp | |
1142 | deleted file mode 100644 | |
1143 | index 7837df1..0000000 | |
1144 | --- a/examples/qml-paint/qml-paint-engine.cpp | |
1145 | +++ /dev/null | |
1146 | @@ -1,104 +0,0 @@ | |
1147 | -/* This file is part of GEGL-QT | |
1148 | - * | |
1149 | - * GEGL-QT is free software; you can redistribute it and/or | |
1150 | - * modify it under the terms of the GNU Lesser General Public | |
1151 | - * License as published by the Free Software Foundation; either | |
1152 | - * version 3 of the License, or (at your option) any later version. | |
1153 | - * | |
1154 | - * GEGL-QT is distributed in the hope that it will be useful, | |
1155 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
1156 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1157 | - * Lesser General Public License for more details. | |
1158 | - * | |
1159 | - * You should have received a copy of the GNU Lesser General Public | |
1160 | - * License along with GEGL-QT; if not, see <http://www.gnu.org/licenses/>. | |
1161 | - * | |
1162 | - * Copyright (C) 2011 Jon Nordby <jononor@gmail.com> | |
1163 | - */ | |
1164 | - | |
1165 | -#include "qml-paint-engine.h" | |
1166 | - | |
1167 | -#include <gegl.h> | |
1168 | - | |
1169 | -/* Just holds the state used by PaintEngine. */ | |
1170 | -struct PaintEnginePrivate | |
1171 | -{ | |
1172 | - GeglNode *graph; | |
1173 | - GeglNode *outputNode; | |
1174 | - GeglNode *strokeNode; | |
1175 | - GeglPath *strokePath; | |
1176 | - bool inStroke; | |
1177 | -}; | |
1178 | - | |
1179 | -namespace { | |
1180 | - const gchar * const DefaultColor = "black"; | |
1181 | - float DefaultHardness = 0.3; | |
1182 | - float DefaultLineWidth = 20.0; | |
1183 | -} | |
1184 | - | |
1185 | -/* PaintEngine | |
1186 | - * Trivial painting engine implemented using Gegl. | |
1187 | - * Is not tied to QML, could be used in any toolkit. */ | |
1188 | -PaintEngine::PaintEngine(QObject *parent) | |
1189 | - : QObject(parent) | |
1190 | - , priv(new PaintEnginePrivate()) | |
1191 | -{ | |
1192 | - priv->graph = gegl_node_new(); | |
1193 | - priv->outputNode = gegl_node_new_child(priv->graph, | |
1194 | - "operation", "gegl:nop", NULL); | |
1195 | - priv->inStroke = false; | |
1196 | - | |
1197 | -} | |
1198 | - | |
1199 | -PaintEngine::~PaintEngine() | |
1200 | -{ | |
1201 | - g_object_unref(priv->graph); | |
1202 | - // Nodes are owned by the graph | |
1203 | - delete priv; | |
1204 | -} | |
1205 | - | |
1206 | -QVariant | |
1207 | -PaintEngine::outputNode() | |
1208 | -{ | |
1209 | - return qVariantFromValue(static_cast<void*>(priv->outputNode)); | |
1210 | -} | |
1211 | - | |
1212 | -void | |
1213 | -PaintEngine::positionChanged(double x, double y, bool buttonPressed) | |
1214 | -{ | |
1215 | - if (buttonPressed && !priv->inStroke) { | |
1216 | - // Start new stroke | |
1217 | - GeglNode *oldStrokeNode = priv->strokeNode; | |
1218 | - priv->inStroke = true; | |
1219 | - | |
1220 | - priv->strokePath = gegl_path_new(); | |
1221 | - gegl_path_append (priv->strokePath, 'M', x, y); | |
1222 | - | |
1223 | - priv->strokeNode = gegl_node_new_child(priv->graph, | |
1224 | - "operation", "gegl:path", | |
1225 | - "d", priv->strokePath, | |
1226 | - "fill-opacity", 0.0, | |
1227 | - "stroke", gegl_color_new (DefaultColor), | |
1228 | - "stroke-width", DefaultLineWidth, | |
1229 | - "stroke-hardness", DefaultHardness, | |
1230 | - NULL); | |
1231 | - if (oldStrokeNode) { | |
1232 | - gegl_node_link_many(oldStrokeNode, priv->strokeNode, NULL); | |
1233 | - } | |
1234 | - gegl_node_link_many(priv->strokeNode, priv->outputNode, NULL); | |
1235 | - | |
1236 | - } else if (buttonPressed && priv->inStroke) { | |
1237 | - // Add a new point to the stroke | |
1238 | - gegl_path_append(priv->strokePath, 'L', x, y, NULL); | |
1239 | - | |
1240 | - } else if (!buttonPressed && priv->inStroke) { | |
1241 | - // End stroke | |
1242 | - priv->inStroke = false; | |
1243 | - gegl_path_append (priv->strokePath, 'M', x, y); | |
1244 | - g_object_unref (priv->strokePath); | |
1245 | - | |
1246 | - } else if (!buttonPressed && !priv->inStroke) { | |
1247 | - // Do nothing | |
1248 | - } | |
1249 | - | |
1250 | -} | |
1251 | diff --git a/examples/qml-paint/qml-paint-engine.h b/examples/qml-paint/qml-paint-engine.h | |
1252 | deleted file mode 100644 | |
1253 | index ac8751b..0000000 | |
1254 | --- a/examples/qml-paint/qml-paint-engine.h | |
1255 | +++ /dev/null | |
1256 | @@ -1,25 +0,0 @@ | |
1257 | -#ifndef QMLPAINTENGINE_H | |
1258 | -#define QMLPAINTENGINE_H | |
1259 | - | |
1260 | -#include <QtCore> | |
1261 | - | |
1262 | -class PaintEnginePrivate; | |
1263 | - | |
1264 | -class PaintEngine : public QObject | |
1265 | -{ | |
1266 | - Q_OBJECT | |
1267 | -public: | |
1268 | - explicit PaintEngine(QObject *parent = 0); | |
1269 | - ~PaintEngine(); | |
1270 | - | |
1271 | - Q_INVOKABLE QVariant outputNode(); | |
1272 | - Q_INVOKABLE void positionChanged(double x, double y, bool buttonPressed); | |
1273 | - | |
1274 | -private: | |
1275 | - void clear(); | |
1276 | - | |
1277 | -private: | |
1278 | - PaintEnginePrivate* priv; | |
1279 | -}; | |
1280 | - | |
1281 | -#endif // QMLPAINTENGINE_H | |
1282 | diff --git a/examples/qml-paint/qml-paint.cpp b/examples/qml-paint/qml-paint.cpp | |
1283 | index c3d6756..3747b01 100644 | |
1284 | --- a/examples/qml-paint/qml-paint.cpp | |
1285 | +++ b/examples/qml-paint/qml-paint.cpp | |
1286 | @@ -16,7 +16,7 @@ | |
1287 | * Copyright (C) 2011 Jon Nordby <jononor@gmail.com> | |
1288 | */ | |
1289 | ||
1290 | -#include "qml-paint-engine.h" | |
1291 | +#include "../common/paint-engine.h" | |
1292 | ||
1293 | #include <gegl-qt.h> | |
1294 | #include <gegl-qt-declarative.h> | |
1295 | diff --git a/examples/qml-paint/qml-paint.pro b/examples/qml-paint/qml-paint.pro | |
1296 | index c282761..177f39b 100644 | |
1297 | --- a/examples/qml-paint/qml-paint.pro | |
1298 | +++ b/examples/qml-paint/qml-paint.pro | |
1299 | @@ -1,7 +1,7 @@ | |
1300 | include(../../config.pri) | |
1301 | include(../examples-common.pri) | |
1302 | ||
1303 | -SOURCES += qml-paint.cpp qml-paint-engine.cpp | |
1304 | -HEADERS += qml-paint-engine.h | |
1305 | +SOURCES += qml-paint.cpp | |
1306 | +HEADERS += | |
1307 | RESOURCES += qmlpaint.qrc | |
1308 | OTHER_FILES += qml-paint.qml | |
1309 | diff --git a/examples/qwidget-autotransform/autotransform-controls.cpp b/examples/qwidget-autotransform/autotransform-controls.cpp | |
1310 | index caee8ca..b9d1df2 100644 | |
1311 | --- a/examples/qwidget-autotransform/autotransform-controls.cpp | |
1312 | +++ b/examples/qwidget-autotransform/autotransform-controls.cpp | |
1313 | @@ -18,6 +18,8 @@ | |
1314 | ||
1315 | #include "autotransform-controls.h" | |
1316 | ||
1317 | +#include <QCheckBox> | |
1318 | +#include <QBoxLayout> | |
1319 | ||
1320 | AutoTransformControls::AutoTransformControls(QWidget *parent) : | |
1321 | QWidget(parent) | |
1322 | diff --git a/examples/qwidget-autotransform/autotransform-controls.h b/examples/qwidget-autotransform/autotransform-controls.h | |
1323 | index f2f69d2..c714246 100644 | |
1324 | --- a/examples/qwidget-autotransform/autotransform-controls.h | |
1325 | +++ b/examples/qwidget-autotransform/autotransform-controls.h | |
1326 | @@ -3,6 +3,9 @@ | |
1327 | ||
1328 | #include <QtGui> | |
1329 | #include <gegl-qt/nodeviewoptions.h> | |
1330 | +#include <QWidget> | |
1331 | + | |
1332 | +class QCheckBox; | |
1333 | ||
1334 | using namespace GeglQt; | |
1335 | ||
1336 | diff --git a/examples/qwidget-autotransform/qwidget-autotransform.cpp b/examples/qwidget-autotransform/qwidget-autotransform.cpp | |
1337 | index 8ad29d9..70ca365 100644 | |
1338 | --- a/examples/qwidget-autotransform/qwidget-autotransform.cpp | |
1339 | +++ b/examples/qwidget-autotransform/qwidget-autotransform.cpp | |
1340 | @@ -19,8 +19,9 @@ | |
1341 | #include <gegl-qt.h> | |
1342 | #include "autotransform-controls.h" | |
1343 | ||
1344 | -#include <QtGui/QApplication> | |
1345 | +#include <QApplication> | |
1346 | #include <QtCore> | |
1347 | +#include <QBoxLayout> | |
1348 | ||
1349 | using namespace GeglQt; | |
1350 | ||
1351 | diff --git a/examples/qwidget-basic/qwidget-basic.cpp b/examples/qwidget-basic/qwidget-basic.cpp | |
1352 | index 22cce16..14a59a8 100644 | |
1353 | --- a/examples/qwidget-basic/qwidget-basic.cpp | |
1354 | +++ b/examples/qwidget-basic/qwidget-basic.cpp | |
1355 | @@ -18,7 +18,7 @@ | |
1356 | ||
1357 | #include <gegl-qt.h> | |
1358 | ||
1359 | -#include <QtGui/QApplication> | |
1360 | +#include <QApplication> | |
1361 | #include <QtCore> | |
1362 | ||
1363 | using namespace GeglQt; | |
1364 | diff --git a/examples/qwidget-transformations/qwidget-transformations.cpp b/examples/qwidget-transformations/qwidget-transformations.cpp | |
1365 | index 9d93cc4..78f3fc7 100644 | |
1366 | --- a/examples/qwidget-transformations/qwidget-transformations.cpp | |
1367 | +++ b/examples/qwidget-transformations/qwidget-transformations.cpp | |
1368 | @@ -20,8 +20,9 @@ | |
1369 | ||
1370 | #include "transformation-controls.h" | |
1371 | ||
1372 | -#include <QtGui/QApplication> | |
1373 | +#include <QApplication> | |
1374 | #include <QtCore> | |
1375 | +#include <QBoxLayout> | |
1376 | ||
1377 | int main(int argc, char *argv[]) | |
1378 | { | |
1379 | diff --git a/examples/qwidget-transformations/transformation-controls.cpp b/examples/qwidget-transformations/transformation-controls.cpp | |
1380 | index 9978ec6..70bd697 100644 | |
1381 | --- a/examples/qwidget-transformations/transformation-controls.cpp | |
1382 | +++ b/examples/qwidget-transformations/transformation-controls.cpp | |
1383 | @@ -18,6 +18,9 @@ | |
1384 | ||
1385 | #include "transformation-controls.h" | |
1386 | ||
1387 | +#include <QDoubleSpinBox> | |
1388 | +#include <QBoxLayout> | |
1389 | + | |
1390 | TransformationControls::TransformationControls(QWidget *parent) : | |
1391 | QWidget(parent) | |
1392 | { | |
1393 | diff --git a/examples/qwidget-transformations/transformation-controls.h b/examples/qwidget-transformations/transformation-controls.h | |
1394 | index 7dfe553..e2bfb57 100644 | |
1395 | --- a/examples/qwidget-transformations/transformation-controls.h | |
1396 | +++ b/examples/qwidget-transformations/transformation-controls.h | |
1397 | @@ -1,9 +1,12 @@ | |
1398 | #ifndef TRANSFORMATIONCONTROLS_H | |
1399 | #define TRANSFORMATIONCONTROLS_H | |
1400 | ||
1401 | +#include <gegl-qt/nodeviewoptions.h> | |
1402 | + | |
1403 | #include <QtGui> | |
1404 | +#include <QWidget> | |
1405 | ||
1406 | -#include <gegl-qt/nodeviewoptions.h> | |
1407 | +class QDoubleSpinBox; | |
1408 | ||
1409 | using namespace GeglQt; | |
1410 | ||
1411 | diff --git a/gegl-qt.pro b/gegl-qt.pro | |
1412 | index c76d789..b9771a2 100644 | |
1413 | --- a/gegl-qt.pro | |
1414 | +++ b/gegl-qt.pro | |
1415 | @@ -10,17 +10,16 @@ isEmpty(USE_EXTERNAL_GEGLQT) { | |
1416 | contains(HAVE_PYSIDE, yes) { | |
1417 | SUBDIRS += pygegl-qt | |
1418 | } | |
1419 | - SUBDIRS += operations plugins doc | |
1420 | + contains(HAVE_QT_WIDGETS, yes) { | |
1421 | + SUBDIRS += operations | |
1422 | + } | |
1423 | + SUBDIRS += plugins doc | |
1424 | ||
1425 | } else { | |
1426 | !system(pkg-config --exists $$GEGLQT_LIBNAME):error("Could not find required dependency: GEGL-QT") | |
1427 | } | |
1428 | SUBDIRS += examples tests | |
1429 | ||
1430 | -# Check hard deps | |
1431 | -!system(pkg-config --exists gegl):error("Could not find required dependency: GEGL") | |
1432 | - | |
1433 | - | |
1434 | ### Extra targets for distribution ### | |
1435 | ||
1436 | DIST_NAME = $$GEGLQT_PROJECTNAME-$$GEGLQT_VERSION | |
1437 | @@ -40,7 +39,7 @@ dist.commands += git archive HEAD --prefix=$$DIST_NAME/ | bzip2 > $$TARBALL_PATH | |
1438 | # Creates a tarball release, extracts it, builds, runs tests and installs | |
1439 | QMAKE_EXTRA_TARGETS += distcheck | |
1440 | distcheck.target = distcheck | |
1441 | -distcheck.depends += dist; | |
1442 | +distcheck.depends += dist | |
1443 | distcheck.commands += mkdir -p $$OUT_PWD/distcheck-build; | |
1444 | distcheck.commands += cd $$OUT_PWD/distcheck-build; | |
1445 | distcheck.commands += tar -xf $$TARBALL_PATH; | |
1446 | diff --git a/gegl-qt/GeglQtWidgets b/gegl-qt/GeglQtWidgets | |
1447 | new file mode 100644 | |
1448 | index 0000000..70644ff | |
1449 | --- /dev/null | |
1450 | +++ b/gegl-qt/GeglQtWidgets | |
1451 | @@ -0,0 +1 @@ | |
1452 | +#include <gegl-qt-widgets.h> | |
1453 | diff --git a/gegl-qt/gegl-qt-widgets.h b/gegl-qt/gegl-qt-widgets.h | |
1454 | new file mode 100644 | |
1455 | index 0000000..f00b6ee | |
1456 | --- /dev/null | |
1457 | +++ b/gegl-qt/gegl-qt-widgets.h | |
1458 | @@ -0,0 +1,7 @@ | |
1459 | +#ifndef GEGLQTWIDGETS_H | |
1460 | +#define GEGLQTWIDGETS_H | |
1461 | + | |
1462 | +#include <gegl-qt/nodeviewwidget.h> | |
1463 | +#include <gegl-qt/nodeviewgraphicswidget.h> | |
1464 | + | |
1465 | +#endif // GEGLQTWIDGETS_H | |
1466 | diff --git a/gegl-qt/gegl-qt.h b/gegl-qt/gegl-qt.h | |
1467 | index d811b86..facf100 100644 | |
1468 | --- a/gegl-qt/gegl-qt.h | |
1469 | +++ b/gegl-qt/gegl-qt.h | |
1470 | @@ -1,10 +1,51 @@ | |
1471 | #ifndef GEGLQT_H | |
1472 | #define GEGLQT_H | |
1473 | ||
1474 | +/*! | |
1475 | + * \mainpage | |
1476 | + * | |
1477 | + * gegl-qt is an integration library for using GEGL in Qt-based applications. | |
1478 | + * | |
1479 | + * All recent versions of Qt4, possibly as far down as 4.2, are supported, | |
1480 | + * and all the different widget-paradims; QWidget, QGraphicsView and Qt Quick. | |
1481 | + * | |
1482 | + * gegl-qt can be used directly from C++, or from QML when build with Qt Quick, | |
1483 | + * or from Python when built with PySide. For usage examples, see | |
1484 | + * http://git.gnome.org/browse/gegl-qt/tree/examples | |
1485 | + * | |
1486 | + * gegl-qt is licensed under the GNU LGPL v3+ and is maintained by Jon Nordby | |
1487 | + * | |
1488 | + * - Homepage: http://www.gegl.org/gegl-qt | |
1489 | + * - Bugtracker: http://bugzilla.gnome.org, product: GEGL, component: gegl-qt | |
1490 | + * - Code: http://git.gnome.org/browse/gegl-qt/ | |
1491 | + * - Mailinglist: http://mail.gnome.org/mailman/listinfo/gegl-developer-list | |
1492 | + * | |
1493 | + * For information on how to build, see the README.txt file in the source code. | |
1494 | + * | |
1495 | + * \section Widgets | |
1496 | + * gegl-qt currently provides one type of widget, a NodeView. It shows the output of a GeglNode. | |
1497 | + * | |
1498 | + * - For QGraphicsView: GeglQt::NodeViewGraphicsWidget | |
1499 | + * - For Qt Quick: GeglQt::NodeViewDeclarativeItem | |
1500 | + * - For QWidget: GeglQt::NodeViewWidget | |
1501 | + */ | |
1502 | + | |
1503 | +/*! | |
1504 | + * \namespace GeglQt | |
1505 | + * | |
1506 | + * \brief Main namespace for gegl-qt | |
1507 | + * | |
1508 | + */ | |
1509 | + | |
1510 | // Node Views | |
1511 | #include <gegl-qt/nodeviewoptions.h> | |
1512 | ||
1513 | +// Code requiring QtWidgets | |
1514 | +// FIXME: don't include when not build with widgets | |
1515 | #include <gegl-qt/nodeviewwidget.h> | |
1516 | #include <gegl-qt/nodeviewgraphicswidget.h> | |
1517 | ||
1518 | +// Code requiring QtDeclarative is found in the | |
1519 | +// gegl-qt-declarative.h header | |
1520 | + | |
1521 | #endif // GEGLQT_H | |
1522 | diff --git a/gegl-qt/gegl-qt.pro b/gegl-qt/gegl-qt.pro | |
1523 | index cda2b3b..f396a05 100644 | |
1524 | --- a/gegl-qt/gegl-qt.pro | |
1525 | +++ b/gegl-qt/gegl-qt.pro | |
1526 | @@ -9,41 +9,66 @@ VERSION = $$GEGLQT_VERSION | |
1527 | ||
1528 | QT += core gui | |
1529 | contains(HAVE_QT_DECLARATIVE, yes) { | |
1530 | - QT += declarative | |
1531 | + QT += $$QT_DECLARATIVE | |
1532 | +} | |
1533 | +contains(HAVE_QT_WIDGETS, yes) { | |
1534 | + QT += $$QT_WIDGETS | |
1535 | } | |
1536 | ||
1537 | CONFIG += link_pkgconfig | |
1538 | -PKGCONFIG += gegl | |
1539 | +PKGCONFIG += $$GEGL_PKG | |
1540 | ||
1541 | OBJECTS_DIR = .obj | |
1542 | MOC_DIR = .moc | |
1543 | ||
1544 | PUBLIC_SOURCES += \ | |
1545 | - nodeviewwidget.cpp \ | |
1546 | - nodeviewgraphicswidget.cpp \ | |
1547 | nodeviewoptions.cpp \ | |
1548 | ||
1549 | +PUBLIC_HEADERS += \ | |
1550 | + nodeviewoptions.h \ | |
1551 | + | |
1552 | TOP_HEADERS += gegl-qt.h GeglQt | |
1553 | ||
1554 | -PUBLIC_HEADERS = \ | |
1555 | - nodeviewwidget.h \ | |
1556 | - nodeviewgraphicswidget.h \ | |
1557 | - nodeviewoptions.h \ | |
1558 | +#PRIVATE_HEADERS += \ | |
1559 | + | |
1560 | +#PRIVATE_SOURCES += \ | |
1561 | + | |
1562 | +contains(HAVE_QT_WIDGETS, yes) { | |
1563 | + PUBLIC_SOURCES += \ | |
1564 | + nodeviewwidget.cpp \ | |
1565 | + nodeviewgraphicswidget.cpp \ | |
1566 | + | |
1567 | + PUBLIC_HEADERS += \ | |
1568 | + nodeviewwidget.h \ | |
1569 | + nodeviewgraphicswidget.h \ | |
1570 | + | |
1571 | + # FIXME: remove QtWidgets dependency from NodeViewImplementation | |
1572 | + PRIVATE_HEADERS += \ | |
1573 | + internal/nodeviewimplementation.h \ | |
1574 | + internal/nodeviewchilditem.h \ | |
1575 | + | |
1576 | + PRIVATE_SOURCES += \ | |
1577 | + internal/nodeviewimplementation.cpp \ | |
1578 | + internal/nodeviewchilditem.cpp \ | |
1579 | + | |
1580 | + TOP_HEADERS += gegl-qt-widgets.h GeglQtWidgets | |
1581 | +} | |
1582 | ||
1583 | # Code that depends on Qt Declarative (optional) | |
1584 | contains(HAVE_QT_DECLARATIVE, yes) { | |
1585 | - PUBLIC_HEADERS += nodeviewdeclarativeitem.h | |
1586 | - PUBLIC_SOURCES += nodeviewdeclarativeitem.cpp | |
1587 | - TOP_HEADERS += gegl-qt-declarative.h GeglQtDeclarative | |
1588 | -} | |
1589 | ||
1590 | -PRIVATE_HEADERS = \ | |
1591 | - internal/nodeviewimplementation.h \ | |
1592 | - internal/nodeviewchilditem.h \ | |
1593 | + contains(QT_MAJOR_VERSION, 5) { | |
1594 | + #PUBLIC_HEADERS += | |
1595 | + #PUBLIC_SOURCES += | |
1596 | + } | |
1597 | + | |
1598 | + contains(HAVE_QT_QUICK1, yes) { | |
1599 | + PUBLIC_HEADERS += nodeviewdeclarativeitem.h | |
1600 | + PUBLIC_SOURCES += nodeviewdeclarativeitem.cpp | |
1601 | + } | |
1602 | ||
1603 | -PRIVATE_SOURCES = \ | |
1604 | - internal/nodeviewimplementation.cpp \ | |
1605 | - internal/nodeviewchilditem.cpp \ | |
1606 | + TOP_HEADERS += gegl-qt-declarative.h GeglQtDeclarative | |
1607 | +} | |
1608 | ||
1609 | SOURCES += $$PUBLIC_SOURCES $$PRIVATE_SOURCES | |
1610 | ||
1611 | @@ -60,16 +85,16 @@ private_headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME/$$GEGLQT_PROJEC | |
1612 | top_headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME | |
1613 | top_headers.files = $$TOP_HEADERS | |
1614 | ||
1615 | -outputFiles(gegl-qt4-0.1.pc) | |
1616 | +outputFiles(gegl-qt$$QT_MAJOR_VERSION-$${GEGLQT_API_VERSION}.pc) | |
1617 | ||
1618 | pkgconfig.path = $$GEGLQT_INSTALL_LIBS/pkgconfig | |
1619 | -pkgconfig.files = gegl-qt4-0.1.pc | |
1620 | +pkgconfig.files = gegl-qt$$QT_MAJOR_VERSION-$${GEGLQT_API_VERSION}.pc | |
1621 | ||
1622 | INSTALLS += target headers top_headers pkgconfig | |
1623 | !isEmpty(GEGLQT_INSTALL_PRIVATE_HEADERS) { | |
1624 | INSTALLS += private_headers | |
1625 | } | |
1626 | ||
1627 | -OTHER_FILES = \ | |
1628 | - gegl-qt4-0.1.pc.in \ | |
1629 | +OTHER_FILES += \ | |
1630 | + gegl-qt$$QT_MAJOR_VERSION-$${GEGLQT_API_VERSION}.pc.in \ | |
1631 | ||
1632 | diff --git a/gegl-qt/gegl-qt4-0.1.pc.in b/gegl-qt/gegl-qt4-0.1.pc.in | |
1633 | index a663f55..820f5d4 100644 | |
1634 | --- a/gegl-qt/gegl-qt4-0.1.pc.in | |
1635 | +++ b/gegl-qt/gegl-qt4-0.1.pc.in | |
1636 | @@ -6,7 +6,7 @@ includedir=@GEGLQT_INSTALL_HEADERS@ | |
1637 | Name: GEGL-QT | |
1638 | Description: Convenience library for using Gegl in Qt applications | |
1639 | Version: @GEGLQT_VERSION@ | |
1640 | -Requires: gegl @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui | |
1641 | +Requires: @GEGL_PKG@ @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui | |
1642 | Cflags: -I${includedir}/@GEGLQT_LIBNAME@ | |
1643 | Libs: -L${libdir} -l@GEGLQT_LIBNAME@ | |
1644 | ||
1645 | diff --git a/gegl-qt/gegl-qt5-0.1.pc.in b/gegl-qt/gegl-qt5-0.1.pc.in | |
1646 | new file mode 100644 | |
1647 | index 0000000..820f5d4 | |
1648 | --- /dev/null | |
1649 | +++ b/gegl-qt/gegl-qt5-0.1.pc.in | |
1650 | @@ -0,0 +1,12 @@ | |
1651 | +prefix=@GEGLQT_INSTALL_PREFIX@ | |
1652 | +exec_prefix=@GEGLQT_INSTALL_PREFIX@ | |
1653 | +libdir=@GEGLQT_INSTALL_LIBS@ | |
1654 | +includedir=@GEGLQT_INSTALL_HEADERS@ | |
1655 | + | |
1656 | +Name: GEGL-QT | |
1657 | +Description: Convenience library for using Gegl in Qt applications | |
1658 | +Version: @GEGLQT_VERSION@ | |
1659 | +Requires: @GEGL_PKG@ @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui | |
1660 | +Cflags: -I${includedir}/@GEGLQT_LIBNAME@ | |
1661 | +Libs: -L${libdir} -l@GEGLQT_LIBNAME@ | |
1662 | + | |
1663 | diff --git a/gegl-qt/internal/nodeviewchilditem.cpp b/gegl-qt/internal/nodeviewchilditem.cpp | |
1664 | index a119170..4a0aede 100644 | |
1665 | --- a/gegl-qt/internal/nodeviewchilditem.cpp | |
1666 | +++ b/gegl-qt/internal/nodeviewchilditem.cpp | |
1667 | @@ -20,6 +20,7 @@ | |
1668 | #include "internal/nodeviewimplementation.h" | |
1669 | ||
1670 | #include <QtDebug> // TEMP | |
1671 | +#include <QStyleOptionGraphicsItem> | |
1672 | ||
1673 | using namespace GeglQt; | |
1674 | ||
1675 | diff --git a/gegl-qt/internal/nodeviewimplementation.cpp b/gegl-qt/internal/nodeviewimplementation.cpp | |
1676 | index e0364ec..784632c 100644 | |
1677 | --- a/gegl-qt/internal/nodeviewimplementation.cpp | |
1678 | +++ b/gegl-qt/internal/nodeviewimplementation.cpp | |
1679 | @@ -108,7 +108,7 @@ NodeViewImplementation::~NodeViewImplementation() | |
1680 | { | |
1681 | delete timer; | |
1682 | if (processor) { | |
1683 | - gegl_processor_destroy(processor); | |
1684 | + g_object_unref(processor); | |
1685 | } | |
1686 | delete mOptions; | |
1687 | delete mChildItem; | |
1688 | @@ -133,7 +133,7 @@ NodeViewImplementation::setInputNode(GeglNode *node) | |
1689 | g_object_unref(mInputNode); | |
1690 | } | |
1691 | if (processor) { | |
1692 | - gegl_processor_destroy(processor); | |
1693 | + g_object_unref(processor); | |
1694 | processor = 0; | |
1695 | } | |
1696 | ||
1697 | @@ -167,8 +167,7 @@ NodeViewImplementation::setOptions(NodeViewOptions *newOptions) | |
1698 | return; | |
1699 | } | |
1700 | ||
1701 | - /* FIXME: Don't take complete ownership of the options instance. | |
1702 | - * Use refcounting instead? */ | |
1703 | + /* XXX: Don't take complete ownership of the options instance, use QSharedPointer instead? */ | |
1704 | delete mOptions; | |
1705 | mOptions = newOptions ? newOptions : new NodeViewOptions(); | |
1706 | ||
1707 | @@ -319,7 +318,7 @@ NodeViewImplementation::paint(QPainter *painter, const QRectF & viewRect) | |
1708 | guchar *buffer = NULL; | |
1709 | GeglRectangle roi; | |
1710 | ||
1711 | - Babl *format = babl_format("B'aG'aR'aA u8"); | |
1712 | + const Babl *format = babl_format("B'aG'aR'aA u8"); | |
1713 | ||
1714 | if (!format) { | |
1715 | qCritical() << "Unknown Babl format"; | |
1716 | diff --git a/gegl-qt/internal/nodeviewimplementation.h b/gegl-qt/internal/nodeviewimplementation.h | |
1717 | index 02eaac9..e25d390 100644 | |
1718 | --- a/gegl-qt/internal/nodeviewimplementation.h | |
1719 | +++ b/gegl-qt/internal/nodeviewimplementation.h | |
1720 | @@ -19,11 +19,13 @@ | |
1721 | * Copyright (C) 2011 Jon Nordby <jononor@gmail.com> | |
1722 | */ | |
1723 | ||
1724 | -#include <Qt/QtGui> | |
1725 | +#include <QtGui> | |
1726 | #include <gegl.h> | |
1727 | ||
1728 | #include <gegl-qt/nodeviewoptions.h> | |
1729 | ||
1730 | +class QGraphicsItem; | |
1731 | + | |
1732 | namespace GeglQt { | |
1733 | ||
1734 | class NodeViewChildItem; | |
1735 | diff --git a/gegl-qt/nodeviewdeclarativeitem.cpp b/gegl-qt/nodeviewdeclarativeitem.cpp | |
1736 | index d60683c..7a25f18 100644 | |
1737 | --- a/gegl-qt/nodeviewdeclarativeitem.cpp | |
1738 | +++ b/gegl-qt/nodeviewdeclarativeitem.cpp | |
1739 | @@ -104,7 +104,7 @@ NodeViewDeclarativeItem::paint(QPainter *painter, | |
1740 | QWidget *widget) | |
1741 | { | |
1742 | // Handled by private class | |
1743 | - Q_UNUSED(widget); | |
1744 | + Q_UNUSED(painter); | |
1745 | Q_UNUSED(option); | |
1746 | Q_UNUSED(widget); | |
1747 | } | |
1748 | diff --git a/gegl-qt/nodeviewdeclarativeitem.h b/gegl-qt/nodeviewdeclarativeitem.h | |
1749 | index a844643..ee6e544 100644 | |
1750 | --- a/gegl-qt/nodeviewdeclarativeitem.h | |
1751 | +++ b/gegl-qt/nodeviewdeclarativeitem.h | |
1752 | @@ -20,6 +20,7 @@ | |
1753 | */ | |
1754 | ||
1755 | #include <QtDeclarative> | |
1756 | +#include <QDeclarativeItem> | |
1757 | #include <QtCore> | |
1758 | #include <gegl.h> | |
1759 | ||
1760 | @@ -31,6 +32,12 @@ namespace GeglQt { | |
1761 | ||
1762 | class NodeViewImplementation; | |
1763 | ||
1764 | +/*! | |
1765 | + * QDeclarativeItem showing the output of a GeglNode | |
1766 | + * | |
1767 | + * Typically used from QML, but can also be instantiated by C++. | |
1768 | + */ | |
1769 | + | |
1770 | class NodeViewDeclarativeItem : public QDeclarativeItem | |
1771 | { | |
1772 | Q_OBJECT | |
1773 | @@ -38,24 +45,40 @@ public: | |
1774 | explicit NodeViewDeclarativeItem(QDeclarativeItem *parent = 0); | |
1775 | ~NodeViewDeclarativeItem(); | |
1776 | ||
1777 | - // QVariant is used so that GeglNode* can be passed through QML | |
1778 | - void setInputNodeVariant(QVariant node); | |
1779 | - QVariant inputNodeVariant(); | |
1780 | - | |
1781 | - void setInputNode(GeglNodePtr node); | |
1782 | + /*! The node this widget displays. | |
1783 | + * \return The GeglNode | |
1784 | + */ | |
1785 | GeglNodePtr inputNode(); | |
1786 | ||
1787 | - Q_PROPERTY(QVariant inputNode READ inputNodeVariant WRITE setInputNodeVariant NOTIFY inputNodeChanged) | |
1788 | + /*! Set the node to display | |
1789 | + * \param node The GeglNode to display, or 0 to unset | |
1790 | + * | |
1791 | + * Will reference the GeglNode. | |
1792 | + */ | |
1793 | + void setInputNode(GeglNodePtr node); | |
1794 | ||
1795 | + /*! The options used on this widget. */ | |
1796 | GeglQt::NodeViewOptions *options() const; | |
1797 | + | |
1798 | + //! \internal | |
1799 | void setOptions(GeglQt::NodeViewOptions* newOptions); | |
1800 | ||
1801 | Q_PROPERTY(GeglQt::NodeViewOptions * options READ options WRITE setOptions NOTIFY optionsChanged) | |
1802 | ||
1803 | - //! reimpl | |
1804 | + // QVariant is used so that GeglNode* can be passed through QML | |
1805 | + //! \internal | |
1806 | + void setInputNodeVariant(QVariant node); | |
1807 | + //! \internal | |
1808 | + QVariant inputNodeVariant(); | |
1809 | + | |
1810 | + Q_PROPERTY(QVariant inputNode READ inputNodeVariant WRITE setInputNodeVariant NOTIFY inputNodeChanged) | |
1811 | + | |
1812 | +public: | |
1813 | + //! \internal | |
1814 | void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry); | |
1815 | + | |
1816 | + //! \internal | |
1817 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
1818 | - //! reimpl end | |
1819 | ||
1820 | Q_SIGNALS: | |
1821 | void inputNodeChanged(); | |
1822 | diff --git a/gegl-qt/nodeviewgraphicswidget.h b/gegl-qt/nodeviewgraphicswidget.h | |
1823 | index 7df37fe..da644b7 100644 | |
1824 | --- a/gegl-qt/nodeviewgraphicswidget.h | |
1825 | +++ b/gegl-qt/nodeviewgraphicswidget.h | |
1826 | @@ -30,6 +30,10 @@ namespace GeglQt { | |
1827 | ||
1828 | class NodeViewImplementation; | |
1829 | ||
1830 | +/*! | |
1831 | + * QGraphicsWidget showing the output of a GeglNode | |
1832 | + */ | |
1833 | + | |
1834 | class NodeViewGraphicsWidget : public QGraphicsWidget | |
1835 | { | |
1836 | Q_OBJECT | |
1837 | @@ -37,14 +41,24 @@ public: | |
1838 | explicit NodeViewGraphicsWidget(QGraphicsItem *parent = 0); | |
1839 | ~NodeViewGraphicsWidget(); | |
1840 | ||
1841 | - void setInputNode(GeglNodePtr node); | |
1842 | + /*! The node this widget displays. | |
1843 | + * \return The GeglNode | |
1844 | + */ | |
1845 | GeglNodePtr inputNode(); | |
1846 | ||
1847 | + /*! Set the node to display | |
1848 | + * \param node The GeglNode to display, or 0 to unset | |
1849 | + * | |
1850 | + * Will reference the GeglNode. | |
1851 | + */ | |
1852 | + void setInputNode(GeglNodePtr node); | |
1853 | + | |
1854 | + /*! The options used on this widget. */ | |
1855 | GeglQt::NodeViewOptions *options() const; | |
1856 | ||
1857 | - //! reimpl | |
1858 | +public: | |
1859 | + //! \internal | |
1860 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
1861 | - //! reimpl end | |
1862 | ||
1863 | private Q_SLOTS: | |
1864 | void invalidate(QRectF rect); | |
1865 | diff --git a/gegl-qt/nodeviewoptions.cpp b/gegl-qt/nodeviewoptions.cpp | |
1866 | index 4620b43..62d771c 100644 | |
1867 | --- a/gegl-qt/nodeviewoptions.cpp | |
1868 | +++ b/gegl-qt/nodeviewoptions.cpp | |
1869 | @@ -31,34 +31,7 @@ struct GeglQtViewOptionsPrivate { | |
1870 | NodeViewOptions::AutoScale autoScale; | |
1871 | }; | |
1872 | ||
1873 | -/* | |
1874 | - TODO: support more options | |
1875 | - | |
1876 | - double rotation; | |
1877 | -*/ | |
1878 | - | |
1879 | - | |
1880 | -/* FIXME: find a better name? */ | |
1881 | -/* TODO: evaluate what is the best behavior when the Auto options are enabled, | |
1882 | - * and trying to use the manual setters as well. | |
1883 | - * | |
1884 | - * Currently enabling autoCenter/autoScaling means that | |
1885 | - * - The view implementation will change the scale/translation values | |
1886 | - * - Using the manual setters will set the value, but it will be overwritten as soon | |
1887 | - * the auto value update is triggered (by viewport/model changes, et.c) | |
1888 | - * | |
1889 | - * A challenge is that GeglQtViewImplementation should still be able to set the values | |
1890 | - * when autocenter/autoscale is enabled. | |
1891 | - * | |
1892 | - * Possible behaviors include | |
1893 | - * 0. Ignoring values from explicit setters | |
1894 | - * Suprising that when toggling auto enable/disable, the previously manually set values will be gone? | |
1895 | - * 1. Setting scale/translation manually will quit auto mode. | |
1896 | - * Could be suprising if one accidentically calls it? | |
1897 | - * 2. Allowing one to set scale/translation manually, but they are overridden when auto mode is on | |
1898 | - * Suprising that calling setSomething(), and then something() would not return the same value; | |
1899 | - * or that scale() returns a different value from the current transformation (and that transformation() indicates) | |
1900 | - */ | |
1901 | +/* TODO: support rotation */ | |
1902 | NodeViewOptions::NodeViewOptions(QObject *parent) | |
1903 | : QObject(parent) | |
1904 | , priv(new GeglQtViewOptionsPrivate()) | |
1905 | diff --git a/gegl-qt/nodeviewoptions.h b/gegl-qt/nodeviewoptions.h | |
1906 | index a50c1b1..3e3a30d 100644 | |
1907 | --- a/gegl-qt/nodeviewoptions.h | |
1908 | +++ b/gegl-qt/nodeviewoptions.h | |
1909 | @@ -26,6 +26,15 @@ class GeglQtViewOptionsPrivate; | |
1910 | namespace GeglQt | |
1911 | { | |
1912 | ||
1913 | +/*! | |
1914 | + * Options available for NodeView widgets | |
1915 | + * | |
1916 | + * Note: when enabling autoCenter/autoScaling the values for translation/scale | |
1917 | + * will be automatically managed. Values set manually will be overwritten. | |
1918 | + * | |
1919 | + * \sa NodeViewWidget, NodeViewGraphicsWidget, NodeViewDeclarativeItem | |
1920 | + */ | |
1921 | + | |
1922 | class NodeViewOptions : public QObject | |
1923 | { | |
1924 | Q_OBJECT | |
1925 | diff --git a/gegl-qt/nodeviewwidget.cpp b/gegl-qt/nodeviewwidget.cpp | |
1926 | index e7643dd..967cee1 100644 | |
1927 | --- a/gegl-qt/nodeviewwidget.cpp | |
1928 | +++ b/gegl-qt/nodeviewwidget.cpp | |
1929 | @@ -19,7 +19,7 @@ | |
1930 | #include "nodeviewwidget.h" | |
1931 | #include "internal/nodeviewimplementation.h" | |
1932 | ||
1933 | -#include <Qt/QtGui> | |
1934 | +#include <QtGui> | |
1935 | #include <QtDebug> | |
1936 | ||
1937 | using namespace GeglQt; | |
1938 | @@ -84,7 +84,7 @@ NodeViewWidget::viewportSizeChangeRequested(QSizeF requestedSize) | |
1939 | resize(requestedSize.toSize()); | |
1940 | } | |
1941 | ||
1942 | -//! \brief Draw the view of GeglNode onto the widget | |
1943 | +// Draw the view of GeglNode onto the widget | |
1944 | void | |
1945 | NodeViewWidget::paintEvent(QPaintEvent *event) | |
1946 | { | |
1947 | diff --git a/gegl-qt/nodeviewwidget.h b/gegl-qt/nodeviewwidget.h | |
1948 | index 7ecf66b..d755dc4 100644 | |
1949 | --- a/gegl-qt/nodeviewwidget.h | |
1950 | +++ b/gegl-qt/nodeviewwidget.h | |
1951 | @@ -19,7 +19,7 @@ | |
1952 | * Copyright (C) 2011 Jon Nordby <jononor@gmail.com> | |
1953 | */ | |
1954 | ||
1955 | -#include <QtGui/QWidget> | |
1956 | +#include <QWidget> | |
1957 | #include <gegl.h> | |
1958 | ||
1959 | #include <gegl-qt/nodeviewoptions.h> | |
1960 | @@ -30,6 +30,10 @@ namespace GeglQt { | |
1961 | ||
1962 | class NodeViewImplementation; | |
1963 | ||
1964 | +/*! | |
1965 | + * QWidget showing the output of a GeglNode | |
1966 | + */ | |
1967 | + | |
1968 | class NodeViewWidget : public QWidget | |
1969 | { | |
1970 | Q_OBJECT | |
1971 | @@ -38,15 +42,27 @@ public: | |
1972 | NodeViewWidget(QWidget *parent = 0); | |
1973 | ~NodeViewWidget(); | |
1974 | ||
1975 | + /*! The node this widget displays. | |
1976 | + * \return The GeglNode | |
1977 | + */ | |
1978 | GeglNodePtr inputNode() const; | |
1979 | + | |
1980 | + /*! Set the node to display | |
1981 | + * \param node The GeglNode to display, or 0 to unset | |
1982 | + * | |
1983 | + * Will reference the GeglNode. | |
1984 | + */ | |
1985 | void setInputNode(GeglNodePtr node); | |
1986 | ||
1987 | + /*! The options used on this widget. */ | |
1988 | GeglQt::NodeViewOptions *options() const; | |
1989 | ||
1990 | - //! \reimpl | |
1991 | +public: | |
1992 | + //! \internal | |
1993 | virtual void paintEvent(QPaintEvent *event); | |
1994 | + | |
1995 | + //! \internal | |
1996 | virtual void resizeEvent(QResizeEvent *event); | |
1997 | - //! \reimpl end | |
1998 | ||
1999 | private Q_SLOTS: | |
2000 | void invalidate(QRectF rect); | |
2001 | diff --git a/operations/geglqtdisplay.cpp b/operations/geglqtdisplay.cpp | |
2002 | index af8270b..71d5d64 100644 | |
2003 | --- a/operations/geglqtdisplay.cpp | |
2004 | +++ b/operations/geglqtdisplay.cpp | |
2005 | @@ -105,9 +105,17 @@ gegl_chant_class_init (GeglChantClass *klass) | |
2006 | operation_class->attach = attach; | |
2007 | G_OBJECT_CLASS (klass)->dispose = dispose; | |
2008 | ||
2009 | - operation_class->name = "gegl-qt4:display"; | |
2010 | +#if GEGL_MINOR_VERSION >= 2 && GEGL_MICRO_VERSION >= 0 | |
2011 | + gegl_operation_class_set_keys (operation_class, | |
2012 | + "name", GEGLQT_OPERATION_PREFIX":display", | |
2013 | + "categories", "output", | |
2014 | + "description", "Displays the input buffer in a Qt window .", | |
2015 | + NULL); | |
2016 | +#else /* GEGL < 0.2.0 */ | |
2017 | + operation_class->name = GEGLQT_OPERATION_PREFIX":display"; | |
2018 | operation_class->categories = "output"; | |
2019 | operation_class->description = "Displays the input buffer in a Qt window."; | |
2020 | +#endif | |
2021 | } | |
2022 | ||
2023 | #endif | |
2024 | diff --git a/operations/operations.pro b/operations/operations.pro | |
2025 | index edce86d..474bef8 100644 | |
2026 | --- a/operations/operations.pro | |
2027 | +++ b/operations/operations.pro | |
2028 | @@ -1,4 +1,3 @@ | |
2029 | - | |
2030 | include(../config.pri) | |
2031 | ||
2032 | TARGET = $$GEGLQT_BASELIBNAME-display | |
2033 | @@ -9,9 +8,16 @@ CONFIG += qt no_keywords plugin | |
2034 | VERSION = $$GEGLQT_VERSION | |
2035 | ||
2036 | QT += core gui | |
2037 | +contains(HAVE_QT_WIDGETS, yes) { | |
2038 | + QT += $$QT_WIDGETS | |
2039 | +} | |
2040 | + | |
2041 | +GEGLQT_OPERATION_PREFIX = gegl-qt$$QT_MAJOR_VERSION | |
2042 | + | |
2043 | +DEFINES += GEGLQT_OPERATION_PREFIX=\\\"$${GEGLQT_OPERATION_PREFIX}\\\" | |
2044 | ||
2045 | CONFIG += link_pkgconfig | |
2046 | -PKGCONFIG += gegl | |
2047 | +PKGCONFIG += $$GEGL_PKG | |
2048 | ||
2049 | INCLUDEPATH += ../gegl-qt .. # .. because public include have gegl-qt/ prefix | |
2050 | LIBS += -L../gegl-qt -l$$GEGLQT_LIBNAME | |
2051 | diff --git a/plugins/plugins.pro b/plugins/plugins.pro | |
2052 | index 6d9a667..12460bb 100644 | |
2053 | --- a/plugins/plugins.pro | |
2054 | +++ b/plugins/plugins.pro | |
2055 | @@ -1,6 +1,8 @@ | |
2056 | include(../config.pri) | |
2057 | ||
2058 | TEMPLATE = subdirs | |
2059 | -contains(HAVE_QT_DECLARATIVE, yes) { | |
2060 | + | |
2061 | +# Currently don't have anything to register for non-quick1 case, so no bother building | |
2062 | +contains(HAVE_QT_QUICK1, yes) { | |
2063 | SUBDIRS += qml-plugin | |
2064 | } | |
2065 | diff --git a/plugins/qml-plugin/GeglQt5/qmldir.in b/plugins/qml-plugin/GeglQt5/qmldir.in | |
2066 | new file mode 100644 | |
2067 | index 0000000..88efedb | |
2068 | --- /dev/null | |
2069 | +++ b/plugins/qml-plugin/GeglQt5/qmldir.in | |
2070 | @@ -0,0 +1 @@ | |
2071 | +plugin @GEGLQT_LIBNAME@ | |
2072 | diff --git a/plugins/qml-plugin/qml-plugin.pro b/plugins/qml-plugin/qml-plugin.pro | |
2073 | index 1bfe618..7c99b52 100644 | |
2074 | --- a/plugins/qml-plugin/qml-plugin.pro | |
2075 | +++ b/plugins/qml-plugin/qml-plugin.pro | |
2076 | @@ -2,10 +2,18 @@ include(../../config.pri) | |
2077 | ||
2078 | TEMPLATE = lib | |
2079 | CONFIG += qt plugin no_keywords | |
2080 | -QT += declarative | |
2081 | + | |
2082 | +contains(HAVE_QT_WIDGETS, yes) { | |
2083 | + QT += $$QT_WIDGETS | |
2084 | +} | |
2085 | + | |
2086 | +contains(HAVE_QT_DECLARATIVE, yes) { | |
2087 | + QT += $$QT_DECLARATIVE | |
2088 | +} | |
2089 | + | |
2090 | TARGET = $$GEGLQT_QML_API_NAME/$$GEGLQT_LIBNAME | |
2091 | ||
2092 | -target.path = $$[QT_INSTALL_IMPORTS]/$$GEGLQT_QML_API_NAME | |
2093 | +target.path = $$QTDECLARATIVE_INSTALL_PLUGINS/$$GEGLQT_QML_API_NAME | |
2094 | ||
2095 | HEADERS += qml-plugin.h | |
2096 | SOURCES += qml-plugin.cpp | |
2097 | @@ -14,7 +22,7 @@ INCLUDEPATH += ../../gegl-qt ../.. # .. because public include have gegl-qt/ pre | |
2098 | LIBS += -L../../gegl-qt -l$$GEGLQT_LIBNAME | |
2099 | ||
2100 | CONFIG += link_pkgconfig | |
2101 | -PKGCONFIG += gegl | |
2102 | +PKGCONFIG += $$GEGL_PKG | |
2103 | ||
2104 | OTHER_FILES += \ | |
2105 | $$GEGLQT_QML_API_NAME/qmldir.in | |
2106 | diff --git a/pygegl-qt/pygegl-qt.pro b/pygegl-qt/pygegl-qt.pro | |
2107 | index 7c2efed..92f882f 100644 | |
2108 | --- a/pygegl-qt/pygegl-qt.pro | |
2109 | +++ b/pygegl-qt/pygegl-qt.pro | |
2110 | @@ -7,13 +7,18 @@ first.depends += generate compile link | |
2111 | ||
2112 | TYPESYSTEM_DIR = $$system(pkg-config pyside --variable=typesystemdir) | |
2113 | ||
2114 | -LIBGEGLQT_SRC_DIR = ../gegl-qt | |
2115 | +LIBGEGLQT_SRC_DIR = $$IN_PWD/../gegl-qt | |
2116 | +LIBGEGLQT_BUILD_DIR = $$OUT_PWD/../gegl-qt | |
2117 | +TOP_SRC_DIR = $$IN_PWD/.. | |
2118 | +TOP_BUILD_DIR = $$OUT_PWD/.. | |
2119 | PYSIDE_INCLUDE_DIR = $$system(pkg-config --variable=includedir pyside) | |
2120 | HEADERDIR_QT = $$[QT_INSTALL_HEADERS] | |
2121 | -GEN_INCLUDE_PATHS = ..:$$LIBGEGLQT_SRC_DIR:$$HEADERDIR_QT/QtCore:$$HEADERDIR_QT | |
2122 | +GEN_INCLUDE_PATHS = $$TOP_SRC_DIR:$$LIBGEGLQT_SRC_DIR:$$HEADERDIR_QT/QtCore:$$HEADERDIR_QT | |
2123 | ||
2124 | INCLUDES += \ | |
2125 | - -I.. \ | |
2126 | + -I$$TOP_BUILD_DIR \ | |
2127 | + -I$$TOP_SRC_DIR \ | |
2128 | + -I$$LIBGEGLQT_BUILD_DIR \ | |
2129 | -I$$LIBGEGLQT_SRC_DIR \ | |
2130 | -I$$PYSIDE_INCLUDE_DIR/QtCore \ | |
2131 | -I$$PYSIDE_INCLUDE_DIR/QtGui \ | |
2132 | @@ -48,7 +53,7 @@ generate.target = generate | |
2133 | generate.commands += generatorrunner --generatorSet=shiboken \ | |
2134 | global.h \ | |
2135 | --include-paths=$$GEN_INCLUDE_PATHS \ | |
2136 | - --typesystem-paths=.:$$TYPESYSTEM_DIR \ | |
2137 | + --typesystem-paths=$$OUT_PWD:$$IN_PWD:$$TYPESYSTEM_DIR \ | |
2138 | --output-directory=. \ | |
2139 | typesystem_gegl-qt.xml | |
2140 | ||
2141 | diff --git a/pygegl-qt/typesystem_gegl-qt.xml.in b/pygegl-qt/typesystem_gegl-qt.xml.in | |
2142 | index 81aac0c..ca6fba7 100644 | |
2143 | --- a/pygegl-qt/typesystem_gegl-qt.xml.in | |
2144 | +++ b/pygegl-qt/typesystem_gegl-qt.xml.in | |
2145 | @@ -4,7 +4,7 @@ | |
2146 | <load-typesystem name="typesystem_declarative.xml" generate="no" /> | |
2147 | ||
2148 | <primitive-type name="GeglNodePtr"> | |
2149 | - <conversion-rule file="geglnode_conversions.h"/> | |
2150 | + <conversion-rule file="@GEGLQT_IN_PWD@/geglnode_conversions.h"/> | |
2151 | <include file-name="pygobject.h" location="global"/> | |
2152 | </primitive-type> | |
2153 | ||
2154 | diff --git a/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro b/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro | |
2155 | index f19431f..ef5753e 100644 | |
2156 | --- a/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro | |
2157 | +++ b/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro | |
2158 | @@ -1,6 +1,8 @@ | |
2159 | include(../../config.pri) | |
2160 | include(../tests-common.pri) | |
2161 | ||
2162 | +QT += gui $$QT_WIDGETS | |
2163 | + | |
2164 | SOURCES += test-nodeviewimplementation.cpp | |
2165 | HEADERS += test-nodeviewimplementation.h | |
2166 | ||
2167 | diff --git a/tests/tests-common.pri b/tests/tests-common.pri | |
2168 | index 950964d..864bb56 100644 | |
2169 | --- a/tests/tests-common.pri | |
2170 | +++ b/tests/tests-common.pri | |
2171 | @@ -6,7 +6,7 @@ QT -= gui # Not all tests needs UI | |
2172 | CONFIG += debug | |
2173 | ||
2174 | CONFIG += link_pkgconfig | |
2175 | -PKGCONFIG += gegl | |
2176 | +PKGCONFIG += $$GEGL_PKG | |
2177 | ||
2178 | isEmpty(USE_EXTERNAL_GEGLQT) { | |
2179 | INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix | |
2180 | diff --git a/tests/tests.pro b/tests/tests.pro | |
2181 | index 35603be..6c162f1 100644 | |
2182 | --- a/tests/tests.pro | |
2183 | +++ b/tests/tests.pro | |
2184 | @@ -1,3 +1,9 @@ | |
2185 | TEMPLATE = subdirs | |
2186 | + | |
2187 | SUBDIRS += \ | |
2188 | - test-nodeviewimplementation | |
2189 | + | |
2190 | +contains(HAVE_QT_WIDGETS, yes) { | |
2191 | + SUBDIRS += \ | |
2192 | + test-nodeviewimplementation \ | |
2193 | + | |
2194 | +} |