Exemplo n.º 1
0
static void processMotion(WMDraggingInfo * info, WMPoint * mousePos)
{
	Window newDestination = findDestination(info, mousePos);

	W_DragSourceStopTimer();

	if (newDestination != XDND_DEST_WIN(info)) {
		recolorCursor(info, False);

		if (XDND_DEST_WIN(info) != None) {
			/* leaving a xdnd window */
			sendLeaveMessage(info);
		}

		XDND_DEST_WIN(info) = newDestination;
		XDND_DEST_ACTION(info) = None;
		XDND_NO_POS_ZONE(info).size.width = 0;
		XDND_NO_POS_ZONE(info).size.height = 0;

		if (newDestination != None) {
			/* entering a xdnd window */
			XDND_SOURCE_STATE(info) = idleState;
			storeDestinationProtocolVersion(info);

			if (!sendEnterMessage(info)) {
				XDND_DEST_WIN(info) = None;
				return;
			}

			W_DragSourceStartTimer(info);
		} else {
			XDND_SOURCE_STATE(info) = NULL;
		}
	} else {
		if (XDND_DEST_WIN(info) != None) {
			if (!sendPositionMessage(info, mousePos)) {
				XDND_DEST_WIN(info) = None;
				return;
			}

			W_DragSourceStartTimer(info);
		}
	}
}
Exemplo n.º 2
0
void Enemy1::moving()
{
	if (currentGoal != currentSquare[FIRST_SQUARE_ID])
	{

		if (posX_ != destX || posY_ != destY)
		{
			moveToPosition(destX, destY);

			if (posX_ == destX && posY_ == destY && !path.empty())
			{
				changeSquare(getLocationRow(path.back()), getLocationCol(path.back()));
				Row_ = getLocationRow(currentSquare[FIRST_SQUARE_ID]);
				Col_ = getLocationCol(currentSquare[FIRST_SQUARE_ID]);
			}
		}
		else
		{	
				findDestination();
		}
	}
}
void ImportLibraryDialog::setupUI()
{
	nameLabel = new QLabel(tr("Library Name : "));
	nameEdit = new QLineEdit;
	nameLabel->setBuddy(nameEdit);
	connect(nameEdit,SIGNAL(textChanged(QString)),this,SLOT(nameEntered()));

	textLabel = new QLabel(tr("Package location : "));
	path = new QLineEdit;
	textLabel->setBuddy(path);

	destLabel = new QLabel(tr("Destination folder : "));
	destPath = new QLineEdit;
	textLabel->setBuddy(destPath);

	accept = new QPushButton(tr("Unpack"));
	accept->setDisabled(true);
	connect(accept,SIGNAL(clicked()),this,SLOT(add()));

	cancel = new QPushButton(tr("Cancel"));
	connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
	//connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));

	find = new QPushButton(QIcon(":/images/coversPackage.png"),"");
	connect(find,SIGNAL(clicked()),this,SLOT(findPath()));

	findDest = new QPushButton(QIcon(":/images/open.png"),"");
	connect(findDest,SIGNAL(clicked()),this,SLOT(findDestination()));

	QGridLayout * content = new QGridLayout;

	content->addWidget(nameLabel,0,0);
	content->addWidget(nameEdit,0,1);

	content->addWidget(textLabel,1,0);
	content->addWidget(path,1,1);
	content->addWidget(find,1,2);
	content->setColumnStretch(2,0); //TODO

	content->addWidget(destLabel,2,0);
	content->addWidget(destPath,2,1);
	content->addWidget(findDest,2,2);
	//destLayout->setStretchFactor(findDest,0); //TODO

	QHBoxLayout *bottomLayout = new QHBoxLayout;
	bottomLayout->addStretch();
	bottomLayout->addWidget(accept);
	bottomLayout->addWidget(cancel);

	progressBar = new QProgressBar(this);
	progressBar->setMinimum(0);
	progressBar->setMaximum(0);
	progressBar->setTextVisible(false);
	progressBar->hide();

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(content);
	//mainLayout->addWidget(progress = new QLabel());
	mainLayout->addStretch();
	mainLayout->addWidget(progressBar);
	mainLayout->addLayout(bottomLayout);

	QHBoxLayout * imgMainLayout = new QHBoxLayout;
	QLabel * imgLabel = new QLabel(this);
	QPixmap p(":/images/importLibrary.png");
	imgLabel->setPixmap(p);
	imgMainLayout->addWidget(imgLabel);
	imgMainLayout->addLayout(mainLayout);
	
	setLayout(imgMainLayout);

	setModal(true);
	setWindowTitle(tr("Extract a catalog"));
}
/*!
    Destination selection dialog execution.
 */
void CmApplSettingsUiPrivate::runDestinationDialog()
{
    OstTraceFunctionEntry0(CMAPPLSETTINGSUIPRIVATE_RUNDESTINATIONDIALOG_ENTRY);

    // Check that there is some content to show:
    // -At least one Destination
    // -Or at least one Connection Method under "Dedicated access point"
    if (mDestinations.isEmpty()
        && (!mListItems.testFlag(CmApplSettingsUi::ShowConnectionMethods)
            || mConnMethods.isEmpty())) {
        // Nothing to show, so finish
        emitFinished(CmApplSettingsUi::ApplSettingsErrorNoContent);
        OstTraceFunctionExit0(CMAPPLSETTINGSUIPRIVATE_RUNDESTINATIONDIALOG_EXIT);
        return;
    }

    // Create a new Destination dialog
    delete mDestinationDialog;
    mDestinationDialog = new CmRadioDialog(this);
    mDestinationDialog->setType(CmRadioDialogTypeDestination);
    
    // Add Dedicated access point option if requested & supported
    if (mListItems.testFlag(CmApplSettingsUi::ShowConnectionMethods)
        && !mConnMethods.isEmpty()) {
        QSet<CmRadioDialogOpt> options;
        options.insert(CmRadioDialogOptDedicatedAP);
        mDestinationDialog->setOptions(options);
    }
    
    // Add destinations to the dialog
    QStringList destinations;
    for (int i = 0; i < mDestinations.count(); i++) {
        destinations << mDestinations[i]->name;
    }
    mDestinationDialog->setItems(destinations);
    
    // Set selection
    int index = 0;          // Default index is the first
    if (mListItems.testFlag(CmApplSettingsUi::ShowConnectionMethods)
        && mSelection.result == CmApplSettingsUi::SelectionTypeConnectionMethod
        && !mConnMethods.isEmpty()) {
        // Dedicated access point
        index = destinations.count();
    } else {
        int destinationIndex = findDestination(mSelection.id);
        if (destinationIndex != ItemNotFound) {
            index = destinationIndex;
        }
    }
    mDestinationDialog->setSelected(index);
    
    // Execute the dialog
    bool connected = connect(
        mDestinationDialog,
        SIGNAL(finished(bool)),
        this,
        SLOT(destinationDialogResult(bool)));
    Q_ASSERT(connected);
    mDestinationDialog->open();
    
    OstTraceFunctionExit0(DUP1_CMAPPLSETTINGSUIPRIVATE_RUNDESTINATIONDIALOG_EXIT);
}
Exemplo n.º 5
0
void listener::run()
{
	TCHAR buf[1000];
	SOCKET ListenSocket;
	ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (ListenSocket == INVALID_SOCKET) 
	{
		wsprintf(buf,_T("Error at socket(): %ld\r\n"), WSAGetLastError());
		SvcDebugOut(buf);
		return;
	}

	sockaddr_in service;
	service.sin_family = AF_INET;
	service.sin_addr.s_addr = inet_addr("0.0.0.0");
	service.sin_port = htons(port);

	if (bind( ListenSocket,(SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR) 
	{
		SvcDebugOut(_T("bind() failed.\r\n"));
		closesocket(ListenSocket);
		return;
	}

	if (listen( ListenSocket, 1 ) == SOCKET_ERROR)
		SvcDebugOut(_T("Error listening on socket.\r\n"));

	SOCKET AcceptSocket;
	wsprintf(buf,_T("Listening port %d with rules:\r\n"),port);
	SvcDebugOut(buf);

	int pos=0;

	while(rules[pos].type!=RULES_T_EOL)
	{
		if(rules[pos].type==RULES_T_FORWARD)
			wsprintf(buf,_T("Forward host matching %s to %s:%d\r\n"),rules[pos].match,rules[pos].dest,rules[pos].destPort);
		else
			wsprintf(buf,_T("Drop host matching %s\r\n"),rules[pos].match);
		SvcDebugOut(buf);
		pos++;
	}

	while(1) 
	{
		AcceptSocket = SOCKET_ERROR;
		while( AcceptSocket == SOCKET_ERROR ) 
		{
			AcceptSocket = accept( ListenSocket, NULL, NULL );
		}

		TCHAR *dest;
		int destPort;
		findDestination(AcceptSocket,&dest,&destPort);
		if(dest==NULL)
		{
			closesocket(AcceptSocket);
		}
		else
		{
			connection *con=new connection();
			con->inSock=AcceptSocket;
			con->destination=dest;
			con->destPort=destPort;
			con->run();
		}
	}
}