Added a help menu to new Qt PPU pattern table tile editor.
This commit is contained in:
parent
d3bc4fb752
commit
6f4537733c
|
@ -26,9 +26,12 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QMenuBar>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
|
@ -1024,9 +1027,38 @@ ppuTileEditor_t::ppuTileEditor_t(int patternIndex, QWidget *parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout;
|
||||||
QHBoxLayout *hbox;
|
QHBoxLayout *hbox;
|
||||||
|
QMenuBar *menuBar;
|
||||||
|
QMenu *helpMenu;
|
||||||
|
QAction *act;
|
||||||
|
int useNativeMenuBar;
|
||||||
|
|
||||||
this->setFocusPolicy(Qt::StrongFocus);
|
this->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
|
menuBar = new QMenuBar(this);
|
||||||
|
|
||||||
|
// This is needed for menu bar to show up on MacOS
|
||||||
|
g_config->getOption( "SDL.UseNativeMenuBar", &useNativeMenuBar );
|
||||||
|
|
||||||
|
menuBar->setNativeMenuBar( useNativeMenuBar ? true : false );
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Menu
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Help
|
||||||
|
helpMenu = menuBar->addMenu(tr("Help"));
|
||||||
|
|
||||||
|
// Help -> Key Assignments
|
||||||
|
act = new QAction(tr("Keys"), this);
|
||||||
|
//act->setShortcut(QKeySequence::Open);
|
||||||
|
act->setStatusTip(tr("View Key Descriptions"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(showKeyAssignments(void)) );
|
||||||
|
|
||||||
|
helpMenu->addAction(act);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// End Menu
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
tileAddr = 0;
|
tileAddr = 0;
|
||||||
palIdx = pindex[ patternIndex ];
|
palIdx = pindex[ patternIndex ];
|
||||||
|
|
||||||
|
@ -1036,6 +1068,8 @@ ppuTileEditor_t::ppuTileEditor_t(int patternIndex, QWidget *parent)
|
||||||
|
|
||||||
mainLayout = new QVBoxLayout();
|
mainLayout = new QVBoxLayout();
|
||||||
|
|
||||||
|
mainLayout->setMenuBar( menuBar );
|
||||||
|
|
||||||
setLayout( mainLayout );
|
setLayout( mainLayout );
|
||||||
|
|
||||||
//vbox = new QVBoxLayout();
|
//vbox = new QVBoxLayout();
|
||||||
|
@ -1186,6 +1220,69 @@ void ppuTileEditor_t::setCellValue( int y, int x, int colorIndex )
|
||||||
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void ppuTileEditor_t::showKeyAssignments(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
QDialog *dialog;
|
||||||
|
QVBoxLayout *mainLayout;
|
||||||
|
QTreeWidget *tree;
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
const char *txt[] =
|
||||||
|
{
|
||||||
|
"Up" , "Move Selected Cell Up",
|
||||||
|
"Down" , "Move Selected Cell Down",
|
||||||
|
"Left" , "Move Selected Cell Left",
|
||||||
|
"Right", "Move Selected Cell Right",
|
||||||
|
"1" , "Set Selected Cell to Color #1",
|
||||||
|
"2" , "Set Selected Cell to Color #2",
|
||||||
|
"3" , "Set Selected Cell to Color #3",
|
||||||
|
"4" , "Set Selected Cell to Color #4",
|
||||||
|
"P" , "Cycle to Next Tile Palette",
|
||||||
|
"ESC" , "Close Window",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
dialog = new QDialog(this);
|
||||||
|
dialog->setWindowTitle("Tile Editor Key Descriptions");
|
||||||
|
dialog->resize( 512, 512 );
|
||||||
|
|
||||||
|
tree = new QTreeWidget();
|
||||||
|
|
||||||
|
tree->setColumnCount(2);
|
||||||
|
|
||||||
|
item = new QTreeWidgetItem();
|
||||||
|
item->setText( 0, QString::fromStdString( "Key" ) );
|
||||||
|
item->setText( 1, QString::fromStdString( "Description" ) );
|
||||||
|
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||||
|
item->setTextAlignment( 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
tree->setHeaderItem( item );
|
||||||
|
|
||||||
|
tree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
while ( txt[i] != NULL )
|
||||||
|
{
|
||||||
|
|
||||||
|
item = new QTreeWidgetItem();
|
||||||
|
|
||||||
|
item->setText( 0, tr(txt[i]) ); i++;
|
||||||
|
item->setText( 1, tr(txt[i]) ); i++;
|
||||||
|
|
||||||
|
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||||
|
item->setTextAlignment( 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
tree->addTopLevelItem( item );
|
||||||
|
}
|
||||||
|
mainLayout = new QVBoxLayout();
|
||||||
|
|
||||||
|
mainLayout->addWidget( tree );
|
||||||
|
|
||||||
|
dialog->setLayout( mainLayout );
|
||||||
|
|
||||||
|
dialog->show();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void ppuTileEditor_t::keyPressEvent(QKeyEvent *event)
|
void ppuTileEditor_t::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
//printf("Tile Editor Key Press: 0x%x \n", event->key() );
|
//printf("Tile Editor Key Press: 0x%x \n", event->key() );
|
||||||
|
|
|
@ -223,6 +223,7 @@ class ppuTileEditor_t : public QDialog
|
||||||
private slots:
|
private slots:
|
||||||
void periodicUpdate(void);
|
void periodicUpdate(void);
|
||||||
void paletteChanged(int index);
|
void paletteChanged(int index);
|
||||||
|
void showKeyAssignments(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ppuViewerDialog_t : public QDialog
|
class ppuViewerDialog_t : public QDialog
|
||||||
|
|
Loading…
Reference in New Issue