Whitespace cleanups and documentation fixes

This commit is contained in:
Peter Penz 2012-02-23 17:26:51 +01:00
parent a6627b9f23
commit 21a5a890b3
30 changed files with 214 additions and 128 deletions

View file

@ -1120,7 +1120,7 @@ void DolphinMainWindow::editSettings()
if (!m_settingsDialog) {
DolphinViewContainer* container = activeViewContainer();
container->view()->writeSettings();
const KUrl url = container->url();
DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));

View file

@ -277,7 +277,7 @@ Name[it]=Dettagli
Name[ja]=
Name[ka]=
Name[kk]=Егжей-тегжейі
Name[km]=
Name[km]=
Name[kn]=ಿ
Name[ko]=
Name[ku]=Kitekit

View file

@ -548,7 +548,7 @@ void KFileItemListWidget::updatePixmapCache()
}
m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize));
// Prepare the pixmap that is used when the item gets hovered
if (isHovered()) {
m_hoverPixmap = m_pixmap;

View file

@ -79,7 +79,7 @@ protected:
void setOverlay(const QPixmap& overlay);
QPixmap overlay() const;
virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>());
virtual void visibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous);
virtual void visibleRolesSizesChanged(const QHash<QByteArray, QSizeF>& current, const QHash<QByteArray, QSizeF>& previous);
@ -116,7 +116,7 @@ private:
void updateIconsLayoutTextCache();
void updateCompactLayoutTextCache();
void updateDetailsLayoutTextCache();
void updateAdditionalInfoTextColor();
void drawPixmap(QPainter* painter, const QPixmap& pixmap);

View file

