Пример #1
0
ScrollableContainer::ScrollableContainer() : Container()
{
	scrollColor.a = 255;

	childAreaTexture = nullptr;
	showBorder(true);

}
Пример #2
0
SensitiveBorder * PhotoView::createBorder( const QString & objName )
{
    SensitiveBorder * border = new SensitiveBorder( this );
    border->setObjectName( objName );

#if 0
    connect( border, SIGNAL( borderEntered() ),
	     this,   SLOT  ( showBorder()    ) );

    connect( border, SIGNAL( borderLeft()    ),
	     this,   SLOT  ( hideBorder()    ) );
#endif

    return border;
}
Пример #3
0
void CScreenSetup::hide()
{
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
	frameBuffer->paintBackgroundBox(0, 0, screenwidth, screenheight);
	if (channel_id)
		showBorder(channel_id);
	else {
		frameBuffer->setBorderColor(color_bak);
		frameBuffer->setBorder(x_coord_bak[0], y_coord_bak[0], x_coord_bak[1], y_coord_bak[1]);
	}
#else
	int w = (int) frameBuffer->getScreenWidth(true);
	int h = (int) frameBuffer->getScreenHeight(true);
	frameBuffer->paintBackgroundBox(0, 0, w, h);
#endif
	frameBuffer->blit();
}
Пример #4
0
int CScreenSetup::exec(CMenuTarget* parent, const std::string &action)
{
	if (!m) {
		selected = 0;
		x_coord[0] = startX;
		x_coord[1] = endX;
		y_coord[0] = startY;
		y_coord[1] = endY;
		if (!channel_id) {
			color_bak = frameBuffer->getBorderColor();
			frameBuffer->getBorder(x_coord_bak[0], y_coord_bak[0], x_coord_bak[1], y_coord_bak[1]);
		}
		updateCoords();
		frameBuffer->setBorder(x_coord[0], y_coord[0], x_coord[1], y_coord[1]);
		frameBuffer->setBorderColor(channel_id ? 0x44444444 : 0x88888888);
		frameBuffer->paintIcon(NEUTRINO_ICON_BORDER_UL, 0, 0);
		frameBuffer->paintIcon(NEUTRINO_ICON_BORDER_LR, screenwidth - 1 - 96, screenheight - 1 - 96 );

		m = new CMenuWidget(channel_id ? LOCALE_VIDEOMENU_MASKSETUP : LOCALE_VIDEOMENU_SCREENSETUP, NEUTRINO_ICON_SETTINGS, w_max (40, 10));
		m->addItem(new CMenuForwarder(LOCALE_SCREENSETUP_UPPERLEFT, true, coord[0], this, "ul", CRCInput::RC_red));
		m->addItem(new CMenuForwarder(LOCALE_SCREENSETUP_LOWERRIGHT, true, coord[1], this, "lr", CRCInput::RC_green));
		if (channel_id)
			m->addItem(new CMenuForwarder(LOCALE_SCREENSETUP_REMOVE, true, NULL, this, "rm", CRCInput::RC_yellow));
		m->addKey(CRCInput::RC_home, this, "ex");
		m->addKey(CRCInput::RC_timeout, this, "ti");
		m->addKey(CRCInput::RC_ok, this, "ok");
		m->addKey(CRCInput::RC_up, this, "u");
		m->addKey(CRCInput::RC_down, this, "d");
		m->addKey(CRCInput::RC_left, this, "l");
		m->addKey(CRCInput::RC_right, this, "r");
		m->addKey(CRCInput::RC_setup, this, "se");
		m->setSelected(selected);
		m->exec(parent, "");
		delete m;
		m = NULL;
		hide();
		return menu_return::RETURN_REPAINT;
	}
	if (action == "ex" || action == "ti") {
		if (action == "ex" && ((startX != x_coord[0] ) || ( endX != x_coord[1] ) || ( startY != y_coord[0] ) || ( endY != y_coord[1] ) ) &&
			(ShowMsg(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel))
			return menu_return::RETURN_NONE;
		loadBorder(channel_id);
		return (action == "ex") ? menu_return::RETURN_EXIT : menu_return::RETURN_EXIT_ALL;
	}
	if (action == "ok") {
		startX = x_coord[0];
		endX = x_coord[1];
		startY = y_coord[0];
		endY = y_coord[1];
		if (channel_id) {
			borderFrame b;
			b.sx = startX;
			b.sy = startY;
			b.ex = endX;
			b.ey = endY;
			borderMap[channel_id] = b;
			showBorder(channel_id);
			saveBorders();
		} else {
			x_coord_bak[0] = x_coord[0];
			y_coord_bak[0] = y_coord[0];
			x_coord_bak[1] = x_coord[1];
			y_coord_bak[1] = y_coord[1];
			g_settings.screen_StartX_int = x_coord[0];
			g_settings.screen_EndX_int = x_coord[1];
			g_settings.screen_StartY_int = y_coord[0];
			g_settings.screen_EndY_int = y_coord[1];
			showBorder(channel_id);

			if(g_settings.screen_preset) {
				g_settings.screen_StartX_lcd = g_settings.screen_StartX_int;
				g_settings.screen_StartY_lcd = g_settings.screen_StartY_int;
				g_settings.screen_EndX_lcd = g_settings.screen_EndX_int;
				g_settings.screen_EndY_lcd = g_settings.screen_EndY_int;
			} else {
				g_settings.screen_StartX_crt = g_settings.screen_StartX_int;
				g_settings.screen_StartY_crt = g_settings.screen_StartY_int;
				g_settings.screen_EndX_crt = g_settings.screen_EndX_int;
				g_settings.screen_EndY_crt = g_settings.screen_EndY_int;
			}
		}
		return menu_return::RETURN_EXIT;
	}
	if (action == "se") {
		coord_abs = !coord_abs;
		updateCoords();
		return menu_return::RETURN_REPAINT;
	}
	if (action == "ul") {
		selected = 0;
		return menu_return::RETURN_REPAINT;
	}
	if (action == "lr") {
		selected = 1;
		return menu_return::RETURN_REPAINT;
	}
	if (action == "rm") {
		if (channel_id) {
			startX = g_settings.screen_StartX;
			startY = g_settings.screen_StartY;
			endX = g_settings.screen_EndX;
			endY = g_settings.screen_EndY;
			resetBorder(channel_id);
			saveBorders();
			if (g_InfoViewer)
				g_InfoViewer->start();
			return menu_return::RETURN_EXIT;
		}
		return menu_return::RETURN_NONE;
	}
	if (action == "u" || action == "d" || action == "l" || action == "r") {
		if ((action == "u") && (((selected == 0) && (y_coord[0] > 0)) || ((selected == 1) && (y_coord[1] > y_coord[0] - 100))))
			y_coord[selected]--;
		else if ((action == "d") && (((selected == 0) && (y_coord[0] < y_coord[1] - 100)) || ((selected == 1) && (y_coord[1] < screenheight))))
			y_coord[selected]++;
		else if ((action == "l") && (((selected == 0) && (x_coord[0] > 0)) || ((selected == 1) && (x_coord[1] > x_coord[0] - 100))))
			x_coord[selected]--;
		else if ((action == "r") && (((selected == 0) && (x_coord[0] < x_coord[1] - 100)) || ((selected == 1) && (x_coord[1] < screenwidth))))
			x_coord[selected]++;
		else
			return menu_return::RETURN_NONE;

		frameBuffer->setBorder(x_coord[0], y_coord[0], x_coord[1], y_coord[1]);
		updateCoords();
		return menu_return::RETURN_REPAINT;
	}
	return menu_return::RETURN_NONE;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FilterParameterWidget::fadeWidget(QWidget* widget, bool in)
{
#if 0
  if (m_FaderWidget)
  {
    m_FaderWidget->close();
  }
  m_FaderWidget = new FaderWidget(widget);
  if(in)
  {
    setVisible(true);
    m_FaderWidget->setFadeIn();
    connect(m_FaderWidget, SIGNAL(animationComplete() ),
            this, SLOT(show()));
    connect(m_FaderWidget, SIGNAL(animationComplete()),
            this, SLOT(showBorder()));

    widget->setStyleSheet("border: 2px solid MediumBlue;");
  }
  else
  {
    m_FaderWidget->setFadeOut();
    connect(m_FaderWidget, SIGNAL(animationComplete() ),
            this, SLOT(hide()));
  }

  m_FaderWidget->setStartColor(palette().color(QWidget::backgroundRole()));
  m_FaderWidget->start();
#else
  fadeIn = in;

  QString styleSheet;
  QTextStream ss (&styleSheet);
  ss << "QFrame#" << this->objectName() << " { ";
  ss << "background-color: rgb(223, 183, 175);";
  ss << "border: 0px Solid;";
  ss << "border-color: rgb(223, 183, 175);";
  ss << "border-radius: 5px;";
  ss <<  "}";

  if(!fadeIn)
  {
    startValue = detail::Max;
    endValue = 0;
  }
  else
  {
    widget->show();
    widget->setStyleSheet(styleSheet);
    //qDebug() << styleSheet();

    fadeIn = in;
    startValue = 0;
    endValue = detail::Max;
  }

  QRect rect = geometry();
  QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft());
  alphaGradient.setColorAt(0.5, Qt::black);
  alphaGradient.setColorAt(1.0, Qt::black);

  if(!effect)
  {
    effect = new QGraphicsOpacityEffect(this);
    effect->setOpacityMask(alphaGradient);
    //this->setGraphicsEffect(effect);
  }

  if(!animation)
  {
    animation = new QPropertyAnimation(effect, "opacity", this);
    animation->setDuration(detail::Duration);
    connect(animation, SIGNAL(finished()),
            this, SLOT(animationFinished()));
    connect(animation, SIGNAL(finished()),
            this, SLOT(showBorder()));
  }

  animation->setStartValue(startValue);
  animation->setEndValue(endValue);

  animation->start();

#endif

}
Пример #6
0
main()
{

    char touche;	// Variable où sera stocké la touche
	int y = OFFSET_Y, x = OFFSET_X;		// Variable de la position du pointeur de l'utilisateur
	double bestScore = -1, score = -1, lastScore = -1;

	time_t depart, arrivee; // Variables de temps

	// Activation de rand()
	srand(time(NULL));

	// Génération du menu
	showBorder();

	// Génération du menu
	showMenu();

	// Nouvelle partie
	newGame();

	// On démarre le chrono
    time(&depart);

	// Gestion des touches
	do{
		// Définition de la couleur du texte
		textbackground(B_TEXT);
		textcolor(C_TEXT);

		// On affiche le nombre de bombes restantes
		gotoxy(mapX+OFFSET_X+(BORDER*2), OFFSET_Y+8);
		printf("Bombs : %d   ", NB_BOMBS-nbFlags);

		if(lastScore != -1)
		{
			// On affiche le meilleur score
			gotoxy(mapX+OFFSET_X+(BORDER*2), OFFSET_Y+12);
			printf("Last Score : %.0f    ", lastScore);
		}

		if(bestScore != -1)
		{
			// On affiche le meilleur score
			gotoxy(mapX+OFFSET_X+(BORDER*2), OFFSET_Y+13);
			printf("Best Score : %.0f    ", bestScore);
		}


		if(gameOver == TRUE)
		{
			// Affichage des bombes
			showBombs();

			// On affiche le message
			msgZone(C_ERROR, B_ERROR);
			printf("BOOOOOM !");
			gotoxy(mapX+OFFSET_X+(BORDER*2), OFFSET_Y+18);
			printf("Retry ? Press \"r\"");

			// Pour l'esthétique, on remet le curseur à sa place
			gotoxy(x, y);

			do{
				touche = getch();
			}while(touche != 114);
		}
		else if(nbMined == NB_CASES-NB_BOMBS)
		{
			// On calcul le temps mis pour gagner
			time(&arrivee);
			score = difftime(arrivee, depart);

			if(score < bestScore || bestScore == -1) bestScore = score;
			lastScore = score;

			// On affiche qu'il a gagner
			msgZone(C_SUCESS, B_SUCESS);
			printf("YOU WIN !");
			gotoxy(mapX+OFFSET_X+(BORDER*2), OFFSET_Y+18);
			printf("Score : %.0f", score);
			// Pour l'esthétique, on remet le curseur à sa place
			gotoxy(x, y);

			do{
				touche = getch();
			}while(touche != 114);
		}
		else
		{
			// On remet le curseur là où le joueur joue
			gotoxy(x, y);

			//On récupère la touche appuyer
			touche = getch();
		}

		//printf("\n%c %d", touche, touche); // DEBUG : permet de voir le code de la touche

		if(needToClear == TRUE)
		{
			clearMsg(); // On efface le message précédent
			gotoxy(x, y); // On remet le curseur là où le joueur joue
		}

		// Si c'est un mouvement, on se déplace
		if(touche == -32)
		{
			// On récupère le sens
			touche = getch();
			switch(touche)
			{
				case 75:if(x != 0+OFFSET_X) x--; break; // gauche
				case 77:if(x != mapX-1+OFFSET_X) x++;break; // droite
				case 80:if(y != mapY-1+OFFSET_Y) y++;break; // bas
				case 72:if(y != 0+OFFSET_Y) y--; break; // haut
			}

			// On déplace le curseur
			gotoxy(x, y);
		}
		else if(touche == 32) // S'il selectionne la case (espace)
		{
			mineCase(x, y);
		}
		else if(touche == 102) // S'il pose un drapeau (touche "F")
		{
			putFlag(x, y);
		}
		else if(touche == 114) // Touche pour commencer une nouvelle partie
		{
			newGame();
			x = OFFSET_X;
			y = OFFSET_Y;
			gotoxy(OFFSET_X, OFFSET_Y);

			// On remet à zéro le chrono
			time(&depart);
		}
		else if(touche == 113) // Touche pour quitter
		{
			return 1;
		}
		else if(touche == 51) // Touche de debug pour voir les bombes (touche B)
		{
			showBombs();
		}
	}
	while(touche != '0');
}