comparison main/MainWindow.cpp @ 730:73a5884a0975 warnfix_no_size_t

Various size_t etc removals, and compiler warning fixes
author Chris Cannam
date Tue, 17 Jun 2014 16:42:51 +0100
parents b959148258a4
children 48bd87b0a84e
comparison
equal deleted inserted replaced
728:b959148258a4 730:73a5884a0975
1135 1135
1136 QIcon icon; 1136 QIcon icon;
1137 QString mainText, shortcutText, tipText, channelText; 1137 QString mainText, shortcutText, tipText, channelText;
1138 LayerFactory::LayerType type = backgroundTypes[i]; 1138 LayerFactory::LayerType type = backgroundTypes[i];
1139 bool mono = true; 1139 bool mono = true;
1140
1141 // Avoid warnings/errors with -Wextra because we aren't explicitly
1142 // handling all layer types (-Wall is OK with this because of the
1143 // default but the stricter level insists)
1144 #pragma GCC diagnostic ignored "-Wswitch-enum"
1140 1145
1141 switch (type) { 1146 switch (type) {
1142 1147
1143 case LayerFactory::Waveform: 1148 case LayerFactory::Waveform:
1144 icon = il.load("waveform"); 1149 icon = il.load("waveform");
2311 return; 2316 return;
2312 } 2317 }
2313 2318
2314 QString description; 2319 QString description;
2315 2320
2316 size_t ssr = getMainModel()->getSampleRate(); 2321 int ssr = getMainModel()->getSampleRate();
2317 size_t tsr = ssr; 2322 int tsr = ssr;
2318 if (m_playSource) tsr = m_playSource->getTargetSampleRate(); 2323 if (m_playSource) tsr = m_playSource->getTargetSampleRate();
2319 2324
2320 if (ssr != tsr) { 2325 if (ssr != tsr) {
2321 description = tr("%1Hz (resampling to %2Hz)").arg(ssr).arg(tsr); 2326 description = tr("%1Hz (resampling to %2Hz)").arg(ssr).arg(tsr);
2322 } else { 2327 } else {
2778 QSize total, visible, selected; 2783 QSize total, visible, selected;
2779 total = pane->getImageSize(); 2784 total = pane->getImageSize();
2780 visible = pane->getImageSize(pane->getFirstVisibleFrame(), 2785 visible = pane->getImageSize(pane->getFirstVisibleFrame(),
2781 pane->getLastVisibleFrame()); 2786 pane->getLastVisibleFrame());
2782 2787
2783 size_t sf0 = 0, sf1 = 0; 2788 int sf0 = 0, sf1 = 0;
2784 2789
2785 if (haveSelection) { 2790 if (haveSelection) {
2786 MultiSelection::SelectionList selections = m_viewManager->getSelections(); 2791 MultiSelection::SelectionList selections = m_viewManager->getSelections();
2787 sf0 = selections.begin()->getStartFrame(); 2792 sf0 = selections.begin()->getStartFrame();
2788 MultiSelection::SelectionList::iterator e = selections.end(); 2793 MultiSelection::SelectionList::iterator e = selections.end();
2938 setWindowTitle(QApplication::applicationName()); 2943 setWindowTitle(QApplication::applicationName());
2939 2944
2940 CommandHistory::getInstance()->clear(); 2945 CommandHistory::getInstance()->clear();
2941 CommandHistory::getInstance()->documentSaved(); 2946 CommandHistory::getInstance()->documentSaved();
2942 documentRestored(); 2947 documentRestored();
2943 }
2944
2945 void
2946 MainWindow::openSession()
2947 {
2948 if (!checkSaveModified()) return;
2949
2950 QString orig = m_audioFile;
2951 if (orig == "") orig = ".";
2952 else orig = QFileInfo(orig).absoluteDir().canonicalPath();
2953
2954 QString path = getOpenFileName(FileFinder::SessionFile);
2955
2956 if (path.isEmpty()) return;
2957
2958 if (openSessionFile(path) == FileOpenFailed) {
2959 emit hideSplash();
2960 QMessageBox::critical(this, tr("Failed to open file"),
2961 tr("<b>File open failed</b><p>Session file \"%1\" could not be opened").arg(path));
2962 }
2963 } 2948 }
2964 2949
2965 void 2950 void
2966 MainWindow::openSomething() 2951 MainWindow::openSomething()
2967 { 2952 {
3707 } 3692 }
3708 } 3693 }
3709 if (defaultInputModel) break; 3694 if (defaultInputModel) break;
3710 } 3695 }
3711 3696
3712 size_t startFrame = 0, duration = 0; 3697 int startFrame = 0, duration = 0;
3713 size_t endFrame = 0; 3698 int endFrame = 0;
3714 m_viewManager->getSelection().getExtents(startFrame, endFrame); 3699 m_viewManager->getSelection().getExtents(startFrame, endFrame);
3715 if (endFrame > startFrame) duration = endFrame - startFrame; 3700 if (endFrame > startFrame) duration = endFrame - startFrame;
3716 else startFrame = 0; 3701 else startFrame = 0;
3717 3702
3718 TransformUserConfigurator configurator; 3703 TransformUserConfigurator configurator;
3907 if (!getMainModel() || !p) { 3892 if (!getMainModel() || !p) {
3908 return; 3893 return;
3909 } 3894 }
3910 3895
3911 bool haveSelection = false; 3896 bool haveSelection = false;
3912 size_t startFrame = 0, endFrame = 0; 3897 int startFrame = 0, endFrame = 0;
3913 3898
3914 if (m_viewManager && m_viewManager->haveInProgressSelection()) { 3899 if (m_viewManager && m_viewManager->haveInProgressSelection()) {
3915 3900
3916 bool exclusive = false; 3901 bool exclusive = false;
3917 Selection s = m_viewManager->getInProgressSelection(exclusive); 3902 Selection s = m_viewManager->getInProgressSelection(exclusive);
3958 MainWindow::updatePositionStatusDisplays() const 3943 MainWindow::updatePositionStatusDisplays() const
3959 { 3944 {
3960 if (!statusBar()->isVisible()) return; 3945 if (!statusBar()->isVisible()) return;
3961 3946
3962 Pane *pane = 0; 3947 Pane *pane = 0;
3963 size_t frame = m_viewManager->getPlaybackFrame(); 3948 int frame = m_viewManager->getPlaybackFrame();
3964 3949
3965 if (m_paneStack) pane = m_paneStack->getCurrentPane(); 3950 if (m_paneStack) pane = m_paneStack->getCurrentPane();
3966 if (!pane) return; 3951 if (!pane) return;
3967 3952
3968 int layers = pane->getLayerCount(); 3953 int layers = pane->getLayerCount();
3985 m_fader->setPeakLeft(left); 3970 m_fader->setPeakLeft(left);
3986 m_fader->setPeakRight(right); 3971 m_fader->setPeakRight(right);
3987 } 3972 }
3988 3973
3989 void 3974 void
3990 MainWindow::sampleRateMismatch(size_t requested, size_t actual, 3975 MainWindow::sampleRateMismatch(int requested, int actual,
3991 bool willResample) 3976 bool willResample)
3992 { 3977 {
3993 if (!willResample) { 3978 if (!willResample) {
3994 emit hideSplash(); 3979 emit hideSplash();
3995 QMessageBox::information 3980 QMessageBox::information
4042 4027
4043 while (m_midiInput->getEventsAvailable() > 0) { 4028 while (m_midiInput->getEventsAvailable() > 0) {
4044 4029
4045 MIDIEvent ev(m_midiInput->readEvent()); 4030 MIDIEvent ev(m_midiInput->readEvent());
4046 4031
4047 size_t frame = currentPane->alignFromReference(ev.getTime()); 4032 int frame = currentPane->alignFromReference(ev.getTime());
4048 4033
4049 bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON && 4034 bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON &&
4050 ev.getVelocity() > 0); 4035 ev.getVelocity() > 0);
4051 4036
4052 bool noteOff = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF || 4037 bool noteOff = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF ||
4097 insertInstantAt(ev.getTime()); 4082 insertInstantAt(ev.getTime());
4098 } 4083 }
4099 } 4084 }
4100 4085
4101 void 4086 void
4102 MainWindow::playStatusChanged(bool playing) 4087 MainWindow::playStatusChanged(bool )
4103 { 4088 {
4104 Pane *currentPane = 0; 4089 Pane *currentPane = 0;
4105 NoteLayer *currentNoteLayer = 0; 4090 NoteLayer *currentNoteLayer = 0;
4106 4091
4107 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); 4092 if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
4219 QMessageBox::Ok); 4204 QMessageBox::Ok);
4220 } 4205 }
4221 } 4206 }
4222 4207
4223 void 4208 void
4224 MainWindow::modelGenerationWarning(QString transformName, QString message) 4209 MainWindow::modelGenerationWarning(QString /* transformName */, QString message)
4225 { 4210 {
4226 emit hideSplash(); 4211 emit hideSplash();
4227 4212
4228 QMessageBox::warning 4213 QMessageBox::warning
4229 (this, tr("Warning"), message, QMessageBox::Ok); 4214 (this, tr("Warning"), message, QMessageBox::Ok);
4253 } 4238 }
4254 } 4239 }
4255 4240
4256 void 4241 void
4257 MainWindow::modelRegenerationWarning(QString layerName, 4242 MainWindow::modelRegenerationWarning(QString layerName,
4258 QString transformName, QString message) 4243 QString /* transformName */,
4244 QString message)
4259 { 4245 {
4260 emit hideSplash(); 4246 emit hideSplash();
4261 4247
4262 QMessageBox::warning 4248 QMessageBox::warning
4263 (this, tr("Warning"), tr("<b>Warning when regenerating layer</b><p>When regenerating the derived layer \"%1\" using new data model as input:<p>%2").arg(layerName).arg(message), QMessageBox::Ok); 4249 (this, tr("Warning"), tr("<b>Warning when regenerating layer</b><p>When regenerating the derived layer \"%1\" using new data model as input:<p>%2").arg(layerName).arg(message), QMessageBox::Ok);