Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 500:032deed8b35b
Connect quit function directly to closeAllWindows rather than try to closeAllWindows from close() (which strangely hangs on Windows)
author | Chris Cannam |
---|---|
date | Mon, 30 Jan 2012 16:56:39 +0000 |
parents | d2a58dfc3ae5 |
children | d09a396cde80 |
comparison
equal
deleted
inserted
replaced
498:d2a58dfc3ae5 | 500:032deed8b35b |
---|---|
147 m_rightButtonTransformsMenu(0), | 147 m_rightButtonTransformsMenu(0), |
148 m_rightButtonPlaybackMenu(0), | 148 m_rightButtonPlaybackMenu(0), |
149 m_soloAction(0), | 149 m_soloAction(0), |
150 m_soloModified(false), | 150 m_soloModified(false), |
151 m_prevSolo(false), | 151 m_prevSolo(false), |
152 m_exiting(false), | |
153 m_rwdStartAction(0), | 152 m_rwdStartAction(0), |
154 m_rwdSimilarAction(0), | 153 m_rwdSimilarAction(0), |
155 m_rwdAction(0), | 154 m_rwdAction(0), |
156 m_ffwdAction(0), | 155 m_ffwdAction(0), |
157 m_ffwdSimilarAction(0), | 156 m_ffwdSimilarAction(0), |
574 menu->addSeparator(); | 573 menu->addSeparator(); |
575 action = new QAction(il.load("exit"), | 574 action = new QAction(il.load("exit"), |
576 tr("&Quit"), this); | 575 tr("&Quit"), this); |
577 action->setShortcut(tr("Ctrl+Q")); | 576 action->setShortcut(tr("Ctrl+Q")); |
578 action->setStatusTip(tr("Exit Sonic Visualiser")); | 577 action->setStatusTip(tr("Exit Sonic Visualiser")); |
579 connect(action, SIGNAL(triggered()), this, SLOT(close())); | 578 connect(action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); |
580 m_keyReference->registerShortcut(action); | 579 m_keyReference->registerShortcut(action); |
581 menu->addAction(action); | 580 menu->addAction(action); |
582 } | 581 } |
583 | 582 |
584 void | 583 void |
3036 } | 3035 } |
3037 | 3036 |
3038 void | 3037 void |
3039 MainWindow::closeEvent(QCloseEvent *e) | 3038 MainWindow::closeEvent(QCloseEvent *e) |
3040 { | 3039 { |
3041 if (m_exiting) { | 3040 // std::cerr << "MainWindow::closeEvent" << std::endl; |
3042 e->accept(); | |
3043 return; | |
3044 } | |
3045 | |
3046 // SVDEBUG << "MainWindow::closeEvent" << endl; | |
3047 | 3041 |
3048 if (m_openingAudioFile) { | 3042 if (m_openingAudioFile) { |
3049 // std::cerr << "Busy - ignoring close event" << std::endl; | 3043 // std::cerr << "Busy - ignoring close event" << std::endl; |
3050 e->ignore(); | 3044 e->ignore(); |
3051 return; | 3045 return; |
3052 } | 3046 } |
3053 | 3047 |
3054 if (!m_abandoning && !checkSaveModified()) { | 3048 if (!m_abandoning && !checkSaveModified()) { |
3055 // SVDEBUG << "Ignoring close event" << endl; | 3049 // std::cerr << "Close refused by user - ignoring close event" << endl; |
3056 e->ignore(); | 3050 e->ignore(); |
3057 return; | 3051 return; |
3058 } | 3052 } |
3059 | 3053 |
3060 QSettings settings; | 3054 QSettings settings; |
3074 | 3068 |
3075 closeSession(); | 3069 closeSession(); |
3076 | 3070 |
3077 e->accept(); | 3071 e->accept(); |
3078 | 3072 |
3079 m_exiting = true; | |
3080 qApp->closeAllWindows(); | |
3081 | |
3082 return; | 3073 return; |
3083 } | 3074 } |
3084 | 3075 |
3085 bool | 3076 bool |
3086 MainWindow::commitData(bool mayAskUser) | 3077 MainWindow::commitData(bool mayAskUser) |
3435 LayerFactory::LayerType type = i->second.layer; | 3426 LayerFactory::LayerType type = i->second.layer; |
3436 | 3427 |
3437 LayerFactory::LayerTypeSet emptyTypes = | 3428 LayerFactory::LayerTypeSet emptyTypes = |
3438 LayerFactory::getInstance()->getValidEmptyLayerTypes(); | 3429 LayerFactory::getInstance()->getValidEmptyLayerTypes(); |
3439 | 3430 |
3440 Layer *newLayer; | 3431 Layer *newLayer = 0; |
3441 | 3432 |
3442 if (emptyTypes.find(type) != emptyTypes.end()) { | 3433 if (emptyTypes.find(type) != emptyTypes.end()) { |
3443 | 3434 |
3444 newLayer = m_document->createEmptyLayer(type); | 3435 newLayer = m_document->createEmptyLayer(type); |
3445 if (newLayer) { | 3436 if (newLayer) { |