Commit 0463e246 authored by Victor Yacovlev's avatar Victor Yacovlev

Allow to preload specific addon actors

parent 3bc2b44b
......@@ -4,6 +4,8 @@
#include "pdautomata.h"
#include "syntaxanalizer.h"
#include <kumir2-libs/errormessages/errormessages.h>
#include <kumir2-libs/extensionsystem/pluginmanager.h>
#include <kumir2/actorinterface.h>
#include "kumiranalizerplugin.h"
#include "stdlibmodules.h"
......@@ -23,14 +25,22 @@ void Analizer::setSourceLanguage(const QDir & resourcesRoot, const QLocale::Lang
Analizer::_NativeLanguage = language;
}
void Analizer::setModuleAlwaysAvailable(const QString &moduleName)
void Analizer::setModuleAlwaysAvailable(const QByteArray &moduleName)
{
if (moduleName==QString::fromLatin1("Files"))
if (moduleName=="Files")
Analizer::_AlwaysAvailableModulesName.append(QString::fromUtf8("Файлы"));
if (moduleName==QString::fromLatin1("Strings"))
else if (moduleName=="Strings")
Analizer::_AlwaysAvailableModulesName.append(QString::fromUtf8("Строки"));
if (moduleName==QString::fromLatin1("Keyboard"))
else if (moduleName=="Keyboard")
Analizer::_AlwaysAvailableModulesName.append(QString::fromUtf8("Клавиатура"));
else {
QList<ActorInterface*> actors = ExtensionSystem::PluginManager::instance()->findPlugins<ActorInterface>();
Q_FOREACH(ActorInterface *actor, actors) {
if(moduleName==actor->asciiModuleName()) {
Analizer::_AlwaysAvailableModulesName.append(actor->localizedModuleName(QLocale::Russian));
}
}
}
}
Analizer::Analizer(KumirAnalizerPlugin * plugin, bool teacherMode)
......
......@@ -46,7 +46,7 @@ public:
* Kumir source language (Russian, Ukrainian, etc.)
*/
static void setSourceLanguage(const QDir & resourcesRoot, const QLocale::Language & language);
static void setModuleAlwaysAvailable(const QString & moduleName);
static void setModuleAlwaysAvailable(const QByteArray & moduleName);
void connectSignalImportsChanged(QObject *receiver, const char *slot);
public slots:
......
......@@ -56,7 +56,7 @@ QString KumirAnalizerPlugin::initialize(const QStringList &configurationArgument
{
QLocale::Language language = QLocale::Russian;
Analizer::setModuleAlwaysAvailable(QString::fromUtf8("Стандартные функции"));
// Analizer::setModuleAlwaysAvailable(QString::fromUtf8("Стандартные функции"));
Q_FOREACH (const QString &arg, configurationArguments) {
if (arg.startsWith("language=")) {
......@@ -68,7 +68,7 @@ QString KumirAnalizerPlugin::initialize(const QStringList &configurationArgument
}
}
else if (arg.startsWith("preload=")) {
const QString modname = arg.mid(8);
const QByteArray modname = arg.mid(8).toLatin1();
Analizer::setModuleAlwaysAvailable(modname);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment