Parent: [7d06dc] (diff)

Child: [1e6fde] (diff)

Download this file

restable.h    98 lines (78 with data), 2.9 kB

 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef _RESTABLE_H_INCLUDED_
#define _RESTABLE_H_INCLUDED_
/* @(#$Id: spell_w.h,v 1.7 2006-12-22 11:01:28 dockes Exp $ (C) 2006 J.F.Dockes */
/*
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <Qt>
#include "ui_restable.h"
#include "refcntr.h"
#include "docseq.h"
class ResTable;
typedef string (FieldGetter)(const string& fldname, const Rcl::Doc& doc);
class RecollModel : public QAbstractTableModel {
Q_OBJECT
public:
RecollModel(const QStringList fields, QObject *parent = 0);
virtual int rowCount (const QModelIndex& = QModelIndex()) const;
virtual int columnCount(const QModelIndex& = QModelIndex()) const;
virtual QVariant headerData (int col,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const;
virtual QVariant data(const QModelIndex& index,
int role = Qt::DisplayRole ) const;
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
virtual void setDocSource(RefCntr<DocSequence> nsource);
virtual bool getdoc(int index, Rcl::Doc &doc);
friend class ResTable;
signals:
void sortDataChanged(DocSeqSortSpec);
private:
mutable RefCntr<DocSequence> m_source;
vector<string> m_fields;
vector<FieldGetter*> m_getters;
};
class ResTablePager;
class ResTable : public QWidget, public Ui::ResTable
{
Q_OBJECT
public:
ResTable(QWidget* parent = 0)
: QWidget(parent),
m_model(0), m_pager(0), m_detaildocnum(-1)
{
setupUi(this);
init();
}
virtual ~ResTable() {}
virtual RecollModel *getModel() {return m_model;}
virtual void saveSizeState();
public slots:
virtual void onTableView_currentChanged(const QModelIndex&);
virtual void on_tableView_entered(const QModelIndex& index);
virtual void saveColWidths();
virtual void setDocSource(RefCntr<DocSequence> nsource);
virtual void resetSource();
virtual void readDocSource();
virtual void onSortDataChanged(DocSeqSortSpec);
friend class ResTablePager;
private:
void init();
RecollModel *m_model;
ResTablePager *m_pager;
int m_detaildocnum;
};
#endif /* _RESTABLE_H_INCLUDED_ */