comparison framework/MainWindowBase.cpp @ 484:01aeda073720 tony-2.0-integration

Merge from branch recording
author Chris Cannam
date Tue, 15 Sep 2015 16:38:09 +0100
parents 52c0aff69478 493f2af85497
children 21d3cf5c8f21
comparison
equal deleted inserted replaced
482:01669adb0956 484:01aeda073720
153 m_abandoning(false), 153 m_abandoning(false),
154 m_labeller(0), 154 m_labeller(0),
155 m_lastPlayStatusSec(0), 155 m_lastPlayStatusSec(0),
156 m_initialDarkBackground(false), 156 m_initialDarkBackground(false),
157 m_defaultFfwdRwdStep(2, 0), 157 m_defaultFfwdRwdStep(2, 0),
158 m_audioRecordMode(RecordCreateAdditionalModel),
158 m_statusLabel(0), 159 m_statusLabel(0),
159 m_menuShortcutMapper(0) 160 m_menuShortcutMapper(0)
160 { 161 {
161 Profiler profiler("MainWindowBase::MainWindowBase"); 162 Profiler profiler("MainWindowBase::MainWindowBase");
162 163
609 emit canEditLayer(haveCurrentEditableLayer); 610 emit canEditLayer(haveCurrentEditableLayer);
610 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer); 611 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer);
611 emit canMeasureLayer(haveCurrentLayer); 612 emit canMeasureLayer(haveCurrentLayer);
612 emit canSelect(haveMainModel && haveCurrentPane); 613 emit canSelect(haveMainModel && haveCurrentPane);
613 emit canPlay(haveMainModel && havePlayTarget); 614 emit canPlay(haveMainModel && havePlayTarget);
614 emit canRecord(m_soundOptions & WithAudioInput); // always possible then 615 emit canRecord(m_recordTarget != 0);
615 emit canFfwd(haveMainModel); 616 emit canFfwd(haveMainModel);
616 emit canRewind(haveMainModel); 617 emit canRewind(haveMainModel);
617 emit canPaste(haveClipboardContents); 618 emit canPaste(haveClipboardContents);
618 emit canInsertInstant(haveCurrentPane); 619 emit canInsertInstant(haveCurrentPane);
619 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); 620 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection);
2681 m_recordTarget->stopRecording(); 2682 m_recordTarget->stopRecording();
2682 emit audioFileLoaded(); 2683 emit audioFileLoaded();
2683 return; 2684 return;
2684 } 2685 }
2685 2686
2687 if (m_audioRecordMode == RecordReplaceSession) {
2688 if (!checkSaveModified()) return;
2689 }
2690
2686 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2691 WritableWaveFileModel *model = m_recordTarget->startRecording();
2687 if (!model) { 2692 if (!model) {
2688 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2693 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2689 //!!! report 2694 //!!! report
2690 return; 2695 return;
2696 //!!! ??? 2701 //!!! ???
2697 return; 2702 return;
2698 } 2703 }
2699 2704
2700 PlayParameterRepository::getInstance()->addPlayable(model); 2705 PlayParameterRepository::getInstance()->addPlayable(model);
2701 2706
2702 if (!getMainModel()) { 2707 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {
2703 2708
2704 //!!! duplication with openAudio here 2709 //!!! duplication with openAudio here
2705 2710
2706 QString templateName = getDefaultSessionTemplate(); 2711 QString templateName = getDefaultSessionTemplate();
2707 bool loadedTemplate = false; 2712 bool loadedTemplate = false;
3611 } 3616 }
3612 #endif 3617 #endif
3613 #endif 3618 #endif
3614 } 3619 }
3615 3620
3616 3621 void
3622 MainWindowBase::openLocalFolder(QString path)
3623 {
3624 QDir d(path);
3625 if (d.exists()) {
3626 QStringList args;
3627 QString path = d.canonicalPath();
3628 #if defined Q_OS_WIN32
3629 // Although the Win32 API is quite happy to have
3630 // forward slashes as directory separators, Windows
3631 // Explorer is not
3632 path = path.replace('/', '\\');
3633 args << path;
3634 QProcess::execute("c:/windows/explorer.exe", args);
3635 #else
3636 args << path;
3637 QProcess::execute(
3638 #if defined Q_OS_MAC
3639 "/usr/bin/open",
3640 #else
3641 "/usr/bin/xdg-open",
3642 #endif
3643 args);
3644 #endif
3645 }
3646 }
3647