QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer()
{
#ifndef Q_OS_WINCE
    const char platformVar[] = "QT_ANGLE_PLATFORM";
    if (qEnvironmentVariableIsSet(platformVar)) {
        const QByteArray anglePlatform = qgetenv(platformVar);
        if (anglePlatform == "d3d11")
            return QWindowsOpenGLTester::AngleRendererD3d11;
        if (anglePlatform == "d3d9")
            return QWindowsOpenGLTester::AngleRendererD3d9;
        if (anglePlatform == "warp")
            return QWindowsOpenGLTester::AngleRendererD3d11Warp;
        qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform;
    }
#endif // !Q_OS_WINCE
    return QWindowsOpenGLTester::InvalidRenderer;
}
示例#2
0
文件: NpcStore.cpp 项目: nemerle/Segs
void NPCStorage::prepare_dictionaries()
{
    // client expects the indices of npcs to be taken from sorted by name array
    std::sort(std::begin(m_all_npcs),std::end(m_all_npcs),[](const Parse_NPC &a,const Parse_NPC &b)->bool {
        return a.m_Name.compare(b.m_Name,Qt::CaseInsensitive)<0;
    });
    for(Parse_NPC &npc : m_all_npcs)
    {
        auto iter = m_name_to_npc_def.find(npc.m_Name.toLower());
        if(iter!=m_name_to_npc_def.end())
        {
            qCWarning(logNPCs) << "Duplicate NPC name" << npc.m_Name << "vs" << iter.value()->m_Name;
            continue;
        }
        m_name_to_npc_def[npc.m_Name.toLower()] = &npc;
    }
}
示例#3
0
quint32 Bundle::crcFile(enum Bundle::File file) const
{
    quint32 ret = 0;

    switch (file) {
    case Bundle::BINARY:
        ret = b->manifest.value(type()).toObject().value("crc").toDouble();
        break;
    case Bundle::RESOURCES:
        ret = b->manifest.value("resources").toObject().value("crc").toDouble();
        break;
    default:
        qCWarning(l) << "Unsupported CRC for" << file;
    }

    return ret;
}
示例#4
0
const QVariant Konfiguration::WertHolen(const QString &name,const QVariant &standart)
{
	if (K_Konfigpuffer.contains(name))
		return K_Konfigpuffer[name];
	else
	{
		if (K_Konfig->contains(name))
		{
			qCDebug(qalarm_Konfiguration)<<tr("%1 nicht im Puffer, lade aus Datei bzw. Standart.").arg(name);
			K_Konfigpuffer.insert(name,K_Konfig->value(name,standart));
			return K_Konfigpuffer[name];
		}
		else
			qCWarning(qalarm_Konfiguration)<<tr("Wert %1 nicht gefunden.").arg(name);
	}
	return standart;
}
示例#5
0
void DevicesModel::refreshDeviceList()
{
    if (!m_dbusInterface->isValid()) {
        clearDevices();
        qCWarning(KDECONNECT_INTERFACES) << "dbus interface not valid";
        return;
    }

    bool onlyPaired = (m_displayFilter & StatusPaired);
    bool onlyReachable = (m_displayFilter & StatusReachable);

    QDBusPendingReply<QStringList> pendingDeviceIds = m_dbusInterface->devices(onlyReachable, onlyPaired);
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingDeviceIds, this);

    QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                     this, SLOT(receivedDeviceList(QDBusPendingCallWatcher*)));
}
void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address,
                                               const QBluetoothUuid &uuid,
                                               QIODevice::OpenMode openMode)
{
    Q_Q(QBluetoothSocket);
    Q_UNUSED(openMode);
    qCDebug(QT_BT_QNX) << "Connecting socket";

    m_peerAddress = address;
#ifdef QT_QNX_BT_BLUETOOTH
    QByteArray b_uuid = uuid.toByteArray();
    b_uuid = b_uuid.mid(1, b_uuid.length() - 2);
    socket = bt_spp_open(address.toString().toUtf8().data(), b_uuid.data(), false);
    if (socket == -1) {
        qCWarning(QT_BT_QNX) << "Could not connect to" << address.toString() << b_uuid <<  qt_error_string(errno);
        errorString = qt_error_string(errno);
        q->setSocketError(QBluetoothSocket::NetworkError);
        return;
    }

    delete readNotifier;
    delete connectWriteNotifier;

    readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
    QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
    connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
    QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));

    connecting = true;
    q->setOpenMode(openMode);
