124 QList<QTreeWidgetItem*> subfileItems; |
124 QList<QTreeWidgetItem*> subfileItems; |
125 |
125 |
126 for (Primitive& prim : cat->prims) |
126 for (Primitive& prim : cat->prims) |
127 { |
127 { |
128 SubfileListItem* item = new SubfileListItem (parentItem, &prim); |
128 SubfileListItem* item = new SubfileListItem (parentItem, &prim); |
129 item->setText (0, fmt ("%1 - %2", prim.name, prim.title)); |
129 item->setText (0, format ("%1 - %2", prim.name, prim.title)); |
130 subfileItems << item; |
130 subfileItems << item; |
131 |
131 |
132 // If this primitive is the one the current object points to, |
132 // If this primitive is the one the current object points to, |
133 // select it by default |
133 // select it by default |
134 if (obj && static_cast<LDSubfile*> (obj)->fileInfo()->name() == prim.name) |
134 if (obj && static_cast<LDSubfile*> (obj)->fileInfo()->name() == prim.name) |
150 } |
150 } |
151 } break; |
151 } break; |
152 |
152 |
153 default: |
153 default: |
154 { |
154 { |
155 critical (fmt ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName)); |
155 critical (format ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName)); |
156 } return; |
156 } return; |
157 } |
157 } |
158 |
158 |
159 QPixmap icon = getIcon (fmt ("add-%1", typeName)); |
159 QPixmap icon = getIcon (format ("add-%1", typeName)); |
160 LDObject* defaults = LDObject::getDefault (type); |
160 LDObject* defaults = LDObject::getDefault (type); |
161 |
161 |
162 lb_typeIcon = new QLabel; |
162 lb_typeIcon = new QLabel; |
163 lb_typeIcon->setPixmap (icon); |
163 lb_typeIcon->setPixmap (icon); |
164 |
164 |
259 QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
259 QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
260 QWidget::connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); |
260 QWidget::connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); |
261 QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); |
261 QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); |
262 layout->addWidget (bbx_buttons, 5, 0, 1, 4); |
262 layout->addWidget (bbx_buttons, 5, 0, 1, 4); |
263 setLayout (layout); |
263 setLayout (layout); |
264 setWindowTitle (fmt (tr ("Edit %1"), typeName)); |
264 setWindowTitle (format (tr ("Edit %1"), typeName)); |
265 |
265 |
266 setWindowIcon (icon); |
266 setWindowIcon (icon); |
267 defaults->destroy(); |
267 defaults->destroy(); |
268 } |
268 } |
269 |
269 |
275 |
275 |
276 button->setIcon (getIcon ("palette")); |
276 button->setIcon (getIcon ("palette")); |
277 button->setAutoFillBackground (true); |
277 button->setAutoFillBackground (true); |
278 |
278 |
279 if (col) |
279 if (col) |
280 button->setStyleSheet (fmt ("background-color: %1", col->hexcode)); |
280 button->setStyleSheet (format ("background-color: %1", col->hexcode)); |
281 } |
281 } |
282 |
282 |
283 // ============================================================================= |
283 // ============================================================================= |
284 // ============================================================================= |
284 // ============================================================================= |
285 QString AddObjectDialog::currentSubfileName() |
285 QString AddObjectDialog::currentSubfileName() |