~michael-sheldon/+junk/keyboard-skeyer-autocorrect

« back to all changes in this revision

Viewing changes to src/lib/logic/wordengine.cpp

  • Committer: Thomas Moenicke
  • Date: 2013-11-28 14:40:54 UTC
  • mto: This revision was merged to the branch mainline in revision 121.
  • Revision ID: thomas.moenicke@canonical.com-20131128144054-0lu0iej0ygrbvr0i
added fr, de, es, en, it lang packs
added internal library for sharing code between presage/hunspell based packages
fixes in buildsystem
fixed path for installing plugins

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
} // namespace
62
62
 
 
63
#define DEFAULT_PLUGIN "libenglishplugin.so"
 
64
 
63
65
//! \class WordEngine
64
66
//! \brief Provides error correction (based on Hunspell) and word
65
67
//! prediction (based on Presage).
78
80
 
79
81
    void loadPlugin(QString pluginName)
80
82
    {
81
 
        QDir pluginsDir("/home/phablet/ubuntu-keyboard/plugins/");
82
 
        pluginsDir.cd("plugins");
83
 
 
 
83
        QDir pluginsDir("/usr/share/maliit/plugins/com/ubuntu/lib/");
 
84
        //pluginsDir.cd("plugins");
 
85
        qDebug() << "loading plugin <<<<<<<<<<<<=====================";
84
86
        QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(pluginName));
85
87
        QObject *plugin = pluginLoader.instance();
 
88
        qDebug() << plugin << pluginName << pluginsDir.absoluteFilePath(pluginName);
86
89
        if (plugin) {
87
90
            languagePlugin = qobject_cast<LanguagePluginInterface *>(plugin);
88
91
            if (!languagePlugin) {
89
92
                qCritical() << "loading plugin failed: " + pluginName;
90
93
 
91
94
                // fallback
92
 
                if (pluginName != "libwesternplugin.so")
93
 
                    loadPlugin("libwesternplugin.so");
94
 
            }
 
95
                if (pluginName != DEFAULT_PLUGIN)
 
96
                    loadPlugin(DEFAULT_PLUGIN);
 
97
            } else
 
98
                qDebug("plugin loaded");
95
99
        }
96
100
    }
97
101
};
101
105
    , use_spell_checker(false)
102
106
    , languagePlugin(0)
103
107
{
104
 
    loadPlugin("libwesternplugin.so");
 
108
    loadPlugin(DEFAULT_PLUGIN);
105
109
}
106
110
 
107
111
 
219
223
    if (languageId == "zh")
220
224
        d->loadPlugin("libpinyinplugin.so");
221
225
    else
222
 
        d->loadPlugin("libwesternplugin.so");
 
226
        d->loadPlugin(DEFAULT_PLUGIN);
223
227
 
224
228
    bool ok = d->languagePlugin->setSpellCheckerLanguage(languageId);
225
229
    if (ok)