diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/fsview/inode.h | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/fsview/inode.h')
-rw-r--r-- | konq-plugins/fsview/inode.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/konq-plugins/fsview/inode.h b/konq-plugins/fsview/inode.h new file mode 100644 index 0000000..8289f6b --- /dev/null +++ b/konq-plugins/fsview/inode.h @@ -0,0 +1,97 @@ +/* This file is part of FSView. + Copyright (C) 2002, 2003 Josef Weidendorfer <[email protected]> + + KCachegrind is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* + * FSView specialisaton of TreeMapItem class. + */ + +#ifndef INODE_H +#define INODE_H + +#include <qmap.h> +#include <qptrlist.h> +#include <qfileinfo.h> +#include <qstring.h> + +#include <kmimetype.h> + +#include "treemap.h" +#include "scan.h" + + +/** + * A specialized version of a TreeMapItem + * for representation of an Directory or File. + * + * These are dynamically created on drawing. + * The real breadth-first scanning of the filesystem + * uses ScanDir:scan. + */ +class Inode: public TreeMapItem, public ScanListener +{ +public: + Inode(); + Inode(ScanDir*, Inode*); + Inode(ScanFile*, Inode*); + ~Inode(); + void init(const QString&); + + void setPeer(ScanDir*); + + TreeMapItemList* children(); + + double value() const; + double size() const; + unsigned int fileCount() const; + unsigned int dirCount() const; + QString path() const; + QString text(int i) const; + QPixmap pixmap(int i) const; + QColor backColor() const; + KMimeType::Ptr mimeType() const; + + const QFileInfo& fileInfo() const { return _info; } + ScanDir* dirPeer() { return _dirPeer; } + ScanFile* filePeer() { return _filePeer; } + bool isDir() { return (_dirPeer != 0); } + + void sizeChanged(ScanDir*); + void scanFinished(ScanDir*); + void destroyed(ScanDir*); + void destroyed(ScanFile*); + +private: + void setMetrics(double, unsigned int); + + QFileInfo _info; + ScanDir* _dirPeer; + ScanFile* _filePeer; + + double _sizeEstimation; + unsigned int _fileCountEstimation, _dirCountEstimation; + + bool _resortNeeded; + + // Cached values, calculated lazy. + // This means a change even in const methods, thus has to be "mutable" + mutable bool _mimeSet, _mimePixmapSet; + mutable KMimeType::Ptr _mimeType; + mutable QPixmap _mimePixmap; +}; + +#endif |