1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-01-23 11:11:06 +02:00

Adding bases to the code generator. Code text edit, fixing input/output ID control, etc.

This commit is contained in:
Juan64Bits 2010-11-20 16:19:34 -05:00
parent 9d578912b7
commit 2efe106cf3
29 changed files with 531 additions and 157 deletions

View File

@ -13,11 +13,11 @@
<Point x="-60" y="40"/> <Point x="-60" y="40"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="3" text="ADC Single Channel" posOffset-x="0"/> <TextItem myStyleIO="7" posOffset-y="-20" editableItem="0" ID="7" text=" Long" posOffset-x="110"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="4" text="0" posOffset-x="20"/> <TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="9" text="255" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="5" text="CH:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="6" text="SP:" posOffset-x="-20"/> <TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="6" text="SP:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="7" text="255" posOffset-x="20"/> <TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="5" text="CH:" posOffset-x="-20"/>
<TextItem myStyleIO="8" posOffset-y="-20" editableItem="0" ID="8" text="UChar" posOffset-x="110"/> <TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="4" text="0" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="3" text="ADC Single Channel" posOffset-x="0"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -196,6 +196,8 @@ void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
SECLine->setColor(myColor); SECLine->setColor(myColor);
} }
} }
painter->setBrush(Qt::lightGray);
painter->drawPolygon(this->path().toFillPolygon());
setSelectedArrows(); setSelectedArrows();
} }

View File

@ -7,8 +7,8 @@
<Point x="30" y="-10"/> <Point x="30" y="-10"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="21" text="Value" posOffset-x="-30"/> <TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="1" text="1" posOffset-x="10"/>
<TextItem myStyleIO="3" posOffset-y="-20" editableItem="0" ID="15" text="OUT Integer" posOffset-x="30"/> <TextItem myStyleIO="3" posOffset-y="-20" editableItem="0" ID="15" text="OUT Integer" posOffset-x="30"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="19" text="1" posOffset-x="10"/> <TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="0" text="Value" posOffset-x="-30"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -43,9 +43,11 @@
#include <QHash> #include <QHash>
#include "diagramscene.h" #include "diagramscene.h"
DiagramScene::DiagramScene(QMenu *itemMenu, QObject *parent) DiagramScene::DiagramScene(QMenu *itemMenu, MainWindow *ownerWindow,
QObject *parent)
: QGraphicsScene(parent) : QGraphicsScene(parent)
{ {
myOwnerWindow = ownerWindow;
myItemMenu = itemMenu; myItemMenu = itemMenu;
myMode = MoveItem; myMode = MoveItem;
@ -59,8 +61,8 @@ DiagramScene::DiagramScene(QMenu *itemMenu, QObject *parent)
myPolygonPath=0; myPolygonPath=0;
myCorners=0; myCorners=0;
TitleText = new DiagramTextItem(0,0,1,0xFFF,255,"BLOCK NAME HERE (not visible)", TitleText = new DiagramTextItem(0,0,1,0xFFF,255,"BLOCK NAME HERE not visible",
QPointF(250,250)); QPointF(500,370));
addItem(TitleText); addItem(TitleText);
} }
@ -124,14 +126,105 @@ void DiagramScene::doSnapToGrid(QGraphicsSceneMouseEvent *mouseEvent)
} }
} }
QString DiagramScene::createPrototype()
{
bool first = 1;
QString functionPrototype = "\nvoid " +
TitleText->toPlainText().replace(' ','_') + "(";
foreach (QGraphicsItem *item, this->items()) {
if (item->type() == DiagramTextItem::Type) {
int styleIO = qgraphicsitem_cast<DiagramTextItem*>(item)->styleIO();
if(styleIO<256)
{
int ioID = qgraphicsitem_cast<DiagramTextItem*>(item)->textID();
if(!first) functionPrototype += ","; first = 0;
switch(styleIO&127)
{
case 1:
functionPrototype += "bool ";
break;
case 2:
functionPrototype += "char ";
break;
case 3:
functionPrototype += "integer ";
break;
case 4:
functionPrototype += "double ";
break;
case 5:
functionPrototype += "float ";
break;
case 6:
functionPrototype += "short ";
break;
case 7:
functionPrototype += "long ";
break;
case 8:
functionPrototype += "unsigned char ";
break;
case 9:
functionPrototype += "unsigned integer ";
break;
case 10:
functionPrototype += "unsigned short ";
break;
case 11:
functionPrototype += "unsigned long ";
break;
default:;
}
functionPrototype += (styleIO>>7)? "in":"&out";
functionPrototype += "_" + QString::number(ioID);
}
}
}
functionPrototype += ") {";
return functionPrototype;
}
void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{ {
doSnapToGrid(mouseEvent); doSnapToGrid(mouseEvent);
QString Text; foreach (QGraphicsItem *item, this->items(mouseEvent->scenePos())) {
if (item->type() == DiagramTextItem::Type) {
if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()<256)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Input/Output text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==256)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==257)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Editable text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
}
}
myOwnerWindow->updateProt();
QString Text;
if (mouseEvent->button() != Qt::LeftButton) if (mouseEvent->button() != Qt::LeftButton)
return; return;
int addResult=0;
switch (myMode) switch (myMode)
{ {
case InsertText: case InsertText:
@ -146,17 +239,19 @@ void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
textItem = new DiagramTextItem(0,0,1,myTextType,0,Text, textItem = new DiagramTextItem(0,0,1,myTextType,0,Text,
mouseEvent->scenePos()); mouseEvent->scenePos());
if(addTextItem(textItem)) addResult=addTextItem(textItem);
if(addResult!=-1)
{ {
textItem->setZValue(1000.0); textItem->setZValue(1000.0);
connect(textItem, SIGNAL(lostFocus(DiagramTextItem*)), connect(textItem, SIGNAL(lostFocus(DiagramTextItem*)),
this, SLOT(editorLostFocus(DiagramTextItem*))); this, SLOT(editorLostFocus(DiagramTextItem*)));
addItem(textItem); addItem(textItem);
textItem->setTextID(addResult);
} }
else else
{ {
delete(textItem); delete(textItem);
QMessageBox::warning(0,"Full","The block can only have only" QMessageBox::warning(0,"Full","The block can only have "
"255 text items"); "255 text items");
} }
emit textInserted(textItem); emit textInserted(textItem);
@ -237,7 +332,7 @@ void DiagramScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent)
void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{ {
doSnapToGrid(mouseEvent); doSnapToGrid(mouseEvent);
if (myMode != EditPolygon && line == 0) if(myMode != EditPolygon && line == 0)
QGraphicsScene::mouseReleaseEvent(mouseEvent); QGraphicsScene::mouseReleaseEvent(mouseEvent);
} }
@ -377,7 +472,7 @@ int DiagramScene::fromXmlFormat(QDomDocument document)
} }
} }
} }
myOwnerWindow->updateProt();
return 1; return 1;
} }
@ -418,10 +513,10 @@ int DiagramScene::addTextItem(DiagramTextItem * textItem)
if(iter==textItemsByID.end()) if(iter==textItemsByID.end())
{ {
textItemsByID.insert(i,textItem); textItemsByID.insert(i,textItem);
return 1; return i;
} }
} }
return 0; return -1;
} }
void DiagramScene::removeTextItem(DiagramTextItem * textItem) void DiagramScene::removeTextItem(DiagramTextItem * textItem)

