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