Changeset View
Changeset View
Standalone View
Standalone View
krusader/DiskUsage/dufilelight.cpp
Show All 27 Lines | |||||
28 | #include <QInputDialog> | 28 | #include <QInputDialog> | ||
29 | #include <QMenu> | 29 | #include <QMenu> | ||
30 | 30 | | |||
31 | #include <KI18n/KLocalizedString> | 31 | #include <KI18n/KLocalizedString> | ||
32 | 32 | | |||
33 | #define SCHEME_POPUP_ID 6730 | 33 | #define SCHEME_POPUP_ID 6730 | ||
34 | 34 | | |||
35 | DUFilelight::DUFilelight(DiskUsage *usage) | 35 | DUFilelight::DUFilelight(DiskUsage *usage) | ||
36 | : RadialMap::Widget(usage), diskUsage(usage), currentDir(0), refreshNeeded(true) | 36 | : RadialMap::Widget(usage), diskUsage(usage), currentDir(nullptr), refreshNeeded(true) | ||
37 | { | 37 | { | ||
38 | // setFocusPolicy(Qt::StrongFocus); | 38 | // setFocusPolicy(Qt::StrongFocus); | ||
39 | 39 | | |||
40 | connect(diskUsage, SIGNAL(enteringDirectory(Directory*)), this, SLOT(slotDirChanged(Directory*))); | 40 | connect(diskUsage, SIGNAL(enteringDirectory(Directory*)), this, SLOT(slotDirChanged(Directory*))); | ||
41 | connect(diskUsage, SIGNAL(clearing()), this, SLOT(clear())); | 41 | connect(diskUsage, SIGNAL(clearing()), this, SLOT(clear())); | ||
42 | connect(diskUsage, SIGNAL(changed(File*)), this, SLOT(slotChanged(File*))); | 42 | connect(diskUsage, SIGNAL(changed(File*)), this, SLOT(slotChanged(File*))); | ||
43 | connect(diskUsage, SIGNAL(deleted(File*)), this, SLOT(slotChanged(File*))); | 43 | connect(diskUsage, SIGNAL(deleted(File*)), this, SLOT(slotChanged(File*))); | ||
44 | connect(diskUsage, SIGNAL(changeFinished()), this, SLOT(slotRefresh())); | 44 | connect(diskUsage, SIGNAL(changeFinished()), this, SLOT(slotRefresh())); | ||
Show All 13 Lines | 54 | if (currentDir != dir) { | |||
58 | create(dir); | 58 | create(dir); | ||
59 | refreshNeeded = false; | 59 | refreshNeeded = false; | ||
60 | } | 60 | } | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | void DUFilelight::clear() | 63 | void DUFilelight::clear() | ||
64 | { | 64 | { | ||
65 | invalidate(false); | 65 | invalidate(false); | ||
66 | currentDir = 0; | 66 | currentDir = nullptr; | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | File * DUFilelight::getCurrentFile() | 69 | File * DUFilelight::getCurrentFile() | ||
70 | { | 70 | { | ||
71 | const RadialMap::Segment * focus = focusSegment(); | 71 | const RadialMap::Segment * focus = focusSegment(); | ||
72 | 72 | | |||
73 | if (!focus || focus->isFake() || focus->file() == currentDir) | 73 | if (!focus || focus->isFake() || focus->file() == currentDir) | ||
74 | return 0; | 74 | return nullptr; | ||
75 | 75 | | |||
76 | return (File *)focus->file(); | 76 | return (File *)focus->file(); | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | void DUFilelight::mousePressEvent(QMouseEvent *event) | 79 | void DUFilelight::mousePressEvent(QMouseEvent *event) | ||
80 | { | 80 | { | ||
81 | if (event->button() == Qt::RightButton) { | 81 | if (event->button() == Qt::RightButton) { | ||
82 | File * file = 0; | 82 | File * file = nullptr; | ||
83 | 83 | | |||
84 | const RadialMap::Segment * focus = focusSegment(); | 84 | const RadialMap::Segment * focus = focusSegment(); | ||
85 | 85 | | |||
86 | if (focus && !focus->isFake() && focus->file() != currentDir) | 86 | if (focus && !focus->isFake() && focus->file() != currentDir) | ||
87 | file = (File *)focus->file(); | 87 | file = (File *)focus->file(); | ||
88 | 88 | | |||
89 | QMenu filelightPopup; | 89 | QMenu filelightPopup; | ||
90 | filelightPopup.addAction(i18n("Zoom In"), this, SLOT(zoomIn()), Qt::Key_Plus); | 90 | filelightPopup.addAction(i18n("Zoom In"), this, SLOT(zoomIn()), Qt::Key_Plus); | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 182 | { | |||
193 | } | 193 | } | ||
194 | } | 194 | } | ||
195 | 195 | | |||
196 | void DUFilelight::slotAboutToShow(int ndx) | 196 | void DUFilelight::slotAboutToShow(int ndx) | ||
197 | { | 197 | { | ||
198 | QWidget *widget = diskUsage->widget(ndx); | 198 | QWidget *widget = diskUsage->widget(ndx); | ||
199 | if (widget == this && (diskUsage->getCurrentDir() != currentDir || refreshNeeded)) { | 199 | if (widget == this && (diskUsage->getCurrentDir() != currentDir || refreshNeeded)) { | ||
200 | refreshNeeded = false; | 200 | refreshNeeded = false; | ||
201 | if ((currentDir = diskUsage->getCurrentDir()) != 0) { | 201 | if ((currentDir = diskUsage->getCurrentDir()) != nullptr) { | ||
202 | invalidate(false); | 202 | invalidate(false); | ||
203 | create(currentDir); | 203 | create(currentDir); | ||
204 | } | 204 | } | ||
205 | } | 205 | } | ||
206 | } | 206 | } | ||
207 | 207 | | |||
208 | void DUFilelight::slotRefresh() | 208 | void DUFilelight::slotRefresh() | ||
209 | { | 209 | { | ||
Show All 16 Lines |