commit yast2-qt-graph for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-qt-graph for openSUSE:Factory checked in at Wed Mar 25 22:54:24 CET 2009. -------- --- yast2-qt-graph/yast2-qt-graph.changes 2009-02-17 11:22:05.000000000 +0100 +++ yast2-qt-graph/yast2-qt-graph.changes 2009-03-24 21:03:23.000000000 +0100 @@ -1,0 +2,11 @@ +Mon Mar 09 16:11:20 CET 2009 - aschnell@suse.de + +- added support for context menus +- 2.18.4 + +------------------------------------------------------------------- +Tue Feb 24 12:46:13 CET 2009 - aschnell@suse.de + +- support newlines in tooltips + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- yast2-qt-graph-2.18.3.tar.bz2 New: ---- yast2-qt-graph-2.18.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-qt-graph.spec ++++++ --- /var/tmp/diff_new_pack.G14243/_old 2009-03-25 22:54:00.000000000 +0100 +++ /var/tmp/diff_new_pack.G14243/_new 2009-03-25 22:54:00.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package yast2-qt-graph (Version 2.18.3) +# spec file for package yast2-qt-graph (Version 2.18.4) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,15 +19,15 @@ Url: http://svn.opensuse.org/svn/yast/trunk/qt-graph/ Name: yast2-qt-graph -Version: 2.18.3 +Version: 2.18.4 Release: 1 License: GPL v2 or later Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-qt-graph-2.18.3.tar.bz2 +Source0: yast2-qt-graph-2.18.4.tar.bz2 BuildRequires: cmake graphviz-devel libqt4-devel -BuildRequires: yast2-devtools yast2-libyui-devel >= 2.18.3 yast2-qt-devel >= 2.18.4 -Requires: yast2-qt >= 2.18.4 yast2-libyui >= 2.18.3 +BuildRequires: yast2-devtools yast2-libyui-devel >= 2.18.7 yast2-qt-devel >= 2.18.6 +Requires: yast2-libyui >= 2.18.7 yast2-qt >= 2.18.6 Provides: yast2-qt:/usr/lib/YaST2/plugin/libpy2qt_graph.so.2 Provides: yast2_ui_graph Summary: YaST graph plugin @@ -71,6 +71,11 @@ %_libdir/YaST2/plugin/libpy2qt_graph.so %changelog +* Mon Mar 09 2009 aschnell@suse.de +- added support for context menus +- 2.18.4 +* Tue Feb 24 2009 aschnell@suse.de +- support newlines in tooltips * Tue Feb 17 2009 aschnell@suse.de - various minor fixes and improvements - 2.18.3 ++++++ yast2-qt-graph-2.18.3.tar.bz2 -> yast2-qt-graph-2.18.4.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/examples/shapes.gv new/yast2-qt-graph-2.18.4/examples/shapes.gv --- old/yast2-qt-graph-2.18.3/examples/shapes.gv 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/examples/shapes.gv 2009-03-24 21:03:15.000000000 +0100 @@ -2,9 +2,20 @@ { node [style="filled", fontname="Helvetica"]; - rectangle [shape="rectangle"]; - diamond [shape="diamond"]; + "rectangle" [shape="rectangle"]; - circle [shape="circle"]; - ellipse [shape="ellipse"]; + "box" [shape="box"]; + "box orientation" [shape="box", orientation=22.5, regular=true]; + + "diamond" [shape="diamond"]; + "diamond regular" [shape="diamond", regular=true]; + + "hexagon" [shape="hexagon"]; + "hexagon regular" [shape="hexagon", regular=true]; + + "polygon" [shape="polygon", sides=12]; + "polygon distortion" [shape="polygon", distortion=-0.25]; + + "circle" [shape="circle"]; + "ellipse" [shape="ellipse"]; } Files old/yast2-qt-graph-2.18.3/examples/SimpleCreate and new/yast2-qt-graph-2.18.4/examples/SimpleCreate differ Files old/yast2-qt-graph-2.18.3/examples/SimpleLoad and new/yast2-qt-graph-2.18.4/examples/SimpleLoad differ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/examples/tooltip.gv new/yast2-qt-graph-2.18.4/examples/tooltip.gv --- old/yast2-qt-graph-2.18.3/examples/tooltip.gv 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/examples/tooltip.gv 2009-03-24 21:03:15.000000000 +0100 @@ -3,4 +3,5 @@ node [style="filled"]; A [tooltip="Keep Smiling ☺"]; + B [tooltip="Hello\nWorld"]; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/package/yast2-qt-graph.changes new/yast2-qt-graph-2.18.4/package/yast2-qt-graph.changes --- old/yast2-qt-graph-2.18.3/package/yast2-qt-graph.changes 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/package/yast2-qt-graph.changes 2009-03-24 21:03:15.000000000 +0100 @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Mon Mar 09 16:11:20 CET 2009 - aschnell@suse.de + +- added support for context menus +- 2.18.4 + +------------------------------------------------------------------- +Tue Feb 24 12:46:13 CET 2009 - aschnell@suse.de + +- support newlines in tooltips + +------------------------------------------------------------------- Tue Feb 17 10:37:58 CET 2009 - aschnell@suse.de - various minor fixes and improvements diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/src/QY2Graph.cc new/yast2-qt-graph-2.18.4/src/QY2Graph.cc --- old/yast2-qt-graph-2.18.3/src/QY2Graph.cc 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/src/QY2Graph.cc 2009-03-24 21:03:15.000000000 +0100 @@ -62,10 +62,6 @@ scene = new QGraphicsScene(this); scene->setItemIndexMethod(QGraphicsScene::BspTreeIndex); setScene(scene); - - signalMapper = new QSignalMapper(this); - connect(signalMapper, SIGNAL(mapped(const QString&)), - this, SIGNAL(nodeDoubleClickEvent(const QString&))); } @@ -117,19 +113,39 @@ } +void +QY2Graph::contextMenuEvent(QContextMenuEvent* event) +{ + QY2Node* node = dynamic_cast<QY2Node*>(itemAt(event->pos())); + + if (node) + emit nodeContextMenuEvent(event, node->name); + else + emit backgroundContextMenuEvent(event); +} + + +void +QY2Graph::mouseDoubleClickEvent(QMouseEvent* event) +{ + QY2Node* node = dynamic_cast<QY2Node*>(itemAt(event->pos())); + + if (node) + emit nodeDoubleClickEvent(event, node->name); +} + + QPointF QY2Graph::gToQ(const point& p, bool upside_down) const { - QPointF tmp(p.x, p.y); - return upside_down ? QPointF(tmp.x(), rect.height() - tmp.y()) : QPointF(tmp.x(), -tmp.y()); + return upside_down ? QPointF(p.x, graphRect.height() - p.y) : QPointF(p.x, -p.y); } QPointF QY2Graph::gToQ(const pointf& p, bool upside_down) const { - QPointF tmp(p.x, p.y); - return upside_down ? QPointF(tmp.x(), rect.height() - tmp.y()) : QPointF(tmp.x(), -tmp.y()); + return upside_down ? QPointF(p.x, graphRect.height() - p.y) : QPointF(p.x, -p.y); } @@ -337,8 +353,8 @@ } // don't use gToQ here since it adjusts the values - rect = QRectF(GD_bb(graph).LL.x, GD_bb(graph).LL.y, GD_bb(graph).UR.x, GD_bb(graph).UR.y); - scene->setSceneRect(rect.adjusted(-5, -5, +5, +5)); + graphRect = QRectF(GD_bb(graph).LL.x, GD_bb(graph).LL.y, GD_bb(graph).UR.x, GD_bb(graph).UR.y); + scene->setSceneRect(graphRect.adjusted(-5, -5, +5, +5)); scene->setBackgroundBrush(aggetToQColor(graph, "bgcolor", Qt::white)); @@ -351,7 +367,7 @@ drawLabel(ND_label(node), &painter); painter.end(); - QY2Node* item = new QY2Node(makeShape(node), picture); + QY2Node* item = new QY2Node(makeShape(node), picture, node->name); item->setPos(gToQ(ND_coord_i(node))); @@ -364,13 +380,13 @@ QString tooltip = aggetToQString(node, "tooltip", ""); if (!tooltip.isEmpty()) + { + tooltip.replace("\\n", "\n"); item->setToolTip(tooltip); + } scene->addItem(item); - signalMapper->setMapping(item, QString(node->name)); - connect(item, SIGNAL(doubleClickEvent()), signalMapper, SLOT(map())); - for (edge_t* edge = agfstout(graph, node); edge != NULL; edge = agnxtout(graph, edge)) { const splines* spl = ED_spl(edge); @@ -411,11 +427,11 @@ } -QY2Node::QY2Node(const QPainterPath& path, const QPicture& picture) +QY2Node::QY2Node(const QPainterPath& path, const QPicture& picture, const QString& name) : QGraphicsPathItem(path), - picture(picture) + picture(picture), + name(name) { - setAcceptedMouseButtons(Qt::LeftButton); } @@ -430,19 +446,6 @@ } -void -QY2Node::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) -{ - emit doubleClickEvent(); -} - - -void -QY2Node::mousePressEvent(QGraphicsSceneMouseEvent*) -{ -} - - QY2Edge::QY2Edge(const QPainterPath& path, const QPicture& picture) : QGraphicsPathItem(path), picture(picture) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/src/QY2Graph.h new/yast2-qt-graph-2.18.4/src/QY2Graph.h --- old/yast2-qt-graph-2.18.3/src/QY2Graph.h 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/src/QY2Graph.h 2009-03-24 21:03:15.000000000 +0100 @@ -26,8 +26,9 @@ #include <QGraphicsView> #include <QGraphicsScene> #include <QGraphicsPathItem> -#include <QSignalMapper> #include <QPicture> +#include <QContextMenuEvent> +#include <QMouseEvent> /** @@ -53,22 +54,26 @@ signals: - void nodeDoubleClickEvent(const QString& name); + void backgroundContextMenuEvent(QContextMenuEvent* event); + void nodeContextMenuEvent(QContextMenuEvent* event, const QString& name); + void nodeDoubleClickEvent(QMouseEvent* event, const QString& name); protected: void keyPressEvent(QKeyEvent* event); void wheelEvent(QWheelEvent* event); - void scaleView(qreal scaleFactor); + void contextMenuEvent(QContextMenuEvent* event); + void mouseDoubleClickEvent(QMouseEvent* event); private: void init(); + void scaleView(qreal scaleFactor); + QGraphicsScene* scene; - QSignalMapper* signalMapper; - QRectF rect; + QRectF graphRect; QPointF gToQ(const point& p, bool upside_down = true) const; QPointF gToQ(const pointf& p, bool upside_down = true) const; @@ -95,23 +100,18 @@ public: - QY2Node(const QPainterPath& path, const QPicture& picture); + QY2Node(const QPainterPath& path, const QPicture& picture, const QString& name); void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); -signals: - - void doubleClickEvent(); - -protected: - - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event); - void mousePressEvent(QGraphicsSceneMouseEvent* event); - private: QPicture picture; +public: + + QString name; + }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/src/YQGraph.cc new/yast2-qt-graph-2.18.4/src/YQGraph.cc --- old/yast2-qt-graph-2.18.3/src/YQGraph.cc 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/src/YQGraph.cc 2009-03-24 21:03:15.000000000 +0100 @@ -38,8 +38,7 @@ { setWidgetRep(this); - connect(this, SIGNAL(nodeDoubleClickEvent(const QString&)), - this, SLOT(nodeActivated(const QString&))); + init(); } @@ -49,8 +48,7 @@ { setWidgetRep(this); - connect(this, SIGNAL(nodeDoubleClickEvent(const QString&)), - this, SLOT(nodeActivated(const QString&))); + init(); } @@ -60,6 +58,20 @@ void +YQGraph::init() +{ + connect(this, SIGNAL(backgroundContextMenuEvent(QContextMenuEvent*)), + this, SLOT(backgroundContextMenu(QContextMenuEvent*))); + + connect(this, SIGNAL(nodeContextMenuEvent(QContextMenuEvent*, const QString&)), + this, SLOT(nodeContextMenu(QContextMenuEvent*, const QString&))); + + connect(this, SIGNAL(nodeDoubleClickEvent(QMouseEvent*, const QString&)), + this, SLOT(nodeDoubleClick(QMouseEvent*, const QString&))); +} + + +void YQGraph::renderGraph(const string& filename, const string& layoutAlgorithm) { QY2Graph::renderGraph(filename, layoutAlgorithm); @@ -95,10 +107,37 @@ void -YQGraph::nodeActivated(const QString& name) +YQGraph::backgroundContextMenu(QContextMenuEvent* event) +{ + if (notifyContextMenu()) + { + lastActivatedNode.clear(); + YQUI::yqApp()->setContextMenuPos(event->globalPos()); + YQUI::ui()->sendEvent(new YWidgetEvent(this, YEvent::ContextMenuActivated)); + } +} + + +void +YQGraph::nodeContextMenu(QContextMenuEvent* event, const QString& name) +{ + if (notifyContextMenu()) + { + lastActivatedNode = name.toStdString(); + YQUI::yqApp()->setContextMenuPos(event->globalPos()); + YQUI::ui()->sendEvent(new YWidgetEvent(this, YEvent::ContextMenuActivated)); + } +} + + +void +YQGraph::nodeDoubleClick(QMouseEvent* event, const QString& name) { - lastActivatedNode = name.toStdString(); - YQUI::ui()->sendEvent(new YWidgetEvent(this, YEvent::Activated)); + if (notify()) + { + lastActivatedNode = name.toStdString(); + YQUI::ui()->sendEvent(new YWidgetEvent(this, YEvent::Activated)); + } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/src/YQGraph.h new/yast2-qt-graph-2.18.4/src/YQGraph.h --- old/yast2-qt-graph-2.18.3/src/YQGraph.h 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/src/YQGraph.h 2009-03-24 21:03:15.000000000 +0100 @@ -66,9 +66,13 @@ private slots: - void nodeActivated(const QString& name); + void backgroundContextMenu(QContextMenuEvent* event); + void nodeContextMenu(QContextMenuEvent* event, const QString& name); + void nodeDoubleClick(QMouseEvent* event, const QString& name); -private: +private: + + void init(); string lastActivatedNode; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/VERSION.cmake new/yast2-qt-graph-2.18.4/VERSION.cmake --- old/yast2-qt-graph-2.18.3/VERSION.cmake 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/VERSION.cmake 2009-03-24 21:03:15.000000000 +0100 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "18") -SET(VERSION_PATCH "3") +SET(VERSION_PATCH "4") diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-graph-2.18.3/yast2-qt-graph.spec.in new/yast2-qt-graph-2.18.4/yast2-qt-graph.spec.in --- old/yast2-qt-graph-2.18.3/yast2-qt-graph.spec.in 2009-02-17 15:06:33.000000000 +0100 +++ new/yast2-qt-graph-2.18.4/yast2-qt-graph.spec.in 2009-03-24 21:03:15.000000000 +0100 @@ -2,8 +2,8 @@ @HEADER@ BuildRequires: cmake libqt4-devel graphviz-devel -BuildRequires: yast2-devtools yast2-qt-devel >= 2.18.4 yast2-libyui-devel >= 2.18.3 -Requires: yast2-qt >= 2.18.4 yast2-libyui >= 2.18.3 +BuildRequires: yast2-devtools yast2-libyui-devel >= 2.18.7 yast2-qt-devel >= 2.18.6 +Requires: yast2-libyui >= 2.18.7 yast2-qt >= 2.18.6 Provides: yast2-qt:/usr/lib/YaST2/plugin/libpy2qt_graph.so.2 Provides: yast2_ui_graph Summary: - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de