Modified Qt main viewport logic so that side panel coloring so that changes via the color picker dialog are seen immediately. Previous behavior is it would only show change upon accepting new color in dialog. Choosing cancel in dialog will return color to original state.
This commit is contained in:
parent
80b36379e7
commit
9c4b03c327
|
@ -42,6 +42,7 @@
|
|||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleViewerGL.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
@ -49,6 +50,8 @@ extern unsigned int gui_draw_area_height;
|
|||
ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
||||
: QOpenGLWidget( parent )
|
||||
{
|
||||
consoleWin_t *win = qobject_cast <consoleWin_t*>(parent);
|
||||
|
||||
view_width = 256;
|
||||
view_height = 224;
|
||||
gltexture = 0;
|
||||
|
@ -71,8 +74,13 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
textureType = GL_TEXTURE_2D;
|
||||
//textureType = GL_TEXTURE_RECTANGLE;
|
||||
|
||||
bgColor.setRgb( 0, 0, 0 );
|
||||
bgColor = NULL;
|
||||
|
||||
if ( win )
|
||||
{
|
||||
bgColor = win->getVideoBgColorPtr();
|
||||
bgColor->setRgb( 0, 0, 0 );
|
||||
}
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 224 );
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
@ -104,7 +112,10 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
|
||||
g_config->getOption ("SDL.ForceAspect", &forceAspect);
|
||||
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", &bgColor );
|
||||
if ( bgColor )
|
||||
{
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", bgColor );
|
||||
}
|
||||
}
|
||||
|
||||
connect( this, SIGNAL(frameSwapped(void)), this, SLOT(renderFinished(void)) );
|
||||
|
@ -370,7 +381,10 @@ void ConsoleViewGL_t::resizeGL(int w, int h)
|
|||
|
||||
void ConsoleViewGL_t::setBgColor( QColor &c )
|
||||
{
|
||||
bgColor = c;
|
||||
if ( bgColor )
|
||||
{
|
||||
*bgColor = c;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::setLinearFilterEnable( bool ena )
|
||||
|
@ -608,7 +622,14 @@ void ConsoleViewGL_t::paintGL(void)
|
|||
glOrtho( 0.0, rw, 0.0, rh, -1.0, 1.0);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glClearColor( bgColor.redF(), bgColor.greenF(), bgColor.blueF(), 1.0f); // Background color to config value.
|
||||
if ( bgColor )
|
||||
{
|
||||
glClearColor( bgColor->redF(), bgColor->greenF(), bgColor->blueF(), 1.0f); // Background color to config value.
|
||||
}
|
||||
else
|
||||
{
|
||||
glClearColor( 0.0, 0.0, 0.0, 1.0f); // Background color to config value.
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
|
||||
unsigned int textureType;
|
||||
unsigned int mouseButtonMask;
|
||||
QColor bgColor;
|
||||
QColor *bgColor;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleViewerSDL.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
@ -37,13 +38,21 @@ extern unsigned int gui_draw_area_height;
|
|||
ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
||||
: QWidget( parent )
|
||||
{
|
||||
consoleWin_t *win = qobject_cast <consoleWin_t*>(parent);
|
||||
|
||||
QPalette pal = palette();
|
||||
|
||||
pal.setColor(QPalette::Window, Qt::black);
|
||||
setAutoFillBackground(true);
|
||||
setPalette(pal);
|
||||
|
||||
bgColor.setRgb( 0, 0, 0 );
|
||||
bgColor = NULL;
|
||||
|
||||
if ( win )
|
||||
{
|
||||
bgColor = win->getVideoBgColorPtr();
|
||||
bgColor->setRgb( 0, 0, 0 );
|
||||
}
|
||||
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 224 );
|
||||
|
@ -103,7 +112,10 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
|
||||
g_config->getOption ("SDL.ForceAspect", &forceAspect);
|
||||
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", &bgColor );
|
||||
if ( bgColor )
|
||||
{
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", bgColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +140,10 @@ ConsoleViewSDL_t::~ConsoleViewSDL_t(void)
|
|||
|
||||
void ConsoleViewSDL_t::setBgColor( QColor &c )
|
||||
{
|
||||
bgColor = c;
|
||||
if ( bgColor )
|
||||
{
|
||||
*bgColor = c;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::setLinearFilterEnable( bool ena )
|
||||
|
@ -643,8 +658,14 @@ void ConsoleViewSDL_t::render(void)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor( sdlRenderer, bgColor.red(), bgColor.green(), bgColor.blue(), 255 );
|
||||
|
||||
if ( bgColor )
|
||||
{
|
||||
SDL_SetRenderDrawColor( sdlRenderer, bgColor->red(), bgColor->green(), bgColor->blue(), 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetRenderDrawColor( sdlRenderer, 0, 0, 0, 255 );
|
||||
}
|
||||
SDL_RenderClear(sdlRenderer);
|
||||
|
||||
uint8_t *textureBuffer;
|
||||
|
|
|
@ -71,7 +71,7 @@ class ConsoleViewSDL_t : public QWidget
|
|||
bool linearFilter;
|
||||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
QColor bgColor;
|
||||
QColor *bgColor;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
|
|
@ -177,6 +177,8 @@ class consoleWin_t : public QMainWindow
|
|||
|
||||
int getPeriodicInterval(void);
|
||||
|
||||
QColor *getVideoBgColorPtr(void){ return &videoBgColor; }
|
||||
|
||||
protected:
|
||||
consoleMenuBar *menubar;
|
||||
|
||||
|
|
Loading…
Reference in New Issue