Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
8883cb23
Commit
8883cb23
authored
Jun 21, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made protocol generator much more usable, more UI tweaks needed to improve usability
parent
8ad9bf60
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
11 deletions
+64
-11
MAVLinkGen.cc
src/standalone/mavlinkgen/MAVLinkGen.cc
+1
-0
XMLCommProtocolWidget.cc
src/ui/XMLCommProtocolWidget.cc
+3
-1
DomModel.cc
src/ui/mavlink/DomModel.cc
+60
-10
No files found.
src/standalone/mavlinkgen/MAVLinkGen.cc
View file @
8883cb23
...
...
@@ -80,6 +80,7 @@ MAVLinkGen::MAVLinkGen(int &argc, char* argv[]) : QApplication(argc, argv)
QMainWindow
*
window
=
new
QMainWindow
();
window
->
setCentralWidget
(
new
XMLCommProtocolWidget
(
window
));
window
->
setWindowTitle
(
applicationName
()
+
" "
+
applicationVersion
());
// window->setBaseSize(qMin(1024, static_cast<int>(QApplication::desktop()->width()*0.8f)), qMin(900, static_cast<int>(QApplication::desktop()->height()*0.8f)));
window
->
show
();
}
...
...
src/ui/XMLCommProtocolWidget.cc
View file @
8883cb23
...
...
@@ -79,7 +79,9 @@ void XMLCommProtocolWidget::setXML(const QString& xml)
}
model
=
new
DomModel
(
doc
,
this
);
m_ui
->
xmlTreeView
->
setModel
(
model
);
m_ui
->
xmlTreeView
->
expandAll
();
// Expand the tree so that message names are visible
m_ui
->
xmlTreeView
->
expandToDepth
(
1
);
m_ui
->
xmlTreeView
->
hideColumn
(
2
);
m_ui
->
xmlTreeView
->
repaint
();
}
...
...
src/ui/mavlink/DomModel.cc
View file @
8883cb23
...
...
@@ -44,29 +44,79 @@ QVariant DomModel::data(const QModelIndex &index, int role) const
if
(
attribute
.
nodeName
()
==
"name"
)
return
attribute
.
nodeValue
();
}
}
if
(
node
.
nodeName
()
==
"field"
)
else
if
(
node
.
nodeName
()
==
"field"
)
{
for
(
int
i
=
0
;
i
<
attributeMap
.
count
();
++
i
)
{
QDomNode
attribute
=
attributeMap
.
item
(
i
);
if
(
attribute
.
nodeName
()
==
"name"
)
return
attribute
.
nodeValue
();
}
}
else
if
(
node
.
nodeName
()
==
"enum"
)
{
for
(
int
i
=
0
;
i
<
attributeMap
.
count
();
++
i
)
{
QDomNode
attribute
=
attributeMap
.
item
(
i
);
if
(
attribute
.
nodeName
()
==
"name"
)
return
attribute
.
nodeValue
();
}
}
else
if
(
node
.
nodeName
()
==
"entry"
)
{
for
(
int
i
=
0
;
i
<
attributeMap
.
count
();
++
i
)
{
QDomNode
attribute
=
attributeMap
.
item
(
i
);
if
(
attribute
.
nodeName
()
==
"name"
)
return
attribute
.
nodeValue
();
}
}
else
if
(
node
.
nodeName
()
==
"#text"
)
{
return
node
.
nodeValue
().
split
(
"
\n
"
).
join
(
" "
);
}
else
{
return
node
.
nodeName
();
}
}
break
;
case
1
:
if
(
node
.
nodeName
()
==
"description"
)
{
return
node
.
nodeValue
().
split
(
"
\n
"
).
join
(
" "
);
}
else
{
for
(
int
i
=
0
;
i
<
attributeMap
.
count
();
++
i
)
{
QDomNode
attribute
=
attributeMap
.
item
(
i
);
attributes
<<
attribute
.
nodeName
()
+
"=
\"
"
+
attribute
.
nodeValue
()
+
"
\"
"
;
if
(
attribute
.
nodeName
()
==
"id"
||
attribute
.
nodeName
()
==
"index"
||
attribute
.
nodeName
()
==
"value"
)
{
return
QString
(
"(# %1)"
).
arg
(
attribute
.
nodeValue
());
}
else
if
(
attribute
.
nodeName
()
==
"type"
)
{
return
attribute
.
nodeValue
();
}
}
return
attributes
.
join
(
" "
);
case
2
:
return
node
.
nodeValue
().
split
(
"
\n
"
).
join
(
" "
);
}
break
;
// case 2:
// {
//// if (node.nodeName() != "description")
//// {
//// for (int i = 0; i < attributeMap.count(); ++i) {
//// QDomNode attribute = attributeMap.item(i);
//// attributes << attribute.nodeName() + "=\""
//// +attribute.nodeValue() + "\"";
//// }
//// return attributes.join(" ");
//// }
//// else
//// {
//// return node.nodeValue().split("\n").join(" ");
//// }
// }
// break;
default:
{
return
QVariant
();
}
}
}
...
...
@@ -84,11 +134,11 @@ QVariant DomModel::headerData(int section, Qt::Orientation orientation,
if
(
orientation
==
Qt
::
Horizontal
&&
role
==
Qt
::
DisplayRole
)
{
switch
(
section
)
{
case
0
:
return
tr
(
"Name"
);
return
tr
(
"Name
"
);
case
1
:
return
tr
(
"Attributes"
);
case
2
:
return
tr
(
"Value"
);
// case 2:
// return tr("Description");
default:
return
QVariant
();
}
...
...
@@ -98,7 +148,7 @@ QVariant DomModel::headerData(int section, Qt::Orientation orientation,
}
QModelIndex
DomModel
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
const
const
{
if
(
!
hasIndex
(
row
,
column
,
parent
))
return
QModelIndex
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment