Commit 5b83b877 authored by Denis Khachko's avatar Denis Khachko

Course manager - load kum program files

parent 9f543e3e
......@@ -29,15 +29,37 @@ QString Plugin::getText()
{
GI * gui = ExtensionSystem::PluginManager::instance()->findPlugin<GI>();
gui->programSource();
return QString();
return gui->programSource().content.visibleText+gui->programSource().content.hiddenText;
}
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;
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)
{return true;};
QWidget* Plugin::mainWindow() const
......
......@@ -51,6 +51,7 @@ private /*fields*/:
QMenu* courseMenu;
QList<QMenu*> MenuList;
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