本文整理汇总了C++中emitError函数的典型用法代码示例。如果您正苦于以下问题:C++ emitError函数的具体用法?C++ emitError怎么用?C++ emitError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emitError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resolver
void PlatformDomainNameAddressQuery::runBlocking() {
//std::cout << "PlatformDomainNameResolver::doRun()" << std::endl;
boost::asio::ip::tcp::resolver resolver(ioService);
boost::asio::ip::tcp::resolver::query query(hostname, "5222");
try {
//std::cout << "PlatformDomainNameResolver::doRun(): Resolving" << std::endl;
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(query);
//std::cout << "PlatformDomainNameResolver::doRun(): Resolved" << std::endl;
if (endpointIterator == boost::asio::ip::tcp::resolver::iterator()) {
//std::cout << "PlatformDomainNameResolver::doRun(): Error 1" << std::endl;
emitError();
}
else {
std::vector<HostAddress> results;
for ( ; endpointIterator != boost::asio::ip::tcp::resolver::iterator(); ++endpointIterator) {
boost::asio::ip::address address = (*endpointIterator).endpoint().address();
results.push_back(address.is_v4() ? HostAddress(&address.to_v4().to_bytes()[0], 4) : HostAddress(&address.to_v6().to_bytes()[0], 16));
}
//std::cout << "PlatformDomainNameResolver::doRun(): Success" << std::endl;
eventLoop->postEvent(
boost::bind(boost::ref(onResult), results, boost::optional<DomainNameResolveError>()),
shared_from_this());
}
}
catch (...) {
//std::cout << "PlatformDomainNameResolver::doRun(): Error 2" << std::endl;
emitError();
}
}
示例2: QObject
SGMXASScanActionControllerFileWriter::SGMXASScanActionControllerFileWriter(const QString &filePath, bool hasRank2Data, QObject *parent) :
QObject(parent)
{
filePath_ = filePath;
hasRank2Data_ = hasRank2Data;
QFileInfo rank1FileInfo(filePath+".dat");
if(rank1FileInfo.exists())
emitError(SGMXASScanActionControllerFileWriter::AlreadyExistsError);
rank1File_ = new QFile(rank1FileInfo.filePath());
if(!rank1File_->open(QIODevice::WriteOnly | QIODevice::Text))
emitError(SGMXASScanActionControllerFileWriter::CouldNotOpenError);
else
QTimer::singleShot(0, this, SLOT(emitFileWriterIsBusy()));
rank2File_ = 0; //NULL
if(hasRank2Data_){
QFileInfo rank2FileInfo(filePath+"_spectra.dat");
if(rank2FileInfo.exists())
emitError(SGMXASScanActionControllerFileWriter::AlreadyExistsError);
rank2File_ = new QFile(rank2FileInfo.filePath());
if(!rank2File_->open(QIODevice::WriteOnly | QIODevice::Text))
emitError(SGMXASScanActionControllerFileWriter::CouldNotOpenError);
}
}
示例3: emitError
QVariant
QPython::getattr(QVariant obj, QString attr) {
if (!SINCE_API_VERSION(1, 4)) {
emitError(QString("Import PyOtherSide 1.4 or newer to use getattr()"));
return QVariant();
}
ENSURE_GIL_STATE;
PyObjectRef pyobj(convertQVariantToPyObject(obj), true);
if (!pyobj) {
emitError(QString("Failed to convert %1 to python object: '%1' (%2)").arg(obj.toString()).arg(priv->formatExc()));
return QVariant();
}
QByteArray byteArray = attr.toUtf8();
const char *attrStr = byteArray.data();
PyObjectRef o(PyObject_GetAttrString(pyobj.borrow(), attrStr), true);
if (!o) {
emitError(QString("Attribute not found: '%1' (%2)").arg(attr).arg(priv->formatExc()));
return QVariant();
}
return convertPyObjectToQVariant(o.borrow());
}
示例4: getScanner
//
// We need to verify that all of its possible values
// (in the enum list)
// is distinct and
// refer to valid notations if toValidateNotation is set on
//
void DTDValidator::checkTokenList(const XMLAttDef& curAttDef
, bool toValidateNotation)
{
XMLCh* list = XMLString::replicate(curAttDef.getEnumeration(), getScanner()->getMemoryManager());
ArrayJanitor<XMLCh> janList(list, getScanner()->getMemoryManager());
//
// Search forward for a space or a null. If a null,
// we are done. If a space, cap it and look it up.
//
bool breakFlag = false;
XMLCh* listPtr = list;
XMLCh* lastPtr = listPtr;
while (true)
{
while (*listPtr && (*listPtr != chSpace))
listPtr++;
//
// If at the end, indicate we need to break after
// this one. Else, cap it off here.
//
if (!*listPtr)
breakFlag = true;
else
*listPtr++ = chNull;
//distinction check
//there should be no same token found in the remaining list
if (XMLString::isInList(lastPtr, listPtr))
{
emitError
(
XMLValid::AttrDupToken
, curAttDef.getFullName()
, lastPtr
);
}
if (toValidateNotation && !fDTDGrammar->getNotationDecl(lastPtr))
{
emitError
(
XMLValid::UnknownNotRefAttr
, curAttDef.getFullName()
, lastPtr
);
}
// Break out if we hit the end last time
if (breakFlag)
break;
// Else move upwards and try again
lastPtr = listPtr;
}
}
示例5: stopCheck
void f3_launcher::startCheck(QString devPath)
{
if (stage != 0)
stopCheck();
f3_cui_output.clear();
progress = 0;
status = f3_launcher_running;
emit f3_launcher_status_changed(f3_launcher_running);
this->devPath = devPath;
QString command;
QStringList args;
if (getOption("mode") == "quick")
{
command = QString(F3_PROBE_COMMAND);
if (!probeCommand(command))
{
emitError(f3_launcher_no_quick);
status = f3_launcher_stopped;
emit f3_launcher_status_changed(f3_launcher_stopped);
return;
}
if (getOption("memory") == "minimum")
args << QString(F3_OPTION_MIN_MEM);
if (getOption("destructive") == "true")
args << QString(F3_OPTION_DESTRUCTIVE);
args << QString(F3_OPTION_TIME);
stage = 11;
emit f3_launcher_status_changed(f3_launcher_staged);
}
else
{
command = QString(F3_WRITE_COMMAND);
stage = 1;
if (getOption("cache") == "write")
{
if (probeDiskFull(devPath) && probeCacheFile(devPath))
{
command = QString(F3_READ_COMMAND);
stage = 2;
}
else
emitError(f3_launcher_cache_nofound);
}
if (showProgress)
args << QString(F3_OPTION_SHOW_PROGRESS);
emit f3_launcher_status_changed(f3_launcher_staged);
}
args << devPath;
f3_cui.start(command, args);
if (showProgress)
{
timer.start();
}
}
示例6: while
void TrkDevice::tryTrkRead()
{
#ifdef Q_OS_WIN
const DWORD BUFFERSIZE = 1024;
char buffer[BUFFERSIZE];
DWORD charsRead;
DWORD totalCharsRead = 0;
while (TryReadFile(d->hdevice, buffer, BUFFERSIZE, &charsRead, NULL)) {
totalCharsRead += charsRead;
d->trkReadBuffer.append(buffer, charsRead);
if (isValidTrkResult(d->trkReadBuffer, d->serialFrame))
break;
}
if (verbose() && totalCharsRead)
logMessage("Read" + d->trkReadBuffer.toHex());
if (!totalCharsRead)
return;
const ushort len = trk::isValidTrkResult(d->trkReadBuffer, d->serialFrame);
if (!len) {
const QString msg = QString::fromLatin1("Partial message: %1").arg(stringFromArray(d->trkReadBuffer));
emitError(msg);
return;
}
#else
const int size = bytesAvailable(d->file.handle());
if (!size)
return;
const QByteArray data = d->file.read(size);
if (verbose())
logMessage("READ " + data.toHex());
d->trkReadBuffer.append(data);
const ushort len = trk::isValidTrkResult(d->trkReadBuffer, d->serialFrame);
if (!len) {
if (d->trkReadBuffer.size() > 10) {
const QString msg = QString::fromLatin1("Unable to extract message from '%1' '%2'").
arg(QLatin1String(d->trkReadBuffer.toHex())).arg(QString::fromAscii(d->trkReadBuffer));
emitError(msg);
}
return;
}
#endif // Q_OS_WIN
trk::TrkResult r;
QByteArray rawData;
while (extractResult(&d->trkReadBuffer, d->serialFrame, &r, &rawData)) {
if (verbose())
logMessage("Read TrkResult " + r.data.toHex());
emit messageReceived(r);
if (!rawData.isEmpty())
emit rawDataReceived(rawData);
}
}
示例7: stubServerListen
bool ConsoleProcess::start(const QString &program, const QString &args)
{
if (isRunning())
return false;
d->m_errorString.clear();
d->m_error = QProcess::UnknownError;
QString pcmd;
QString pargs;
if (d->m_mode != Run) { // The debugger engines already pre-process the arguments.
pcmd = program;
pargs = args;
} else {
QtcProcess::Arguments outArgs;
QtcProcess::prepareCommand(program, args, &pcmd, &outArgs, OsTypeWindows,
&d->m_environment, &d->m_workingDir);
pargs = outArgs.toWindowsArgs();
}
const QString err = stubServerListen();
if (!err.isEmpty()) {
emitError(QProcess::FailedToStart, msgCommChannelFailed(err));
return false;
}
QStringList env = d->m_environment.toStringList();
if (!env.isEmpty()) {
d->m_tempFile = new QTemporaryFile();
if (!d->m_tempFile->open()) {
stubServerShutdown();
emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
delete d->m_tempFile;
d->m_tempFile = 0;
return false;
}
QTextStream out(d->m_tempFile);
out.setCodec("UTF-16LE");
out.setGenerateByteOrderMark(false);
foreach (const QString &var, fixWinEnvironment(env))
out << var << QChar(0);
out << QChar(0);
out.flush();
if (out.status() != QTextStream::Ok) {
stubServerShutdown();
emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
delete d->m_tempFile;
d->m_tempFile = 0;
return false;
}
}
示例8: fileModified
void ItemEditor::close()
{
// check if file was modified before closing
if ( m_modified || fileModified() )
emit fileModified(m_data, m_mime);
if (m_editor && m_editor->exitCode() != 0 ) {
emitError( tr("editor exit code is %1").arg(m_editor->exitCode()) );
const QByteArray errors = m_editor->readAllStandardError();
if ( !errors.isEmpty() )
emitError( QString::fromUtf8(errors) );
}
emit closed(this);
}
示例9: qCWarning
void AddCollectionTask::doStart(KIMAP::Session *session)
{
if (parentCollection().remoteId().isEmpty()) {
qCWarning(IMAPRESOURCE_LOG) << "Parent collection has no remote id, aborting." << collection().name() << parentCollection().name();
emitError(i18n("Cannot add IMAP folder '%1' for a non-existing parent folder '%2'.",
collection().name(),
parentCollection().name()));
changeProcessed();
return;
}
const QChar separator = separatorCharacter();
m_pendingJobs = 0;
m_session = session;
m_collection = collection();
m_collection.setName(m_collection.name().replace(separator, QString()));
m_collection.setRemoteId(separator + m_collection.name());
QString newMailBox = mailBoxForCollection(parentCollection());
if (!newMailBox.isEmpty()) {
newMailBox += separator;
}
newMailBox += m_collection.name();
qCDebug(IMAPRESOURCE_LOG) << "New folder: " << newMailBox;
KIMAP::CreateJob *job = new KIMAP::CreateJob(session);
job->setMailBox(newMailBox);
connect(job, &KIMAP::CreateJob::result, this, &AddCollectionTask::onCreateDone);
job->start();
}
示例10: sendSpecialPacket
void Transmitter::sendKeyPacket()
{
char *out;
int keylen = rsa->getPeerPublicKeyLen();
try
{
if (keylen > 0)
{
if (blowfish)
{
int len = rsa->encrypt(blowfish->getPass(), blowfish->getPassLen(), &out);
sendSpecialPacket(out, len, DRTA_INFO_NEW_KEY);
free(out);
}
}
else
{
sendResetPacket();
}
}
catch (Error e)
{
emitError(e.getText());
}
}
示例11: Q_ASSERT
void RecognitionControl::run()
{
Q_ASSERT(recog);
RecognitionConfiguration *cfg = setupConfig();
bool success = recog->init(cfg);
delete cfg;
if (!success) {
emitError(i18n("Failed to setup recognition: %1", recog->getLastError()));
return;
}
m_initialized=true;
while (shouldBeRunning)
{
if (!queueLock.tryLock(500)) continue;
QString file;
if (!toRecognize.isEmpty())
file = toRecognize.dequeue();
queueLock.unlock();
if (file.isNull()) {
QThread::msleep(100);
} else {
emit recognitionResult(file, recog->recognize(file));
emit recognitionDone(file);
}
}
}
示例12: PARSER_FLOW_TRACER
bool Expr::parseUnaryExpression() {
PARSER_FLOW_TRACER();
/* left associative */
switch (ahead().type()) {
case T_AT_SIGN:
emitError("addr-of-operator unsupported");
// ### @foo (addr-of operator)
return false;
case T_MINUS:
case T_PLUS:
case T_NOT: {
Model::ExprUnary::Ptr result = new Model::ExprUnary;
result->setUnaryOperator(tokenToUnary(ahead().type()));
next();
FAIL_IF_NOT(parsePrimaryExpression());
result->setOperand(model());
setModel(result);
return true; }
default:
return parsePrimaryExpression();
}
}
示例13: cmd
void ListCommand::execute(const QVariantMap options)
{
DbFilter queryFilter = options.value(OPTION_DB_FILTER).value<DbFilter>();
CommandFileList cmd(getSession());
cmd.setAutoDelete(true);
cmd.setFields("items(fileSize,id,title,modifiedDate,createdDate,downloadUrl, headRevisionId)");
QString query = QueryEntry::getEntries(queryFilter);
// Keepass db folder is set to root in Google drive if user did not customize it
if (config()->get("cloud/GdriveKeepassFolder").toString().length()
> 0) cmd.execForFolder(config()->get(
"cloud/GdriveKeepassFolder").toString(), query);
else cmd.exec(query);
cmd.waitForFinish(false);
if (cmd.error() == Errors::NO_ERROR) {
qRegisterMetaType<GoogleDrive::FileInfoList>("GoogleDrive::FileInfoList");
qRegisterMetaType<GoogleDrive::FileInfo>("GoogleDrive::FileInfo");
GoogleDrive::FileInfoList dbList = cmd.files();
RemoteFileList remoteFileList = RemoteFileImpl::fromGDriveFileInfoList(dbList);
setResult(KeePassxDriveSync::ResultBuilder().addValue(remoteFileList).build());
emitSuccess();
} else {
emitError(Errors::FileError::LIST_FILES_PROBLEM,
QString("Failed to list files for keepass directory"));
}
}
示例14: getPlayerIndex
void Server::manageError(QString address, int port, QAbstractSocket::SocketError error){
int playerIndex = getPlayerIndex(address, port);
if(networkAnswers[playerIndex].isEmpty()){
nbNetworkAnswers++;
}
else{
qDebug() << "Server::manageError() : SUPER WEIRD, player sent first message "
<< networkAnswers[playerIndex] << " then error " << error;
}
switch(waitingForMessage){
case(WAITING_FOR_MESSAGE::INFO):
case(WAITING_FOR_MESSAGE::START):
emit playerReady(playerIndex, false);
break;
case(WAITING_FOR_MESSAGE::PLAY):
moves[playerIndex] = "";
break;
default:
break;
}
if(nbNetworkAnswers == addresses.size()){
handleTransition();
}
emit emitError(playerIndex, error);
}
示例15: Unit
// MEMBER FUNCTION
int Trick::MemoryManager::ref_assignment( REF2* R, V_TREE* V) {
int ret = 0;
UCFn *cf = NULL;
// Create a units conversion function if necessary.
if (R->units) {
try {
Unit *from_units = new Unit(R->units);
Unit *to_units = new Unit(R->attr->units);
// This Conversion_to call allocates a new UCFn
cf = from_units->Conversion_to( to_units);
delete from_units;
delete to_units;
} catch (Unit::CONVERSION_ERROR) {
std::stringstream message;
message << "Can't convert \"" << R->units << "\" to \"" << R->attr->units << "\".";
emitError(message.str());
cf = NULL;
return TRICK_UNITS_CONVERSION_ERROR ;
}
}
// R->num_index is badly named. It is really the current dimension
ret = assign_recursive( R->address, R->attr, R->num_index, 0, V, cf);
delete cf ;
return ( ret);
}