Commit 5615e2f7 authored by Victor Yacovlev's avatar Victor Yacovlev

Merge branch 'master' of gitorious.org:kumir2/kumir2

parents 99291ca7 5b83b877
...@@ -29,15 +29,37 @@ QString Plugin::getText() ...@@ -29,15 +29,37 @@ QString Plugin::getText()
{ {
GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>(); GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>();
gui->programSource(); gui->programSource();
return QString(); return gui->programSource().content.visibleText+gui->programSource().content.hiddenText;
} }
void Plugin::setPreProgram(QVariant param) void Plugin::setPreProgram(QVariant param)
{ {
GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>(); if(param.toString().right(4)==".kum")
{
setTextFromFile(param.toString());
}
else
{GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>();
Shared::GuiInterface::ProgramSourceText text; Shared::GuiInterface::ProgramSourceText text;
text.content=KumFile::fromString(param.toString()); text.content=KumFile::fromString(param.toString());
gui->setProgramSource(text); text.language=Shared::GuiInterface::ProgramSourceText::Kumir;
gui->setProgramSource(text);
}
} }
bool Plugin::setTextFromFile(QString fname)
{
QFile file(fname);
if(!file.open(QIODevice::ReadOnly))return false;
GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>();
Shared::GuiInterface::ProgramSourceText text;
QDataStream ds(&file);
ds>>text.content;
text.language=Shared::GuiInterface::ProgramSourceText::Kumir;
gui->setProgramSource(text);
return true;
}
bool Plugin::startNewTask(QStringList isps) bool Plugin::startNewTask(QStringList isps)
{return true;}; {return true;};
QWidget* Plugin::mainWindow() const QWidget* Plugin::mainWindow() const
......
...@@ -51,6 +51,7 @@ private /*fields*/: ...@@ -51,6 +51,7 @@ private /*fields*/:
QMenu* courseMenu; QMenu* courseMenu;
QList<QMenu*> MenuList; QList<QMenu*> MenuList;
MainWindowTask* MW; MainWindowTask* MW;
bool setTextFromFile(QString fname);
}; };
......
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