Example #1
1
void DatabaseInfo::acceptWidget(DomWidget *node)
{
    QHash<QString, DomProperty*> properties = propertyMap(node->elementProperty());

    DomProperty *frameworkCode = properties.value(QLatin1String("frameworkCode"), 0);
    if (frameworkCode && toBool(frameworkCode->elementBool()) == false)
        return;

    DomProperty *db = properties.value(QLatin1String("database"), 0);
    if (db && db->elementStringList()) {
        QStringList info = db->elementStringList()->elementString();

        QString connection = info.size() > 0 ? info.at(0) : QString();
        if (connection.isEmpty())
            return;
        m_connections.append(connection);

        QString table = info.size() > 1 ? info.at(1) : QString();
        if (table.isEmpty())
            return;
        m_cursors[connection].append(table);

        QString field = info.size() > 2 ? info.at(2) : QString();
        if (field.isEmpty())
            return;
        m_fields[connection].append(field);
    }

    TreeWalker::acceptWidget(node);
}
Example #2
0
QString SourceEntry::toString() const
{
    if (!d->isValid)
        return d->line.trimmed();

    QString line;

    if (!d->isEnabled)
        line = QLatin1String("# ");

    line += d->type;

    if (!d->architectures.isEmpty())
        line += QString(" [arch=%1]").arg(d->architectures.join(QChar(',')));

    line += ' ' % d->uri % ' ' % d->dist;

    if (!d->components.isEmpty())
        line += ' ' + d->components.join(QChar(' '));

    if (!d->comment.isEmpty())
        line += QLatin1String(" #") % d->comment;

    return line;
}
Example #3
0
QString backtrace(int levels = -1) {
	QString s;
	void* trace[256];
	int n = backtrace(trace, 256);
	if (!n) {
		return s;
	}
	char** strings = backtrace_symbols (trace, n);

	if ( levels != -1 ) {
		n = qMin( n, levels );
	}		
	s = QLatin1String("[\n");

	for (int i = 0; i < n; ++i) {
		s += QString::number(i) +
			QLatin1String(": ") +
			QLatin1String(strings[i]) + QLatin1String("\n");
	}
	s += QLatin1String("]\n");
	if (strings) {
		free (strings);
	}

	return s;
}
SubversionClient::Version SubversionClient::svnVersion()
{
    if (m_svnVersionBinary != settings()->binaryPath()) {
        QStringList args;
        args << QLatin1String("--version") << QLatin1String("-q");
        const Utils::SynchronousProcessResponse response =
                VcsBase::VcsBasePlugin::runVcs(QDir().absolutePath(), settings()->binaryPath(),
                                               args, settings()->timeOutMs());
        if (response.result == Utils::SynchronousProcessResponse::Finished &&
                response.exitCode == 0) {
            m_svnVersionBinary = settings()->binaryPath();
            m_svnVersion = response.stdOut.trimmed();
        } else {
            m_svnVersionBinary.clear();
            m_svnVersion.clear();
        }
    }

    SubversionClient::Version v;
    if (::sscanf(m_svnVersion.toLatin1().constData(), "%d.%d.%d",
                 &v.majorVersion, &v.minorVersion, &v.patchVersion) != 3) {
        v.majorVersion = v.minorVersion = v.patchVersion = -1;
    }

    return v;
}
Example #5
0
/*!
    Returns the list of valid keys, i.e. the available keyboard
    drivers.

    \sa create()
*/
QStringList QKbdDriverFactory::keys()
{
    QStringList list;

#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX)
    list << QLatin1String("QNX");
#endif
#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_KBD_INTEGRITY)
    list << QLatin1String("INTEGRITY");
#endif
#ifndef QT_NO_QWS_KBD_TTY
    list << QLatin1String("TTY");
#endif
#ifndef QT_NO_QWS_KBD_LINUXINPUT
    list << QLatin1String("LinuxInput");
#endif
#ifndef QT_NO_QWS_KBD_UM
    list << QLatin1String("UM");
#endif

#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
    QStringList plugins = loader()->keys();
    for (int i = 0; i < plugins.size(); ++i) {
        if (!list.contains(plugins.at(i)))
            list += plugins.at(i);
    }
#endif //QT_NO_LIBRARY
#endif //QT_MAKEDLL

    return list;
}
Example #6
0
void KDSoapValue::writeElementContents(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace) const
{
    const QVariant value = this->value();

    if (isNil() && d->m_nillable) {
        writer.writeAttribute(KDSoapNamespaceManager::xmlSchemaInstance2001(), QLatin1String("nil"), QLatin1String("true"));
    }

    if (use == EncodedUse) {
        // use=encoded means writing out xsi:type attributes. http://www.eherenow.com/soapfight.htm taught me that.
        QString type;
        if (!this->type().isEmpty()) {
            type = namespacePrefixes.resolve(this->typeNs(), this->type());
        }
        if (type.isEmpty() && !value.isNull()) {
            type = variantToXMLType(value);    // fallback
        }
        if (!type.isEmpty()) {
            writer.writeAttribute(KDSoapNamespaceManager::xmlSchemaInstance2001(), QLatin1String("type"), type);
        }

        // cppcheck-suppress redundantCopyLocalConst
        const KDSoapValueList list = this->childValues();
        const bool isArray = !list.arrayType().isEmpty();
        if (isArray) {
            writer.writeAttribute(KDSoapNamespaceManager::soapEncoding(), QLatin1String("arrayType"), namespacePrefixes.resolve(list.arrayTypeNs(), list.arrayType()) + QLatin1Char('[') + QString::number(list.count()) + QLatin1Char(']'));
        }
    }
    writeChildren(namespacePrefixes, writer, use, messageNamespace, false);

    if (!value.isNull()) {
        writer.writeCharacters(variantToTextValue(value, this->typeNs(), this->type()));
    }
}
Example #7
0
File: main.cpp Project: Suneal/qt
QObject* QTsLibPlugin::create(const QString &key,
                                                 const QString &specification)
{
    if (!key.compare(QLatin1String("Tslib"), Qt::CaseInsensitive) || !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive))
        return new QTsLibMouseHandler(key, specification);
    return 0;
    }
