@@ -0,0 +1,25 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
|
2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
|
3 | <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="48" height="48" id="svg4289" sodipodi:version="0.32" inkscape:version="0.45" version="1.0" sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/actions" sodipodi:docname="list-add.svg" inkscape:export-filename="/home/andreas/project/gnome-icon-theme/scalable/actions/list-add.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:output_extension="org.inkscape.output.svg.inkscape"> | |||
|
4 | <defs id="defs4291"> | |||
|
5 | <linearGradient inkscape:collect="always" id="linearGradient4622"> | |||
|
6 | <stop style="stop-color:#b4b5b3;stop-opacity:1" offset="0" id="stop4624"/> | |||
|
7 | <stop style="stop-color:#d8d9d7;stop-opacity:1" offset="1" id="stop4626"/> | |||
|
8 | </linearGradient> | |||
|
9 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient4622" id="linearGradient4320" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2.810197,0,0,2.747234,1.562312,1.675085)" x1="8.6790628" y1="6.7354665" x2="8.7223368" y2="10.858153"/> | |||
|
10 | </defs> | |||
|
11 | <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="16" inkscape:cx="28.380765" inkscape:cy="26.638236" inkscape:current-layer="layer1" showgrid="false" inkscape:grid-bbox="true" inkscape:document-units="px" width="48px" height="48px" showguides="true" inkscape:guide-bbox="true" inkscape:window-width="1673" inkscape:window-height="968" inkscape:window-x="1" inkscape:window-y="27"/> | |||
|
12 | <metadata id="metadata4294"> | |||
|
13 | <rdf:RDF> | |||
|
14 | <cc:Work rdf:about=""> | |||
|
15 | <dc:format>image/svg+xml</dc:format> | |||
|
16 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> | |||
|
17 | </cc:Work> | |||
|
18 | </rdf:RDF> | |||
|
19 | </metadata> | |||
|
20 | <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer"> | |||
|
21 | <path style="opacity:1;fill:url(#linearGradient4320);fill-opacity:1;stroke:#555753;stroke-width:1.00000048;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 8.4999995,21.548779 L 8.4999995,26.514266 L 21.542175,26.514266 L 21.542175,38.455753 L 26.527841,38.500024 L 26.499007,26.514266 L 39.499998,26.469995 L 39.499998,21.548779 L 26.478909,21.548779 L 26.482175,8.542935 L 21.498141,8.5000092 L 21.496508,21.55147 L 8.4999995,21.548779 z " id="path4314" sodipodi:nodetypes="ccccccccccccc"/> | |||
|
22 | <path style="opacity:0.2;fill:white;fill-opacity:1;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" d="M 9,22.072045 L 22.070199,22.072045 L 22.065556,9 L 26.002778,9.1688851 L 25.957932,22.156486 L 38.906989,22.072045 L 38.906989,24.048454 L 9,24.048454 L 9,22.072045 z " id="path4316" sodipodi:nodetypes="ccccccccc"/> | |||
|
23 | <path style="opacity:0.4;fill:none;fill-opacity:1;stroke:white;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 9.5000012,22.518518 L 9.5000012,25.561981 L 22.540436,25.561981 L 22.540436,37.458666 L 25.525069,37.499986 L 25.498095,25.561981 L 38.500003,25.520661 L 38.500003,22.518518 L 25.567682,22.518518 L 25.570737,9.540046 L 22.499243,9.499982 L 22.497715,22.52103 L 9.5000012,22.518518 z " id="path5202" sodipodi:nodetypes="ccccccccccccc"/> | |||
|
24 | </g> | |||
|
25 | </svg> No newline at end of file |
@@ -0,0 +1,48 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
|
2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
|
3 | <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="48" height="48" id="svg4289" sodipodi:version="0.32" inkscape:version="0.45" version="1.0" sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/actions" sodipodi:docname="list-remove.svg" inkscape:export-filename="/home/andreas/project/gnome-icon-theme/22x22/actions/list-add.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:output_extension="org.inkscape.output.svg.inkscape"> | |||
|
4 | <defs id="defs4291"> | |||
|
5 | <linearGradient inkscape:collect="always" id="linearGradient4622"> | |||
|
6 | <stop style="stop-color:#b4b5b3;stop-opacity:1" offset="0" id="stop4624"/> | |||
|
7 | <stop style="stop-color:#d8d9d7;stop-opacity:1" offset="1" id="stop4626"/> | |||
|
8 | </linearGradient> | |||
|
9 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient4622" id="linearGradient4320" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2.810197,0,0,2.747234,1.562312,1.675085)" x1="8.6790628" y1="6.7354665" x2="8.7223368" y2="10.858153"/> | |||
|
10 | </defs> | |||
|
11 | <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="16" inkscape:cx="28.380765" inkscape:cy="26.606986" inkscape:current-layer="layer1" showgrid="false" inkscape:grid-bbox="true" inkscape:document-units="px" width="48px" height="48px" showguides="true" inkscape:guide-bbox="true" inkscape:window-width="1673" inkscape:window-height="968" inkscape:window-x="1" inkscape:window-y="27"/> | |||
|
12 | <metadata id="metadata4294"> | |||
|
13 | <rdf:RDF> | |||
|
14 | <cc:Work rdf:about=""> | |||
|
15 | <dc:format>image/svg+xml</dc:format> | |||
|
16 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> | |||
|
17 | <cc:license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/"/> | |||
|
18 | <dc:title>List remove</dc:title> | |||
|
19 | <dc:date>August 2006</dc:date> | |||
|
20 | <dc:creator> | |||
|
21 | <cc:Agent> | |||
|
22 | <dc:title>Andreas Nilsson</dc:title> | |||
|
23 | </cc:Agent> | |||
|
24 | </dc:creator> | |||
|
25 | <dc:source>http://www.gnome.org</dc:source> | |||
|
26 | <dc:subject> | |||
|
27 | <rdf:Bag> | |||
|
28 | <rdf:li>remove</rdf:li> | |||
|
29 | <rdf:li>minus</rdf:li> | |||
|
30 | </rdf:Bag> | |||
|
31 | </dc:subject> | |||
|
32 | </cc:Work> | |||
|
33 | <cc:License rdf:about="http://creativecommons.org/licenses/GPL/2.0/"> | |||
|
34 | <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> | |||
|
35 | <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> | |||
|
36 | <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/> | |||
|
37 | <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> | |||
|
38 | <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/> | |||
|
39 | <cc:requires rdf:resource="http://web.resource.org/cc/SourceCode"/> | |||
|
40 | </cc:License> | |||
|
41 | </rdf:RDF> | |||
|
42 | </metadata> | |||
|
43 | <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer"> | |||
|
44 | <path style="opacity:1;fill:url(#linearGradient4320);fill-opacity:1;stroke:#555753;stroke-width:1.00000048;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 8.4999995,21.548779 L 8.4999995,26.514266 L 39.499998,26.469995 L 39.499998,21.548779 L 8.4999995,21.548779 z " id="path4314" sodipodi:nodetypes="ccccc"/> | |||
|
45 | <path style="opacity:0.2;fill:white;fill-opacity:1;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" d="M 9,22.072045 L 38.906989,22.072045 L 38.906989,24.048454 L 9,24.048454 L 9,22.072045 z " id="path4316" sodipodi:nodetypes="ccccc"/> | |||
|
46 | <path style="opacity:0.4;fill:none;fill-opacity:1;stroke:white;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 9.5000012,22.518518 L 9.5000012,25.561981 L 38.500003,25.520661 L 38.500003,22.518518 L 9.5000012,22.518518 z " id="path5202" sodipodi:nodetypes="ccccc"/> | |||
|
47 | </g> | |||
|
48 | </svg> No newline at end of file |
@@ -0,0 +1,6 | |||||
|
1 | <RCC> | |||
|
2 | <qresource prefix="/img"> | |||
|
3 | <file>Gnome-list-add.svg</file> | |||
|
4 | <file>Gnome-list-remove.svg</file> | |||
|
5 | </qresource> | |||
|
6 | </RCC> |
@@ -0,0 +1,102 | |||||
|
1 | #include "collapsableperipheralwidget.h" | |||
|
2 | #include "ui_collapsableperipheralwidget.h" | |||
|
3 | #include <QCursor> | |||
|
4 | ||||
|
5 | ||||
|
6 | CollapsablePeripheralWidget::CollapsablePeripheralWidget(peripheralWidget *periph, QWidget *parent) : | |||
|
7 | QWidget(parent), | |||
|
8 | ui(new Ui::CollapsablePeripheralWidget) | |||
|
9 | { | |||
|
10 | m_periph=0; | |||
|
11 | m_collapsed = true; | |||
|
12 | ui->setupUi(this); | |||
|
13 | tthidetmr.setSingleShot(true); | |||
|
14 | tthidetmr.setInterval(200); | |||
|
15 | connect(this->ui->collapseQpb,SIGNAL(clicked()),this,SLOT(collapse())); | |||
|
16 | connect(this->ui->periphName,SIGNAL(clicked()),this,SLOT(collapse())); | |||
|
17 | connect(this->ui->periphName,SIGNAL(enter()),this,SLOT(showTooltip())); | |||
|
18 | connect(this->ui->periphName,SIGNAL(leave()),&this->tthidetmr,SLOT(start())); | |||
|
19 | connect(&this->tthidetmr,SIGNAL(timeout()),this,SLOT(hideTooltip())); | |||
|
20 | setPeripheralWidget(periph); | |||
|
21 | } | |||
|
22 | ||||
|
23 | CollapsablePeripheralWidget::~CollapsablePeripheralWidget() | |||
|
24 | { | |||
|
25 | delete ui; | |||
|
26 | } | |||
|
27 | ||||
|
28 | void CollapsablePeripheralWidget::setPeripheralWidget(peripheralWidget *periph) | |||
|
29 | { | |||
|
30 | if(periph) | |||
|
31 | { | |||
|
32 | this->m_periph = periph; | |||
|
33 | this->ui->gridLayout->addWidget(periph,1,0,1,-1); | |||
|
34 | this->ui->periphName->setText(periph->name()); | |||
|
35 | this->m_periph->setVisible(false); | |||
|
36 | } | |||
|
37 | } | |||
|
38 | ||||
|
39 | peripheralWidget *CollapsablePeripheralWidget::getPeripheralWidget() | |||
|
40 | { | |||
|
41 | return m_periph; | |||
|
42 | } | |||
|
43 | ||||
|
44 | void CollapsablePeripheralWidget::changeEvent(QEvent *e) | |||
|
45 | { | |||
|
46 | QWidget::changeEvent(e); | |||
|
47 | switch (e->type()) { | |||
|
48 | case QEvent::LanguageChange: | |||
|
49 | ui->retranslateUi(this); | |||
|
50 | break; | |||
|
51 | default: | |||
|
52 | break; | |||
|
53 | } | |||
|
54 | } | |||
|
55 | ||||
|
56 | void CollapsablePeripheralWidget::collapse() | |||
|
57 | { | |||
|
58 | this->m_periph->setVisible(m_collapsed); | |||
|
59 | if(this->m_collapsed) | |||
|
60 | { | |||
|
61 | this->ui->collapseQpb->setIcon(QIcon(":/img/Gnome-list-remove.svg")); | |||
|
62 | } | |||
|
63 | else | |||
|
64 | { | |||
|
65 | this->ui->collapseQpb->setIcon(QIcon(":/img/Gnome-list-add.svg")); | |||
|
66 | } | |||
|
67 | m_collapsed = !m_collapsed; | |||
|
68 | } | |||
|
69 | ||||
|
70 | void CollapsablePeripheralWidget::setName(const QString &name) | |||
|
71 | { | |||
|
72 | if(m_periph) | |||
|
73 | { | |||
|
74 | this->ui->periphName->setText(name); | |||
|
75 | } | |||
|
76 | } | |||
|
77 | ||||
|
78 | void CollapsablePeripheralWidget::showTooltip() | |||
|
79 | { | |||
|
80 | if(!m_periph->isVisible() && m_collapsed) | |||
|
81 | { | |||
|
82 | m_periph->show(); | |||
|
83 | } | |||
|
84 | } | |||
|
85 | ||||
|
86 | void CollapsablePeripheralWidget::hideTooltip() | |||
|
87 | { | |||
|
88 | if(m_periph->isVisible() && m_collapsed) | |||
|
89 | { | |||
|
90 | QRect temprect = this->geometry(); | |||
|
91 | temprect.moveTo(this->mapToGlobal(mapFromParent(QPoint(this->x(),this->y())))); | |||
|
92 | if(temprect.contains(QCursor::pos())) | |||
|
93 | { | |||
|
94 | this->tthidetmr.start(); | |||
|
95 | } | |||
|
96 | else | |||
|
97 | { | |||
|
98 | m_periph->hide(); | |||
|
99 | } | |||
|
100 | } | |||
|
101 | } | |||
|
102 |
@@ -0,0 +1,56 | |||||
|
1 | #ifndef COLLAPSABLEPERIPHERALWIDGET_H | |||
|
2 | #define COLLAPSABLEPERIPHERALWIDGET_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <peripheralwidget.h> | |||
|
6 | #include <QTimer> | |||
|
7 | ||||
|
8 | namespace Ui { | |||
|
9 | class CollapsablePeripheralWidget; | |||
|
10 | } | |||
|
11 | ||||
|
12 | class QRegToolTipLabel : public QLabel | |||
|
13 | { | |||
|
14 | Q_OBJECT | |||
|
15 | public: | |||
|
16 | QRegToolTipLabel(QWidget * parent = 0, Qt::WindowFlags f = 0):QLabel(parent,f){} | |||
|
17 | QRegToolTipLabel(const QString & text, QWidget * parent = 0, Qt::WindowFlags f = 0):QLabel(text,parent,f){} | |||
|
18 | signals: | |||
|
19 | void enter(); | |||
|
20 | void leave(); | |||
|
21 | void clicked(); | |||
|
22 | protected: | |||
|
23 | void enterEvent(QEvent* event){emit enter();QLabel::enterEvent(event);} | |||
|
24 | void leaveEvent(QEvent* event){emit leave();QLabel::leaveEvent(event);} | |||
|
25 | void mousePressEvent(QMouseEvent * event){emit clicked();QLabel::mousePressEvent(event);} | |||
|
26 | }; | |||
|
27 | ||||
|
28 | class CollapsablePeripheralWidget : public QWidget | |||
|
29 | { | |||
|
30 | Q_OBJECT | |||
|
31 | ||||
|
32 | public: | |||
|
33 | explicit CollapsablePeripheralWidget(peripheralWidget* periph,QWidget *parent = 0); | |||
|
34 | ~CollapsablePeripheralWidget(); | |||
|
35 | void setPeripheralWidget(peripheralWidget* periph); | |||
|
36 | peripheralWidget* getPeripheralWidget(); | |||
|
37 | protected: | |||
|
38 | void changeEvent(QEvent *e); | |||
|
39 | ||||
|
40 | public slots: | |||
|
41 | void collapse(); | |||
|
42 | void setName(const QString& name); | |||
|
43 | void showTooltip(); | |||
|
44 | void hideTooltip(); | |||
|
45 | signals: | |||
|
46 | void clicked(peripheralWidget* sender); | |||
|
47 | void upSig(peripheralWidget* sender,int cursorIndex); | |||
|
48 | void downSig(peripheralWidget* sender,int cursorIndex); | |||
|
49 | private: | |||
|
50 | Ui::CollapsablePeripheralWidget *ui; | |||
|
51 | peripheralWidget* m_periph; | |||
|
52 | bool m_collapsed; | |||
|
53 | QTimer tthidetmr; | |||
|
54 | }; | |||
|
55 | ||||
|
56 | #endif // COLLAPSABLEPERIPHERALWIDGET_H |
@@ -0,0 +1,89 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>CollapsablePeripheralWidget</class> | |||
|
4 | <widget class="QWidget" name="CollapsablePeripheralWidget"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>845</width> | |||
|
10 | <height>249</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="sizePolicy"> | |||
|
14 | <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | |||
|
15 | <horstretch>0</horstretch> | |||
|
16 | <verstretch>0</verstretch> | |||
|
17 | </sizepolicy> | |||
|
18 | </property> | |||
|
19 | <property name="windowTitle"> | |||
|
20 | <string>Form</string> | |||
|
21 | </property> | |||
|
22 | <property name="styleSheet"> | |||
|
23 | <string notr="true">QWidget#CollapsablePeripheralWidget { | |||
|
24 | border: 1px solid gray; | |||
|
25 | border-radius: 9px; | |||
|
26 | }</string> | |||
|
27 | </property> | |||
|
28 | <layout class="QGridLayout" name="gridLayout"> | |||
|
29 | <item row="0" column="2"> | |||
|
30 | <widget class="QPushButton" name="collapseQpb"> | |||
|
31 | <property name="sizePolicy"> | |||
|
32 | <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> | |||
|
33 | <horstretch>0</horstretch> | |||
|
34 | <verstretch>0</verstretch> | |||
|
35 | </sizepolicy> | |||
|
36 | </property> | |||
|
37 | <property name="text"> | |||
|
38 | <string/> | |||
|
39 | </property> | |||
|
40 | <property name="icon"> | |||
|
41 | <iconset resource="../ressources/peripheralwidget.qrc"> | |||
|
42 | <normaloff>:/img/Gnome-list-add.svg</normaloff> | |||
|
43 | <normalon>:/img/Gnome-list-remove.svg</normalon>:/img/Gnome-list-add.svg</iconset> | |||
|
44 | </property> | |||
|
45 | <property name="flat"> | |||
|
46 | <bool>true</bool> | |||
|
47 | </property> | |||
|
48 | </widget> | |||
|
49 | </item> | |||
|
50 | <item row="0" column="0"> | |||
|
51 | <widget class="QRegToolTipLabel" name="periphName"> | |||
|
52 | <property name="sizePolicy"> | |||
|
53 | <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | |||
|
54 | <horstretch>0</horstretch> | |||
|
55 | <verstretch>0</verstretch> | |||
|
56 | </sizepolicy> | |||
|
57 | </property> | |||
|
58 | <property name="text"> | |||
|
59 | <string>PeriphName</string> | |||
|
60 | </property> | |||
|
61 | </widget> | |||
|
62 | </item> | |||
|
63 | <item row="0" column="1"> | |||
|
64 | <spacer name="horizontalSpacer"> | |||
|
65 | <property name="orientation"> | |||
|
66 | <enum>Qt::Horizontal</enum> | |||
|
67 | </property> | |||
|
68 | <property name="sizeHint" stdset="0"> | |||
|
69 | <size> | |||
|
70 | <width>40</width> | |||
|
71 | <height>20</height> | |||
|
72 | </size> | |||
|
73 | </property> | |||
|
74 | </spacer> | |||
|
75 | </item> | |||
|
76 | </layout> | |||
|
77 | </widget> | |||
|
78 | <customwidgets> | |||
|
79 | <customwidget> | |||
|
80 | <class>QRegToolTipLabel</class> | |||
|
81 | <extends>QLabel</extends> | |||
|
82 | <header location="global">collapsableperipheralwidget.h</header> | |||
|
83 | </customwidget> | |||
|
84 | </customwidgets> | |||
|
85 | <resources> | |||
|
86 | <include location="../ressources/peripheralwidget.qrc"/> | |||
|
87 | </resources> | |||
|
88 | <connections/> | |||
|
89 | </ui> |
@@ -0,0 +1,107 | |||||
|
1 | #include "socregsviewernew.h" | |||
|
2 | #include "ui_socregsviewernew.h" | |||
|
3 | ||||
|
4 | SocRegsViewerNew::SocRegsViewerNew(const QString &name,QWidget *parent) : | |||
|
5 | QWidget(parent), | |||
|
6 | ui(new Ui::SocRegsViewerNew) | |||
|
7 | { | |||
|
8 | ui->setupUi(this); | |||
|
9 | this->ui->socName->setText(name); | |||
|
10 | } | |||
|
11 | ||||
|
12 | SocRegsViewerNew::~SocRegsViewerNew() | |||
|
13 | { | |||
|
14 | delete ui; | |||
|
15 | } | |||
|
16 | ||||
|
17 | peripheralWidget *SocRegsViewerNew::peripheral(int index) | |||
|
18 | { | |||
|
19 | if(index>=0 && index<p_peripherals.count()) | |||
|
20 | { | |||
|
21 | return p_peripherals.at(index); | |||
|
22 | } | |||
|
23 | return NULL; | |||
|
24 | } | |||
|
25 | ||||
|
26 | void SocRegsViewerNew::addPeripheral(peripheralWidget *peripheral) | |||
|
27 | { | |||
|
28 | if(peripheral!=NULL) | |||
|
29 | { | |||
|
30 | CollapsablePeripheralWidget* cperiph = new CollapsablePeripheralWidget(peripheral); | |||
|
31 | cperiph->setPeripheralWidget(peripheral); | |||
|
32 | p_peripherals.append(peripheral); | |||
|
33 | p_CPeripherals.append(cperiph); | |||
|
34 | this->ui->scrollAreaWidgetContents->layout()->addWidget(cperiph); | |||
|
35 | connect(cperiph,SIGNAL(clicked(peripheralWidget*)),this,SLOT(periphClicked(peripheralWidget*))); | |||
|
36 | connect(cperiph,SIGNAL(upSig(peripheralWidget*,int)),this,SLOT(periphUp(peripheralWidget*,int))); | |||
|
37 | connect(cperiph,SIGNAL(downSig(peripheralWidget*,int)),this,SLOT(periphDown(peripheralWidget*,int))); | |||
|
38 | } | |||
|
39 | } | |||
|
40 | ||||
|
41 | void SocRegsViewerNew::periphClicked(peripheralWidget *sender) | |||
|
42 | { | |||
|
43 | peripheralWidget * item; | |||
|
44 | if(sender!=NULL) | |||
|
45 | { | |||
|
46 | for(int i=0;i<p_peripherals.count();i++) | |||
|
47 | { | |||
|
48 | item = p_peripherals.at(i); | |||
|
49 | if(item!=sender) | |||
|
50 | { | |||
|
51 | item->leave(); | |||
|
52 | } | |||
|
53 | } | |||
|
54 | } | |||
|
55 | } | |||
|
56 | ||||
|
57 | void SocRegsViewerNew::periphUp(peripheralWidget *sender, int cursorIndex) | |||
|
58 | { | |||
|
59 | int index,senderIndex; | |||
|
60 | if(sender!=NULL) | |||
|
61 | { | |||
|
62 | index =senderIndex= p_peripherals.indexOf(sender); | |||
|
63 | while(index!=-1 && index!=0) | |||
|
64 | { | |||
|
65 | if(p_peripherals.at(index-1)->count()>0) | |||
|
66 | { | |||
|
67 | p_peripherals.at(senderIndex)->leave(); | |||
|
68 | p_peripherals.at(index-1)->enter(cursorIndex,false); | |||
|
69 | // ensureWidgetVisible(p_peripherals.at(index-1)); | |||
|
70 | break; | |||
|
71 | } | |||
|
72 | index--; | |||
|
73 | } | |||
|
74 | } | |||
|
75 | } | |||
|
76 | ||||
|
77 | void SocRegsViewerNew::periphDown(peripheralWidget *sender, int cursorIndex) | |||
|
78 | { | |||
|
79 | int index,senderIndex; | |||
|
80 | if(sender!=NULL) | |||
|
81 | { | |||
|
82 | index=senderIndex= p_peripherals.indexOf(sender); | |||
|
83 | while((index!=-1) && (index<(p_peripherals.count()-1))) | |||
|
84 | { | |||
|
85 | if(p_peripherals.at(index+1)->count()>0) | |||
|
86 | { | |||
|
87 | p_peripherals.at(senderIndex)->leave(); | |||
|
88 | p_peripherals.at(index+1)->enter(cursorIndex); | |||
|
89 | // ensureWidgetVisible(p_peripherals.at(index+1)); | |||
|
90 | break; | |||
|
91 | } | |||
|
92 | index++; | |||
|
93 | } | |||
|
94 | } | |||
|
95 | } | |||
|
96 | ||||
|
97 | void SocRegsViewerNew::changeEvent(QEvent *e) | |||
|
98 | { | |||
|
99 | QWidget::changeEvent(e); | |||
|
100 | switch (e->type()) { | |||
|
101 | case QEvent::LanguageChange: | |||
|
102 | ui->retranslateUi(this); | |||
|
103 | break; | |||
|
104 | default: | |||
|
105 | break; | |||
|
106 | } | |||
|
107 | } |
@@ -0,0 +1,38 | |||||
|
1 | #ifndef SOCREGSVIEWERNEW_H | |||
|
2 | #define SOCREGSVIEWERNEW_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <peripheralwidget.h> | |||
|
6 | #include <collapsableperipheralwidget.h> | |||
|
7 | ||||
|
8 | namespace Ui { | |||
|
9 | class SocRegsViewerNew; | |||
|
10 | } | |||
|
11 | ||||
|
12 | class SocRegsViewerNew : public QWidget | |||
|
13 | { | |||
|
14 | Q_OBJECT | |||
|
15 | ||||
|
16 | public: | |||
|
17 | explicit SocRegsViewerNew(const QString &name, QWidget *parent = 0); | |||
|
18 | ~SocRegsViewerNew(); | |||
|
19 | ||||
|
20 | peripheralWidget *peripheral(int index); | |||
|
21 | ||||
|
22 | signals: | |||
|
23 | ||||
|
24 | public slots: | |||
|
25 | void addPeripheral(peripheralWidget* peripheral); | |||
|
26 | void periphClicked(peripheralWidget* sender); | |||
|
27 | void periphUp(peripheralWidget* sender,int cursorIndex); | |||
|
28 | void periphDown(peripheralWidget* sender,int cursorIndex); | |||
|
29 | protected: | |||
|
30 | void changeEvent(QEvent *e); | |||
|
31 | ||||
|
32 | private: | |||
|
33 | Ui::SocRegsViewerNew *ui; | |||
|
34 | QList<peripheralWidget*> p_peripherals; | |||
|
35 | QList<CollapsablePeripheralWidget*> p_CPeripherals; | |||
|
36 | }; | |||
|
37 | ||||
|
38 | #endif // SOCREGSVIEWERNEW_H |
@@ -0,0 +1,60 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>SocRegsViewerNew</class> | |||
|
4 | <widget class="QWidget" name="SocRegsViewerNew"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>713</width> | |||
|
10 | <height>357</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Form</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QGridLayout" name="gridLayout"> | |||
|
17 | <item row="0" column="1"> | |||
|
18 | <widget class="QComboBox" name="rootPluginCmbBx"/> | |||
|
19 | </item> | |||
|
20 | <item row="2" column="0" colspan="2"> | |||
|
21 | <widget class="QScrollArea" name="PeriphList"> | |||
|
22 | <property name="widgetResizable"> | |||
|
23 | <bool>true</bool> | |||
|
24 | </property> | |||
|
25 | <widget class="QWidget" name="scrollAreaWidgetContents"> | |||
|
26 | <property name="geometry"> | |||
|
27 | <rect> | |||
|
28 | <x>0</x> | |||
|
29 | <y>0</y> | |||
|
30 | <width>693</width> | |||
|
31 | <height>302</height> | |||
|
32 | </rect> | |||
|
33 | </property> | |||
|
34 | <layout class="QVBoxLayout" name="verticalLayout"> | |||
|
35 | <item> | |||
|
36 | <widget class="QLabel" name="socName"> | |||
|
37 | <property name="text"> | |||
|
38 | <string>SocName</string> | |||
|
39 | </property> | |||
|
40 | <property name="alignment"> | |||
|
41 | <set>Qt::AlignCenter</set> | |||
|
42 | </property> | |||
|
43 | </widget> | |||
|
44 | </item> | |||
|
45 | </layout> | |||
|
46 | </widget> | |||
|
47 | </widget> | |||
|
48 | </item> | |||
|
49 | <item row="0" column="0"> | |||
|
50 | <widget class="QLabel" name="label"> | |||
|
51 | <property name="text"> | |||
|
52 | <string>Root Plugin</string> | |||
|
53 | </property> | |||
|
54 | </widget> | |||
|
55 | </item> | |||
|
56 | </layout> | |||
|
57 | </widget> | |||
|
58 | <resources/> | |||
|
59 | <connections/> | |||
|
60 | </ui> |
@@ -2,13 +2,22 | |||||
2 | PERIPHERAL_WDGT_SOURCES =\ |
|
2 | PERIPHERAL_WDGT_SOURCES =\ | |
3 | src/peripheralwidget.cpp \ |
|
3 | src/peripheralwidget.cpp \ | |
4 | src/registerwidget.cpp \ |
|
4 | src/registerwidget.cpp \ | |
5 | src/socregsviewer.cpp |
|
5 | src/socregsviewer.cpp \ | |
6 |
|
6 | src/socregsviewernew.cpp \ | ||
|
7 | src/collapsableperipheralwidget.cpp | |||
7 |
|
8 | |||
8 |
|
9 | |||
9 | PERIPHERAL_WDGT_HEADERS += \ |
|
10 | PERIPHERAL_WDGT_HEADERS += \ | |
10 | src/peripheralwidget.h \ |
|
11 | src/peripheralwidget.h \ | |
11 | src/registerwidget.h \ |
|
12 | src/registerwidget.h \ | |
12 | src/socregsviewer.h |
|
13 | src/socregsviewer.h \ | |
|
14 | src/socregsviewernew.h \ | |||
|
15 | src/collapsableperipheralwidget.h | |||
13 |
|
16 | |||
|
17 | PERIPHERAL_WDGT_FORMS += \ | |||
|
18 | src/socregsviewernew.ui \ | |||
|
19 | src/collapsableperipheralwidget.ui | |||
14 |
|
20 | |||
|
21 | PERIPHERAL_WDGT_RESOURCES += \ | |||
|
22 | $$PWD/ressources/peripheralwidget.qrc | |||
|
23 |
@@ -21,7 +21,7 | |||||
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "peripheralwidget.h" |
|
22 | #include "peripheralwidget.h" | |
23 |
|
23 | |||
24 | peripheralWidget::peripheralWidget(const QString &name, qint32 baseAddress, QWidget *parent) : |
|
24 | peripheralWidget::peripheralWidget(const QString &name, qint32 baseAddress, readWriteProxy *proxy, QWidget *parent) : | |
25 | QWidget(parent) |
|
25 | QWidget(parent) | |
26 | { |
|
26 | { | |
27 | p_name = name; |
|
27 | p_name = name; | |
@@ -29,6 +29,7 peripheralWidget::peripheralWidget(const | |||||
29 | p_timer->setInterval(500); |
|
29 | p_timer->setInterval(500); | |
30 | p_baseAddress = baseAddress; |
|
30 | p_baseAddress = baseAddress; | |
31 | p_header = p_name + QString(" @0x%1").arg((uint)p_baseAddress,8,16); |
|
31 | p_header = p_name + QString(" @0x%1").arg((uint)p_baseAddress,8,16); | |
|
32 | p_proxy = proxy; | |||
32 | setAttribute(Qt::WA_AlwaysShowToolTips); |
|
33 | setAttribute(Qt::WA_AlwaysShowToolTips); | |
33 | setMouseTracking(true); |
|
34 | setMouseTracking(true); | |
34 | setFocusPolicy(Qt::StrongFocus); |
|
35 | setFocusPolicy(Qt::StrongFocus); | |
@@ -36,6 +37,8 peripheralWidget::peripheralWidget(const | |||||
36 | registersWdgts.clear(); |
|
37 | registersWdgts.clear(); | |
37 | connect(p_timer,SIGNAL(timeout()),this,SLOT(blinkCursor())); |
|
38 | connect(p_timer,SIGNAL(timeout()),this,SLOT(blinkCursor())); | |
38 | setFont(QFont("Utopia", 14,QFont::Bold)); |
|
39 | setFont(QFont("Utopia", 14,QFont::Bold)); | |
|
40 | setMinimumSize(400,100); | |||
|
41 | updateGeometry(); | |||
39 | } |
|
42 | } | |
40 |
|
43 | |||
41 | int peripheralWidget::count() |
|
44 | int peripheralWidget::count() | |
@@ -43,6 +46,11 int peripheralWidget::count() | |||||
43 | return registersWdgts.count(); |
|
46 | return registersWdgts.count(); | |
44 | } |
|
47 | } | |
45 |
|
48 | |||
|
49 | const QString &peripheralWidget::name() | |||
|
50 | { | |||
|
51 | return this->p_name; | |||
|
52 | } | |||
|
53 | ||||
46 | void peripheralWidget::blinkCursor() |
|
54 | void peripheralWidget::blinkCursor() | |
47 | { |
|
55 | { | |
48 | if(selectedReg!=-1) |
|
56 | if(selectedReg!=-1) | |
@@ -87,6 +95,11 void peripheralWidget::enter(int cursorI | |||||
87 | } |
|
95 | } | |
88 | } |
|
96 | } | |
89 |
|
97 | |||
|
98 | void peripheralWidget::setReadWriteProxy(peripheralWidget::readWriteProxy *proxy) | |||
|
99 | { | |||
|
100 | this->p_proxy = proxy; | |||
|
101 | } | |||
|
102 | ||||
90 | void peripheralWidget::mousePressEvent(QMouseEvent *event) |
|
103 | void peripheralWidget::mousePressEvent(QMouseEvent *event) | |
91 | { |
|
104 | { | |
92 | p_timer->stop(); |
|
105 | p_timer->stop(); | |
@@ -129,7 +142,6 void peripheralWidget::mouseMoveEvent(QM | |||||
129 | { |
|
142 | { | |
130 | match = true; |
|
143 | match = true; | |
131 | int bitfieldIndex=registersWdgts.at(i)->cursorIndex(event->pos().x()); |
|
144 | int bitfieldIndex=registersWdgts.at(i)->cursorIndex(event->pos().x()); | |
132 |
|
||||
133 | QString toolTipText ="<b>< font color='Black'>"+registersWdgts.at(i)->bitFieldName(bitfieldIndex) +"</b><br />"; |
|
145 | QString toolTipText ="<b>< font color='Black'>"+registersWdgts.at(i)->bitFieldName(bitfieldIndex) +"</b><br />"; | |
134 | toolTipText+= "Hexadecimal=<b>< font color='Blue'>"+registersWdgts.at(i)->bitFieldToHex(bitfieldIndex)+"</b>"; |
|
146 | toolTipText+= "Hexadecimal=<b>< font color='Blue'>"+registersWdgts.at(i)->bitFieldToHex(bitfieldIndex)+"</b>"; | |
135 | toolTipText+= " Decimal=<b>< font color='BlueViolet'>"+registersWdgts.at(i)->bitFieldToDec(bitfieldIndex)+"</b><br />"; |
|
147 | toolTipText+= " Decimal=<b>< font color='BlueViolet'>"+registersWdgts.at(i)->bitFieldToDec(bitfieldIndex)+"</b><br />"; | |
@@ -160,13 +172,13 void peripheralWidget::keyPressEvent(QKe | |||||
160 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); |
|
172 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); | |
161 | break; |
|
173 | break; | |
162 | case Qt::Key_W: |
|
174 | case Qt::Key_W: | |
163 |
|
|
175 | p_proxy->writeReg(registersWdgts.at(selectedReg)->address(),registersWdgts.at(selectedReg)->value()); | |
164 | registersWdgts.at(selectedReg)->setUpdated(true); |
|
176 | registersWdgts.at(selectedReg)->setUpdated(true); | |
165 | registersWdgts.at(selectedReg)->repaint(); |
|
177 | registersWdgts.at(selectedReg)->repaint(); | |
166 | break; |
|
178 | break; | |
167 | case Qt::Key_R: |
|
179 | case Qt::Key_R: | |
168 | qint32 value; |
|
180 | qint32 value; | |
169 |
value = |
|
181 | value = p_proxy->readReg(registersWdgts.at(selectedReg)->address()); | |
170 | registersWdgts.at(selectedReg)->setValue(value); |
|
182 | registersWdgts.at(selectedReg)->setValue(value); | |
171 | break; |
|
183 | break; | |
172 | default: |
|
184 | default: | |
@@ -200,13 +212,13 void peripheralWidget::keyPressEvent(QKe | |||||
200 | down(); |
|
212 | down(); | |
201 | break; |
|
213 | break; | |
202 | case Qt::Key_W: |
|
214 | case Qt::Key_W: | |
203 |
|
|
215 | p_proxy->writeReg(registersWdgts.at(selectedReg)->address(),registersWdgts.at(selectedReg)->value()); | |
204 | registersWdgts.at(selectedReg)->setUpdated(true); |
|
216 | registersWdgts.at(selectedReg)->setUpdated(true); | |
205 | registersWdgts.at(selectedReg)->repaint(); |
|
217 | registersWdgts.at(selectedReg)->repaint(); | |
206 | break; |
|
218 | break; | |
207 | case Qt::Key_R: |
|
219 | case Qt::Key_R: | |
208 | qint32 value; |
|
220 | qint32 value; | |
209 |
value = |
|
221 | value = p_proxy->readReg(registersWdgts.at(selectedReg)->address()); | |
210 | registersWdgts.at(selectedReg)->setValue(value); |
|
222 | registersWdgts.at(selectedReg)->setValue(value); | |
211 | break; |
|
223 | break; | |
212 | default: |
|
224 | default: | |
@@ -236,7 +248,9 void peripheralWidget::paintEvent(QPaint | |||||
236 | } |
|
248 | } | |
237 | if(registersWdgts.count()>0) |
|
249 | if(registersWdgts.count()>0) | |
238 | { |
|
250 | { | |
239 |
|
|
251 | int w=registersWdgts.first()->boundingRect().width(); | |
|
252 | int h=offset.y(); | |||
|
253 | setMinimumSize(w,h); | |||
240 | } |
|
254 | } | |
241 | updateGeometry(); |
|
255 | updateGeometry(); | |
242 |
|
256 |
@@ -38,11 +38,20 | |||||
38 | * TODO ADD an outdated marker |
|
38 | * TODO ADD an outdated marker | |
39 | * Show outdated registers with a different color for example |
|
39 | * Show outdated registers with a different color for example | |
40 | */ |
|
40 | */ | |
|
41 | ||||
41 | class SOCEXPLORER_SDK_EXPORT peripheralWidget : public QWidget |
|
42 | class SOCEXPLORER_SDK_EXPORT peripheralWidget : public QWidget | |
42 | { |
|
43 | { | |
43 | Q_OBJECT |
|
44 | Q_OBJECT | |
44 | public: |
|
45 | public: | |
45 | explicit peripheralWidget(const QString& name,qint32 baseAddress, QWidget *parent = 0); |
|
46 | class readWriteProxy | |
|
47 | { | |||
|
48 | public: | |||
|
49 | readWriteProxy() {} | |||
|
50 | virtual void writeReg(qint32 address,qint32 value)=0; | |||
|
51 | virtual qint32 readReg(qint32 address)=0; | |||
|
52 | }; | |||
|
53 | ||||
|
54 | explicit peripheralWidget(const QString& name,qint32 baseAddress,readWriteProxy* proxy=0, QWidget *parent = 0); | |||
46 | registerWidget* registerAt(int index) |
|
55 | registerWidget* registerAt(int index) | |
47 | { |
|
56 | { | |
48 | if(index>=0 && index<registersWdgts.count()) |
|
57 | if(index>=0 && index<registersWdgts.count()) | |
@@ -50,6 +59,7 public: | |||||
50 | return NULL; |
|
59 | return NULL; | |
51 | } |
|
60 | } | |
52 | int count(); |
|
61 | int count(); | |
|
62 | const QString& name(); | |||
53 | signals: |
|
63 | signals: | |
54 | void writeRegSig(qint32 address,qint32 value); |
|
64 | void writeRegSig(qint32 address,qint32 value); | |
55 | qint32 readRegSig(qint32 address); |
|
65 | qint32 readRegSig(qint32 address); | |
@@ -61,6 +71,7 public slots: | |||||
61 | void addRegister(const QString& name,qint32 address); |
|
71 | void addRegister(const QString& name,qint32 address); | |
62 | void leave(); |
|
72 | void leave(); | |
63 | void enter(int cursorIndex,bool fromTop=true); |
|
73 | void enter(int cursorIndex,bool fromTop=true); | |
|
74 | void setReadWriteProxy(readWriteProxy* proxy); | |||
64 | protected: |
|
75 | protected: | |
65 | void mousePressEvent(QMouseEvent *event); |
|
76 | void mousePressEvent(QMouseEvent *event); | |
66 | void mouseMoveEvent(QMouseEvent *event); |
|
77 | void mouseMoveEvent(QMouseEvent *event); | |
@@ -77,6 +88,7 private: | |||||
77 | QList<registerWidget*> registersWdgts; |
|
88 | QList<registerWidget*> registersWdgts; | |
78 | int selectedReg; |
|
89 | int selectedReg; | |
79 | QTimer* p_timer; |
|
90 | QTimer* p_timer; | |
|
91 | readWriteProxy* p_proxy; | |||
80 |
|
92 | |||
81 | }; |
|
93 | }; | |
82 |
|
94 |
General Comments 0
You need to be logged in to leave comments.
Login now