]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphincontroller.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program 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 *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "dolphincontroller.h"
24 DolphinController::DolphinController(QObject
* parent
) :
26 m_showHiddenFiles(false),
28 m_zoomInPossible(false),
29 m_zoomOutPossible(false),
30 m_additionalInfoCount(0),
35 DolphinController::~DolphinController()
39 void DolphinController::setUrl(const KUrl
& url
)
47 void DolphinController::triggerUrlChangeRequest(const KUrl
& url
)
50 emit
requestUrlChange(url
);
54 void DolphinController::triggerContextMenuRequest(const QPoint
& pos
)
57 emit
requestContextMenu(pos
);
60 void DolphinController::requestActivation()
65 void DolphinController::indicateDroppedUrls(const KUrl::List
& urls
,
67 const QModelIndex
& destIndex
,
70 emit
urlsDropped(urls
, destPath
, destIndex
, source
);
74 void DolphinController::indicateSortingChange(DolphinView::Sorting sorting
)
76 emit
sortingChanged(sorting
);
79 void DolphinController::indicateSortOrderChange(Qt::SortOrder order
)
81 emit
sortOrderChanged(order
);
84 void DolphinController::setShowHiddenFiles(bool show
)
86 if (m_showHiddenFiles
!= show
) {
87 m_showHiddenFiles
= show
;
88 emit
showHiddenFilesChanged(show
);
92 void DolphinController::setShowPreview(bool show
)
94 if (m_showPreview
!= show
) {
96 emit
showPreviewChanged(show
);
100 void DolphinController::setAdditionalInfoCount(int count
)
102 if (m_additionalInfoCount
!= count
) {
103 m_additionalInfoCount
= count
;
104 emit
additionalInfoCountChanged(count
);
108 void DolphinController::indicateActivationChange(bool active
)
110 emit
activationChanged(active
);
113 void DolphinController::triggerZoomIn()
118 void DolphinController::triggerZoomOut()
123 void DolphinController::drawHoverIndication(QWidget
* widget
,
127 QPainter
painter(widget
);
129 QBrush
blendedBrush(brush
);
130 QColor color
= blendedBrush
.color();
132 blendedBrush
.setColor(color
);
134 const int radius
= 10;
135 QPainterPath
path(QPointF(bounds
.left(), bounds
.top() + radius
));
136 path
.quadTo(bounds
.left(), bounds
.top(), bounds
.left() + radius
, bounds
.top());
137 path
.lineTo(bounds
.right() - radius
, bounds
.top());
138 path
.quadTo(bounds
.right(), bounds
.top(), bounds
.right(), bounds
.top() + radius
);
139 path
.lineTo(bounds
.right(), bounds
.bottom() - radius
);
140 path
.quadTo(bounds
.right(), bounds
.bottom(), bounds
.right() - radius
, bounds
.bottom());
141 path
.lineTo(bounds
.left() + radius
, bounds
.bottom());
142 path
.quadTo(bounds
.left(), bounds
.bottom(), bounds
.left(), bounds
.bottom() - radius
);
145 painter
.setRenderHint(QPainter::Antialiasing
);
146 painter
.fillPath(path
, blendedBrush
);
150 void DolphinController::triggerItem(const KFileItem
& item
)
152 emit
itemTriggered(item
);
155 void DolphinController::emitItemEntered(const KFileItem
& item
)
157 emit
itemEntered(item
);
160 void DolphinController::emitViewportEntered()
162 emit
viewportEntered();
165 #include "dolphincontroller.moc"