GuiAppParameters GuiAppWizardDialog::parameters() const
{
    GuiAppParameters rc;
    rc.className = m_filesPage->className();
    rc.baseClassName = m_filesPage->baseClassName();
    rc.sourceFileName = m_filesPage->sourceFileName();
    rc.headerFileName = m_filesPage->headerFileName();
    rc.formFileName = m_filesPage->formFileName();
    rc.designerForm =  m_filesPage->formInputChecked();
    rc.isMobileApplication = true;
    if (isTargetSelected(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID))
            || isTargetSelected(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID))
            || isTargetSelected(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID))) {
        rc.widgetWidth = 800;
        rc.widgetHeight = 480;
    } else if (isTargetSelected(QLatin1String(Constants::S60_DEVICE_TARGET_ID)) ||
               isTargetSelected(QLatin1String(Constants::S60_EMULATOR_TARGET_ID))) {
        rc.widgetWidth = 360;
        rc.widgetHeight = 640;
    } else {
        rc.isMobileApplication = false;
        rc.widgetWidth = 400;
        rc.widgetHeight = 300;
    }
    return rc;
}
UserMentionEntity::UserMentionEntity(const QJsonObject &json)
{
    m_screenName = std::move(json.value(QLatin1String("screen_name")).toString());
    m_text = QString(QLatin1String("@%1")).arg(m_screenName);
    m_id = std::move(json.value(QLatin1String("id_str")).toString());
    m_name = std::move(json.value(QLatin1String("name")).toString());
}
bool QHelpCollectionHandler::addCustomFilter(const QString &filterName,
        const QStringList &attributes)
{
    if (!isDBOpened() || filterName.isEmpty())
        return false;

    int nameId = -1;
    m_query.prepare(QLatin1String("SELECT Id FROM FilterNameTable WHERE Name=?"));
    m_query.bindValue(0, filterName);
    m_query.exec();
    while (m_query.next()) {
        nameId = m_query.value(0).toInt();
        break;
    }

    m_query.exec(QLatin1String("SELECT Id, Name FROM FilterAttributeTable"));
    QStringList idsToInsert = attributes;
    QMap<QString, int> attributeMap;
    while (m_query.next()) {
        attributeMap.insert(m_query.value(1).toString(),
                            m_query.value(0).toInt());
        if (idsToInsert.contains(m_query.value(1).toString()))
            idsToInsert.removeAll(m_query.value(1).toString());
    }

    foreach (QString id, idsToInsert) {
        m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)"));
        m_query.bindValue(0, id);
        m_query.exec();
        attributeMap.insert(id, m_query.lastInsertId().toInt());
    }
