332 { |
332 { |
333 LDObject* obj; |
333 LDObject* obj; |
334 bool ishistory = false; |
334 bool ishistory = false; |
335 bool prevIsHistory = false; |
335 bool prevIsHistory = false; |
336 |
336 |
337 QDialog* dlg = new QDialog; |
337 QDialog* dlg = new QDialog {m_window}; |
338 Ui_AddHistoryLine* ui = new Ui_AddHistoryLine; |
338 Ui_AddHistoryLine ui; |
339 ui->setupUi (dlg); |
339 ui.setupUi(dlg); |
340 ui->m_username->setText (m_config->defaultUser()); |
340 ui.m_username->setText (m_config->defaultUser()); |
341 ui->m_date->setDate (QDate::currentDate()); |
341 ui.m_date->setDate (QDate::currentDate()); |
342 ui->m_comment->setFocus(); |
342 ui.m_comment->setFocus(); |
343 |
343 |
344 if (not dlg->exec()) |
344 if (not dlg->exec()) |
345 return; |
345 return; |
346 |
346 |
347 // Find a spot to place the new comment |
347 // Find a spot to place the new comment |
362 |
362 |
363 int idx = obj ? obj->lineNumber() : 0; |
363 int idx = obj ? obj->lineNumber() : 0; |
364 |
364 |
365 // Create the comment object based on input |
365 // Create the comment object based on input |
366 currentDocument()->emplaceAt<LDComment>(idx++, format("!HISTORY %1 [%2] %3", |
366 currentDocument()->emplaceAt<LDComment>(idx++, format("!HISTORY %1 [%2] %3", |
367 ui->m_date->date().toString ("yyyy-MM-dd"), |
367 ui.m_date->date().toString ("yyyy-MM-dd"), |
368 ui->m_username->text(), |
368 ui.m_username->text(), |
369 ui->m_comment->text())); |
369 ui.m_comment->text())); |
370 |
370 |
371 // If we're adding a history line right before a scemantic object, pad it |
371 // If we're adding a history line right before a scemantic object, pad it |
372 // an empty line |
372 // an empty line |
373 if (obj and obj->next() and obj->next()->isScemantic()) |
373 if (obj and obj->next() and obj->next()->isScemantic()) |
374 currentDocument()->emplaceAt<LDEmpty>(idx); |
374 currentDocument()->emplaceAt<LDEmpty>(idx); |
375 |
375 |
376 m_window->buildObjectList(); |
376 m_window->buildObjectList(); |
377 delete ui; |
|
378 } |
377 } |
379 |
378 |
380 void AlgorithmToolset::splitLines() |
379 void AlgorithmToolset::splitLines() |
381 { |
380 { |
382 bool ok; |
381 bool ok; |