Changeset View
Changeset View
Standalone View
Standalone View
src/core/loader.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 79 | { | |||
---|---|---|---|---|---|
80 | qCDebug(SONNET_LOG_CORE) << "Removing loader: " << this; | 80 | qCDebug(SONNET_LOG_CORE) << "Removing loader: " << this; | ||
81 | delete d->settings; d->settings = nullptr; | 81 | delete d->settings; d->settings = nullptr; | ||
82 | delete d; | 82 | delete d; | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | SpellerPlugin *Loader::createSpeller(const QString &language, | 85 | SpellerPlugin *Loader::createSpeller(const QString &language, | ||
86 | const QString &clientName) const | 86 | const QString &clientName) const | ||
87 | { | 87 | { | ||
88 | QString pclient = clientName; | 88 | QString backend = clientName; | ||
89 | QString plang = language; | 89 | QString plang = language; | ||
90 | 90 | | |||
91 | if (backend.isEmpty()) { | ||||
92 | backend = d->settings->defaultClient(); | ||||
93 | } | ||||
91 | if (plang.isEmpty()) { | 94 | if (plang.isEmpty()) { | ||
92 | plang = d->settings->defaultLanguage(); | 95 | plang = d->settings->defaultLanguage(); | ||
93 | } | 96 | } | ||
94 | 97 | | |||
95 | const QVector<Client *> lClients = d->languageClients[plang]; | 98 | const QVector<Client *> lClients = d->languageClients[plang]; | ||
96 | 99 | | |||
97 | if (lClients.isEmpty()) { | 100 | if (lClients.isEmpty()) { | ||
98 | qCWarning(SONNET_LOG_CORE) << "No language dictionaries for the language:" << plang; | 101 | qCWarning(SONNET_LOG_CORE) << "No language dictionaries for the language:" << plang; | ||
99 | return nullptr; | 102 | return nullptr; | ||
100 | } | 103 | } | ||
101 | 104 | | |||
102 | QVectorIterator<Client *> itr(lClients); | 105 | QVectorIterator<Client *> itr(lClients); | ||
103 | while (itr.hasNext()) { | 106 | while (itr.hasNext()) { | ||
104 | Client *item = itr.next(); | 107 | Client *item = itr.next(); | ||
105 | if (!pclient.isEmpty()) { | 108 | if (!backend.isEmpty()) { | ||
106 | if (pclient == item->name()) { | 109 | if (backend == item->name()) { | ||
107 | SpellerPlugin *dict = item->createSpeller(plang); | 110 | SpellerPlugin *dict = item->createSpeller(plang); | ||
108 | return dict; | 111 | return dict; | ||
109 | } | 112 | } | ||
110 | } else { | 113 | } else { | ||
111 | //the first one is the one with the highest | 114 | //the first one is the one with the highest | ||
112 | //reliability | 115 | //reliability | ||
113 | SpellerPlugin *dict = item->createSpeller(plang); | 116 | SpellerPlugin *dict = item->createSpeller(plang); | ||
114 | return dict; | 117 | return dict; | ||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |