src/mainwindow.cpp

changeset 985
ed7b31b9f904
parent 984
a7b6f987d269
child 986
525921eae58c
equal deleted inserted replaced
984:a7b6f987d269 985:ed7b31b9f904
89 connect (ui.objectList, SIGNAL (itemSelectionChanged()), this, SLOT (selectionChanged())); 89 connect (ui.objectList, SIGNAL (itemSelectionChanged()), this, SLOT (selectionChanged()));
90 connect (ui.objectList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (objectListDoubleClicked (QListWidgetItem*))); 90 connect (ui.objectList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (objectListDoubleClicked (QListWidgetItem*)));
91 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); 91 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected()));
92 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); 92 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int)));
93 93
94 if (ActivePrimitiveScanner() != nullptr) 94 if (ActivePrimitiveScanner())
95 connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); 95 connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives()));
96 else 96 else
97 updatePrimitives(); 97 updatePrimitives();
98 98
99 m_msglog = new MessageManager; 99 m_msglog = new MessageManager;
162 162
163 for (QVariant const& toolbarname : m_configOptions.hiddenToolbars()) 163 for (QVariant const& toolbarname : m_configOptions.hiddenToolbars())
164 { 164 {
165 QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString()); 165 QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString());
166 166
167 if (toolbar != nullptr) 167 if (toolbar)
168 toolbar->hide(); 168 toolbar->hide();
169 } 169 }
170 170
171 createBlankDocument(); 171 createBlankDocument();
172 m_renderer->setDocument (m_currentDocument); 172 m_renderer->setDocument (m_currentDocument);
1029 // Updates various actions, undo/redo are set enabled/disabled where appropriate, togglable actions are updated based 1029 // Updates various actions, undo/redo are set enabled/disabled where appropriate, togglable actions are updated based
1030 // on configuration, etc. 1030 // on configuration, etc.
1031 // 1031 //
1032 void MainWindow::updateActions() 1032 void MainWindow::updateActions()
1033 { 1033 {
1034 if (m_currentDocument != nullptr and m_currentDocument->history() != nullptr) 1034 if (m_currentDocument and m_currentDocument->history())
1035 { 1035 {
1036 EditHistory* his = m_currentDocument->history(); 1036 EditHistory* his = m_currentDocument->history();
1037 int pos = his->position(); 1037 int pos = his->position();
1038 ui.actionUndo->setEnabled (pos != -1); 1038 ui.actionUndo->setEnabled (pos != -1);
1039 ui.actionRedo->setEnabled (pos < (long) his->size() - 1); 1039 ui.actionRedo->setEnabled (pos < (long) his->size() - 1);
1256 // TODO: document may be null, this shouldn't be the case 1256 // TODO: document may be null, this shouldn't be the case
1257 // 1257 //
1258 void MainWindow::changeDocument (LDDocument* document) 1258 void MainWindow::changeDocument (LDDocument* document)
1259 { 1259 {
1260 // Implicit files were loaded for caching purposes and may never be switched to. 1260 // Implicit files were loaded for caching purposes and may never be switched to.
1261 if (document != nullptr and document->isCache()) 1261 if (document and document->isCache())
1262 return; 1262 return;
1263 1263
1264 m_currentDocument = document; 1264 m_currentDocument = document;
1265 1265
1266 if (document) 1266 if (document)

mercurial