@ -85,7 +85,7 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
m_maximumUpdateIntervalTimer->setInterval(2000);
m_maximumUpdateIntervalTimer->setSingleShot(true);
connect(m_maximumUpdateIntervalTimer, SIGNAL(timeout()), this, SLOT(dispatchPendingItemsToInsert()));
// When changing the value of an item which represents the sort-role a resorting must be
// triggered. Especially in combination with KFileItemModelRolesUpdater this might be done
// for a lot of items within a quite small timeslot. To prevent expensive resortings the
@ -96,7 +96,7 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
connect(m_resortAllItemsTimer, SIGNAL(timeout()), this, SLOT(resortAllItems()));
Q_ASSERT(m_minimumUpdateIntervalTimer->interval() <= m_maximumUpdateIntervalTimer->interval());
connect(KGlobalSettings::self(), SIGNAL(naturalSortingChanged()), this, SLOT(slotNaturalSortingChanged()));
}
@ -151,7 +151,7 @@ bool KFileItemModel::setData(int index, const QHash<QByteArray, QVariant>& value
if (changedRoles.contains(sortRole())) {
m_resortAllItemsTimer->start();
}
return true;
}
@ -595,13 +595,13 @@ void KFileItemModel::onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder pre
{
Q_UNUSED(current);
Q_UNUSED(previous);
resortAllItems();
resortAllItems();
}
void KFileItemModel::resortAllItems()
{
m_resortAllItemsTimer->stop();
const int itemCount = count();
if (itemCount <= 0) {
return;
@ -622,23 +622,23 @@ void KFileItemModel::resortAllItems()
foreach (const ItemData* itemData, m_itemData) {
oldUrls.append(itemData->item.url());
}
m_groups.clear();
m_items.clear();
// Resort the items
sort(m_itemData.begin(), m_itemData.end());
sort(m_itemData.begin(), m_itemData.end());
for (int i = 0; i < itemCount; ++i) {
m_items.insert(m_itemData.at(i)->item.url(), i);
}
// Determine the indexes that have been moved
QList<int> movedToIndexes;
movedToIndexes.reserve(itemCount);
for (int i = 0; i < itemCount; i++) {
const int newIndex = m_items.value(oldUrls.at(i).url());
movedToIndexes.append(newIndex);
}
}
// Don't check whether items have really been moved and always emit a
// itemsMoved() signal after resorting: In case of grouped items
@ -646,10 +646,10 @@ void KFileItemModel::resortAllItems()
// position. Let the receiver of the signal decide whether a check for moved
// items makes sense.
emit itemsMoved(KItemRange(0, itemCount), movedToIndexes);
#ifdef KFILEITEMMODEL_DEBUG
kDebug() << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed();
#endif
#endif
}
void KFileItemModel::slotCompleted()
@ -941,7 +941,7 @@ void KFileItemModel::insertItems(const KFileItemList& items)
// Insert item at the position targetIndex by transfering
// the ownership of the item-data from sortedItems to m_itemData.
// m_items will be inserted after the loop (see comment below)
m_itemData.insert(targetIndex, sortedItems.at(sourceIndex));
m_itemData.insert(targetIndex, sortedItems.at(sourceIndex));
++insertedCount;
if (insertedAtIndex < 0) {
@ -999,7 +999,7 @@ void KFileItemModel::removeItems(const KFileItemList& items)
int targetIndex = 0;
foreach (const ItemData* itemData, sortedItems) {
const KFileItem& itemToRemove = itemData->item;
const int previousTargetIndex = targetIndex;
while (targetIndex < m_itemData.count()) {
if (m_itemData.at(targetIndex)->item.url() == itemToRemove.url()) {
@ -1078,7 +1078,7 @@ QList<KFileItemModel::ItemData*> KFileItemModel::createItemDataList(const KFileI
itemDataList.append(itemData);
}
return itemDataList;
}
@ -1159,7 +1159,7 @@ QByteArray KFileItemModel::roleByteArray(Role role) const
}
QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item) const
{
{
// It is important to insert only roles that are fast to retrieve. E.g.
// KFileItem::iconName() can be very expensive if the MIME-type is unknown
// and hence will be retrieved asynchronously by KFileItemModelRolesUpdater.
@ -1307,7 +1307,7 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
case NameRole:
// The name role is handled as default fallback after the switch
break;
case SizeRole: {
if (itemA.isDir()) {
// See "if (m_sortFoldersFirst || m_sortRole == SizeRole)" in KFileItemModel::lessThan():
@ -1350,12 +1350,12 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
}
break;
}
case RatingRole: {
result = a->values.value("rating").toInt() - b->values.value("rating").toInt();
break;
}
case PermissionsRole:
case OwnerRole:
case GroupRole:
@ -1369,7 +1369,7 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
b->values.value(role).toString());
break;
}
default:
break;
}
@ -1400,16 +1400,16 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
void KFileItemModel::sort(QList<ItemData*>::iterator begin,
QList<ItemData*>::iterator end)
{
{
// The implementation is based on qStableSortHelper() from qalgorithms.h
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
// In opposite to qStableSort() it allows to use a member-function for the comparison of elements.
const int span = end - begin;
if (span < 2) {
return;
}
const QList<ItemData*>::iterator middle = begin + span / 2;
sort(begin, middle);
sort(middle, end);
@ -1422,21 +1422,21 @@ void KFileItemModel::merge(QList<ItemData*>::iterator begin,
{
// The implementation is based on qMerge() from qalgorithms.h
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
const int len1 = pivot - begin;
const int len2 = end - pivot;
if (len1 == 0 || len2 == 0) {
return;
}
if (len1 + len2 == 2) {
if (lessThan(*(begin + 1), *(begin))) {
qSwap(*begin, *(begin + 1));
}
return;
}
QList<ItemData*>::iterator firstCut;
QList<ItemData*>::iterator secondCut;
int len2Half;
@ -1450,11 +1450,11 @@ void KFileItemModel::merge(QList<ItemData*>::iterator begin,
secondCut = pivot + len2Half;
firstCut = upperBound(begin, pivot, *secondCut);
}
reverse(firstCut, pivot);
reverse(pivot, secondCut);
reverse(firstCut, secondCut);
const QList<ItemData*>::iterator newPivot = firstCut + len2Half;
merge(begin, firstCut, newPivot);
merge(newPivot, secondCut, end);
@ -1466,7 +1466,7 @@ QList<KFileItemModel::ItemData*>::iterator KFileItemModel::lowerBound(QList<Item
{
// The implementation is based on qLowerBound() from qalgorithms.h
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
QList<ItemData*>::iterator middle;
int n = int(end - begin);
int half;
@ -1490,7 +1490,7 @@ QList<KFileItemModel::ItemData*>::iterator KFileItemModel::upperBound(QList<Item
{
// The implementation is based on qUpperBound() from qalgorithms.h
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
QList<ItemData*>::iterator middle;
int n = end - begin;
int half;
@ -1513,11 +1513,11 @@ void KFileItemModel::reverse(QList<ItemData*>::iterator begin,
{
// The implementation is based on qReverse() from qalgorithms.h
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
--end;
while (begin < end) {
qSwap(*begin++, *end--);
}
}
}
int KFileItemModel::stringCompare(const QString& a, const QString& b) const

View file

@ -179,7 +179,7 @@ private slots:
* and foldersFirst() settings.
*/
void resortAllItems();
void slotCompleted();
void slotCanceled();
void slotNewItems(const KFileItemList& items);
@ -219,10 +219,10 @@ private:
QHash<QByteArray, QVariant> values;
ItemData* parent;
};
void insertItems(const KFileItemList& items);
void removeItems(const KFileItemList& items);
/**
* Helper method for insertItems() and removeItems(): Creates
* a list of ItemData elements based on the given items.
@ -243,7 +243,7 @@ private:
* Runtime complexity is O(1).
*/
Role roleIndex(const QByteArray& role) const;
/**
* @return Role-byte-array for the given role-index.
* Runtime complexity is O(1).
@ -251,7 +251,7 @@ private:
QByteArray roleByteArray(Role role) const;
QHash<QByteArray, QVariant> retrieveData(const KFileItem& item) const;
/**
* @return True if the item-data \a a should be ordered before the item-data
* \b. The item-data may have different parent-items.
@ -264,14 +264,14 @@ private:
* have the same parent item, otherwise the comparison will be wrong.
*/
int sortRoleCompare(const ItemData* a, const ItemData* b) const;
/**
* Sorts the items by using lessThan() as comparison criteria.
* The merge sort algorithm is used to assure a worst-case
* of O(n * log(n)) and to keep the number of comparisons low.
*/
void sort(QList<ItemData*>::iterator begin, QList<ItemData*>::iterator end);
/** Helper method for sort(). */
void merge(QList<ItemData*>::iterator begin,
QList<ItemData*>::iterator pivot,
@ -281,14 +281,14 @@ private:
QList<ItemData*>::iterator lowerBound(QList<ItemData*>::iterator begin,
QList<ItemData*>::iterator end,
const ItemData* value);
/** Helper method for sort(). */
QList<ItemData*>::iterator upperBound(QList<ItemData*>::iterator begin,
QList<ItemData*>::iterator end,
const ItemData* value);
/** Helper method for sort(). */
void reverse(QList<ItemData*>::iterator begin, QList<ItemData*>::iterator end);
int stringCompare(const QString& a, const QString& b) const;
/**
@ -340,7 +340,7 @@ private:
Role m_sortRole;
QSet<QByteArray> m_roles;
Qt::CaseSensitivity m_caseSensitivity;
QList<ItemData*> m_itemData;
QHash<KUrl, int> m_items; // Allows O(1) access for KFileItemModel::index(const KFileItem& item)

View file

@ -251,7 +251,7 @@ void KFileItemModelRolesUpdater::slotItemsRemoved(const KItemRangeList& itemRang
{
Q_UNUSED(itemRanges);
m_firstVisibleIndex = 0;
m_lastVisibleIndex = -1;
m_lastVisibleIndex = -1;
if (!hasPendingRoles()) {
return;
}

View file

@ -202,7 +202,7 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
default: break;
}
}
const bool selectSingleItem = m_selectionBehavior != NoSelection &&
itemCount == 1 &&
(key == Qt::Key_Home || key == Qt::Key_End ||

View file

@ -135,9 +135,9 @@ void KItemListGroupHeader::paint(QPainter* painter, const QStyleOptionGraphicsIt
// No top- or left-line should be drawn for the first group-header
return;
}
painter->setPen(m_lineColor);
if (m_scrollOrientation == Qt::Horizontal) {
painter->drawLine(0, 0, 0, size().height() - 1);
} else {
@ -209,7 +209,7 @@ void KItemListGroupHeader::updateCache()
const QFontMetrics fontMetrics(m_styleOption.font);
const qreal roleHeight = fontMetrics.height();
const int y = (m_scrollOrientation == Qt::Vertical) ? padding : horizontalMargin;
m_roleBounds = QRectF(horizontalMargin + padding,

View file

@ -360,7 +360,7 @@ void KItemListView::setStyleOption(const KItemListStyleOption& option)
const KItemListStyleOption previousOption = m_styleOption;
m_styleOption = option;
bool animate = true;
bool animate = true;
const QSizeF margin(option.horizontalMargin, option.verticalMargin);
if (margin != m_layouter->itemMargin()) {
// Skip animations when the number of rows or columns
@ -382,7 +382,7 @@ void KItemListView::setStyleOption(const KItemListStyleOption& option)
it.value()->setStyleOption(option);
}
m_sizeHintResolver->clearCache();
m_sizeHintResolver->clearCache();
doLayout(animate ? Animation : NoAnimation);
onStyleOptionChanged(option, previousOption);
@ -408,10 +408,10 @@ void KItemListView::setGeometry(const QRectF& rect)
// update of the visible-roles sizes, only the stretched sizes
// need to be adjusted to the new size.
updateStretchedVisibleRolesSizes();
if (m_useHeaderWidths) {
QSizeF dynamicItemSize = m_layouter->itemSize();
if (m_itemSize.width() < 0) {
const qreal requiredWidth = visibleRolesSizesWidthSum();
if (newSize.width() > requiredWidth) {
@ -420,7 +420,7 @@ void KItemListView::setGeometry(const QRectF& rect)
const qreal headerWidth = qMax(newSize.width(), requiredWidth);
m_header->resize(headerWidth, m_header->size().height());
}
if (m_itemSize.height() < 0) {
const qreal requiredHeight = visibleRolesSizesHeightSum();
if (newSize.height() > requiredHeight) {
@ -428,10 +428,10 @@ void KItemListView::setGeometry(const QRectF& rect)
}
// TODO: KItemListHeader is not prepared for vertical alignment
}
m_layouter->setItemSize(dynamicItemSize);
}
// Triggering a synchronous layout is fine from a performance point of view,
// as with dynamic item sizes no moving animation must be done.
m_layouter->setSize(newSize);
@ -439,9 +439,9 @@ void KItemListView::setGeometry(const QRectF& rect)
} else {
const bool animate = !changesItemGridLayout(newSize,
m_layouter->itemSize(),
m_layouter->itemMargin());
m_layouter->itemMargin());
m_layouter->setSize(newSize);
if (animate) {
// Trigger an asynchronous relayout with m_layoutTimer to prevent
// performance bottlenecks. If the timer is exceeded, an animated layout
@ -1352,7 +1352,7 @@ void KItemListView::setModel(KItemModelBase* model)
}
m_model = model;
m_layouter->setModel(model);
m_layouter->setModel(model);
m_grouped = model->groupedSorting();
if (m_model) {
@ -1584,7 +1584,7 @@ QList<int> KItemListView::recycleInvisibleItems(int firstVisibleIndex,
} else {
widget->setVisible(false);
items.append(index);
if (m_grouped) {
recycleGroupHeaderForWidget(widget);
}
@ -1600,7 +1600,7 @@ bool KItemListView::moveWidget(KItemListWidget* widget,const QPointF& newPos)
if (widget->pos() == newPos) {
return false;
}
bool startMovingAnim = false;
// When having a grid the moving-animation should only be started, if it is done within
@ -2040,11 +2040,11 @@ QRectF KItemListView::headerBoundaries() const
bool KItemListView::changesItemGridLayout(const QSizeF& newGridSize,
const QSizeF& newItemSize,
const QSizeF& newItemMargin) const
{
{
if (newItemSize.isEmpty() || newGridSize.isEmpty()) {
return false;
}
if (m_layouter->scrollOrientation() == Qt::Vertical) {
const qreal itemWidth = m_layouter->itemSize().width();
if (itemWidth > 0) {
@ -2057,7 +2057,7 @@ bool KItemListView::changesItemGridLayout(const QSizeF& newGridSize,
m_layouter->itemMargin().width());
return oldColumnCount != newColumnCount;
}
}
}
} else {
const qreal itemHeight = m_layouter->itemSize().height();
if (itemHeight > 0) {
@ -2070,9 +2070,9 @@ bool KItemListView::changesItemGridLayout(const QSizeF& newGridSize,
m_layouter->itemMargin().height());
return oldRowCount != newRowCount;
}
}
}
}
return false;
}
@ -2081,7 +2081,7 @@ bool KItemListView::animateChangedItemCount(int changedItemCount) const
if (m_layouter->size().isEmpty() || m_layouter->itemSize().isEmpty()) {
return false;
}
const int maximum = (scrollOrientation() == Qt::Vertical)
? m_layouter->size().width() / m_layouter->itemSize().width()
: m_layouter->size().height() / m_layouter->itemSize().height();
@ -2106,7 +2106,7 @@ void KItemListView::updateGroupHeaderHeight()
{
qreal groupHeaderHeight = m_styleOption.fontMetrics.height();
qreal groupHeaderMargin = 0;
if (scrollOrientation() == Qt::Horizontal) {
// The vertical margin above and below the header should be
// equal to the horizontal margin, not the vertical margin

View file

@ -72,18 +72,33 @@ public:
KItemListView(QGraphicsWidget* parent = 0);
virtual ~KItemListView();
/**
* If the scroll-orientation is vertical, the items are ordered
* from top to bottom (= default setting). If the scroll-orientation
* is horizontal, the items are ordered from left to right.
*/
void setScrollOrientation(Qt::Orientation orientation);
Qt::Orientation scrollOrientation() const;
void setItemSize(const QSizeF& size);
QSizeF itemSize() const;
// TODO: add note that offset is not checked against maximumOffset, only against 0.
/**
* Offset of the scrollbar that represents the scroll-orientation
* (see setScrollOrientation()).
*/
void setScrollOffset(qreal offset);
qreal scrollOffset() const;
qreal maximumScrollOffset() const;
/**
* Offset related to an item, that does not fit into the available
* size of the listview. If the scroll-orientation is vertical
* the item-offset describes the offset of the horizontal axe, if
* the scroll-orientation is horizontal the item-offset describes
* the offset of the vertical axe.
*/
void setItemOffset(qreal scrollOffset);
qreal itemOffset() const;
@ -116,7 +131,7 @@ public:
/**
* @return Model of the item-list. The model gets
* initialized by KItemListController::setView() and will
* initialized by KItemListController::setModel() and will
* result in calling KItemListController::onModelChanged().
*/
KItemModelBase* model() const;
@ -145,11 +160,27 @@ public:
/** @reimp */
virtual void setGeometry(const QRectF& rect);
/**
* @return Index of the item that is below the point \a pos.
* The position is relative to the upper right of
* the visible area. Only (at least partly) visible
* items are considered. -1 is returned if no item is
* below the position.
*/
int itemAt(const QPointF& pos) const;
bool isAboveSelectionToggle(int index, const QPointF& pos) const;
bool isAboveExpansionToggle(int index, const QPointF& pos) const;
/**
* @return Index of the first item that is at least partly visible.
* -1 is returned if the model contains no items.
*/
int firstVisibleIndex() const;
/**
* @return Index of the last item that is at least partly visible.
* -1 is returned if the model contains no items.
*/
int lastVisibleIndex() const;
/**
@ -162,17 +193,20 @@ public:
/**
* @param itemRanges Items that must be checked for getting the visible roles sizes.
* @return The size of each visible role in case if KItemListView::itemSize()
* is empty. This allows to have dynamic but equal role sizes between
* all items. Per default an empty hash is returned.
* @return The size of each visible role in case if KItemListView::itemSize()
* is empty. This allows to have dynamic but equal role sizes between
* all items, like used in the classic "table-views". Per default an
* empty hash is returned.
*/
virtual QHash<QByteArray, QSizeF> visibleRolesSizes(const KItemRangeList& itemRanges) const;
/**
* @return True if the view supports the expanding of items. Per default false
* is returned. If expanding of items is supported, the methods
* KItemModelBase::setExpanded(), KItemModelBase::isExpanded() and
* KItemModelBase::isExpandable() must be reimplemented. The view-implementation
* @return True if the view supports the expanding of items. Per default
* false is returned. If expanding of items is supported
* (see setSupportsItemExpanding()),the methods
* KItemModelBase::setExpanded(), KItemModelBase::isExpanded(),
* KItemModelBase::isExpandable() and KItemModelBase::expandedParentsCount()
* must be reimplemented. The view-implementation
* has to take care itself how to visually represent the expanded items provided
* by the model.
*/
@ -220,7 +254,8 @@ public:
/**
* Turns on the header if \p show is true. Per default the
* header is not shown.
* header is not shown. Usually the header is turned on when
* showing a classic "table-view" to describe the shown columns.
*/
void setHeaderShown(bool show);
bool isHeaderShown() const;
@ -506,7 +541,7 @@ private:
* if no header is shown.
*/
QRectF headerBoundaries() const;
/**
* @return True if the number of columns or rows will be changed when applying
* the new grid- and item-size. Used to determine whether an animation
@ -515,7 +550,7 @@ private:
bool changesItemGridLayout(const QSizeF& newGridSize,
const QSizeF& newItemSize,
const QSizeF& newItemMargin) const;
/**
* @param changedItemCount Number of inserted or removed items.
* @return True if the inserting or removing of items should be animated.
@ -564,7 +599,7 @@ private:
* value != 0 will be returned.
*/
static int calculateAutoScrollingIncrement(int pos, int range, int oldInc);
/**
* Helper functions for changesItemCount().
* @return The number of items that fit into the available size by

View file

@ -31,6 +31,12 @@ class QGraphicsWidget;
class QPointF;
class QPropertyAnimation;
/**
* @brief Internal helper class for KItemListView to animate the items.
*
* Supports item animations for moving, creating, deleting and resizing
* an item. Several applications can be applied to one item in parallel.
*/
class LIBDOLPHINPRIVATE_EXPORT KItemListViewAnimation : public QObject
{
Q_OBJECT
@ -52,12 +58,32 @@ public:
void setScrollOffset(qreal scrollOffset);
qreal scrollOffset() const;
/**
* Starts the animation of the type \a type for the widget \a widget. If an animation
* of the type is already running, this animation will be stopped before starting
* the new animation.
*/
void start(QGraphicsWidget* widget, AnimationType type, const QVariant& endValue = QVariant());
/**
* Stops the animation of the type \a type for the widget \a widget.
*/
void stop(QGraphicsWidget* widget, AnimationType type);
/**
* Stops all animations that have been applied to the widget \a widget.
*/
void stop(QGraphicsWidget* widget);
/**
* @return True if the animation of the type \a type has been started
* for the widget \a widget..
*/
bool isStarted(QGraphicsWidget *widget, AnimationType type) const;
/**
* @return True if any animation has been started for the widget.
*/
bool isStarted(QGraphicsWidget* widget) const;
signals:

View file

@ -265,7 +265,7 @@ QRectF KItemListViewLayouter::groupHeaderRect(int index) const
} else {
pos.rx() -= m_itemMargin.width();
pos.ry() = 0;
// Determine the maximum width used in the
// current column. As the scroll-direction is
// Qt::Horizontal and m_itemRects is accessed directly,
@ -278,14 +278,14 @@ QRectF KItemListViewLayouter::groupHeaderRect(int index) const
if (bounds.y() != y) {
break;
}
if (bounds.height() > width) {
width = bounds.height();
}
++index;
++index;
}
size = QSizeF(width, m_size.height());
}
return QRectF(pos, size);
@ -300,7 +300,7 @@ int KItemListViewLayouter::itemColumn(int index) const
return (m_scrollOrientation == Qt::Vertical)
? m_itemInfos[index].column
: m_itemInfos[index].row;
: m_itemInfos[index].row;
}
int KItemListViewLayouter::itemRow(int index) const
@ -312,7 +312,7 @@ int KItemListViewLayouter::itemRow(int index) const
return (m_scrollOrientation == Qt::Vertical)
? m_itemInfos[index].row
: m_itemInfos[index].column;
: m_itemInfos[index].column;
}
int KItemListViewLayouter::maximumVisibleItems() const
@ -360,7 +360,7 @@ void KItemListViewLayouter::doLayout()
QSizeF itemSize = m_itemSize;
QSizeF itemMargin = m_itemMargin;
QSizeF size = m_size;
const bool grouped = createGroupHeaders();
const bool horizontalScrolling = (m_scrollOrientation == Qt::Horizontal);
@ -373,7 +373,7 @@ void KItemListViewLayouter::doLayout()
itemMargin.setHeight(m_itemMargin.width());
size.setWidth(m_size.height());
size.setHeight(m_size.width());
if (grouped) {
// In the horizontal scrolling case all groups are aligned
// at the top, which decreases the available height. For the
@ -501,7 +501,7 @@ void KItemListViewLayouter::doLayout()
m_itemInfos.erase(m_itemInfos.begin() + itemCount,
m_itemInfos.end());
}
if (itemCount > 0) {
// Calculate the maximum y-range of the last row for m_maximumScrollOffset
m_maximumScrollOffset = m_itemInfos.last().rect.bottom();

View file

@ -30,6 +30,20 @@
class KItemModelBase;
class KItemListSizeHintResolver;
/**
* @brief Internal helper class for KItemListView to layout the items.
*
* The layouter is capable to align the items within a grid. If the
* scroll-direction is horizontal the column-width of the grid can be
* variable. If the scroll-direction is vertical the row-height of
* the grid can be variable.
*
* The layouter is implemented in a way that it postpones the expensive
* layout operation until a property is read the first time after
* marking the layouter as dirty (see markAsDirty()). This means that
* changing properties of the layouter is not expensive, only the
* first read of a property can get expensive.
*/
class LIBDOLPHINPRIVATE_EXPORT KItemListViewLayouter : public QObject
{
Q_OBJECT
@ -52,7 +66,7 @@ public:
*/
void setItemMargin(const QSizeF& margin);
QSizeF itemMargin() const;
/**
* Sets the height of the header that is always aligned
* at the top. A height of <= 0.0 means that no header is
@ -74,7 +88,7 @@ public:
*/
void setGroupHeaderMargin(qreal margin);
qreal groupHeaderMargin() const;
void setScrollOffset(qreal scrollOffset);
qreal scrollOffset() const;
@ -111,14 +125,21 @@ public:
*/
QRectF itemRect(int index) const;
/**
* @return Rectangle of the group header for the item with the
* index \a index. Note that the layouter does not check
* whether the item really has a header: Usually only
* the first item of a group gets a header (see
* isFirstGroupItem()).
*/
QRectF groupHeaderRect(int index) const;
/**
* @return Column of the item with the index \a index.
* -1 is returned if an invalid index is given.
*/
int itemColumn(int index) const;
/**
* @return Row of the item with the index \a index.
* -1 is returned if an invalid index is given.
@ -137,6 +158,10 @@ public:
*/
bool isFirstGroupItem(int itemIndex) const;
/**
* Marks the layouter as dirty. This means as soon as a property of
* the layouter gets read, an expensive relayout will be done.
*/
void markAsDirty();
#ifndef QT_NO_DEBUG
@ -172,7 +197,7 @@ private:
QSizeF m_itemSize;
QSizeF m_itemMargin;
qreal m_headerHeight;
qreal m_headerHeight;
const KItemModelBase* m_model;
const KItemListSizeHintResolver* m_sizeHintResolver;

View file

@ -247,7 +247,7 @@ void KItemListWidget::setHovered(bool hovered)
if (!m_hoverAnimation) {
m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
m_hoverAnimation->setDuration(duration);
connect(m_hoverAnimation, SIGNAL(finished()), this, SLOT(slotHoverAnimationFinished()));
}

View file

@ -140,7 +140,7 @@ protected:
virtual void hoveredChanged(bool hovered);
virtual void alternateBackgroundChanged(bool enabled);
virtual void siblingsInformationChanged(const QBitArray& current, const QBitArray& previous);
virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
/**
* @return The current opacity of the hover-animation. When implementing a custom painting-code for a hover-state

View file

@ -45,7 +45,7 @@ typedef QList<KItemRange> KItemRangeList;
/**
* @brief Base class for model implementations used by KItemListView and KItemListController.
*
* A item-model consists of a variable number of items. The number of items
* An item-model consists of a variable number of items. The number of items
* is given by KItemModelBase::count(). The data of an item is accessed by a unique index
* with KItemModelBase::data(). The indexes are integer-values counting from 0 to the
* KItemModelBase::count() - 1.
@ -55,7 +55,7 @@ typedef QList<KItemRange> KItemRangeList;
* A model can optionally provide sorting- and grouping-capabilities.
*
* Also optionally it is possible to provide a tree of items by implementing the methods
* setExpanded(), isExpanded() and isExpandable().
* setExpanded(), isExpanded(), isExpandable() and expandedParentsCount().
*/
class LIBDOLPHINPRIVATE_EXPORT KItemModelBase : public QObject
{

View file

@ -122,7 +122,7 @@ void TreeViewContextMenu::open()
// in KItemViews or manually as part of the FoldersPanel
//popup->addAction(autoScrollingAction);
connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool)));
if (!m_fileItem.isNull()) {
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
@ -132,7 +132,7 @@ void TreeViewContextMenu::open()
}
QList<QAction*> customActions = m_parent->customContextMenuActions();
if (!customActions.isEmpty()) {
if (!customActions.isEmpty()) {
popup->addSeparator();
foreach (QAction* action, customActions) {
popup->addAction(action);

View file

@ -183,7 +183,7 @@ Name[id]=Umum
Name[is]=Almennt
Name[it]=Generale
Name[ja]=
Name[ka]=
Name[ka]=
Name[kk]=Жалпы
Name[km]=
Name[kn]=

View file

@ -121,7 +121,7 @@ Comment[pt]=Este serviço permite-lhe configurar a navegação do Dolphin.
Comment[pt_BR]=Este serviço permite configurar a navegação do Dolphin.
Comment[ro]=Acest serviciu permite configurarea navigării Dolphin.
Comment[ru]=Эта служба позволяет настраивать навигацию в Dolphin
Comment[si]= Dolphin .
Comment[si]= Dolphin .
Comment[sk]=Táto služba umožňuje nastavenie navigácie v Dolphine.
Comment[sl]=Ta storitev omogoča spreminjanje nastavitev krmarjenja programa Dolphin.
Comment[sr]=Овај сервис омогућава подешавање навигације у Делфину.

View file

@ -119,7 +119,7 @@ Comment[pt]=Este serviço permite-lhe configurar os modos de visualização do D
Comment[pt_BR]=Este serviço permite configurar os modos de exibição do Dolphin.
Comment[ro]=Acest serviciu permite configurarea regimurilor de vizualizare Dolphin.
Comment[ru]=Эта служба позволяет настраивать режимы просмотра папок в Dolphin
Comment[si]= Dolphin .
Comment[si]= Dolphin .
Comment[sk]=Táto služba umožňuje nastavenie režimov zobrazenia Dolphinu.
Comment[sl]=Ta storitev omogoča spreminjanje nastavitev načinov pogleda programa Dolphin.
Comment[sr]=Овај сервис омогућава подешавање Делфинових режима приказа.

View file

@ -157,7 +157,7 @@ void ViewSettingsTab::loadSettings()
ViewModeSettings settings(viewMode());
settings.readConfig();
const QSize iconSize(settings.iconSize(), settings.iconSize());
m_defaultSizeSlider->setValue(ZoomLevelInfo::zoomLevelForIconSize(iconSize));

View file

@ -271,7 +271,7 @@ void KFileItemModelTest::testSetDataWithModifiedSortRole()
if (expectMoveSignal) {
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)), DefaultTimeout));
}
QCOMPARE(m_model->data(0).value("rating").toInt(), ratingIndex0);
QCOMPARE(m_model->data(1).value("rating").toInt(), ratingIndex1);
QCOMPARE(m_model->data(2).value("rating").toInt(), ratingIndex2);

View file

@ -331,7 +331,7 @@ Q_DECLARE_METATYPE(QList<int>);
* The following function provides a generic way to test the selection functionality.
*
* The test is data-driven and takes the following arguments:
*
*
* \param initialSelection The selection at the beginning.
* \param anchor This item will be the anchor item.
* \param current This item will be the current item.

View file

@ -48,7 +48,7 @@ DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister,
controller()->setModel(new KFileItemModel(dirLister, this));
m_fileItemListView = new KFileItemListView();
m_fileItemListView->setWidgetCreator(new KItemListWidgetCreator<DolphinFileItemListWidget>());
m_fileItemListView->setWidgetCreator(new KItemListWidgetCreator<DolphinFileItemListWidget>());
m_fileItemListView->setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
controller()->setView(m_fileItemListView);
@ -60,7 +60,7 @@ DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister,
DolphinItemListContainer::~DolphinItemListContainer()
{
writeSettings();
controller()->setView(0);
delete m_fileItemListView;
m_fileItemListView = 0;
@ -191,7 +191,7 @@ void DolphinItemListContainer::readSettings()
}
void DolphinItemListContainer::writeSettings()
{
{
IconsModeSettings::self()->writeConfig();
CompactModeSettings::self()->writeConfig();
DetailsModeSettings::self()->writeConfig();
@ -217,7 +217,7 @@ void DolphinItemListContainer::updateGridSize()
case KFileItemListView::IconsLayout: {
const int minItemWidth = 48;
itemWidth = minItemWidth + IconsModeSettings::textWidthIndex() * 64;
if (previewsShown()) {
// Optimize the width for previews with a 3:2 aspect ratio instead
// of a 1:1 ratio to avoid wasting too much vertical space when
@ -225,12 +225,12 @@ void DolphinItemListContainer::updateGridSize()
const int minWidth = iconSize * 3 / 2;
itemWidth = qMax(itemWidth, minWidth);
}
if (itemWidth < iconSize + padding * 2) {
itemWidth = iconSize + padding * 2;
}
itemHeight = padding * 3 + iconSize + styleOption.fontMetrics.height();
horizontalMargin = 4;
verticalMargin = 8;
break;
@ -239,7 +239,7 @@ void DolphinItemListContainer::updateGridSize()
itemWidth = padding * 4 + iconSize + styleOption.fontMetrics.height() * 5;
const int textLinesCount = m_fileItemListView->visibleRoles().count();
itemHeight = padding * 2 + qMax(iconSize, textLinesCount * styleOption.fontMetrics.height());
horizontalMargin = 8;
break;
}

View file

@ -64,7 +64,7 @@ public:
void beginTransaction();
void endTransaction();
void readSettings();
void readSettings();
void writeSettings();
private:

View file

@ -451,11 +451,11 @@ void DolphinView::stopLoading()
void DolphinView::readSettings()
{
const int oldZoomLevel = m_container->zoomLevel();
GeneralSettings::self()->readConfig();
m_container->readSettings();
applyViewProperties();
const int newZoomLevel = m_container->zoomLevel();
if (newZoomLevel != oldZoomLevel) {
emit zoomLevelChanged(newZoomLevel, oldZoomLevel);

View file

@ -269,7 +269,7 @@ public:
* font, ...).
*/
void readSettings();
/**
* Saves the current settings (e.g. icons size, font, ..).
*/
@ -551,7 +551,7 @@ protected:
/** @reimp */
virtual void hideEvent(QHideEvent* event);
private slots:
/**
* Marks the view as active (DolphinView:isActive() will return true)
@ -766,7 +766,7 @@ private:
KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu
QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
VersionControlObserver* m_versionControlObserver;
// For unit tests

View file

@ -49,7 +49,7 @@ QString DragAndDropHelper::dropUrls(const KFileItem& destItem, const KUrl& destU
return i18nc("@info:status", "A folder cannot be dropped into itself");
}
}
KonqOperations::doDrop(destItem, destUrl, event, QApplication::activeWindow());
} else {
KonqOperations::doDrop(KFileItem(), destUrl, event, QApplication::activeWindow());

View file

@ -44,9 +44,9 @@ ToolTipManager::ToolTipManager(QWidget* parent) :
m_itemRect()
{
if (parent) {
m_margin = qMax(m_margin, parent->style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth));
m_margin = qMax(m_margin, parent->style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth));
}
m_showToolTipTimer = new QTimer(this);
m_showToolTipTimer->setSingleShot(true);
m_showToolTipTimer->setInterval(500);