-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for project loading progress display #3672
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/core/TrackContainer.cpp
Outdated
@@ -124,6 +122,9 @@ void TrackContainer::loadSettings( const QDomElement & _this ) | |||
if( node.isElement() && | |||
!node.toElement().attribute( "metadata" ).toInt() ) | |||
{ | |||
QString trackName = node.toElement().hasAttribute( "name" ) ? node.toElement().attribute( "name" ) : | |||
node.firstChild().toElement().attribute( "name" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
125 and 126 too long lines. The coding conventions suggestion for ternary operators is something like this:
QString trackName = node.toElement().hasAttribute( "name" )
? node.toElement().attribute( "name" )
: node.firstChild().toElement().attribute( "name" );
src/core/TrackContainer.cpp
Outdated
@@ -124,6 +122,9 @@ void TrackContainer::loadSettings( const QDomElement & _this ) | |||
if( node.isElement() && | |||
!node.toElement().attribute( "metadata" ).toInt() ) | |||
{ | |||
QString trackName = node.toElement().hasAttribute( "name" ) ? node.toElement().attribute( "name" ) : | |||
node.firstChild().toElement().attribute( "name" ); | |||
pd->setLabelText( tr("Loading Track %1 (%2/Total %3)").arg( trackName ).arg( pd->value() ).arg( Engine::getSong()->getLoadingTrackCount() ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It crashes here on command line render. If you wrap it in an if
, something like this:
if( gui )
{
pd->setLabelText( tr("Loading Track %1 (%2/Total %3)").arg(
trackName ).arg( pd->value() ).arg(
Engine::getSong()->getLoadingTrackCount() ) )
}
that should fix it.
Also. The line is much too long and wraps badly. Please try and use more lines.
Backtrace for crash on command line render
|
@zonkmachine Okay. I'll change the code and test it again. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more convention...
src/core/Song.cpp
Outdated
m_nLoadingTrack=0; | ||
for( int i=0,n=tclist.count(); i<n; ++i ){ | ||
QDomNode nd=tclist.at(i).firstChild(); | ||
while(!nd.isNull()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the general idea is to put the braces on the same column/tab although I'm not 100% sure about the convention around this.
( .. )
{
this
}
( .. ){
not this
}
src/core/Song.cpp
Outdated
{ | ||
++m_nLoadingTrack; | ||
if( nd.toElement().attribute("type").toInt() == Track::BBTrack ){ | ||
n += nd.toElement().elementsByTagName("bbtrack").at(0).toElement().firstChildElement().childNodes().count(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit too long line here.
Crash fixed! |
How about conventions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the braces too.
src/core/Song.cpp
Outdated
for( int i=0,n=tclist.count(); i<n; ++i ) | ||
{ | ||
QDomNode nd=tclist.at(i).firstChild(); | ||
while(!nd.isNull()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also {
src/core/Song.cpp
Outdated
if( nd.isElement() && nd.nodeName() == "track" ) | ||
{ | ||
++m_nLoadingTrack; | ||
if( nd.toElement().attribute("type").toInt() == Track::BBTrack ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here {
@zonkmachine I checked coding conventions, and it seems to be fine now. |
Merge? |
The code look OK. If it's all tested, please merge @zonkmachine. I assume we've tested against a bunch of different project types and that |
The logic doesn't blow up, but the loading time does however. I thought I had tested for that already... :( Do you see any possibilities to trim it down a bit?
|
Does commenting out the UI call help? |
I'm also a bit skeptical of iterating mid-for-loop although I haven't placed a debugger on it to see if it can cause problems. |
No. The commit just before this PR is:
Somethings happened along the way. I'm trying a bisect. |
@PhysSong Sorry, it looks like false alarm. I compiled without
This PR is all good. |
Fix project loading progress jumping back. Show the name of the track currently being loaded.
Fix project loading progress jumping back. Show the name of the track currently being loaded.
Fix project loading progress jumping back. Show the name of the track currently being loaded.
This PR currently includes two commits: first one fixes #3611, second one is enhancement mentioned in same issue. I set base branch to stable-1.2 because of #3611 (comment) by @tresf.
It is okay to decouple two commits if needed(but I don't think the decoupling is needed).
@liushuyu This PR contains a new string which needs translation. Once it is merged, please add it to i18n source string list.
see this.