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 <QPluginLoader>
31 #include "../../includes/CommonDictInterface.h"
32 #include "../../includes/settings.h"
33 #include "../../includes/translation.h"
36 //! Inner part of dictionary - glues together GUI and plugins
37 class Backbone : public QObject
42 Backbone(QObject *parent = 0);
44 Backbone(const Backbone& b);
46 //! \return all loadded dictionaries with activity state flag
47 QHash<CommonDictInterface*, bool> getDictionaries();
49 //! \return all loadded plugins
50 QList<CommonDictInterface*> getPlugins();
52 //! \return history of performed searches
53 QList<QString> getHistory(); //TODO implementation needed (in future)
55 //! \return return search fesult
56 QMultiHash<QString, Translation*> result();
58 //! \return maximum number of word that plugin could find
59 int searchLimit() const;
61 //! \return number of active searches
62 int activeSearches() const;
65 //! stops all current searches
68 //! search for a word translation
69 void search(QString word);
71 //! sets active dictionaries
72 void selectedDictionaries(QList<CommonDictInterface* >);
74 //! adds new dictionary
75 void addDictionary(CommonDictInterface* dict);
78 //! stops all current activity and kill plugins - be ready to exit
82 //! Fired when dictionary call finalTranslation(..) with translation ready
83 void translation(QList<Translation*>);
85 // TODO void removeDictionary(CommonDictInterface* dict);
86 // TODO addToBookmark(Translation*);
87 // TODO removeFromBookmark(Translation*);
90 //! emmited when backbone is ready to close - after getting stop signal it
91 //! should kill all threads and so on
94 //! emitted when there are search result ready to fetch
100 void loadPlugins(); //< locate and load plugins
101 QHash<CommonDictInterface*, bool> dicts;
102 QList<CommonDictInterface*> plugins;
103 QMultiHash<QString, Translation*> _result;