Beispiel #1
0
bool TSqlObject::remove()
{
    syncToSqlRecord();
    QString del = TActionContext::currentDatabase().driver()->sqlStatement(QSqlDriver::DeleteStatement, tableName(), *static_cast<QSqlRecord *>(this), false);
    
    if (del.isEmpty()) {
        sqlError = QSqlError(QLatin1String("Unable to delete row"),
                             QString(), QSqlError::StatementError);
        return false;
    }

    del.append(" WHERE ");
    int revIndex = metaObject()->indexOfProperty(REVISION_PROPERTY_NAME);
    if (revIndex >= 0) {
        bool ok;
        int revsion = property(REVISION_PROPERTY_NAME).toInt(&ok);
        if (!ok || revsion <= 0) {
            sqlError = QSqlError(QLatin1String("Unable to convert the 'revision' property to an int"),
                                 QString(), QSqlError::UnknownError);
            tError("Unable to convert the 'revsion' property to an int, %s", qPrintable(objectName()));
            return false;
        }

        del.append(TSqlQuery::escapeIdentifier(REVISION_PROPERTY_NAME));
        del.append("=").append(TSqlQuery::formatValue(revsion));
        del.append(" AND ");
    }

    const char *pkName = metaObject()->property(metaObject()->propertyOffset() + primaryKeyIndex()).name();
    if (primaryKeyIndex() < 0 || !pkName) {
        QString msg = QString("Not found the primary key for table ") + tableName();
        sqlError = QSqlError(msg, QString(), QSqlError::StatementError);
        tError("%s", qPrintable(msg));
        return false;
    }
    del.append(TSqlQuery::escapeIdentifier(pkName));
    del.append("=").append(TSqlQuery::formatValue(property(pkName)));

    tSystemDebug("SQL statement: %s", qPrintable(del));
    QSqlQuery query(TActionContext::currentDatabase());
    bool res = query.exec(del);
    sqlError = query.lastError();
    if (!res) {
        tSystemError("SQL delete error: %s", qPrintable(sqlError.text()));
        return false;
    }
    
    // Optimistic lock check
    if (query.numRowsAffected() != 1) {
        if (revIndex >= 0) {
            QString msg = QString("Row was updated or deleted from table ") + tableName() + QLatin1String(" by another transaction");
            sqlError = QSqlError(msg, QString(), QSqlError::UnknownError);
            throw SqlException(msg, __FILE__, __LINE__);
        }
        tWarn("Row was deleted by another transaction, %s", qPrintable(tableName()));
    }

    clear();
    return true;
}
Beispiel #2
0
void TConfig::init()
{
    QFile config(k->path);
    k->isOk = false;

    if (config.exists()) {
        QString errorMsg = "";
        int errorLine = 0;
        int errorColumn = 0;

        k->isOk = k->document.setContent(&config, &errorMsg, &errorLine, &errorColumn);

        if (!k->isOk) {
            #ifdef K_DEBUG 
                   tError() << "TConfig::init() - Fatal Error: Configuration file is corrupted - Line: " << errorLine << " - Column: " << errorColumn;
                   tError() << "TConfig::init() - Message: " << errorMsg;
            #endif
        }

        config.close();
   }

   if (!k->isOk) {
       QDomProcessingInstruction header = k->document.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\"");
       k->document.appendChild(header);

       QDomElement root = k->document.createElement("Config");
       k->document.appendChild(root);
   }
}
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;
}
bool TasksetWriter::write(const std::string& filename, vector<Task*>& taskset) const {
    xmlDocPtr doc;
    tDebug() << "Writing Taskset to XML file: " << filename;

    xmlTextWriterPtr writer;
    writer = xmlNewTextWriterDoc(&doc, 0);
    xmlTextWriterSetIndent(writer, 1);
    if (xmlTextWriterSetIndentString(writer, (const xmlChar*) "  ") != 0) {
        tError() << "Fehler beim Setzen des Einrueckens!";
    }

    xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);

    xmlTextWriterWriteComment(writer, (xmlChar*) "Hier kommen die Tasks");

    xmlTextWriterStartElement(writer, (xmlChar*) "taskset");
    xmlTextWriterWriteAttributeNS(writer, (xmlChar*) "xsi", (xmlChar*) "schemaLocation", (xmlChar*) "http://www.w3.org/2001/XMLSchema-instance", (xmlChar*) "http://www.tmsxmlns.com taskset.xsd");
    xmlTextWriterWriteAttribute(writer, (xmlChar*) "xmlns", (xmlChar*) "http://www.tmsxmlns.com");

    xmlTextWriterWriteRaw(writer, (xmlChar*) "\n");

    for (size_t i = 0; i < taskset.size(); i++) {
        xmlTextWriterWriteRaw(writer, (xmlChar*) "\n");
        //taskset[i]->write(writer);
        taskset[i]->writeToXML(writer);
        xmlTextWriterWriteRaw(writer, (xmlChar*) "\n");
    }

    xmlTextWriterEndElement(writer); // close TaskSet

    xmlTextWriterEndDocument(writer);
    xmlFreeTextWriter(writer);
    xmlSaveFile(filename.c_str(), doc);

    xmlNodePtr cur = xmlDocGetRootElement(doc);
    if (cur == NULL) {
        tError() << "Empty document.";
        xmlFreeDoc(doc);
        return false;
    }
    if (xmlStrcmp(cur->name, (const xmlChar *) "taskset")) {
        tError() << "Document of the wrong type, root node != taskset";
        xmlFreeDoc(doc);
        return false;
    }

    if (isValid(doc) > 0) {
        tDebug() << "Written document is valid";

    } else {
        tError() << "Written document is invalid";
        xmlFreeDoc(doc);
        return false;
    }

    xmlFreeDoc(doc);

    return true;

}
Beispiel #5
0
void TupPaintArea::setCurrentScene(int index)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    if (k->project->scenesTotal() > 0) {

        TupScene *scene = k->project->scene(index);
        if (scene) {
            k->currentSceneIndex = index;
            graphicsScene()->setCurrentScene(scene);
        } else {
            if (k->project->scenesTotal() == 1) {
                setDragMode(QGraphicsView::NoDrag);
                k->currentSceneIndex = 0;
                graphicsScene()->setCurrentScene(0);
            } else {
                #ifdef K_DEBUG
                       tError() << "TupPaintArea::setCurrentScene() - [ Fatal Error ] -  No scenes available. Invalid index -> " << index;
                       tError() << "TupPaintArea::setCurrentScene() - Scenes total -> " << k->project->scenesTotal();
                #endif
            }
        }
    }
}
Beispiel #6
0
void TCommandHistory::redoFromAction(QAction *a)
{
    int idx = a->data().toInt();
    
    m_stack->blockSignals(true);
    for (int i = qMax(idx, m_currentIndex)-1; i >= qMin(idx, m_currentIndex)-1; i--) {
         #ifdef K_DEBUG
             QString msg = "TupCommandExecutor::createItem() - Error: Invalid scene index!";
             #ifdef Q_OS_WIN32
                 qDebug() << "SHOW_VAR: " << i;
             #else
                 SHOW_VAR(i);
             #endif
          #endif

         if (!m_stack->canRedo()) {
             #ifdef K_DEBUG
                 QString msg = "TCommandHistory::redoFromAction() - Error: Cannot redo!!!";
                 #ifdef Q_OS_WIN32
                     qDebug() << msg;
                 #else
                     tError() << msg;
                 #endif
             #endif

             break;
         }
        
         m_stack->redo();
        
         if (m_actions.contains(i)) {
             m_redoMenu->removeAction(m_actions[i]);
             m_undoMenu->addAction(m_actions[i]);
         } else {
             #ifdef K_DEBUG
                 QString msg = "TCommandHistory::redoFromAction() - Error while doing REDO";
                 #ifdef Q_OS_WIN32
                     qDebug() << msg;
                 #else
                     tError() << msg;
                 #endif
             #endif
        }
    }
    
    if (m_redoMenu->isEmpty())
        m_redoMenu->menuAction()->setEnabled(false);
    else
        m_redoMenu->menuAction()->setEnabled(true);
    
    if (!m_undoMenu->isEmpty()) 
        m_undoMenu->menuAction()->setEnabled(true);
    
    if (m_actions.contains(m_stack->index()+1))
        m_redoMenu->setDefaultAction(m_actions[m_stack->index()+1]);

    m_stack->blockSignals(false);
}
bool TUrlRoute::addRouteFromString(QString line)
{
    QStringList items = line.split(' ', QString::SkipEmptyParts);

    if (items.count() == 3) {
        // Trimm quotes
        QString method = items[0];
        QString route = THttpUtility::trimmedQuotes(items[1]);
        QString destination = THttpUtility::trimmedQuotes(items[2]);

        TRoute rt;

        rt.method = TRoute::methodFromString(method);

        if (rt.method == TRoute::Invalid)
        {
            tError("Invalid method, '%s'", qPrintable(items[0]));
            return false;
        }

        // parse controller and action
        QStringList list = destination.split('#');
        if (list.count() == 2) {
            rt.controller = list[0].toLower().toLatin1() + "controller";
            rt.action = list[1].toLatin1();
        } else {
            tError("Invalid destination, '%s'", qPrintable(destination));
            return false;
        }

        rt.components = route.split('/');
        if (route.startsWith('/')) rt.components.takeFirst();
        if (route.endsWith('/')) rt.components.takeLast();

        if (rt.components.indexOf(":params") >= 0)
        {
            if (rt.components.indexOf(":params") != rt.components.length() - 1)
            {
                tError("Invalid route: :params must be at the end! [%s]",qPrintable(route));
                return false;
            }
            else
            {
                rt.components.takeLast();
                rt.has_variable_params = 1;
            }
        }

        routes << rt;
        tSystemDebug("added route: method:%d components:%s ctrl:%s action:%s, params:%d",
                     rt.method, qPrintable(rt.components.join('/')), rt.controller.data(),
                     rt.action.data(), rt.has_variable_params);
        return true;
    } else {
        tError("Invalid directive, '%s'", qPrintable(line));
        return false;
    }
}
bool TUrlRoute::addRouteFromString(const QString &line)
{
     QStringList items = line.simplified().split(' ');
     if (items.count() != 3) {
         tError("Invalid directive, '%s'", qPrintable(line));
         return false;
     }

     // Trimm quotes
     items[1] = THttpUtility::trimmedQuotes(items[1]);
     items[2] = THttpUtility::trimmedQuotes(items[2]);
     QString &path = items[1];

     if (path.contains(":params") && !path.endsWith(":params")) {
         tError(":params must be specified as last directive.");
         return false;
     }

     TRoute rt;

     // Check method
     rt.method = directiveHash()->value(items[0].toLower(), TRoute::Invalid);
     if (rt.method == TRoute::Invalid) {
         tError("Invalid directive, '%s'", qPrintable(items[0]));
         return false;
     }

     // parse path
     rt.componentList = splitPath(path);
     rt.hasVariableParams = rt.componentList.contains(":params");

     for (int i = 0; i < rt.componentList.count(); ++i) {
         const QString &c = rt.componentList[i];
         if (c.startsWith(":")) {
             if (c != ":param" && c != ":params") {
                 return false;
             }
         } else {
             rt.keywordIndexes << i;
         }
     }

     // parse controller and action
     QStringList list = items[2].split('#');
     if (list.count() == 2) {
         rt.controller = list[0].toLower().toLatin1() + "controller";
         rt.action = list[1].toLatin1();
     } else {
         tError("Invalid action, '%s'", qPrintable(items[2]));
         return false;
     }

     routes << rt;
     tSystemDebug("route: method:%d path:%s  ctrl:%s action:%s params:%d",
                  rt.method, qPrintable(QLatin1String("/") + rt.componentList.join("/")), rt.controller.data(),
                  rt.action.data(), rt.hasVariableParams);
     return true;
}
Beispiel #9
0
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;
}
Beispiel #10
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;
}
Beispiel #11
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;
}
  int MKTask::calcL(int n, const unsigned int* vals, unsigned int pos) const {
    if (n > k) {
      tError() << "Invalid parameter n=" << n << " > " << k << "!";
      return -1;
    }
    unsigned int p;
    if (pos == 0)
      p = k - 1;
    else
      p = pos - 1;

    unsigned int ctr = 0;
    unsigned int i;
    for (i = 0; i < k; ++i) {
      if (vals[p] == 1)
	ctr++;
      if (ctr == n)
	break;

      if (p == 0)
	p = k - 1;
      else
	--p;
    }
    return i + 1;
  }
