mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
BugFix CountVisitor
This commit is contained in:
@@ -79,14 +79,22 @@ void CountVisitor::visit (MediaSource& s)
|
||||
|
||||
void CountVisitor::visit (SessionFileSource& s)
|
||||
{
|
||||
if (s.session() != nullptr)
|
||||
num_source_ += s.session()->numSources();
|
||||
else
|
||||
++num_source_;
|
||||
|
||||
if (s.playable())
|
||||
++num_playable_;
|
||||
}
|
||||
|
||||
void CountVisitor::visit (SessionGroupSource& s)
|
||||
{
|
||||
if (s.session() != nullptr)
|
||||
num_source_ += s.session()->numSources();
|
||||
else
|
||||
++num_source_;
|
||||
|
||||
if (s.playable())
|
||||
++num_playable_;
|
||||
}
|
||||
|
||||
10
Mixer.cpp
10
Mixer.cpp
@@ -151,7 +151,7 @@ void Mixer::update()
|
||||
// cosmetics saved ok
|
||||
Rendering::manager().setMainWindowTitle(SystemToolkit::filename(filename));
|
||||
Settings::application.recentSessions.push(filename);
|
||||
Log::Notify("Session %s saved.", filename.c_str());
|
||||
Log::Notify("Session '%s' saved.", filename.c_str());
|
||||
}
|
||||
busy_ = false;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ Source * Mixer::createSourceFile(const std::string &path)
|
||||
}
|
||||
else {
|
||||
Settings::application.recentImport.remove(path);
|
||||
Log::Notify("File %s does not exist.", path.c_str());
|
||||
Log::Notify("File '%s' does not exist.", path.c_str());
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -1396,9 +1396,9 @@ void Mixer::swap()
|
||||
Action::manager().init();
|
||||
|
||||
// notification
|
||||
uint N = session_->numSources();
|
||||
std::string numsource = ( N>0 ? std::to_string(N) : "No" ) + " source" + (N>1 ? "s" : "");
|
||||
Log::Notify("Session %s loaded. %s created.", session_->filename().c_str(), numsource.c_str());
|
||||
uint N = session_->size();
|
||||
std::string numsource = ( N>0 ? std::to_string(N) : "no" ) + " source" + (N>1 ? "s" : "");
|
||||
Log::Notify("Session '%s' loaded with %s.", session_->filename().c_str(), numsource.c_str());
|
||||
}
|
||||
|
||||
void Mixer::close(bool smooth)
|
||||
|
||||
@@ -440,11 +440,15 @@ uint Session::size() const
|
||||
|
||||
uint Session::numSources() const
|
||||
{
|
||||
if (true) {
|
||||
CountVisitor counter;
|
||||
for( SourceList::const_iterator it = sources_.cbegin(); it != sources_.cend(); ++it) {
|
||||
(*it)->accept(counter);
|
||||
}
|
||||
return counter.numSources();
|
||||
}
|
||||
else
|
||||
return size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user