Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Office
Calligra
Commits
169f1277
Commit
169f1277
authored
May 21, 2022
by
Tomas Mecir
Browse files
Properly show progress when loading big documents.
parent
6b89611a
Pipeline
#179280
passed with stage
in 29 minutes and 33 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
filters/sheets/csv/csvimport.cc
View file @
169f1277
...
...
@@ -112,7 +112,6 @@ KoFilter::ConversionStatus CSVFilter::convert(const QByteArray& from, const QByt
decimal
=
dialog
->
decimalSymbol
();
thousands
=
dialog
->
thousandsSeparator
();
int
step
=
100
/
numRows
*
numCols
;
int
value
=
0
;
emit
sigProgress
(
value
);
...
...
@@ -126,10 +125,16 @@ KoFilter::ConversionStatus CSVFilter::convert(const QByteArray& from, const QByt
Cell
cell
(
sheet
,
1
,
1
);
QFontMetrics
fm
(
cell
.
style
().
font
());
int
processed
=
0
;
for
(
int
row
=
0
;
row
<
numRows
;
++
row
)
{
for
(
int
col
=
0
;
col
<
numCols
;
++
col
)
{
value
+=
step
;
emit
sigProgress
(
value
);
processed
++
;
int
progress
=
(
int
)
(
100.0
*
processed
/
(
numRows
*
numCols
));
if
(
progress
!=
value
)
{
value
=
progress
;
emit
sigProgress
(
value
);
}
const
QString
text
(
dialog
->
text
(
row
,
col
));
// ### FIXME: how to calculate the width of numbers (as they might not be in the right format)
...
...
@@ -185,8 +190,6 @@ KoFilter::ConversionStatus CSVFilter::convert(const QByteArray& from, const QByt
}
}
emit
sigProgress
(
98
);
for
(
int
i
=
0
;
i
<
numCols
;
++
i
)
{
if
(
widths
[
i
]
>
defaultWidth
)
sheet
->
columnFormats
()
->
setColWidth
(
i
+
1
,
i
+
1
,
widths
[
i
]);
...
...
libs/main/KoDocument.cpp
View file @
169f1277
...
...
@@ -1454,6 +1454,7 @@ bool KoDocument::openFile()
d
->
progressUpdater
=
new
KoProgressUpdater
(
progressProxy
,
KoProgressUpdater
::
Unthreaded
,
d
->
profileStream
);
d
->
filterManager
->
setProgressUpdater
(
d
->
progressUpdater
);
d
->
progressUpdater
->
setReferenceTime
(
d
->
profileReferenceTime
);
d
->
progressUpdater
->
start
(
100
,
i18n
(
"Opening Document"
));
...
...
@@ -1537,7 +1538,8 @@ bool KoDocument::openFile()
d
->
isLoading
=
false
;
delete
d
->
progressUpdater
;
d
->
progressUpdater
=
0
;
d
->
progressUpdater
=
nullptr
;
d
->
filterManager
->
setProgressUpdater
(
nullptr
);
return
false
;
}
d
->
isEmpty
=
false
;
...
...
@@ -1602,7 +1604,8 @@ bool KoDocument::openFile()
updater
->
setProgress
(
100
);
}
delete
d
->
progressUpdater
;
d
->
progressUpdater
=
0
;
d
->
filterManager
->
setProgressUpdater
(
nullptr
);
d
->
progressUpdater
=
nullptr
;
d
->
isLoading
=
false
;
...
...
libs/main/KoFilterManager.cpp
View file @
169f1277
...
...
@@ -530,6 +530,11 @@ bool KoFilterManager::getBatchMode(void) const
return
d
->
batch
;
}
void
KoFilterManager
::
setProgressUpdater
(
KoProgressUpdater
*
updater
)
{
d
->
progressUpdater
=
updater
;
}
KoProgressUpdater
*
KoFilterManager
::
progressUpdater
()
const
{
if
(
d
->
progressUpdater
.
isNull
())
{
...
...
libs/main/KoFilterManager.h
View file @
169f1277
...
...
@@ -140,6 +140,11 @@ public:
**/
KoProgressUpdater
*
progressUpdater
()
const
;
/**
* Set up a progress updater.
*/
void
setProgressUpdater
(
KoProgressUpdater
*
updater
);
private:
// === API for KoFilterChains === (internal)
// The friend methods are private in KoFilterChain and
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment