PathMapper::PathMapper()
{
    m_CRMLDirectoryMonitor = new CCRMLDirectoryMonitor;

    QTimer *timer = new QTimer(this);
    timer->setSingleShot(true);
    timer->setInterval(1000);

    connect(m_CRMLDirectoryMonitor, SIGNAL(directoryChanged()), timer, SLOT(start()));
    connect(timer, SIGNAL(timeout()), this, SLOT(updateMappings()));

    updateMappings();
}
void LanguageResourceModel::updateResources()
{
    if (!m_resourceManager) {
        return;
    }

    m_resources.clear();
    QList<LanguageResource*> resources = m_resourceManager->languageResources();

    foreach (LanguageResource *language, resources) {
        if (displayResource(language)) {
            m_resources.append(language);
        }
    }
    updateMappings();
}
예제 #3
0
void ResourceModel::setDataIndex(DataIndex* dataIndex)
{
    if (dataIndex != m_dataIndex)
    {
        beginResetModel();

        if (m_dataIndex)
        {
            m_dataIndex->disconnect(this);
        }

        m_dataIndex = dataIndex;

        if (m_dataIndex)
        {
            connect(m_dataIndex, SIGNAL(courseAboutToBeAdded(DataIndexCourse*,int)), SLOT(onCourseAboutToBeAdded(DataIndexCourse*,int)));
            connect(m_dataIndex, SIGNAL(courseAdded()), SLOT(onResourceAdded()));
            connect(m_dataIndex, SIGNAL(coursesAboutToBeRemoved(int,int)), SLOT(onCoursesAboutToBeRemoved(int,int)));
            connect(m_dataIndex, SIGNAL(coursesRemoved()), SLOT(onResourceRemoved()));
            connect(m_dataIndex, SIGNAL(keyboardLayoutAboutToBeAdded(DataIndexKeyboardLayout*,int)), SLOT(onKeyboardLayoutAboutToBeAdded(DataIndexKeyboardLayout*,int)));
            connect(m_dataIndex, SIGNAL(keyboardLayoutAdded()), SLOT(onResourceAdded()));
            connect(m_dataIndex, SIGNAL(keyboardLayoutsAboutToBeRemoved(int,int)), SLOT(onKeyboardLayoutsAboutToBeRemoved(int,int)));
            connect(m_dataIndex, SIGNAL(keyboardLayoutsRemoved()), SLOT(onResourceRemoved()));
        }

        for (int i = 0; i < dataIndex->courseCount(); i++)
        {
            connectToCourse(dataIndex->course(i));
        }

        for (int i = 0; i < dataIndex->keyboardLayoutCount(); i++)
        {
            connectToKeyboardLayout(dataIndex->keyboardLayout(i));
        }

        updateMappings();

        endResetModel();

        emit dataIndexChanged();
    }
}
예제 #4
0
void PhonemeGroupModel::onPhonemeGroupAdded()
{
    updateMappings();
    endInsertRows();
}
void LanguageResourceModel::onLanguageResourceAdded()
{
    updateMappings();
    endInsertRows();
}
예제 #6
0
void ResourceModel::onResourceRemoved()
{
    updateMappings();
    endRemoveRows();
}
예제 #7
0
void ResourceModel::onResourceAdded()
{
    updateMappings();
    endInsertRows();
}