View File

@ -47,6 +47,7 @@
#include <QtXml> #include <QtXml>
#include "diagramtextitem.h" #include "diagramtextitem.h"
#include "arrow.h" #include "arrow.h"
#include "mainwindow.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
@ -56,8 +57,9 @@ class QGraphicsLineItem;
class QFont; class QFont;
class QGraphicsTextItem; class QGraphicsTextItem;
class QColor; class QColor;
class QStatusBar;
QT_END_NAMESPACE QT_END_NAMESPACE
class MainWindow;
class Arrow; class Arrow;
class DiagramTextItem; class DiagramTextItem;
@ -68,7 +70,7 @@ class DiagramScene : public QGraphicsScene
public: public:
enum Mode { MoveItem , EditPolygon, InsertText }; enum Mode { MoveItem , EditPolygon, InsertText };
DiagramScene(QMenu *itemMenu, QObject *parent = 0); DiagramScene(QMenu *itemMenu, MainWindow *ownerWindow, QObject *parent=0);
QDomDocument toXmlFormat(); QDomDocument toXmlFormat();
int fromXmlFormat(QDomDocument xmlDocument); int fromXmlFormat(QDomDocument xmlDocument);
@ -81,6 +83,8 @@ public:
int addTextItem(DiagramTextItem * textItem); int addTextItem(DiagramTextItem * textItem);
void removeTextItem(DiagramTextItem * textItem); void removeTextItem(DiagramTextItem * textItem);
QString createPrototype();
public slots: public slots:
void setMode(Mode mode){myMode=mode;} void setMode(Mode mode){myMode=mode;}
void editorLostFocus(DiagramTextItem *item); void editorLostFocus(DiagramTextItem *item);
@ -116,6 +120,7 @@ private:
short int myGrid; short int myGrid;
int myCorners; int myCorners;
QHash<int,DiagramTextItem*> textItemsByID; QHash<int,DiagramTextItem*> textItemsByID;
MainWindow *myOwnerWindow;
}; };
#endif #endif

View File

@ -76,7 +76,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MI4KrAyPP5,guid=5c5c5e6146195c74b6ad266d4cc07afd</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@ -84,8 +84,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value> <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value> <value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-CFAuJK</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_PID=1516</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value> <value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value> <value type="QString">LANG=en_US.utf8</value>
@ -96,20 +95,20 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value> <value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1534,unix/Maximus:/tmp/.ICE-unix/1534</value> <value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value> <value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1570</value> <value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-CFAuJK/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">USER=juan64bits</value> <value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value> <value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-V4ry7M/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287682812.550485-1725059380</value> <value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
</valuelist> </valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/juan64bits/QT/diagramscene/block_editor/diagramscene.pro</value> <value type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg/block_editor/diagramscene.pro</value>
<value type="QString">-spec</value> <value type="QString">-spec</value>
<value type="QString">linux-g++</value> <value type="QString">linux-g++</value>
<value type="QString">-r</value> <value type="QString">-r</value>
@ -117,7 +116,7 @@
</valuelist> </valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value> <value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
<value key="abstractProcess.enabled" type="bool">false</value> <value key="abstractProcess.enabled" type="bool">false</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/diagramscene/block_editor</value> <value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg/block_editor</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
@ -125,7 +124,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MI4KrAyPP5,guid=5c5c5e6146195c74b6ad266d4cc07afd</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@ -133,8 +132,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value> <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value> <value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-CFAuJK</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_PID=1516</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value> <value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value> <value type="QString">LANG=en_US.utf8</value>
@ -145,17 +143,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value> <value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1534,unix/Maximus:/tmp/.ICE-unix/1534</value> <value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value> <value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1570</value> <value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-CFAuJK/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">USER=juan64bits</value> <value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value> <value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-V4ry7M/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287682812.550485-1725059380</value> <value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
@ -163,7 +161,7 @@
</valuelist> </valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value> <value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value> <value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/diagramscene/block_editor</value> <value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg/block_editor</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>

View File

@ -70,14 +70,14 @@ public:
{ return Type;} { return Type;}
int styleIO() int styleIO()
{ return myStyleIO;} { return myStyleIO;}
unsigned char ID()
{ return myID;}
unsigned char textID() const unsigned char textID() const
{ return myID;} { return myID;}
void setTextID(unsigned char ID)
{ myID=ID;}
QPointF offset() const QPointF offset() const
{ return posOffset;} { return posOffset;}

View File

