comparison framework/MainWindowBase.cpp @ 591:77d33ed8e753

More debug output during startup
author Chris Cannam
date Sun, 05 Mar 2017 17:15:46 +0000
parents 5f488e1868cc
children 1918bf5c9a9e
comparison
equal deleted inserted replaced
590:c196680910dc 591:77d33ed8e753
162 m_iconsVisibleInMenus(true), 162 m_iconsVisibleInMenus(true),
163 m_menuShortcutMapper(0) 163 m_menuShortcutMapper(0)
164 { 164 {
165 Profiler profiler("MainWindowBase::MainWindowBase"); 165 Profiler profiler("MainWindowBase::MainWindowBase");
166 166
167 SVDEBUG << "MainWindowBase::MainWindowBase" << endl;
168
167 if (options & WithAudioInput) { 169 if (options & WithAudioInput) {
168 if (!(options & WithAudioOutput)) { 170 if (!(options & WithAudioOutput)) {
169 cerr << "WARNING: MainWindowBase: WithAudioInput requires WithAudioOutput -- recording will not work" << endl; 171 SVCERR << "WARNING: MainWindowBase: WithAudioInput requires WithAudioOutput -- recording will not work" << endl;
170 } 172 }
171 } 173 }
172 174
173 qRegisterMetaType<sv_frame_t>("sv_frame_t"); 175 qRegisterMetaType<sv_frame_t>("sv_frame_t");
174 qRegisterMetaType<sv_samplerate_t>("sv_samplerate_t"); 176 qRegisterMetaType<sv_samplerate_t>("sv_samplerate_t");
182 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), 184 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
183 this, SLOT(documentModified())); 185 this, SLOT(documentModified()));
184 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()), 186 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
185 this, SLOT(documentRestored())); 187 this, SLOT(documentRestored()));
186 188
189 SVDEBUG << "MainWindowBase: Creating view manager" << endl;
190
187 m_viewManager = new ViewManager(); 191 m_viewManager = new ViewManager();
188 connect(m_viewManager, SIGNAL(selectionChanged()), 192 connect(m_viewManager, SIGNAL(selectionChanged()),
189 this, SLOT(updateMenuStates())); 193 this, SLOT(updateMenuStates()));
190 connect(m_viewManager, SIGNAL(inProgressSelectionChanged()), 194 connect(m_viewManager, SIGNAL(inProgressSelectionChanged()),
191 this, SLOT(inProgressSelectionChanged())); 195 this, SLOT(inProgressSelectionChanged()));
196
197 SVDEBUG << "MainWindowBase: Calculating view font size" << endl;
192 198
193 // set a sensible default font size for views -- cannot do this 199 // set a sensible default font size for views -- cannot do this
194 // in Preferences, which is in base and not supposed to use QtGui 200 // in Preferences, which is in base and not supposed to use QtGui
195 int viewFontSize = int(QApplication::font().pointSize() * 0.9); 201 int viewFontSize = int(QApplication::font().pointSize() * 0.9);
196 QSettings settings; 202 QSettings settings;
197 settings.beginGroup("Preferences"); 203 settings.beginGroup("Preferences");
198 viewFontSize = settings.value("view-font-size", viewFontSize).toInt(); 204 viewFontSize = settings.value("view-font-size", viewFontSize).toInt();
199 settings.setValue("view-font-size", viewFontSize); 205 settings.setValue("view-font-size", viewFontSize);
200 settings.endGroup(); 206 settings.endGroup();
207
208 SVDEBUG << "MainWindowBase: View font size is " << viewFontSize << endl;
201 209
202 #ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS 210 #ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS
203 Preferences::BackgroundMode mode = 211 Preferences::BackgroundMode mode =
204 Preferences::getInstance()->getBackgroundMode(); 212 Preferences::getInstance()->getBackgroundMode();
205 m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); 213 m_initialDarkBackground = m_viewManager->getGlobalDarkBackground();
228 this, SLOT(paneDropAccepted(Pane *, QStringList))); 236 this, SLOT(paneDropAccepted(Pane *, QStringList)));
229 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QString)), 237 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QString)),
230 this, SLOT(paneDropAccepted(Pane *, QString))); 238 this, SLOT(paneDropAccepted(Pane *, QString)));
231 connect(m_paneStack, SIGNAL(paneDeleteButtonClicked(Pane *)), 239 connect(m_paneStack, SIGNAL(paneDeleteButtonClicked(Pane *)),
232 this, SLOT(paneDeleteButtonClicked(Pane *))); 240 this, SLOT(paneDeleteButtonClicked(Pane *)));
241
242 SVDEBUG << "MainWindowBase: Creating play source" << endl;
233 243
234 m_playSource = new AudioCallbackPlaySource 244 m_playSource = new AudioCallbackPlaySource
235 (m_viewManager, QApplication::applicationName()); 245 (m_viewManager, QApplication::applicationName());
236 246
237 if (m_soundOptions & WithAudioInput) { 247 if (m_soundOptions & WithAudioInput) {
248 SVDEBUG << "MainWindowBase: Creating record target" << endl;
238 m_recordTarget = new AudioCallbackRecordTarget 249 m_recordTarget = new AudioCallbackRecordTarget
239 (m_viewManager, QApplication::applicationName()); 250 (m_viewManager, QApplication::applicationName());
240 connect(m_recordTarget, 251 connect(m_recordTarget,
241 SIGNAL(recordDurationChanged(sv_frame_t, sv_samplerate_t)), 252 SIGNAL(recordDurationChanged(sv_frame_t, sv_samplerate_t)),
242 this, 253 this,
243 SLOT(recordDurationChanged(sv_frame_t, sv_samplerate_t))); 254 SLOT(recordDurationChanged(sv_frame_t, sv_samplerate_t)));
244 } 255 }
245 256
246 connect(m_playSource, SIGNAL(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)), 257 connect(m_playSource, SIGNAL(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)),
247 this, SLOT(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool))); 258 this, SLOT(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)));
248 connect(m_playSource, SIGNAL(channelCountIncreased(int)), 259 connect(m_playSource, SIGNAL(channelCountIncreased(int)),
249 this, SLOT(audioChannelCountIncreased(int))); 260 this, SLOT(audioChannelCountIncreased(int)));
250 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()), 261 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()),
251 this, SLOT(audioOverloadPluginDisabled())); 262 this, SLOT(audioOverloadPluginDisabled()));
252 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()), 263 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()),
270 connect(Preferences::getInstance(), 281 connect(Preferences::getInstance(),
271 SIGNAL(propertyChanged(PropertyContainer::PropertyName)), 282 SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
272 this, 283 this,
273 SLOT(preferenceChanged(PropertyContainer::PropertyName))); 284 SLOT(preferenceChanged(PropertyContainer::PropertyName)));
274 285
286 SVDEBUG << "MainWindowBase: Creating labeller" << endl;
287
275 Labeller::ValueType labellerType = Labeller::ValueFromTwoLevelCounter; 288 Labeller::ValueType labellerType = Labeller::ValueFromTwoLevelCounter;
276 settings.beginGroup("MainWindow"); 289 settings.beginGroup("MainWindow");
277 290
278 labellerType = (Labeller::ValueType) 291 labellerType = (Labeller::ValueType)
279 settings.value("labellertype", (int)labellerType).toInt(); 292 settings.value("labellertype", (int)labellerType).toInt();
283 296
284 m_labeller = new Labeller(labellerType); 297 m_labeller = new Labeller(labellerType);
285 m_labeller->setCounterCycleSize(cycle); 298 m_labeller->setCounterCycleSize(cycle);
286 299
287 if (m_soundOptions & WithMIDIInput) { 300 if (m_soundOptions & WithMIDIInput) {
301 SVDEBUG << "MainWindowBase: Creating MIDI input" << endl;
288 m_midiInput = new MIDIInput(QApplication::applicationName(), this); 302 m_midiInput = new MIDIInput(QApplication::applicationName(), this);
289 } 303 }
290 304
291 QTimer::singleShot(1500, this, SIGNAL(hideSplash())); 305 QTimer::singleShot(1500, this, SIGNAL(hideSplash()));
306
307 SVDEBUG << "MainWindowBase: Constructor done" << endl;
292 } 308 }
293 309
294 MainWindowBase::~MainWindowBase() 310 MainWindowBase::~MainWindowBase()
295 { 311 {
296 SVDEBUG << "MainWindowBase::~MainWindowBase" << endl; 312 SVDEBUG << "MainWindowBase::~MainWindowBase" << endl;
315 } 331 }
316 332
317 void 333 void
318 MainWindowBase::emitHideSplash() 334 MainWindowBase::emitHideSplash()
319 { 335 {
336 SVDEBUG << "MainWindowBase: Hiding splash screen" << endl;
320 emit hideSplash(this); 337 emit hideSplash(this);
321 } 338 }
322 339
323 void 340 void
324 MainWindowBase::finaliseMenus() 341 MainWindowBase::finaliseMenus()
325 { 342 {
343 SVDEBUG << "MainWindowBase::finaliseMenus called" << endl;
344
326 delete m_menuShortcutMapper; 345 delete m_menuShortcutMapper;
327 m_menuShortcutMapper = 0; 346 m_menuShortcutMapper = 0;
328 347
329 foreach (QShortcut *sc, m_appShortcuts) { 348 foreach (QShortcut *sc, m_appShortcuts) {
330 delete sc; 349 delete sc;
346 (QString(), Qt::FindDirectChildrenOnly); 365 (QString(), Qt::FindDirectChildrenOnly);
347 366
348 foreach (QMenu *menu, menus) { 367 foreach (QMenu *menu, menus) {
349 if (menu) finaliseMenu(menu); 368 if (menu) finaliseMenu(menu);
350 } 369 }
370
371 SVDEBUG << "MainWindowBase::finaliseMenus done" << endl;
351 } 372 }
352 373
353 void 374 void
354 MainWindowBase::finaliseMenu(QMenu *menu) 375 MainWindowBase::finaliseMenu(QMenu *menu)
355 { 376 {