Example #1
0
QString TupProject::recoverScene(int pos) const
{
    TupScene *scene = k->undoScenes.takeLast();
    if (scene) {
        k->scenes[pos] = scene;
        return scene->sceneName();
    }

    return "";
}
Example #2
0
TupScene *TupProject::createScene(QString name, int position, bool loaded)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN
            qDebug() << "[TupProject::createScene()]";
        #else
            T_FUNCINFO;
        #endif
    #endif

    if (position < 0 || position > k->scenes.count())
        return 0;

    TupScene *scene = new TupScene(this, k->dimension, k->bgColor);
    k->scenes.insert(position, scene);
    k->sceneCounter++;
    scene->setSceneName(name);
    
    if (loaded)
        TupProjectLoader::createScene(scene->sceneName(), position, this);

    return scene;
}
Example #3
0
bool TupCommandExecutor::removeScene(TupSceneResponse *response)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif    

    int position = response->sceneIndex();
    int scenesTotal = m_project->scenesTotal();

    TupScene *toRemove = m_project->scene(position);

    if (toRemove) {
        QDomDocument document;
        document.appendChild(toRemove->toXml(document));
        
        response->setState(document.toString());
        response->setArg(toRemove->sceneName());
        
        if (m_project->removeScene(position)) {

            if (position+1 < scenesTotal) {
                for (int i = position + 1; i < scenesTotal; i++)
                     m_project->moveScene(i, i-1);
            }

            emit responsed(response);

            return true;
        } 
    } else {
        #ifdef K_DEBUG
               tError() << "TupCommandExecutor::removeScene() - Scene doesn't exist (" << position << ")";
        #endif
    }
    
    return false;
}