@ -9,10 +9,10 @@
<Point x="-70" y="-30"/> <Point x="-70" y="-30"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="9" posOffset-y="-0" editableItem="0" ID="13" text="OUT" posOffset-x="60"/> <TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="0" text="IN" posOffset-x="-70"/>
<TextItem myStyleIO="138" posOffset-y="-0" editableItem="0" ID="12" text="IN" posOffset-x="-70"/> <TextItem myStyleIO="3" posOffset-y="-0" editableItem="0" ID="1" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text="&lt;&lt;" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/> <TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text="&lt;&lt;" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -53,6 +53,7 @@ class QRectF;
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
class QPainterPath; class QPainterPath;
QT_END_NAMESPACE QT_END_NAMESPACE
class Arrow;
class lineItem : public QGraphicsLineItem class lineItem : public QGraphicsLineItem
{ {

View File

@ -49,7 +49,7 @@ int main(int argv, char *args[])
QApplication app(argv, args); QApplication app(argv, args);
MainWindow mainWindow; MainWindow mainWindow;
mainWindow.setGeometry(100, 100, 1024, 640); mainWindow.setGeometry(100, 100, 1024, 768);
mainWindow.show(); mainWindow.show();
return app.exec(); return app.exec();
} }

View File

@ -51,18 +51,43 @@ MainWindow::MainWindow()
createActions(); createActions();
createToolBox(); createToolBox();
createMenus(); createMenus();
statusBar = new QStatusBar(this);
scene = new DiagramScene(itemMenu); scene = new DiagramScene(itemMenu,this);
scene->setSceneRect(QRectF(0, 0, 1000, 1000)); scene->setSceneRect(QRectF(0, 0, 1000, 1000));
connect(scene, SIGNAL(textInserted(QGraphicsTextItem*)), connect(scene, SIGNAL(textInserted(QGraphicsTextItem*)),
this, SLOT(textInserted(QGraphicsTextItem*))); this, SLOT(textInserted(QGraphicsTextItem*)));
createToolbars(); createToolbars();
QHBoxLayout *layout = new QHBoxLayout; /* Create widgets for code editor */
layout->addWidget(toolBox); headerTextEdit = new QTextEdit;
view = new QGraphicsView(scene); headerTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
layout->addWidget(view); headerTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
blockTextEdit = new QTextEdit;
blockTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
blockTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
extraTextEdit = new QTextEdit;
extraTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
extraTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
prototypeLabel = new QLabel;
prototypeLabel->setText("\nvoid BLOCK_NAME () {");
headerLabel = new QLabel;
headerLabel->setText("Code for Header Section Here");
extraLabel = new QLabel;
extraLabel->setText("}\n\nCode for Extra Section Here");
/* Create central widget */
QGridLayout *layout = new QGridLayout;
layout->addWidget(toolBox,0,0,7,1);
view = new QGraphicsView(scene);
layout->addWidget(view,0,1,1,1);
layout->addWidget(headerLabel,1,1,1,1);
layout->addWidget(headerTextEdit,2,1,1,1);
layout->addWidget(prototypeLabel,3,1,1,1);
layout->addWidget(blockTextEdit,4,1,1,1);
layout->addWidget(extraLabel,5,1,1,1);
layout->addWidget(extraTextEdit,6,1,1,1);
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
widget->setLayout(layout); widget->setLayout(layout);
@ -74,6 +99,8 @@ MainWindow::MainWindow()
if(QApplication::argc()>1) if(QApplication::argc()>1)
{newDiagram(QString(QApplication::argv()[1]));} {newDiagram(QString(QApplication::argv()[1]));}
statusBar->showMessage("Ready...");
this->setStatusBar(statusBar);
} }
void MainWindow::deleteItem() void MainWindow::deleteItem()
@ -103,6 +130,7 @@ void MainWindow::deleteItem()
scene->removeItem(item); scene->removeItem(item);
delete(item); delete(item);
} }
updateProt();
} }
} }
} }
@ -111,8 +139,13 @@ void MainWindow::textInserted(QGraphicsTextItem*)
{ {
buttonGroup->button(selectedButton)->setChecked(false); buttonGroup->button(selectedButton)->setChecked(false);
scene->setMode(DiagramScene::MoveItem); scene->setMode(DiagramScene::MoveItem);
updateProt();
} }
void MainWindow::updateProt()
{
prototypeLabel->setText(scene->createPrototype());
}
void MainWindow::sceneScaleChanged(const QString &scale) void MainWindow::sceneScaleChanged(const QString &scale)
{ {
@ -158,27 +191,27 @@ void MainWindow::createToolBox()
QGridLayout *layout = new QGridLayout; QGridLayout *layout = new QGridLayout;
//INPUTS //INPUTS
int i=0; int i=0;
layout->addWidget(createToolButton(129+i,tr("Bool"), layout->addWidget(createToolButton(128+i,tr("Bool"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Char"), layout->addWidget(createToolButton(128+i,tr("Char"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Integer"), layout->addWidget(createToolButton(128+i,tr("Integer"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Double"), layout->addWidget(createToolButton(128+i,tr("Double"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Float"), layout->addWidget(createToolButton(128+i,tr("Float"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Short"), layout->addWidget(createToolButton(128+i,tr("Short"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("Long"), layout->addWidget(createToolButton(128+i,tr("Long"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("UChar"), layout->addWidget(createToolButton(128+i,tr("UChar"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("UInt"), layout->addWidget(createToolButton(128+i,tr("UInt"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("UShort"), layout->addWidget(createToolButton(128+i,tr("UShort"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
layout->addWidget(createToolButton(129+i,tr("ULong"), layout->addWidget(createToolButton(128+i,tr("ULong"),
QIcon(":/images/background1.png")),++i,0); QIcon(":/images/background1.png")),++i,0);
@ -343,6 +376,7 @@ bool MainWindow::newDiagram(QString filePath)
{ {
saveIfNeeded(); saveIfNeeded();
scene->cleanScene(); scene->cleanScene();
prototypeLabel->setText("\nvoid BLOCK_NAME () {");
myFilePath=""; myFilePath="";
if(filePath=="") if(filePath=="")
@ -357,8 +391,8 @@ bool MainWindow::newDiagram(QString filePath)
file.close(); file.close();
if(!parsing) if(!parsing)
{ {
QMessageBox::warning(this,"Aborting","Failed to parse file, " QMessageBox::warning(this,"Parsing warning","Invalid or void "
"wrong format or encoding."); " element found in file.");
return 0; return 0;
} }
scene->fromXmlFormat(document); scene->fromXmlFormat(document);

View File

@ -50,6 +50,7 @@
#include "diagramtextitem.h" #include "diagramtextitem.h"
#include "lineitem.h" #include "lineitem.h"
#include "arrow.h" #include "arrow.h"
#include <QtGui>
class DiagramScene; class DiagramScene;
@ -80,6 +81,9 @@ public:
{ return QDir::currentPath();} { return QDir::currentPath();}
void saveIfNeeded(); void saveIfNeeded();
void updateProt();
QStatusBar *statusBar;
private slots: private slots:
void deleteItem(); void deleteItem();
@ -97,6 +101,7 @@ private:
void createActions(); void createActions();
void createMenus(); void createMenus();
void createToolbars(); void createToolbars();
QWidget *createToolButton(int ID, QString type,QIcon icon); QWidget *createToolButton(int ID, QString type,QIcon icon);
DiagramScene *scene; DiagramScene *scene;
@ -126,6 +131,14 @@ private:
QButtonGroup *buttonGroup; QButtonGroup *buttonGroup;
QLabel * headerLabel;
QTextEdit * headerTextEdit;
QLabel * prototypeLabel;
QTextEdit * blockTextEdit;
QLabel * extraLabel;
QTextEdit * extraTextEdit;
int selectedButton; int selectedButton;
QString myFilePath; QString myFilePath;

View File

@ -23,10 +23,10 @@
<Point x="-90" y="20"/> <Point x="-90" y="20"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="137" posOffset-y="-0" editableItem="0" ID="14" text="UChar" posOffset-x="-90"/> <TextItem myStyleIO="136" posOffset-y="-0" editableItem="0" ID="4" text="UChar" posOffset-x="-90"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="15" text="|-Duty-|" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="16" text="0" posOffset-x="0"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="11" text="Out:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="18" text="PWM" posOffset-x="-50"/> <TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="18" text="PWM" posOffset-x="-50"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="11" text="Out:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="16" text="0" posOffset-x="0"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="15" text="|-Duty-|" posOffset-x="-20"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -9,10 +9,10 @@
<Point x="-70" y="-30"/> <Point x="-70" y="-30"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="9" posOffset-y="-0" editableItem="0" ID="13" text="OUT" posOffset-x="60"/> <TextItem myStyleIO="2" posOffset-y="-0" editableItem="0" ID="3" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="138" posOffset-y="-0" editableItem="0" ID="12" text="IN" posOffset-x="-70"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text=">>" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/> <TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text=">>" posOffset-x="-20"/>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="2" text="IN" posOffset-x="-70"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -23,7 +23,7 @@
<Point x="-50" y="-10"/> <Point x="-50" y="-10"/>
</Polygon> </Polygon>
<TextItems> <TextItems>
<TextItem myStyleIO="130" posOffset-y="-10" editableItem="0" ID="14" text="IN Bool" posOffset-x="-50"/> <TextItem myStyleIO="129" posOffset-y="-10" editableItem="0" ID="6" text="IN Bool" posOffset-x="-50"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="23" text="System While" posOffset-x="0"/> <TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="23" text="System While" posOffset-x="0"/>
</TextItems> </TextItems>
</CustomItem> </CustomItem>

View File

@ -0,0 +1,26 @@
#include "codedialog.h"
#include "ui_codedialog.h"
codeDialog::codeDialog(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::codeDialog)
{
ui->setupUi(this);
}
codeDialog::~codeDialog()
{
delete ui;
}
void codeDialog::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}

View File

@ -0,0 +1,23 @@
#ifndef CODEDIALOG_H
#define CODEDIALOG_H
#include <QMainWindow>
namespace Ui {
class codeDialog;
}
class codeDialog : public QMainWindow {
Q_OBJECT
public:
codeDialog(QWidget *parent = 0);
~codeDialog();
protected:
void changeEvent(QEvent *e);
private:
Ui::codeDialog *ui;
};
#endif // CODEDIALOG_H

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>codeDialog</class>
<widget class="QMainWindow" name="codeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="okButton">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QTextEdit" name="codeTextEdit">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>codeDialog</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel">
<x>392</x>
<y>423</y>
</hint>
<hint type="destinationlabel">
<x>319</x>
<y>239</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -147,6 +147,17 @@ DiagramTextItem *DiagramItem::pointerText(unsigned char ID)
return 0; return 0;
} }
bool DiagramItem::textIsIO(unsigned char ID)
{
foreach(DiagramTextItem *item, textItems)
{
if(item->textID()==ID)
if(item->styleIO()!=0)
return 1;
}
return 0;
}
unsigned char DiagramItem::existArrow(DiagramTextItem *startItem, unsigned char DiagramItem::existArrow(DiagramTextItem *startItem,
DiagramTextItem *endItem) DiagramTextItem *endItem)
{ {

View File

@ -108,7 +108,6 @@ public:
unsigned char existArrow(DiagramTextItem *startItem, unsigned char existArrow(DiagramTextItem *startItem,
DiagramTextItem *endItem); DiagramTextItem *endItem);
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{QGraphicsPolygonItem::mousePressEvent(mouseEvent);} {QGraphicsPolygonItem::mousePressEvent(mouseEvent);}
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent); void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
@ -118,6 +117,7 @@ public:
bool setValue(unsigned char ioID, QString value); bool setValue(unsigned char ioID, QString value);
DiagramTextItem * pointerText(unsigned char ID); DiagramTextItem * pointerText(unsigned char ID);
bool textIsIO(unsigned char ID);
void setColor(const QColor &color) void setColor(const QColor &color)
{ myColor=color; setBrush(color); } { myColor=color; setBrush(color); }

View File

@ -277,10 +277,6 @@ QDomDocument DiagramScene::toXmlFormat()
QDomElement diagram = document.createElement("Diagram"); QDomElement diagram = document.createElement("Diagram");
document.appendChild(diagram); document.appendChild(diagram);
QDomElement test = document.createElement("Test");
test.text().fromAscii("TEXT HERE");
document.appendChild(test);
//Lists of items //Lists of items
QList<DiagramItem *> Items; QList<DiagramItem *> Items;
QList<Arrow *> Arrows; QList<Arrow *> Arrows;
@ -333,7 +329,7 @@ QDomDocument DiagramScene::toXmlFormat()
int DiagramScene::fromXmlFormat(QDomDocument document) int DiagramScene::fromXmlFormat(QDomDocument document)
{ {
//Read diagrams TODO: in future... add multi projects functionality //Read diagrams TODO: in future... add multi projects functionality
QHash<int , DiagramItem *> DiagramsID; DiagramsID.clear();
QDomNodeList diagrams = document.elementsByTagName("Diagram"); QDomNodeList diagrams = document.elementsByTagName("Diagram");
if(!diagrams.at(0).isElement()) if(!diagrams.at(0).isElement())
return 0; return 0;
@ -436,43 +432,68 @@ int DiagramScene::fromXmlFormat(QDomDocument document)
DiagramTextItem *startItem= DiagramTextItem *startItem=
DiagramsID.value(arrow.attribute("start-Owner").toInt()) DiagramsID.value(arrow.attribute("start-Owner").toInt())
->pointerText(arrow.attribute("start-ID").toInt()); ->pointerText(arrow.attribute("start-ID").toInt());
bool startIsIO =
DiagramsID.value(arrow.attribute("start-Owner").toInt())
->textIsIO(arrow.attribute("start-ID").toInt());
DiagramTextItem *endItem= DiagramTextItem *endItem=
DiagramsID.value(arrow.attribute("end-Owner").toInt()) DiagramsID.value(arrow.attribute("end-Owner").toInt())
->pointerText(arrow.attribute("end-ID").toInt()); ->pointerText(arrow.attribute("end-ID").toInt());
bool endIsIO =
DiagramsID.value(arrow.attribute("end-Owner").toInt())
->textIsIO(arrow.attribute("end-ID").toInt());
Arrow *newArrow = new Arrow(startItem, endItem,0,this); if(!startIsIO||!endIsIO)
newArrow->setColor(QColor(arrow.attribute("color")));
startItem->ownerItem()->addArrow(newArrow);
endItem->ownerItem()->addArrow(newArrow);
newArrow->setZValue(0.0);
addItem(newArrow);
newArrow->updatePosition();
for (QDomNode node = arrow.firstChild() ;
!node.isNull() ;
node = node.nextSibling())
{ {
//Load diagram text values and set on diagram item QMessageBox::warning(0,"Arrow can't be loaded.",
QDomElement arrowCorners = node.toElement(); tr("An arrow can not be loaded because ")+
if(arrowCorners.tagName()!="arrowCorners") tr("will be connected to a label")+
return 0; tr(" that isn't an Input/Output type. ")+
int i=0; tr("Probable cause may be that the start")+
for (QDomNode node = arrowCorners.firstChild() ; tr(" or end block has been modified."));
}
else if(startItem==0 || endItem==0)
{
QMessageBox::warning(0,"Arrow can't be loaded",
tr("An arrow can not be loaded because ")+
tr("her IO label ID could not be found. ")+
tr("Probable cause may be that the start")+
tr(" or end block has been modified."));
}
else
{
Arrow *newArrow = new Arrow(startItem, endItem,0,this);
newArrow->setColor(QColor(arrow.attribute("color")));
startItem->ownerItem()->addArrow(newArrow);
endItem->ownerItem()->addArrow(newArrow);
newArrow->setZValue(0.0);
addItem(newArrow);
newArrow->updatePosition();
for (QDomNode node = arrow.firstChild() ;
!node.isNull() ; !node.isNull() ;
node = node.nextSibling()) node = node.nextSibling())
{ {
QDomElement arrowCorner = node.toElement(); //Load diagram text values and set on diagram item
if(arrowCorner.tagName()!="arrowCorner") QDomElement arrowCorners = node.toElement();
if(arrowCorners.tagName()!="arrowCorners")
return 0; return 0;
int i=0;
for (QDomNode node = arrowCorners.firstChild() ;
!node.isNull() ;
node = node.nextSibling())
{
QDomElement arrowCorner = node.toElement();
if(arrowCorner.tagName()!="arrowCorner")
return 0;
QPointF cornerPos = QPointF cornerPos =
QPointF(arrowCorner.attribute("x").toFloat(), QPointF(arrowCorner.attribute("x").toFloat(),
arrowCorner.attribute("y").toFloat()); arrowCorner.attribute("y").toFloat());
newArrow->createCorner(cornerPos,++i); newArrow->createCorner(cornerPos,++i);
}
} }
} }
} }
} }
} }

View File

@ -67,7 +67,7 @@ class DiagramScene : public QGraphicsScene
public: public:
enum Mode { InsertItem, InsertLine, InsertText, MoveItem }; enum Mode { InsertItem, InsertLine, InsertText, MoveItem };
DiagramScene(QMenu *itemMenu, MainWindow *ownerWindow = 0, DiagramScene(QMenu *itemMenu, MainWindow *ownerWindow,
QObject *parent = 0); QObject *parent = 0);
QFont font() const QFont font() const
@ -88,6 +88,9 @@ public:
int fromXmlFormat(QDomDocument xmlDocument); int fromXmlFormat(QDomDocument xmlDocument);
void cleanScene(); void cleanScene();
QHash<int , DiagramItem *> getDiagramsID ()
{ return DiagramsID;}
QStringList getLibList(){return libraryList;} QStringList getLibList(){return libraryList;}
void setLibList(QStringList list) void setLibList(QStringList list)
{libraryList=list;} {libraryList=list;}
@ -136,6 +139,7 @@ private:
QStringList libraryList; QStringList libraryList;
QHash<QString , QDomElement*> domElementsByName; QHash<QString , QDomElement*> domElementsByName;
QHash<QString , int> buttonIdByName; QHash<QString , int> buttonIdByName;
QHash<int , DiagramItem *> DiagramsID;
MainWindow *myOwnerWindow; MainWindow *myOwnerWindow;
}; };

View File

@ -3,16 +3,19 @@ HEADERS = mainwindow.h \
diagramscene.h \ diagramscene.h \
arrow.h \ arrow.h \
diagramtextitem.h \ diagramtextitem.h \
lineitem.h lineitem.h \
codedialog.h \
codedialog.h \
codedialog.h
SOURCES = mainwindow.cpp \ SOURCES = mainwindow.cpp \
diagramitem.cpp \ diagramitem.cpp \
main.cpp \ main.cpp \
arrow.cpp \ arrow.cpp \
diagramtextitem.cpp \ diagramtextitem.cpp \
diagramscene.cpp \ diagramscene.cpp \
lineitem.cpp lineitem.cpp \
codedialog.cpp
RESOURCES = diagramscene.qrc RESOURCES = diagramscene.qrc
TARGET = diagrameditor TARGET = diagrameditor
# install # install
@ -30,4 +33,5 @@ symbian:include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
QT += xml \ QT += xml \
svg \ svg \
network network
FORMS += librarydialog.ui FORMS += librarydialog.ui \
codedialog.ui

View File

@ -76,7 +76,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bm3IFDvHlY,guid=a9cadece3d5adbab4e7ecc664cc367c4</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@ -84,11 +84,11 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value> <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value> <value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-EOe3re</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_PID=1591</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value> <value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value> <value type="QString">LANG=en_US.utf8</value>
<value type="QString">LANGUAGE=</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=juan64bits</value> <value type="QString">LOGNAME=juan64bits</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value> <value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
@ -96,20 +96,20 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value> <value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1609,unix/Maximus:/tmp/.ICE-unix/1609</value> <value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value> <value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1645</value> <value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-EOe3re/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">USER=juan64bits</value> <value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value> <value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-XFOps8/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287874500.2500-279079160</value> <value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
</valuelist> </valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/juan64bits/QT/sie_cg/diagramscene.pro</value> <value type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg/diagramscene.pro</value>
<value type="QString">-spec</value> <value type="QString">-spec</value>
<value type="QString">linux-g++</value> <value type="QString">linux-g++</value>
<value type="QString">-r</value> <value type="QString">-r</value>
@ -117,7 +117,7 @@
</valuelist> </valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value> <value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
<value key="abstractProcess.enabled" type="bool">false</value> <value key="abstractProcess.enabled" type="bool">false</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/sie_cg</value> <value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
@ -125,7 +125,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bm3IFDvHlY,guid=a9cadece3d5adbab4e7ecc664cc367c4</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@ -133,11 +133,11 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value> <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value> <value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-EOe3re</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_PID=1591</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value> <value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value> <value type="QString">LANG=en_US.utf8</value>
<value type="QString">LANGUAGE=</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=juan64bits</value> <value type="QString">LOGNAME=juan64bits</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value> <value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
@ -145,17 +145,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value> <value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1609,unix/Maximus:/tmp/.ICE-unix/1609</value> <value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value> <value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1645</value> <value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-EOe3re/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">USER=juan64bits</value> <value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value> <value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-XFOps8/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287874500.2500-279079160</value> <value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
@ -163,7 +163,7 @@
</valuelist> </valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value> <value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value> <value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/sie_cg</value> <value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>

View File

@ -24,5 +24,6 @@
<file>images/yes.png</file> <file>images/yes.png</file>
<file>images/zoom_in.png</file> <file>images/zoom_in.png</file>
<file>images/zoom_out.png</file> <file>images/zoom_out.png</file>
<file>images/cg.png</file>
</qresource> </qresource>
</RCC> </RCC>

BIN
Software/sie_cg/images/cg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@ -50,7 +50,7 @@ MainWindow::MainWindow()
{ {
buttonGroup=0; buttonGroup=0;
toolBox=0; toolBox=0;
statusBar = new QStatusBar(this);
createActions(); createActions();
createMenus(); createMenus();
scene = new DiagramScene(itemMenu,this); scene = new DiagramScene(itemMenu,this);
@ -68,9 +68,11 @@ MainWindow::MainWindow()
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
myFilePath = ""; myFilePath = "";
libDialog=0; libDialog=0;
cgDialog=0;
if(QApplication::argc()>1) if(QApplication::argc()>1)
{newDiagram(QString(QApplication::argv()[1]));} {newDiagram(QString(QApplication::argv()[1]));}
statusBar->showMessage("Ready...");
this->setStatusBar(statusBar);
} }
void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button) void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button)
@ -147,6 +149,35 @@ void MainWindow::pointerGroupClicked(int)
scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId())); scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
} }
void MainWindow::cgGroupClicked(int id)
{
if(id==0)
{
QString Test;
QHash<int , DiagramItem *> DiagramsID = scene->getDiagramsID();
foreach (QGraphicsItem *item, scene->items()) {
if (item->type() == DiagramItem::Type) {
Test+=(tr("\nDiagramID=\t") + QString::number(DiagramsID.
key(qgraphicsitem_cast<DiagramItem *>(item))));
QList<DiagramTextItem *> TextItems =
qgraphicsitem_cast<DiagramItem *>(item)->getTextItems();
foreach (DiagramTextItem *textItem, TextItems) {
Test+=(tr("\n\tTextItemID=\t") + QString::number(
textItem->textID()));
Test+=(tr("\n\t\tTextItemStyleIO=\t") + QString::number(
textItem->styleIO()));
Test+=(tr("\n\t\tTextItemValue=\t") +
textItem->toPlainText());
Test+=(tr("\n\t\tTextItemEditable=\t") +
(textItem->isEditable()?"true":"false"));
}
}
}
codeForm();
cgUi->codeTextEdit->setPlainText(Test);
}
}
void MainWindow::bringToFront() void MainWindow::bringToFront()
{ {
sendTo(1); sendTo(1);
@ -378,10 +409,10 @@ void MainWindow::createToolBox()
//toolBox->addItem(backgroundWidget, tr("Backgrounds")); //toolBox->addItem(backgroundWidget, tr("Backgrounds"));
//Add tool box to window //Add tool box to window
QHBoxLayout *newLayout = new QHBoxLayout; QGridLayout *newLayout = new QGridLayout;
newLayout->addWidget(toolBox); newLayout->addWidget(toolBox,0,0);
view = new QGraphicsView(scene); view = new QGraphicsView(scene);
newLayout->addWidget(view); newLayout->addWidget(view,0,1);
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
widget->setLayout(newLayout); widget->setLayout(newLayout);
@ -466,11 +497,13 @@ void MainWindow::createActions()
libraryAction = new QAction(tr("&Library..."),this); libraryAction = new QAction(tr("&Library..."),this);
libraryAction->setStatusTip(tr("Add, Remove or edit libraries"));
connect(libraryAction, SIGNAL(triggered()), connect(libraryAction, SIGNAL(triggered()),
this, SLOT(libraryForm())); this, SLOT(libraryForm()));
optionsAction = new QAction(tr("&Options"),this); optionsAction = new QAction(tr("&Options"),this);
optionsAction->setShortcuts(QKeySequence::Preferences); optionsAction->setShortcuts(QKeySequence::Preferences);
optionsAction->setStatusTip(tr("Edit options"));
connect(optionsAction, SIGNAL(triggered()), connect(optionsAction, SIGNAL(triggered()),
this, SLOT(optionsForm())); this, SLOT(optionsForm()));
@ -518,6 +551,20 @@ void MainWindow::createToolbars()
editToolBar->addAction(toFrontAction); editToolBar->addAction(toFrontAction);
editToolBar->addAction(sendBackAction); editToolBar->addAction(sendBackAction);
QToolButton *cgButton = new QToolButton;
cgButton->setCheckable(false);
cgButton->setIcon(QIcon(":/images/cg.png"));
cgGroup = new QButtonGroup;
cgGroup->addButton(cgButton,0);
connect(cgGroup, SIGNAL(buttonClicked(int)),
this, SLOT(cgGroupClicked(int)));
cgToolbar = addToolBar(tr("Code Generator"));
cgToolbar->addWidget(cgButton);
fontCombo = new QFontComboBox(); fontCombo = new QFontComboBox();
fontSizeCombo = new QComboBox(); fontSizeCombo = new QComboBox();
connect(fontCombo, SIGNAL(currentFontChanged(QFont)), connect(fontCombo, SIGNAL(currentFontChanged(QFont)),
@ -602,6 +649,7 @@ void MainWindow::createToolbars()
pointerToolbar->addWidget(pointerButton); pointerToolbar->addWidget(pointerButton);
pointerToolbar->addWidget(linePointerButton); pointerToolbar->addWidget(linePointerButton);
pointerToolbar->addWidget(sceneScaleCombo); pointerToolbar->addWidget(sceneScaleCombo);
} }
QWidget *MainWindow::createCellWidget(QString text, QDomElement *customItem) QWidget *MainWindow::createCellWidget(QString text, QDomElement *customItem)
@ -712,8 +760,8 @@ QDomDocument MainWindow::parseDocument(QString filePath)
file.close(); file.close();
if(!parsing) if(!parsing)
{ {
QMessageBox::warning(this,"Operation failed","Failed to parse file, " QMessageBox::warning(this,"Parsing warning","Invalid or void "
"wrong format or encoding."); " element found in file.");
} }
} }
else else
@ -821,16 +869,21 @@ int MainWindow::exportDiagram()
int MainWindow::libraryForm() int MainWindow::libraryForm()
{ {
bool firstTime=0;
if(!libDialog) if(!libDialog)
{ {
createLibraryDialog(); createLibraryDialog();
firstTime=1;
} }
libDialog->setModal(1); libDialog->setModal(1);
libUi->listLib->clear(); libUi->listLib->clear();
libUi->listLib->addItems(libraryList); libUi->listLib->addItems(libraryList);
libDialog->setWindowTitle(tr("Library paths...")); libDialog->setWindowTitle(tr("Library paths..."));
QStringList oldLibraryList=libraryList; QStringList oldLibraryList=libraryList;
libDialog->exec(); if(firstTime)
libDialog->exec();
else
libDialog->show();
if (libDialog->result() == QDialog::Rejected) if (libDialog->result() == QDialog::Rejected)
libraryList = oldLibraryList; libraryList = oldLibraryList;
@ -838,7 +891,7 @@ int MainWindow::libraryForm()
{ {
scene->setLibList(libraryList); scene->setLibList(libraryList);
updateLibraries(); updateLibraries();
} }
return 0; return 0;
} }
@ -854,6 +907,27 @@ void MainWindow::createLibraryDialog()
connect(libUi->editLib,SIGNAL(clicked()),this,SLOT(editLibPath())); connect(libUi->editLib,SIGNAL(clicked()),this,SLOT(editLibPath()));
} }
int MainWindow::codeForm()
{
if(!cgDialog)
{
createCgDialog();
}
cgDialog->setWindowTitle(tr("Code Generator..."));
cgUi->codeTextEdit->setAcceptRichText(true);
cgDialog->show();
return 0;
}
void MainWindow::createCgDialog()
{
cgDialog = new QMainWindow(this);
cgUi = new Ui_codeDialog;
cgUi->setupUi(cgDialog);
}
void MainWindow::addLibPath() void MainWindow::addLibPath()
{ {
QString QString
@ -869,10 +943,10 @@ void MainWindow::addLibPath()
" or not exists."); " or not exists.");
return; return;
} }
if(libUi->listLib->findItems(filePath,Qt::MatchExactly).count()==0) QDir myCurrentDir = this->currentDir();
{ QString relativePath= myCurrentDir.relativeFilePath(filePath);
QDir myCurrentDir = this->currentDir(); if(libUi->listLib->findItems(relativePath,Qt::MatchExactly).count()==0)
QString relativePath=myCurrentDir.relativeFilePath(filePath); {
libraryList.append(relativePath); libraryList.append(relativePath);
libUi->listLib->addItem(relativePath); libUi->listLib->addItem(relativePath);
} }

