1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
22 // Created by Bartosz Szatkowski
30 #include "../../includes/CommonDictInterface.h"
31 #include "../../includes/settings.h"
32 #include "../../includes/translation.h"
35 //! Inner part of dictionary - glues together GUI and plugins
36 class Backbone : public QObject
41 Backbone(QObject *parent = 0);
43 Backbone(const Backbone& b);
45 //! \return all loadded dictionaries with activity state flag
46 QHash<CommonDictInterface*, bool> getDictionaries();
48 //! \return all loadded plugins
49 QList<CommonDictInterface*> getPlugins();
51 //! \return history of performed searches
52 QList<QString> getHistory(); //TODO implementation needed (in future)
54 //! \return return search fesult
55 QHash<QString, Translation*> result();
57 //! \return maximum number of word that plugin could find
58 int searchLimit() const;
61 //! stops all current searches
64 //! search for a word translation
65 void search(QString word);
67 //! sets active dictionaries
68 void selectedDictionaries(QList<CommonDictInterface* >);
70 //! adds new dictionary
71 void addDictionary(CommonDictInterface* dict);
74 //! stops all current activity and kill plugins - be ready to exit
78 //! Fired when dictionary call finalTranslation(..) with translation ready
79 void translation(QList<Translation*>);
81 // TODO void removeDictionary(CommonDictInterface* dict);
82 // TODO addToBookmark(Translation*);
83 // TODO removeFromBookmark(Translation*);
86 //! emmited when backbone is ready to close - after getting stop signal it
87 //! should kill all threads and so on
90 //! emitted when there are search result ready to fetch
96 QHash<CommonDictInterface*, bool> dicts;
97 QList<CommonDictInterface*> plugins;
98 QHash<QString, Translation*> resultv;