1 /* -*- c++ -*- */
2 /*
3  * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
4  *           https://gqrx.dk/
5  *
6  * Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci.
7  *
8  * Gqrx is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3, or (at your option)
11  * any later version.
12  *
13  * Gqrx is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Gqrx; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street,
21  * Boston, MA 02110-1301, USA.
22  */
23 #ifndef BOOKMARKSTABLEMODEL_H
24 #define BOOKMARKSTABLEMODEL_H
25 
26 #include <QAbstractTableModel>
27 #include <QList>
28 
29 #include "bookmarks.h"
30 
31 
32 class BookmarksTableModel : public QAbstractTableModel
33 {
34     Q_OBJECT
35 
36 public:
37     enum EColumns
38     {
39         COL_FREQUENCY,
40         COL_NAME,
41         COL_MODULATION,
42         COL_BANDWIDTH,
43         COL_TAGS
44     };
45 
46     explicit BookmarksTableModel(QObject *parent = 0);
47 
48     int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
49     int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
50     QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
51     QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
52     bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
53     Qt::ItemFlags flags ( const QModelIndex & index ) const;
54 
55     BookmarkInfo* getBookmarkAtRow(int row);
56     int GetBookmarksIndexForRow(int iRow);
57 
58 private:
59     QList<BookmarkInfo*> m_Bookmarks;
60     QMap<int,int> m_mapRowToBookmarksIndex;
61 
62 signals:
63 public slots:
64     void update();
65 
66 };
67 
68 #endif
69