void EditorSession::setSkeleton(Skeleton *skeleton) { if (m_skeleton == skeleton) { return; } m_skeleton = skeleton; Language *language = m_language; if (!m_language) { language = m_resourceManager->languageResources().first()->language(); } if (m_skeleton) { bool found = false; int resources = m_resourceManager->courseResources(language).count(); for (int i=0; i < resources; ++i) { Course * course = m_resourceManager->course(language, i); if (course->foreignId() == m_skeleton->id()) { setCourse(course); found = true; break; } } if (!found) { setCourse(nullptr); } } emit skeletonChanged(); }
void EditorSession::setLanguage(Language *language) { if (m_language == language) { return; } m_language = language; if (m_skeletonMode) { bool found = false; if (m_skeleton) { int resources = m_resourceManager->courseResources(m_language).count(); for (int i=0; i < resources; ++i) { Course * course = m_resourceManager->course(m_language, i); if (course->foreignId() == m_skeleton->id()) { setCourse(course); found = true; break; } } } if (!found) { setCourse(nullptr); } } else { // not skeleton mode if (m_resourceManager->courseResources(m_language).count() > 0) { setCourse(m_resourceManager->course(m_language, 0)); } } emit languageChanged(); }
void EditorSession::setEditSkeleton(bool enabled) { if (m_editSkeleton == enabled) { return; } m_editSkeleton = enabled; if (enabled) { m_tmpCourseWhileSkeletonEditing = m_course; setCourse(m_skeleton); } else { setCourse(m_tmpCourseWhileSkeletonEditing); m_tmpCourseWhileSkeletonEditing = nullptr; } emit editSkeletonChanged(); }
////////////////////////////////////////////////////////////////////////// // Default constructor TACourse::TACourse(string n, Manager* aManager) { manager = aManager; setCourse(n); //cout << "CONSTRUCT TACourse for " << n << endl; }
////////////////////////////////////////////////////////////////////////// // Default constructor TakenCourse::TakenCourse(Manager* aManager, string n) { manager = aManager; setCourse(n); //cout << "CONSTRUCT TakenCourse for " << n << endl; }