Added logic to allow the sprite preview area to be hidden if desired.
This commit is contained in:
parent
53047762c4
commit
83e2d36480
|
@ -2581,6 +2581,15 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
|
|||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// View -> Show Preview
|
||||
act = new QAction(tr("Show &Preview"), this);
|
||||
//act->setShortcut(QKeySequence::Close);
|
||||
act->setCheckable(true);
|
||||
act->setStatusTip(tr("Show Preview Area"));
|
||||
connect(act, SIGNAL(triggered(bool)), this, SLOT(togglePreviewVis(bool)) );
|
||||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// Focus Policy
|
||||
optMenu = menuBar->addMenu(tr("&Options"));
|
||||
|
||||
|
@ -2723,8 +2732,17 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
|
|||
frame->setLayout( vbox );
|
||||
hbox1->addWidget( frame );
|
||||
vbox->addWidget( preView );
|
||||
//frame->hide(); // TODO Hide until preview code is ready
|
||||
previewFrame = frame;
|
||||
previewFrame->setMaximumWidth(0);
|
||||
|
||||
previewAnimation = new QPropertyAnimation( previewFrame, "maximumWidth", this);
|
||||
previewAnimation->setDuration(500);
|
||||
previewAnimation->setStartValue(0);
|
||||
previewAnimation->setEndValue(512);
|
||||
previewAnimation->setEasingCurve( QEasingCurve::InOutCirc );
|
||||
|
||||
connect( previewAnimation, SIGNAL(valueChanged(const QVariant &)), this, SLOT(previewAnimWidthChange(const QVariant &)));
|
||||
connect( previewAnimation, SIGNAL(finished(void)), this, SLOT(previewAnimResizeDone(void)) );
|
||||
|
||||
updateTimer = new QTimer( this );
|
||||
|
||||
|
@ -2771,6 +2789,40 @@ void spriteViewerDialog_t::toggleGridVis(void)
|
|||
oamView->setGridVisibility( !oamView->getGridVisibility() );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void spriteViewerDialog_t::togglePreviewVis(bool state)
|
||||
{
|
||||
//if ( previewFrame->isHidden() )
|
||||
//{
|
||||
// previewFrame->show();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// previewFrame->hide();
|
||||
//}
|
||||
if ( state )
|
||||
{
|
||||
previewAnimation->setStartValue(0);
|
||||
previewAnimation->setEndValue(512);
|
||||
previewAnimation->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
previewAnimation->setStartValue( previewFrame->width() );
|
||||
previewAnimation->setEndValue(0);
|
||||
previewAnimation->start();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void spriteViewerDialog_t::previewAnimWidthChange(const QVariant &value)
|
||||
{
|
||||
resize( minimumSizeHint() );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void spriteViewerDialog_t::previewAnimResizeDone(void)
|
||||
{
|
||||
resize( minimumSizeHint() );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void spriteViewerDialog_t::periodicUpdate(void)
|
||||
{
|
||||
int idx;
|
||||
|
@ -3304,7 +3356,6 @@ void oamPreview_t::paintEvent(QPaintEvent *event)
|
|||
QPainter painter(this);
|
||||
QColor bgColor(0, 0, 0);
|
||||
QPen pen;
|
||||
//char showSelector;
|
||||
char spriteRendered[64];
|
||||
struct oamSpriteData_t *spr;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QLineEdit>
|
||||
#include <QGroupBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
#include "Qt/main.h"
|
||||
|
||||
|
@ -444,6 +445,8 @@ class spriteViewerDialog_t : public QDialog
|
|||
QCheckBox *vFlipBox;
|
||||
QCheckBox *bgPrioBox;
|
||||
QCheckBox *showPosHex;
|
||||
QGroupBox *previewFrame;
|
||||
QPropertyAnimation *previewAnimation;
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
|
@ -452,6 +455,9 @@ class spriteViewerDialog_t : public QDialog
|
|||
void setClickFocus(void);
|
||||
void setHoverFocus(void);
|
||||
void toggleGridVis(void);
|
||||
void togglePreviewVis(bool);
|
||||
void previewAnimWidthChange(const QVariant &);
|
||||
void previewAnimResizeDone(void);
|
||||
};
|
||||
|
||||
int openPPUViewWindow( QWidget *parent );
|
||||
|
|
Loading…
Reference in New Issue