Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Utilities
Filelight
Commits
647cd78f
Commit
647cd78f
authored
Aug 23, 2020
by
Martin Tobias Holmedahl Sandsmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show size of files scanned so far in progress box
parent
5af1bcb2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
14 deletions
+23
-14
src/localLister.cpp
src/localLister.cpp
+6
-4
src/progressBox.cpp
src/progressBox.cpp
+5
-4
src/progressBox.h
src/progressBox.h
+1
-1
src/remoteLister.cpp
src/remoteLister.cpp
+4
-2
src/scan.h
src/scan.h
+7
-3
No files found.
src/localLister.cpp
View file @
647cd78f
...
...
@@ -189,13 +189,15 @@ LocalLister::scan(const QByteArray &path, const QByteArray &dirname)
continue
;
}
if
(
S_ISREG
(
statbuf
.
st_mode
))
//file
if
(
S_ISREG
(
statbuf
.
st_mode
))
{
//file
#ifndef Q_OS_WIN
c
wd
->
append
(
ent
->
d_name
,
(
statbuf
.
st_blocks
*
S_BLKSIZE
)
)
;
c
onst
size_t
size
=
(
statbuf
.
st_blocks
*
S_BLKSIZE
);
#else
c
wd
->
append
(
ent
->
d_name
,
statbuf
.
st_size
)
;
c
onst
size_t
size
=
statbuf
.
st_size
;
#endif
cwd
->
append
(
ent
->
d_name
,
size
);
m_parent
->
m_totalSize
+=
size
;
}
else
if
(
S_ISDIR
(
statbuf
.
st_mode
))
//folder
{
Folder
*
d
=
nullptr
;
...
...
src/progressBox.cpp
View file @
647cd78f
...
...
@@ -25,6 +25,7 @@
#include "mainWindow.h"
#include <KColorScheme>
#include <KFormat>
#include <KIO/Job>
#include <KLocalizedString>
...
...
@@ -45,7 +46,7 @@ ProgressBox::ProgressBox(QWidget *parent, Filelight::MainWindow *mainWindow, Fil
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Fixed
);
setText
(
999999
);
setText
(
999999
,
0
);
setSizePolicy
(
QSizePolicy
::
Fixed
,
QSizePolicy
::
Fixed
);
setMinimumSize
(
300
,
300
);
...
...
@@ -66,7 +67,7 @@ ProgressBox::start() //slot
void
ProgressBox
::
report
()
//slot
{
setText
(
m_manager
->
files
());
setText
(
m_manager
->
files
()
,
m_manager
->
totalSize
()
);
update
();
//repaint();
}
...
...
@@ -85,9 +86,9 @@ ProgressBox::halt()
}
void
ProgressBox
::
setText
(
int
files
)
ProgressBox
::
setText
(
int
files
,
size_t
totalSize
)
{
m_text
=
i18np
(
"%1 File"
,
"%1 Files"
,
files
);
m_text
=
i18n
c
p
(
"Scanned number of files and size so far"
,
"%1 File
, %2
"
,
"%1 Files
, %2
"
,
files
,
KFormat
().
formatByteSize
(
totalSize
)
);
m_textWidth
=
fontMetrics
().
boundingRect
(
m_text
).
width
();
m_textHeight
=
fontMetrics
().
height
();
}
...
...
src/progressBox.h
View file @
647cd78f
...
...
@@ -38,7 +38,7 @@ class ProgressBox : public QWidget
public:
ProgressBox
(
QWidget
*
parent
,
Filelight
::
MainWindow
*
mainWindow
,
Filelight
::
ScanManager
*
scanManager
);
void
setText
(
int
);
void
setText
(
int
files
,
size_t
totalSize
);
public
Q_SLOTS
:
void
start
();
...
...
src/remoteLister.cpp
View file @
647cd78f
...
...
@@ -112,10 +112,12 @@ void RemoteLister::onCompleted()
const
KFileItemList
items
=
KDirLister
::
items
();
for
(
KFileItemList
::
ConstIterator
it
=
items
.
begin
(),
end
=
items
.
end
();
it
!=
end
;
++
it
)
{
if
(
it
->
isDir
())
if
(
it
->
isDir
())
{
m_store
->
stores
+=
new
Store
(
it
->
url
(),
it
->
name
(),
m_store
);
else
}
else
{
m_store
->
folder
->
append
(
it
->
name
().
toUtf8
().
constData
(),
it
->
size
());
m_manager
->
m_totalSize
+=
it
->
size
();
}
m_manager
->
m_files
++
;
}
...
...
src/scan.h
View file @
647cd78f
...
...
@@ -47,8 +47,11 @@ public:
bool
start
(
const
QUrl
&
path
);
bool
running
()
const
;
uint
files
()
const
{
return
m_files
;
int
files
()
const
{
return
m_files
.
loadRelaxed
();
}
size_t
totalSize
()
const
{
return
m_totalSize
.
loadRelaxed
();
}
void
invalidateCacheFor
(
const
QUrl
&
url
);
...
...
@@ -66,7 +69,8 @@ Q_SIGNALS:
private:
bool
m_abort
;
uint
m_files
;
QAtomicInt
m_files
;
QAtomicInteger
<
size_t
>
m_totalSize
;
QMutex
m_mutex
;
LocalLister
*
m_thread
;
...
...
Write
Preview
Markdown
is supported
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