aboutsummaryrefslogtreecommitdiff
path: root/src/tabbrowsinghistory.hpp
blob: c1e20e713b8304c174a6150577510a99902d1400 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef TABBROWSINGHISTORY_HPP
#define TABBROWSINGHISTORY_HPP

#include <QAbstractListModel>
#include <QVector>
#include <QUrl>

class TabBrowsingHistory :
        public QAbstractListModel
{
    Q_OBJECT
public:
    TabBrowsingHistory();

    bool canGoBack() const;

    bool canGoForward() const;

    QModelIndex pushUrl(QModelIndex const & position, QUrl const & url);
    void replaceUrl(size_t const position, QUrl const & url);

    QUrl get(QModelIndex const & index) const;

    QModelIndex oneForward(const QModelIndex &index) const;

    QModelIndex oneBackward(const QModelIndex &index) const;

public:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;


private:
    QVector<QUrl> history;
};

#endif // TABBROWSINGHISTORY_HPP