~lubuntu-dev/lxde/libfm-qt-debian-git

« back to all changes in this revision

Viewing changes to src/placesview.h

  • Committer: Alf Gaida
  • Date: 2015-12-17 15:45:00 UTC
  • Revision ID: git-v1:99d4cf5e0b3761023e2285ffb96a79d050f0bdf4
Tags: upstream/0.10.0+20151214
Adding upstream version 0.10.0+20151214.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 - 2015  Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 *
 
18
 */
 
19
 
 
20
 
 
21
#ifndef FM_PLACESVIEW_H
 
22
#define FM_PLACESVIEW_H
 
23
 
 
24
#include "libfmqtglobals.h"
 
25
#include <QTreeView>
 
26
#include <libfm/fm.h>
 
27
 
 
28
namespace Fm {
 
29
 
 
30
class PlacesModel;
 
31
class PlacesModelItem;
 
32
 
 
33
class LIBFM_QT_API PlacesView : public QTreeView {
 
34
Q_OBJECT
 
35
 
 
36
public:
 
37
  explicit PlacesView(QWidget* parent = 0);
 
38
  virtual ~PlacesView();
 
39
 
 
40
  void setCurrentPath(FmPath* path);
 
41
  FmPath* currentPath() {
 
42
    return currentPath_;
 
43
  }
 
44
 
 
45
  // libfm-gtk compatible alias
 
46
  FmPath* getCwd() {
 
47
    return currentPath();
 
48
  }
 
49
 
 
50
  void chdir(FmPath* path) {
 
51
    setCurrentPath(path);
 
52
  }
 
53
 
 
54
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
 
55
  void setIconSize(const QSize &size) {
 
56
      // The signal QAbstractItemView::iconSizeChanged is only available after Qt 5.5.
 
57
      // To simulate the effect for older Qt versions, we override setIconSize().
 
58
      QAbstractItemView::setIconSize(size);
 
59
      onIconSizeChanged(size);
 
60
  }
 
61
#endif
 
62
 
 
63
Q_SIGNALS:
 
64
  void chdirRequested(int type, FmPath* path);
 
65
 
 
66
protected Q_SLOTS:
 
67
  void onClicked(const QModelIndex & index);
 
68
  void onPressed(const QModelIndex & index);
 
69
  void onIconSizeChanged(const QSize & size);
 
70
  // void onMountOperationFinished(GError* error);
 
71
 
 
72
  void onOpenNewTab();
 
73
  void onOpenNewWindow();
 
74
 
 
75
  void onEmptyTrash();
 
76
 
 
77
  void onMountVolume();
 
78
  void onUnmountVolume();
 
79
  void onEjectVolume();
 
80
  void onUnmountMount();
 
81
 
 
82
  void onMoveBookmarkUp();
 
83
  void onMoveBookmarkDown();
 
84
  void onDeleteBookmark();
 
85
  void onRenameBookmark();
 
86
 
 
87
protected:
 
88
  void drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const {
 
89
    // override this method to inhibit drawing of the branch grid lines by Qt.
 
90
  }
 
91
 
 
92
  virtual void dragMoveEvent(QDragMoveEvent* event);
 
93
  virtual void dropEvent(QDropEvent* event);
 
94
  virtual void contextMenuEvent(QContextMenuEvent* event);
 
95
 
 
96
  virtual void commitData(QWidget * editor);
 
97
 
 
98
private:
 
99
  void onEjectButtonClicked(PlacesModelItem* item);
 
100
  void activateRow(int type, const QModelIndex& index);
 
101
 
 
102
private:
 
103
  PlacesModel* model_;
 
104
  FmPath* currentPath_;
 
105
};
 
106
 
 
107
}
 
108
 
 
109
#endif // FM_PLACESVIEW_H