View File

@ -54,9 +54,13 @@
#include "lineitem.h" #include "lineitem.h"
#include "arrow.h" #include "arrow.h"
#include "ui_librarydialog.h" #include "ui_librarydialog.h"
#include "ui_codedialog.h"
class DiagramScene; class DiagramScene;
class DiagramTextItem;
class DiagramItem;
class Ui_libraryDialog; class Ui_libraryDialog;
class callexternappT;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAction; class QAction;
@ -86,9 +90,12 @@ public:
int updateLibraries(); int updateLibraries();
QStatusBar *statusBar;
private slots: private slots:
void backgroundButtonGroupClicked(QAbstractButton *button); void backgroundButtonGroupClicked(QAbstractButton *button);
void buttonGroupClicked(int id); void buttonGroupClicked(int id);
void cgGroupClicked(int id);
void deleteItem(); void deleteItem();
void pointerGroupClicked(int id); void pointerGroupClicked(int id);
void bringToFront(); void bringToFront();
@ -121,13 +128,14 @@ private slots:
int optionsForm(); int optionsForm();
int codeForm();
private: private:
int saveIfNeeded(); int saveIfNeeded();
void addLibrariesButtons(QGridLayout *layout); void addLibrariesButtons(QGridLayout *layout);
QDomDocument parseDocument(QString filePath); QDomDocument parseDocument(QString filePath);
void createLibraryDialog(); void createLibraryDialog();
void createCgDialog();
void createToolBox(); void createToolBox();
void createActions(); void createActions();
void createMenus(); void createMenus();
@ -167,10 +175,11 @@ private:
QMenu *aboutMenu; QMenu *aboutMenu;
QToolBar *fileToolBar; QToolBar *fileToolBar;
QToolBar *cgToolbar;
QToolBar *textToolBar; QToolBar *textToolBar;
QToolBar *editToolBar; QToolBar *editToolBar;
QToolBar *colorToolBar; QToolBar *colorToolBar;
QToolBar *pointerToolbar; QToolBar *pointerToolbar;
QComboBox *sceneScaleCombo; QComboBox *sceneScaleCombo;
QComboBox *itemColorCombo; QComboBox *itemColorCombo;
@ -181,6 +190,7 @@ private:
QToolBox *toolBox; QToolBox *toolBox;
QButtonGroup *buttonGroup; QButtonGroup *buttonGroup;
QButtonGroup *pointerTypeGroup; QButtonGroup *pointerTypeGroup;
QButtonGroup *cgGroup;
QButtonGroup *backgroundButtonGroup; QButtonGroup *backgroundButtonGroup;
QToolButton *fontColorToolButton; QToolButton *fontColorToolButton;
QToolButton *fillColorToolButton; QToolButton *fillColorToolButton;
@ -192,14 +202,14 @@ private:
QAction *fillAction; QAction *fillAction;
QAction *lineAction; QAction *lineAction;
QString myFilePath; QString myFilePath;
QDialog *libDialog; QDialog *libDialog;
Ui_libraryDialog *libUi; Ui_libraryDialog *libUi;
QMainWindow *cgDialog;
Ui_codeDialog *cgUi;
QStringList libraryList; QStringList libraryList;
QHash<QString , QDomElement*> domElementsByName; QHash<QString , QDomElement*> domElementsByName;
QHash<QString , int> buttonIdByName; QHash<QString , int> buttonIdByName;
static QString callexternapp(QString xexecFile, QString xexecParm); static QString callexternapp(QString xexecFile, QString xexecParm);
}; };
class callexternappT : public QThread class callexternappT : public QThread
@ -212,8 +222,8 @@ public:
{ {
QProcess lnexternapp; QProcess lnexternapp;
lnexternapp.start(QString("%1 %2").arg(execFile).arg(execParm)); lnexternapp.start(QString("%1 %2").arg(execFile).arg(execParm));
//lnexternapp.waitForFinished(-1); lnexternapp.waitForFinished(-1);
//retnValu = QString(lnexternapp.readAll()); retnValu = QString(lnexternapp.readAll());
} }
}; };

