Skip to content
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

Merged
merged 6 commits into from
Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class EXPORT Song : public TrackContainer

void processNextBuffer();

inline int getLoadingTrackCount() const
{
return m_nLoadingTrack;
}
inline int getMilliseconds() const
{
return m_elapsedMilliSeconds;
Expand Down Expand Up @@ -339,6 +343,7 @@ private slots:

ControllerVector m_controllers;

int m_nLoadingTrack;

QString m_fileName;
QString m_oldFileName;
Expand Down
17 changes: 17 additions & 0 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,23 @@ void Song::loadProject( const QString & fileName )
}

node = dataFile.content().firstChild();

QDomNodeList tclist=dataFile.content().elementsByTagName("trackcontainer");
m_nLoadingTrack=0;
for( int i=0,n=tclist.count(); i<n; ++i ){
QDomNode nd=tclist.at(i).firstChild();
while(!nd.isNull()){
Copy link
Member

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
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also {

if( nd.isElement() && nd.nodeName() == "track" )
{
++m_nLoadingTrack;
if( nd.toElement().attribute("type").toInt() == Track::BBTrack ){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here {

n += nd.toElement().elementsByTagName("bbtrack").at(0).toElement().firstChildElement().childNodes().count();
Copy link
Member

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.

}
nd=nd.nextSibling();
}
}
}

while( !node.isNull() )
{
if( node.isElement() )
Expand Down
4 changes: 1 addition & 3 deletions src/core/TrackContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void TrackContainer::loadSettings( const QDomElement & _this )
{
pd = new QProgressDialog( tr( "Loading project..." ),
tr( "Cancel" ), 0,
_this.childNodes().count(),
Engine::getSong()->getLoadingTrackCount(),
gui->mainWindow() );
pd->setWindowModality( Qt::ApplicationModal );
pd->setWindowTitle( tr( "Please wait..." ) );
Expand All @@ -102,8 +102,6 @@ void TrackContainer::loadSettings( const QDomElement & _this )
else
{
start_val = pd->value();
pd->setMaximum( pd->maximum() +
_this.childNodes().count() );
}
}

Expand Down