Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 368:f1cab64363d7 warnfix_no_size_t
Merge from branch tony_integration
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 08:45:13 +0100 |
parents | 0876ea394902 88bf6cc73275 |
children | 024226dd9f51 |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Tue Jun 17 17:00:26 2014 +0100 +++ b/framework/MainWindowBase.cpp Wed Jun 18 08:45:13 2014 +0100 @@ -152,7 +152,9 @@ m_openingAudioFile(false), m_abandoning(false), m_labeller(0), - m_lastPlayStatusSec(0) + m_lastPlayStatusSec(0), + m_initialDarkBackground(false), + m_defaultFfwdRwdStep(2, 0) { Profiler profiler("MainWindowBase::MainWindowBase"); @@ -372,26 +374,8 @@ MainWindowBase::getOpenFileName(FileFinder::FileType type) { FileFinder *ff = FileFinder::getInstance(); - switch (type) { - case FileFinder::SessionFile: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::AudioFile: - return ff->getOpenFileName(type, m_audioFile); - case FileFinder::LayerFile: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::LayerFileNoMidi: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::LayerFileNonSV: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::LayerFileNoMidiNonSV: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::SessionOrAudioFile: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::ImageFile: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::CSVFile: - return ff->getOpenFileName(type, m_sessionFile); - case FileFinder::AnyFile: + + if (type == FileFinder::AnyFile) { if (getMainModel() != 0 && m_paneStack != 0 && m_paneStack->getCurrentPane() != 0) { // can import a layer @@ -400,37 +384,28 @@ return ff->getOpenFileName(FileFinder::SessionOrAudioFile, m_sessionFile); } + } + + QString lastPath = m_sessionFile; + + if (type == FileFinder::AudioFile) { + lastPath = m_audioFile; } - return ""; + + return ff->getOpenFileName(type, lastPath); } QString MainWindowBase::getSaveFileName(FileFinder::FileType type) { + QString lastPath = m_sessionFile; + + if (type == FileFinder::AudioFile) { + lastPath = m_audioFile; + } + FileFinder *ff = FileFinder::getInstance(); - switch (type) { - case FileFinder::SessionFile: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::AudioFile: - return ff->getSaveFileName(type, m_audioFile); - case FileFinder::LayerFile: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::LayerFileNoMidi: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::LayerFileNonSV: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::LayerFileNoMidiNonSV: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::SessionOrAudioFile: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::ImageFile: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::CSVFile: - return ff->getSaveFileName(type, m_sessionFile); - case FileFinder::AnyFile: - return ff->getSaveFileName(type, m_sessionFile); - } - return ""; + return ff->getSaveFileName(type, lastPath); } void @@ -553,6 +528,7 @@ emit canClearSelection(haveSelection); emit canEditSelection(haveSelection && haveCurrentEditableLayer); emit canSave(m_sessionFile != "" && m_documentModified); + emit canSaveAs(haveMainModel); emit canSelectPreviousPane(havePrevPane); emit canSelectNextPane(haveNextPane); emit canSelectPreviousLayer(havePrevLayer); @@ -1243,7 +1219,9 @@ int rate = 0; - if (Preferences::getInstance()->getResampleOnLoad()) { + if (Preferences::getInstance()->getFixedSampleRate() != 0) { + rate = Preferences::getInstance()->getFixedSampleRate(); + } else if (Preferences::getInstance()->getResampleOnLoad()) { rate = m_playSource->getSourceSampleRate(); } @@ -2552,7 +2530,7 @@ if (!layer) { frame = RealTime::realTime2Frame - (RealTime::frame2RealTime(frame, sr) + RealTime(2, 0), sr); + (RealTime::frame2RealTime(frame, sr) + m_defaultFfwdRwdStep, sr); if (frame > int(getMainModel()->getEndFrame())) { frame = getMainModel()->getEndFrame(); } @@ -2577,7 +2555,7 @@ m_viewManager->setPlaybackFrame(frame); - if (frame == getMainModel()->getEndFrame() && + if (frame == (int)getMainModel()->getEndFrame() && m_playSource && m_playSource->isPlaying() && !m_viewManager->getPlayLoopMode()) { @@ -2614,7 +2592,6 @@ if (!layer) { ffwd(); return; } Pane *pane = m_paneStack->getCurrentPane(); - int frame = m_viewManager->getPlaybackFrame(); int resolution = 0; @@ -2634,7 +2611,7 @@ m_viewManager->setPlaybackFrame(frame); - if (frame == getMainModel()->getEndFrame() && + if (frame == (int)getMainModel()->getEndFrame() && m_playSource && m_playSource->isPlaying() && !m_viewManager->getPlayLoopMode()) { @@ -2659,7 +2636,7 @@ // the prior point instead of the immediately neighbouring one if (m_playSource && m_playSource->isPlaying()) { RealTime ct = RealTime::frame2RealTime(frame, sr); - ct = ct - RealTime::fromSeconds(0.25); + ct = ct - RealTime::fromSeconds(0.15); if (ct < RealTime::zeroTime) ct = RealTime::zeroTime; frame = RealTime::realTime2Frame(ct, sr); } @@ -2667,7 +2644,7 @@ if (!layer) { frame = RealTime::realTime2Frame - (RealTime::frame2RealTime(frame, sr) - RealTime(2, 0), sr); + (RealTime::frame2RealTime(frame, sr) - m_defaultFfwdRwdStep, sr); if (frame < int(getMainModel()->getStartFrame())) { frame = getMainModel()->getStartFrame(); } @@ -2716,7 +2693,6 @@ if (!layer) { rewind(); return; } Pane *pane = m_paneStack->getCurrentPane(); - int frame = m_viewManager->getPlaybackFrame(); int resolution = 0; @@ -3214,7 +3190,9 @@ // SVDEBUG << "MainWindowBase::mainModelChanged(" << model << ")" << endl; updateDescriptionLabel(); if (model) m_viewManager->setMainModelSampleRate(model->getSampleRate()); - if (model && !m_playTarget && m_audioOutput) createPlayTarget(); + if (model && !m_playTarget && m_audioOutput) { + createPlayTarget(); + } } void @@ -3317,13 +3295,11 @@ process->start("open", args); #else #ifdef Q_OS_WIN32 - - QString pf(getenv("ProgramFiles")); - QString command = pf + QString("\\Internet Explorer\\IEXPLORE.EXE"); - - args.append(url); - process->start(command, args); - + QString pf(getenv("ProgramFiles")); + QString command = pf + QString("\\Internet Explorer\\IEXPLORE.EXE"); + + args.append(url); + process->start(command, args); #else if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { args.append("exec");