Beispiel #13
0
bool ThemeManager::applyTheme(const ThemeDocument &kd)
{
    // tDebug() << "Applying theme" << endl;

    bool ok = false;
    QXmlSimpleReader reader;
    reader.setContentHandler(this);
    reader.setErrorHandler(this);
    QXmlInputSource xmlsource;
    xmlsource.setData(kd.toString());

    if (reader.parse(&xmlsource)) {
        ok = true;
    } else {
        #ifdef K_DEBUG
            QString msg = "ThemeManager::applyTheme() - Fatal Error: Can't process theme document";
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif

        ok = false;
    }
    
    return ok;
}
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;
}
/*!
  \~english
  Returns the rendering data of the partial template given by \a templateName.

  \~japanese
  部分テンプレート \a templateName に変数 \a vars を設定した描画データを返す
*/
QString TActionController::getRenderingData(const QString &templateName, const QVariantHash &vars)
{
    T_TRACEFUNC("templateName: %s", qPrintable(templateName));

    // Creates view-object
    QStringList names = templateName.split("/");
    if (names.count() != 2) {
        tError("Invalid patameter: %s", qPrintable(templateName));
        return QString();
    }

    TDispatcher<TActionView> viewDispatcher(viewClassName(names[0], names[1]));
    TActionView *view = viewDispatcher.object();
    if (!view) {
        return QString();
    }

    QVariantHash hash = allVariants();
    for (QHashIterator<QString, QVariant> i(vars); i.hasNext(); ) {
        i.next();
        hash.insert(i.key(), i.value()); // item's value of same key is replaced
    }

    view->setController(this);
    view->setVariantHash(hash);
    return view->toString();  
}
Beispiel #16
0
void TupNetSocket::readed(const QString &readed)
{
    #ifdef K_DEBUG
        QString msg = "TupNetSocket::readed() - PACKAGE ARRIVING: ";
        #ifdef Q_OS_WIN32
            qWarning() << msg;
            qWarning()  << readed;
        #else
            tWarning() << msg;
            tWarning("net")  << readed;
        #endif
    #endif

    QDomDocument doc;
    
    if (doc.setContent(readed)) {
        QString root = doc.documentElement().tagName();
        m_handler->handlePackage(root, readed);
    } else {
        #ifdef K_DEBUG
            QString msg = "TupNetSocket::readed() - Error: Package isn't a DOM document";
            #ifdef Q_OS_WIN32
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif
    }
}
Beispiel #17
0
bool ThemeManager::applyTheme(const QString &file)
{
    bool ok = false;
    QXmlSimpleReader reader;
    reader.setContentHandler(this);
    reader.setErrorHandler(this);
    QFile f(file);
    QXmlInputSource xmlsource(&f);

    if (reader.parse(&xmlsource)) {
        ok = true;
    } else {
        #ifdef K_DEBUG
            QString msg = "ThemeManager::applyTheme() - Fatal Error: Can't process the theme file: " + file;
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif

        ok = false;
    }
    
    return ok;
}
Beispiel #18
0
TConfig::TConfig() : QObject(), k(new Private)
{
    #ifdef K_DEBUG
           TINIT;
    #endif
	
    #ifdef Q_WS_X11
           k->configDirectory.setPath(QDir::homePath() + "/." + QCoreApplication::applicationName());
    #elif defined(Q_WS_WIN)
                  k->configDirectory.setPath(QDir::homePath() + "/" + QCoreApplication::applicationName());
    #elif defined(Q_WS_MAC)
                  k->configDirectory.setPath(QDir::homePath() + "/." + QCoreApplication::applicationName());
    #endif

    if (!k->configDirectory.exists()) {
        k->firstTime = true;
        #ifdef K_DEBUG
               tWarning() << "*** TConfig::TConfig() - Config file doesn't exist. Creating path: " << k->configDirectory.path();
        #endif

        if (!k->configDirectory.mkdir(k->configDirectory.path())) {
            #ifdef K_DEBUG
                   tError() << "TConfig::TConfig() - Fatal Error: Can't create path -> " << k->configDirectory.path();
            #endif
        }
    } else {
        k->firstTime = false;
    }

    k->path = k->configDirectory.path() + "/" + QCoreApplication::applicationName().toLower() + ".cfg";
    init();
}
Beispiel #19
0
bool TupProject::createSymbol(int type, const QString &name, const QByteArray &data, const QString &folder)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN
            qDebug() << "[TupProject::createSymbol()]";
        #else
            T_FUNCINFOX("symbol");
        #endif
    #endif
   
    if (!k->isOpen) {        
        #ifdef K_DEBUG
            QString msg = "TupProject::createSymbol() - Fatal error: project is NOT open!";
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif
        
        return false;
    }

    if (k->library->createSymbol(TupLibraryObject::Type(type), name, data, folder) == 0) {
        #ifdef K_DEBUG
            QString msg = "TupProject::createSymbol() - Fatal error: object can't be created. Data is NULL!";
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif    

        return false;
    }         

    #ifdef K_DEBUG
        QString msg = "TupProject::createSymbol() - Object added successfully -> " + name;
        #ifdef Q_OS_WIN
            qWarning() << msg;
        #else
            tWarning() << msg;
        #endif
    #endif    

    return true;
}
Beispiel #20
0
bool ThemeManager::error(const QXmlParseException &exception)
{
    #ifdef K_DEBUG
        QString msg = "ThemeManager::error() - Fatal Error: Can't process theme!";
        #ifdef Q_OS_WIN
            qDebug() << msg;
            qDebug() << "ThemeManager::error() - Message: " << exception.message();
        #else
            tError() << msg;
            tError() << "ThemeManager::error() - Message: " << exception.message();
        #endif
    #else
        Q_UNUSED(exception);
    #endif

    return false;
}
Beispiel #21
0
void TCommandHistory::undoFromAction(QAction *a)
{
    int idx = a->data().toInt();
    m_stack->blockSignals(true);

    for (int i = qMin(idx, m_currentIndex); i < qMax(idx, m_currentIndex); i++) {
        if (!m_stack->canUndo()) {
            #ifdef K_DEBUG
                QString msg = "TCommandHistory::undoFromAction() - Error: Cannot undo!!!";
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif
            break;
        }
        
        m_stack->undo();
        
        if (m_actions.contains(i)) {
            m_undoMenu->removeAction(m_actions[i]);
            m_redoMenu->addAction(m_actions[i]);
        } else {
            #ifdef K_DEBUG
                QString msg = "TCommandHistory::undoFromAction() - Error: History item not found!";
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif
        }
    }
    
    if (m_undoMenu->isEmpty()) 
        m_undoMenu->menuAction()->setEnabled(false);
    else 
        m_undoMenu->menuAction()->setEnabled(true);
    
    if (!m_redoMenu->isEmpty()) 
        m_redoMenu->menuAction()->setEnabled(true);
    
    m_undoMenu->setDefaultAction(m_actions[m_stack->index()]);
    m_stack->blockSignals(false);
}
void TScheduler::start(int msec)
{
    if (Tf::app()->multiProcessingModule() == TWebApplication::Prefork) {
        tError("Unsupported TScheduler in prefork MPM");
        return;
    }

    timer->start(msec);
}
Beispiel #23
0
void TupProjectCommand::redo()
{
    #ifdef K_DEBUG
           T_FUNCINFO << k->response->part();
    #endif    

    if (k->executed) {
        k->response->setMode(TupProjectResponse::Redo);
    } else {
        k->response->setMode(TupProjectResponse::Do);
        k->executed = true;
    }
    
    switch (k->response->part()) {
            case TupProjectRequest::Project:
            {
                 #ifdef K_DEBUG
                        tDebug() << "Project response isn't handle";
                 #endif
            }
            break;
            case TupProjectRequest::Frame:
            {
                 frameCommand();
            }
            break;
            case TupProjectRequest::Layer:
            {
                 layerCommand();
            }
            break;
            case TupProjectRequest::Scene:
            {
                 sceneCommand();
            }
            break;
            case TupProjectRequest::Item:
            {
                 itemCommand();
            }
            break;
            case TupProjectRequest::Library:
            {
                 libraryCommand();
            }
            break;
            default:
            {
                 #ifdef K_DEBUG
                        tError() << "TupProjectCommand::redo() - Error: Unknown project response";
                 #endif
            }
            break;
    }
}
Beispiel #24
0
bool ThemeManager::fatalError(const QXmlParseException &exception)
{
    #ifdef K_DEBUG
        QString msg1 = "ThemeManager::error() - Fatal Error: Can't load theme...";
        QString msg2 = "ThemeManager::error() - Line: " + QString::number(exception.lineNumber()) + " Column: " + QString::number(exception.columnNumber());
        QString msg3 = "ThemeManager::error() - Message: " + exception.message();
        #ifdef Q_OS_WIN
            qDebug() << msg1;
            qDebug() << msg2;
            qDebug() << msg3;
        #else
            tError() << msg1;
            tError() << msg2;
            tError() << msg3;
        #endif
    #else
           Q_UNUSED(exception);
    #endif

    return false;
}
  Job* FPPScheduler::dispatch(int now, DispatchStat& dispatchStat) {
    Job* job = ALDScheduler::dispatch(now, dispatchStat);
    const Job* fin = dispatchStat.finished;
    if (fin != NULL) {
      if (fin != dlmon.jobFinished(fin)) {
	tError() << "Finished job " << job << " " << *job << " not found in dlmon!";
      }
      else {
	tDebug() << "Removed finished job " << job << " " << *job << " from dlmon!";
      }
    }
    return job;
  }
