コード例 #1
0
bool TupCommandExecutor::updateLipSync(TupLayerResponse *response)
{
    #ifdef K_DEBUG
        QString msg = "TupCommandExecutor::updateLipSync() - Updating lipsync...";
        #ifdef Q_OS_WIN32
            qWarning() << msg;
        #else
            tWarning() << msg;
        #endif
    #endif

    int scenePos = response->sceneIndex();
    QString xml = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLipSync *lipsync = new TupLipSync();
    lipsync->fromXml(xml);
    if (scene->updateLipSync(lipsync)) {
        emit responsed(response);
        return true;
    }

    return false;
}
コード例 #2
0
bool TupCommandExecutor::removeLipSync(TupLayerResponse *response)
{
    #ifdef K_DEBUG
        QString msg = "TupCommandExecutor::removeLipSync() - Adding lipsync...";
        #ifdef Q_OS_WIN32
            qWarning() << msg;
        #else
            tWarning() << msg;
        #endif
    #endif

    int scenePos = response->sceneIndex();
    QString name = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    if (scene->removeLipSync(name)) {
        emit responsed(response);
        return true;
    }

    return false;
}
コード例 #3
0
bool TupCommandExecutor::addLipSync(TupLayerResponse *response)
{
    #ifdef K_DEBUG
        QString msg = "TupCommandExecutor::addLipSync() - Adding lipsync...";
        #ifdef Q_OS_WIN32
            qWarning() << msg;
        #else
            tWarning() << msg;
        #endif
    #endif

    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    QString xml = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        TupLipSync *lipsync = new TupLipSync();
        lipsync->fromXml(xml);
        layer->addLipSync(lipsync);

        emit responsed(response);
        return true;
    }

    return false;
}
コード例 #4
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
bool TupProject::resetScene(int pos, const QString &newName)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN
            qDebug() << "[TupProject::resetScene()]";
        #else
            T_FUNCINFO;
        #endif
    #endif
   
    TupScene *scene = sceneAt(pos);
    if (scene) {
        k->undoScenes << k->scenes.takeAt(pos);

        TupScene *basic = new TupScene(this, k->dimension, "#ffffff");
        basic->setSceneName(newName);
        basic->setBasicStructure();
        k->scenes.insert(pos, basic);

        return true;
    } else {
        #ifdef K_DEBUG
            QString msg = "TupProject::resetScene() - No scene at index -> " + QString::number(pos);
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif
    }

    return false;
}
コード例 #5
0
bool TupCommandExecutor::insertSymbolIntoFrame(TupLibraryResponse *response)
{
#ifdef K_DEBUG
    tFatal() << "TupCommandExecutor::insertSymbolIntoFrame() - Adding symbol to project: " << response->arg().toString();
#endif


    if (m_project->scenesTotal() > 0) {
        if (m_project->insertSymbolIntoFrame(response->spaceMode(), response->arg().toString(),
                                             response->sceneIndex(), response->layerIndex(), response->frameIndex())) {
            TupScene *scene = m_project->scene(response->sceneIndex());
            if (scene) {
                TupLayer *layer = scene->layer(response->layerIndex());
                if (layer) {
                    TupFrame *frame = layer->frame(response->frameIndex());
                    if (frame)
                        response->setFrameState(frame->isEmpty());
                }
            }
            emit responsed(response);
            return true;
        }
    } else {
#ifdef K_DEBUG
        tError() << "TupCommandExecutor::insertSymbolIntoFrame() - No scenes available!";
#endif
    }

    return false;
}
コード例 #6
0
bool TupCommandExecutor::createFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::createFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif

    int scenePosition = response->sceneIndex();
    int layerPosition = response->layerIndex();
    int position = response->frameIndex();
    QString name = response->arg().toString();

    // QString state = response->state();
    
    TupScene *scene = m_project->scene(scenePosition);
    
    if (!scene) 
        return false;

    scene->insertStoryBoardScene(position);
    
    TupLayer *layer = scene->layer(layerPosition);
    
    if (layer) {
        TupFrame *frame = layer->createFrame(name, position);
        
        if (!frame)
            return false;
       
        /* 
        if (!name.isEmpty()) {
            #ifdef K_DEBUG
                tDebug("items") << name;
            #endif
            frame->setFrameName(name);
        } else {
            response->setArg(frame->frameName());
        }
        */

        response->setArg(frame->frameName());
        response->setFrameIndex(layer->visualIndexOf(frame));

        emit responsed(response);

        /* SQA: Check if this code is really necessary
        if (!state.isEmpty()) {
            frame->fromXml(state);
            response->setArg(frame->frameName());
        }
        */

        return true;
    }
    
    return false;
}
コード例 #7
0
bool TupCommandExecutor::moveLayer(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    int newPosition = response->arg().toInt();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    if (! scene->moveLayer(position, newPosition)) {
        #ifdef K_DEBUG
            QString msg = "TupCommandExecutor::moveLayer() - Error while moving layer!";
            #ifdef Q_OS_WIN32
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif	
        return false;
    } else {
        emit responsed(response);
        return true;
    }

    return false;
}
コード例 #8
0
bool TupCommandExecutor::removeLayer(TupLayerResponse *response)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    int scenePos = response->sceneIndex();
    int position = response->layerIndex();

    TupScene *scene = m_project->scene(scenePos);

    if (scene) {
        TupLayer *layer = scene->layer(position);
        if (layer) {
            QDomDocument document;
            document.appendChild(layer->toXml(document));
            response->setState(document.toString());
            response->setArg(layer->layerName());

            if (scene->removeLayer(position)) {
                emit responsed(response);
                return true;
            } 
        } 
    }

    return false;
}
コード例 #9
0
bool TupCommandExecutor::setFrameVisibility(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    bool view = response->arg().toBool();
    
    TupScene *scene = m_project->scene(scenePos);
    
    if (!scene)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        TupFrame *frame = layer->frame(position);
        
        if (! frame) 
            return false;
        
        frame->setVisible(view);
        emit responsed(response);

        return true;
    }
    
    return false;
}
コード例 #10
0
bool TupCommandExecutor::resetFrame(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
   
    TupScene *scene = m_project->scene(scenePos);
   
    if (scene) {
        scene->resetStoryBoardScene(position);
        TupLayer *layer = scene->layer(layerPos);
        if (layer) {
            TupFrame *frame = layer->frame(position);
            if (frame) {
                /*
                QDomDocument doc;
                doc.appendChild(frame->toXml(doc));
                response->setArg(frame->frameName());
                */
                if (layer->resetFrame(position)) {
                    //response->setState(doc.toString(0));
                    emit responsed(response);

                    return true;
                }
            }
        }
    }
   
    return false;
}
コード例 #11
0
bool TupCommandExecutor::removeSymbolFromFrame(TupLibraryResponse *response)
{
#ifdef K_DEBUG
    T_FUNCINFO;
#endif

    if (m_project->scenesTotal() > 0) {
        if (m_project->removeSymbolFromFrame(response->arg().toString(), response->symbolType())) {
            TupScene *scene = m_project->scene(response->sceneIndex());
            if (scene) {
                TupLayer *layer = scene->layer(response->layerIndex());
                if (layer) {
                    TupFrame *frame = layer->frame(response->frameIndex());
                    if (frame)
                        response->setFrameState(frame->isEmpty());
                }
            }
            emit responsed(response);
            return true;
        } else {
#ifdef K_DEBUG
            tError() << "TupCommandExecutor::removeSymbolFromFrame() - Error: Symbol can't be removed from project!";
#endif
        }
    } else {
#ifdef K_DEBUG
        tError() << "TupCommandExecutor::removeSymbolFromFrame() - No scenes available!";
#endif
    }

    return false;
}
コード例 #12
0
bool TupCommandExecutor::exchangeFrame(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    int newPosition = response->arg().toInt();
    TupScene *scene = m_project->scene(scenePos);
   
    if (!scene)
        return false;
  
    scene->moveStoryBoardScene(position, newPosition);
    TupLayer *layer = scene->layer(layerPos);
   
    if (layer) {
        if (layer->exchangeFrame(position, newPosition)) {
            emit responsed(response);
            return true;
        } else {
            #ifdef K_DEBUG
                QString msg = "TupCommandExecutor::exchangeFrame() - Error while exchanging frames";
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif  
            return false;
        }
    }
   
    return false;
}
コード例 #13
0
bool TupCommandExecutor::renameLayer(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    QString newName = response->arg().toString();

    #ifdef K_DEBUG
           tWarning() << "Renamed layer: " << newName;
    #endif

    QString oldName;

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        QString current = layer->layerName();
        layer->setLayerName(newName);

        emit responsed(response);
        response->setArg(current);

        return true;
    }

    return false;
}
コード例 #14
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
void TupProject::setBgColor(const QColor color)
{
    k->bgColor = color;

    int totalScenes = k->scenes.size();
    for (int i = 0; i < totalScenes; i++) {
         TupScene *scene = k->scenes.at(i);
         scene->setBgColor(color);
    }
}
コード例 #15
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
QString TupProject::recoverScene(int pos) const
{
    TupScene *scene = k->undoScenes.takeLast();
    if (scene) {
        k->scenes[pos] = scene;
        return scene->sceneName();
    }

    return "";
}
コード例 #16
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
bool TupProject::removeSymbolFromFrame(const QString &name, TupLibraryObject::Type type)
{
    #ifdef K_DEBUG
        QString msg = "TupProject::removeSymbolFromFrame() - Removing symbol " + name + " from project...";
        #ifdef Q_OS_WIN
            qDebug() << msg;
        #else
            T_FUNCINFO << msg;
        #endif
    #endif
    
    if (type == TupLibraryObject::Folder)
        return true;

    int totalScenes = k->scenes.size(); 
    for (int i = 0; i < totalScenes; i++) {
         TupScene *scene =  k->scenes.at(i);
         int totalLayers = scene->layers().size();
         for (int j = 0; j < totalLayers; j++) {
              TupLayer *layer = scene->layers().at(j);
              int totalFrames = layer->frames().size(); 
              for (int t = 0; t < totalFrames; t++) {
                   TupFrame *frame = layer->frames().at(t);
                   if (type != TupLibraryObject::Svg)
                       frame->removeImageItemFromFrame(name);
                   else
                       frame->removeSvgItemFromFrame(name);
              }
         }

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->removeSvgItemFromFrame(name);
                 else
                     frame->removeImageItemFromFrame(name);
             }

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->removeSvgItemFromFrame(name);
                 else
                     frame->removeImageItemFromFrame(name);
             }
         }
    }

    // k->library->removeObject(name, true);

    return true;
}
コード例 #17
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
/**
 * This function closes project 
 */