View File

@ -26,7 +26,7 @@ Arrows depend of items, and items depend of libraries!!!!
</DiagramItem> </DiagramItem>
<DiagramItem x="2460" y="2350" z="500" type="Right Shift" ID="1" color="#00ffff"> <DiagramItem x="2460" y="2350" z="500" type="Right Shift" ID="1" color="#00ffff">
<diagramValues> <diagramValues>
<diagramValue value="1" ID="11"/> <diagramValue value="2" ID="11"/>
</diagramValues> </diagramValues>
</DiagramItem> </DiagramItem>
<DiagramItem x="2670" y="2350" z="500" type="PWM Single" ID="2" color="#808000"> <DiagramItem x="2670" y="2350" z="500" type="PWM Single" ID="2" color="#808000">
@ -39,21 +39,19 @@ Arrows depend of items, and items depend of libraries!!!!
</DiagramItem> </DiagramItem>
<DiagramItem x="2470" y="2100" z="500" type="Constant" ID="4" color="#00ffff"> <DiagramItem x="2470" y="2100" z="500" type="Constant" ID="4" color="#00ffff">
<diagramValues> <diagramValues>
<diagramValue value="Value" ID="21"/> <diagramValue value="1" ID="1"/>
<diagramValue value="1" ID="19"/>
</diagramValues> </diagramValues>
</DiagramItem> </DiagramItem>
<DiagramItem x="2220" y="2330" z="-0.1" type="ADC Single" ID="5" color="#808080"> <DiagramItem x="2230" y="2330" z="-0.1" type="ADC Single" ID="5" color="#808080">
<diagramValues> <diagramValues>
<diagramValue value="255" ID="9"/>
<diagramValue value="0" ID="4"/> <diagramValue value="0" ID="4"/>
<diagramValue value="255" ID="7"/>
</diagramValues> </diagramValues>
</DiagramItem> </DiagramItem>
</DiagramItems> </DiagramItems>
<Arrows> <Arrows>
<Arrow end-ID="12" end-Owner="1" start-x="110" start-y="20" start-Owner="5" ID="0" start-ID="8" end-x="-70" end-y="0" color="#000000"/> <Arrow end-ID="2" end-Owner="1" start-x="110" start-y="20" start-Owner="5" ID="0" start-ID="7" end-x="-70" end-y="0" color="#000000"/>
<Arrow end-ID="14" end-Owner="2" start-x="60" start-y="0" start-Owner="1" ID="1" start-ID="13" end-x="-90" end-y="0" color="#000000"/> <Arrow end-ID="4" end-Owner="2" start-x="60" start-y="0" start-Owner="1" ID="1" start-ID="3" end-x="-90" end-y="0" color="#000000"/>
<Arrow end-ID="14" end-Owner="3" start-x="30" start-y="20" start-Owner="4" ID="2" start-ID="15" end-x="-50" end-y="10" color="#000000"/> <Arrow end-ID="6" end-Owner="3" start-x="30" start-y="20" start-Owner="4" ID="2" start-ID="15" end-x="-50" end-y="10" color="#000000"/>
</Arrows> </Arrows>
</Diagram> </Diagram>
<Test/>