Esempio n. 1
0
SearchBar::SearchBar(QWidget* parent)
    : QWidget(parent),
      searchText_(nullptr),
      searchButton_(nullptr)
{
    createPanels();
}
Esempio n. 2
0
int GUI::update(MouseState *mouse, int& state, bool& muted, bool& retry)
{
	
	if(GUI_STATE != state)
	{
		old_GUI_STATE = GUI_STATE;
		if(state == STATE_PAUSED && (old_GUI_STATE == STATE_GAMESTART || old_GUI_STATE == STATE_PLAYING))
		{
			lastPlayingState = GUI_STATE;
		}
		if(state != STATE_GAMESTART && state != STATE_PLAYING && old_GUI_STATE != STATE_PAUSED)
		{
			clearTexts();
		}
		clearBtns();
		clearPanels();
		createBtns(state);
		createPanels(state);
		GUI_STATE = state;
	}
	else if(state == STATE_LOADING && GUI_STATE == state)
	{
		state = STATE_GAMESTART;
		clearTexts();
		clearPanels();
		createPanels(state);
	}
	

	for(int i = 0; i < this->nrOfBtns; i++)
	{
		bool check = checkBtn(mouse, this->menuBtns[i]);
		if(check)
		{
			state = changeState(this->menuBtns[i]);
			
		}
	}

	muted = this->muted;
	retry = this->retry;
	return state;
}
Esempio n. 3
0
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent), ui(new Ui::MainWindow) {
    ui->setupUi(this);

	centralWidget = new QWidget();
	QPalette pal(palette());
	pal.setColor(QPalette::Background, Qt::white);
	centralWidget->setAutoFillBackground(true);
	centralWidget->setPalette(pal);

	QHBoxLayout * layout = new QHBoxLayout;
	createPanels();
	layout->addWidget(drawPanel);
	layout->addWidget(controlPanel);
	centralWidget->setLayout(layout);
	this->setCentralWidget(centralWidget);

	createMenus();
	resize(800, 600);
}
Esempio n. 4
0
GUI::GUI()
{
	this->menuBtns = NULL;
	this->textBoxes = NULL;
	this->panels = NULL; 
	this->nrOfBtns = 0;
	this->nrOfBoxes = 0;
	this->nrOfPanles = 0;
	this->GUI_STATE = 0;
	midScreenW = (float)SCREEN_WIDTH/2;
	midScreenH = (float)SCREEN_HEIGHT/2;
	muted = false;
	retry = false;
	first = true;
	createLevelList();
	this->currentLevel = 0;
	initDifficulty();
	this->currentBuilding = TEXTURE_MAINBUILDING;
	createBtns(STATE_MENU);
	createPanels(STATE_MENU);
	
}
Esempio n. 5
0
PhotoView::PhotoView( PhotoDir * photoDir )
    : QGraphicsView()
    , _photoDir( photoDir )
    , _lastPhoto( 0 )
    , _zoomMode( ZoomFitImage )
    , _zoomFactor( 1.0	 )
    , _zoomIncrement( 1.2 )
    , _idleTimeout( DefaultIdleTimeout )
    , _actions( this )
{
    Q_CHECK_PTR( photoDir );
    setScene( new QGraphicsScene );

    _canvas = new Canvas( this );
    createBorders();

    QSize pannerMaxSize( qApp->desktop()->screenGeometry().size() / 6 );
    _panner = new Panner( pannerMaxSize, this );

    createPanels();

    //
    // Visual tweaks
    //

    QPalette pal = palette();
    pal.setColor( QPalette::Base, Qt::black );
    setPalette( pal );
    setFrameStyle( QFrame::NoFrame );

    setVerticalScrollBarPolicy	( Qt::ScrollBarAlwaysOff );
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );

#if 0
    // Some styles (e.g. Plastique) have an undesired two pixel wide focus rect
    // around QGraphicsView widgets. This is not what we want here, so let's
    // select a style that does not do this. This does not have an effect on
    // existing or future child widgets. And since scroll bars are turned off,
    // there is no other visual effect anyway.

    // FIXME
    // FIXME
    // FIXME
    setStyle( new QWindowsStyle() );
    // FIXME
    // FIXME
    // FIXME
#endif

    // Enable mouse tracking so a mouse cursor that was set invisible by an
    // item (e.g., Canvas) can be made visible again upon mouse movement.
    setMouseTracking( true );

    connect( &_idleTimer, SIGNAL( timeout()    ),
	     this,	   SLOT	 ( hideCursor() ) );

    _idleTimer.setSingleShot( true );
    _idleTimer.start( _idleTimeout );
    _cursor = viewport()->cursor();

    //
    // Load images
    //

    _photoDir->prefetch();

    if ( ! _photoDir->isEmpty() )
	loadImage();
}