Mercurial > hg > easaier-soundaccess
comparison sv/main/MainWindow.cpp @ 217:c24fafc45d50
add the lock and unlock window
author | benoitrigolleau |
---|---|
date | Thu, 07 Feb 2008 15:17:13 +0000 |
parents | c4e897bf012b |
children | e8175839a5ac |
comparison
equal
deleted
inserted
replaced
216:3045ced14a59 | 217:c24fafc45d50 |
---|---|
48 #include "widgets/ExpandWidget.h" | 48 #include "widgets/ExpandWidget.h" |
49 #include "widgets/AdvancedToolBox.h" | 49 #include "widgets/AdvancedToolBox.h" |
50 #include "widgets/ConnectionStatus.h" | 50 #include "widgets/ConnectionStatus.h" |
51 #include "widgets/LayerViewerWidget.h" | 51 #include "widgets/LayerViewerWidget.h" |
52 | 52 |
53 | |
54 #include "audioio/AudioCallbackPlaySource.h" | 53 #include "audioio/AudioCallbackPlaySource.h" |
55 #include "audioio/AudioCallbackPlayTarget.h" | 54 #include "audioio/AudioCallbackPlayTarget.h" |
56 #include "audioio/AudioTargetFactory.h" | 55 #include "audioio/AudioTargetFactory.h" |
57 #include "audioio/PlaySpeedRangeMapper.h" | 56 #include "audioio/PlaySpeedRangeMapper.h" |
58 #include "data/fileio/AudioFileReaderFactory.h" | 57 #include "data/fileio/AudioFileReaderFactory.h" |
151 m_documentModified(false), | 150 m_documentModified(false), |
152 m_openingAudioFile(false), | 151 m_openingAudioFile(false), |
153 m_abandoning(false), | 152 m_abandoning(false), |
154 m_preferencesDialog(0), | 153 m_preferencesDialog(0), |
155 m_playSpeedVal(1), | 154 m_playSpeedVal(1), |
156 m_curSender(0) | 155 m_curSender(0), |
156 m_nbLock(0) | |
157 { | 157 { |
158 | 158 |
159 m_videoWidget = 0; | 159 m_videoWidget = 0; |
160 m_instance = this; | 160 m_instance = this; |
161 | 161 |
389 m_EasaierManager = new EasaierSessionManager(m_httpClient); | 389 m_EasaierManager = new EasaierSessionManager(m_httpClient); |
390 | 390 |
391 connect(m_EasaierManager, SIGNAL(queryModelLoaded(QueryModel*)), | 391 connect(m_EasaierManager, SIGNAL(queryModelLoaded(QueryModel*)), |
392 this, SLOT(queryModelLoaded(QueryModel*))); | 392 this, SLOT(queryModelLoaded(QueryModel*))); |
393 | 393 |
394 | |
394 connect(m_EasaierManager, SIGNAL(audioFileLoaded()), | 395 connect(m_EasaierManager, SIGNAL(audioFileLoaded()), |
395 this, SLOT(audioFileLoaded())); | 396 this, SLOT(audioFileLoaded())); |
396 | 397 |
398 connect(m_EasaierManager, SIGNAL(audioFileLoaded()), | |
399 this, SLOT(unlockWindow())); | |
400 | |
397 setupMenus(); | 401 setupMenus(); |
398 setupToolbars(); | 402 setupToolbars(); |
399 | 403 |
400 statusBar(); | 404 statusBar(); |
401 | 405 |
402 newEasaierSession(); | 406 newEasaierSession(); |
403 | 407 |
404 } | 408 } |
409 | |
410 void MainWindow::lockWindow(){ | |
411 //lock the menu | |
412 QWidget *menu = this->menuWidget(); | |
413 if(menu){ | |
414 menu->setEnabled(false); | |
415 } | |
416 | |
417 // lock the toolbar | |
418 for(int i=0; i< m_toolBarVector.count();i++){ | |
419 m_toolBarVectorValues.append(m_toolBarVector[i]->isEnabled()); | |
420 m_toolBarVector[i]->setEnabled(false); | |
421 } | |
422 | |
423 //lock the central widget | |
424 | |
425 QWidget *centralWidget = this->centralWidget(); | |
426 if(centralWidget){ | |
427 QLayout *centralLayout = centralWidget->layout(); | |
428 if(centralLayout){ | |
429 m_waitwidget = new WaitingWidget; | |
430 m_waitwidget->setAnimation(true); | |
431 ((QGridLayout*) centralLayout)->addWidget(m_waitwidget , 0,0); | |
432 m_waitwidget->setGeometry(-20,-20,100,100); | |
433 } | |
434 } | |
435 m_nbLock++; | |
436 } | |
437 | |
438 void MainWindow::unlockWindow(){ | |
439 m_nbLock--; | |
440 if(m_nbLock<=0){ | |
441 //unlock the menu | |
442 QWidget *menu = this->menuWidget(); | |
443 if(menu){ | |
444 menu->setEnabled(true); | |
445 } | |
446 | |
447 // unlock the toolbar | |
448 for(int i=0; i< m_toolBarVector.count();i++){ | |
449 m_toolBarVector[i]->setEnabled(m_toolBarVectorValues[i]); | |
450 } | |
451 m_toolBarVectorValues.clear(); | |
452 | |
453 // unlock the central widget | |
454 QWidget *centralWidget = this->centralWidget(); | |
455 if(centralWidget){ | |
456 QLayout *centralLayout = centralWidget->layout(); | |
457 if(centralLayout){ | |
458 centralLayout->removeWidget(m_waitwidget); | |
459 delete m_waitwidget; | |
460 | |
461 } | |
462 } | |
463 } | |
464 } | |
465 | |
405 | 466 |
406 MainWindow::~MainWindow() | 467 MainWindow::~MainWindow() |
407 { | 468 { |
408 // std::cerr << "MainWindow::~MainWindow()" << std::endl; | 469 // std::cerr << "MainWindow::~MainWindow()" << std::endl; |
409 | 470 |
682 { | 743 { |
683 if (m_mainMenusCreated) return; | 744 if (m_mainMenusCreated) return; |
684 | 745 |
685 QMenu* menu = menuBar()->addMenu(tr("&Easaier")); | 746 QMenu* menu = menuBar()->addMenu(tr("&Easaier")); |
686 QToolBar *toolbar = addToolBar(tr("Easaier session Toolbar")); | 747 QToolBar *toolbar = addToolBar(tr("Easaier session Toolbar")); |
748 m_toolBarVector.append(toolbar); | |
687 | 749 |
688 QIcon icon(":icons/filenew.png"); | 750 QIcon icon(":icons/filenew.png"); |
689 QAction *action = new QAction(icon, tr("&New Session"), this); | 751 QAction *action = new QAction(icon, tr("&New Session"), this); |
690 action->setShortcut(tr("Ctrl+N")); | 752 action->setShortcut(tr("Ctrl+N")); |
691 action->setStatusTip(tr("Clear the current Easaier session and start a new one")); | 753 action->setStatusTip(tr("Clear the current Easaier session and start a new one")); |
1687 | 1749 |
1688 void | 1750 void |
1689 MainWindow::setupToolbars() | 1751 MainWindow::setupToolbars() |
1690 { | 1752 { |
1691 QToolBar *toolbar = addToolBar(tr("Transport Toolbar")); | 1753 QToolBar *toolbar = addToolBar(tr("Transport Toolbar")); |
1754 m_toolBarVector.append(toolbar); | |
1692 | 1755 |
1693 QAction *action = toolbar->addAction(QIcon(":/icons/rewind-start.png"), | 1756 QAction *action = toolbar->addAction(QIcon(":/icons/rewind-start.png"), |
1694 tr("Rewind to Start")); | 1757 tr("Rewind to Start")); |
1695 action->setShortcut(tr("Home")); | 1758 action->setShortcut(tr("Home")); |
1696 action->setStatusTip(tr("Rewind to the start")); | 1759 action->setStatusTip(tr("Rewind to the start")); |
1727 action->setStatusTip(tr("Fast-forward to the end")); | 1790 action->setStatusTip(tr("Fast-forward to the end")); |
1728 connect(action, SIGNAL(triggered()), this, SLOT(ffwdEnd())); | 1791 connect(action, SIGNAL(triggered()), this, SLOT(ffwdEnd())); |
1729 connect(this, SIGNAL(canPlay(bool)), action, SLOT(setEnabled(bool))); | 1792 connect(this, SIGNAL(canPlay(bool)), action, SLOT(setEnabled(bool))); |
1730 | 1793 |
1731 toolbar = addToolBar(tr("Play Mode Toolbar")); | 1794 toolbar = addToolBar(tr("Play Mode Toolbar")); |
1795 m_toolBarVector.append(toolbar); | |
1732 | 1796 |
1733 action = toolbar->addAction(QIcon(":/icons/playselection.png"), | 1797 action = toolbar->addAction(QIcon(":/icons/playselection.png"), |
1734 tr("Constrain Playback to Selection")); | 1798 tr("Constrain Playback to Selection")); |
1735 action->setCheckable(true); | 1799 action->setCheckable(true); |
1736 action->setChecked(m_viewManager->getPlaySelectionMode()); | 1800 action->setChecked(m_viewManager->getPlaySelectionMode()); |
1751 action, SLOT(setChecked(bool))); | 1815 action, SLOT(setChecked(bool))); |
1752 connect(action, SIGNAL(triggered()), this, SLOT(playLoopToggled())); | 1816 connect(action, SIGNAL(triggered()), this, SLOT(playLoopToggled())); |
1753 connect(this, SIGNAL(canPlay(bool)), action, SLOT(setEnabled(bool))); | 1817 connect(this, SIGNAL(canPlay(bool)), action, SLOT(setEnabled(bool))); |
1754 | 1818 |
1755 toolbar = addToolBar(tr("Edit Toolbar")); | 1819 toolbar = addToolBar(tr("Edit Toolbar")); |
1820 m_toolBarVector.append(toolbar); | |
1821 | |
1756 CommandHistory::getInstance()->registerToolbar(toolbar); | 1822 CommandHistory::getInstance()->registerToolbar(toolbar); |
1757 | 1823 |
1758 toolbar = addToolBar(tr("Tools Toolbar")); | 1824 toolbar = addToolBar(tr("Tools Toolbar")); |
1825 m_toolBarVector.append(toolbar); | |
1826 | |
1759 QActionGroup *group = new QActionGroup(this); | 1827 QActionGroup *group = new QActionGroup(this); |
1760 | 1828 |
1761 action = toolbar->addAction(QIcon(":/icons/navigate.png"), | 1829 action = toolbar->addAction(QIcon(":/icons/navigate.png"), |
1762 tr("Navigate")); | 1830 tr("Navigate")); |
1763 action->setCheckable(true); | 1831 action->setCheckable(true); |