示例#1
0
void SideBarTask::submitTask()
{
    // On sauvegarde l'index courant
    // car mis à -1 après un model->select()
    int oldIndex = mapper->currentIndex();

    mapper->submit();
    Task::getInstance()->getModel()->submitAll();
    mapper->setCurrentIndex(oldIndex);
    emit isUpdated();
}
示例#2
0
void SideBarTask::submitTask()
{
    // On sauvegarde l'index courant
    // car mis à -1 après un model->select()
    int oldIndex = mapper->currentIndex();

    mapper->submit();
    model->submitAll();
    mapper->setCurrentIndex(oldIndex);

    if(Task::getInstance()->needRefreshView){
        emit needRefresh();
        Task::getInstance()->needRefreshView = false;
    } else {
        emit isUpdated();
    }
}
示例#3
0
void UpdateCheck::fileIsReady( QNetworkReply * reply)
{

    reply->deleteLater();

    if(reply->error() == QNetworkReply::NoError) {
        // Get the http status code
        int v = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
        // Here we got the final reply
        QByteArray replyXml = reply->readAll();
        qDebug()<<replyXml;

        QXmlStreamReader reader(replyXml);
        QString os;
        QString version;
        while (!reader.atEnd()) {

            reader.readNext();
            if (reader.isStartElement()) {
                if (reader.name() == "OperatingSystem")
                {
                    os=reader.readElementText();
                    //qDebug()<<p;
                }
                if (reader.name() == "StableVersion")
                {
                    version=reader.readElementText();

                }
                if (reader.name() == "ReleaseNotes")
                {
                    QString relNotes=reader.readElementText();
                    QStringList vList;
                    vList.append(version);
                    vList.append(relNotes);
                    mapVersions.insert(os,vList);
                }
            }

        }
    }
    else
    {
        // Error
        qDebug()<<reply->errorString();
        if (reply->errorString()=="Host  not found")
            emit NetworkError("Host  not found");


    }

    reply->manager()->deleteLater();


#ifdef Q_OS_WIN
    QString latestVersion;
    QString myVersion=Version::stable();
    if (mapVersions["Windows"].count()>0)
        latestVersion= mapVersions["Windows"].at(0);
    bool bUpdateAvail=isUpdated(latestVersion,myVersion);
    if(mapVersions["Windows"].count()>1)
        emit gotUpdateChkResponse(bUpdateAvail,mapVersions["Windows"].at(0),mapVersions["Windows"].at(1));

#endif
#ifdef Q_OS_LINUX
    QString latestVersion;
    QString myVersion=Version::stable();
    if (mapVersions["Linux"].count()>0)
        latestVersion= mapVersions["Linux"].at(0);
    bool bUpdateAvail=isUpdated(latestVersion,myVersion);

    if(mapVersions["Linux"].count()>1)
        emit gotUpdateChkResponse(bUpdateAvail,mapVersions["Linux"].at(0),mapVersions["Linux"].at(1));

# endif

    if( bUpdateAvail)
            _stableVersion=latestVersion;

}
示例#4
0
 const Matrix4& Transform::getInverse() const {
     if(!isUpdated()) {
         update();
     }
     return mCachedInverse;
 }
示例#5
0
 const Matrix4& Transform::getMatrix() const {
     if(!isUpdated()) {
         update();
     }
     return mCachedMatrix;
 }
示例#6
0
 const Matrix4& Camera::getViewMatrix() {
     if(!isUpdated()) {
         update();
     }
     return mView;
 }
示例#7
0
 const Matrix4& Camera::getWorldMatrix() {
     if(!isUpdated()) {
         update();
     }
     return mWorld;
 }
