void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) { QQuickWebEngineNewViewRequest request; // This increases the ref-count of newWebContents and will tell Chromium // to start loading it and possibly return it to its parent page window.open(). request.m_adapter = newWebContents; request.m_isUserInitiated = userGesture; switch (disposition) { case WebContentsAdapterClient::NewForegroundTabDisposition: case WebContentsAdapterClient::NewBackgroundTabDisposition: request.m_destination = QQuickWebEngineView::NewViewInTab; break; case WebContentsAdapterClient::NewPopupDisposition: request.m_destination = QQuickWebEngineView::NewViewInDialog; break; case WebContentsAdapterClient::NewWindowDisposition: request.m_destination = QQuickWebEngineView::NewViewInWindow; break; default: Q_UNREACHABLE(); } emit e->newViewRequested(&request); }
int VisualStudioVersionInfo::marketingVersion() const { switch (m_version.majorVersion()) { case 6: return 6; case 7: switch (m_version.minorVersion()) { case 0: return 2002; case 1: return 2003; default: Q_UNREACHABLE(); } break; case 8: return 2005; case 9: return 2008; case 10: return 2010; case 11: return 2012; case 12: return 2013; case 14: return 2015; case 15: return 2017; default: qWarning() << QStringLiteral("unrecognized Visual Studio version: ") << m_version.toString(); return 0; } }
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) return; wl_output_transform transform; bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation; switch (orientation) { case Qt::PrimaryOrientation: transform = WL_OUTPUT_TRANSFORM_NORMAL; break; case Qt::LandscapeOrientation: transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL; break; case Qt::PortraitOrientation: transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90; break; case Qt::InvertedLandscapeOrientation: transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180; break; case Qt::InvertedPortraitOrientation: transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; break; default: Q_UNREACHABLE(); } set_buffer_transform(transform); // set_buffer_transform is double buffered, we need to commit. commit(); }
const QString NetworkPlugin::itemContextMenu(const QString &itemKey) { for (auto item : m_deviceItemList) if (item->uuid() == itemKey) return item->itemContextMenu(); Q_UNREACHABLE(); return QString(); }
const QString NetworkPlugin::itemCommand(const QString &itemKey) { for (auto deviceItem : m_deviceItemList) if (deviceItem->uuid() == itemKey) return deviceItem->itemCommand(); Q_UNREACHABLE(); return QString(); }
void Shred::ReloadTo(const dirs direction) { switch ( direction ) { case NORTH: ++shredY; break; case SOUTH: --shredY; break; case EAST: --shredX; break; case WEST: ++shredX; break; default: Q_UNREACHABLE(); break; } }
static QString fileNameForComponent(UIDelegatesManager::ComponentType type) { switch (type) { FOR_EACH_COMPONENT_TYPE(FILE_NAME_CASE_STATEMENT, NO_SEPARATOR) default: Q_UNREACHABLE(); } return QString(); }
int AudioMixerClientData::processPackets(ConcurrentAddedStreams& addedStreams) { SharedNodePointer node = _packetQueue.node; assert(_packetQueue.empty() || node); _packetQueue.node.clear(); while (!_packetQueue.empty()) { auto& packet = _packetQueue.front(); switch (packet->getType()) { case PacketType::MicrophoneAudioNoEcho: case PacketType::MicrophoneAudioWithEcho: case PacketType::InjectAudio: case PacketType::SilentAudioFrame: { if (node->isUpstream()) { setupCodecForReplicatedAgent(packet); } processStreamPacket(*packet, addedStreams); optionallyReplicatePacket(*packet, *node); break; } case PacketType::AudioStreamStats: { parseData(*packet); break; } case PacketType::NegotiateAudioFormat: negotiateAudioFormat(*packet, node); break; case PacketType::RequestsDomainListData: parseRequestsDomainListData(*packet); break; case PacketType::PerAvatarGainSet: parsePerAvatarGainSet(*packet, node); break; case PacketType::NodeIgnoreRequest: parseNodeIgnoreRequest(packet, node); break; case PacketType::RadiusIgnoreRequest: parseRadiusIgnoreRequest(packet, node); break; case PacketType::AudioSoloRequest: parseSoloRequest(packet, node); break; default: Q_UNREACHABLE(); } _packetQueue.pop(); } assert(_packetQueue.empty()); // now that we have processed all packets for this frame // we can prepare the sources from this client to be ready for mixing return checkBuffersBeforeFrameSend(); }
void Scene::MoveCursorToAdhere(const Edge& edge) { Q_CHECK_PTR(cursor_); if (const auto adherable = GetAdherableEdge(*cursor_, edge)) { if (const auto difference = Difference(*adherable, edge)) { cursor_->moveBy(difference->x(), difference->y()); return; } } Q_UNREACHABLE(); }
void AudioMixerClientData::processPackets() { SharedNodePointer node = _packetQueue.node; assert(_packetQueue.empty() || node); _packetQueue.node.clear(); while (!_packetQueue.empty()) { auto& packet = _packetQueue.front(); switch (packet->getType()) { case PacketType::MicrophoneAudioNoEcho: case PacketType::MicrophoneAudioWithEcho: case PacketType::InjectAudio: case PacketType::SilentAudioFrame: { if (node->isUpstream()) { setupCodecForReplicatedAgent(packet); } QMutexLocker lock(&getMutex()); parseData(*packet); optionallyReplicatePacket(*packet, *node); break; } case PacketType::AudioStreamStats: { QMutexLocker lock(&getMutex()); parseData(*packet); break; } case PacketType::NegotiateAudioFormat: negotiateAudioFormat(*packet, node); break; case PacketType::RequestsDomainListData: parseRequestsDomainListData(*packet); break; case PacketType::PerAvatarGainSet: parsePerAvatarGainSet(*packet, node); break; case PacketType::NodeIgnoreRequest: parseNodeIgnoreRequest(packet, node); break; case PacketType::RadiusIgnoreRequest: parseRadiusIgnoreRequest(packet, node); break; default: Q_UNREACHABLE(); } _packetQueue.pop(); } assert(_packetQueue.empty()); }
static QString nameForType(RangeType typeNumber) { switch (typeNumber) { case Compiling: return FlameGraphModel::tr("Compile"); case Creating: return FlameGraphModel::tr("Create"); case Binding: return FlameGraphModel::tr("Binding"); case HandlingSignal: return FlameGraphModel::tr("Signal"); case Javascript: return FlameGraphModel::tr("JavaScript"); default: Q_UNREACHABLE(); } }
void QSGNodeVisitorEx::visitChildren(QSGNode *node) { for (QSGNode *child = node->firstChild(); child; child = child->nextSibling()) { switch (child->type()) { case QSGNode::ClipNodeType: { QSGClipNode *c = static_cast<QSGClipNode*>(child); if (visit(c)) visitChildren(c); endVisit(c); break; } case QSGNode::TransformNodeType: { QSGTransformNode *c = static_cast<QSGTransformNode*>(child); if (visit(c)) visitChildren(c); endVisit(c); break; } case QSGNode::OpacityNodeType: { QSGOpacityNode *c = static_cast<QSGOpacityNode*>(child); if (visit(c)) visitChildren(c); endVisit(c); break; } case QSGNode::GeometryNodeType: { if (child->flags() & QSGNode::IsVisitableNode) { QSGVisitableNode *v = static_cast<QSGVisitableNode*>(child); v->accept(this); } else { QSGGeometryNode *c = static_cast<QSGGeometryNode*>(child); if (visit(c)) visitChildren(c); endVisit(c); } break; } case QSGNode::RootNodeType: { QSGRootNode *root = static_cast<QSGRootNode*>(child); if (visit(root)) visitChildren(root); endVisit(root); break; } case QSGNode::BasicNodeType: { visitChildren(child); break; } default: Q_UNREACHABLE(); break; } } }
static const char *candidateSignal(int which) { switch (CandidateSignal(which)) { case TextValueSelectedSignal: return SIGNAL(textValueSelected(QString)); case IntValueSelectedSignal: return SIGNAL(intValueSelected(int)); case DoubleValueSelectedSignal: return SIGNAL(doubleValueSelected(double)); case NumCandidateSignals: ; // fall through }; Q_UNREACHABLE(); return Q_NULLPTR; }
Edge::EdgeLength Edge::Length() const { switch (num_.value()) { case 0: // fallthrough case 3: return EdgeLength::kLong; case 1: // fallthrough case 2: return EdgeLength::kShort; default: Q_UNREACHABLE(); } }
FSTReader::ModelType ModelSelector::getModelType() const { QString text = _modelType->currentText(); if (text == AVATAR_HEAD_AND_BODY_STRING) { return FSTReader::HEAD_AND_BODY_MODEL; } else if (text == AVATAR_ATTACHEMENT_STRING) { return FSTReader::ATTACHMENT_MODEL; } else if (text == ENTITY_MODEL_STRING) { return FSTReader::ENTITY_MODEL; } Q_UNREACHABLE(); }
QRgb PointHandles::stateColor(PointHandleState state) const { switch (state) { case NormalHandleState: return qRgb( 0, 0, 255); case ActiveHandleState: return qRgb(255, 150, 0); case SelectedHandleState: return qRgb(255, 0, 0); case DisabledHandleState: return qRgb(106, 106, 106); default: Q_UNREACHABLE(); return qRgb(255, 0, 0); } }
Utils::SmallString SqlStatementBuilder::columnTypeToString(ColumnType columnType) { switch (columnType) { case ColumnType::Numeric: return "NUMERIC"; case ColumnType::Integer: return "INTEGER"; case ColumnType::Real: return "REAL"; case ColumnType::Text: return "TEXT"; case ColumnType::None: return {}; } Q_UNREACHABLE(); }
/*! \internal Called by LoadAnimationClipJob on the threadpool */ void AnimationClip::loadAnimation() { qCDebug(Jobs) << Q_FUNC_INFO << m_source; clearData(); // Load the data switch (m_dataType) { case File: loadAnimationFromUrl(); break; case Data: loadAnimationFromData(); break; default: Q_UNREACHABLE(); } // Update the duration const float t = findDuration(); setDuration(t); m_channelComponentCount = findChannelComponentCount(); // If using a loader inform the frontend of the status change if (m_source.isEmpty()) { if (qFuzzyIsNull(t) || m_channelComponentCount == 0) setStatus(QAnimationClipLoader::Error); else setStatus(QAnimationClipLoader::Ready); } // notify all ClipAnimators and BlendedClipAnimators that depend on this clip, // that the clip has changed and that they are now dirty { QMutexLocker lock(&m_mutex); for (const Qt3DCore::QNodeId id : qAsConst(m_dependingAnimators)) { ClipAnimator *animator = m_handler->clipAnimatorManager()->lookupResource(id); if (animator) animator->animationClipMarkedDirty(); } for (const Qt3DCore::QNodeId id : qAsConst(m_dependingBlendedAnimators)) { BlendedClipAnimator *animator = m_handler->blendedClipAnimatorManager()->lookupResource(id); if (animator) animator->animationClipMarkedDirty(); } m_dependingAnimators.clear(); m_dependingBlendedAnimators.clear(); } qCDebug(Jobs) << "Loaded animation data:" << *this; }
void QMirClientInput::dispatchTouchEvent(QMirClientWindow *window, const MirInputEvent *ev) { const MirTouchEvent *tev = mir_input_event_get_touch_event(ev); // FIXME(loicm) Max pressure is device specific. That one is for the Samsung Galaxy Nexus. That // needs to be fixed as soon as the compat input lib adds query support. const float kMaxPressure = 1.28; const QRect kWindowGeometry = window->geometry(); QList<QWindowSystemInterface::TouchPoint> touchPoints; // TODO: Is it worth setting the Qt::TouchPointStationary ones? Currently they are left // as Qt::TouchPointMoved const unsigned int kPointerCount = mir_touch_event_point_count(tev); touchPoints.reserve(int(kPointerCount)); for (unsigned int i = 0; i < kPointerCount; ++i) { QWindowSystemInterface::TouchPoint touchPoint; const float kX = mir_touch_event_axis_value(tev, i, mir_touch_axis_x) + kWindowGeometry.x(); const float kY = mir_touch_event_axis_value(tev, i, mir_touch_axis_y) + kWindowGeometry.y(); // see bug lp:1346633 workaround comments elsewhere const float kW = mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_major); const float kH = mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_minor); const float kP = mir_touch_event_axis_value(tev, i, mir_touch_axis_pressure); touchPoint.id = mir_touch_event_id(tev, i); touchPoint.normalPosition = QPointF(kX / kWindowGeometry.width(), kY / kWindowGeometry.height()); touchPoint.area = QRectF(kX - (kW / 2.0), kY - (kH / 2.0), kW, kH); touchPoint.pressure = kP / kMaxPressure; MirTouchAction touch_action = mir_touch_event_action(tev, i); switch (touch_action) { case mir_touch_action_down: mLastInputWindow = window; touchPoint.state = Qt::TouchPointPressed; break; case mir_touch_action_up: touchPoint.state = Qt::TouchPointReleased; break; case mir_touch_action_change: touchPoint.state = Qt::TouchPointMoved; break; default: Q_UNREACHABLE(); } touchPoints.append(touchPoint); } ulong timestamp = mir_input_event_get_event_time(ev) / 1000000; QWindowSystemInterface::handleTouchEvent(window->window(), timestamp, mTouchDevice, touchPoints); }
float UpdateAxisActionJob::processAxisInput(const Qt3DCore::QNodeId axisInputId) { AnalogAxisInput *analogInput = m_handler->analogAxisInputManager()->lookupResource(axisInputId); if (analogInput) return analogInput->process(m_handler, m_currentTime); ButtonAxisInput *buttonInput = m_handler->buttonAxisInputManager()->lookupResource(axisInputId); if (buttonInput) return buttonInput->process(m_handler, m_currentTime); Q_UNREACHABLE(); return 0.0f; }
QString Telegram::Peer::toString() const { switch (type) { case User: return c_userPrefix + QString::number(id); case Chat: return c_chatPrefix + QString::number(id); case Channel: return c_channelPrefix + QString::number(id); } Q_UNREACHABLE(); return QString(); }
void peoplecount::preprocess_cmdargs() { // Default options auto const& help_opt = parser_->addHelpOption(); auto const& ver_opt = parser_->addVersionOption(); configure_cmdparser(); if (!parser_->parse(arguments())) { QTextStream(stderr) << parser_->errorText(); exit(EXIT_FAILURE); } if (parser_->isSet(help_opt)) { parser_->showHelp(EXIT_SUCCESS); Q_UNREACHABLE(); } if (parser_->isSet(ver_opt)) { parser_->showVersion(); Q_UNREACHABLE(); } if (parser_->isSet("listmodules")) { QTextStream(stdout) << "Available modules\n"; for (auto const& m : module_factory_->list()) { QTextStream(stdout) << "\t" << m << "\n"; } std::exit(EXIT_SUCCESS); } if (parser_->isSet("scriptport")) { bool ok; int port = parser_->value("scriptport").toInt(&ok); if (ok && (port > 1024 && port < 65535)) { script_ = new script_if(this); script_->start_server(port); } else { QTextStream(stdout) << "Invalid script port\n"; std::exit(EXIT_FAILURE); } } }
/*! \internal */ QByteArray QSslKeyPrivate::pemHeader() const { if (type == QSsl::PublicKey) return QByteArrayLiteral("-----BEGIN PUBLIC KEY-----"); else if (algorithm == QSsl::Rsa) return QByteArrayLiteral("-----BEGIN RSA PRIVATE KEY-----"); else if (algorithm == QSsl::Dsa) return QByteArrayLiteral("-----BEGIN DSA PRIVATE KEY-----"); else if (algorithm == QSsl::Ec) return QByteArrayLiteral("-----BEGIN EC PRIVATE KEY-----"); Q_UNREACHABLE(); return QByteArray(); }
static inline QString bannerPageToString(const QCUPSSupport::BannerPage bannerPage) { switch (bannerPage) { case QCUPSSupport::NoBanner: return QStringLiteral("none"); case QCUPSSupport::Standard: return QStringLiteral("standard"); case QCUPSSupport::Unclassified: return QStringLiteral("unclassified"); case QCUPSSupport::Confidential: return QStringLiteral("confidential"); case QCUPSSupport::Classified: return QStringLiteral("classified"); case QCUPSSupport::Secret: return QStringLiteral("secret"); case QCUPSSupport::TopSecret: return QStringLiteral("topsecret"); } Q_UNREACHABLE(); return QString(); };
/*! Adds the first \a length chars of \a data to the cryptographic hash. */ void QCryptographicHash::addData(const char *data, int length) { switch (d->method) { case Sha1: sha1Update(&d->sha1Context, (const unsigned char *)data, length); break; #ifdef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 default: Q_ASSERT_X(false, "QCryptographicHash", "Method not compiled in"); Q_UNREACHABLE(); break; #else case Md4: md4_update(&d->md4Context, (const unsigned char *)data, length); break; case Md5: MD5Update(&d->md5Context, (const unsigned char *)data, length); break; case Sha224: SHA224Input(&d->sha224Context, reinterpret_cast<const unsigned char *>(data), length); break; case Sha256: SHA256Input(&d->sha256Context, reinterpret_cast<const unsigned char *>(data), length); break; case Sha384: SHA384Input(&d->sha384Context, reinterpret_cast<const unsigned char *>(data), length); break; case Sha512: SHA512Input(&d->sha512Context, reinterpret_cast<const unsigned char *>(data), length); break; case RealSha3_224: case Keccak_224: sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8); break; case RealSha3_256: case Keccak_256: sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8); break; case RealSha3_384: case Keccak_384: sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8); break; case RealSha3_512: case Keccak_512: sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8); break; #endif } d->result.clear(); }
/*! Resets the object. */ void QCryptographicHash::reset() { switch (d->method) { case Sha1: sha1InitState(&d->sha1Context); break; #ifdef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 default: Q_ASSERT_X(false, "QCryptographicHash", "Method not compiled in"); Q_UNREACHABLE(); break; #else case Md4: md4_init(&d->md4Context); break; case Md5: MD5Init(&d->md5Context); break; case Sha224: SHA224Reset(&d->sha224Context); break; case Sha256: SHA256Reset(&d->sha256Context); break; case Sha384: SHA384Reset(&d->sha384Context); break; case Sha512: SHA512Reset(&d->sha512Context); break; case RealSha3_224: case Keccak_224: sha3Init(&d->sha3Context, 224); break; case RealSha3_256: case Keccak_256: sha3Init(&d->sha3Context, 256); break; case RealSha3_384: case Keccak_384: sha3Init(&d->sha3Context, 384); break; case RealSha3_512: case Keccak_512: sha3Init(&d->sha3Context, 512); break; #endif } d->result.clear(); }
static const char* nativeOrientationDirectionToStr(MirOrientation orientation) { switch (orientation) { case mir_orientation_normal: return "Normal"; case mir_orientation_left: return "Left"; case mir_orientation_inverted: return "Inverted"; case mir_orientation_right: return "Right"; } Q_UNREACHABLE(); }
void UDTTest::parseArguments() { // use a QCommandLineParser to setup command line arguments and give helpful output _argumentParser.setApplicationDescription("High Fidelity UDT Protocol Test Client"); _argumentParser.addHelpOption(); const QCommandLineOption helpOption = _argumentParser.addHelpOption(); _argumentParser.addOptions({ PORT_OPTION, TARGET_OPTION, PACKET_SIZE, MIN_PACKET_SIZE, MAX_PACKET_SIZE, MAX_SEND_BYTES, MAX_SEND_PACKETS, UNRELIABLE_PACKETS, ORDERED_PACKETS, MESSAGE_SIZE, MESSAGE_SEED, STATS_INTERVAL }); if (!_argumentParser.parse(arguments())) { qCritical() << _argumentParser.errorText(); _argumentParser.showHelp(); Q_UNREACHABLE(); } if (_argumentParser.isSet(helpOption)) { _argumentParser.showHelp(); Q_UNREACHABLE(); } }
QString fileErrorToString(QFileDevice::FileError error) { switch (error) { case QFileDevice::NoError: return AsyncFile::tr("NoError"); case QFileDevice::ReadError: return AsyncFile::tr("ReadError"); case QFileDevice::WriteError: return AsyncFile::tr("WriteError"); case QFileDevice::FatalError: return AsyncFile::tr("FatalError"); case QFileDevice::ResourceError: return AsyncFile::tr("ResourceError"); case QFileDevice::OpenError: return AsyncFile::tr("OpenError"); default: break; } Q_UNREACHABLE(); return AsyncFile::tr("UnknownError"); }
void Scene::RotateCursor(RotateDirection direction) { Q_CHECK_PTR(cursor_); Q_CHECK_PTR(collection_); switch (direction) { case RotateDirection::kLeft: cursor_->Rotate(36); break; case RotateDirection::kRight: cursor_->Rotate(-36); break; default: Q_UNREACHABLE(); } collection_->RearrangeAdherableEdges(*cursor_); }