| 84 applyToActions ([&](QAction* act) |
84 applyToActions ([&](QAction* act) |
| 85 { |
85 { |
| 86 connect (act, SIGNAL (triggered()), this, SLOT (actionTriggered())); |
86 connect (act, SIGNAL (triggered()), this, SLOT (actionTriggered())); |
| 87 m_defaultShortcuts[act] = act->shortcut(); |
87 m_defaultShortcuts[act] = act->shortcut(); |
| 88 }); |
88 }); |
| |
89 connect( |
| |
90 ui.header, |
| |
91 &HeaderEdit::descriptionChanged, |
| |
92 this, |
| |
93 &MainWindow::updateTitle |
| |
94 ); |
| 89 |
95 |
| 90 updateGridToolBar(); |
96 updateGridToolBar(); |
| 91 updateEditModeActions(); |
97 updateEditModeActions(); |
| 92 updateRecentFilesMenu(); |
98 updateRecentFilesMenu(); |
| 93 updateColorToolbar(); |
99 updateColorToolbar(); |
| 275 |
281 |
| 276 // --------------------------------------------------------------------------------------------------------------------- |
282 // --------------------------------------------------------------------------------------------------------------------- |
| 277 // |
283 // |
| 278 void MainWindow::updateTitle() |
284 void MainWindow::updateTitle() |
| 279 { |
285 { |
| 280 QString title = format (APPNAME " " VERSION_STRING); |
286 QString title = APPNAME " " VERSION_STRING; |
| 281 |
287 |
| 282 // Append our current file if we have one |
288 // Append our current file if we have one |
| 283 if (m_currentDocument) |
289 if (m_currentDocument) |
| 284 { |
290 { |
| 285 title += ": "; |
291 title += ": "; |
| 286 title += m_currentDocument->getDisplayName(); |
292 title += m_currentDocument->getDisplayName(); |
| 287 |
293 |
| 288 if (m_currentDocument->size() > 0 and |
294 if (not m_currentDocument->header.description.isEmpty()) |
| 289 m_currentDocument->getObject(0)->type() == LDObjectType::Comment) |
295 title += format (": %1", m_currentDocument->header.description); |
| 290 { |
|
| 291 // Append title |
|
| 292 LDComment* comm = static_cast <LDComment*> (m_currentDocument->getObject (0)); |
|
| 293 title += format (": %1", comm->text()); |
|
| 294 } |
|
| 295 |
296 |
| 296 if (m_currentDocument->hasUnsavedChanges()) |
297 if (m_currentDocument->hasUnsavedChanges()) |
| 297 title += '*'; |
298 title += '*'; |
| 298 } |
299 } |
| 299 |
300 |
| 945 // A ton of stuff needs to be updated |
946 // A ton of stuff needs to be updated |
| 946 updateDocumentListItem (document); |
947 updateDocumentListItem (document); |
| 947 updateTitle(); |
948 updateTitle(); |
| 948 print ("Changed document to %1", document->getDisplayName()); |
949 print ("Changed document to %1", document->getDisplayName()); |
| 949 ui.objectList->setModel(document); |
950 ui.objectList->setModel(document); |
| |
951 ui.header->setHeader(&document->header); |
| 950 QItemSelectionModel* selection = m_selections.value(document); |
952 QItemSelectionModel* selection = m_selections.value(document); |
| 951 |
953 |
| 952 if (selection == nullptr) |
954 if (selection == nullptr) |
| 953 { |
955 { |
| 954 m_selections[document] = ui.objectList->selectionModel(); |
956 m_selections[document] = ui.objectList->selectionModel(); |