Commit faacac9d authored by Victor Yacovlev's avatar Victor Yacovlev

GUI part of Courses Start page implementation

parent df53a98f
......@@ -64,6 +64,7 @@ function loadHelpContents()
function loadCourseContents()
{
var contents = gui.coursesList();
var paths = gui.coursesList();
var block = document.getElementById("courses_list");
block.innerHTML = "";
for (var i=0; i<contents.length; i++) {
......@@ -74,7 +75,7 @@ function loadCourseContents()
if (i == contents.length - 1) {
clazz += " last";
}
var onClick = 'gui.showCoursesWindow(' + i + ')';
var onClick = 'gui.showCoursesWindow("' + paths[i] + '")';
var text = contents[i];
var line = "<button class='" + clazz + "' onclick='" + onClick + "'>" + text + "</button>\n";
block.innerHTML += line;
......
......@@ -502,16 +502,28 @@ void Plugin::startTesting()
kumirProgram_->testingRun();
}
void Plugin::showCoursesWindow(int index)
void Plugin::showCoursesWindow(const QString & id)
{
if (courseManager_ && !id.isEmpty()) {
courseManager_->activateCourseFromList(id);
}
if (coursesWindow_) {
coursesWindow_->activate();
}
}
QStringList Plugin::coursesList() const
QStringList Plugin::coursesList(bool fullPaths) const
{
return QStringList();
const QStringList files = courseManager_->getListOfCourses();
if (fullPaths)
return files;
else {
QStringList result;
for (int i=0; i<files.size(); i++) {
result << QFileInfo(files[i]).fileName();
}
return result;
}
}
void Plugin::showHelpWindow(int index)
......
......@@ -57,8 +57,8 @@ public slots:
bool showWorkspaceChooseDialog();
// for JavaScript
void showCoursesWindow(int index);
QStringList coursesList() const;
void showCoursesWindow(const QString & id);
QStringList coursesList(bool fullPaths) const;
void showHelpWindow(int index);
QStringList helpList() const;
......
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