Пример #1
0
void CoursePage::courseSelectedChangedSlot(Course course)
{
    // Update the labels with the name of the course
    courseLabel->setText(QString::fromStdString(course.name));

    // Rebuild the section picker
    while (pickerScrollLayout->count() > 0) {
        delete pickerScrollLayout->takeAt(0)->widget();
    }
    sectionPicker = new SectionPickerWidget(findFact(course.root_fact), model, pageStack, factAddForm, factAddDialog, sectionEditForm, sectionEditDialog);
    pickerScrollLayout->addWidget(sectionPicker);
    pickerScrollLayout->addStretch(1);
    pickerScrollArea->ensureVisible(0, 0);

    // Rebuild the fact list
    while (courseScrollLayout->count() > 0) {
        delete courseScrollLayout->takeAt(0)->widget();
    }
    factListView = new FactListView(course, model, pageStack);
    courseScrollLayout->addWidget(factListView);
    courseScrollLayout->addStretch(1);
    courseScrollArea->ensureVisible(0, 0);

    // Connect the two together
    connect(sectionPicker, SIGNAL(sectionSelected(int)), factListView, SLOT(selectSection(int)));
    connect(sectionPicker, SIGNAL(sectionSelected(int)), this, SLOT(sectionSelected(int)));

    // Adjust the size of the splitter panes
    splitter->setSizes(QList<int>({0, 1}));
}
Пример #2
0
void renderAll()
{
    // First delete any rendered images
    if (system((std::string("rm -f ") + imageDir + "/fact/* " + imageDir + "/proof/*").c_str())) {
        std::cout << "Could not delete rendered images" << std::endl;
    }

    std::vector<Course> courses = findAllCourses();
    for (size_t i = 0; i < courses.size(); i++) {
        recursivelyRenderFact(findFact(courses[i].root_fact));
    }
}
Пример #3
0
void CoursePage::factAddFormCompleted()
{
    Fact data = factAddForm->getData();

    Fact newFact = findFact(addFact(data.parent, data.name, data.type));

    model->addFact(newFact);

    factAddDialog->close();

    if (newFact.type != "Section") {
        model->setFactSelected(newFact);
        pageStack->setCurrentIndex(2);
    }
}
Пример #4
0
// Add data to (*this)
int FactControl::addFactAndHistory(const Fact & aFact,
         const History & history,const int & extra) {
   int result;
   if(findFact(aFact,result)) {
     DBG();
   } else {
     d_rules.push_back(new GroebnerRule(aFact));
     _history.push_back(history);
     GBList<History>::const_iterator iter2 = 
        ((const GBList<History>)_history).begin();
     iter2.advance(_history.size()-1);
     _historyIterators.push_back(iter2);
     _extra.push_back(extra);

     ++d_numberOfFacts;
     ++d_rules_sz;
     result = d_numberOfFacts;
   }
   return result;
};