Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Filelight
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Utilities
Filelight
Commits
8403c2a2
Commit
8403c2a2
authored
Jan 25, 2010
by
Martin Tobias Holmedahl Sandsmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
also rename Directory → Folder in the kpart, thanks to Burkhard Lück for patches
svn path=/trunk/playground/utils/filelight/; revision=1080225
parent
87d4778c
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
138 additions
and
120 deletions
+138
-120
src/app/mainWindow.cpp
src/app/mainWindow.cpp
+1
-1
src/part/fileTree.cpp
src/part/fileTree.cpp
+2
-2
src/part/fileTree.h
src/part/fileTree.h
+14
-14
src/part/localLister.cpp
src/part/localLister.cpp
+9
-9
src/part/localLister.h
src/part/localLister.h
+5
-5
src/part/part.cpp
src/part/part.cpp
+7
-7
src/part/part.h
src/part/part.h
+3
-3
src/part/radialMap/builder.cpp
src/part/radialMap/builder.cpp
+9
-9
src/part/radialMap/builder.h
src/part/radialMap/builder.h
+5
-5
src/part/radialMap/labels.cpp
src/part/radialMap/labels.cpp
+9
-3
src/part/radialMap/map.cpp
src/part/radialMap/map.cpp
+6
-4
src/part/radialMap/map.h
src/part/radialMap/map.h
+1
-1
src/part/radialMap/segmentTip.cpp
src/part/radialMap/segmentTip.cpp
+3
-3
src/part/radialMap/segmentTip.h
src/part/radialMap/segmentTip.h
+2
-2
src/part/radialMap/widget.cpp
src/part/radialMap/widget.cpp
+14
-4
src/part/radialMap/widget.h
src/part/radialMap/widget.h
+5
-5
src/part/radialMap/widgetEvents.cpp
src/part/radialMap/widgetEvents.cpp
+5
-5
src/part/remoteLister.cpp
src/part/remoteLister.cpp
+13
-13
src/part/remoteLister.h
src/part/remoteLister.h
+1
-1
src/part/scan.cpp
src/part/scan.cpp
+10
-10
src/part/scan.h
src/part/scan.h
+5
-5
src/part/settingsDialog.cpp
src/part/settingsDialog.cpp
+6
-6
src/part/settingsDialog.h
src/part/settingsDialog.h
+2
-2
src/part/summaryWidget.cpp
src/part/summaryWidget.cpp
+1
-1
No files found.
src/app/mainWindow.cpp
View file @
8403c2a2
...
...
@@ -185,7 +185,7 @@ inline void MainWindow::configKeys() //slot
inline
void
MainWindow
::
slotScanFolder
()
{
slotScanUrl
(
KFileDialog
::
getExistingDirectoryUrl
(
m_part
->
url
(),
this
,
QString
(
"Select folder to scan..."
)));
slotScanUrl
(
KFileDialog
::
getExistingDirectoryUrl
(
m_part
->
url
(),
this
,
i18n
(
"Select folder to scan..."
)));
}
inline
void
MainWindow
::
slotScanHomeFolder
()
{
...
...
src/part/fileTree.cpp
View file @
8403c2a2
...
...
@@ -33,14 +33,14 @@ static const char PREFIX[4] = { 'K', 'M', 'G', 'T' };
QString
File
::
fullPath
(
const
Directory
*
root
/*= 0*/
)
const
File
::
fullPath
(
const
Folder
*
root
/*= 0*/
)
const
{
QString
path
;
if
(
root
==
this
)
root
=
0
;
//prevent returning empty string when there is something we could return
for
(
const
Directory
*
d
=
(
Directory
*
)
this
;
d
!=
root
&&
d
;
d
=
d
->
parent
())
for
(
const
Folder
*
d
=
(
Folder
*
)
this
;
d
!=
root
&&
d
;
d
=
d
->
parent
())
path
.
prepend
(
d
->
name
());
return
path
;
...
...
src/part/fileTree.h
View file @
8403c2a2
...
...
@@ -219,13 +219,13 @@ private:
};
class
Directory
;
class
Folder
;
class
QString
;
class
File
{
public:
friend
class
Directory
;
friend
class
Folder
;
enum
UnitPrefix
{
kilo
,
mega
,
giga
,
tera
};
...
...
@@ -237,7 +237,7 @@ public:
delete
[]
m_name
;
}
const
Directory
*
parent
()
const
{
const
Folder
*
parent
()
const
{
return
m_parent
;
}
const
char
*
name8Bit
()
const
{
...
...
@@ -250,20 +250,20 @@ public:
return
QFile
::
decodeName
(
m_name
);
}
virtual
bool
is
Directory
()
const
{
virtual
bool
is
Folder
()
const
{
return
false
;
}
QString
fullPath
(
const
Directory
*
=
0
)
const
;
QString
fullPath
(
const
Folder
*
=
0
)
const
;
QString
humanReadableSize
(
UnitPrefix
key
=
mega
)
const
;
public:
static
QString
humanReadableSize
(
uint
size
,
UnitPrefix
Key
=
mega
);
protected:
File
(
const
char
*
name
,
FileSize
size
,
Directory
*
parent
)
:
m_parent
(
parent
),
m_name
(
qstrdup
(
name
)),
m_size
(
size
)
{}
File
(
const
char
*
name
,
FileSize
size
,
Folder
*
parent
)
:
m_parent
(
parent
),
m_name
(
qstrdup
(
name
)),
m_size
(
size
)
{}
Directory
*
m_parent
;
//0 if this is treeRoot
Folder
*
m_parent
;
//0 if this is treeRoot
char
*
m_name
;
FileSize
m_size
;
//in units of KiB
...
...
@@ -273,20 +273,20 @@ private:
};
class
Directory
:
public
Chain
<
File
>
,
public
File
class
Folder
:
public
Chain
<
File
>
,
public
File
{
public:
Directory
(
const
char
*
name
)
:
File
(
name
,
0
),
m_children
(
0
)
{}
//DON'T pass the full path!
Folder
(
const
char
*
name
)
:
File
(
name
,
0
),
m_children
(
0
)
{}
//DON'T pass the full path!
uint
children
()
const
{
return
m_children
;
}
virtual
bool
is
Directory
()
const
{
virtual
bool
is
Folder
()
const
{
return
true
;
}
///appends a
Directory
void
append
(
Directory
*
d
,
const
char
*
name
=
0
)
///appends a
Folder
void
append
(
Folder
*
d
,
const
char
*
name
=
0
)
{
if
(
name
)
{
delete
[]
d
->
m_name
;
...
...
@@ -315,8 +315,8 @@ private:
uint
m_children
;
private:
Directory
(
const
Directory
&
);
//undefined
void
operator
=
(
const
Directory
&
);
//undefined
Folder
(
const
Folder
&
);
//undefined
void
operator
=
(
const
Folder
&
);
//undefined
};
#endif
src/part/localLister.cpp
View file @
8403c2a2
...
...
@@ -48,7 +48,7 @@ namespace Filelight
QStringList
LocalLister
::
s_remoteMounts
;
QStringList
LocalLister
::
s_localMounts
;
LocalLister
::
LocalLister
(
const
QString
&
path
,
Chain
<
Directory
>
*
cachedTrees
,
QObject
*
parent
)
LocalLister
::
LocalLister
(
const
QString
&
path
,
Chain
<
Folder
>
*
cachedTrees
,
QObject
*
parent
)
:
QThread
()
,
m_path
(
path
)
,
m_trees
(
cachedTrees
)
...
...
@@ -64,7 +64,7 @@ LocalLister::LocalLister(const QString &path, Chain<Directory> *cachedTrees, QOb
for
(
QStringList
::
ConstIterator
it
=
list
.
constBegin
();
it
!=
list
.
constEnd
();
++
it
)
if
((
*
it
).
startsWith
(
path
))
//prevent scanning of these directories
m_trees
->
append
(
new
Directory
((
*
it
).
toLocal8Bit
()));
m_trees
->
append
(
new
Folder
((
*
it
).
toLocal8Bit
()));
}
void
...
...
@@ -72,7 +72,7 @@ LocalLister::run()
{
//recursively scan the requested path
const
QByteArray
path
=
QFile
::
encodeName
(
m_path
);
Directory
*
tree
=
scan
(
path
,
path
);
Folder
*
tree
=
scan
(
path
,
path
);
//delete the list of trees useful for this scan,
//in a sucessful scan the contents would now be transferred to 'tree'
...
...
@@ -158,7 +158,7 @@ outputError(QByteArray path)
case
ENOMEM
:
out
(
"Insufficient memory to complete the operation"
);
case
ENOTDIR
:
out
(
"A component of the path is not a
directory
"
);
out
(
"A component of the path is not a
folder
"
);
case
EBADF
:
out
(
"Bad file descriptor"
);
case
EFAULT
:
...
...
@@ -172,10 +172,10 @@ outputError(QByteArray path)
#undef out
}
Directory
*
Folder
*
LocalLister
::
scan
(
const
QByteArray
&
path
,
const
QByteArray
&
dirname
)
{
Directory
*
cwd
=
new
Directory
(
dirname
);
Folder
*
cwd
=
new
Folder
(
dirname
);
DIR
*
dir
=
opendir
(
path
);
if
(
!
dir
)
{
...
...
@@ -215,16 +215,16 @@ LocalLister::scan(const QByteArray &path, const QByteArray &dirname)
//using units of KiB as 32bit max is 4GiB and 64bit ints are expensive
cwd
->
append
(
ent
->
d_name
,
(
ST_NBLOCKS
(
statbuf
)
*
ST_NBLOCKSIZE
)
/
1024
);
else
if
(
S_ISDIR
(
statbuf
.
st_mode
))
//
directory
else
if
(
S_ISDIR
(
statbuf
.
st_mode
))
//
folder
{
Directory
*
d
=
0
;
Folder
*
d
=
0
;
QByteArray
new_dirname
=
ent
->
d_name
;
new_dirname
+=
'/'
;
new_path
+=
'/'
;
//check to see if we've scanned this section already
for
(
Iterator
<
Directory
>
it
=
m_trees
->
iterator
();
it
!=
m_trees
->
end
();
++
it
)
for
(
Iterator
<
Folder
>
it
=
m_trees
->
iterator
();
it
!=
m_trees
->
end
();
++
it
)
{
if
(
new_path
==
(
*
it
)
->
name8Bit
())
{
...
...
src/part/localLister.h
View file @
8403c2a2
...
...
@@ -25,7 +25,7 @@
#include <QThread>
#include <QByteArray>
class
Directory
;
class
Folder
;
template
<
class
T
>
class
Chain
;
namespace
Filelight
...
...
@@ -35,21 +35,21 @@ class LocalLister : public QThread
Q_OBJECT
public:
LocalLister
(
const
QString
&
path
,
Chain
<
Directory
>
*
cachedTrees
,
QObject
*
parent
);
LocalLister
(
const
QString
&
path
,
Chain
<
Folder
>
*
cachedTrees
,
QObject
*
parent
);
static
bool
readMounts
();
signals:
void
branchCompleted
(
Directory
*
tree
,
bool
finished
);
void
branchCompleted
(
Folder
*
tree
,
bool
finished
);
private:
QString
m_path
;
Chain
<
Directory
>
*
m_trees
;
Chain
<
Folder
>
*
m_trees
;
QObject
*
m_parent
;
private:
virtual
void
run
();
Directory
*
scan
(
const
QByteArray
&
,
const
QByteArray
&
);
Folder
*
scan
(
const
QByteArray
&
,
const
QByteArray
&
);
private:
static
QStringList
s_localMounts
,
s_remoteMounts
;
//TODO namespace
...
...
src/part/part.cpp
View file @
8403c2a2
...
...
@@ -94,15 +94,15 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QList<QVariant>&)
KStandardAction
::
zoomOut
(
m_map
,
SLOT
(
zoomOut
()),
actionCollection
());
KStandardAction
::
preferences
(
this
,
SLOT
(
configFilelight
()),
actionCollection
());
connect
(
m_map
,
SIGNAL
(
created
(
const
Directory
*
)),
SIGNAL
(
completed
()));
connect
(
m_map
,
SIGNAL
(
created
(
const
Directory
*
)),
SLOT
(
mapChanged
(
const
Directory
*
)));
connect
(
m_map
,
SIGNAL
(
created
(
const
Folder
*
)),
SIGNAL
(
completed
()));
connect
(
m_map
,
SIGNAL
(
created
(
const
Folder
*
)),
SLOT
(
mapChanged
(
const
Folder
*
)));
connect
(
m_map
,
SIGNAL
(
activated
(
const
KUrl
&
)),
SLOT
(
updateURL
(
const
KUrl
&
)));
// TODO make better system
connect
(
m_map
,
SIGNAL
(
giveMeTreeFor
(
const
KUrl
&
)),
SLOT
(
updateURL
(
const
KUrl
&
)));
connect
(
m_map
,
SIGNAL
(
giveMeTreeFor
(
const
KUrl
&
)),
SLOT
(
openUrl
(
const
KUrl
&
)));
connect
(
m_manager
,
SIGNAL
(
completed
(
Directory
*
)),
SLOT
(
scanCompleted
(
Directory
*
)));
connect
(
m_manager
,
SIGNAL
(
completed
(
Folder
*
)),
SLOT
(
scanCompleted
(
Folder
*
)));
connect
(
m_manager
,
SIGNAL
(
aboutToEmptyCache
()),
m_map
,
SLOT
(
invalidate
()));
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
postInit
()));
...
...
@@ -156,7 +156,7 @@ Part::openUrl(const KUrl &u)
}
else
if
(
isLocal
&&
access
(
path8bit
,
F_OK
)
!=
0
)
//stat(path, &statbuf) == 0
{
KMSG
(
i18n
(
"
Directory
not found: %1"
,
path
));
KMSG
(
i18n
(
"
Folder
not found: %1"
,
path
));
}
else
if
(
isLocal
&&
access
(
path8bit
,
R_OK
|
X_OK
)
!=
0
)
{
...
...
@@ -241,7 +241,7 @@ Part::start(const KUrl &url)
{
if
(
!
m_started
)
{
connect
(
m_map
,
SIGNAL
(
mouseHover
(
const
QString
&
)),
statusBar
(),
SLOT
(
message
(
const
QString
&
)));
connect
(
m_map
,
SIGNAL
(
created
(
const
Directory
*
)),
statusBar
(),
SLOT
(
clear
()));
connect
(
m_map
,
SIGNAL
(
created
(
const
Folder
*
)),
statusBar
(),
SLOT
(
clear
()));
m_started
=
true
;
}
...
...
@@ -276,7 +276,7 @@ Part::rescan()
}
void
Part
::
scanCompleted
(
Directory
*
tree
)
Part
::
scanCompleted
(
Folder
*
tree
)
{
if
(
tree
)
{
statusBar
()
->
showMessage
(
i18n
(
"Scan completed, generating map..."
));
...
...
@@ -299,7 +299,7 @@ Part::scanCompleted(Directory *tree)
}
void
Part
::
mapChanged
(
const
Directory
*
tree
)
Part
::
mapChanged
(
const
Folder
*
tree
)
{
//IMPORTANT -> url() has already been set
...
...
src/part/part.h
View file @
8403c2a2
...
...
@@ -34,7 +34,7 @@ using KParts::StatusBarExtension;
namespace
RadialMap
{
class
Widget
;
}
class
Directory
;
class
Folder
;
namespace
Filelight
...
...
@@ -73,8 +73,8 @@ public slots:
private
slots
:
void
postInit
();
void
scanCompleted
(
Directory
*
);
void
mapChanged
(
const
Directory
*
);
void
scanCompleted
(
Folder
*
);
void
mapChanged
(
const
Folder
*
);
private:
KStatusBar
*
statusBar
()
{
...
...
src/part/radialMap/builder.cpp
View file @
8403c2a2
...
...
@@ -31,7 +31,7 @@
//**** add some angle bounds checking (possibly in Segment ctor? can I delete in a ctor?)
//**** this class is a mess
RadialMap
::
Builder
::
Builder
(
RadialMap
::
Map
*
m
,
const
Directory
*
const
d
,
bool
fast
)
RadialMap
::
Builder
::
Builder
(
RadialMap
::
Map
*
m
,
const
Folder
*
const
d
,
bool
fast
)
:
m_map
(
m
)
,
m_root
(
d
)
,
m_minSize
(
static_cast
<
unsigned
int
>
((
d
->
size
()
*
3
)
/
(
PI
*
m
->
height
()
-
m
->
MAP_2MARGIN
)))
...
...
@@ -56,7 +56,7 @@ RadialMap::Builder::Builder(RadialMap::Map *m, const Directory* const d, bool fa
void
RadialMap
::
Builder
::
findVisibleDepth
(
const
Directory
*
const
dir
,
const
unsigned
int
depth
)
RadialMap
::
Builder
::
findVisibleDepth
(
const
Folder
*
const
dir
,
const
unsigned
int
depth
)
{
//**** because I don't use the same minimumSize criteria as in the visual function
// this can lead to incorrect visual representation
...
...
@@ -79,8 +79,8 @@ RadialMap::Builder::findVisibleDepth(const Directory* const dir, const unsigned
if
(
*
m_depth
>=
stopDepth
)
return
;
for
(
ConstIterator
<
File
>
it
=
dir
->
constIterator
();
it
!=
dir
->
end
();
++
it
)
if
((
*
it
)
->
is
Directory
()
&&
(
*
it
)
->
size
()
>
m_minSize
)
findVisibleDepth
((
Directory
*
)
*
it
,
depth
+
1
);
//if no files greater than min size the depth is still recorded
if
((
*
it
)
->
is
Folder
()
&&
(
*
it
)
->
size
()
>
m_minSize
)
findVisibleDepth
((
Folder
*
)
*
it
,
depth
+
1
);
//if no files greater than min size the depth is still recorded
}
void
...
...
@@ -98,7 +98,7 @@ RadialMap::Builder::setLimits(const uint &b) //b = breadth?
//**** segments currently overlap at edges (i.e. end of first is start of next)
bool
RadialMap
::
Builder
::
build
(
const
Directory
*
const
dir
,
const
unsigned
int
depth
,
unsigned
int
a_start
,
const
unsigned
int
a_end
)
RadialMap
::
Builder
::
build
(
const
Folder
*
const
dir
,
const
unsigned
int
depth
,
unsigned
int
a_start
,
const
unsigned
int
a_end
)
{
//first iteration: dir == m_root
...
...
@@ -117,12 +117,12 @@ RadialMap::Builder::build(const Directory* const dir, const unsigned int depth,
(
m_signature
+
depth
)
->
append
(
s
);
if
((
*
it
)
->
is
Directory
())
if
((
*
it
)
->
is
Folder
())
{
if
(
depth
!=
*
m_depth
)
{
//recurse
s
->
m_hasHiddenChildren
=
build
((
Directory
*
)
*
it
,
depth
+
1
,
a_start
,
a_start
+
a_len
);
s
->
m_hasHiddenChildren
=
build
((
Folder
*
)
*
it
,
depth
+
1
,
a_start
,
a_start
+
a_len
);
}
else
s
->
m_hasHiddenChildren
=
true
;
}
...
...
@@ -133,8 +133,8 @@ RadialMap::Builder::build(const Directory* const dir, const unsigned int depth,
hiddenSize
+=
(
*
it
)
->
size
();
if
((
*
it
)
->
is
Directory
())
//**** considered virtual, but dir wouldn't count itself!
hiddenFileCount
+=
static_cast
<
const
Directory
*>
(
*
it
)
->
children
();
//need to add one to count the dir as well
if
((
*
it
)
->
is
Folder
())
//**** considered virtual, but dir wouldn't count itself!
hiddenFileCount
+=
static_cast
<
const
Folder
*>
(
*
it
)
->
children
();
//need to add one to count the dir as well
++
hiddenFileCount
;
}
...
...
src/part/radialMap/builder.h
View file @
8403c2a2
...
...
@@ -25,7 +25,7 @@
#include "radialMap.h" //Segment, defines
template
<
class
T
>
class
Chain
;
class
Directory
;
class
Folder
;
namespace
RadialMap
...
...
@@ -37,15 +37,15 @@ class Map;
class
Builder
{
public:
Builder
(
Map
*
,
const
Directory
*
const
,
bool
fast
=
false
);
Builder
(
Map
*
,
const
Folder
*
const
,
bool
fast
=
false
);
private:
void
findVisibleDepth
(
const
Directory
*
const
dir
,
const
uint
=
0
);
void
findVisibleDepth
(
const
Folder
*
const
dir
,
const
uint
=
0
);
void
setLimits
(
const
uint
&
);
bool
build
(
const
Directory
*
const
,
const
uint
=
0
,
uint
=
0
,
const
uint
=
5760
);
bool
build
(
const
Folder
*
const
,
const
uint
=
0
,
uint
=
0
,
const
uint
=
5760
);
Map
*
m_map
;
const
Directory
*
const
m_root
;
const
Folder
*
const
m_root
;
const
uint
m_minSize
;
uint
*
m_depth
;
Chain
<
Segment
>
*
m_signature
;
...
...
src/part/radialMap/labels.cpp
View file @
8403c2a2
...
...
@@ -48,7 +48,7 @@ public:
const
int
angle
;
int
x1
,
y1
,
x2
,
y2
,
x3
;
int
tx
,
ty
;
int
tx
,
ty
,
tw
,
th
;
QString
qs
;
};
...
...
@@ -86,12 +86,12 @@ RadialMap::Widget::paintExplodedLabels(QPainter &paint) const
if
(
m_focus
&&
m_focus
->
file
()
!=
m_tree
)
//separate behavior for selected vs unselected segments
{
//don't bother with files
if
(
m_focus
->
file
()
&&
!
m_focus
->
file
()
->
is
Directory
())
if
(
m_focus
->
file
()
&&
!
m_focus
->
file
()
->
is
Folder
())
return
;
//find the range of levels we will be potentially drawing labels for
//startLevel is the level above whatever m_focus is in
for
(
const
Directory
*
p
=
(
const
Directory
*
)
m_focus
->
file
();
p
!=
m_tree
;
++
startLevel
)
for
(
const
Folder
*
p
=
(
const
Folder
*
)
m_focus
->
file
();
p
!=
m_tree
;
++
startLevel
)
p
=
p
->
parent
();
//range=2 means 2 levels to draw labels for
...
...
@@ -323,6 +323,12 @@ RadialMap::Widget::paintExplodedLabels(QPainter &paint) const
paint
.
drawEllipse
((
*
it
)
->
x1
-
3
,
(
*
it
)
->
y1
-
3
,
7
,
7
);
//**** CPU intensive! better to use a pixmap
paint
.
drawLine
((
*
it
)
->
x1
,
(
*
it
)
->
y1
,
(
*
it
)
->
x2
,
(
*
it
)
->
y2
);
paint
.
drawLine
((
*
it
)
->
x2
,
(
*
it
)
->
y2
,
(
*
it
)
->
x3
,
(
*
it
)
->
y2
);
paint
.
setBrush
(
QBrush
(
Qt
::
white
));
paint
.
setPen
(
Qt
::
NoPen
);
paint
.
drawRoundedRect
((
*
it
)
->
tx
-
2
,
(
*
it
)
->
ty
-
fontMetrics
().
height
()
+
2
,
fontMetrics
().
width
((
*
it
)
->
qs
)
+
4
,
fontMetrics
().
height
()
+
2
,
5
,
Qt
::
RelativeSize
);
paint
.
setPen
(
QPen
(
Qt
::
black
,
1
));
paint
.
drawText
((
*
it
)
->
tx
,
(
*
it
)
->
ty
,
(
*
it
)
->
qs
);
}
...
...
src/part/radialMap/map.cpp
View file @
8403c2a2
...
...
@@ -64,7 +64,7 @@ void RadialMap::Map::invalidate()
m_visibleDepth
=
Config
::
defaultRingDepth
;
}
void
RadialMap
::
Map
::
make
(
const
Directory
*
tree
,
bool
refresh
)
void
RadialMap
::
Map
::
make
(
const
Folder
*
tree
,
bool
refresh
)
{
//**** determineText seems like pointless optimization
// but is it good to keep the text consistent?
...
...
@@ -244,12 +244,12 @@ void RadialMap::Map::colorise()
cb
.
setHsv
(
h
,
s2
,
(
v2
<
90
)
?
90
:
v2
);
//too dark if < 100
cp
.
setHsv
(
h
,
17
,
v1
);
}
else
if
(
!
(
*
it
)
->
file
()
->
is
Directory
())
//file
else
if
(
!
(
*
it
)
->
file
()
->
is
Folder
())
//file
{
cb
.
setHsv
(
h
,
17
,
v1
);
cp
.
setHsv
(
h
,
17
,
v2
);
}
else
//
directory
else
//
folder
{
cb
.
setHsv
(
h
,
s1
,
v1
);
//v was 225
cp
.
setHsv
(
h
,
s2
,
v2
);
//v was 225 - delta
...
...
@@ -277,7 +277,9 @@ void RadialMap::Map::paint(bool antialias)
QRect
rect
=
m_rect
;
rect
.
adjust
(
5
,
5
,
-
5
,
-
5
);
m_pixmap
.
fill
(
m_scheme
.
background
().
color
());
QColor
background
=
m_scheme
.
background
().
color
();
background
.
setAlpha
(
0
);
m_pixmap
.
fill
(
background
);
//m_rect.moveRight(1); // Uncommenting this breaks repainting when recreating map from cache
...
...
src/part/radialMap/map.h
View file @
8403c2a2
...
...
@@ -39,7 +39,7 @@ public:
Map
(
bool
summary
);
~
Map
();
void
make
(
const
Directory
*
,
bool
=
false
);
void
make
(
const
Folder
*
,
bool
=
false
);
bool
resize
(
const
QRect
&
);
bool
isNull
()
const
{
...
...
src/part/radialMap/segmentTip.cpp
View file @
8403c2a2
...
...
@@ -65,7 +65,7 @@ SegmentTip::moveTo(QPoint p, bool placeAbove)
}
void
SegmentTip
::
updateTip
(
const
File
*
const
file
,
const
Directory
*
const
root
)
SegmentTip
::
updateTip
(
const
File
*
const
file
,
const
Folder
*
const
root
)
{
const
QString
s1
=
file
->
fullPath
(
root
);
QString
s2
=
file
->
humanReadableSize
();
...
...
@@ -81,9 +81,9 @@ SegmentTip::updateTip(const File* const file, const Directory* const root)
m_text
+=
'\n'
;
m_text
+=
s2
;
if
(
file
->
is
Directory
())
if
(
file
->
is
Folder
())
{
int
files
=
static_cast
<
const
Directory
*>
(
file
)
->
children
();
int
files
=
static_cast
<
const
Folder
*>
(
file
)
->
children
();
const
uint
pc
=
uint
((
100
*
files
)
/
(
double
)
root
->
children
());
QString
s3
=
i18np
(
"File: %1"
,
"Files: %1"
,
files
);
...
...
src/part/radialMap/segmentTip.h
View file @
8403c2a2
...
...
@@ -26,7 +26,7 @@
#include <QWidget>
class
File
;
class
Directory
;
class
Folder
;
namespace
RadialMap
{
...
...
@@ -35,7 +35,7 @@ class SegmentTip : public QWidget
public:
SegmentTip
(
uint
);
void
updateTip
(
const
File
*
,
const
Directory
*
);
void
updateTip
(
const
File
*
,
const
Folder
*
);
void
moveTo
(
QPoint
,
bool
);
private:
...
...
src/part/radialMap/widget.cpp
View file @
8403c2a2
...
...
@@ -48,11 +48,21 @@ RadialMap::Widget::Widget(QWidget *parent, bool isSummary)
setAcceptDrops
(
true
);
setMinimumSize
(
100
,
100
);
//TODO: set a sane minimumsize, not just a random one.
QColor
background
=
palette
().
background
().
color
();
background
.
setAlpha
(
50
);
QPalette
pal
=
palette
();
pal
.
setColor
(
QPalette
::
Window
,
background
);
setPalette
(
pal
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
parent
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
parent
->
parentWidget
()
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
const
QBitmap
*
cursor
=
QCursor
(
Qt
::
PointingHandCursor
).
bitmap
();
m_tip
=
new
SegmentTip
(
cursor
?
cursor
->
height
()
:
16
);
connect
(
this
,
SIGNAL
(
created
(
const
Directory
*
)),
SLOT
(
sendFakeMouseEvent
()));
connect
(
this
,
SIGNAL
(
created
(
const
Directory
*
)),
SLOT
(
update
()));
connect
(
this
,
SIGNAL
(
created
(
const
Folder
*
)),
SLOT
(
sendFakeMouseEvent
()));
connect
(
this
,
SIGNAL
(
created
(
const
Folder
*
)),
SLOT
(
update
()));
connect
(
&
m_timer
,
SIGNAL
(
timeout
()),
SLOT
(
resizeTimeout
()));
}
...
...
@@ -97,7 +107,7 @@ RadialMap::Widget::invalidate()
}
void
RadialMap
::
Widget
::
create
(
const
Directory
*
tree
)
RadialMap
::
Widget
::
create
(
const
Folder
*
tree
)
{
//it is not the responsibility of create() to invalidate first
//skip invalidation at your own risk
...
...
@@ -122,7 +132,7 @@ RadialMap::Widget::create(const Directory *tree)
}
void
RadialMap
::
Widget
::
createFromCache
(
const
Directory
*
tree
)
RadialMap
::
Widget
::
createFromCache
(
const
Folder
*
tree
)
{
//no scan was necessary, use cached tree, however we MUST still emit invalidate
invalidate
();
...
...
src/part/radialMap/widget.h
View file @
8403c2a2
...
...
@@ -37,7 +37,7 @@
#include "map.h"
template
<
class
T
>
class
Chain
;
class
Directory
;
class
Folder
;
class
File
;
namespace
KIO
{
class
Job
;
...
...
@@ -74,7 +74,7 @@ public:
public
slots
:
void
zoomIn
();
void
zoomOut
();
void
create
(
const
Directory
*
);
void
create
(
const
Folder
*
);
void
invalidate
();
void
refresh
(
int
);
...
...
@@ -82,12 +82,12 @@ private slots:
void
resizeTimeout
();
void
sendFakeMouseEvent
();
void
deleteJobFinished
(
KJob
*
);
void
createFromCache
(
const
Directory
*
);
void
createFromCache
(
const
Folder
*
);
signals:
void
activated
(
const
KUrl
&
);
void
invalidated
(
const
KUrl
&
);
void
created
(
const
Directory
*
);
void
created
(
const
Folder
*
);
void
mouseHover
(
const
QString
&
);
void
giveMeTreeFor
(
const
KUrl
&
);
...
...
@@ -111,7 +111,7 @@ protected:
private:
void
paintExplodedLabels
(
QPainter
&
)
const
;
const
Directory
*
m_tree
;
const
Folder
*
m_tree
;
const
Segment
*
m_focus
;
QPoint
m_offset
;
QTimer
m_timer
;
...
...
src/part/radialMap/widgetEvents.cpp
View file @
8403c2a2
...
...
@@ -167,7 +167,7 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
if
(
m_focus
&&
!
m_focus
->
isFake
())
{
const
KUrl
url
=
Widget
::
url
(
m_focus
->
file
());
const
bool
isDir
=
m_focus
->
file
()
->
is
Directory
();
const
bool
isDir
=
m_focus
->
file
()
->
is
Folder
();
// Actions in the right click menu
QAction
*
openKonqueror
=
0
;
...
...
@@ -219,8 +219,8 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
}
else
if
(
clicked
==
deleteItem
)
{
m_toBeDeleted
=
m_focus
;
const
KUrl
url
=
Widget
::
url
(
m_toBeDeleted
->
file
());
const
QString
message
=
m_toBeDeleted
->
file
()
->
is
Directory
()
?
i18n
(
"<qt>The
directory
at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted.</qt>"
,
url
.
prettyUrl
())
const
QString
message
=
m_toBeDeleted
->
file
()
->
is
Folder
()
?
i18n
(
"<qt>The
folder
at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted.</qt>"
,
url
.
prettyUrl
())
:
i18n
(
"<qt><i>'%1'</i> will be <b>permanently</b> deleted.</qt>"
,
url
.
prettyUrl
());
const
int
userIntention
=
KMessageBox
::
warningContinueCancel
(
this
,
message
,
...
...
@@ -251,7 +251,7 @@ section_two:
else
if
(
m_focus
->
file
()
!=
m_tree
)
{
// is left click
// KIconEffect::visualActivate(this, rect); // TODO: recreate this
emit
activated
(
url
);
//activate first, this will cause UI to prepare itself
createFromCache
((
Directory
*
)
m_focus
->
file
());
createFromCache
((
Folder
*
)
m_focus
->
file
());
}
else
emit
giveMeTreeFor
(
url
.
upUrl
());
...
...
@@ -263,7 +263,7 @@ void RadialMap::Widget::deleteJobFinished(KJob *job)
{
QApplication
::
restoreOverrideCursor
();
if
(
!
job
->
error
()
&&
m_toBeDeleted
)
{
const
Directory
*
dir
=
m_toBeDeleted
->
file
()
->
parent
();
const
Folder
*
dir
=
m_toBeDeleted
->
file
()
->
parent
();
for
(
Iterator
<
File
>
it
=
dir
->
iterator
();
it
!=
dir
->
end
();
++
it
)
{
if
(
m_toBeDeleted
->
file
()
==
(
*
it
))
it
.
remove
();
...
...
src/part/remoteLister.cpp
View file @
8403c2a2
...
...
@@ -37,24 +37,24 @@ namespace Filelight
//TODO: delete all this stuff!
// You need to use a single DirLister.