コード例 #1
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::ClearHaltHost(DWORD dwInterface, UCHAR Endpoint)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	if (Endpoint == 0) {
		if(!mUsbFuncs->lpResetDefaultPipe(mDevice)) {
			return false;
		}
	} else {
		USB_PIPE epPipe = GetPipeForEndpoint(dwInterface, Endpoint);
		if (!epPipe) {
			SetLastError(ERROR_INVALID_PARAMETER);
			return FALSE;
		}
		// First clear the halt on the host side
		BOOL halted = FALSE;
		if(!mUsbFuncs->lpIsPipeHalted(epPipe, &halted)) {
			return FALSE;
		}
		// Only count failure to reset as an error if halted
		if(!mUsbFuncs->lpResetPipe(epPipe) && halted) {
			return FALSE;
		}
	}
	return TRUE;
}
コード例 #2
0
ファイル: RenderWidget.cpp プロジェクト: Antidote/dolphin
bool RenderWidget::event(QEvent* event)
{
  switch (event->type())
  {
  case QEvent::KeyPress:
  {
    QKeyEvent* ke = static_cast<QKeyEvent*>(event);
    if (ke->key() == Qt::Key_Escape)
      emit EscapePressed();
    break;
  }
  case QEvent::WinIdChange:
    emit HandleChanged((void*)winId());
    break;
  case QEvent::FocusIn:
  case QEvent::FocusOut:
    emit FocusChanged(hasFocus());
    break;
  case QEvent::WindowStateChange:
    emit StateChanged(isFullScreen());
    break;
  case QEvent::Close:
    emit Closed();
    break;
  default:
    break;
  }
  return QWidget::event(event);
}
コード例 #3
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::AllocateInterfaceClaimers()
{
	// Callers should already hold mCloseMutex.
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	// Work out how many interfaces are needed for this configuration
	LPCUSB_DEVICE devInfo = mUsbFuncs->lpGetDeviceInfo(mDevice);
	LPCUSB_CONFIGURATION activeConfig = devInfo->lpActiveConfig;
	const DWORD newIfaceCount = activeConfig->dwNumInterfaces;
	InterfaceClaimers* newClaimers = NULL;
	if (newIfaceCount > 0) {
		// Allocate the new interface claim tracking objects
		// and initialise them.
		newClaimers = new (std::nothrow) InterfaceClaimers[newIfaceCount];
		for (DWORD i = 0; i < newIfaceCount; ++i) {
			const USB_INTERFACE& iface = activeConfig->lpInterfaces[i];
			if (!newClaimers[i].Init(iface)) {
				delete [] newClaimers;
				return FALSE;
			}
		}
	}
	if (mInterfaceClaimers) {
		delete [] mInterfaceClaimers;
		mInterfaceClaimers = NULL;
		mInterfaceClaimersCount = 0;
	}
	mInterfaceClaimers = newClaimers;
	mInterfaceClaimersCount = newIfaceCount;
	return TRUE;
}
コード例 #4
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::IsEndpointHalted(DWORD dwInterface, UCHAR Endpoint, BOOL& halted)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	if (Endpoint == 0) {
		// This could use mUsbFuncs->lpIsDefaultPipeHalted,
		// but that API is deprecated and always returns false.
		halted = FALSE;
		return TRUE;
	}
	USB_PIPE epPipe = GetPipeForEndpoint(dwInterface, Endpoint);
	if (!epPipe) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}
	// First check the halt on the host side
	halted = FALSE;
	if(!mUsbFuncs->lpIsPipeHalted(epPipe, &halted)) {
		return FALSE;
	}
	return TRUE;
}
コード例 #5
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::ClaimInterface(DWORD dwInterfaceValue, LPVOID Context)
{
	WriteLocker lock(mCloseMutex);
	if (Closed()) {
		// Don't allow closed devices to be claimed
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	for (DWORD i = 0; i < mInterfaceClaimersCount; ++i) {
		if (mInterfaceClaimers[i].InterfaceValue() == dwInterfaceValue) {
			BOOL IsFirst = FALSE;
			if (!mInterfaceClaimers[i].Claim(Context, IsFirst)) {
				return FALSE;
			}
			// If this was the first claim then need to open pipes
			if (IsFirst) {
				if (!OpenPipes(mInterfaceClaimers[i])) {
					ClosePipes(mInterfaceClaimers[i]);
					SetLastError(ERROR_INTERNAL_ERROR);
					return FALSE;
				}
			}
			return TRUE;
		}
	}
	SetLastError(ERROR_INVALID_PARAMETER);
	return FALSE;
}
コード例 #6
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::OpenPipes(InterfaceClaimers& Iface)
{
	if (Closed()) {
		return FALSE;
	}

	LPCUSB_DEVICE info = mUsbFuncs->lpGetDeviceInfo(mDevice);
	// Find the interface
	LPCUSB_CONFIGURATION config = info->lpActiveConfig;
	for (DWORD i = 0; i < config->dwNumInterfaces; ++i) {
		LPCUSB_INTERFACE ifaceDesc = &(config->lpInterfaces[i]);
		if (ifaceDesc->Descriptor.bInterfaceNumber != Iface.InterfaceValue())
			continue;
		// Found the interface, iterate through endpoints
		for (DWORD epIdx = 0; epIdx < ifaceDesc->Descriptor.bNumEndpoints; ++epIdx) {
			LPCUSB_ENDPOINT epDesc = &(ifaceDesc->lpEndpoints[epIdx]);
			USB_PIPE p = Iface.GetPipeForEndpoint(epDesc->Descriptor.bEndpointAddress);
			if (p != NULL) {
				// Already been opened, so skip this endpoint
				continue;	
			}
			p = mUsbFuncs->lpOpenPipe(mDevice, &epDesc->Descriptor);
			if (p == NULL) {
				return FALSE;
			}
			Iface.SetPipeForEndpoint(epDesc->Descriptor.bEndpointAddress, p);
		}
		// Setup all endpoints correctly
		return TRUE;
	}
	// Interface not found
	return FALSE;
}
コード例 #7
0
ファイル: main.cpp プロジェクト: Road-Drum/citra
void GMainWindow::ShutdownGame() {
    emu_thread->RequestStop();

    // Release emu threads from any breakpoints
    // This belongs after RequestStop() and before wait() because if emulation stops on a GPU
    // breakpoint after (or before) RequestStop() is called, the emulation would never be able
    // to continue out to the main loop and terminate. Thus wait() would hang forever.
    // TODO(bunnei): This function is not thread safe, but it's being used as if it were
    Pica::g_debug_context->ClearBreakpoints();

    emit EmulationStopping();

    // Wait for emulation thread to complete and delete it
    emu_thread->wait();
    emu_thread = nullptr;

    // The emulation is stopped, so closing the window or not does not matter anymore
    disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));

    // Update the GUI
    ui.action_Start->setEnabled(false);
    ui.action_Start->setText(tr("Start"));
    ui.action_Pause->setEnabled(false);
    ui.action_Stop->setEnabled(false);
    render_window->hide();
    game_list->show();

    emulation_running = false;
}
コード例 #8
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::IsKernelDriverActiveForInterface(DWORD dwInterface, PBOOL active)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	// Convert DWORD to UCHAR and catch any out-of-range values
	if (dwInterface > UCHAR_MAX) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}
	UCHAR ifnum = static_cast<UCHAR>(dwInterface);

	LPCUSB_DEVICE devInfo = mUsbFuncs->lpGetDeviceInfo(mDevice);

	if (!mUsbFuncs->lpFindInterface(devInfo, ifnum, 0)) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}

	(*active) = CheckKernelDriverActiveForInterface(ifnum);
	return TRUE;
}
コード例 #9
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::SetAltSetting(DWORD dwInterface, DWORD dwAlternateSetting)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	if (dwInterface > UCHAR_MAX || dwAlternateSetting > UCHAR_MAX) {
		
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}

	USB_TRANSFER transfer = mUsbFuncs->lpSetInterface(mDevice, NULL, NULL, 0, 
		static_cast<UCHAR>(dwInterface), static_cast<UCHAR>(dwAlternateSetting));
	if (!transfer) {
		return FALSE;
	}
	DWORD dwError = 0;
	if(mUsbFuncs->lpGetTransferStatus(transfer, NULL, &dwError)) {
		SetLastError(Transfer::TranslateError(dwError, 0, FALSE));
		return dwError == USB_NO_ERROR;
	} else {
		return FALSE;
	}
}
コード例 #10
0
ファイル: Window.cpp プロジェクト: Jeremy-D-Miller/wiixplorer
Window::~Window()
{
	Closing(this);

	titleBarButton -> Held.disconnect(this);
	titleBarButton -> Released.disconnect(this);
	delete titleBarButton;
	delete titleBar;
	delete titleText;
	delete icon;

	delete window_tile_horizontal_top;
	delete window_tile_horizontal_bottom;
	delete window_tile_vertical_left;
	delete window_tile_vertical_right;
	delete window_corner_left_top;
	delete window_corner_left_bottom;
	delete window_corner_right_top;
	delete window_corner_right_bottom;

	Resources::Remove(window_tile_horizontalDat);
	Resources::Remove(window_tile_verticalDat);
	Resources::Remove(window_corner_leftDat);
	Resources::Remove(window_corner_rightDat);

	delete trigA;

	Closed(this);
}
コード例 #11
0
ファイル: DebugStats.cpp プロジェクト: Manaluusua/naali
Console::CommandResult DebugStatsModule::ShowProfilingWindow(const StringVector &params)
{
    boost::shared_ptr<UiServices::UiModule> ui_module = 
        framework_->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices).lock();
    if (!ui_module.get())
        return Console::ResultFailure("Failed to acquire UiModule pointer!");

    // If the window is already visible, no need to create another one.
    if (profilerWindow_)
    {
        ///\todo The ideal path would only return here. We would like to hook the close button of the window
        /// to clear the profilerWindow_ member. Here we check if the profilerWindow_ member is 0, and only
        /// create the window if it does not exist.
        //return;

        // Now we need play 'singleton' with the UI subsystem.
        //profilerWindow_->show();
        return Console::ResultSuccess();
//        delete profilerWindow_;
    }

    profilerWindow_ = new TimeProfilerWindow(ui_module.get(), this);
    UiServices::UiProxyWidget *proxy = ui_module->GetInworldSceneController()->AddWidgetToScene(profilerWindow_,
        UiServices::UiWidgetProperties("Profiler", UiServices::SceneWidget));
    //Desired: profilerWindow_->show();
    // Instead of:
    proxy->show();
    // The following should not be needed if the size was properly set in Designer.
    proxy->resize(650, 530);
    // Assuming size needs to be se in a custom way:
    // profilerWindow_->resize();
    
//    proxy->setWindowTitle("Profiler");

    QObject::connect(proxy, SIGNAL(Closed()), profilerWindow_, SLOT(Closed()));
//  Desired:    QObject::connect(profilerWindow_, SIGNAL(Closed()), profilerWindow_, SLOT(Closed()));
//  This should be in profilerWindow_.

// profilerWindow_->setAttribute(Qt::WA_DeleteOnClose);
//connect(profilerWindow_, SIGNAL(Destroyed(QObject *)), this, CloseProfilingWindow());
    if (current_world_stream_)
        profilerWindow_->SetWorldStreamPtr(current_world_stream_);

    profilerWindow_->RefreshProfilingData();

    return Console::ResultSuccess();
}
コード例 #12
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::Init(USB_HANDLE hDevice,
	LPCUSB_FUNCS lpUsbFuncs,
	LPCUSB_INTERFACE lpInterface)
{
	if (!hDevice || !lpUsbFuncs) {
		ERROR_MSG((
			TEXT("USBKWrapperDrv!UsbDevice::Init(...) - passed null device or functions\r\n")));
		return FALSE;
	}

	if (!mCloseMutex.Init()) {
		ERROR_MSG((TEXT("USBKWrapperDrv!UsbDevice::Init() - failed to create mutex\r\n")));
		return FALSE;
	}

	mDevice = hDevice;
	mUsbFuncs = lpUsbFuncs;
	mUsbInterface = lpInterface;

	// Need to register for notifications
	// so that it can be noticed when devices disconnect
	mRegistered = mUsbFuncs->lpRegisterNotificationRoutine(
		mDevice, UsbDeviceNotifyRoutine, this);
	if (!mRegistered) {
		ERROR_MSG((
			TEXT("USBKWrapperDrv!UsbDevice::Init(...) - failed to register for device notification\r\n")));
		return FALSE;
	}

	WriteLocker lock(mCloseMutex);
	if (Closed()) {
		// Check that the device hasn't been disconnected in the meantime.
		ERROR_MSG((
			TEXT("USBKWrapperDrv!UsbDevice::Init(...) - device closed\r\n")));
		return FALSE;
	}
	// Allocate any structures needed
	if (!AllocateInterfaceClaimers()) {
		ERROR_MSG((
			TEXT("USBKWrapperDrv!UsbDevice::Init(...) - failed to allocate interface claimers\r\n")));
		return FALSE;
	}

	// Fetch and cache raw configuration descriptor bytes
	if (!FetchAllConfigDescriptors()) {
		ERROR_MSG((
			TEXT("USBKWrapperDrv!UsbDevice::Init(...) - failed to fetch configuration descriptors\r\n")));
		return FALSE;
	}

	// Provide notification to userland that this USB device has appeared
	AdvertiseDevice(TRUE);

	DEVLIFETIME_MSG((
		TEXT("USBKWrapperDrv!UsbDevice::Init(0x%08x, ...) mBus: %d mAddress: %d\r\n"),
		mDevice, mBus, mAddress));
	return TRUE;
}
コード例 #13
0
ファイル: TexturePreviewEditor.cpp プロジェクト: A-K/naali
void TexturePreviewEditor::Close()
{
//    UiServiceInterface* ui= framework_->GetService<UiServiceInterface>();
//    if (!ui)
//        return
//    ui->RemoveWidgetFromScene(this);
    // Must be last line in this function, since it is possible this causes the deletion of this object
    emit Closed(inventoryId_);
}
コード例 #14
0
ファイル: TabDlg.cpp プロジェクト: Artoria2e5/obtr
void TabbedDialog::Close ()
{
	if (hDlg) {
		ClearTabs ();
		oapiCloseDialog (hDlg);
		hDlg = NULL;
		Closed ();
	}
}
コード例 #15
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::CloseTransfer(USB_TRANSFER hTransfer)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	return mUsbFuncs->lpCloseTransfer(hTransfer);
}
コード例 #16
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::CancelTransfer(USB_TRANSFER hTransfer, DWORD dwFlags)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	return mUsbFuncs->lpAbortTransfer(hTransfer, dwFlags);
}
コード例 #17
0
ファイル: mythdialogbox.cpp プロジェクト: DocOnDev/mythtv
void MythDialogBox::SendEvent(int res, QString text, QVariant data)
{
    emit Closed(m_id, res);

    if (!m_retObject)
        return;

    DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, text, data);
    QCoreApplication::postEvent(m_retObject, dce);
}
コード例 #18
0
void Edge::Close(const QString &reason)
{
    if(_closed) {
        qWarning() << "Edge already closed.";
        return;
    }
    _closed = true;

    emit Closed(this, reason);
}
コード例 #19
0
OP_STATUS
ES_RemoteDebugConnection::Close()
{
	delete socket;
	socket = NULL;
	delete socketaddress;
	socketaddress = NULL;

	state = CLOSED;
	return Closed();
}
コード例 #20
0
void UMasterServerFunctions::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
	FString MessageBody = "";

	if (!Response.IsValid()) { CurrentRequest.ResponseType = EHttpResponse::HR_NoData; Closed(MessageBody); return; }
	if (EHttpResponseCodes::IsOk(Response->GetResponseCode()))
	{
		if (Response->GetContentType().Equals("application/json"))
		{
			MessageBody = DecompressBytes(Response->GetContent());
			ProcessJSON(MessageBody);
		}
	}
	else
	{
		MessageBody = FString::Printf(TEXT("{\"success\":\"HTTP Error: %d\"}"), Response->GetResponseCode());
	}

	Closed(MessageBody);
}
コード例 #21
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::GetDeviceDescriptor(LPUSB_DEVICE_DESCRIPTOR lpDeviceDescriptor)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	LPCUSB_DEVICE devInfo = mUsbFuncs->lpGetDeviceInfo(mDevice);
	memcpy(lpDeviceDescriptor, &devInfo->Descriptor, sizeof(devInfo->Descriptor));
	return TRUE;
}
コード例 #22
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::DetachKernelDriverForInterface(DWORD dwInterface)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	// Until we can find a way to do this in Windows CE, this operation is not supported.
	SetLastError(ERROR_NOT_SUPPORTED);
	return FALSE;
}
コード例 #23
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::GetActiveConfigValue(PUCHAR pConfigurationValue)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	LPCUSB_DEVICE devInfo = mUsbFuncs->lpGetDeviceInfo(mDevice);
	(*pConfigurationValue) = devInfo->lpActiveConfig->Descriptor.bConfigurationValue;
	return TRUE;
}
コード例 #24
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::GetTransferStatusNoLock(
	USB_TRANSFER hTransfer,
	LPDWORD lpdwBytesTransferred,
	LPDWORD lpdwError)
{
	// This doesn't hold the lock as it's intended to only be called from a transfer completion callback, during
	// which the device can't change status.
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	return mUsbFuncs->lpGetTransferStatus(hTransfer, lpdwBytesTransferred, lpdwError);
}
コード例 #25
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
void UsbDevice::ClosePipes(InterfaceClaimers& Iface)
{
	if (Closed()) {
		return;
	}
	for (DWORD i = 0; i < Iface.GetPipeCount(); ++i) {
		USB_PIPE p = Iface.GetPipeForIndex(i);
		if (p != NULL) {
			mUsbFuncs->lpClosePipe(p);
			Iface.SetPipeForIndex(i, NULL);
		}
	}
}
コード例 #26
0
OSCL_EXPORT_REF void PV2WayMIO::AddCompleted(const PVCmdResponse& aResponse)
{
    if (aResponse.GetCmdStatus() == PVMFSuccess)
    {
        iAdded = true;
    }
    else
    {
        OutputInfo("PV2WayMIO::AddCompleted:: Failed to add MIO");
        Closed();
    }

    iAddId = -1;
}
コード例 #27
0
ファイル: mainwindow.cpp プロジェクト: u-foka/gtester
void MainWindow::closeEvent(QCloseEvent *event) {
    if (_model.isRunning()) {
        event->ignore();
        return;
    }

    if (! _model.isClean() && _model.isChanged()) {
        QMessageBox msgBox;
            msgBox.setIcon(QMessageBox::Question);
            msgBox.setText(tr("The document has been modified."));
            msgBox.setInformativeText(tr("Do you want to save your changes?"));
            msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
            msgBox.setDefaultButton(QMessageBox::Save);

            switch (msgBox.exec()) {
            case QMessageBox::Save:
                on_actionSave_triggered();
                if (_model.isChanged()) {
                    event->ignore();
                    return;
                }

                break;

            case QMessageBox::Discard:
                // Do nothing
                break;

            case QMessageBox::Cancel:
                event->ignore();
                return;

            default:
                throw std::runtime_error("Invalid ansver");
            }
    }

    // Save geometry
    _settings.setValue(SETTINGS_WINDOW_GEOMETRY, saveGeometry());
    _settings.setValue(SETTINGS_WINDOW_STATE, saveState());

    _settings.setValue(SETTINGS_SPLITTER_STATE, _ui->splitter->saveState());

    _settings.setValue(SETTINGS_TREEHEADER_STATE, _ui->testsTree->header()->saveState());

    // Notify application
    emit Closed(this);

    QMainWindow::closeEvent(event);
}
コード例 #28
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::GetConfigDescriptor(DWORD dwConfigurationIndex, UserBuffer<LPVOID>& buffer, LPDWORD lpSize)
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	if (dwConfigurationIndex < 0 ||
		dwConfigurationIndex >= mNumConfigurations) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}
	return CopyConfigDescriptor(dwConfigurationIndex, buffer, lpSize);
}
コード例 #29
0
ファイル: UsbDevice.cpp プロジェクト: dsdwew/CEUSBKWrapper
BOOL UsbDevice::Reenumerate()
{
	ReadLocker lock(mCloseMutex);
	if (Closed()) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	// Only reset if we're controlling the entire device, and not just a single interface.
	if (mUsbInterface) {
		ERROR_MSG((TEXT("USBKWrapperDrv!UsbDevice::Reset(...) - can't reset non-exclusive single interface devices\r\n")));
		SetLastError(ERROR_NOT_SUPPORTED);
		return FALSE;
	}
	return mUsbFuncs->lpDisableDevice(mDevice, TRUE, 0);
}	
コード例 #30
-1
ファイル: TexturePreviewEditor.cpp プロジェクト: A-K/naali
void TexturePreviewEditor::Initialize()
{
//    UiServiceInterface* ui= framework_->GetService<UiServiceInterface>();
//    if (!ui)
//        return;

    // Create widget from ui file
    QUiLoader loader;
    QFile file("./data/ui/texture_preview.ui");
    if (!file.exists())
    {
        OgreAssetEditorModule::LogError("Cannot find OGRE Script Editor .ui file.");
        return;
    }

    mainWidget_ = loader.load(&file);
    file.close();

    setAttribute(Qt::WA_DeleteOnClose);

    resize(cWindowMinimumWidth, cWindowMinimumHeight);

    layout_ = new QVBoxLayout;
    layout_->addWidget(mainWidget_);
    layout_->setContentsMargins(0, 0, 0, 0);
    setLayout(layout_);

    // Get controls
    okButtonName_ = mainWidget_->findChild<QPushButton *>("okButton");
    connect(okButtonName_, SIGNAL(clicked()), this, SLOT(Closed()));

    headerLabel_ = mainWidget_->findChild<QLabel *>("imageNameLabel");
    scaleLabel_ = mainWidget_->findChild<QLabel *>("imageScaleLabel");
    
    QLabel *assetIdLabel = mainWidget_->findChild<QLabel *>("imageAssetIdLabel");
    if(assetIdLabel)
        assetIdLabel->setText(inventoryId_);

    imageLabel_ = new TextureLabel();
    imageLabel_->setObjectName("previewImageLabel");
    imageLabel_->setScaledContents(true);
    imageLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    QObject::connect(imageLabel_, SIGNAL(MouseClicked(QMouseEvent*)), this, SLOT(TextureLabelClicked(QMouseEvent*)));

    scrollAreaWidget_ = mainWidget_->findChild<QScrollArea *>("imageScrollArea");
    scrollAreaWidget_->widget()->layout()->addWidget(imageLabel_);

    // Set black background image that will be replaced once the real image has been received.
    QImage emptyImage = QImage(QSize(256, 256), QImage::Format_ARGB32);
    emptyImage.fill(qRgba(0,0,0,0));
    imageLabel_->setPixmap(QPixmap::fromImage(emptyImage));
    headerLabel_->setText(objectName());

    // Add widget to UI via ui services module
    setWindowTitle(tr("Texture: ") + objectName());
//    UiProxyWidget *proxy = ui->AddWidgetToScene(this);
//    connect(proxy, SIGNAL(Closed()), this, SLOT(Closed()));
//    proxy->show();
//    ui->BringWidgetToFront(proxy);
}