diff --git a/src/browsermanager.h b/src/browsermanager.h index a33ac36..c3ad016 100644 --- a/src/browsermanager.h +++ b/src/browsermanager.h @@ -1,91 +1,91 @@ /*************************************************************************** * * * Copyright 2014 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ #ifndef BOOKMARKSMANAGER_H #define BOOKMARKSMANAGER_H #include #include #include "urlmodel.h" class QSettings; namespace AngelFish { /** * @class BookmarksManager * @short Access to Bookmarks and History. This is a singleton for * administration and access to the various models and browser-internal * data. */ class BrowserManager : public QObject { Q_OBJECT Q_PROPERTY(QAbstractListModel* bookmarks READ bookmarks NOTIFY bookmarksChanged) Q_PROPERTY(QAbstractListModel* history READ history NOTIFY historyChanged) Q_PROPERTY(QString homepage READ homepage WRITE setHomepage NOTIFY homepageChanged) Q_PROPERTY(QString searchBaseUrl READ searchBaseUrl WRITE setSearchBaseUrl NOTIFY searchBaseUrlChanged) public: BrowserManager(QObject *parent = nullptr); - ~BrowserManager(); + ~BrowserManager() override; UrlModel* bookmarks(); UrlModel* history(); QString homepage(); QString searchBaseUrl(); Q_INVOKABLE static QString urlFromUserInput(const QString &input); signals: void updated(); void bookmarksChanged(); void historyChanged(); void homepageChanged(); void searchBaseUrlChanged(); public slots: void reload(); void addBookmark(const QVariantMap &bookmarkdata); void removeBookmark(const QString &url); void addToHistory(const QVariantMap &pagedata); void removeFromHistory(const QString &url); void setHomepage(const QString& homepage); void setSearchBaseUrl(const QString& searchBaseUrl); private: UrlModel* m_bookmarks; UrlModel* m_history; QSettings* m_settings; }; } // namespace #endif //BOOKMARKSMANAGER_H diff --git a/src/urlmodel.h b/src/urlmodel.h index 8c0a6a2..b3cebd1 100644 --- a/src/urlmodel.h +++ b/src/urlmodel.h @@ -1,78 +1,78 @@ /*************************************************************************** * * * Copyright 2014-2015 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ #ifndef URLMODEL_H #define URLMODEL_H #include #include #include namespace AngelFish { class UrlModel : public QAbstractListModel { Q_OBJECT public: enum Roles { url = Qt::UserRole + 1, title, icon, preview, lastVisited, bookmarked }; explicit UrlModel(const QString &filename, QObject *parent = 0); void setSourceData(QJsonArray &data); QJsonArray sourceData() const; QString key(int role) const; bool load(); bool save(); void add(const QJsonObject &data); void remove(const QString &url); - virtual QHash roleNames() const; - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; + QHash roleNames() const override; + int rowCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role) const override; void update(); Q_INVOKABLE bool updateIcon(const QString &url, const QString &iconSource); QJsonArray fakeData(); QString filePath() const; private: QJsonArray m_data; QHash m_roleNames; QString m_fileName; }; } // namespace #endif // URLMODEL_H