コード例 #1
0
ファイル: formatwidget.cpp プロジェクト: baiyunping333/PREF
void FormatWidget::loadFormat()
{
    FormatsDialog fd(this->_hexedit->data()->length(), (this->_hexedit->selectionLength() ? this->_hexedit->cursorPos() : 0), this->topLevelWidget());
    int res = fd.exec();

    if(res == FormatsDialog::Accepted)
    {
        this->_formatview = nullptr;
        this->_logwidget->clear();
        this->_formatdefinition = fd.selectedFormat();

        Logger* logger = new Logger(this->_logwidget);
        bool validated = this->_formatdefinition->callValidate(this->_hexedit->data(), logger, fd.offset());

        if(!validated)
        {
            emit parsingFailed();
            logger->deleteLater();
            return;
        }

        this->_worker = new FormatWorker(this->_formatdefinition, logger, this->_hexedit->data(), fd.offset(), this);
        connect(this->_worker, SIGNAL(started()), this, SIGNAL(workStarted()));
        connect(this->_worker, SIGNAL(started()), this, SIGNAL(parsingStarted()));
        connect(this->_worker, SIGNAL(finished()), this, SIGNAL(workFinished()));
        connect(this->_worker, SIGNAL(finished()), this, SIGNAL(parsingCompleted()));
        connect(this->_worker, SIGNAL(parsingFailed()), this, SIGNAL(parsingFailed()));
        connect(this->_worker, SIGNAL(parsingCompleted()), this, SLOT(onParseCompleted()));
        this->_worker->start();
    }
}
コード例 #2
0
ファイル: FileInformation.cpp プロジェクト: ElderOrb/qctools
void FileInformation::runParse()
{
    if(signalServer->enabled() && m_autoCheckFileUploaded)
    {
        QString statsFileName = fileName() + ".qctools.xml.gz";
        QFileInfo fileInfo(statsFileName);

        checkFileUploaded(fileInfo.fileName());
    }

    {
        int frameNumber = 1;

        for (;;)
        {
            if (Glue)
            {
                if (!Glue->NextFrame())
                    break;

                ++frameNumber;
            }
            if (WantToStop)
                break;
            yieldCurrentThread();
        }
    }

    ActiveParsing_Count--;
    m_parsed = !WantToStop;

    Q_EMIT parsingCompleted(WantToStop == false);
}