summaryrefslogtreecommitdiff
path: root/src/plugins/bookmarks
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-02-15 11:07:45 +0100
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-02-15 11:07:45 +0100
commitcac7f826b563a27701089a44750e48b27569fb50 (patch)
tree86339ea0d0d975d6850988ae466d1652a7ebe9b8 /src/plugins/bookmarks
parentf4163b8ba01cd1a4f5d91c83a3863939b7809375 (diff)
downloadqt-creator-cac7f826b563a27701089a44750e48b27569fb50.tar.gz
Remove static icons, cleanup.
Use constructor initialization, const.
Diffstat (limited to 'src/plugins/bookmarks')
-rw-r--r--src/plugins/bookmarks/bookmark.cpp19
-rw-r--r--src/plugins/bookmarks/bookmark.h13
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp15
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.h5
4 files changed, 25 insertions, 27 deletions
diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp
index f5b621d671..1d870af830 100644
--- a/src/plugins/bookmarks/bookmark.cpp
+++ b/src/plugins/bookmarks/bookmark.cpp
@@ -35,21 +35,20 @@
using namespace Bookmarks::Internal;
-const QIcon Bookmark::m_bookmarkIcon = QIcon(":/bookmarks/images/bookmark.png");
-
-Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *manager)
- : BaseTextMark(fileName, lineNumber), m_manager(manager)
+Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *manager) :
+ BaseTextMark(fileName, lineNumber),
+ m_manager(manager),
+ m_fileInfo(fileName),
+ m_fileName(fileName),
+ m_onlyFile(m_fileInfo.fileName()),
+ m_path(m_fileInfo.path()),
+ m_lineNumber(lineNumber)
{
- m_fileName = fileName;
- m_fileInfo.setFile(fileName);
- m_onlyFile = m_fileInfo.fileName();
- m_path = m_fileInfo.path();
- m_lineNumber= lineNumber;
}
QIcon Bookmark::icon() const
{
- return m_bookmarkIcon;
+ return m_manager->bookmarkIcon();
}
void Bookmark::removedFromEditor()
diff --git a/src/plugins/bookmarks/bookmark.h b/src/plugins/bookmarks/bookmark.h
index 0f62dbbb0a..6b1010f1a5 100644
--- a/src/plugins/bookmarks/bookmark.h
+++ b/src/plugins/bookmarks/bookmark.h
@@ -64,16 +64,13 @@ public:
inline int lineNumber() const { return m_lineNumber; }
private:
- static const QIcon m_bookmarkIcon;
-
BookmarkManager *m_manager;
- int m_lineNumber;
- QString m_name;
- QString m_fileName;
- QString m_onlyFile;
- QString m_path;
+ const QFileInfo m_fileInfo;
+ const QString m_fileName;
+ const QString m_onlyFile;
+ const QString m_path;
QString m_lineText;
- QFileInfo m_fileInfo;
+ int m_lineNumber;
};
} // namespace Internal
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 0d2ea2f45e..aa05dd711a 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -202,16 +202,16 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
painter->restore();
}
-BookmarkView::BookmarkView(QWidget *parent)
- : QListView(parent)
+BookmarkView::BookmarkView(QWidget *parent) :
+ QListView(parent),
+ m_bookmarkContext(new BookmarkContext(this)),
+ m_manager(0)
{
setWindowTitle(tr("Bookmarks"));
- setWindowIcon(QIcon(":/bookmarks/images/bookmark.png"));
connect(this, SIGNAL(clicked(const QModelIndex &)),
this, SLOT(gotoBookmark(const QModelIndex &)));
- m_bookmarkContext = new BookmarkContext(this);
ICore::instance()->addContextObject(m_bookmarkContext);
setItemDelegate(new BookmarkDelegate(this));
@@ -317,11 +317,10 @@ QWidget *BookmarkContext::widget()
// BookmarkManager
////
-BookmarkManager::BookmarkManager()
- : m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png")))
+BookmarkManager::BookmarkManager() :
+ m_bookmarkIcon(QLatin1String(":/bookmarks/images/bookmark.png")),
+ m_selectionModel(new QItemSelectionModel(this, this))
{
- m_selectionModel = new QItemSelectionModel(this, this);
-
connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)),
this, SLOT(updateActionStatus()));
diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h
index 843bfe0033..ab80e7b06c 100644
--- a/src/plugins/bookmarks/bookmarkmanager.h
+++ b/src/plugins/bookmarks/bookmarkmanager.h
@@ -66,6 +66,9 @@ class BookmarkManager : public QAbstractItemModel
public:
BookmarkManager();
~BookmarkManager();
+
+ QIcon bookmarkIcon() const { return m_bookmarkIcon; }
+
void updateBookmark(Bookmark *bookmark);
void removeBookmark(Bookmark *bookmark); // Does not remove the mark
void removeAllBookmarks();
@@ -127,7 +130,7 @@ private:
DirectoryFileBookmarksMap m_bookmarksMap;
- QIcon m_bookmarkIcon;
+ const QIcon m_bookmarkIcon;
QList<Bookmark *> m_bookmarksList;
QItemSelectionModel *m_selectionModel;