#else
    m_uuid = uuid;
    if (isServerSocket)
        return;

    if (state != QBluetoothSocket::UnconnectedState) {
        qCDebug(QT_BT_QNX) << "Socket already connected";
        return;
    }

    ppsSendControlMessage("connect_service", 0x1101, uuid, address.toString(), QString(), this, BT_SPP_CLIENT_SUBTYPE);
    ppsRegisterForEvent(QStringLiteral("service_connected"),this);
    ppsRegisterForEvent(QStringLiteral("get_mount_point_path"),this);
#endif
    q->setSocketState(QBluetoothSocket::ConnectingState);
}
示例#7
0
QStringList AWDBusAdaptor::ActiveServices() const
{
    QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(
        QDBus::BlockWithGui, "ListNames");
    if (listServices.arguments().isEmpty()) {
        qCWarning(LOG_DBUS) << "Could not find any DBus service";
        return {};
    }
    QStringList arguments = listServices.arguments().first().toStringList();

    return std::accumulate(arguments.cbegin(), arguments.cend(), QStringList(),
                           [](QStringList &source, QString service) {
                               if (service.startsWith(AWDBUS_SERVICE))
                                   source.append(service);
                               return source;
                           });
}
示例#8
0
文件: fb_backend.cpp 项目: 8l/kwin
void FramebufferBackend::map()
{
    if (m_memory) {
        // already mapped;
        return;
    }
    if (m_fd < 0) {
        // not valid
        return;
    }
    void *mem = mmap(nullptr, m_bufferLength, PROT_WRITE, MAP_SHARED, m_fd, 0);
    if (mem == MAP_FAILED) {
        qCWarning(KWIN_FB) << "Failed to mmap frame buffer";
        return;
    }
    m_memory = mem;
}
示例#9
0
chrono::milliseconds ConfigFile::remotePollInterval(const QString &connection) const
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();

    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    auto defaultPollInterval = chrono::milliseconds(DEFAULT_REMOTE_POLL_INTERVAL);
    auto remoteInterval = millisecondsValue(settings, remotePollIntervalC, defaultPollInterval);
    if (remoteInterval < chrono::seconds(5)) {
        qCWarning(lcConfigFile) << "Remote Interval is less than 5 seconds, reverting to" << DEFAULT_REMOTE_POLL_INTERVAL;
        remoteInterval = defaultPollInterval;
    }
    return remoteInterval;
}
示例#10
0
/**
 * @fn convertOptionName
 */
QPair<QString, QString> QueuedPluginManager::convertOptionName(const QString &_key)
{
    qCDebug(LOG_PL) << "Convert option name" << _key;

    QStringList fields = _key.split('.');
    if (fields.count() < 3) {
        qCWarning(LOG_PL) << "Invalid option name" << _key;
        return {"", ""};
    }
    // Plugin.
    fields.takeFirst();
    // plugin name
    QString plugin = fields.takeFirst();
    QString option = fields.join('.');

    return {plugin, option};
}
示例#11
0
void ppsRegisterControl()
{
    count++;
    if (count == 1) {
        if (ppsCtrlFD != -1) {
            qCDebug(QT_BT_QNX) << "PPS control FD not properly deinitialized";
            return;
        }
        ppsCtrlFD = qt_safe_open(btControlFDPath, O_RDWR | O_SYNC);
        if (ppsCtrlFD == -1) {
            qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "ppsCtrlFD - failed to qt_safe_open" << btControlFDPath;
        } else {
            ppsCtrlNotifier = new QSocketNotifier(ppsCtrlFD, QSocketNotifier::Read);
            QObject::connect(ppsCtrlNotifier, SIGNAL(activated(int)), &bbSocketNotifier, SLOT(distribute()));
        }
    }
}
示例#12
0
/**
 * @fn tryGetUser
 */
