void NetworkEditorView::focusInEvent(QFocusEvent* e) { auto enable = networkEditor_->selectedItems().size() > 0; setupAction("Cut", enable, [&]() { auto data = networkEditor_->cut(); auto mimedata = util::make_unique<QMimeData>(); mimedata->setData(QString("application/x.vnd.inviwo.network+xml"), data); mimedata->setData(QString("text/plain"), data); QApplication::clipboard()->setMimeData(mimedata.release()); }); setupAction("Copy", enable, [&]() { auto data = networkEditor_->copy(); auto mimedata = util::make_unique<QMimeData>(); mimedata->setData(QString("application/x.vnd.inviwo.network+xml"), data); mimedata->setData(QString("text/plain"), data); QApplication::clipboard()->setMimeData(mimedata.release()); }); setupAction("Paste", true, [&]() { auto clipboard = QApplication::clipboard(); auto mimeData = clipboard->mimeData(); if (mimeData->formats().contains(QString("application/x.vnd.inviwo.network+xml"))) { networkEditor_->paste(mimeData->data(QString("application/x.vnd.inviwo.network+xml"))); } else if (mimeData->formats().contains(QString("text/plain"))) { networkEditor_->paste(mimeData->data(QString("text/plain"))); } }); setupAction("Delete", enable, [&]() { networkEditor_->deleteSelection(); }); QGraphicsView::focusInEvent(e); }
static inline const VideoFormat *byFourCC(quint32 fourCC) { for (int i = 0; i < formats().size(); i++) if (formats()[i].fourCC == fourCC) return &formats()[i]; return &formats()[0]; }
static inline const VideoFormat *byBpp(int bpp) { for (int i = 0; i < formats().size(); i++) if (formats()[i].bpp == bpp) return &formats()[i]; return &formats()[0]; }
static inline const VideoFormat *byFormat(AkVideoCaps::PixelFormat format) { for (int i = 0; i < formats().size(); i++) if (formats()[i].format == format) return &formats()[i]; return &formats()[0]; }
// Put the list of net media in a parameter list void SDPMedia::putMedia(NamedList& msg, bool putPort) { msg.addParam("media" + suffix(),"yes"); msg.addParam("formats" + suffix(),formats()); msg.addParam("transport" + suffix(),transport()); if (mappings()) msg.addParam("rtp_mapping" + suffix(),mappings()); if (isAudio()) msg.addParam("rtp_rfc2833",rfc2833()); if (putPort) msg.addParam("rtp_port" + suffix(),remotePort()); if (remoteCrypto()) msg.addParam("crypto" + suffix(),remoteCrypto()); // must handle encryption differently const char* enc = getValue("encryption"); if (enc) msg.addParam("encryption" + suffix(),enc); clearParam("encryption"); unsigned int n = length(); for (unsigned int i = 0; i < n; i++) { const NamedString* param = getParam(i); if (param) msg.addParam("sdp" + suffix() + "_" + param->name(),*param); } }
STDMETHODIMP wxIDataObject::EnumFormatEtc(DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::EnumFormatEtc")); wxDataObject::Direction dir = dwDir == DATADIR_GET ? wxDataObject::Get : wxDataObject::Set; // format count is total of user specified and system formats. const size_t ourFormatCount = m_pDataObject->GetFormatCount(dir); const size_t sysFormatCount = m_systemData.size(); const ULONG nFormatCount = wx_truncate_cast(ULONG, ourFormatCount + sysFormatCount); // fill format array with formats ... wxScopedArray<wxDataFormat> formats(nFormatCount); // ... from content data (supported formats) m_pDataObject->GetAllFormats(formats.get(), dir); // ... from system data for ( size_t j = 0; j < sysFormatCount; j++ ) { SystemDataEntry* entry = m_systemData[j]; wxDataFormat& format = formats[ourFormatCount + j]; format = entry->pformatetc->cfFormat; } wxIEnumFORMATETC *pEnum = new wxIEnumFORMATETC(formats.get(), nFormatCount); pEnum->AddRef(); *ppenumFormatEtc = pEnum; return S_OK; }
int lprofP_output(lprofP_STATE* S){ if (S->stack_level == 0) { return 0; } S->stack_level--; info = &lprofS_pop(&(S->stack_top)); char* name = info->function_name; if (strlen(name) > MAX_FUNCTION_NAME_LENGTH) { name = (char*)malloc(MAX_FUNCTION_NAME_LENGTH + 10); name[0] = '\"'; strncpy(name + 1, info->function_name, MAX_FUNCTION_NAME_LENGTH); name[MAX_FUNCTION_NAME_LENGTH] = '"'; name[MAX_FUNCTION_NAME_LENGTH + 1] = '\0'; } formats(name); output("%d\t%s\t%s\t%d\t%d\t%f\t%f\n", info->stack_level, info->file_defined, name, info->line_defined, info->current_line, info->local_time, info->total_time); return 1; }
void babl_base_model_gray (void) { components (); models (); conversions (); formats (); }
bool SaverXml::enter(document::Document& document) { QString format = formats().format("mela")->setting<QString>("image_format", &document); image_format = mimeType(format, "image/png"); writer.writeStartElement("document"); writeId(document); writer.writeAttribute("width", QString::number(document.imageSize().width())); writer.writeAttribute("height", QString::number(document.imageSize().height())); writeMetadata(document.metadata()); const auto& settings = document.formatSettings().settings(); if ( !settings.empty() ) { writer.writeStartElement("formats"); for ( auto i = settings.begin(); i != settings.end(); ++i ) { QString element = i.key() ? i.key()->id() : "default"; writer.writeStartElement(element); for ( auto j = i->begin(); j != i->end(); ++j ) writer.writeTextElement(j.key(), j.value().toString()); writer.writeEndElement(); } writer.writeEndElement(); } return true; }
void SurfaceWindow::createSwapchain() { VkSwapchainCreateInfoKHR info = {}; uint32_t nFormat; vkGetPhysicalDeviceSurfaceFormatsKHR(mDevice, mSurface, &nFormat, nullptr); std::vector<VkSurfaceFormatKHR> formats(nFormat); vkGetPhysicalDeviceSurfaceFormatsKHR(mDevice, mSurface, &nFormat, &formats[0]); if(nFormat == 1 && formats[0].format == VK_FORMAT_UNDEFINED) formats[0].format = VK_FORMAT_B8G8R8A8_SRGB; mFormat = formats[0].format; SimpleRenderPassBuilder renderPassBuilder; mRenderPass = renderPassBuilder.build(mDevice, mFormat); info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; info.pNext = nullptr; info.flags = 0; info.imageFormat = formats[0].format; info.imageColorSpace = formats[0].colorSpace; info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; info.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; info.compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR; info.presentMode = VK_PRESENT_MODE_MAILBOX_KHR; info.surface = mSurface; info.minImageCount = 2; // Double buffering... info.imageExtent.width = mWidth; info.imageExtent.height = mHeight; vulkanCheckError(vkCreateSwapchainKHR(mDevice, &info, nullptr, &mSwapchain)); initFrameBuffers(); }
std::vector<cl_image_format> getSupportedImageFormats(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type) { cl_uint num_elements; CL_CHECKED_CALL(clGetSupportedImageFormats(context, flags, image_type, 0, nullptr, &num_elements)); std::vector<cl_image_format> formats(num_elements); CL_CHECKED_CALL(clGetSupportedImageFormats(context, flags, image_type, formats.size(), &formats[0], nullptr)); return move(formats); }
void LauncherDropArea::dragEnterEvent (QGraphicsSceneDragDropEvent *event) { auto data = event->mimeData (); if (!data->formats ().contains ("x-leechcraft/tab-tabclass")) return; event->acceptProposedAction (); setCursor (Qt::DragCopyCursor); }
/* returns if there is another function in the stack */ int lprofP_callhookOUT(lprofP_STATE* S) { if (S == NULL ||S->stack_level == 0) { return 0; } S->stack_level--; /* 0: do not resume the parent function's timer yet... */ info = lprofM_leave_function(S, 0); /* writing a log may take too long to be computed with the function's time ...*/ lprofM_pause_total_time(S); info->local_time += function_call_time; info->total_time += function_call_time; char* source = info->file_defined; if (source[0] != '@') { source = "(string)"; } else { formats(source); } char* name = info->function_name; if (strlen(name) > MAX_FUNCTION_NAME_LENGTH) { name = malloc(MAX_FUNCTION_NAME_LENGTH+10); name[0] = '\"'; strncpy(name+1, info->function_name, MAX_FUNCTION_NAME_LENGTH); name[MAX_FUNCTION_NAME_LENGTH] = '"'; name[MAX_FUNCTION_NAME_LENGTH+1] = '\0'; } formats(name); output("%d\t%s\t%s\t%d\t%d\t%f\t%f\n", S->stack_level, source, name, info->line_defined, info->current_line, info->local_time, info->total_time); /* ... now it's ok to resume the timer */ if (S->stack_level != 0) { lprofM_resume_function(S); } return 1; }
int standard_args(int argc, char **argv) { if (find_arg("--version", argc, argv) > 0 || find_arg("-version", argc, argv) > 0) return version(); if (find_arg("--formats", argc, argv) > 0 || find_arg("-formats", argc, argv) > 0) return formats(); if (find_arg("--types", argc, argv) > 0 || find_arg("-types", argc, argv) > 0) return types(); return -1; }
int init (void) { types (); components (); models (); formats (); conversions (); return 0; }
bool GaduChatService::sendMessage(const Chat &chat, FormattedMessage &message, bool silent) { kdebugf(); QString plain = message.toPlain(); QList<Contact> contacts = chat.contacts().toContactList(); if (plain.isEmpty()) // for image sending message.prepend(FormattedMessagePart(" ", false, false, false, QColor(0, 0, 0))); unsigned int uinsCount = 0; unsigned int formatsSize = 0; QScopedArrayPointer<unsigned char> formats(GaduFormatter::createFormats(Protocol->account(), message, formatsSize)); bool stop = false; kdebugmf(KDEBUG_INFO, "\n%s\n", (const char *)unicode2latin(plain)); QByteArray data = plain.toUtf8(); emit filterRawOutgoingMessage(chat, data, stop); plain = QString::fromUtf8(data); emit filterOutgoingMessage(chat, plain, stop); if (stop) { kdebugmf(KDEBUG_FUNCTION_END, "end: filter stopped processing\n"); return false; } if (data.length() >= 2000) { MessageDialog::show("dialog-warning", tr("Kadu"), tr("Filtered message too long (%1>=%2)").arg(data.length()).arg(2000)); kdebugmf(KDEBUG_FUNCTION_END, "end: filtered message too long\n"); return false; } uinsCount = contacts.count(); int messageId = -1; if (uinsCount > 1) { QScopedArrayPointer<UinType> uins(new UinType[uinsCount]); unsigned int i = 0; foreach (const Contact &contact, contacts) uins[i++] = Protocol->uin(contact); if (formatsSize) messageId = gg_send_message_confer_richtext( Protocol->gaduSession(), GG_CLASS_CHAT, uinsCount, uins.data(), (unsigned char *)data.data(), formats.data(), formatsSize); else messageId = gg_send_message_confer( Protocol->gaduSession(), GG_CLASS_CHAT, uinsCount, uins.data(), (unsigned char *)data.data()); }
QStringList MediaMimeData::formats() const { QStringList formats( QMimeData::formats() ); formats.append(MEDIA_MIME); if( !formats.contains( "text/uri-list" ) ) formats.append( "text/uri-list" ); return formats; }
void AddressEditWidget::dropEvent(QDropEvent* ev) { auto mime = ev->mimeData(); if(mime->formats().contains(iscore::mime::messagelist())) { Mime<State::MessageList>::Deserializer des{*mime}; State::MessageList ml = des.deserialize(); if(ml.size() > 0) { setAddress(ml[0].address); } } }
error* context__get_supported_image_formats(clobj_t _ctx, cl_mem_flags flags, cl_mem_object_type image_type, generic_info *out) { auto ctx = static_cast<context*>(_ctx); return c_handle_error([&] { cl_uint num; pyopencl_call_guarded(clGetSupportedImageFormats, ctx, flags, image_type, 0, nullptr, buf_arg(num)); pyopencl_buf<cl_image_format> formats(num); pyopencl_call_guarded(clGetSupportedImageFormats, ctx, flags, image_type, formats, buf_arg(num)); *out = pyopencl_convert_array_info(cl_image_format, formats); }); }
void LoaderXml::root() { auto doc = requireElement(xml,"document"); builder.beginDocument(); id(doc); document_ = builder.currentDocument(); /// \todo file format version document_->setImageSize(QSize( doc.attribute("width","32").toInt(), doc.attribute("height","32").toInt() )); metadata(doc.firstChildElement("metadata")); animations(doc.firstChildElement("animations")); formats(doc.firstChildElement("formats")); layers(doc); builder.endDocument(); }
void NewDoc::createOpenDocPage() { PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); QString docDir = "."; QString prefsDocDir=prefsManager->documentDir(); if (!prefsDocDir.isEmpty()) docDir = docContext->get("docsopen", prefsDocDir); else docDir = docContext->get("docsopen", "."); QString formats(FileLoader::getLoadFilterString()); // formats.remove("PDF (*.pdf *.PDF);;"); openDocFrame = new QFrame(this); openDocLayout = new QVBoxLayout(openDocFrame); openDocLayout->setMargin(5); openDocLayout->setSpacing(5); m_selectedFile = ""; fileDialog = new QFileDialog(openDocFrame, tr("Open"), docDir, formats); fileDialog->setFileMode(QFileDialog::ExistingFile); fileDialog->setAcceptMode(QFileDialog::AcceptOpen); fileDialog->setOption(QFileDialog::DontUseNativeDialog); fileDialog->setNameFilterDetailsVisible(false); fileDialog->setReadOnly(true); fileDialog->setSizeGripEnabled(false); fileDialog->setModal(false); QList<QPushButton *> b = fileDialog->findChildren<QPushButton *>(); QListIterator<QPushButton *> i(b); while (i.hasNext()) i.next()->setVisible(false); fileDialog->setWindowFlags(Qt::Widget); openDocLayout->addWidget(fileDialog); FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this); QList<QListView *> lv = fileDialog->findChildren<QListView *>(); QListIterator<QListView *> lvi(lv); while (lvi.hasNext()) lvi.next()->installEventFilter(keyCatcher); connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject())); connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString))); connect(keyCatcher, SIGNAL(desktopPressed()), this, SLOT(gotoDesktopDirectory())); connect(keyCatcher, SIGNAL(homePressed()), this, SLOT(gotoHomeDirectory())); connect(keyCatcher, SIGNAL(parentPressed()), this, SLOT(gotoParentDirectory())); connect(keyCatcher, SIGNAL(enterSelectedPressed()), this, SLOT(gotoSelectedDirectory())); connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile())); connect(fileDialog, SIGNAL(rejected()), this, SLOT(reject())); }
void TrackEditor::dragEnterEvent(QDragEnterEvent *e) { const QMimeData *mime = e->mimeData(); if (mime->hasUrls() || mime->hasText()) { if (e->proposedAction() & Qt::CopyAction) { e->acceptProposedAction(); } else { e->setDropAction(Qt::CopyAction); e->accept(); } } else { QStringList formats(mime->formats()); RG_DEBUG << "HINT: Unaccepted MimeFormat in TrackEditor::dragEnterEvent : " << formats; } }
void SeparateTabBar::dragMoveEvent (QDragMoveEvent *event) { const auto tabIdx = tabAt (event->pos ()); if (IsLastTab_ && tabIdx == count () - 1) return; auto data = event->mimeData (); const auto& formats = data->formats (); if (formats.contains ("x-leechcraft/tab-drag-action") && data->data ("x-leechcraft/tab-drag-action") == "reordering") event->acceptProposedAction (); else TabWidget_->setCurrentIndex (tabIdx); if (auto idt = qobject_cast<IDNDTab*> (TabWidget_->Widget (tabIdx))) idt->HandleDragEnter (event); }
QString QgsWMSLayerItem::createUri() { if ( mLayerProperty.name.isEmpty() ) return QString(); // layer collection // Number of styles must match number of layers mDataSourceUri.setParam( QStringLiteral( "layers" ), mLayerProperty.name ); QString style = !mLayerProperty.style.isEmpty() ? mLayerProperty.style.at( 0 ).name : QString(); mDataSourceUri.setParam( QStringLiteral( "styles" ), style ); QString format; // get first supported by qt and server QVector<QgsWmsSupportedFormat> formats( QgsWmsProvider::supportedFormats() ); const auto constFormats = formats; for ( const QgsWmsSupportedFormat &f : constFormats ) { if ( mCapabilitiesProperty.capability.request.getMap.format.indexOf( f.format ) >= 0 ) { format = f.format; break; } } mDataSourceUri.setParam( QStringLiteral( "format" ), format ); QString crs; // get first known if possible QgsCoordinateReferenceSystem testCrs; for ( const QString &c : qgis::as_const( mLayerProperty.crs ) ) { testCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( c ); if ( testCrs.isValid() ) { crs = c; break; } } if ( crs.isEmpty() && !mLayerProperty.crs.isEmpty() ) { crs = mLayerProperty.crs[0]; } mDataSourceUri.setParam( QStringLiteral( "crs" ), crs ); //uri = rasterLayerPath + "|layers=" + layers.join( "," ) + "|styles=" + styles.join( "," ) + "|format=" + format + "|crs=" + crs; return mDataSourceUri.encodedUri(); }
std::vector<VkSurfaceFormatKHR> getPhysicalDeviceSurfaceFormats (const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) { deUint32 numFormats = 0; VK_CHECK(vki.getPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &numFormats, DE_NULL)); if (numFormats > 0) { std::vector<VkSurfaceFormatKHR> formats (numFormats); VK_CHECK(vki.getPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &numFormats, &formats[0])); return formats; } else return std::vector<VkSurfaceFormatKHR>(); }
// Put the list of net media in a parameter list void SDPMedia::putMedia(NamedList& msg, bool putPort) { msg.addParam("media" + suffix(),"yes"); msg.addParam("formats" + suffix(),formats()); msg.addParam("transport" + suffix(),transport()); if (mappings()) msg.addParam("rtp_mapping" + suffix(),mappings()); if (isAudio()) msg.addParam("rtp_rfc2833",rfc2833()); if (putPort) msg.addParam("rtp_port" + suffix(),remotePort()); if (remoteCrypto()) msg.addParam("crypto" + suffix(),remoteCrypto()); // must handle encryption differently const char* enc = m_rAttrs.getValue("encryption"); if (enc) msg.addParam("encryption" + suffix(),enc); putNamedList(msg, m_rAttrs, "sdp" + suffix() + "_"); putNamedList(msg, m_fmtps, "fmtp_"); }
bool wxClipboard::AddData( wxDataObject *data ) { wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); wxCHECK_MSG( data, false, wxT("data is invalid") ); // we can only store one wxDataObject so clear the old one Clear(); Data() = data; // get formats from wxDataObjects const size_t count = data->GetFormatCount(); wxDataFormatArray formats(new wxDataFormat[count]); data->GetAllFormats(formats.get()); // always provide TIMESTAMP as a target, see comments in selection_handler // for explanation AddSupportedTarget(g_timestampAtom); for ( size_t i = 0; i < count; i++ ) { const wxDataFormat format(formats[i]); wxLogTrace(TRACE_CLIPBOARD, wxT("Adding support for %s"), format.GetId().c_str()); AddSupportedTarget(format); } if ( !m_idSelectionGetHandler ) { m_idSelectionGetHandler = g_signal_connect ( m_clipboardWidget, "selection_get", G_CALLBACK (selection_handler), GUINT_TO_POINTER (gtk_get_current_event_time()) ); } // tell the world we offer clipboard data return SetSelectionOwner(); }
QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const { if (fmt.isEmpty() || empty()) return QByteArray(); (void)formats(); // trigger update of format list QList<Atom> atoms; Atom *targets = (Atom *) format_atoms.data(); int size = format_atoms.size() / sizeof(Atom); for (int i = 0; i < size; ++i) atoms.append(targets[i]); QByteArray encoding; Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display()->nativeDisplay(),fmt, requestedType, atoms, &encoding); if (fmtatom == 0) return QVariant(); return mimeConvertToFormat(m_clipboard->screen()->display()->nativeDisplay(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); }
// ---------------------------------------------------------------------------- // CSdpRtpmapStrategy::HasMatchingFormatsL // ---------------------------------------------------------------------------- // TBool CSdpRtpmapStrategy::HasMatchingFormatsL( const CSdpMediaField& aReceivedMedia, const CSdpMediaField& aClientMedia) const { if (aReceivedMedia.Protocol() != iRtpAvpStringF || aClientMedia.Protocol() != iRtpAvpStringF) { return EFalse; } RArray<TUint> formats(ExtractFormatsL(aReceivedMedia.FormatList())); CleanupClosePushL(formats); const RPointerArray<CSdpFmtAttributeField>& clientAttributes = const_cast<CSdpMediaField&>(aClientMedia).FormatAttributeFields(); for (TInt i=0; i < clientAttributes.Count(); i++) { const CSdpFmtAttributeField& clientAttribute = *clientAttributes[i]; if (clientAttribute.Attribute() == iRtpmapStringF) { TLex8 formatLex(clientAttribute.Format()); TUint value = 0; if (formatLex.Val(value) == KErrNone && value < KMinDynPayloadType) { TInt index = 0; TInt err = formats.FindInOrder(value,index); if (err == KErrNone && index >= 0) { CleanupStack::PopAndDestroy(1); // formats return ETrue; } } } } CleanupStack::PopAndDestroy(1); // formats return EFalse; }
QVariant QClipboardWatcher::retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const { if (fmt.isEmpty() || empty()) return QByteArray(); (void)formats(); // trigger update of format list DEBUG("QClipboardWatcher::data: fetching format '%s'", fmt.toLatin1().data()); QList<Atom> atoms; Atom *targets = (Atom *) format_atoms.data(); int size = format_atoms.size() / sizeof(Atom); for (int i = 0; i < size; ++i) atoms.append(targets[i]); QByteArray encoding; Atom fmtatom = X11->xdndMimeAtomForFormat(fmt, requestedType, atoms, &encoding); if (fmtatom == 0) return QVariant(); return X11->xdndMimeConvertToFormat(fmtatom, getDataInFormat(fmtatom), fmt, requestedType, encoding); }