1 /*
2  *  Copyright 2005-2011 Fabrice Colin
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 
19 #ifndef _MODELCOLUMNS_HH
20 #define _MODELCOLUMNS_HH
21 
22 #include <time.h>
23 #include <sys/types.h>
24 #include <glibmm/refptr.h>
25 #include <glibmm/ustring.h>
26 #include <gdkmm/event.h>
27 #include <gtkmm/treemodel.h>
28 #include <gtkmm/treemodelcolumn.h>
29 
30 #include "QueryProperties.h"
31 
32 /// Model column for text combo boxes.
33 class ComboModelColumns : public Gtk::TreeModel::ColumnRecord
34 {
35 	public:
36 		ComboModelColumns();
37 		virtual ~ComboModelColumns();
38 
39 		Gtk::TreeModelColumn<Glib::ustring> m_name;
40 
41 };
42 
43 /// Main window, model column for the search engines tree.
44 class EnginesModelColumns : public Gtk::TreeModel::ColumnRecord
45 {
46 	public:
47 		EnginesModelColumns();
48 		virtual ~EnginesModelColumns();
49 
50 		Gtk::TreeModelColumn<Glib::ustring> m_name;
51 		Gtk::TreeModelColumn<Glib::ustring> m_engineName;
52 		Gtk::TreeModelColumn<Glib::ustring> m_option;
53 		typedef enum { ENGINE_SEPARATOR = 0, ENGINE_FOLDER,
54 			WEB_ENGINE, INTERNAL_INDEX_ENGINE, INDEX_ENGINE } EngineType;
55 		Gtk::TreeModelColumn<EngineType> m_type;
56 
57 };
58 
59 /// Main window, model column for the queries tree.
60 class QueryModelColumns : public Gtk::TreeModel::ColumnRecord
61 {
62 public:
63 	QueryModelColumns();
64 	virtual ~QueryModelColumns();
65 
66 	Gtk::TreeModelColumn<Glib::ustring> m_name;
67 	Gtk::TreeModelColumn<Glib::ustring> m_lastRun;
68 	Gtk::TreeModelColumn<time_t> m_lastRunTime;
69 	Gtk::TreeModelColumn<Glib::ustring> m_summary;
70 	Gtk::TreeModelColumn<QueryProperties> m_properties;
71 
72 };
73 
74 /// Main window, model column for the search results tree.
75 class ResultsModelColumns : public Gtk::TreeModel::ColumnRecord
76 {
77 public:
78 	ResultsModelColumns();
79 	virtual ~ResultsModelColumns();
80 
81 	Gtk::TreeModelColumn<Glib::ustring> m_text;
82 	Gtk::TreeModelColumn<Glib::ustring> m_url;
83 	Gtk::TreeModelColumn<bool> m_indexed;
84 	Gtk::TreeModelColumn<bool> m_viewed;
85 	Gtk::TreeModelColumn<int> m_rankDiff;
86 	Gtk::TreeModelColumn<int> m_score;
87 	Gtk::TreeModelColumn<Glib::ustring> m_scoreText;
88 	Gtk::TreeModelColumn<unsigned int> m_engines;
89 	Gtk::TreeModelColumn<unsigned int> m_indexes;
90 	Gtk::TreeModelColumn<unsigned int> m_docId;
91 	typedef enum { ROW_ENGINE = 0, ROW_HOST, ROW_RESULT, ROW_OTHER } RowType;
92 	Gtk::TreeModelColumn<RowType> m_resultType;
93 	Gtk::TreeModelColumn<Glib::ustring> m_timestamp;
94 	Gtk::TreeModelColumn<time_t> m_timestampTime;
95 	Gtk::TreeModelColumn<std::string> m_serial;
96 
97 };
98 
99 /// Preferences window, model column for the Xapian indexes tree.
100 class OtherIndexModelColumns : public Gtk::TreeModel::ColumnRecord
101 {
102 public:
103 	OtherIndexModelColumns();
104 	virtual ~OtherIndexModelColumns();
105 
106 	Gtk::TreeModelColumn<Glib::ustring> m_name;
107 	Gtk::TreeModelColumn<Glib::ustring> m_location;
108 
109 };
110 
111 /// Preferences window, model column for the labels tree.
112 /// Export/import window, model column for the labels tree.
113 class LabelModelColumns : public Gtk::TreeModel::ColumnRecord
114 {
115 public:
116 	LabelModelColumns();
117 	virtual ~LabelModelColumns();
118 
119 	Gtk::TreeModelColumn<bool> m_enabled;
120 	Gtk::TreeModelColumn<Glib::ustring> m_name;
121 
122 };
123 
124 /// Preferences window, model column for the mail accounts tree.
125 class TimestampedModelColumns : public Gtk::TreeModel::ColumnRecord
126 {
127 public:
128 	TimestampedModelColumns();
129 	virtual ~TimestampedModelColumns();
130 
131 	Gtk::TreeModelColumn<Glib::ustring> m_location;
132 	Gtk::TreeModelColumn<time_t> m_mTime;
133 
134 };
135 
136 /// Preferences window, model column for the directories tree.
137 class IndexableModelColumns : public Gtk::TreeModel::ColumnRecord
138 {
139 public:
140 	IndexableModelColumns();
141 	virtual ~IndexableModelColumns();
142 
143 	Gtk::TreeModelColumn<bool> m_monitor;
144 	Gtk::TreeModelColumn<Glib::ustring> m_location;
145 
146 };
147 
148 #endif // _MODELCOLUMNS_HH
149