mirror of https://github.com/KLayout/klayout.git
WIP: refined solution - some bug fixes, XML file is backward compatible now
This commit is contained in:
parent
8919916da9
commit
511f55d4da
|
|
@ -52,6 +52,8 @@
|
||||||
<file alias="clear_edit_16px@2x.png">images/clear_edit_16px@2x.png</file>
|
<file alias="clear_edit_16px@2x.png">images/clear_edit_16px@2x.png</file>
|
||||||
<file alias="clearbreakpoints_16px.png">images/clearbreakpoints_16px.png</file>
|
<file alias="clearbreakpoints_16px.png">images/clearbreakpoints_16px.png</file>
|
||||||
<file alias="clearbreakpoints_16px@2x.png">images/clearbreakpoints_16px@2x.png</file>
|
<file alias="clearbreakpoints_16px@2x.png">images/clearbreakpoints_16px@2x.png</file>
|
||||||
|
<file alias="clone_16px.png">images/clone_16px.png</file>
|
||||||
|
<file alias="clone_16px@2x.png">images/clone_16px@2x.png</file>
|
||||||
<file alias="cm_add_24px.png">images/cm_add_24px.png</file>
|
<file alias="cm_add_24px.png">images/cm_add_24px.png</file>
|
||||||
<file alias="cm_add_24px@2x.png">images/cm_add_24px@2x.png</file>
|
<file alias="cm_add_24px@2x.png">images/cm_add_24px@2x.png</file>
|
||||||
<file alias="cm_diff_24px.png">images/cm_diff_24px.png</file>
|
<file alias="cm_diff_24px.png">images/cm_diff_24px.png</file>
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 411 B |
Binary file not shown.
|
After Width: | Height: | Size: 673 B |
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 4.2333332 4.2333335"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1011"
|
||||||
|
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||||
|
sodipodi:docname="clone_16px.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1013"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
showgrid="true"
|
||||||
|
units="px"
|
||||||
|
inkscape:snap-nodes="true"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-nodes="true"
|
||||||
|
inkscape:snap-others="false"
|
||||||
|
inkscape:zoom="34.576923"
|
||||||
|
inkscape:cx="2.6173526"
|
||||||
|
inkscape:cy="10.006674"
|
||||||
|
inkscape:window-width="1846"
|
||||||
|
inkscape:window-height="1016"
|
||||||
|
inkscape:window-x="74"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
width="16px">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid1074"
|
||||||
|
spacingx="0.13229167"
|
||||||
|
spacingy="0.13229167"
|
||||||
|
empspacing="2" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs1008">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3600">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ff9f3f;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3602" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3604" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#fdfdfd;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.5"
|
||||||
|
d="M 0.92604171,2.3812501 V 1.9843751 H 1.9843751 V 0.92604171 h 0.79375 V 1.9843751 h 1.0583333 v 0.79375 H 2.7781251 v 1.0583333 h -0.79375 V 2.7781251 H 0.92604171 Z"
|
||||||
|
id="path828" />
|
||||||
|
<path
|
||||||
|
style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:#808080;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 0.92604171,2.3812501 V 1.9843751 H 1.9843751 V 0.92604171 h 0.79375 V 1.9843751 h 1.0583333 v 0.79375 H 2.7781251 v 1.0583333 h -0.79375 V 2.7781251 H 0.92604171 Z"
|
||||||
|
id="path830" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#fdfdfd;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.5"
|
||||||
|
d="M 0.39687504,1.8520834 V 1.4552084 H 1.4552084 V 0.39687504 h 0.79375 V 1.4552084 h 1.0583333 v 0.79375 H 2.2489584 v 1.0583333 h -0.79375 V 2.2489584 H 0.39687504 Z"
|
||||||
|
id="path3331" />
|
||||||
|
<rect
|
||||||
|
style="fill:none;stroke:#865b26;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
id="rect3596"
|
||||||
|
width="4.2333326"
|
||||||
|
height="4.2333331"
|
||||||
|
x="3.3333333e-07"
|
||||||
|
y="3.3333333e-07"
|
||||||
|
inkscape:export-filename="/home/matthias/klayout/master/src/lay/lay/images/back.png"
|
||||||
|
inkscape:export-xdpi="27.093315"
|
||||||
|
inkscape:export-ydpi="27.093315" />
|
||||||
|
<path
|
||||||
|
style="fill:#404040;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 0.39687504,1.8520834 V 1.4552084 H 1.4552084 V 0.39687504 h 0.79375 V 1.4552084 h 1.0583333 v 0.79375 H 2.2489584 v 1.0583333 h -0.79375 V 2.2489584 H 0.39687504 Z"
|
||||||
|
id="path2830" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -108,6 +108,9 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="add_pb">
|
<widget class="QToolButton" name="add_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Add technology</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -116,12 +119,15 @@
|
||||||
<normaloff>:/add_16px.png</normaloff>:/add_16px.png</iconset>
|
<normaloff>:/add_16px.png</normaloff>:/add_16px.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise">
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="delete_pb">
|
<widget class="QToolButton" name="delete_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Delete technology</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -130,33 +136,37 @@
|
||||||
<normaloff>:/clear_16px.png</normaloff>:/clear_16px.png</iconset>
|
<normaloff>:/clear_16px.png</normaloff>:/clear_16px.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise">
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<widget class="QToolButton" name="rename_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Rename technology</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rename</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../icons/icons.qrc">
|
||||||
|
<normaloff>:/rename_16px@2x.png</normaloff>:/rename_16px@2x.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>141</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="rename_pb">
|
|
||||||
<property name="text">
|
|
||||||
<string>Rename</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -435,6 +435,16 @@ public:
|
||||||
m_symbols.clear ();
|
m_symbols.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_connections ()
|
||||||
|
{
|
||||||
|
m_connections.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear_symbols ()
|
||||||
|
{
|
||||||
|
m_symbols.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
void erase (iterator p)
|
void erase (iterator p)
|
||||||
{
|
{
|
||||||
m_connections.erase (p);
|
m_connections.erase (p);
|
||||||
|
|
@ -524,7 +534,7 @@ public:
|
||||||
|
|
||||||
const_iterator end () const
|
const_iterator end () const
|
||||||
{
|
{
|
||||||
return m_connectivity.begin ();
|
return m_connectivity.end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator begin ()
|
iterator begin ()
|
||||||
|
|
|
||||||
|
|
@ -68,26 +68,94 @@ namespace tl
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class Value>
|
static const db::NetTracerConnectivity *
|
||||||
struct FallbackXMLWriteAdapator
|
get_default (const db::NetTracerTechnologyComponent &tc)
|
||||||
{
|
{
|
||||||
FallbackXMLWriteAdapator (void (db::NetTracerConnectivity::*member) (const Value &))
|
for (auto d = tc.begin (); d != tc.end (); ++d) {
|
||||||
: mp_member (member)
|
if (d->name ().empty ()) {
|
||||||
|
return d.operator-> ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tc.begin () != tc.end ()) {
|
||||||
|
return tc.begin ().operator-> ();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Value>
|
||||||
|
struct FallbackXMLWriteAdaptor
|
||||||
|
{
|
||||||
|
FallbackXMLWriteAdaptor (void (db::NetTracerConnectivity::*member) (const Value &), void (db::NetTracerConnectivity::*clear) ())
|
||||||
|
: mp_member (member), mp_clear (clear), mp_stack (0)
|
||||||
{
|
{
|
||||||
// .. nothing yet ..
|
// .. nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator () (db::NetTracerTechnologyComponent &owner, tl::XMLReaderState &reader) const
|
void operator () (db::NetTracerTechnologyComponent &owner, tl::XMLReaderState &reader) const
|
||||||
{
|
{
|
||||||
if (owner.size () == 0) {
|
if (! mp_stack) {
|
||||||
owner.push_back (db::NetTracerConnectivity ());
|
mp_stack = const_cast<db::NetTracerConnectivity *> (get_default (owner));
|
||||||
|
if (! mp_stack) {
|
||||||
|
owner.push_back (db::NetTracerConnectivity ());
|
||||||
|
mp_stack = (owner.end () - 1).operator-> ();
|
||||||
|
}
|
||||||
|
(mp_stack->*mp_clear) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
tl::XMLObjTag<Value> tag;
|
tl::XMLObjTag<Value> tag;
|
||||||
((*owner.begin ()).*mp_member) (*reader.back (tag));
|
(mp_stack->*mp_member) (*reader.back (tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (db::NetTracerConnectivity::*mp_member) (const Value &);
|
void (db::NetTracerConnectivity::*mp_member) (const Value &);
|
||||||
|
void (db::NetTracerConnectivity::*mp_clear) ();
|
||||||
|
mutable db::NetTracerConnectivity *mp_stack;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Value, class Iter>
|
||||||
|
struct FallbackXMLReadAdaptor
|
||||||
|
{
|
||||||
|
typedef tl::pass_by_ref_tag tag;
|
||||||
|
|
||||||
|
FallbackXMLReadAdaptor (Iter (db::NetTracerConnectivity::*begin) () const, Iter (db::NetTracerConnectivity::*end) () const)
|
||||||
|
: mp_begin (begin), mp_end (end)
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
|
Value operator () () const
|
||||||
|
{
|
||||||
|
return *m_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool at_end () const
|
||||||
|
{
|
||||||
|
return m_iter == m_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
void start (const db::NetTracerTechnologyComponent &parent)
|
||||||
|
{
|
||||||
|
const db::NetTracerConnectivity *tn = get_default (parent);
|
||||||
|
if (! tn) {
|
||||||
|
m_iter = Iter ();
|
||||||
|
m_end = Iter ();
|
||||||
|
} else {
|
||||||
|
m_iter = (tn->*mp_begin) ();
|
||||||
|
m_end = (tn->*mp_end) ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void next ()
|
||||||
|
{
|
||||||
|
++m_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Iter (db::NetTracerConnectivity::*mp_begin) () const;
|
||||||
|
Iter (db::NetTracerConnectivity::*mp_end) () const;
|
||||||
|
Iter m_iter, m_end;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -113,20 +181,20 @@ public:
|
||||||
virtual tl::XMLElementBase *xml_element () const
|
virtual tl::XMLElementBase *xml_element () const
|
||||||
{
|
{
|
||||||
return new db::TechnologyComponentXMLElement<NetTracerTechnologyComponent> (net_tracer_component_name (),
|
return new db::TechnologyComponentXMLElement<NetTracerTechnologyComponent> (net_tracer_component_name (),
|
||||||
// Fallback readers for migrating pre-0.28 setups to 0.28
|
|
||||||
tl::XMLMember<NetTracerConnectionInfo, NetTracerTechnologyComponent, tl::XMLMemberDummyReadAdaptor <NetTracerConnectionInfo, NetTracerTechnologyComponent>, FallbackXMLWriteAdapator <NetTracerConnectionInfo>, tl::XMLStdConverter <NetTracerConnectionInfo> > (
|
|
||||||
tl::XMLMemberDummyReadAdaptor <NetTracerConnectionInfo, NetTracerTechnologyComponent> (),
|
|
||||||
FallbackXMLWriteAdapator <NetTracerConnectionInfo> (&NetTracerConnectivity::add), "connection") +
|
|
||||||
tl::XMLMember<NetTracerSymbolInfo, NetTracerTechnologyComponent, tl::XMLMemberDummyReadAdaptor <NetTracerSymbolInfo, NetTracerTechnologyComponent>, FallbackXMLWriteAdapator <NetTracerSymbolInfo>, tl::XMLStdConverter <NetTracerSymbolInfo> > (
|
|
||||||
tl::XMLMemberDummyReadAdaptor <NetTracerSymbolInfo, NetTracerTechnologyComponent> (),
|
|
||||||
FallbackXMLWriteAdapator <NetTracerSymbolInfo> (&NetTracerConnectivity::add_symbol), "symbols") +
|
|
||||||
// 0.28 definitions
|
// 0.28 definitions
|
||||||
tl::make_element ((NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin, (NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end, (void (NetTracerTechnologyComponent::*) (const NetTracerConnectivity &)) &NetTracerTechnologyComponent::push_back, "connectivity",
|
tl::make_element ((NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin, (NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end, (void (NetTracerTechnologyComponent::*) (const NetTracerConnectivity &)) &NetTracerTechnologyComponent::push_back, "stack",
|
||||||
tl::make_member (&NetTracerConnectivity::name, &NetTracerConnectivity::set_name, "name") +
|
tl::make_member (&NetTracerConnectivity::name, &NetTracerConnectivity::set_name, "name") +
|
||||||
tl::make_member (&NetTracerConnectivity::description, &NetTracerConnectivity::set_description, "description") +
|
tl::make_member (&NetTracerConnectivity::description, &NetTracerConnectivity::set_description, "description") +
|
||||||
tl::make_member ((NetTracerConnectivity::const_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::begin, (NetTracerConnectivity::const_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::end, &NetTracerConnectivity::add, "connection") +
|
tl::make_member ((NetTracerConnectivity::const_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::begin, (NetTracerConnectivity::const_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::end, &NetTracerConnectivity::add, "connection") +
|
||||||
tl::make_member ((NetTracerConnectivity::const_symbol_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::begin_symbols, (NetTracerConnectivity::const_symbol_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::end_symbols, &NetTracerConnectivity::add_symbol, "symbols")
|
tl::make_member ((NetTracerConnectivity::const_symbol_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::begin_symbols, (NetTracerConnectivity::const_symbol_iterator (NetTracerConnectivity::*) () const) &NetTracerConnectivity::end_symbols, &NetTracerConnectivity::add_symbol, "symbols")
|
||||||
)
|
) +
|
||||||
|
// Fallback readers for migrating pre-0.28 setups to 0.28 and backward compatibility
|
||||||
|
tl::XMLMember<NetTracerConnectionInfo, NetTracerTechnologyComponent, FallbackXMLReadAdaptor <NetTracerConnectionInfo, NetTracerConnectivity::const_iterator>, FallbackXMLWriteAdaptor <NetTracerConnectionInfo>, tl::XMLStdConverter <NetTracerConnectionInfo> > (
|
||||||
|
FallbackXMLReadAdaptor <NetTracerConnectionInfo, NetTracerConnectivity::const_iterator> (&NetTracerConnectivity::begin, &NetTracerConnectivity::end),
|
||||||
|
FallbackXMLWriteAdaptor <NetTracerConnectionInfo> (&NetTracerConnectivity::add, &NetTracerConnectivity::clear_connections), "connection") +
|
||||||
|
tl::XMLMember<NetTracerSymbolInfo, NetTracerTechnologyComponent, FallbackXMLReadAdaptor <NetTracerSymbolInfo, NetTracerConnectivity::const_symbol_iterator>, FallbackXMLWriteAdaptor <NetTracerSymbolInfo>, tl::XMLStdConverter <NetTracerSymbolInfo> > (
|
||||||
|
FallbackXMLReadAdaptor <NetTracerSymbolInfo, NetTracerConnectivity::const_symbol_iterator> (&NetTracerConnectivity::begin_symbols, &NetTracerConnectivity::end_symbols),
|
||||||
|
FallbackXMLWriteAdaptor <NetTracerSymbolInfo> (&NetTracerConnectivity::add_symbol, &NetTracerConnectivity::clear_symbols), "symbols")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QFrame" name="frame_5">
|
<widget class="QFrame" name="frame_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -39,8 +45,11 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="4" column="4">
|
<item row="4" column="5">
|
||||||
<widget class="QToolButton" name="move_down_pb">
|
<widget class="QToolButton" name="move_down_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move selected stacks up</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -50,32 +59,24 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QToolButton" name="del_pb">
|
<widget class="QToolButton" name="add_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Add new stack</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../../icons/icons.qrc">
|
<iconset resource="../../../../icons/icons.qrc">
|
||||||
<normaloff>:/del_16px.png</normaloff>:/del_16px.png</iconset>
|
<normaloff>:/add_16px.png</normaloff>:/add_16px.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Del</string>
|
<string>Return</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="2" column="1" colspan="6">
|
||||||
<widget class="QToolButton" name="move_up_pb">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../../../icons/icons.qrc">
|
|
||||||
<normaloff>:/up_16px.png</normaloff>:/up_16px.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="5">
|
|
||||||
<widget class="QFrame" name="frame_2">
|
<widget class="QFrame" name="frame_2">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
|
@ -85,19 +86,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="6">
|
<item row="1" column="0" rowspan="2" colspan="7">
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Double-click to edit text</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" rowspan="2" colspan="6">
|
|
||||||
<widget class="QTreeWidget" name="stack_tree">
|
<widget class="QTreeWidget" name="stack_tree">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
|
@ -105,9 +94,18 @@
|
||||||
<verstretch>1</verstretch>
|
<verstretch>1</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
<property name="rootIsDecorated">
|
<property name="rootIsDecorated">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name</string>
|
<string>Name</string>
|
||||||
|
|
@ -120,7 +118,50 @@
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="5">
|
<item row="4" column="3">
|
||||||
|
<widget class="QToolButton" name="del_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove selected stacks</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../icons/icons.qrc">
|
||||||
|
<normaloff>:/del_16px.png</normaloff>:/del_16px.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Del</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="4">
|
||||||
|
<widget class="QToolButton" name="move_up_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move selected stacks down</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../icons/icons.qrc">
|
||||||
|
<normaloff>:/up_16px.png</normaloff>:/up_16px.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="7">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Double-click to edit text</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="6">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
|
@ -133,24 +174,24 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="0" column="0" colspan="7">
|
||||||
<widget class="QToolButton" name="add_pb">
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Technology Stacks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QToolButton" name="clone_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Clone current stack</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../../icons/icons.qrc">
|
<iconset resource="../../../../icons/icons.qrc">
|
||||||
<normaloff>:/add_16px.png</normaloff>:/add_16px.png</iconset>
|
<normaloff>:/clone_16px.png</normaloff>:/clone_16px.png</iconset>
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Return</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="6">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Technology Stacks</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,20 @@ NetTracerTechComponentEditor::NetTracerTechComponentEditor (QWidget *parent)
|
||||||
{
|
{
|
||||||
Ui::NetTracerTechComponentEditor::setupUi (this);
|
Ui::NetTracerTechComponentEditor::setupUi (this);
|
||||||
|
|
||||||
|
QAction *action;
|
||||||
|
action = new QAction (QObject::tr ("Add Stack"), this);
|
||||||
|
connect (action, SIGNAL (triggered ()), this, SLOT (add_clicked ()));
|
||||||
|
stack_tree->addAction (action);
|
||||||
|
action = new QAction (QObject::tr ("Delete Selected Stacks"), this);
|
||||||
|
connect (action, SIGNAL (triggered ()), this, SLOT (delete_clicked ()));
|
||||||
|
stack_tree->addAction (action);
|
||||||
|
action = new QAction (QObject::tr ("Duplicate Stack"), this);
|
||||||
|
connect (action, SIGNAL (triggered ()), this, SLOT (clone_clicked ()));
|
||||||
|
stack_tree->addAction (action);
|
||||||
|
|
||||||
connect (add_pb, SIGNAL (clicked ()), this, SLOT (add_clicked ()));
|
connect (add_pb, SIGNAL (clicked ()), this, SLOT (add_clicked ()));
|
||||||
connect (del_pb, SIGNAL (clicked ()), this, SLOT (del_clicked ()));
|
connect (del_pb, SIGNAL (clicked ()), this, SLOT (del_clicked ()));
|
||||||
|
connect (clone_pb, SIGNAL (clicked ()), this, SLOT (clone_clicked ()));
|
||||||
connect (move_up_pb, SIGNAL (clicked ()), this, SLOT (move_up_clicked ()));
|
connect (move_up_pb, SIGNAL (clicked ()), this, SLOT (move_up_clicked ()));
|
||||||
connect (move_down_pb, SIGNAL (clicked ()), this, SLOT (move_down_clicked ()));
|
connect (move_down_pb, SIGNAL (clicked ()), this, SLOT (move_down_clicked ()));
|
||||||
|
|
||||||
|
|
@ -154,6 +166,7 @@ NetTracerTechComponentEditor::commit ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commit_current ();
|
||||||
*data = m_data;
|
*data = m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,6 +188,11 @@ NetTracerTechComponentEditor::setup ()
|
||||||
stack_tree->setItemDelegateForColumn (1, new NetTracerTechComponentColumnDelegate (stack_tree, &m_data));
|
stack_tree->setItemDelegateForColumn (1, new NetTracerTechComponentColumnDelegate (stack_tree, &m_data));
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
|
|
||||||
|
if (stack_tree->topLevelItemCount () > 0) {
|
||||||
|
stack_tree->setCurrentItem (stack_tree->topLevelItem (0));
|
||||||
|
}
|
||||||
|
current_item_changed (stack_tree->currentItem (), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -207,6 +225,46 @@ NetTracerTechComponentEditor::commit_current (QTreeWidgetItem *current)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string
|
||||||
|
new_name (const db::NetTracerTechnologyComponent &data)
|
||||||
|
{
|
||||||
|
for (int i = 1; ; ++i) {
|
||||||
|
std::string n = "STACK" + tl::to_string (i);
|
||||||
|
bool found = false;
|
||||||
|
for (auto d = data.begin (); d != data.end () && ! found; ++d) {
|
||||||
|
found = (d->name () == n);
|
||||||
|
}
|
||||||
|
if (! found) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetTracerTechComponentEditor::clone_clicked ()
|
||||||
|
{
|
||||||
|
// removes focus from the tree view - commits the data
|
||||||
|
add_pb->setFocus ();
|
||||||
|
commit_current ();
|
||||||
|
|
||||||
|
int row = stack_tree->currentItem () ? stack_tree->indexOfTopLevelItem (stack_tree->currentItem ()) : -1;
|
||||||
|
if (row < 0) {
|
||||||
|
m_data.push_back (db::NetTracerConnectivity ());
|
||||||
|
row = int (m_data.size () - 1);
|
||||||
|
} else {
|
||||||
|
row += 1;
|
||||||
|
m_data.insert (m_data.begin () + row, db::NetTracerConnectivity ());
|
||||||
|
m_data.begin ()[row] = m_data.begin ()[row - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
m_data.begin ()[row].set_name (new_name (m_data));
|
||||||
|
|
||||||
|
update ();
|
||||||
|
stack_tree->setCurrentItem (stack_tree->topLevelItem (row));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetTracerTechComponentEditor::add_clicked ()
|
NetTracerTechComponentEditor::add_clicked ()
|
||||||
{
|
{
|
||||||
|
|
@ -223,6 +281,8 @@ NetTracerTechComponentEditor::add_clicked ()
|
||||||
m_data.insert (m_data.begin () + row, db::NetTracerConnectivity ());
|
m_data.insert (m_data.begin () + row, db::NetTracerConnectivity ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_data.begin ()[row].set_name (new_name (m_data));
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
stack_tree->setCurrentItem (stack_tree->topLevelItem (row));
|
stack_tree->setCurrentItem (stack_tree->topLevelItem (row));
|
||||||
}
|
}
|
||||||
|
|
@ -355,16 +415,12 @@ NetTracerTechComponentEditor::update ()
|
||||||
} else {
|
} else {
|
||||||
item->setData (0, Qt::DisplayRole, QVariant (tl::to_qstring (name)));
|
item->setData (0, Qt::DisplayRole, QVariant (tl::to_qstring (name)));
|
||||||
}
|
}
|
||||||
item->setData (1, Qt::DisplayRole, QVariant (tl::to_qstring (l->description ())));
|
|
||||||
|
|
||||||
item->setData (0, Qt::UserRole, QVariant (n));
|
item->setData (0, Qt::UserRole, QVariant (n));
|
||||||
|
|
||||||
}
|
item->setData (1, Qt::DisplayRole, QVariant (tl::to_qstring (l->description ())));
|
||||||
|
item->setData (1, Qt::UserRole, QVariant (n));
|
||||||
|
|
||||||
if (! stack_tree->currentItem () && stack_tree->topLevelItemCount () > 0) {
|
|
||||||
stack_tree->setCurrentItem (stack_tree->topLevelItem (0));
|
|
||||||
}
|
}
|
||||||
current_item_changed (stack_tree->currentItem (), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void add_clicked ();
|
void add_clicked ();
|
||||||
|
void clone_clicked ();
|
||||||
void del_clicked ();
|
void del_clicked ();
|
||||||
void move_up_clicked ();
|
void move_up_clicked ();
|
||||||
void move_down_clicked ();
|
void move_down_clicked ();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue