summaryrefslogtreecommitdiffstats
path: root/bibletime/backend/cswordmodulesearch.h
blob: 2e871cf726c14e90a2fc48404d6f5d81997926af (plain)
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
98
99
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



#ifndef CSWORDMODULESEARCH_H
#define CSWORDMODULESEARCH_H

//BibleTime - backend
#include "cswordmoduleinfo.h"

//BibleTime - utils
#include "util/cpointers.h"

//Qt includes
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqsignal.h>

//System includes
#include <pthread.h>

//Sword includes
#include <listkey.h>

/**
 * CSwordModuleSearch manages the search on Sword modules. It manages the thread(s)
 * and manages the different modules.
  *
  * @author The BibleTime team
  * @version $Id: cswordmodulesearch.h,v 1.34 2006/08/08 19:32:48 joachim Exp $
  */

class CSwordModuleSearch: public CPointers {

public:
	CSwordModuleSearch();
	/**
	* The destructor of this class. It cleans uop memory before it's deleted.
	*/
	virtual ~CSwordModuleSearch();
	/**
	* Sets the text which should be search in the modules.
	*/
	void setSearchedText( const TQString& );
	/**
	* Starts the search for the search text.
	*/
	const bool startSearch();
	/**
	* This function sets the modules which should be searched.
	*/
	void setModules( const ListCSwordModuleInfo& );
	/**
	* Sets the search scope.
	*/
	void setSearchScope( const sword::ListKey& scope );
	/**
	* Sets the seaech scope back.
	*/
	void resetSearchScope();
	/**
	* @return "true" if in the last search the searcher found items, if no items were found return "false"
	*/
	const bool foundItems() const;
	/**
	* Returns a copy of the used search scope.
	*/
	const sword::ListKey& searchScope() const;

	void connectFinished( TQObject * receiver, const char * member );
	void searchFinished();

	/**
	* Returns true if all of the specified modules have indices already built.
	*/
	const bool modulesHaveIndices( const ListCSwordModuleInfo& );

protected:
	TQString m_searchedText;
	sword::ListKey m_searchScope;
	ListCSwordModuleInfo m_moduleList;

	int m_searchOptions;

	bool m_foundItems;

private:
 	TQSignal m_finishedSig;
	static CSwordModuleSearch* searcher;
};

#endif