Exemplo n.º 1
0
void MpcImportWindow::createDialogContent()
{
	ui->setupUi(dialog);

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->pushButtonAcquire, SIGNAL(clicked()),
	        this, SLOT(acquireObjectData()));
	connect(ui->pushButtonAbortDownload, SIGNAL(clicked()),
	        this, SLOT(abortDownload()));
	connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects()));
	connect(ui->pushButtonDiscard, SIGNAL(clicked()),
	        this, SLOT(discardObjects()));

	connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)),
	        this, SLOT(bookmarkSelected(QString)));

	connect(ui->radioButtonFile, SIGNAL(toggled(bool)),
	        ui->frameFile, SLOT(setVisible(bool)));
	connect(ui->radioButtonURL, SIGNAL(toggled(bool)),
	        ui->frameURL, SLOT(setVisible(bool)));

	connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));
	connect(ui->radioButtonComets, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));

	connect(ui->pushButtonMarkAll, SIGNAL(clicked()),
	        this, SLOT(markAll()));
	connect(ui->pushButtonMarkNone, SIGNAL(clicked()),
	        this, SLOT(unmarkAll()));

	connect(ui->pushButtonSendQuery, SIGNAL(clicked()),
	        this, SLOT(sendQuery()));
	connect(ui->lineEditQuery, SIGNAL(returnPressed()),
		this, SLOT(sendQuery()));
	connect(ui->pushButtonAbortQuery, SIGNAL(clicked()),
	        this, SLOT(abortQuery()));
	connect(ui->lineEditQuery, SIGNAL(textEdited(QString)),
	        this, SLOT(resetNotFound()));
	//connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery()));
	connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown()));

	QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this);
	filterProxyModel->setSourceModel(candidateObjectsModel);
	filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
	ui->listViewObjects->setModel(filterProxyModel);
	connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)),
	        filterProxyModel, SLOT(setFilterFixedString(const QString&)));

	loadBookmarks();
	updateTexts();

	resetCountdown();
	resetDialog();
}
Exemplo n.º 2
0
void copy_region(void)
{
  typePage *p;

  if (!mark_set) { displayMessageAndWaitForKey("Nothing to copy"); return; }
  sizeCopyBuffer = mark_max - mark_min + 1;
  if (sizeCopyBuffer == 0) return;
  if (sizeCopyBuffer > BIGGEST_COPYING) {
    displayTwoLineMessage("Hey, don't you think that's too big?!", "Really copy (Yes/No)");
    if (tolower(getch()) != 'y') return;
  }
  FREE(copyBuffer);
  if ((copyBuffer = malloc(sizeCopyBuffer)) == NULL) {
    displayMessageAndWaitForKey("Can't allocate that much memory");
    return;
  }
  if (LSEEK_(fd, mark_min) == -1 || read(fd, copyBuffer, sizeCopyBuffer) == -1) {
    displayMessageAndWaitForKey(strerror(errno));
    return;
  }

  for (p = edited; p; p = p->next) {
    if (mark_min < p->base + p->size && p->base <= mark_max) {
      off_t min = MIN(p->base, mark_min);
      memcpy(copyBuffer + p->base - min,
	     p->vals + mark_min - min,
	     MIN(p->base + p->size, mark_max) - MAX(p->base, mark_min) + 1);
    }
  }
  unmarkAll();
  mark_set = FALSE;
}
Exemplo n.º 3
0
Card *Gypsy::newCards()
{
    if (Deck::deck()->isEmpty())
        return 0;

    unmarkAll();
    dealRow(true);
    takeState();
    considerGameStarted();
    if (Deck::deck()->isEmpty())
        emit newCardsPossible(false);

    return store[0]->top();
}
Exemplo n.º 4
0
void AGraph::generateGraphRouteVisualization()
{
	clearRouteVisuals();

	unmarkAll();
	TArray<int32> stack;

	for (int32 i = 0; i < MAX_SIZE; i++)
	{
		DFS_makeVisualizers(stack, i);
	}
#if WITH_EDITOR
	Super::PostEditChange();
#endif
}
Exemplo n.º 5
0
//BREAD FIRST SEARCH
void Graph::BFS()
{
    unmarkAll();
    int u = 0;
    queue<int> q;
    markVertex(u);
    q.push(u);

    while (!q.empty()) {
	u = q.front();
	q.pop();
	for (int i = 0; i < NODE_COUNT; i++) 
	    if (isAdjacent(u,i) && !isMarked(i)) {
		q.push(i);
		markVertex(i);
	    }
	cout << u << " ";
    }
}
Exemplo n.º 6
0
void Graph::DFS()
{
    unmarkAll();
    DFS(0);
}
Exemplo n.º 7
0
ActionsButtonPanel::ActionsButtonPanel(QWidget *parent)
    :   QWidget(parent)
{
    //createDefaultExtensions();
    QVBoxLayout *mainLayout         = new QVBoxLayout(this);
    filter_pushButton               = new QPushButton("&Filter", this);
    sort_pushButton                 = new QPushButton("&Sort", this);
    reset_pushButton                = new QPushButton("&Reset", this);
    markings_pushButton             = new QPushButton("Markings", this);
    autoSelection_pushButton        = new QPushButton("&Auto Selection", this);
    commit_pushButton               = new QPushButton("&Commit", this);
    auto_pushButton                 = new QPushButton("A&uto", this);
    filterDialog                    = new FilterDialog(this);

    sort_pushButton->setCheckable(true);
    markings_pushButton->setCheckable(true);
    autoSelection_pushButton->setCheckable(true);

    QFrame* line = new QFrame(this);
    line->setFrameShape(QFrame::HLine);

    QFrame* line2 = new QFrame(this);
    line2->setFrameShape(QFrame::HLine);

    QFrame* line3 = new QFrame(this);
    line3->setFrameShape(QFrame::HLine);

    mainLayout->addWidget(commit_pushButton);
    mainLayout->addWidget(line);
    mainLayout->addWidget(filter_pushButton);
    mainLayout->addWidget(sort_pushButton);
    mainLayout->addWidget(reset_pushButton);
    mainLayout->addWidget(line2);
    mainLayout->addWidget(autoSelection_pushButton);
    mainLayout->addWidget(markings_pushButton);
    mainLayout->addWidget(line3);
    mainLayout->addWidget(auto_pushButton);
    mainLayout->addStretch();
    auto_pushButton->setEnabled(false);

    sortContextMenu.addAction("&Descending Order of File size", this, SLOT(sortByDescendingFileSize()));
    sortContextMenu.addAction("&Ascending Order of File size", this, SLOT(sortByAscendingFileSize()));

    autoSelectionContextMenu.addAction("Select Group Keeps", this, SIGNAL(selectGroupKeeps()));
    autoSelectionContextMenu.addAction("Select Group Deletes", this, SIGNAL(selectGroupDeletes()));
    autoSelectionContextMenu.addAction("Select Next Group Keeps", this, SIGNAL(selectNextGroupKeeps()));
    autoSelectionContextMenu.addAction("Select Next Group Deletes", this, SIGNAL(selectNextGroupDeletes()));
    autoSelectionContextMenu.addAction("Auto Select Next &Possibilities", this, SIGNAL(autoSelectDeletePossibilities()))
           ;// ->setEnabled(false);
    autoSelectionContextMenu.addAction("Auto Select Highest &Keeps", this, SIGNAL(autoSelectNextKeeps()));
    autoSelectionContextMenu.addAction("Auto Select Highest &Deletes", this, SIGNAL(autoSelectNextDeletes()));

    markingsContextMenu.addAction("Unmark &All", this, SIGNAL(unmarkAll()));
    markingsContextMenu.addAction("Unmark All &Keeps", this, SIGNAL(unmarkAllKeeps()));
    markingsContextMenu.addAction("Unmark all &Deletes", this, SIGNAL(unmarkAllDeletes()));

    connect(reset_pushButton, SIGNAL(clicked()), this, SIGNAL(resetRequested()));
    connect(commit_pushButton, SIGNAL(clicked()), this, SIGNAL(commitRequested()));

    connect(filter_pushButton, SIGNAL(clicked()), this, SLOT(filterContextMenuClicked()));
    connect(sort_pushButton, SIGNAL(clicked()), this, SLOT(processSortRequest()));
    connect(autoSelection_pushButton, SIGNAL(clicked()), this, SLOT(processAutoSelectionClicked()));
    connect(markings_pushButton, SIGNAL(clicked()), this, SLOT(processMarkingsClicked()));
    connect(auto_pushButton, SIGNAL(clicked()), this, SIGNAL(autoCleanDeletes()));

    connect(&sortContextMenu, SIGNAL(aboutToHide()), this, SLOT(sortContextMenuAboutToHide()));
    connect(&autoSelectionContextMenu, SIGNAL(aboutToHide()), this,
            SLOT(autoSelectionContextMenuAboutToHide()));
    connect(&markingsContextMenu, SIGNAL(aboutToHide()), this,
            SLOT(markingsContextMenuAboutToHide()));
    connect(&filterContextMenu, SIGNAL(aboutToHide()), this,
            SLOT(filterContextMenuAboutToHide()));
    connect(filterDialog, SIGNAL(aboutToHide()), this, SLOT(filterContextMenuAboutToHide()));
    connect(filterDialog, SIGNAL(filterByExtension(QStringList)), this, SIGNAL(filterByExtension(QStringList)));
    connect(filterDialog, SIGNAL(filterByPath(QString)), this, SIGNAL(filterByPath(QString)));
    connect(filterDialog, SIGNAL(filterByRegex(QRegExp)), this, SIGNAL(filterByRegex(QRegExp)));
    connect(filterDialog, SIGNAL(filterBySize(ulong,ulong)), this, SIGNAL(filterBySize(ulong,ulong)));
}
Exemplo n.º 8
0
// function for showing the AI menu and editing the felevent settings
int AIsettingMenu(windowRef w, GameRef game)
{

	int quit = 0;
	int retVal = 0;


	buttonRef continueBtn = getBtn(continueImgFile, (WSw / 2) - BtnRectWidth / 2, 4.8 * (WSh / 6));
	if (continueBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef minimaxDepthBtn = getBtn(minimaxDepthImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 1.15 * (WSh / 6));
	if (minimaxDepthBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef minimax1Btn = getBtn(minimax1ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 1.6 * (WSh / 6));
	if (minimax1Btn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef minimax2Btn = getBtn(minimax2ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 2.2 * (WSh / 6));
	if (minimax2Btn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef minimax3Btn = getBtn(minimax3ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 2.8 * (WSh / 6));
	if (minimax3Btn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef minimax4Btn = getBtn(minimax4ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 3.4 * (WSh / 6));
	if (minimax4Btn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef bestDepthBtn = getBtn(bestDepthImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 4 * (WSh / 6));
	if (bestDepthBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef userColorBtn = getBtn(userColorImgFile, (WSw / 4) - BtnRectWidth / 2, 1.15 * (WSh / 6));
	if (userColorBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef whiteBtn = getBtn(whiteImgFile, (WSw / 4) - BtnRectWidth / 2, 1.6 * (WSh / 6));
	if (whiteBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}

	buttonRef blackBtn = getBtn(blackImgFile, (WSw / 4) - BtnRectWidth / 2, 2.2 * (WSh / 6));
	if (blackBtn == NULL){
		perror("ERROR: failed getBtn");
		return ERROR;
	}


	panelRef topPanel = getPanel(0, 0, WSw, WSh);
	if (topPanel == NULL){
		perror("ERROR: failed getPanel");
		return ERROR;
	}

	lableRef topPanelLbl = getLbl(backImgFile, 0, 0);
	if (topPanelLbl == NULL){
		perror("ERROR: failed getLabel");
		return ERROR;
	}
	setLblHightWigth(topPanelLbl, WSw, WSh);



	while (!quit)
	{
		// Clear window to WHITE
		if (fillWindow(w, 255, 255, 255) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed fillWindow");
			break;
		}
		fillPanel(topPanel, 255, 255, 255);

		if (drowImgOnLblPnl(topPanelLbl, topPanel) == 1)
		{

			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		// Draw images


		if (drowImgOnBtn(continueBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}
		if (drowImgOnBtn(minimaxDepthBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(minimax1Btn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(minimax2Btn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(minimax3Btn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(minimax4Btn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(bestDepthBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(userColorBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(whiteBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}

		if (drowImgOnBtn(blackBtn, w) == 1)
		{
			quit = QUIT;
			retVal = ERROR;
			perror("ERROR: failed drowImg");
			break;
		}


		if (SDL_Flip(w->window) != 0)
		{
			perror("ERROR: failed perform SDL_Flip in MainMenu");
			return ERROR;
		}

		//Poll for keyboard & mouse events
		SDL_Event e = { 0 };
		while (SDL_PollEvent(&e) != 0 && quit == 0 && retVal == 0)
		{
			switch (e.type)
			{
			case (SDL_QUIT) :
				quit = QUIT;
				retVal = QUIT;
				break;
			case (SDL_KEYUP) :
				if (e.key.keysym.sym == SDLK_ESCAPE){
					quit = QUIT;
					retVal = QUIT;
				}
			case (SDL_MOUSEBUTTONUP) :
				if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(continueBtn, e)){
					quit = QUIT;
					retVal = setOrGame(w, game, 2);
				}
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax1Btn, e)){
										 unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn);
										 reloadImgToBtn(minimax1Btn, minimax1PressImgFile);
										 game->minimaxDepth = 1;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax2Btn, e)){
										 unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn);
										 reloadImgToBtn(minimax2Btn, minimax2PressImgFile);
										 game->minimaxDepth = 2;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax3Btn, e)){
										 unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn);
										 reloadImgToBtn(minimax3Btn, minimax3PressImgFile);
										 game->minimaxDepth = 3;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax4Btn, e)){
										 unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn);
										 reloadImgToBtn(minimax4Btn, minimax4PressImgFile);
										 game->minimaxDepth = 4;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(bestDepthBtn, e)){
										 unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn);
										 reloadImgToBtn(bestDepthBtn, bestDepthPressImgFile);
										 game->minimaxDepth = 5;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(whiteBtn, e)){
										 reloadImgToBtn(whiteBtn, whitePressImgFile);
										 reloadImgToBtn(blackBtn, blackImgFile);
										 game->userColor = WHITE;
										 game->computerColor = BLACK;
									 }
									 if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(blackBtn, e)){
										 reloadImgToBtn(blackBtn, blackPressImgFile);
										 reloadImgToBtn(whiteBtn, whiteImgFile);
										 game->userColor = BLACK;
										 game->computerColor = WHITE;
									 }




			}

		}
		SDL_Delay(0);
	}



	// free allocated mem
	freePanel(topPanel);
	freeBtn(continueBtn);
	freeBtn(minimaxDepthBtn);
	freeBtn(minimax1Btn);
	freeBtn(minimax2Btn);
	freeBtn(minimax3Btn);
	freeBtn(minimax4Btn);
	freeBtn(bestDepthBtn);
	freeBtn(whiteBtn);
	freeBtn(blackBtn);
	freeLbl(topPanelLbl);
	freeBtn(userColorBtn);

	return retVal;
}