Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 366:0876ea394902 warnfix_no_size_t
Remove size_t's, fix compiler warnings
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 16:23:06 +0100 |
parents | 4969e7921931 |
children | f1cab64363d7 |
comparison
equal
deleted
inserted
replaced
355:e7a3fa8f4eec | 366:0876ea394902 |
---|---|
211 this, SLOT(paneDeleteButtonClicked(Pane *))); | 211 this, SLOT(paneDeleteButtonClicked(Pane *))); |
212 | 212 |
213 m_playSource = new AudioCallbackPlaySource(m_viewManager, | 213 m_playSource = new AudioCallbackPlaySource(m_viewManager, |
214 QApplication::applicationName()); | 214 QApplication::applicationName()); |
215 | 215 |
216 connect(m_playSource, SIGNAL(sampleRateMismatch(size_t, size_t, bool)), | 216 connect(m_playSource, SIGNAL(sampleRateMismatch(int, int, bool)), |
217 this, SLOT(sampleRateMismatch(size_t, size_t, bool))); | 217 this, SLOT(sampleRateMismatch(int, int, bool))); |
218 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()), | 218 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()), |
219 this, SLOT(audioOverloadPluginDisabled())); | 219 this, SLOT(audioOverloadPluginDisabled())); |
220 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()), | 220 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()), |
221 this, SLOT(audioTimeStretchMultiChannelDisabled())); | 221 this, SLOT(audioTimeStretchMultiChannelDisabled())); |
222 | 222 |
223 connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)), | 223 connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)), |
224 this, SLOT(outputLevelsChanged(float, float))); | 224 this, SLOT(outputLevelsChanged(float, float))); |
225 | 225 |
226 connect(m_viewManager, SIGNAL(playbackFrameChanged(unsigned long)), | 226 connect(m_viewManager, SIGNAL(playbackFrameChanged(int)), |
227 this, SLOT(playbackFrameChanged(unsigned long))); | 227 this, SLOT(playbackFrameChanged(int))); |
228 | 228 |
229 connect(m_viewManager, SIGNAL(globalCentreFrameChanged(unsigned long)), | 229 connect(m_viewManager, SIGNAL(globalCentreFrameChanged(int)), |
230 this, SLOT(globalCentreFrameChanged(unsigned long))); | 230 this, SLOT(globalCentreFrameChanged(int))); |
231 | 231 |
232 connect(m_viewManager, SIGNAL(viewCentreFrameChanged(View *, unsigned long)), | 232 connect(m_viewManager, SIGNAL(viewCentreFrameChanged(View *, int)), |
233 this, SLOT(viewCentreFrameChanged(View *, unsigned long))); | 233 this, SLOT(viewCentreFrameChanged(View *, int))); |
234 | 234 |
235 connect(m_viewManager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)), | 235 connect(m_viewManager, SIGNAL(viewZoomLevelChanged(View *, int, bool)), |
236 this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool))); | 236 this, SLOT(viewZoomLevelChanged(View *, int, bool))); |
237 | 237 |
238 connect(Preferences::getInstance(), | 238 connect(Preferences::getInstance(), |
239 SIGNAL(propertyChanged(PropertyContainer::PropertyName)), | 239 SIGNAL(propertyChanged(PropertyContainer::PropertyName)), |
240 this, | 240 this, |
241 SLOT(preferenceChanged(PropertyContainer::PropertyName))); | 241 SLOT(preferenceChanged(PropertyContainer::PropertyName))); |
279 if (menu) finaliseMenu(menu); | 279 if (menu) finaliseMenu(menu); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void | 283 void |
284 MainWindowBase::finaliseMenu(QMenu *menu) | 284 MainWindowBase::finaliseMenu(QMenu * |
285 #ifdef Q_OS_MAC | |
286 menu | |
287 #endif | |
288 ) | |
285 { | 289 { |
286 #ifdef Q_OS_MAC | 290 #ifdef Q_OS_MAC |
287 // See https://bugreports.qt-project.org/browse/QTBUG-38256 and | 291 // See https://bugreports.qt-project.org/browse/QTBUG-38256 and |
288 // our issue #890 http://code.soundsoftware.ac.uk/issues/890 -- | 292 // our issue #890 http://code.soundsoftware.ac.uk/issues/890 -- |
289 // single-key shortcuts that are associated only with a menu | 293 // single-key shortcuts that are associated only with a menu |
742 if (!model) return; | 746 if (!model) return; |
743 | 747 |
744 Pane *currentPane = m_paneStack->getCurrentPane(); | 748 Pane *currentPane = m_paneStack->getCurrentPane(); |
745 if (!currentPane) return; | 749 if (!currentPane) return; |
746 | 750 |
747 size_t startFrame, endFrame; | 751 int startFrame, endFrame; |
748 | 752 |
749 if (currentPane->getStartFrame() < 0) startFrame = 0; | 753 if (currentPane->getStartFrame() < 0) startFrame = 0; |
750 else startFrame = currentPane->getStartFrame(); | 754 else startFrame = currentPane->getStartFrame(); |
751 | 755 |
752 if (currentPane->getEndFrame() > model->getEndFrame()) endFrame = model->getEndFrame(); | 756 if (currentPane->getEndFrame() > model->getEndFrame()) endFrame = model->getEndFrame(); |
813 } | 817 } |
814 | 818 |
815 void | 819 void |
816 MainWindowBase::pasteAtPlaybackPosition() | 820 MainWindowBase::pasteAtPlaybackPosition() |
817 { | 821 { |
818 unsigned long pos = getFrame(); | 822 int pos = getFrame(); |
819 Clipboard &clipboard = m_viewManager->getClipboard(); | 823 Clipboard &clipboard = m_viewManager->getClipboard(); |
820 if (!clipboard.empty()) { | 824 if (!clipboard.empty()) { |
821 long firstEventFrame = clipboard.getPoints()[0].getFrame(); | 825 int firstEventFrame = clipboard.getPoints()[0].getFrame(); |
822 long offset = 0; | 826 int offset = 0; |
823 if (firstEventFrame < 0) { | 827 if (firstEventFrame < 0) { |
824 offset = (long)pos - firstEventFrame; | 828 offset = pos - firstEventFrame; |
825 } else if (firstEventFrame < pos) { | 829 } else if (firstEventFrame < pos) { |
826 offset = pos - (unsigned long)firstEventFrame; | 830 offset = pos - firstEventFrame; |
827 } else { | 831 } else { |
828 offset = -((unsigned long)firstEventFrame - pos); | 832 offset = -(firstEventFrame - pos); |
829 } | 833 } |
830 pasteRelative(offset); | 834 pasteRelative(offset); |
831 } | 835 } |
832 } | 836 } |
833 | 837 |
896 } | 900 } |
897 } | 901 } |
898 | 902 |
899 // FrameTimer method | 903 // FrameTimer method |
900 | 904 |
901 unsigned long | 905 int |
902 MainWindowBase::getFrame() const | 906 MainWindowBase::getFrame() const |
903 { | 907 { |
904 if (m_playSource && m_playSource->isPlaying()) { | 908 if (m_playSource && m_playSource->isPlaying()) { |
905 return m_playSource->getCurrentPlayingFrame(); | 909 return m_playSource->getCurrentPlayingFrame(); |
906 } else { | 910 } else { |
918 MainWindowBase::insertInstantsAtBoundaries() | 922 MainWindowBase::insertInstantsAtBoundaries() |
919 { | 923 { |
920 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | 924 MultiSelection::SelectionList selections = m_viewManager->getSelections(); |
921 for (MultiSelection::SelectionList::iterator i = selections.begin(); | 925 for (MultiSelection::SelectionList::iterator i = selections.begin(); |
922 i != selections.end(); ++i) { | 926 i != selections.end(); ++i) { |
923 size_t start = i->getStartFrame(); | 927 int start = i->getStartFrame(); |
924 size_t end = i->getEndFrame(); | 928 int end = i->getEndFrame(); |
925 if (start != end) { | 929 if (start != end) { |
926 insertInstantAt(start); | 930 insertInstantAt(start); |
927 insertInstantAt(end); | 931 insertInstantAt(end); |
928 } | 932 } |
929 } | 933 } |
930 } | 934 } |
931 | 935 |
932 void | 936 void |
933 MainWindowBase::insertInstantAt(size_t frame) | 937 MainWindowBase::insertInstantAt(int frame) |
934 { | 938 { |
935 Pane *pane = m_paneStack->getCurrentPane(); | 939 Pane *pane = m_paneStack->getCurrentPane(); |
936 if (!pane) { | 940 if (!pane) { |
937 return; | 941 return; |
938 } | 942 } |
1020 MainWindowBase::insertItemAtSelection() | 1024 MainWindowBase::insertItemAtSelection() |
1021 { | 1025 { |
1022 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | 1026 MultiSelection::SelectionList selections = m_viewManager->getSelections(); |
1023 for (MultiSelection::SelectionList::iterator i = selections.begin(); | 1027 for (MultiSelection::SelectionList::iterator i = selections.begin(); |
1024 i != selections.end(); ++i) { | 1028 i != selections.end(); ++i) { |
1025 size_t start = i->getStartFrame(); | 1029 int start = i->getStartFrame(); |
1026 size_t end = i->getEndFrame(); | 1030 int end = i->getEndFrame(); |
1027 if (start < end) { | 1031 if (start < end) { |
1028 insertItemAt(start, end - start); | 1032 insertItemAt(start, end - start); |
1029 } | 1033 } |
1030 } | 1034 } |
1031 } | 1035 } |
1032 | 1036 |
1033 void | 1037 void |
1034 MainWindowBase::insertItemAt(size_t frame, size_t duration) | 1038 MainWindowBase::insertItemAt(int frame, int duration) |
1035 { | 1039 { |
1036 Pane *pane = m_paneStack->getCurrentPane(); | 1040 Pane *pane = m_paneStack->getCurrentPane(); |
1037 if (!pane) { | 1041 if (!pane) { |
1038 return; | 1042 return; |
1039 } | 1043 } |
1040 | 1044 |
1041 // ugh! | 1045 // ugh! |
1042 | 1046 |
1043 size_t alignedStart = pane->alignFromReference(frame); | 1047 int alignedStart = pane->alignFromReference(frame); |
1044 size_t alignedEnd = pane->alignFromReference(frame + duration); | 1048 int alignedEnd = pane->alignFromReference(frame + duration); |
1045 if (alignedStart >= alignedEnd) return; | 1049 if (alignedStart >= alignedEnd) return; |
1046 size_t alignedDuration = alignedEnd - alignedStart; | 1050 int alignedDuration = alignedEnd - alignedStart; |
1047 | 1051 |
1048 Command *c = 0; | 1052 Command *c = 0; |
1049 | 1053 |
1050 QString name = tr("Add Item at %1 s") | 1054 QString name = tr("Add Item at %1 s") |
1051 .arg(RealTime::frame2RealTime | 1055 .arg(RealTime::frame2RealTime |
1235 if (!source.isAvailable()) return FileOpenFailed; | 1239 if (!source.isAvailable()) return FileOpenFailed; |
1236 source.waitForData(); | 1240 source.waitForData(); |
1237 | 1241 |
1238 m_openingAudioFile = true; | 1242 m_openingAudioFile = true; |
1239 | 1243 |
1240 size_t rate = 0; | 1244 int rate = 0; |
1241 | 1245 |
1242 if (Preferences::getInstance()->getResampleOnLoad()) { | 1246 if (Preferences::getInstance()->getResampleOnLoad()) { |
1243 rate = m_playSource->getSourceSampleRate(); | 1247 rate = m_playSource->getSourceSampleRate(); |
1244 } | 1248 } |
1245 | 1249 |
1846 if (!source.isAvailable()) return FileOpenFailed; | 1850 if (!source.isAvailable()) return FileOpenFailed; |
1847 source.waitForData(); | 1851 source.waitForData(); |
1848 | 1852 |
1849 QXmlInputSource *inputSource = 0; | 1853 QXmlInputSource *inputSource = 0; |
1850 QFile *file = 0; | 1854 QFile *file = 0; |
1851 bool isTemplate = false; | |
1852 | 1855 |
1853 file = new QFile(source.getLocalFilename()); | 1856 file = new QFile(source.getLocalFilename()); |
1854 inputSource = new QXmlInputSource(file); | 1857 inputSource = new QXmlInputSource(file); |
1855 | 1858 |
1856 if (!checkSaveModified()) { | 1859 if (!checkSaveModified()) { |
1936 } | 1939 } |
1937 | 1940 |
1938 MainWindowBase::FileOpenStatus | 1941 MainWindowBase::FileOpenStatus |
1939 MainWindowBase::openLayersFromRDF(FileSource source) | 1942 MainWindowBase::openLayersFromRDF(FileSource source) |
1940 { | 1943 { |
1941 size_t rate = 0; | 1944 int rate = 0; |
1942 | 1945 |
1943 SVDEBUG << "MainWindowBase::openLayersFromRDF" << endl; | 1946 SVDEBUG << "MainWindowBase::openLayersFromRDF" << endl; |
1944 | 1947 |
1945 ProgressDialog dialog(tr("Importing from RDF..."), true, 2000, this); | 1948 ProgressDialog dialog(tr("Importing from RDF..."), true, 2000, this); |
1946 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); | 1949 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
2314 if (!currentPane) return; | 2317 if (!currentPane) return; |
2315 | 2318 |
2316 Model *model = getMainModel(); | 2319 Model *model = getMainModel(); |
2317 if (!model) return; | 2320 if (!model) return; |
2318 | 2321 |
2319 size_t start = model->getStartFrame(); | 2322 int start = model->getStartFrame(); |
2320 size_t end = model->getEndFrame(); | 2323 int end = model->getEndFrame(); |
2321 if (m_playSource) end = std::max(end, m_playSource->getPlayEndFrame()); | 2324 if (m_playSource) end = std::max(end, m_playSource->getPlayEndFrame()); |
2322 size_t pixels = currentPane->width(); | 2325 int pixels = currentPane->width(); |
2323 | 2326 |
2324 size_t sw = currentPane->getVerticalScaleWidth(); | 2327 int sw = currentPane->getVerticalScaleWidth(); |
2325 if (pixels > sw * 2) pixels -= sw * 2; | 2328 if (pixels > sw * 2) pixels -= sw * 2; |
2326 else pixels = 1; | 2329 else pixels = 1; |
2327 if (pixels > 4) pixels -= 4; | 2330 if (pixels > 4) pixels -= 4; |
2328 | 2331 |
2329 size_t zoomLevel = (end - start) / pixels; | 2332 int zoomLevel = (end - start) / pixels; |
2330 if (zoomLevel < 1) zoomLevel = 1; | 2333 if (zoomLevel < 1) zoomLevel = 1; |
2331 | 2334 |
2332 currentPane->setZoomLevel(zoomLevel); | 2335 currentPane->setZoomLevel(zoomLevel); |
2333 currentPane->setCentreFrame((start + end) / 2); | 2336 currentPane->setCentreFrame((start + end) / 2); |
2334 } | 2337 } |
2542 int frame = m_viewManager->getPlaybackFrame(); | 2545 int frame = m_viewManager->getPlaybackFrame(); |
2543 ++frame; | 2546 ++frame; |
2544 | 2547 |
2545 Pane *pane = m_paneStack->getCurrentPane(); | 2548 Pane *pane = m_paneStack->getCurrentPane(); |
2546 Layer *layer = getSnapLayer(); | 2549 Layer *layer = getSnapLayer(); |
2547 size_t sr = getMainModel()->getSampleRate(); | 2550 int sr = getMainModel()->getSampleRate(); |
2548 | 2551 |
2549 if (!layer) { | 2552 if (!layer) { |
2550 | 2553 |
2551 frame = RealTime::realTime2Frame | 2554 frame = RealTime::realTime2Frame |
2552 (RealTime::frame2RealTime(frame, sr) + RealTime(2, 0), sr); | 2555 (RealTime::frame2RealTime(frame, sr) + RealTime(2, 0), sr); |
2554 frame = getMainModel()->getEndFrame(); | 2557 frame = getMainModel()->getEndFrame(); |
2555 } | 2558 } |
2556 | 2559 |
2557 } else { | 2560 } else { |
2558 | 2561 |
2559 size_t resolution = 0; | 2562 int resolution = 0; |
2560 if (pane) frame = pane->alignFromReference(frame); | 2563 if (pane) frame = pane->alignFromReference(frame); |
2561 if (layer->snapToFeatureFrame(m_paneStack->getCurrentPane(), | 2564 if (layer->snapToFeatureFrame(m_paneStack->getCurrentPane(), |
2562 frame, resolution, Layer::SnapRight)) { | 2565 frame, resolution, Layer::SnapRight)) { |
2563 if (pane) frame = pane->alignToReference(frame); | 2566 if (pane) frame = pane->alignToReference(frame); |
2564 } else { | 2567 } else { |
2567 } | 2570 } |
2568 | 2571 |
2569 if (frame < 0) frame = 0; | 2572 if (frame < 0) frame = 0; |
2570 | 2573 |
2571 if (m_viewManager->getPlaySelectionMode()) { | 2574 if (m_viewManager->getPlaySelectionMode()) { |
2572 frame = m_viewManager->constrainFrameToSelection(size_t(frame)); | 2575 frame = m_viewManager->constrainFrameToSelection(int(frame)); |
2573 } | 2576 } |
2574 | 2577 |
2575 m_viewManager->setPlaybackFrame(frame); | 2578 m_viewManager->setPlaybackFrame(frame); |
2576 | 2579 |
2577 if (frame == getMainModel()->getEndFrame() && | 2580 if (frame == getMainModel()->getEndFrame() && |
2591 m_playSource->isPlaying() && | 2594 m_playSource->isPlaying() && |
2592 !m_viewManager->getPlayLoopMode()) { | 2595 !m_viewManager->getPlayLoopMode()) { |
2593 stop(); | 2596 stop(); |
2594 } | 2597 } |
2595 | 2598 |
2596 size_t frame = getMainModel()->getEndFrame(); | 2599 int frame = getMainModel()->getEndFrame(); |
2597 | 2600 |
2598 if (m_viewManager->getPlaySelectionMode()) { | 2601 if (m_viewManager->getPlaySelectionMode()) { |
2599 frame = m_viewManager->constrainFrameToSelection(frame); | 2602 frame = m_viewManager->constrainFrameToSelection(frame); |
2600 } | 2603 } |
2601 | 2604 |
2609 | 2612 |
2610 Layer *layer = getSnapLayer(); | 2613 Layer *layer = getSnapLayer(); |
2611 if (!layer) { ffwd(); return; } | 2614 if (!layer) { ffwd(); return; } |
2612 | 2615 |
2613 Pane *pane = m_paneStack->getCurrentPane(); | 2616 Pane *pane = m_paneStack->getCurrentPane(); |
2614 size_t sr = getMainModel()->getSampleRate(); | |
2615 | 2617 |
2616 int frame = m_viewManager->getPlaybackFrame(); | 2618 int frame = m_viewManager->getPlaybackFrame(); |
2617 | 2619 |
2618 size_t resolution = 0; | 2620 int resolution = 0; |
2619 if (pane) frame = pane->alignFromReference(frame); | 2621 if (pane) frame = pane->alignFromReference(frame); |
2620 if (layer->snapToSimilarFeature(m_paneStack->getCurrentPane(), | 2622 if (layer->snapToSimilarFeature(m_paneStack->getCurrentPane(), |
2621 frame, resolution, Layer::SnapRight)) { | 2623 frame, resolution, Layer::SnapRight)) { |
2622 if (pane) frame = pane->alignToReference(frame); | 2624 if (pane) frame = pane->alignToReference(frame); |
2623 } else { | 2625 } else { |
2625 } | 2627 } |
2626 | 2628 |
2627 if (frame < 0) frame = 0; | 2629 if (frame < 0) frame = 0; |
2628 | 2630 |
2629 if (m_viewManager->getPlaySelectionMode()) { | 2631 if (m_viewManager->getPlaySelectionMode()) { |
2630 frame = m_viewManager->constrainFrameToSelection(size_t(frame)); | 2632 frame = m_viewManager->constrainFrameToSelection(int(frame)); |
2631 } | 2633 } |
2632 | 2634 |
2633 m_viewManager->setPlaybackFrame(frame); | 2635 m_viewManager->setPlaybackFrame(frame); |
2634 | 2636 |
2635 if (frame == getMainModel()->getEndFrame() && | 2637 if (frame == getMainModel()->getEndFrame() && |
2648 int frame = m_viewManager->getPlaybackFrame(); | 2650 int frame = m_viewManager->getPlaybackFrame(); |
2649 if (frame > 0) --frame; | 2651 if (frame > 0) --frame; |
2650 | 2652 |
2651 Pane *pane = m_paneStack->getCurrentPane(); | 2653 Pane *pane = m_paneStack->getCurrentPane(); |
2652 Layer *layer = getSnapLayer(); | 2654 Layer *layer = getSnapLayer(); |
2653 size_t sr = getMainModel()->getSampleRate(); | 2655 int sr = getMainModel()->getSampleRate(); |
2654 | 2656 |
2655 // when rewinding during playback, we want to allow a period | 2657 // when rewinding during playback, we want to allow a period |
2656 // following a rewind target point at which the rewind will go to | 2658 // following a rewind target point at which the rewind will go to |
2657 // the prior point instead of the immediately neighbouring one | 2659 // the prior point instead of the immediately neighbouring one |
2658 if (m_playSource && m_playSource->isPlaying()) { | 2660 if (m_playSource && m_playSource->isPlaying()) { |
2670 frame = getMainModel()->getStartFrame(); | 2672 frame = getMainModel()->getStartFrame(); |
2671 } | 2673 } |
2672 | 2674 |
2673 } else { | 2675 } else { |
2674 | 2676 |
2675 size_t resolution = 0; | 2677 int resolution = 0; |
2676 if (pane) frame = pane->alignFromReference(frame); | 2678 if (pane) frame = pane->alignFromReference(frame); |
2677 if (layer->snapToFeatureFrame(m_paneStack->getCurrentPane(), | 2679 if (layer->snapToFeatureFrame(m_paneStack->getCurrentPane(), |
2678 frame, resolution, Layer::SnapLeft)) { | 2680 frame, resolution, Layer::SnapLeft)) { |
2679 if (pane) frame = pane->alignToReference(frame); | 2681 if (pane) frame = pane->alignToReference(frame); |
2680 } else { | 2682 } else { |
2683 } | 2685 } |
2684 | 2686 |
2685 if (frame < 0) frame = 0; | 2687 if (frame < 0) frame = 0; |
2686 | 2688 |
2687 if (m_viewManager->getPlaySelectionMode()) { | 2689 if (m_viewManager->getPlaySelectionMode()) { |
2688 frame = m_viewManager->constrainFrameToSelection(size_t(frame)); | 2690 frame = m_viewManager->constrainFrameToSelection(int(frame)); |
2689 } | 2691 } |
2690 | 2692 |
2691 m_viewManager->setPlaybackFrame(frame); | 2693 m_viewManager->setPlaybackFrame(frame); |
2692 } | 2694 } |
2693 | 2695 |
2694 void | 2696 void |
2695 MainWindowBase::rewindStart() | 2697 MainWindowBase::rewindStart() |
2696 { | 2698 { |
2697 if (!getMainModel()) return; | 2699 if (!getMainModel()) return; |
2698 | 2700 |
2699 size_t frame = getMainModel()->getStartFrame(); | 2701 int frame = getMainModel()->getStartFrame(); |
2700 | 2702 |
2701 if (m_viewManager->getPlaySelectionMode()) { | 2703 if (m_viewManager->getPlaySelectionMode()) { |
2702 frame = m_viewManager->constrainFrameToSelection(frame); | 2704 frame = m_viewManager->constrainFrameToSelection(frame); |
2703 } | 2705 } |
2704 | 2706 |
2712 | 2714 |
2713 Layer *layer = getSnapLayer(); | 2715 Layer *layer = getSnapLayer(); |
2714 if (!layer) { rewind(); return; } | 2716 if (!layer) { rewind(); return; } |
2715 | 2717 |
2716 Pane *pane = m_paneStack->getCurrentPane(); | 2718 Pane *pane = m_paneStack->getCurrentPane(); |
2717 size_t sr = getMainModel()->getSampleRate(); | |
2718 | 2719 |
2719 int frame = m_viewManager->getPlaybackFrame(); | 2720 int frame = m_viewManager->getPlaybackFrame(); |
2720 | 2721 |
2721 size_t resolution = 0; | 2722 int resolution = 0; |
2722 if (pane) frame = pane->alignFromReference(frame); | 2723 if (pane) frame = pane->alignFromReference(frame); |
2723 if (layer->snapToSimilarFeature(m_paneStack->getCurrentPane(), | 2724 if (layer->snapToSimilarFeature(m_paneStack->getCurrentPane(), |
2724 frame, resolution, Layer::SnapLeft)) { | 2725 frame, resolution, Layer::SnapLeft)) { |
2725 if (pane) frame = pane->alignToReference(frame); | 2726 if (pane) frame = pane->alignToReference(frame); |
2726 } else { | 2727 } else { |
2728 } | 2729 } |
2729 | 2730 |
2730 if (frame < 0) frame = 0; | 2731 if (frame < 0) frame = 0; |
2731 | 2732 |
2732 if (m_viewManager->getPlaySelectionMode()) { | 2733 if (m_viewManager->getPlaySelectionMode()) { |
2733 frame = m_viewManager->constrainFrameToSelection(size_t(frame)); | 2734 frame = m_viewManager->constrainFrameToSelection(int(frame)); |
2734 } | 2735 } |
2735 | 2736 |
2736 m_viewManager->setPlaybackFrame(frame); | 2737 m_viewManager->setPlaybackFrame(frame); |
2737 } | 2738 } |
2738 | 2739 |
2940 | 2941 |
2941 void | 2942 void |
2942 MainWindowBase::connectLayerEditDialog(ModelDataTableDialog *dialog) | 2943 MainWindowBase::connectLayerEditDialog(ModelDataTableDialog *dialog) |
2943 { | 2944 { |
2944 connect(m_viewManager, | 2945 connect(m_viewManager, |
2945 SIGNAL(globalCentreFrameChanged(unsigned long)), | 2946 SIGNAL(globalCentreFrameChanged(int)), |
2946 dialog, | 2947 dialog, |
2947 SLOT(userScrolledToFrame(unsigned long))); | 2948 SLOT(userScrolledToFrame(int))); |
2948 | 2949 |
2949 connect(m_viewManager, | 2950 connect(m_viewManager, |
2950 SIGNAL(playbackFrameChanged(unsigned long)), | 2951 SIGNAL(playbackFrameChanged(int)), |
2951 dialog, | 2952 dialog, |
2952 SLOT(playbackScrolledToFrame(unsigned long))); | 2953 SLOT(playbackScrolledToFrame(int))); |
2953 | 2954 |
2954 connect(dialog, | 2955 connect(dialog, |
2955 SIGNAL(scrollToFrame(unsigned long)), | 2956 SIGNAL(scrollToFrame(int)), |
2956 m_viewManager, | 2957 m_viewManager, |
2957 SLOT(setGlobalCentreFrame(unsigned long))); | 2958 SLOT(setGlobalCentreFrame(int))); |
2958 | 2959 |
2959 connect(dialog, | 2960 connect(dialog, |
2960 SIGNAL(scrollToFrame(unsigned long)), | 2961 SIGNAL(scrollToFrame(int)), |
2961 m_viewManager, | 2962 m_viewManager, |
2962 SLOT(setPlaybackFrame(unsigned long))); | 2963 SLOT(setPlaybackFrame(int))); |
2963 } | 2964 } |
2964 | 2965 |
2965 void | 2966 void |
2966 MainWindowBase::previousPane() | 2967 MainWindowBase::previousPane() |
2967 { | 2968 { |
3045 } | 3046 } |
3046 } | 3047 } |
3047 } | 3048 } |
3048 | 3049 |
3049 void | 3050 void |
3050 MainWindowBase::playbackFrameChanged(unsigned long frame) | 3051 MainWindowBase::playbackFrameChanged(int frame) |
3051 { | 3052 { |
3052 if (!(m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3053 if (!(m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3053 | 3054 |
3054 updatePositionStatusDisplays(); | 3055 updatePositionStatusDisplays(); |
3055 | 3056 |
3081 | 3082 |
3082 statusBar()->showMessage(m_myStatusMessage); | 3083 statusBar()->showMessage(m_myStatusMessage); |
3083 } | 3084 } |
3084 | 3085 |
3085 void | 3086 void |
3086 MainWindowBase::globalCentreFrameChanged(unsigned long ) | 3087 MainWindowBase::globalCentreFrameChanged(int ) |
3087 { | 3088 { |
3088 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3089 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3089 Pane *p = 0; | 3090 Pane *p = 0; |
3090 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3091 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3091 if (!p->getFollowGlobalPan()) return; | 3092 if (!p->getFollowGlobalPan()) return; |
3092 updateVisibleRangeDisplay(p); | 3093 updateVisibleRangeDisplay(p); |
3093 } | 3094 } |
3094 | 3095 |
3095 void | 3096 void |
3096 MainWindowBase::viewCentreFrameChanged(View *v, unsigned long frame) | 3097 MainWindowBase::viewCentreFrameChanged(View *v, int frame) |
3097 { | 3098 { |
3098 // SVDEBUG << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << endl; | 3099 // SVDEBUG << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << endl; |
3099 | 3100 |
3100 if (m_viewDataDialogMap.find(v) != m_viewDataDialogMap.end()) { | 3101 if (m_viewDataDialogMap.find(v) != m_viewDataDialogMap.end()) { |
3101 for (DataDialogSet::iterator i = m_viewDataDialogMap[v].begin(); | 3102 for (DataDialogSet::iterator i = m_viewDataDialogMap[v].begin(); |
3108 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3109 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3109 if (v == p) updateVisibleRangeDisplay(p); | 3110 if (v == p) updateVisibleRangeDisplay(p); |
3110 } | 3111 } |
3111 | 3112 |
3112 void | 3113 void |
3113 MainWindowBase::viewZoomLevelChanged(View *v, unsigned long , bool ) | 3114 MainWindowBase::viewZoomLevelChanged(View *v, int , bool ) |
3114 { | 3115 { |
3115 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3116 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3116 Pane *p = 0; | 3117 Pane *p = 0; |
3117 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3118 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3118 if (v == p) updateVisibleRangeDisplay(p); | 3119 if (v == p) updateVisibleRangeDisplay(p); |
3322 | 3323 |
3323 args.append(url); | 3324 args.append(url); |
3324 process->start(command, args); | 3325 process->start(command, args); |
3325 | 3326 |
3326 #else | 3327 #else |
3327 #ifdef Q_WS_X11 | |
3328 if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { | 3328 if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { |
3329 args.append("exec"); | 3329 args.append("exec"); |
3330 args.append(url); | 3330 args.append(url); |
3331 process->start("kfmclient", args); | 3331 process->start("kfmclient", args); |
3332 } else if (!qgetenv("BROWSER").isEmpty()) { | 3332 } else if (!qgetenv("BROWSER").isEmpty()) { |
3336 args.append(url); | 3336 args.append(url); |
3337 process->start("firefox", args); | 3337 process->start("firefox", args); |
3338 } | 3338 } |
3339 #endif | 3339 #endif |
3340 #endif | 3340 #endif |
3341 #endif | |
3342 } | 3341 } |
3343 | 3342 |
3344 | 3343 |