src/documentloader.cpp

changeset 1063
1f15c52c11f6
parent 1023
9450ac3cd930
child 1065
c8ecddbd99e9
equal deleted inserted replaced
1062:4119185b56ca 1063:1f15c52c11f6
78 if (isOnForeground()) 78 if (isOnForeground())
79 { 79 {
80 // Show a progress dialog if we're loading the main ldDocument.here so we can show progress updates and keep the 80 // Show a progress dialog if we're loading the main ldDocument.here so we can show progress updates and keep the
81 // WM posted that we're still here. 81 // WM posted that we're still here.
82 m_progressDialog = new OpenProgressDialog(qobject_cast<QWidget*>(parent())); 82 m_progressDialog = new OpenProgressDialog(qobject_cast<QWidget*>(parent()));
83 m_progressDialog->setNumLines (m_lines.size()); 83 m_progressDialog->setNumLines (length(m_lines));
84 m_progressDialog->setModal (true); 84 m_progressDialog->setModal (true);
85 m_progressDialog->show(); 85 m_progressDialog->show();
86 connect (this, SIGNAL (workDone()), m_progressDialog, SLOT (accept())); 86 connect (this, SIGNAL (workDone()), m_progressDialog, SLOT (accept()));
87 connect (m_progressDialog, SIGNAL (rejected()), this, SLOT (abort())); 87 connect (m_progressDialog, SIGNAL (rejected()), this, SLOT (abort()));
88 } 88 }
107 } 107 }
108 108
109 // Parse up to 200 lines per iteration 109 // Parse up to 200 lines per iteration
110 int max = i + 200; 110 int max = i + 200;
111 111
112 for (; i < max and i < (int) m_lines.size(); ++i) 112 for (; i < max and i < (int) length(m_lines); ++i)
113 { 113 {
114 QString line = m_lines[i]; 114 QString line = m_lines[i];
115 115
116 // Trim the trailing newline 116 // Trim the trailing newline
117 while (line.endsWith ("\n") or line.endsWith ("\r")) 117 while (line.endsWith ("\n") or line.endsWith ("\r"))
132 m_progress = i; 132 m_progress = i;
133 133
134 if (m_progressDialog) 134 if (m_progressDialog)
135 m_progressDialog->setProgress (i); 135 m_progressDialog->setProgress (i);
136 136
137 if (i >= m_lines.size() - 1) 137 if (i >= length(m_lines) - 1)
138 { 138 {
139 emit workDone(); 139 emit workDone();
140 m_isDone = true; 140 m_isDone = true;
141 } 141 }
142 else 142 else

mercurial