Beispiel #26
0
void TupScreen::updateFirstFrame()
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    if (k->currentSceneIndex > -1 && k->currentSceneIndex < k->animationList.count()) {
        TupScene *scene = k->project->scene(k->currentSceneIndex);
        if (scene) { 
            TupAnimationRenderer renderer(k->project->bgColor());
            renderer.setScene(scene, k->project->dimension());
            renderer.renderPhotogram(0);

            QImage firstFrame = QImage(k->project->dimension(), QImage::Format_RGB32);

            QPainter painter(&firstFrame);
            painter.setRenderHint(QPainter::Antialiasing);
            renderer.render(&painter);

            if (k->isScaled) {
                QImage resized = firstFrame.scaledToWidth(k->screenDimension.width(), Qt::SmoothTransformation);
                k->renderCamera = resized;
            } else {
                k->renderCamera = firstFrame;
            }

            k->firstShoot = true;
        } else {
            #ifdef K_DEBUG
                   tError() << "TupScreen::updateFirstFrame() - [ Fatal Error ] - Null scene at index: " << k->currentSceneIndex;
            #endif
        }
    } else {
        #ifdef K_DEBUG
               tError() << "TupScreen::updateFirstFrame() - [ Fatal Error ] - Can't access to scene index: " << k->currentSceneIndex;
        #endif
    }
}
Beispiel #27
0
void TVHBox::moveWidgetUp(QWidget *widget)
{
    // dDebug() << "Childs " << children ().count() << endl;
    int position = m_pLayout->indexOf(widget);
    
    // dDebug() << "Position: " << position << endl;
    
    if (position > 0) {
        m_pLayout->removeWidget(widget);
        m_pLayout->insertWidget(position-1, widget);
    } else {
        tError() << "The widget isn't in the layout" << endl;
    }
}
Beispiel #28
0
void TupProjectCommand::paintAreaCommand()
{

    #ifdef K_DEBUG
           tError() << "TupProjectCommand::paintAreaCommand() - Error: FIX ME in ktprojectcommand.cpp";
    #endif

    /*
     if (redo)
         k->executor->reemitEvent(response);
     else
         k->executor->reemitEvent(response);
    */
}
Beispiel #29
0
bool TupPackageHandler::makePackage(const QString &projectPath, const QString &packagePath)
{
    if (!QFile::exists(projectPath)) {
        #ifdef K_DEBUG
               tError() << "TupPackageHandler::makePackage() - Project path doesn't exist -> " << projectPath;
        #endif
        return false;
    }
    
    QFileInfo packageInfo(packagePath);
    QuaZip zip(packagePath);

    if (!zip.open(QuaZip::mdCreate)) {
        #ifdef K_DEBUG
               tError() << "TupPackageHandler::makePackage() - Error while create package: " << zip.getZipError();
        #endif
        return false;
    }

    if (! compress(&zip, projectPath)) {
        #ifdef K_DEBUG
               tError() << "TupPackageHandler::makePackage() - Error while compress project" << zip.getZipError();
        #endif
        return false;
    }
    
    zip.close();

    if (zip.getZipError() != 0) {
        #ifdef K_DEBUG
               tError() << "TupPackageHandler::makePackage() - Error: " << zip.getZipError();
        #endif
        return false;
    }
    
    return true;
}
Beispiel #30
0
void TupProjectCommand::layerCommand()
{
    TupLayerResponse *response = static_cast<TupLayerResponse *>(k->response);
    
    switch (response->action()) {
            case TupProjectRequest::Add:
            {
                 k->executor->createLayer(response);
            }
            break;
            case TupProjectRequest::Remove:
            {
                 k->executor->removeLayer(response);
            }
            break;
            case TupProjectRequest::Move:
            {
                 k->executor->moveLayer(response);
            }
            break;
            case TupProjectRequest::Lock:
            {
                 k->executor->lockLayer(response);
            }
            break;
            case TupProjectRequest::Rename:
            {
                 k->executor->renameLayer(response);
            }
            break;
            case TupProjectRequest::Select:
            {
                 k->executor->selectLayer(response);
            }
            break;
            case TupProjectRequest::View:
            {
                 k->executor->setLayerVisibility(response);
            }
            break;
            default: 
            {
                 #ifdef K_DEBUG
                        tError() << "TupProjectCommand::layerCommand() - Error: Unknown project response";
                 #endif
            }
            break;
    }
}