Mercurial > hg > svgui
comparison view/View.cpp @ 301:5636eeacc467
* Merge from sv-match-alignment branch (excluding alignment-specific document).
- add aggregate wave model (not yet complete enough to be added as a true
model in a layer, but there's potential)
- add play solo mode
- add alignment model -- unused in plain SV
- fix two plugin leaks
- add m3u playlist support (opens all files at once, potentially hazardous)
- fix retrieval of pre-encoded URLs
- add ability to resample audio files on import, so as to match rates with
other files previously loaded; add preference for same
- add preliminary support in transform code for range and rate of transform
input
- reorganise preferences dialog, move dark-background option to preferences,
add option for temporary directory location
author | Chris Cannam |
---|---|
date | Fri, 28 Sep 2007 13:56:38 +0000 |
parents | 226cb289bdf4 |
children | 1517c76cd678 |
comparison
equal
deleted
inserted
replaced
300:0824a754a8eb | 301:5636eeacc467 |
---|---|
18 #include "data/model/Model.h" | 18 #include "data/model/Model.h" |
19 #include "base/ZoomConstraint.h" | 19 #include "base/ZoomConstraint.h" |
20 #include "base/Profiler.h" | 20 #include "base/Profiler.h" |
21 #include "base/Pitch.h" | 21 #include "base/Pitch.h" |
22 | 22 |
23 #include "layer/TimeRulerLayer.h" //!!! damn, shouldn't be including that here | 23 #include "layer/TimeRulerLayer.h" |
24 #include "layer/SingleColourLayer.h" | 24 #include "layer/SingleColourLayer.h" |
25 #include "data/model/PowerOfSqrtTwoZoomConstraint.h" //!!! likewise | 25 #include "data/model/PowerOfSqrtTwoZoomConstraint.h" |
26 #include "data/model/RangeSummarisableTimeValueModel.h" | |
26 | 27 |
27 #include <QPainter> | 28 #include <QPainter> |
28 #include <QPaintEvent> | 29 #include <QPaintEvent> |
29 #include <QRect> | 30 #include <QRect> |
30 #include <QApplication> | 31 #include <QApplication> |
799 } | 800 } |
800 | 801 |
801 void | 802 void |
802 View::modelCompletionChanged() | 803 View::modelCompletionChanged() |
803 { | 804 { |
805 std::cerr << "View(" << this << ")::modelCompletionChanged()" << std::endl; | |
806 | |
804 QObject *obj = sender(); | 807 QObject *obj = sender(); |
805 checkProgress(obj); | 808 checkProgress(obj); |
806 } | 809 } |
807 | 810 |
808 void | 811 void |
874 View::viewManagerPlaybackFrameChanged(unsigned long f) | 877 View::viewManagerPlaybackFrameChanged(unsigned long f) |
875 { | 878 { |
876 if (m_manager) { | 879 if (m_manager) { |
877 if (sender() != m_manager) return; | 880 if (sender() != m_manager) return; |
878 } | 881 } |
882 | |
883 f = getAlignedPlaybackFrame(); | |
879 | 884 |
880 if (m_playPointerFrame == f) return; | 885 if (m_playPointerFrame == f) return; |
881 bool visible = (getXForFrame(m_playPointerFrame) != getXForFrame(f)); | 886 bool visible = (getXForFrame(m_playPointerFrame) != getXForFrame(f)); |
882 size_t oldPlayPointerFrame = m_playPointerFrame; | 887 size_t oldPlayPointerFrame = m_playPointerFrame; |
883 m_playPointerFrame = f; | 888 m_playPointerFrame = f; |
1050 } | 1055 } |
1051 } | 1056 } |
1052 return 0; | 1057 return 0; |
1053 } | 1058 } |
1054 | 1059 |
1060 int | |
1061 View::getAlignedPlaybackFrame() const | |
1062 { | |
1063 if (!m_manager) return 0; | |
1064 if (!m_manager->getPlaybackModel()) return m_manager->getPlaybackFrame(); | |
1065 | |
1066 RangeSummarisableTimeValueModel *waveformModel = 0; | |
1067 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | |
1068 | |
1069 if (!*i) continue; | |
1070 if (dynamic_cast<TimeRulerLayer *>(*i)) continue; | |
1071 | |
1072 Model *model = (*i)->getModel(); | |
1073 if (!model) continue; | |
1074 | |
1075 waveformModel = dynamic_cast<RangeSummarisableTimeValueModel *>(model); | |
1076 if (!waveformModel) { | |
1077 waveformModel = dynamic_cast<RangeSummarisableTimeValueModel *> | |
1078 (model->getSourceModel()); | |
1079 } | |
1080 | |
1081 if (waveformModel) break; | |
1082 } | |
1083 | |
1084 int pf = m_manager->getPlaybackFrame(); | |
1085 | |
1086 if (!waveformModel) return pf; | |
1087 | |
1088 RangeSummarisableTimeValueModel *pm = | |
1089 dynamic_cast<RangeSummarisableTimeValueModel *> | |
1090 (m_manager->getPlaybackModel()); | |
1091 | |
1092 // std::cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf; | |
1093 | |
1094 if (pm) { | |
1095 pf = pm->alignFromReference(pf); | |
1096 // std::cerr << " -> " << pf; | |
1097 } | |
1098 | |
1099 int af = waveformModel->alignToReference(pf); | |
1100 | |
1101 // std::cerr << ", aligned = " << af << std::endl; | |
1102 return af; | |
1103 } | |
1104 | |
1055 bool | 1105 bool |
1056 View::areLayersScrollable() const | 1106 View::areLayersScrollable() const |
1057 { | 1107 { |
1058 // True iff all views are scrollable | 1108 // True iff all views are scrollable |
1059 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1109 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { |
1230 i != m_progressBars.end(); ++i) { | 1280 i != m_progressBars.end(); ++i) { |
1231 | 1281 |
1232 if (i->first == object) { | 1282 if (i->first == object) { |
1233 | 1283 |
1234 int completion = i->first->getCompletion(this); | 1284 int completion = i->first->getCompletion(this); |
1285 QString text = i->first->getPropertyContainerName(); | |
1286 | |
1287 if (completion >= 100) { | |
1288 | |
1289 //!!! | |
1290 Model *model = i->first->getModel(); | |
1291 RangeSummarisableTimeValueModel *wfm = | |
1292 dynamic_cast<RangeSummarisableTimeValueModel *>(model); | |
1293 if (wfm) { | |
1294 completion = wfm->getAlignmentCompletion(); | |
1295 if (completion < 100) { | |
1296 text = tr("Alignment"); | |
1297 } | |
1298 } | |
1299 } | |
1235 | 1300 |
1236 if (completion >= 100) { | 1301 if (completion >= 100) { |
1237 | 1302 |
1238 i->second->hide(); | 1303 i->second->hide(); |
1239 | 1304 |
1240 } else { | 1305 } else { |
1241 | 1306 |
1242 i->second->setText(i->first->getPropertyContainerName()); | 1307 i->second->setText(text); |
1243 | 1308 |
1244 i->second->setValue(completion); | 1309 i->second->setValue(completion); |
1245 i->second->move(0, ph - i->second->height()); | 1310 i->second->move(0, ph - i->second->height()); |
1246 | 1311 |
1247 i->second->show(); | 1312 i->second->show(); |