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
26 Backbone::Backbone(QObject *parent)
37 Backbone::Backbone(const Backbone &b){
38 dicts = QHash<CommonDictInterface*, bool > (b.dicts);
39 plugins = QList<CommonDictInterface* > (b.plugins);
40 resultv = QHash<QString, Translation* > (b.resultv);
41 searchLimitv = b.searchLimit();
44 int Backbone::searchLimit() const {
48 QHash<CommonDictInterface*, bool > Backbone::getDictionaries() {
52 QList<CommonDictInterface* > Backbone::getPlugins() {
56 QList<QString> Backbone::getHistory() {
60 QHash<QString, Translation*> Backbone::result() {
64 void Backbone::stopSearching() {
65 foreach(CommonDictInterface* dict, dicts.keys())
69 void Backbone::search(QString word) {
70 //TODO add running searches in new threads
71 foreach(CommonDictInterface* dict, dicts.keys())
73 dict->search(word, searchLimit());
76 void Backbone::selectedDictionaries(QList<CommonDictInterface* > activeDicts) {
77 foreach(CommonDictInterface* dict, dicts.keys())
78 if(activeDicts.contains(dict))
84 void Backbone::addDictionary(CommonDictInterface* dict) {
86 connect(dict, SIGNAL(finalTranslation(QList<Translation*>)),
87 this, SLOT(translation(QList<Translation*>)));
90 void Backbone::quit() {
97 void Backbone::translation(QList<Translation *> trans) {