示例#8
0
文件: main.cpp 项目: Baltasarq/cp3mm
int main(int argc, const char * argv[])
{
    std::string inputFileName;
    std::auto_ptr<Cp3mm::Parser::Cp3Parser> parser;
    bool force = false;
    bool help = false;
    bool version = false;
    bool verbose = false;
    unsigned int firstArg = 1;
    Cp3mm::Tds::Entity::Strictness strictness = Cp3mm::Tds::Entity::MediumStrictness;

    try {
        // Welcome
        printf( "%s", Cp3mm::AppInfo::TitleMessage.c_str() );
        printf( " (%s %s)\n\n", Cp3mm::AppInfo::Name.c_str(), Cp3mm::AppInfo::Version.c_str() );

        // Explore and answer command-line options
        processOptions( firstArg, argv, argc, force, help, version, verbose, strictness );

        if ( version ) {
            printf( "%s (%s) by %s - %s\n\n",
                    Cp3mm::AppInfo::Name.c_str(), Cp3mm::AppInfo::Version.c_str(),
                    Cp3mm::AppInfo::Author.c_str(), Cp3mm::AppInfo::Copyright.c_str()
            );
            goto End;
        }

        if ( help ) {
            printf( "%s\n", MsgHelp.c_str() );
            goto End;
        }

        // Report, if needed
        if ( strictness == Cp3mm::Tds::Entity::ErroneousStrictness ) {
            strictness = Cp3mm::Tds::Entity::MediumStrictness;
        }

        if ( verbose ) {
            printf( "Force: %s\tStrict level: %s\n\n",
                    force? "yes" : "no",
                    Cp3mm::Tds::Entity::cnvtStrictnessToString( strictness ).c_str()
            );
        }

        // Process parameter
        if ( argc == 2 ) {
            inputFileName = argv[ firstArg ];

            // Only process it provided it has the correct extension
            if ( Cp3mm::AppInfo::isAcceptedExt( FileMan::getExt( inputFileName ) ) )
            {
                // Open input file
                InputFile inputFile( inputFileName );

                // Prepare output file names
                std::string outputHeaderName = FileMan::replaceExt( inputFileName, Cp3mm::AppInfo::CHeaderFilesExt );
                std::string outputImplName   = FileMan::replaceExt( inputFileName, Cp3mm::AppInfo::CppFilesExt );
                std::string outputDepsName   = FileMan::replaceExt( inputFileName, Cp3mm::AppInfo::DepFilesExt );

                // Chk if anything really needs to be done
                if ( !force
                  && isUpdated( inputFile, outputHeaderName, outputImplName ) )
                {
                    printf( "Skipping '%s' due to '%s' and '%s' being up to date.\n\n",
                                inputFileName.c_str(),
                                outputHeaderName.c_str(),
                                outputImplName.c_str()
                    );
                    goto End;
                }

                // Open output files
                OutputFile outHeader( outputHeaderName );
                OutputFile outImpl( outputImplName );

                // Process file
                parser.reset(
                    new Cp3mm::Parser::Cp3Parser( inputFile, outHeader, outImpl, strictness )
                );
                printf( "Processing( '%s' )...\n", inputFileName.c_str() );
                parser->process();

                // Finishing
                parser->saveDependenciesToFile( outputDepsName );
                printf( "Done( '%s' ).\n", outputImplName.c_str() );
            }
            else printf( "Skipped( '%s' ).\n", inputFileName.c_str() );
        }
        else throw std::runtime_error( "invalid number of arguments" );
    } catch(const Cp3mm::Parser::ParserError &e) {
        std::string statement = parser->getCurrentLine();
        unsigned int pos = 0;

        if ( parser->getCurrentLex() != NULL ) {
            statement = parser->getCurrentLine();
            pos = parser->getCurrentPos();
        }

        std::printf( "\n%s: %s at %d,%d\n\t%s\n\t%s:%d: '%s'\n",
                inputFileName.c_str(),
                e.getType(),
                e.getNumLine(),
                pos,
                statement.c_str(),
                inputFileName.c_str(),
                e.getNumLine(),
                e.what()
        );

        exit( EXIT_FAILURE );
    }
    catch(const Cp3mm::Tds::StrictnessError &e) {
        std::printf( "\nStrictness error: '%s'\n", e.what() );
        exit( EXIT_FAILURE );
    }
    catch(const Cp3mm::Tds::SemanticError &e) {
        std::printf( "\nSemantic error: '%s'\n", e.what() );
        exit( EXIT_FAILURE );
    }
    catch(const std::runtime_error &e) {
        std::printf( "\nError: '%s'\n", e.what() );
        exit( EXIT_FAILURE );
    }
    catch(const std::exception &e) {
        std::printf( "\nCRITICAL: '%s'\n", e.what() );
        exit( EXIT_FAILURE );
    }
    catch(...) {
        std::printf( "\nCRITICAL UNKNOWN ERROR\n" );
        exit( EXIT_FAILURE );
    }

    End:
    return EXIT_SUCCESS;
}