Repository navigation
Fixes for project loading progress display - #3672
Conversation
| !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.
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" );
| { | ||
| 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.
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. |
|
|
zonkmachine
left a comment
There was a problem hiding this comment.
Some more convention...
| 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.
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
}
| { | ||
| ++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.
A bit too long line here.
Crash fixed! |
|
How about conventions? |
zonkmachine
left a comment
There was a problem hiding this comment.
The rest of the braces too.
| for( int i=0,n=tclist.count(); i<n; ++i ) | ||
| { | ||
| QDomNode nd=tclist.at(i).firstChild(); | ||
| while(!nd.isNull()){ |
| if( nd.isElement() && nd.nodeName() == "track" ) | ||
| { | ||
| ++m_nLoadingTrack; | ||
| if( nd.toElement().attribute("type").toInt() == Track::BBTrack ){ |
|
@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.