QueuedUser *QueuedCorePrivateHelper::tryGetUser(const long long _id)
{
    auto user = users()->user(_id);
    if (!user) {
        qCInfo(LOG_LIB) << "Try to get information about user" << _id << "from database";
        auto data = database()->get(QueuedDB::USERS_TABLE, _id);
        if (data.isEmpty()) {
            qCWarning(LOG_LIB) << "Could not find user with ID" << _id;
            return nullptr;
        }

        auto defs = QueuedUserManager::parseDefinitions(data);
        user = new QueuedUser(this, defs, _id);
    }

    return user;
}
示例#13
0
/** Updates, creates or removes a blacklist entry for the given item.
 *
 * May adjust the status or item._errorString.
 */
static void blacklistUpdate(SyncJournalDb *journal, SyncFileItem &item)
{
    SyncJournalErrorBlacklistRecord oldEntry = journal->errorBlacklistEntry(item._file);

    bool mayBlacklist =
        item._errorMayBeBlacklisted // explicitly flagged for blacklisting
        || ((item._status == SyncFileItem::NormalError
                || item._status == SyncFileItem::SoftError
                || item._status == SyncFileItem::DetailError)
               && item._httpErrorCode != 0 // or non-local error
               );

    // No new entry? Possibly remove the old one, then done.
    if (!mayBlacklist) {
        if (oldEntry.isValid()) {
            journal->wipeErrorBlacklistEntry(item._file);
        }
        return;
    }

    auto newEntry = createBlacklistEntry(oldEntry, item);
    journal->setErrorBlacklistEntry(newEntry);

    // Suppress the error if it was and continues to be blacklisted.
    // An ignoreDuration of 0 mean we're tracking the error, but not actively
    // suppressing it.
    if (item._hasBlacklistEntry && newEntry._ignoreDuration > 0) {
        item._status = SyncFileItem::BlacklistedError;

        qCInfo(lcPropagator) << "blacklisting " << item._file
                             << " for " << newEntry._ignoreDuration
                             << ", retry count " << newEntry._retryCount;

        return;
    }

    // Some soft errors might become louder on repeat occurrence
    if (item._status == SyncFileItem::SoftError
        && newEntry._retryCount > 1) {
        qCWarning(lcPropagator) << "escalating soft error on " << item._file
                                << " to normal error, " << item._httpErrorCode;
        item._status = SyncFileItem::NormalError;
        return;
    }
}
示例#14
0
quint64 ConfigFile::forceSyncInterval(const QString &connection) const
{
    uint pollInterval = remotePollInterval(connection);

    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    quint64 defaultInterval = 2 * 60 * 60 * 1000ull; // 2h
    quint64 interval = settings.value(QLatin1String(forceSyncIntervalC), defaultInterval).toULongLong();
    if (interval < pollInterval) {
        qCWarning(lcConfigFile) << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval;
        interval = pollInterval;
    }
    return interval;
}
示例#15
0
QString ExtScript::applyFilters(QString _value) const
{
    qCDebug(LOG_LIB) << "Value" << _value;

    for (auto filt : m_filters) {
        qCInfo(LOG_LIB) << "Found filter" << filt;
        QVariantMap filter = jsonFilters[filt].toMap();
        if (filter.isEmpty()) {
            qCWarning(LOG_LIB) << "Could not find filter" << _value
                               << "in the json";
            continue;
        }
        for (auto f : filter.keys())
            _value.replace(f, filter[f].toString());
    }

    return _value;
}
示例#16
0
uint TypeRepository::indexForType(const AbstractType::Ptr input) {
  if(!input)
    return 0;

  uint i = typeRepository()->index(AbstractTypeDataRequest(*input));
#ifdef DEBUG_TYPE_REPOSITORY
  AbstractType::Ptr t = typeForIndex(i);
  if(!t->equals(input.data())) {
      qCWarning(LANGUAGE) << "found type in repository does not equal source type:" << input->toString() << t->toString();
      t->equals(input.data());
  }
#ifdef ASSERT_ON_PROBLEM
  Q_ASSERT(t->equals(input.data()));
  Q_ASSERT(input->equals(t.data()));
#endif
#endif
  return i;
}
示例#17
0
void XWaylandManager::handleSurfaceId(XWaylandShellSurface *window, xcb_client_message_event_t *event)
{
    if (window->surface()) {
        qCWarning(XWAYLAND_TRACE) << "Window" << window->window() << "already has a surface id";
        return;
    }

    quint32 id = event->data.data32[0];
    window->setSurfaceId(id);

    wl_resource *resource = wl_client_get_object(m_server->client(), id);
    if (resource) {
        window->setSurface(QWaylandSurface::fromResource(resource));
    } else {
        window->setSurface(Q_NULLPTR);
        m_unpairedWindows.append(window);
    }
}
示例#18
0
chrono::milliseconds ConfigFile::updateCheckInterval(const QString &connection) const
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    auto defaultInterval = chrono::hours(10);
    auto interval = millisecondsValue(settings, updateCheckIntervalC, defaultInterval);

    auto minInterval = chrono::minutes(5);
    if (interval < minInterval) {
        qCWarning(lcConfigFile) << "Update check interval less than five minutes, resetting to 5 minutes";
        interval = minInterval;
    }
    return interval;
}
示例#19
0
static QByteArray read_data( archive* a ){
	QByteArray raw;
	
	//Read chuncks
	const char *buff;
	size_t size;
	int64_t offset;
	
	while( true ){
		switch( archive_read_data_block( a, (const void**)&buff, &size, &offset ) ){
			case ARCHIVE_OK: raw += QByteArray( buff, size ); break;
			case ARCHIVE_EOF: return raw;
			default:
				qCWarning(LOG) << "Error while reading zip data:" << archive_error_string(a);
				return raw;
		}
	}
}
示例#20
0
LayoutSet X11Helper::getCurrentLayouts()
{
	LayoutSet layoutSet;

	QList<LayoutUnit> currentLayouts = getLayoutsList();
	layoutSet.layouts = currentLayouts;

	unsigned int group = X11Helper::getGroup();
	if( group < (unsigned int)currentLayouts.size() ) {
		layoutSet.currentLayout = currentLayouts[group];
	}
	else {
		qCWarning(KCM_KEYBOARD) << "Current group number" << group << "is outside of current layout list" << getLayoutsListAsString(currentLayouts);
		layoutSet.currentLayout = LayoutUnit();
	}

	return layoutSet;
}
示例#21
0
void MoveJob::start()
{
    QNetworkRequest req;
    req.setRawHeader("Destination", QUrl::toPercentEncoding(_destination, "/"));
    for (auto it = _extraHeaders.constBegin(); it != _extraHeaders.constEnd(); ++it) {
        req.setRawHeader(it.key(), it.value());
    }
    if (_url.isValid()) {
        sendRequest("MOVE", _url, req);
    } else {
        sendRequest("MOVE", makeDavUrl(path()), req);
    }

    if (reply()->error() != QNetworkReply::NoError) {
        qCWarning(lcPropagateRemoteMove) << " Network error: " << reply()->errorString();
    }
    AbstractNetworkJob::start();
}
示例#22
0
chrono::milliseconds ConfigFile::forceSyncInterval(const QString &connection) const
{
    auto pollInterval = remotePollInterval(connection);

    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    auto defaultInterval = chrono::hours(2);
    auto interval = millisecondsValue(settings, forceSyncIntervalC, defaultInterval);
    if (interval < pollInterval) {
        qCWarning(lcConfigFile) << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval.count();
        interval = pollInterval;
    }
    return interval;
}
示例#23
0
bool SqlDatabase::openReadOnly(const QString &filename)
{
    if (isOpen()) {
        return true;
    }

    if (!openHelper(filename, SQLITE_OPEN_READONLY)) {
        return false;
    }

    if (checkDb() != CheckDbResult::Ok) {
        qCWarning(lcSql) << "Consistency check failed in readonly mode, giving up" << filename;
        close();
        return false;
    }

    return true;
}
示例#24
0
int ConfigFile::updateCheckInterval(const QString &connection) const
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    int defaultInterval = 1000 * 60 * 60 * 10; // ten hours
    int interval = settings.value(QLatin1String(updateCheckIntervalC), defaultInterval).toInt();

    int minInterval = 1000 * 60 * 5;
    if (interval < minInterval) {
        qCWarning(lcConfigFile) << "Update check interval less than five minutes, setting " << minInterval;
        interval = minInterval;
    }
    return interval;
}
示例#25
0
QString TvDevice::printXmlData(const QByteArray &data)
{
    QString xmlOut;
    QXmlStreamReader reader(data);
    QXmlStreamWriter writer(&xmlOut);
    writer.setAutoFormatting(true);

    while (!reader.atEnd()) {
        reader.readNext();
        if(!reader.isWhitespace()) {
            writer.writeCurrentToken(reader);
        }
    }
    if(reader.hasError()) {
        qCWarning(dcLgSmartTv) << "error reading XML device information:" << reader.errorString();
    }
    return xmlOut;
}
示例#26
0
bool DrmPlane::isCrtcSupported(uint32_t crtc)
{
    ScopedDrmPointer<_drmModeRes, &drmModeFreeResources> res(drmModeGetResources(m_fd));
    if (!res) {
        qCWarning(KWIN_DRM) << "Failed to get drm resources";
    }
    for (int c = 0; c < res->count_crtcs; c++) {
        if (res->crtcs[c] != crtc) {
            continue;
        }
        qCDebug(KWIN_DRM) <<  "Mask " << m_possibleCrtcs << ", idx " << c;
        if (m_possibleCrtcs & (1 << c)) {
            return true;
        }
    }
    qCDebug(KWIN_DRM) <<  "CRTC" << crtc << "not supported";
    return false;
}
示例#27
0
bool ConsolePlan::addPlane(float angle, QList<Plane2DCoordinate> coordinates)
{
    QString str;
    if (m_planeSpots.contains(angle))
    {
        //  overwrite the existed plane
        m_planeSpots.insert(angle,coordinates);
        str = printLastAction(AddPlane) + printLastError(ErrorOverwriteExistingPlane);
        qCWarning(PlanGenerator()) << PlanGenerator().categoryName() << str;
        return false;
    }else
    {
        m_planeSpots.insert(angle,coordinates);
        str = printLastAction(AddPlane) + printLastError(NoError);
        qCDebug(PlanGenerator()) << PlanGenerator().categoryName() << str;
        return true;
    }
}
示例#28
0
文件: kfileitem.cpp 项目: KDE/kio
void KFileItem::refresh()
{
    if (!d) {
        qCWarning(KIO_CORE) << "null item";
        return;
    }

    d->m_fileMode = KFileItem::Unknown;
    d->m_permissions = KFileItem::Unknown;
    d->m_hidden = KFileItemPrivate::Auto;
    refreshMimeType();

    // Basically, we can't trust any information we got while listing.
    // Everything could have changed...
    // Clearing m_entry makes it possible to detect changes in the size of the file,
    // the time information, etc.
    d->m_entry.clear();
    d->init(); // re-populates d->m_entry
}
示例#29
0
bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port)
{
    Q_UNUSED(address)
    Q_D(QBluetoothServer);
    if (serverType() != QBluetoothServiceInfo::RfcommProtocol) {
        d->m_lastError = UnsupportedProtocolError;
        emit error(d->m_lastError);
        return false;
    }

    // listen has already been called before
    if (d->socket && d->socket->state() == QBluetoothSocket::ListeningState)
        return true;

    d->socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);

    //We can not register an actual Rfcomm port, because the platform does not allow it
    //but we need a way to associate a server with a service

    if (port == 0) { //Try to assign a non taken port id
        for (int i=1; ; i++){
            if (__fakeServerPorts.key(i) == 0) {
                port = i;
                break;
            }
        }
    }

    if (__fakeServerPorts.key(port) == 0) {
        __fakeServerPorts[d] = port;
        qCDebug(QT_BT_QNX) << "Port" << port << "registered";
    } else {
        qCWarning(QT_BT_QNX) << "server with port" << port << "already registered or port invalid";
        d->m_lastError = ServiceAlreadyRegisteredError;
        emit error(d->m_lastError);
        return false;
    }

    d->socket->setSocketState(QBluetoothSocket::ListeningState);

    ppsRegisterForEvent(QStringLiteral("service_connected"),d);
    return true;
}
void NotificationsModel::refreshNotificationList()
{
    if (!m_dbusInterface) {
        return;
    }

    clearNotifications();

    if (!m_dbusInterface->isValid()) {
        qCWarning(KDECONNECT_INTERFACES) << "dbus interface not valid";
        return;
    }

    QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications();
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingNotificationIds, this);

    QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                     this, SLOT(receivedNotifications(QDBusPendingCallWatcher*)));
}