SingleTaskMenu::SingleTaskMenu(const QString& tablename, CamcopsApp& app) : MenuWindow(app, ""), // start with a blank title m_tablename(tablename), m_current_task(nullptr) { // Title TaskFactoryPtr factory = app.factory(); TaskPtr specimen = factory->create(m_tablename); m_title = specimen->menutitle(); m_anonymous = specimen->isAnonymous(); // m_items is EXPENSIVE (and depends on security), so leave it to build() }
MenuItem::MenuItem(const TaskMenuItem& taskmenuitem, CamcopsApp& app) // m_title: below { setDefaults(); m_task_tablename = taskmenuitem.tablename; TaskPtr task = app.factory()->create(m_task_tablename); if (task == nullptr) { m_title = tr("UNKNOWN TASK") + ": " + taskmenuitem.tablename; m_implemented = false; return; } m_title = task->menutitle(); m_subtitle = task->menusubtitle(); m_crippled = task->isCrippled(); if (task->isAnonymous()) { m_icon = UiFunc::iconFilename(UiConst::ICON_ANONYMOUS); } }