diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-07 23:28:42 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-07 23:28:42 +0100 |
commit | b984992fc92b6dd607732d6dad1c533b36f1ba3a (patch) | |
tree | 984c5ede072c2ebb10ad32acb5d5928162feb97f /lib/bookmarks | |
parent | Searching through BookmarkModel elements (diff) | |
download | smolbote-b984992fc92b6dd607732d6dad1c533b36f1ba3a.tar.xz |
Added .clang-format
Diffstat (limited to 'lib/bookmarks')
-rw-r--r-- | lib/bookmarks/bookmarkitem.cpp | 2 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkitem.h | 8 | ||||
-rw-r--r-- | lib/bookmarks/bookmarksmodel.cpp | 18 | ||||
-rw-r--r-- | lib/bookmarks/bookmarksmodel.h | 3 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkswidget.cpp | 6 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkswidget.h | 10 | ||||
-rw-r--r-- | lib/bookmarks/xbel.cpp | 1 | ||||
-rw-r--r-- | lib/bookmarks/xbel.h | 2 |
8 files changed, 25 insertions, 25 deletions
diff --git a/lib/bookmarks/bookmarkitem.cpp b/lib/bookmarks/bookmarkitem.cpp index 14ad197..875ccc6 100644 --- a/lib/bookmarks/bookmarkitem.cpp +++ b/lib/bookmarks/bookmarkitem.cpp @@ -48,7 +48,7 @@ int BookmarkItem::childCount() const int BookmarkItem::row() const { if(m_parentItem) { - return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem*>(this)); + return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem *>(this)); } // no parent item, we are root diff --git a/lib/bookmarks/bookmarkitem.h b/lib/bookmarks/bookmarkitem.h index 839f10e..1b9223e 100644 --- a/lib/bookmarks/bookmarkitem.h +++ b/lib/bookmarks/bookmarkitem.h @@ -29,10 +29,12 @@ public: int childIndex(BookmarkItem *item) const; int childCount() const; - BookmarkItemType type() const { + BookmarkItemType type() const + { return m_type; }; - int columnCount() const { + int columnCount() const + { return 2; }; @@ -47,7 +49,7 @@ public: private: BookmarkItemType m_type; BookmarkItem *m_parentItem; - QVector<BookmarkItem*> m_childItems; + QVector<BookmarkItem *> m_childItems; }; #endif //BOOKMARKITEM_H diff --git a/lib/bookmarks/bookmarksmodel.cpp b/lib/bookmarks/bookmarksmodel.cpp index 757612e..7e0c35b 100644 --- a/lib/bookmarks/bookmarksmodel.cpp +++ b/lib/bookmarks/bookmarksmodel.cpp @@ -9,7 +9,8 @@ #include "bookmarksmodel.h" #include <QStyle> -BookmarksModel::BookmarksModel(QStyle *style, QObject *parent) : QAbstractItemModel(parent) +BookmarksModel::BookmarksModel(QStyle *style, QObject *parent) + : QAbstractItemModel(parent) { folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On); folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off); @@ -62,14 +63,14 @@ QModelIndex BookmarksModel::index(BookmarkItem *node, int column) const QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const { // invalid item requested - if (!hasIndex(row, column, parent)) { + if(!hasIndex(row, column, parent)) { return QModelIndex(); } // index exists BookmarkItem *parentItem; if(parent.isValid()) { - parentItem = static_cast<BookmarkItem*>(parent.internalPointer()); + parentItem = static_cast<BookmarkItem *>(parent.internalPointer()); } else { parentItem = m_rootItem; } @@ -87,7 +88,7 @@ QModelIndex BookmarksModel::parent(const QModelIndex &index) const return QModelIndex(); } - BookmarkItem *childItem = static_cast<BookmarkItem*>(index.internalPointer()); + BookmarkItem *childItem = static_cast<BookmarkItem *>(index.internalPointer()); BookmarkItem *parentItem = childItem->parentItem(); if(parentItem == m_rootItem) { @@ -107,7 +108,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const if(!parent.isValid()) { parentItem = m_rootItem; } else { - parentItem = static_cast<BookmarkItem*>(parent.internalPointer()); + parentItem = static_cast<BookmarkItem *>(parent.internalPointer()); } return parentItem->childCount(); @@ -116,7 +117,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const int BookmarksModel::columnCount(const QModelIndex &parent) const { if(parent.isValid()) { - return static_cast<BookmarkItem*>(parent.internalPointer())->columnCount(); + return static_cast<BookmarkItem *>(parent.internalPointer())->columnCount(); } else { return m_rootItem->columnCount(); } @@ -125,12 +126,12 @@ int BookmarksModel::columnCount(const QModelIndex &parent) const QVariant BookmarksModel::data(const QModelIndex &index, int role) const { // get data of invalid index? - if (!index.isValid()) { + if(!index.isValid()) { return QVariant(); } const BookmarkItem *item = static_cast<BookmarkItem *>(index.internalPointer()); - switch (role) { + switch(role) { case Qt::DisplayRole: case Qt::EditRole: if(index.column() == 0) { @@ -200,6 +201,5 @@ QModelIndexList BookmarksModel::match(const QModelIndex &start, int role, const } } - return list; } diff --git a/lib/bookmarks/bookmarksmodel.h b/lib/bookmarks/bookmarksmodel.h index 9d884fb..baf2ba9 100644 --- a/lib/bookmarks/bookmarksmodel.h +++ b/lib/bookmarks/bookmarksmodel.h @@ -6,9 +6,9 @@ * SPDX-License-Identifier: GPL-3.0 */ +#include "bookmarkitem.h" #include <QAbstractItemModel> #include <QIcon> -#include "bookmarkitem.h" #ifndef BOOKMARKSMODEL_H #define BOOKMARKSMODEL_H @@ -46,7 +46,6 @@ private: QIcon bookmarkIcon; BookmarkItem *m_rootItem; - }; #endif //BOOKMARKSMODEL_H diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp index daec3f4..8aafe37 100644 --- a/lib/bookmarks/bookmarkswidget.cpp +++ b/lib/bookmarks/bookmarkswidget.cpp @@ -10,9 +10,9 @@ #include "ui_bookmarksform.h" #include <QUrl> -BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) : - QWidget(parent), - ui(new Ui::BookmarksDialog) +BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) + : QWidget(parent) + , ui(new Ui::BookmarksDialog) { // make sure this dialog does not get deleted on close setAttribute(Qt::WA_DeleteOnClose, false); diff --git a/lib/bookmarks/bookmarkswidget.h b/lib/bookmarks/bookmarkswidget.h index cdc013e..f82a512 100644 --- a/lib/bookmarks/bookmarkswidget.h +++ b/lib/bookmarks/bookmarkswidget.h @@ -9,11 +9,12 @@ #ifndef BOOKMARKSDIALOG_H #define BOOKMARKSDIALOG_H -#include <QWidget> -#include "xbel.h" #include "bookmarksmodel.h" +#include "xbel.h" +#include <QWidget> -namespace Ui { +namespace Ui +{ class BookmarksDialog; } @@ -23,7 +24,7 @@ class BookmarksWidget : public QWidget public: explicit BookmarksWidget(const QString &path, QWidget *parent = 0); - ~BookmarksWidget() override ; + ~BookmarksWidget() override; void save(); QAbstractItemModel *model() const; @@ -31,7 +32,6 @@ public: signals: void openUrl(const QUrl &url); - private: void expandNodes(BookmarkItem *node); diff --git a/lib/bookmarks/xbel.cpp b/lib/bookmarks/xbel.cpp index eeb019a..7a7632c 100644 --- a/lib/bookmarks/xbel.cpp +++ b/lib/bookmarks/xbel.cpp @@ -46,7 +46,6 @@ BookmarkItem *Xbel::read() return root; } - void Xbel::readChildElements(QXmlStreamReader &reader, BookmarkItem *parentItem) { while(reader.readNextStartElement()) { diff --git a/lib/bookmarks/xbel.h b/lib/bookmarks/xbel.h index 1c03b74..c425cc5 100644 --- a/lib/bookmarks/xbel.h +++ b/lib/bookmarks/xbel.h @@ -9,9 +9,9 @@ #ifndef XBELREADER_H #define XBELREADER_H +#include "bookmarkitem.h" #include <QString> #include <QXmlStreamReader> -#include "bookmarkitem.h" class Xbel { |