mirror of
https://github.com/rgriebl/brickstore.git
synced 2026-05-01 04:31:16 -05:00
Load and save markers and added to BSX specification
This commit is contained in:
+6
-2
@@ -63,17 +63,21 @@ Item = element Item {
|
||||
|
||||
element Stockroom { string "A" | string "B" | string "C" }? & # default: no stockroom
|
||||
|
||||
# Optional elements, useful to track an item across catalog updates
|
||||
# Optional: useful to track an item across catalog updates
|
||||
element ItemName { xsd:string }? &
|
||||
element ItemTypeName { xsd:string }? &
|
||||
element ColorName { xsd:string }? &
|
||||
element CategoryID { xsd:integer }? &
|
||||
element CategoryName { xsd:string }? &
|
||||
|
||||
# Deprecated - replaced by the more versatile DifferenceBaseValues
|
||||
# Optional: deprecated - replaced by the more versatile DifferenceBaseValues
|
||||
element OrigQty { xsd:integer }? & # default: 0
|
||||
element OrigPrice { xsd:double }? & # default: 0
|
||||
|
||||
# Optional: new elements added in BrickStore 2021.3.3
|
||||
element MarkerText { xsd:string }? & # default: no marker text
|
||||
element MarkerColor { xsd:string }? & # default: no marker color, format: #RRGGBB
|
||||
|
||||
# Difference mode base values:
|
||||
# All attributes are optional and have a corresponding element defined above
|
||||
element DifferenceBaseValues {
|
||||
|
||||
@@ -268,13 +268,6 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
|
||||
|
||||
if (!selected) {
|
||||
switch (idx.column()) {
|
||||
case Document::Marker:
|
||||
if (lot->isMarked()) {
|
||||
bg = lot->markerColor();
|
||||
fg = Utility::textColor(bg);
|
||||
}
|
||||
break;
|
||||
|
||||
case Document::ItemType:
|
||||
if (lot->itemType())
|
||||
bg = shadeColor(lot->itemType()->id(), 0.1);
|
||||
@@ -346,8 +339,12 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
|
||||
case Document::Marker: {
|
||||
if (lot->isMarked()) {
|
||||
selectionFrame = true;
|
||||
selectionFrameFill = lot->markerColor();
|
||||
fg = Utility::textColor(selectionFrameFill);
|
||||
if (lot->markerColor().isValid()) {
|
||||
selectionFrameFill = lot->markerColor();
|
||||
fg = Utility::textColor(selectionFrameFill);
|
||||
} else {
|
||||
selectionFrameFill = bg;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1207,6 +1207,8 @@ DocumentIO::BsxContents DocumentIO::parseBsxInventory(QIODevice *in)
|
||||
v == "B"_l1 ? BrickLink::Stockroom::B :
|
||||
v == "C"_l1 ? BrickLink::Stockroom::C
|
||||
: BrickLink::Stockroom::None); } },
|
||||
{ u"MarkerText", [](auto lot, auto v) { lot->setMarkerText(v); } },
|
||||
{ u"MarkerColor", [](auto lot, auto v) { lot->setMarkerColor(QColor(v)); } },
|
||||
{ u"OrigPrice", [&legacyOrigPrice](auto lot, auto v) {
|
||||
Q_UNUSED(lot)
|
||||
legacyOrigPrice.setValue(v.toDouble());
|
||||
@@ -1484,6 +1486,10 @@ bool DocumentIO::createBsxInventory(QIODevice *out, const BsxContents &bsx)
|
||||
create(u"TotalWeight", &Lot::totalWeight, [](double d) {
|
||||
return QString::number(d, 'f', 4); }, Required);
|
||||
}
|
||||
if (!lot->markerText().isEmpty())
|
||||
create(u"MarkerText", &Lot::markerText, asString, Constant);
|
||||
if (lot->markerColor().isValid())
|
||||
create(u"MarkerColor", &Lot::markerColor, [](QColor c) { return c.name(); }, Constant);
|
||||
|
||||
if (base && !baseValues.isEmpty()) {
|
||||
xml.writeStartElement("DifferenceBaseValues"_l1);
|
||||
|
||||
Reference in New Issue
Block a user