本文整理汇总了C++中Transfer类的典型用法代码示例。如果您正苦于以下问题:C++ Transfer类的具体用法?C++ Transfer怎么用?C++ Transfer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transfer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCurrentQueue
void MainWindow::displayDestroyed()
{
Queue* q = getCurrentQueue();
//QModelIndex i = treeTransfers->currentIndex();
QList<int> sel = getSelection();
Transfer* d = 0;
if(q != 0 && sel.size() == 1)
d = q->at(sel[0]);
if(QWidget* w = stackedDetails->currentWidget())
{
//disconnect(w, SIGNAL(destroyed()), this, SLOT(displayDestroyed()));
stackedDetails->removeWidget(w);
delete w;
}
m_pDetailsDisplay = 0;
if(d != 0)
{
QWidget* widgetDisplay = new QWidget(stackedDetails);
m_pDetailsDisplay = d->createDetailsWidget(widgetDisplay);
if(m_pDetailsDisplay)
{
stackedDetails->insertWidget(0,widgetDisplay);
stackedDetails->setCurrentIndex(0);
connect(m_pDetailsDisplay, SIGNAL(destroyed()), this, SLOT(displayDestroyed()));
}
else
delete widgetDisplay;
}
doneQueue(q);
}
示例2: libusb_fill_iso_transfer
bool LibusbSoundplaneDriver::processThreadScheduleTransfer(Transfer &transfer)
{
if (processThreadShouldStopTransfers())
{
return false;
}
libusb_fill_iso_transfer(
transfer.transfer,
transfer.device,
transfer.endpointAddress,
reinterpret_cast<unsigned char *>(transfer.packets),
sizeof(transfer.packets),
transfer.numPackets(),
processThreadTransferCallbackStatic,
&transfer,
1000);
libusb_set_iso_packet_lengths(
transfer.transfer,
sizeof(transfer.packets) / transfer.numPackets());
const auto result = libusb_submit_transfer(transfer.transfer);
if (result < 0)
{
fprintf(stderr, "Failed to submit USB transfer: %s\n", libusb_error_name(result));
return false;
}
else
{
mOutstandingTransfers++;
return true;
}
}
示例3: qCritical
Transfer * Client::registerTransfer (const QString& name, TransferType type,
const QString& clientId) {
Transfer * transfer = 0;
if (d_ptr->interface == 0) {
if (d_ptr->initDbusInterface() == false) {
qCritical() << "Failed to create dbus interface";
return transfer;
}
}
QDBusReply<QString> reply =
d_ptr->interface->registerTransientTransfer(name, type, clientId);
if (reply.isValid()) {
transfer = new TransientTransfer (d_ptr->interface, reply.value(), name,
type, this);
if (transfer != 0) {
d_ptr->transfers[transfer->transferId()] = transfer;
connect(d_ptr,SIGNAL(sendLastProgress()),transfer,
SLOT(sendLastProgress()));
} else {
qCritical() << "Failed to create transfer";
}
} else {
qWarning() << "Transfer UI returned error.";
}
return transfer;
}
示例4: g_warning
cairo_surface_t *
GalliumSurface::Cairo ()
{
static cairo_user_data_key_t key;
struct pipe_resource *texture = sampler_view->texture;
Transfer *transfer;
unsigned char *data;
if (!pipe) {
g_warning ("GalliumSurface::Cairo called with invalid "
"surface instance.");
return NULL;
}
if (mapped)
return cairo_surface_reference (mapped);
transfer = new Transfer (pipe, texture);
data = (unsigned char *) transfer->Map ();
mapped = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
texture->width0,
texture->height0,
texture->width0 * 4);
cairo_surface_set_user_data (mapped,
&key,
(void *) transfer,
CairoDestroy);
return cairo_surface_reference (mapped);
}
示例5: setMessage
void JavaExtractor::finishedExtraction(QList<QString> list)
{
if (list.isEmpty())
{
setMessage(tr("Empty or invalid link list"));
setState(Failed);
return;
}
QString clsName = m_engines[m_strClass].targetClass;
if (clsName.isEmpty())
{
BestEngine e = bestEngine(list[0], Download);
if (!e.engine)
{
setMessage(tr("Failed to detect URL class: %1").arg(list[0]));
setState(Failed);
return;
}
clsName = e.engine->shortName;
}
QList<Transfer*> ts;
TransferFactory* f = TransferFactory::instance();
foreach (QString url, list)
{
Transfer *t = f->createInstance(clsName);
t->init(url, m_strTarget);
t->setState(Waiting);
ts << t;
}
示例6: checkWork
bool checkWork() {
int flag;
MPI_Iprobe(reqRank, WORK_TRANSMIT, MPI_COMM_WORLD, &flag, &status);
if (flag) {
file << "Process " << rank << " Prijma praci\n";
// kontrola velkosti
int testTransferSize;
MPI_Get_count(&status, MPI_SHORT, &testTransferSize);
file << "\nTransfer Size: " << testTransferSize << "\n";
// prijmanie predoslej ziadosti
Transfer * transfer = new Transfer(testTransferSize);
MPI_Recv(transfer->transfer, testTransferSize, MPI_SHORT, reqRank, WORK_TRANSMIT, MPI_COMM_WORLD, &status);
// pokial 1 == NO_WORK
if (testTransferSize == 1)return false;
file << "Process " << rank << " Prijal spravu o velkosti:" << testTransferSize << "\n";
stack->add(transfer->unpack());
delete transfer;
}
return flag == 0;
}
示例7: checkSolution
void checkSolution() {
LinkedStack<Kostra> tempStack;
int flag, testTransferSize;
for (int i = 0; i < worldSize; i++) {
if (i == rank)continue;
MPI_Iprobe(i, SOLUTION_TRANSMIT, MPI_COMM_WORLD, &flag, &status);
file << "\nProcess " << rank << " : Checking Solutions from: " << i << "flag:" << flag << "\n";
if (flag) {
MPI_Get_count(&status, MPI_SHORT, &testTransferSize);
Transfer * t = new Transfer(testTransferSize);
file << "Prijmam solution o velkosti: " << testTransferSize << "\n";
MPI_Recv(t->transfer, testTransferSize, MPI_SHORT, i, SOLUTION_TRANSMIT, MPI_COMM_WORLD, &status);
file << "Prijal sem solution o velkosti: " << testTransferSize << "\n";
tempStack = *t->unpack();
if (solution == NULL || tempStack.front->k->krok < solution->krok)
setSolution(tempStack.front->k);
delete t;
}
}
file << "\nProcess " << rank << " : Exiting Solutions: ";
}
示例8: ConstructAndAddTransferTransaction
void TextFileDataSource::ConstructAndAddTransferTransaction(std::string line)
{
enum
{
ID,
AMOUNT,
CUSTOMER_ID,
DATE,
TO_ACCOUNT_ID,
FROM_ACCOUNT_ID,
NUM_FIELDS
};
vector<std::string> lineSplit = stringUtils::splitstring(line, ',');
date dt;
Transfer t
(
TypeConverter(lineSplit[ID]),
TypeConverter(lineSplit[AMOUNT]),
TypeConverter(lineSplit[CUSTOMER_ID]),
dt,
TypeConverter(lineSplit[TO_ACCOUNT_ID]),
TypeConverter(lineSplit[FROM_ACCOUNT_ID])
);
_transactions.add(t.getId(), &t);
}
示例9: write
bool DeviceHandleLibUSB::write(const Transfer& transfer_, uint8_t endpoint_)
{
int nBytesWritten = 0;
if (static_cast<bool>(transfer_) == true)
{
int result = libusb_bulk_transfer(m_pCurrentDevice, // Device handle
endpoint_, // Endpoint
const_cast<uint8_t*>(transfer_.data().data()), // Data pointer
transfer_.size(), // Size of data
&nBytesWritten, // N. of bytes actually written
kLibUSBWriteTimeout // Timeout
);
if ((LIBUSB_SUCCESS != result) || (nBytesWritten != transfer_.size()))
{
M_LOG(
"[DeviceHandleLibUSB] write: error=" << result << " - transfer size: " << transfer_.size()
<< " written: "
<< nBytesWritten);
return false;
}
return true;
}
return false;
}
示例10: Transfer
dbinterface::dbinterface()
{
this->dbm=new dbmeth;
if(dbm->Transfer(dbm->do_nothing)){//!
Transfer *tr = new Transfer(this,dbm->transferMes());
tr->exec();
}
}
示例11:
void
GalliumSurface::CairoDestroy (void *data)
{
Transfer *transfer = (Transfer *) data;
transfer->Unmap ();
delete transfer;
}
示例12: shiftPressed
void TraktorF1MK2::processButtons(const Transfer& input_)
{
bool shiftPressed(isButtonPressed(input_, Button::Shift));
Device::Button changedButton(Device::Button::Unknown);
bool buttonPressed(false);
for (int i = 0; i < kF1MK2_buttonsDataSize - 1; i++) // Skip the last byte (encoder value)
{
for (int k = 0; k < 8; k++)
{
uint8_t btn = (i * 8) + k;
Button currentButton(static_cast<Button>(btn));
if (currentButton == Button::Shift)
{
continue;
}
buttonPressed = isButtonPressed(input_, currentButton);
if (buttonPressed != m_buttonStates[btn])
{
m_buttonStates[btn] = buttonPressed;
changedButton = deviceButton(currentButton);
if (changedButton != Device::Button::Unknown)
{
if (currentButton >= Button::Pad8 && currentButton <= Button::Pad9)
{
keyChanged(btn, buttonPressed ? 1.0 : 0.0, shiftPressed);
}
else
{
buttonChanged(changedButton, buttonPressed, shiftPressed);
}
}
}
}
}
// encoder
uint8_t currentValue = input_.data()[kF1MK2_buttonsDataSize];
if (currentValue != m_encoderValue)
{
bool valueIncreased = ((static_cast<uint8_t>(m_encoderValue) < currentValue)
|| ((m_encoderValue == 0xff) && (currentValue == 0x00)))
&& (!((m_encoderValue == 0x0) && (currentValue == 0xff)));
m_encoderValue = currentValue;
encoderChanged(0, valueIncreased, shiftPressed);
}
// pots/faders
for (uint8_t potIndex = 0, i = kF1MK2_buttonsDataSize + 1; potIndex < 8; i += 2, potIndex++)
{
unsigned value = (input_.data()[i]) | (input_.data()[i + 1] << 8);
if (m_potentiometersValues[potIndex] != value)
{
m_potentiometersValues[potIndex] = value;
controlChanged(potIndex, value / 1024.0, shiftPressed);
}
}
}
示例13: Q_EMIT
void ClientPrivate::startSlot (const QString & id) {
if (transfers.contains (id)) {
Transfer * transfer = transfers[id];
transfer->startSlot ();
Q_EMIT(startTransfer (transfer));
} else {
qDebug() << "Ignore start signal for" << id;
}
}
示例14: getTransfer
void TransfersContentsWidget::openTransfer(const QModelIndex &index)
{
Transfer *transfer = getTransfer(index.isValid() ? index : m_ui->transfersViewWidget->currentIndex());
if (transfer)
{
transfer->openTarget();
}
}
示例15: qDebug
void ClientPrivate::cancelSlot (const QString & id) {
qDebug() << "Transfer id " << id;
if (transfers.contains (id)) {
Transfer * transfer = transfers[id];
transfer->cancelSlot ();
Q_EMIT(cancelTransfer (transfer));
} else {
qDebug() << "Ignore cancel signal for" << id;
}
}