bool QHelpCollectionHandler::openCollectionFile()
{
    if (m_dbOpened)
        return m_dbOpened;

    m_connectionName = QHelpGlobal::uniquifyConnectionName(
                           QLatin1String("QHelpCollectionHandler"), this);
    bool openingOk = true;
    {
        QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), m_connectionName);
        db.setDatabaseName(collectionFile());
        openingOk = db.open();
        if (openingOk)
            m_query = QSqlQuery(db);
    }
    if (!openingOk) {
        QSqlDatabase::removeDatabase(m_connectionName);
        emit error(tr("Cannot open collection file: %1").arg(collectionFile()));
        return false;
    }

    m_query.exec(QLatin1String("SELECT COUNT(*) FROM sqlite_master WHERE TYPE=\'table\'"
                               "AND Name=\'NamespaceTable\'"));
    m_query.next();
    if (m_query.value(0).toInt() < 1) {
        if (!createTables(&m_query)) {
            emit error(tr("Cannot create tables in file %1!").arg(collectionFile()));
            return false;
        }
    }

    m_dbOpened = true;
    return m_dbOpened;
}
bool QHelpCollectionHandler::removeCustomFilter(const QString &filterName)
{
    if (!isDBOpened() || filterName.isEmpty())
        return false;

    int filterNameId = -1;
    m_query.prepare(QLatin1String("SELECT Id FROM FilterNameTable WHERE Name=?"));
    m_query.bindValue(0, filterName);
    m_query.exec();
    if (m_query.next())
        filterNameId = m_query.value(0).toInt();

    if (filterNameId < 0) {
        emit error(tr("Unknown filter!"));
        return false;
    }

    m_query.prepare(QLatin1String("DELETE FROM FilterTable WHERE NameId=?"));
    m_query.bindValue(0, filterNameId);
    m_query.exec();

    m_query.prepare(QLatin1String("DELETE FROM FilterNameTable WHERE Id=?"));
    m_query.bindValue(0, filterNameId);
    m_query.exec();

    return true;
}
Example #13
0
void AppContextPrivate::readSettings()
{
    settings->beginGroup(QLatin1String(GROUP_MAINWINDOW));
    mainWindow->resize(settings->value(QLatin1String(SETTINGS_SIZE), QSize(1024, 768)).toSize());
    mainWindow->move(settings->value(QLatin1String(SETTINGS_POSITION), QPoint(200, 200)).toPoint());
    settings->endGroup();
}
Example #14
0
void AppContextPrivate::writeSettings()
{
    settings->beginGroup(QLatin1String(GROUP_MAINWINDOW));
    settings->setValue(QLatin1String(SETTINGS_SIZE), mainWindow->size());
    settings->setValue(QLatin1String(SETTINGS_POSITION), mainWindow->pos());
    settings->endGroup();
}
void CheckForUpdatesJob::parseXmlData( const QByteArray& data )
{
    QBuffer buffer;
    buffer.setData( data );
    buffer.open( QIODevice::ReadOnly );

    QDomDocument document;
    QString errorMessage;
    int errorLine = 0;
    int errorColumn = 0;
    if ( !document.setContent( &buffer, &errorMessage, &errorLine, &errorColumn ) )
    {
        m_jobData.errorString = tr( "Invalid XML: [%1:%2] %3" ).arg( QString::number( errorLine ), QString::number( errorColumn ), errorMessage );
        m_jobData.error = 999; // this value is just to have an and does not mean anything - error != 0
        return;
    }

    QDomElement element = document.documentElement();
    QDomElement versionElement = element.firstChildElement( QLatin1String( "version" ) );
    QDomElement linkElement = versionElement.nextSiblingElement( QLatin1String( "link" ) );
    const QString releaseVersion = versionElement.text();
    m_jobData.releaseVersion = releaseVersion;
    QUrl link( linkElement.text() );
    m_jobData.link = link;
    QString releaseInfoLink( linkElement.nextSiblingElement( QLatin1String( "releaseinfolink" ) ).text() );
    m_jobData.releaseInformationLink = releaseInfoLink;

}
Example #16
0
QString Ui3Reader::trcall(const QString& sourceText, const QString& comment)
{
    if (sourceText.isEmpty() && comment.isEmpty())
        return QLatin1String("QString()");

    QString t = trmacro;
    bool encode = false;
    if (t.isNull()) {
        t = QLatin1String("tr");
        for (int i = 0; i < (int) sourceText.length(); i++) {
            if (sourceText[i].unicode() >= 0x80) {
                t = QLatin1String("trUtf8");
                encode = true;
                break;
            }
        }
    }

    if (comment.isEmpty()) {
        return t + QLatin1Char('(') + fixString(sourceText, encode) + QLatin1Char(')');
    } else {
        return t + QLatin1Char('(')
               + fixString(sourceText, encode)
               + QLatin1String(", ")
               + fixString(comment, encode) + QLatin1Char(')');
    }
}
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
    : hIcon(0), q(object), ignoreNextMouseRelease(false)

