/usr/include/libfm-qt/folderview.h is in libfm-qt-dev 0.11.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | /*
* Copyright (C) 2012 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef FM_FOLDERVIEW_H
#define FM_FOLDERVIEW_H
#include "libfmqtglobals.h"
#include <QWidget>
#include <QListView>
#include <QTreeView>
#include <QMouseEvent>
#include <libfm/fm.h>
#include "foldermodel.h"
#include "proxyfoldermodel.h"
#include "fileinfo.h"
#include "path.h"
class QTimer;
namespace Fm {
class FileMenu;
class FolderMenu;
class FileLauncher;
class FolderViewStyle;
class LIBFM_QT_API FolderView : public QWidget {
Q_OBJECT
public:
enum ViewMode {
FirstViewMode = 1,
IconMode = FirstViewMode,
CompactMode,
DetailedListMode,
ThumbnailMode,
LastViewMode = ThumbnailMode,
NumViewModes = (LastViewMode - FirstViewMode + 1)
};
enum ClickType {
ActivatedClick,
MiddleClick,
ContextMenuClick
};
friend class FolderViewTreeView;
friend class FolderViewListView;
explicit FolderView(ViewMode _mode = IconMode, QWidget* parent = 0);
virtual ~FolderView();
void setViewMode(ViewMode _mode);
ViewMode viewMode() const;
void setIconSize(ViewMode mode, QSize size);
QSize iconSize(ViewMode mode) const;
QAbstractItemView* childView() const;
ProxyFolderModel* model() const;
void setModel(ProxyFolderModel* _model);
FmFolder* folder() {
return model_ ? static_cast<FolderModel*>(model_->sourceModel())->folder() : NULL;
}
FmFileInfo* folderInfo() {
FmFolder* _folder = folder();
return _folder ? fm_folder_get_info(_folder) : NULL;
}
FmPath* path() {
FmFolder* _folder = folder();
return _folder ? fm_folder_get_path(_folder) : NULL;
}
QItemSelectionModel* selectionModel() const;
Fm::FileInfoList selectedFiles() const;
Fm::PathList selectedFilePaths() const;
QModelIndex indexFromFolderPath(FmPath* folderPath) const;
void selectAll();
void invertSelection();
void setFileLauncher(FileLauncher* launcher) {
fileLauncher_ = launcher;
}
FileLauncher* fileLauncher() {
return fileLauncher_;
}
int autoSelectionDelay() const {
return autoSelectionDelay_;
}
void setAutoSelectionDelay(int delay);
protected:
virtual bool event(QEvent* event);
virtual void contextMenuEvent(QContextMenuEvent* event);
virtual void childMousePressEvent(QMouseEvent* event);
virtual void childDragEnterEvent(QDragEnterEvent* event);
virtual void childDragMoveEvent(QDragMoveEvent* e);
virtual void childDragLeaveEvent(QDragLeaveEvent* e);
virtual void childDropEvent(QDropEvent* e);
void emitClickedAt(ClickType type, const QPoint& pos);
QModelIndexList selectedRows ( int column = 0 ) const;
QModelIndexList selectedIndexes() const;
virtual void prepareFileMenu(Fm::FileMenu* menu);
virtual void prepareFolderMenu(Fm::FolderMenu* menu);
virtual bool eventFilter(QObject* watched, QEvent* event);
void updateGridSize(); // called when view mode, icon size, font size or cell margin is changed
QSize getMargins() const {
return itemDelegateMargins_;
}
// sets the cell margins in the icon and thumbnail modes
// and calls updateGridSize() when needed
void setMargins(QSize size);
public Q_SLOTS:
void onItemActivated(QModelIndex index);
void onSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
virtual void onFileClicked(int type, FmFileInfo* fileInfo);
private Q_SLOTS:
void onAutoSelectionTimeout();
void onSelChangedTimeout();
Q_SIGNALS:
void clicked(int type, FmFileInfo* file);
void clickedBack();
void clickedForward();
void selChanged(int n_sel);
void sortChanged();
private:
QAbstractItemView* view;
ProxyFolderModel* model_;
ViewMode mode;
QSize iconSize_[NumViewModes];
FileLauncher* fileLauncher_;
int autoSelectionDelay_;
QTimer* autoSelectionTimer_;
QModelIndex lastAutoSelectionIndex_;
QTimer* selChangedTimer_;
// the cell margins in the icon and thumbnail modes
QSize itemDelegateMargins_;
};
}
#endif // FM_FOLDERVIEW_H
|