void TupProject::clear()
{
    for (int i=0; i<k->scenes.count(); i++) {
         TupScene *scene = k->scenes.takeAt(i);
         scene->clear();
         delete scene;
         scene = NULL;
    }

    k->scenes.clear();
    k->sceneCounter = 0;

    // deleteDataDir(k->cachePath);
}
コード例 #18
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
bool TupProject::removeSymbol(const QString &name, TupLibraryObject::Type type)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN
            qDebug() << "[TupProject::removeSymbol()]";
        #else
            T_FUNCINFO;
        #endif
    #endif    
    
    int totalScenes = k->scenes.size();
    for (int i = 0; i < totalScenes; i++) {
         TupScene *scene = k->scenes.at(i);

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->removeImageItemFromFrame(name);
                 else
                     frame->removeSvgItemFromFrame(name);
             } 

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->removeImageItemFromFrame(name);
                 else
                     frame->removeSvgItemFromFrame(name);
             }
         }

         int totalLayers = scene->layers().size();
         for (int j = 0; j < totalLayers; j++) {
              TupLayer *layer = scene->layers().at(j);
              int totalFrames = layer->frames().size();
              for (int t = 0; t < totalFrames; t++) {
                   TupFrame *frame = layer->frames().at(t);
                   if (type != TupLibraryObject::Svg)
                       frame->removeImageItemFromFrame(name);
                   else
                       frame->removeSvgItemFromFrame(name);
              }
         }
    }

    return k->library->removeObject(name, true);
}
コード例 #19
0
ファイル: tupcommandexecutor.cpp プロジェクト: hpsaturn/tupi
bool TupCommandExecutor::resetScene(TupSceneResponse *response)
{
    int position = response->sceneIndex();
    QString name = response->arg().toString();
    TupScene *scene = m_project->scene(position);

    if (!scene)
        return false;

    scene->reset(name);

    emit responsed(response);

    return true;
}
コード例 #20
0
ファイル: tupcommandexecutor.cpp プロジェクト: hpsaturn/tupi
bool TupCommandExecutor::setSceneVisibility(TupSceneResponse *response)
{
    int position = response->sceneIndex();
    bool view = response->arg().toBool();
    
    TupScene *scene = m_project->scene(position);
    
    if (!scene)
        return false;
    
    scene->setVisible(view);
    
    emit responsed(response);
    
    return true;
}
コード例 #21
0
ファイル: tupcommandexecutor.cpp プロジェクト: hpsaturn/tupi
bool TupCommandExecutor::renameScene(TupSceneResponse *response)
{
    int position = response->sceneIndex();
    QString newName = response->arg().toString();
    TupScene *scene = m_project->scene(position);

    if (!scene)
        return false;
    
    // TupProjectRequest request = TupRequestBuilder::createSceneRequest(position, TupProjectRequest::Rename, newName);
    
    scene->setSceneName(newName);
    
    emit responsed(response);

    return true;
}
コード例 #22
0
bool TupCommandExecutor::selectFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::selectFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	
	
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    // bool prioritary = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene || scenePos < 0 || position < 0)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        if (position < layer->framesTotal()) {
            TupFrame *frame = layer->frame(position);
            if (! frame) 
                return false;
        
            emit responsed(response);
            return true;
        } else {
            #ifdef K_DEBUG
                QString msg = "TupCommandExecutor::selectFrame() - Invalid frame index -> " + QString::number(position);
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif
            return false;
        }
    } 
    
    return false;
}
コード例 #23
0
bool TupCommandExecutor::createLayer(TupLayerResponse *response)
{	
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::createLayer()]";
        #else
            T_FUNCINFO;
        #endif
    #endif

    int scenePosition = response->sceneIndex();
    int position = response->layerIndex();

    QString name = response->arg().toString();
    QString state = response->state();

    TupScene *scene = m_project->scene(scenePosition);

    if (scene) {
        TupLayer *layer = scene->createLayer(name, position);

        if (! layer) 
            return false;

        /*
        if (!name.isEmpty())
            layer->setLayerName(name);
        else
            response->setArg(layer->layerName());
        */

        layer->setLayerName(name);

        // response->setArg(layer->layerName());
        // layer->fromXml(state);
        // m_project->updateScene(scenePosition, scene);

        emit responsed(response);

        return true;
    }

    return false;
}
コード例 #24
0
bool TupCommandExecutor::renameFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::renameFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	

    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    QString newName= response->arg().toString();

    QString oldName;
    
    TupScene *scene = m_project->scene(scenePos);
    
    if (!scene)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        TupFrame *frame = layer->frame(position);
        
        if (! frame) 
            return false;
        
        oldName = frame->frameName();

        if (oldName.compare(newName) != 0)
            frame->setFrameName(newName);
        
        emit responsed(response);

        return true;
    }
    
    return false;
}
コード例 #25
0
ファイル: tupcommandexecutor.cpp プロジェクト: hpsaturn/tupi
bool TupCommandExecutor::lockScene(TupSceneResponse *response)
{
    int position = response->sceneIndex();
    bool lock = response->arg().toBool();

    #ifdef K_DEBUG
        tWarning() << "Lock scene: " << lock;
    #endif    

    TupScene *scene = m_project->scene(position);
    
    if (!scene)
        return false;
    
    scene->setLocked(lock);
    
    emit responsed(response);

    return true;
}
コード例 #26
0
bool TupCommandExecutor::lockLayer(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    bool lock = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        layer->setLocked(lock);
        emit responsed(response);
        return true;
    }

    return false;
}
コード例 #27
0
bool TupCommandExecutor::pasteFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::pasteFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	
	
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    QString copyFrame = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);
    if (scene) {
        TupLayer *layer = scene->layer(layerPos);
        if (layer) {
            TupFrame *frame = layer->frame(position);
            if (frame) {
                QString name = frame->frameName();
                
                QDomDocument doc;
                doc.appendChild(frame->toXml(doc));
                response->setArg(doc.toString(0));
                frame->clear();
                frame->fromXml(copyFrame);
                frame->setFrameName(name);

                response->setFrameState(frame->isEmpty());
                emit responsed(response);

                return true;
            }
        }
    }

    return false;
}
コード例 #28
0
ファイル: tupproject.cpp プロジェクト: xtingray/tupi
bool TupProject::updateSymbolId(TupLibraryObject::Type type, const QString &oldId, const QString &newId)
{
    int scenesCount = k->scenes.size();
    for (int i = 0; i < scenesCount; i++) {
         TupScene *scene = k->scenes.at(i);
         int layersCount = scene->layers().size();
         for (int j = 0; j < layersCount; j++) {
              TupLayer *layer = scene->layers().at(j);
              int framesCount = layer->frames().size();  
              for (int t = 0; t < framesCount; t++) {
                   TupFrame *frame = layer->frames().at(t); 
                   if (type != TupLibraryObject::Svg)
                       frame->updateIdFromFrame(oldId, newId);
                   else 
                       frame->updateSvgIdFromFrame(oldId, newId);
              }
         }

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->updateIdFromFrame(oldId, newId);
                 else
                     frame->updateSvgIdFromFrame(oldId, newId);
             }

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->updateIdFromFrame(oldId, newId);
                 else
                     frame->updateSvgIdFromFrame(oldId, newId);
             }
         }
    }

    return true;
}
コード例 #29
0
ファイル: nodestool.cpp プロジェクト: xtingray/tupi
TupFrame* NodesTool::currentFrame()
{
    TupFrame *frame = 0;
    if (k->scene->spaceContext() == TupProject::FRAMES_EDITION) {
        frame = k->scene->currentFrame();
        k->currentLayer = k->scene->currentLayerIndex();
        k->currentFrame = k->scene->currentFrameIndex();
    } else {
        k->currentLayer = -1;
        k->currentFrame = -1;

        TupScene *tupScene = k->scene->scene();
        TupBackground *bg = tupScene->background();
        if (k->scene->spaceContext() == TupProject::STATIC_BACKGROUND_EDITION) {
            frame = bg->staticFrame();
        } else if (k->scene->spaceContext() == TupProject::DYNAMIC_BACKGROUND_EDITION) {
                   frame = bg->dynamicFrame();
        }
    }

    return frame;
}
コード例 #30
0
bool TupCommandExecutor::setLayerVisibility(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    bool view = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        layer->setVisible(view);
        responsed(response);

        return true;
    }

    return false;
}