{
#ifndef Q_OS_WINCE
    notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE;
    maxTipLength = 128;
#else
    notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE;
    maxTipLength = 64;
#endif

    // For restoring the tray icon after explorer crashes
    if (!MYWM_TASKBARCREATED) {
        MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
    }

    // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
    static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
        (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");

    if (pChangeWindowMessageFilterEx) {
        // Call the safer ChangeWindowMessageFilterEx API if available
        pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
    } else {
        static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
            (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");

        if (pChangeWindowMessageFilter) {
            // Call the deprecated ChangeWindowMessageFilter API otherwise
            pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
        }
    }
}
Example #18
0
/*! Extracts an object name from \a e. It's stored in the 'name'
 property.
 */
QString Ui3Reader::getObjectName(const QDomElement& e)
{
    QDomElement n = getObjectProperty(e, QLatin1String("name"));
    if (n.firstChild().toElement().tagName() == QLatin1String("cstring"))
        return n.firstChild().toElement().firstChild().toText().data();
    return QString();
}
Example #19
0
QString Revision::toString()const
{
    QString value;
    switch (m_revision.kind) {
    case svn_opt_revision_number:
        value.sprintf("%li", m_revision.value.number);
        break;
    case svn_opt_revision_date:
        value = DateTime(m_revision.value.date).toString(QStringLiteral("{yyyy-MM-dd}"));
        break;
    case svn_opt_revision_base:
        value = QLatin1String("BASE");
        break;
    case svn_opt_revision_head:
        value = QLatin1String("HEAD");
        break;
    case svn_opt_revision_working:
        value = QLatin1String("WORKING");
        break;
    case svn_opt_revision_previous:
        value = QLatin1String("PREVIOUS");
        break;
    case svn_opt_revision_unspecified:
    default:
        value =QLatin1String( "-1");
        break;
    }
    return value;
}
Example #20
0
QString Ui3Reader::getDatabaseInfo(const QDomElement& e, const QString& tag)
{
    QDomElement n;
    QDomElement n1;
    int child = 0;
    // database info is a stringlist stored in this order
    if (tag == QLatin1String("connection"))
        child = 0;
    else if (tag == QLatin1String("table"))
        child = 1;
    else if (tag == QLatin1String("field"))
        child = 2;
    else
        return QString();
    n = getObjectProperty(e, QLatin1String("database"));
    if (n.firstChild().toElement().tagName() == QLatin1String("stringlist")) {
        // find correct stringlist entry
        QDomElement n1 = n.firstChild().firstChild().toElement();
        for (int i = 0; i < child && !n1.isNull(); ++i)
            n1 = n1.nextSibling().toElement();
        if (n1.isNull())
            return QString();
        return n1.firstChild().toText().data();
    }
    return QString();
}
Example #21
0
bool QtWebKitWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
{
	if (request.url().scheme() == QLatin1String("javascript") && frame)
	{
		frame->evaluateJavaScript(request.url().path());

		return true;
	}

	if (type == QWebPage::NavigationTypeFormResubmitted && SettingsManager::getValue(QLatin1String("Choices/WarnFormResend")).toBool())
	{
		bool cancel = false;
		bool warn = true;

		if (m_webWidget)
		{
			ContentsDialog dialog(Utils::getIcon(QLatin1String("dialog-warning")), tr("Question"), tr("Are you sure that you want to send form data again?"), tr("Do you want to resend data?"), (QDialogButtonBox::Yes | QDialogButtonBox::Cancel), NULL, m_webWidget);
			dialog.setCheckBox(tr("Do not show this message again"), true);

			QEventLoop eventLoop;

			m_webWidget->showDialog(&dialog);

			connect(&dialog, SIGNAL(finished(int)), &eventLoop, SLOT(quit()));
			connect(this, SIGNAL(destroyed()), &eventLoop, SLOT(quit()));

			eventLoop.exec();

			m_webWidget->hideDialog(&dialog);

			cancel = !dialog.isAccepted();
			warn = !dialog.getCheckBoxState();
		}
		else
		{
Example #22
0
/*!
  Registers an object with name \a name.

  The returned name is a valid variable identifier, as similar to \a
  name as possible and guaranteed to be unique within the form.

  \sa registeredName(), isObjectRegistered()
 */
QString Ui3Reader::registerObject(const QString& name)
{
    if (objectNames.isEmpty()) {
        // some temporary variables we need
        objectNames += QLatin1String("img");
        objectNames += QLatin1String("item");
        objectNames += QLatin1String("cg");
        objectNames += QLatin1String("pal");
    }

    QString result = name;
    int i;
    while ((i = result.indexOf(QLatin1Char(' '))) != -1 ) {
        result[i] = QLatin1Char('_');
    }

    if (objectNames.contains(result)) {
        int i = 2;
        while (objectNames.contains(result + QLatin1Char('_') + QString::number(i)))
            i++;
        result += QLatin1Char('_');
        result += QString::number(i);
    }
    objectNames += result;
    objectMapper.insert(name, result);
    return result;
}
Example #23
0
QString CodeGenerator::generateMain(const Sprite *bgSprite, const SpriteVector *spriteVec)
{
    QString entityImport;
    QString entityRegister;

    QStringList *entImpSnippet = &_snippets["entity_import"];
    QStringList *entRegSnippet = &_snippets["entity_register"];

    entityImport += indentCode(entImpSnippet).replace(QLatin1String("%name%"), bgSprite->getName());
    entityRegister += indentCode(entRegSnippet, 1).replace(QLatin1String("%name%"), bgSprite->getName());

    // sprites
    for(SpriteVector::const_iterator it = spriteVec->begin(); it != spriteVec->end(); it++)
    {
        entityImport += indentCode(entImpSnippet).replace(QLatin1String("%name%"), (*it)->getName());
        entityRegister += indentCode(entRegSnippet, 1).replace(QLatin1String("%name%"), (*it)->getName());
    }

    // main file
    QString str;
    str += indentCode(&_snippets["main_import"]);
    str += entityImport + "\n";
    str += indentCode(&_snippets["main"], 0, entityRegister);

    return str;
}
Example #24
0
QStringList jsmoke_qtwebkit_ScriptPlugin::keys() const
{
    QStringList list;
    list << QLatin1String("jsmoke");
    list << QLatin1String("jsmoke.qtwebkit");
    return list;
}
Example #25
0
XboxInput::XboxInput()
	: GetState(NULL)
	, m_getStateFunc(NULL)
	, m_getStateExFunc(NULL)
	, m_xinputlib(NULL)
	, m_valid(false) {

	// Load the most suitable XInput DLL available.
	//
	// We prefer 1_4 and 1_3 over the others because they provide
	// XInputGetStateEx(), which allows us to query the state of
	// the guide button.
	//
	// See https://msdn.microsoft.com/en-us/library/windows/desktop/hh405051(v=vs.85).aspx
	// for more information.
	QStringList alternatives;
	alternatives << QLatin1String("XInput1_4.dll");
	alternatives << QLatin1String("xinput1_3.dll");
	alternatives << QLatin1String("XInput9_1_0.dll");
	alternatives << QLatin1String("xinput1_2.dll");
	alternatives << QLatin1String("xinput1_1.dll");

	foreach(const QString &lib, alternatives) {
		m_xinputlib = LoadLibraryW(reinterpret_cast<const wchar_t *>(lib.utf16()));
		if (m_xinputlib != NULL) {
			qWarning("XboxInput: using XInput DLL '%s'", qPrintable(lib));
			m_valid = true;
			break;
		}
	}
Example #26
0
void IrcChannelPrivate::changeModes(const QString& value, const QStringList& arguments)
{
    Q_Q(IrcChannel);
    const IrcNetwork* network = q->network();

    QMap<QString, QString> ms = modes;
    QStringList args = arguments;

    bool add = true;
    for (int i = 0; i < value.size(); ++i) {
        const QString m = value.at(i);
        if (m == QLatin1String("+")) {
            add = true;
        } else if (m == QLatin1String("-")) {
            add = false;
        } else {
            if (add) {
                QString a;
                if (!args.isEmpty() && network && network->channelModes(IrcNetwork::TypeB | IrcNetwork::TypeC).contains(m))
                    a = args.takeFirst();
                ms.insert(m, a);
            } else {
                ms.remove(m);
            }
        }
    }

    if (modes != ms) {
        setKey(ms.value(QLatin1String("k")));
        modes = ms;
        emit q->modeChanged(q->mode());
    }
}
void EnvironmentVariableTest::testPersistentNonSystem()
{
#ifndef Q_OS_WIN
    QSKIP("This operation only works on Windows");
#endif
    KDUpdater::Application app;
    QString key = QLatin1String("IFW_TestKey");
    QString value = QLatin1String("IFW_TestValue");
    QInstaller::EnvironmentVariableOperation op;
    op.setArguments( QStringList() << key
                    << value
                    << QLatin1String("true")
                    << QLatin1String("false"));
    const bool ok = op.performOperation();

    QVERIFY2(ok, qPrintable(op.errorString()));

    // Verify now...
    QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Environment"), QSettings::NativeFormat);
    QVERIFY(value == settings.value(key).toString());

    // Remove the setting
    QEXPECT_FAIL("", "Undo Operation not implemented yet", Continue);
    QVERIFY(op.undoOperation());

    //QVERIFY(settings.value(key).toString().isEmpty());
    settings.remove(key);
}
Example #28
0
ibanBic::ibanBic()
    : m_bic(QLatin1String("")),
    m_iban(QLatin1String("")),
    m_ownerName(QLatin1String(""))
{

}
Example #29
0
void Box2DPlugin::registerTypes(const char *uri)
{
    Q_ASSERT(QLatin1String(uri) == QLatin1String("Box2D"));

    qmlRegisterType<Box2DWorld>(uri, 1, 1, "World");
    qmlRegisterType<Box2DBody>(uri, 1, 1, "Body");
    qmlRegisterUncreatableType<Box2DFixture>(uri, 1,0, "Fixture",
                                             QStringLiteral("Base type for Box, Circle etc."));
    qmlRegisterType<Box2DBox>(uri, 1, 1, "Box");
    qmlRegisterType<Box2DCircle>(uri, 1, 1, "Circle");
    qmlRegisterType<Box2DPolygon>(uri, 1, 1, "Polygon");
    qmlRegisterType<Box2DChain>(uri, 1, 1, "Chain");
    qmlRegisterType<Box2DEdge>(uri, 1, 1, "Edge");
    qmlRegisterType<Box2DDebugDraw>(uri, 1, 1, "DebugDraw");
    qmlRegisterUncreatableType<Box2DJoint>(uri, 1, 1, "Joint",
                                           QStringLiteral("Base type for DistanceJoint, RevoluteJoint etc."));
    qmlRegisterType<Box2DDistanceJoint>(uri, 1, 1, "DistanceJoint");
    qmlRegisterType<Box2DPrismaticJoint>(uri, 1, 1, "PrismaticJoint");
    qmlRegisterType<Box2DRevoluteJoint>(uri, 1, 1, "RevoluteJoint");
    qmlRegisterType<Box2DMotorJoint>(uri, 1, 1, "MotorJoint");
    qmlRegisterType<Box2DWeldJoint>(uri, 1, 1, "WeldJoint");
    qmlRegisterType<Box2DPulleyJoint>(uri, 1, 1, "PulleyJoint");
    qmlRegisterType<Box2DFrictionJoint>(uri, 1, 1, "FrictionJoint");
    qmlRegisterType<Box2DWheelJoint>(uri, 1, 1, "WheelJoint");
    qmlRegisterType<Box2DMouseJoint>(uri, 1, 1, "MouseJoint");
    qmlRegisterType<Box2DGearJoint>(uri, 1, 1, "GearJoint");
    qmlRegisterType<Box2DRopeJoint>(uri, 1, 1, "RopeJoint");

    qmlRegisterUncreatableType<Box2DContact>(uri, 1,1, "Contact",QStringLiteral("Contact class"));
    qmlRegisterType<Box2DRayCast>(uri, 1,1, "RayCast");

}
/*!
    \internal
 */
bool QSystemSemaphorePrivate::modifySemaphore(int count)
{
    if (-1 == handle())
        return false;

    struct sembuf operation;
    operation.sem_num = 0;
    operation.sem_op = count;
    operation.sem_flg = SEM_UNDO;

    int res;
    EINTR_LOOP(res, semop(semaphore, &operation, 1));
    if (-1 == res) {
        // If the semaphore was removed be nice and create it and then modifySemaphore again
        if (errno == EINVAL || errno == EIDRM) {
            semaphore = -1;
            cleanHandle();
            handle();
            return modifySemaphore(count);
        }
        setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
        qDebug() << QLatin1String("QSystemSemaphore::modify failed") << count << semctl(semaphore, 0, GETVAL) << errno << EIDRM << EINVAL;
#endif
        return false;
    }

    clearError();
    return true;
}