예제 #1
0
FileBrowser::FileBrowser() {
  setObjectName("file-browser");
  resize(800, 480);
  setGeometryString(&config().geometry.fileBrowser);
  application.windowList.append(this);

  previewLayout = new QVBoxLayout;
  previewLayout->setAlignment(Qt::AlignTop);
  previewFrame->setLayout(previewLayout);

  previewInfo = new QLabel;
  previewLayout->addWidget(previewInfo);

  previewImage = new QWidget;
  previewImage->setFixedSize(256, 239);
  previewLayout->addWidget(previewImage);

  previewSpacer = new QWidget;
  previewSpacer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
  previewLayout->addWidget(previewSpacer);

  previewApplyPatch = new QCheckBox("Apply Patch");
  previewApplyPatch->setVisible(false);
  previewApplyPatch->setChecked(config().file.applyPatches);
  previewLayout->addWidget(previewApplyPatch);

  connect(this, SIGNAL(changed(const string&)), this, SLOT(change(const string&)));
  connect(this, SIGNAL(activated(const string&)), this, SLOT(activate(const string&)));
  connect(this, SIGNAL(accepted(const string&)), this, SLOT(accept(const string&)));
  connect(previewApplyPatch, SIGNAL(stateChanged(int)), this, SLOT(toggleApplyPatch()));
}
예제 #2
0
MemoryEditor::MemoryEditor() {
  setObjectName("memory-editor");
  setWindowTitle("Memory Editor");
  setGeometryString(&config().geometry.memoryEditor);
  application.windowList.append(this);

  layout = new QHBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  editor = new HexEditor;
  editor->reader = { &MemoryEditor::reader, this };
  editor->writer = { &MemoryEditor::writer, this };
  editor->setFont(QFont(Style::Monospace));
  editor->setMinimumWidth((editor->lineWidth() + 3) * editor->fontMetrics().width(' '));
  editor->setMinimumHeight((16 + 1) * editor->fontMetrics().height());
  editor->setSize(16 * 1024 * 1024);
  memorySource = SNES::Debugger::MemorySource::CPUBus;
  layout->addWidget(editor);

  controlLayout = new QVBoxLayout;
  controlLayout->setSpacing(0);
  layout->addLayout(controlLayout);

  source = new QComboBox;
  source->addItem("S-CPU bus");
  source->addItem("S-APU bus");
  source->addItem("S-PPU VRAM");
  source->addItem("S-PPU OAM");
  source->addItem("S-PPU CGRAM");
  controlLayout->addWidget(source);
  controlLayout->addSpacing(2);

  addr = new QLineEdit;
  controlLayout->addWidget(addr);

  autoUpdateBox = new QCheckBox("Auto update");
  controlLayout->addWidget(autoUpdateBox);

  refreshButton = new QPushButton("Refresh");
  controlLayout->addWidget(refreshButton);

  spacer = new QWidget;
  spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
  controlLayout->addWidget(spacer);

  exportButton = new QPushButton("Export");
  controlLayout->addWidget(exportButton);

  importButton = new QPushButton("Import");
  controlLayout->addWidget(importButton);

  connect(source, SIGNAL(currentIndexChanged(int)), this, SLOT(sourceChanged(int)));
  connect(addr, SIGNAL(textEdited(const QString&)), this, SLOT(updateOffset()));
  connect(addr, SIGNAL(returnPressed()), this, SLOT(updateOffset()));
  connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
  connect(exportButton, SIGNAL(released()), this, SLOT(exportMemory()));
  connect(importButton, SIGNAL(released()), this, SLOT(importMemory()));
}
예제 #3
0
파일: about.cpp 프로젝트: BigEd/snes-sdk
AboutWindow::AboutWindow() {
  setObjectName("about-window");
  setWindowTitle("About bsnes ...");
  setGeometryString(&config().geometry.aboutWindow);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setSizeConstraint(QLayout::SetFixedSize);
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  logo = new Logo;
  logo->setFixedSize(600, 106);
  layout->addWidget(logo);

  info = new QLabel(string() <<
    "<table width='100%'><tr>"
    "<td align='left'><b>Version: </b>" << bsnesVersion << "</td>"
    "<td align='center'><b>Author: </b>byuu</td>"
    "<td align='right'><b>Homepage: </b><a href='http://byuu.org'>http://byuu.org</a></td>"
    "</tr></table>"
  );
  layout->addWidget(info);
}
예제 #4
0
VramViewer::VramViewer() {
  setObjectName("vram-viewer");
  setWindowTitle("Video RAM Viewer");
  setGeometryString(&config().geometry.vramViewer);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setSizeConstraint(QLayout::SetFixedSize);
  layout->setAlignment(Qt::AlignCenter);
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  controlLayout = new QHBoxLayout;
  controlLayout->setSizeConstraint(QLayout::SetMinimumSize);
  controlLayout->setAlignment(Qt::AlignRight);
  layout->addLayout(controlLayout);

  depth2bpp = new QRadioButton("2 BPP");
  controlLayout->addWidget(depth2bpp);

  depth4bpp = new QRadioButton("4 BPP");
  controlLayout->addWidget(depth4bpp);

  depth8bpp = new QRadioButton("8 BPP");
  controlLayout->addWidget(depth8bpp);

  depthMode7 = new QRadioButton("Mode 7");
  controlLayout->addWidget(depthMode7);

  autoUpdateBox = new QCheckBox("Auto update");
  controlLayout->addWidget(autoUpdateBox);

  refreshButton = new QPushButton("Refresh");
  controlLayout->addWidget(refreshButton);

  canvas = new VramCanvas;
  canvas->setFixedSize(512, 512);
  layout->addWidget(canvas);

  vramInfo = new QLabel;
  layout->addWidget(vramInfo);

  bpp = 2;
  depth2bpp->setChecked(true);

  connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
  connect(depth2bpp,  SIGNAL(pressed()), this, SLOT(setDepth2bpp()));
  connect(depth4bpp,  SIGNAL(pressed()), this, SLOT(setDepth4bpp()));
  connect(depth8bpp,  SIGNAL(pressed()), this, SLOT(setDepth8bpp()));
  connect(depthMode7, SIGNAL(pressed()), this, SLOT(setDepthMode7()));
  connect(canvas, SIGNAL(infoChanged(unsigned)), this, SLOT(displayInfo(unsigned)));
}
예제 #5
0
ToolsWindow::ToolsWindow() {
  setObjectName("tools-window");
  setWindowTitle("Tools");
  resize(600, 360);
  setGeometryString(&config().geometry.toolsWindow);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  cheatEditorWindow = new CheatEditorWindow;
  cheatFinderWindow = new CheatFinderWindow;
  stateManagerWindow = new StateManagerWindow;
  effectToggleWindow = new EffectToggleWindow;
  soundViewerWindow = new SoundViewerWindow;
  
  cheatEditorArea = new QScrollArea;
  cheatEditorArea->setWidget(cheatEditorWindow);
  cheatEditorArea->setFrameStyle(0);
  cheatEditorArea->setWidgetResizable(true);

  cheatFinderArea = new QScrollArea;
  cheatFinderArea->setWidget(cheatFinderWindow);
  cheatFinderArea->setFrameStyle(0);
  cheatFinderArea->setWidgetResizable(true);

  stateManagerArea = new QScrollArea;
  stateManagerArea->setWidget(stateManagerWindow);
  stateManagerArea->setFrameStyle(0);
  stateManagerArea->setWidgetResizable(true);

  effectToggleArea = new QScrollArea;
  effectToggleArea->setWidget(effectToggleWindow);
  effectToggleArea->setFrameStyle(0);
  effectToggleArea->setWidgetResizable(true);
  
  tab = new QTabWidget;
  tab->addTab(cheatEditorArea, "Cheat Editor");
  tab->addTab(cheatFinderArea, "Cheat Finder");
  tab->addTab(stateManagerArea, "State Manager");
  if(SNES::PPU::SupportsLayerEnable || SNES::DSP::SupportsChannelEnable)
    tab->addTab(effectToggleArea, "Effect Toggle");

  layout->addWidget(tab);
}
예제 #6
0
BreakpointEditor::BreakpointEditor() {
  setObjectName("breakpoint-editor");
  setWindowTitle("Breakpoint Editor");
  setGeometryString(&config().geometry.breakpointEditor);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setSizeConstraint(QLayout::SetFixedSize);
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  for(unsigned n = 0; n < SNES::Debugger::Breakpoints; n++) {
    breakpoint[n] = new BreakpointItem(n);
    layout->addWidget(breakpoint[n]);
  }
}
예제 #7
0
PropertiesViewer::PropertiesViewer() {
  setObjectName("properties-viewer");
  setWindowTitle("Properties");
  setGeometryString(&config().geometry.propertiesViewer);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  tabWidget = new QTabWidget;
  layout->addWidget(tabWidget);

  cpuPropertiesTab = new PropertiesWidget(SNES::cpu);
  tabWidget->addTab(cpuPropertiesTab, "S-CPU");

  smpPropertiesTab = new PropertiesWidget(SNES::smp);
  tabWidget->addTab(smpPropertiesTab, "S-SMP");

  ppuPropertiesTab = new PropertiesWidget(SNES::ppu);
  tabWidget->addTab(ppuPropertiesTab, "S-PPU");

  dspPropertiesTab = new PropertiesWidget(SNES::dsp);
  tabWidget->addTab(dspPropertiesTab, "S-DSP");

  sa1PropertiesTab = new PropertiesWidget(SNES::sa1);
  tabWidget->addTab(sa1PropertiesTab, "SA-1");

  sfxPropertiesTab = new PropertiesWidget(SNES::superfx);
  tabWidget->addTab(sfxPropertiesTab, "GSU");

  controlLayout = new QHBoxLayout;
  controlLayout->setAlignment(Qt::AlignRight);
  layout->addLayout(controlLayout);

  autoUpdateBox = new QCheckBox("Auto update");
  controlLayout->addWidget(autoUpdateBox);

  refreshButton = new QPushButton("Refresh");
  controlLayout->addWidget(refreshButton);

  connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
}
예제 #8
0
SoundViewerWindow::SoundViewerWindow() {
	setObjectName("sound-viewer");
	setWindowTitle("Sound Viewer");
	setGeometryString(&config().geometry.soundViewerWindow);
	application.windowList.append(this);
  
	layout = new QVBoxLayout;
	layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	layout->setMargin(Style::WindowMargin);
	layout->setSpacing(Style::WidgetSpacing);
	layout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(layout);
	
	for (int i = 0; i < 8; i++) {
		noteLabel[i] = new QLabel(QString("Channel %1").arg(i+1));
		layout->addWidget(noteLabel[i]);
		viewer[i] = new SoundViewerWidget(i);
		layout->addWidget(viewer[i]);
	}
}
예제 #9
0
BreakpointEditor::BreakpointEditor() {
  setObjectName("breakpoint-editor");
  setWindowTitle("Breakpoint Editor");
  setGeometryString(&config().geometry.breakpointEditor);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setSizeConstraint(QLayout::SetFixedSize);
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  for(unsigned n = 0; n < SNES::Debugger::Breakpoints; n++) {
    breakpoint[n] = new BreakpointItem(n);
    layout->addWidget(breakpoint[n]);
  }
  
  breakOnWDM = new QCheckBox("Break on WDM (CPU/SA-1 opcode 0x42)");
  connect(breakOnWDM, SIGNAL(toggled(bool)), this, SLOT(toggle()));
  layout->addWidget(breakOnWDM);
}
예제 #10
0
Disassembler::Disassembler() {
  setObjectName("disassembler");
  setWindowTitle("Disassembler");
  setGeometryString(&config().geometry.disassembler);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  cpuDisassembler = new DisasmWidget;
  smpDisassembler = new DisasmWidget;
  sa1Disassembler = new DisasmWidget;
  sfxDisassembler = new DisasmWidget;

  tab = new QTabWidget;
  tab->addTab(cpuDisassembler, "S-CPU");
  tab->addTab(smpDisassembler, "S-SMP");
  tab->addTab(sa1Disassembler, "SA-1");
  tab->addTab(sfxDisassembler, "SuperFX");
  layout->addWidget(tab);
}
예제 #11
0
Debugger::Debugger() {
  setObjectName("debugger");
  setWindowTitle("Debugger");
  setGeometryString(&config().geometry.debugger);
  application.windowList.append(this);

  layout = new QHBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  menu = new QMenuBar;
  layout->setMenuBar(menu);

  menu_tools = menu->addMenu("Tools");
  menu_tools_disassembler = menu_tools->addAction("Disassembler ...");
  menu_tools_breakpoint = menu_tools->addAction("Breakpoint Editor ...");
  menu_tools_memory = menu_tools->addAction("Memory Editor ...");
  menu_tools_propertiesViewer = menu_tools->addAction("Properties Viewer ...");

  menu_ppu = menu->addMenu("S-PPU");
  menu_ppu_vramViewer = menu_ppu->addAction("Video RAM Viewer ...");
  menu_ppu_oamViewer = menu_ppu->addAction("Sprite Viewer ...");
  menu_ppu_cgramViewer = menu_ppu->addAction("Palette Viewer ...");

  menu_misc = menu->addMenu("Misc");
  menu_misc_clear = menu_misc->addAction("Clear Console");
  menu_misc_options = menu_misc->addAction("Options ...");

  console = new QTextEdit;
  console->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  console->setReadOnly(true);
  console->setFont(QFont(Style::Monospace));
  console->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
  console->setMinimumWidth((92 + 4) * console->fontMetrics().width(' '));
  console->setMinimumHeight((25 + 1) * console->fontMetrics().height());
  layout->addWidget(console);

  controlLayout = new QVBoxLayout;
  controlLayout->setSpacing(0);
  layout->addLayout(controlLayout);

  commandLayout = new QHBoxLayout;
  controlLayout->addLayout(commandLayout);

  // TODO: icons/hotkeys instead of text
  runBreak = new QToolButton;
  runBreak->setText("Brk");
  commandLayout->addWidget(runBreak);
  commandLayout->addSpacing(Style::WidgetSpacing);

  stepInstruction = new QToolButton;
  stepInstruction->setText("Step");
  commandLayout->addWidget(stepInstruction);

  stepOver = new QToolButton;
  stepOver->setText("Over");
  commandLayout->addWidget(stepOver);

  stepOut = new QToolButton;
  stepOut->setText("Out");
  commandLayout->addWidget(stepOut);

  controlLayout->addSpacing(Style::WidgetSpacing);

  stepCPU = new QCheckBox("Step S-CPU");
  stepCPU->setChecked(true);
  controlLayout->addWidget(stepCPU);

  stepSMP = new QCheckBox("Step S-SMP");
  controlLayout->addWidget(stepSMP);

  stepSA1 = new QCheckBox("Step SA-1");
  controlLayout->addWidget(stepSA1);

  stepSFX = new QCheckBox("Step SuperFX");
  controlLayout->addWidget(stepSFX);
  
  controlLayout->addSpacing(Style::WidgetSpacing);

  traceCPU = new QCheckBox("Trace S-CPU opcodes");
  controlLayout->addWidget(traceCPU);

  traceSMP = new QCheckBox("Trace S-SMP opcodes");
  controlLayout->addWidget(traceSMP);
  
  traceSA1 = new QCheckBox("Trace SA-1 opcodes");
  controlLayout->addWidget(traceSA1);
  
  traceSFX = new QCheckBox("Trace SuperFX opcodes");
  controlLayout->addWidget(traceSFX);

  traceMask = new QCheckBox("Enable trace mask");
  controlLayout->addWidget(traceMask);

  spacer = new QWidget;
  spacer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
  controlLayout->addWidget(spacer);

  tracer = new Tracer;
  disassembler = new Disassembler;
  breakpointEditor = new BreakpointEditor;
  memoryEditor = new MemoryEditor;
  propertiesViewer = new PropertiesViewer;
  vramViewer = new VramViewer;
  oamViewer = new OamViewer;
  cgramViewer = new CgramViewer;
  debuggerOptions = new DebuggerOptions;

  connect(menu_tools_disassembler, SIGNAL(triggered()), disassembler, SLOT(show()));
  connect(menu_tools_breakpoint, SIGNAL(triggered()), breakpointEditor, SLOT(show()));
  connect(menu_tools_memory, SIGNAL(triggered()), memoryEditor, SLOT(show()));
  connect(menu_tools_propertiesViewer, SIGNAL(triggered()), propertiesViewer, SLOT(show()));

  connect(menu_ppu_vramViewer, SIGNAL(triggered()), vramViewer, SLOT(show()));
  connect(menu_ppu_oamViewer, SIGNAL(triggered()), oamViewer, SLOT(show()));
  connect(menu_ppu_cgramViewer, SIGNAL(triggered()), cgramViewer, SLOT(show()));

  connect(menu_misc_clear, SIGNAL(triggered()), this, SLOT(clear()));
  connect(menu_misc_options, SIGNAL(triggered()), debuggerOptions, SLOT(show()));

  connect(runBreak, SIGNAL(released()), this, SLOT(toggleRunStatus()));
  
  connect(stepInstruction, SIGNAL(released()), this, SLOT(stepAction()));
  connect(stepOver, SIGNAL(released()), this, SLOT(stepOverAction()));
  connect(stepOut, SIGNAL(released()), this, SLOT(stepOutAction()));
  
  connect(stepCPU, SIGNAL(released()), this, SLOT(synchronize()));
  connect(stepSMP, SIGNAL(released()), this, SLOT(synchronize()));
  connect(stepSA1, SIGNAL(released()), this, SLOT(synchronize()));
  connect(stepSFX, SIGNAL(released()), this, SLOT(synchronize()));
  connect(traceCPU, SIGNAL(stateChanged(int)), tracer, SLOT(setCpuTraceState(int)));
  connect(traceSMP, SIGNAL(stateChanged(int)), tracer, SLOT(setSmpTraceState(int)));
  connect(traceSA1, SIGNAL(stateChanged(int)), tracer, SLOT(setSa1TraceState(int)));
  connect(traceSFX, SIGNAL(stateChanged(int)), tracer, SLOT(setSfxTraceState(int)));
  connect(traceMask, SIGNAL(stateChanged(int)), tracer, SLOT(setTraceMaskState(int)));

  frameCounter = 0;
  synchronize();
  resize(855, 425);
}
예제 #12
0
LoaderWindow::LoaderWindow() {
  setObjectName("loader-window");
  setMinimumWidth(520);
  setGeometryString(&config().geometry.loaderWindow);
  application.windowList.append(this);

  layout = new QVBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  layout->setAlignment(Qt::AlignTop);
  setLayout(layout);

  grid = new QGridLayout;
  layout->addLayout(grid);

  baseLabel = new QLabel("Base cartridge:");
  grid->addWidget(baseLabel, 0, 0);

  baseFile = new QLineEdit;
  baseFile->setReadOnly(true);
  grid->addWidget(baseFile, 0, 1);

  baseBrowse = new QPushButton("Browse ...");
  grid->addWidget(baseBrowse, 0, 2);

  baseClear = new QPushButton("Clear");
  grid->addWidget(baseClear, 0, 3);

  slot1Label = new QLabel("Slot A cartridge:");
  grid->addWidget(slot1Label, 1, 0);

  slot1File = new QLineEdit;
  slot1File->setReadOnly(true);
  grid->addWidget(slot1File, 1, 1);

  slot1Browse = new QPushButton("Browse ...");
  grid->addWidget(slot1Browse, 1, 2);

  slot1Clear = new QPushButton("Clear");
  grid->addWidget(slot1Clear, 1, 3);

  slot2Label = new QLabel("Slot B cartridge:");
  grid->addWidget(slot2Label, 2, 0);

  slot2File = new QLineEdit;
  slot2File->setReadOnly(true);
  grid->addWidget(slot2File, 2, 1);

  slot2Browse = new QPushButton("Browse ...");
  grid->addWidget(slot2Browse, 2, 2);

  slot2Clear = new QPushButton("Clear");
  grid->addWidget(slot2Clear, 2, 3);

  load = new QPushButton("Load");
  grid->addWidget(load, 3, 2);

  cancel = new QPushButton("Cancel");
  grid->addWidget(cancel, 3, 3);

  connect(baseBrowse, SIGNAL(released()), this, SLOT(selectBaseCartridge()));
  connect(baseClear, SIGNAL(released()), this, SLOT(clearBaseCartridge()));
  connect(slot1Browse, SIGNAL(released()), this, SLOT(selectSlot1Cartridge()));
  connect(slot1Clear, SIGNAL(released()), this, SLOT(clearSlot1Cartridge()));
  connect(slot2Browse, SIGNAL(released()), this, SLOT(selectSlot2Cartridge()));
  connect(slot2Clear, SIGNAL(released()), this, SLOT(clearSlot2Cartridge()));
  connect(load, SIGNAL(released()), this, SLOT(onLoad()));
  connect(cancel, SIGNAL(released()), this, SLOT(close()));
}
예제 #13
0
MemoryEditor::MemoryEditor() {
  setObjectName("memory-editor");
  setWindowTitle("Memory Editor");
  setGeometryString(&config().geometry.memoryEditor);
  application.windowList.append(this);

  layout = new QGridLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  editor = new QHexEdit;
  editor->reader = { &MemoryEditor::reader, this };
  editor->writer = { &MemoryEditor::writer, this };
  editor->usage  = { &MemoryEditor::usage, this };
  memorySource = SNES::Debugger::MemorySource::CPUBus;
  layout->addWidget(editor, 0, 0);

  controlLayout = new QVBoxLayout;
  controlLayout->setSpacing(0);
  layout->addLayout(controlLayout, 0, 1);
  layout->setColumnStretch(0, 1);

  source = new QComboBox;
  source->addItem("S-CPU bus");
  source->addItem("S-APU bus");
  source->addItem("S-PPU VRAM");
  source->addItem("S-PPU OAM");
  source->addItem("S-PPU CGRAM");
  source->addItem("Cartridge ROM");
  source->addItem("Cartridge RAM");
  source->addItem("SA-1 bus");
  source->addItem("GSU bus");
  controlLayout->addWidget(source);
  controlLayout->addSpacing(2);

  addr = new QLineEdit;
  controlLayout->addWidget(addr);

  autoUpdateBox = new QCheckBox("Auto update");
  controlLayout->addWidget(autoUpdateBox);

  refreshButton = new QPushButton("Refresh");
  controlLayout->addWidget(refreshButton);

  toolLayout = new QHBoxLayout;
  controlLayout->addLayout(toolLayout);
  #define tool(widget, icon, text, slot, accel) \
    widget = new QToolButton; \
    toolLayout->addWidget(widget); \
    widget->setAutoRaise(true); \
    widget->setDefaultAction(new QAction(this)); \
    widget->defaultAction()->setIcon(QIcon(":16x16/mem-" icon ".png")); \
    widget->defaultAction()->setToolTip(text); \
    widget->defaultAction()->setShortcut(accel); \
    connect(widget->defaultAction(), SIGNAL(triggered()), this, SLOT(slot()))
  tool(prevCodeButton, "prev-code",    "Previous Code",    prevCode, 0);
  tool(nextCodeButton, "next-code",    "Next Code",        nextCode, 0);
  tool(prevDataButton, "prev-data",    "Previous Data",    prevData, 0);
  tool(nextDataButton, "next-data",    "Next Data",        nextData, 0);
  tool(prevUnkButton,  "prev-unknown", "Previous Unknown", prevUnknown, 0);
  tool(nextUnkButton,  "next-unknown", "Next Unknown",     nextUnknown, 0);
  toolLayout->addStretch();

  toolLayout = new QHBoxLayout;
  controlLayout->addLayout(toolLayout);
  tool(findButton,     "find",         "Find in Memory (Ctrl+F)",  search, Qt::Key_F | Qt::CTRL);
  // TODO: other icons for these maybe
  tool(findPrevButton, "prev-unknown", "Find again up (Shift+F3)", searchPrev, Qt::Key_F3 | Qt::SHIFT);
  tool(findNextButton, "next-unknown", "Find again down (F3)",     searchNext, Qt::Key_F3);
  toolLayout->addStretch();
  #undef tool

  spacer = new QWidget;
  spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
  controlLayout->addWidget(spacer);

  exportButton = new QPushButton("Export");
  controlLayout->addWidget(exportButton);

  importButton = new QPushButton("Import");
  controlLayout->addWidget(importButton);

  statusBar = new QLabel;
  layout->addWidget(statusBar, 1, 0, 1, 2);

  connect(editor, SIGNAL(currentAddressChanged(qint64)), this, SLOT(showAddress(qint64)));
  connect(source, SIGNAL(currentIndexChanged(int)), this, SLOT(sourceChanged(int)));
  connect(addr, SIGNAL(textEdited(const QString&)), this, SLOT(updateOffset()));
  connect(addr, SIGNAL(returnPressed()), this, SLOT(updateOffset()));
  connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
  connect(exportButton, SIGNAL(released()), this, SLOT(exportMemory()));
  connect(importButton, SIGNAL(released()), this, SLOT(importMemory()));

  sourceChanged(0);
}
예제 #14
0
TilemapViewer::TilemapViewer() {
    setObjectName("tilemap-viewer");
    setWindowTitle("Tilemap Viewer");
    setGeometryString(&config().geometry.tilemapViewer);
    application.windowList.append(this);

    inUpdateFormCall = false;

    layout = new QHBoxLayout;
    layout->setSizeConstraint(QLayout::SetMinimumSize);
    layout->setAlignment(Qt::AlignLeft);
    layout->setMargin(Style::WindowMargin);
    layout->setSpacing(Style::WidgetSpacing);
    setLayout(layout);

    sidebarLayout = new QFormLayout;
    sidebarLayout->setSizeConstraint(QLayout::SetMinimumSize);
    sidebarLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    sidebarLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
    sidebarLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    sidebarLayout->setLabelAlignment(Qt::AlignLeft);
    layout->addLayout(sidebarLayout);


    zoomCombo = new QComboBox;
    zoomCombo->addItem("1x", QVariant(1));
    zoomCombo->addItem("2x", QVariant(2));
    zoomCombo->addItem("3x", QVariant(3));
    zoomCombo->addItem("4x", QVariant(4));
    zoomCombo->addItem("5x", QVariant(5));
    zoomCombo->addItem("6x", QVariant(6));
    zoomCombo->addItem("7x", QVariant(7));
    zoomCombo->addItem("8x", QVariant(8));
    zoomCombo->addItem("9x", QVariant(9));

    autoUpdateBox = new QCheckBox("Auto update");
    sidebarLayout->addRow(zoomCombo, autoUpdateBox);

    refreshButton = new QPushButton("Refresh");
    sidebarLayout->addRow(refreshButton);

    sidebarLayout->addRow(new QWidget);


    customScreenMode = new QCheckBox("Custom Screen Mode");
    sidebarLayout->addRow(customScreenMode);

    screenMode = new QSpinBox;
    screenMode->setMinimum(0);
    screenMode->setMaximum(7);
    sidebarLayout->addRow("Mode:", screenMode);

    bgLayout = new QHBoxLayout;
    bgLayout->setSizeConstraint(QLayout::SetMinimumSize);
    for(unsigned i = 0; i < 4; i++) {
        bgButtons[i] = new QToolButton;
        bgButtons[i]->setText(QString::number(i + 1));
        bgButtons[i]->setCheckable(true);
        bgButtons[i]->setAutoExclusive(true);
        bgLayout->addWidget(bgButtons[i]);
    }
    sidebarLayout->addRow("BG:", bgLayout);

    sidebarLayout->addRow(new QWidget);


    customTilemap = new QCheckBox("Override Tilemap");
    sidebarLayout->addRow(customTilemap);

    bitDepth = new QComboBox;
    bitDepth->addItem("2bpp", QVariant(TilemapRenderer::BPP2));
    bitDepth->addItem("4bpp", QVariant(TilemapRenderer::BPP4));
    bitDepth->addItem("8bpp", QVariant(TilemapRenderer::BPP8));
    bitDepth->addItem("Mode 7", QVariant(TilemapRenderer::MODE7));
    sidebarLayout->addRow("Bit Depth:", bitDepth);

    screenSize = new QComboBox;
    screenSize->addItem("32x32", QVariant(0));
    screenSize->addItem("64x32", QVariant(1));
    screenSize->addItem("32x64", QVariant(2));
    screenSize->addItem("64x64", QVariant(3));
    sidebarLayout->addRow("Map Size:", screenSize);

    screenAddr = new QLineEdit;
    sidebarLayout->addRow("Map Addr:", screenAddr);

    tileSize = new QComboBox;
    tileSize->addItem("8x8", QVariant(false));
    tileSize->addItem("16x16", QVariant(true));
    sidebarLayout->addRow("Tile Size:", tileSize);

    tileAddr = new QLineEdit;
    sidebarLayout->addRow("Tile Addr:", tileAddr);

    setCustomScreenMode(false);
    setCustomTilemap(false);

    scene = new QGraphicsScene;

    scenePixmap = new QGraphicsPixmapItem();
    scenePixmap->setTransformationMode(Qt::FastTransformation);
    scene->addItem(scenePixmap);

    view = new QGraphicsView(scene);
    view->setMinimumSize(256, 256);
    layout->addWidget(view, 10);


    onFormChanged();


    connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
    connect(zoomCombo,     SIGNAL(currentIndexChanged(int)), this, SLOT(onZoomChanged(int)));

    connect(customScreenMode, SIGNAL(clicked(bool)), this, SLOT(setCustomScreenMode(bool)));
    connect(customTilemap,    SIGNAL(clicked(bool)), this, SLOT(setCustomTilemap(bool)));

    for(int i = 0; i < 4; i++) {
        connect(bgButtons[i],SIGNAL(clicked(bool)),               this, SLOT(onFormChanged()));
    }
    connect(screenMode,    SIGNAL(valueChanged(int)),           this, SLOT(onFormChanged()));
    connect(bitDepth,      SIGNAL(currentIndexChanged(int)),    this, SLOT(onFormChanged()));
    connect(screenSize,    SIGNAL(currentIndexChanged(int)),    this, SLOT(onFormChanged()));
    connect(tileSize,      SIGNAL(currentIndexChanged(int)),    this, SLOT(onFormChanged()));
    connect(tileAddr,      SIGNAL(textChanged(const QString&)), this, SLOT(onFormChanged()));
    connect(screenAddr,    SIGNAL(textChanged(const QString&)), this, SLOT(onFormChanged()));
}
예제 #15
0
MainWindow::MainWindow() {
  setObjectName("main-window");
  setWindowTitle(string() << SNES::Info::Name << " v" << SNES::Info::Version);
  setCloseOnEscape(false);
  setGeometryString(&config().geometry.mainWindow);
  application.windowList.append(this);

  //menu bar
  #if defined(PLATFORM_OSX)
  menuBar = new QMenuBar(0);
  #else
  menuBar = new QMenuBar;
  #endif

  system = menuBar->addMenu("&System");

  system_load = system->addAction("Load &Cartridge ...");

  system_loadSpecial = system->addMenu("Load &Special");

  system_loadSpecial_bsx = system_loadSpecial->addAction("Load &BS-X Cartridge ...");
  
  system_loadSpecial_bsxSlotted = system_loadSpecial->addAction("Load BS-X &Slotted Cartridge ...");

  system_loadSpecial_sufamiTurbo = system_loadSpecial->addAction("Load Sufami &Turbo Cartridge ...");

  system_loadSpecial_superGameBoy = system_loadSpecial->addAction("Load Super &Game Boy Cartridge ...");

  system_saveMemoryPack = system->addAction("Save Memory Pack ...");
  system_saveMemoryPack->setVisible(false);

  system_reload = system->addAction("Re&load");

  system->addSeparator();

  system->addAction(system_power = new CheckAction("&Power", 0));

  system_reset = system->addAction("&Reset");

  system->addSeparator();

  system_port1 = system->addMenu("Controller Port &1");
  system_port1->addAction(system_port1_none = new RadioAction("&None", 0));
  system_port1->addAction(system_port1_gamepad = new RadioAction("&Gamepad", 0));
  system_port1->addAction(system_port1_asciipad = new RadioAction("&asciiPad", 0));
  system_port1->addAction(system_port1_multitap = new RadioAction("&Multitap", 0));
  system_port1->addAction(system_port1_mouse = new RadioAction("&Mouse", 0));
  system_port1->addAction(system_port1_nttdatakeypad = new RadioAction("NTT Data &Keypad", 0));

  system_port2 = system->addMenu("Controller Port &2");
  system_port2->addAction(system_port2_none = new RadioAction("&None", 0));
  system_port2->addAction(system_port2_gamepad = new RadioAction("&Gamepad", 0));
  system_port2->addAction(system_port2_asciipad = new RadioAction("&asciiPad", 0));
  system_port2->addAction(system_port2_multitap = new RadioAction("&Multitap", 0));
  system_port2->addAction(system_port2_mouse = new RadioAction("&Mouse", 0));
  system_port2->addAction(system_port2_superscope = new RadioAction("&Super Scope", 0));
  system_port2->addAction(system_port2_justifier = new RadioAction("&Justifier", 0));
  system_port2->addAction(system_port2_justifiers = new RadioAction("Two &Justifiers", 0));

  #if !defined(PLATFORM_OSX)
  system->addSeparator();
  #endif

  system_exit = system->addAction("E&xit");
  system_exit->setMenuRole(QAction::QuitRole);

  settings = menuBar->addMenu("S&ettings");

  settings_videoMode = settings->addMenu("Video &Mode");

  settings_videoMode->addAction(settings_videoMode_1x = new RadioAction("Scale &1x", 0));

  settings_videoMode->addAction(settings_videoMode_2x = new RadioAction("Scale &2x", 0));

  settings_videoMode->addAction(settings_videoMode_3x = new RadioAction("Scale &3x", 0));

  settings_videoMode->addAction(settings_videoMode_4x = new RadioAction("Scale &4x", 0));

  settings_videoMode->addAction(settings_videoMode_5x = new RadioAction("Scale &5x", 0));

  settings_videoMode->addAction(settings_videoMode_max_normal = new RadioAction("Scale Max - &Normal", 0));

  settings_videoMode->addAction(settings_videoMode_max_wide = new RadioAction("Scale Max - &Wide", 0));

  settings_videoMode->addAction(settings_videoMode_max_wideZoom = new RadioAction("Scale Max - Wide &Zoom", 0));

  settings_videoMode->addSeparator();

  settings_videoMode->addAction(settings_videoMode_correctAspectRatio = new CheckAction("Correct &Aspect Ratio", 0));

  settings_videoMode->addSeparator();

  settings_videoMode->addAction(settings_videoMode_ntsc = new RadioAction("&NTSC", 0));
  settings_videoMode->addAction(settings_videoMode_pal = new RadioAction("&PAL", 0));

  if(filter.opened()) {
    settings_videoFilter = settings->addMenu("Video &Filter");

    settings_videoFilter_configure = settings_videoFilter->addAction("&Configure Active Filter ...");
    settings_videoFilter->addSeparator();

    settings_videoFilter->addAction(settings_videoFilter_none = new RadioAction("&None", 0));
    settings_videoFilter_list.append(settings_videoFilter_none);

    lstring filterlist;
    filterlist.split(";", filter.dl_supported());
    for(unsigned i = 0; i < filterlist.size(); i++) {
      RadioAction *action = new RadioAction(filterlist[i], 0);
      settings_videoFilter->addAction(action);
      settings_videoFilter_list.append(action);
    }
  }

  settings->addAction(settings_smoothVideo = new CheckAction("&Smooth Video Output", 0));

  settings->addSeparator();

  settings->addAction(settings_muteAudio = new CheckAction("&Mute Audio Output", 0));

  settings->addSeparator();

  settings_emulationSpeed = settings->addMenu("Emulation &Speed");

  settings_emulationSpeed->addAction(settings_emulationSpeed_slowest = new RadioAction("Slowest", 0));

  settings_emulationSpeed->addAction(settings_emulationSpeed_slow = new RadioAction("Slow", 0));

  settings_emulationSpeed->addAction(settings_emulationSpeed_normal = new RadioAction("Normal", 0));

  settings_emulationSpeed->addAction(settings_emulationSpeed_fast = new RadioAction("Fast", 0));

  settings_emulationSpeed->addAction(settings_emulationSpeed_fastest = new RadioAction("Fastest", 0));

  settings_emulationSpeed->addSeparator();

  settings_emulationSpeed->addAction(settings_emulationSpeed_syncVideo = new CheckAction("Sync &Video", 0));

  settings_emulationSpeed->addAction(settings_emulationSpeed_syncAudio = new CheckAction("Sync &Audio", 0));

  settings_configuration = settings->addAction("&Configuration ...");
  settings_configuration->setMenuRole(QAction::PreferencesRole);

  tools = menuBar->addMenu("&Tools");

  tools_movies = tools->addMenu("&Movies");

  tools_movies_play = tools_movies->addAction("Play Movie ...");

  tools_movies_stop = tools_movies->addAction("Stop");

  tools_movies_recordFromPowerOn = tools_movies->addAction("Record Movie (and restart system)");

  tools_movies_recordFromHere = tools_movies->addAction("Record Movie (starting from here)");

  tools_captureScreenshot = tools->addAction("&Capture Screenshot");
  
  tools_captureSPC = tools->addAction("Capture &SPC Dump");

  tools->addSeparator();

  tools_loadState = tools->addMenu("&Load Quick State");
  for(unsigned i = 0; i < 10; i++) {
    QAction *loadAction = new QAction(string("Slot ", i + 1), 0);
    loadAction->setData(i);
    connect(loadAction, SIGNAL(triggered()), this, SLOT(loadState()));
    tools_loadState->addAction(loadAction);
  }

  tools_saveState = tools->addMenu("&Save Quick State");
  for(unsigned i = 0; i < 10; i++) {
    QAction *saveAction = new QAction(string("Slot ", i + 1), 0);
    saveAction->setData(i);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveState()));
    tools_saveState->addAction(saveAction);
  }

  tools->addSeparator();

  tools_cheatEditor = tools->addAction("Cheat &Editor ...");

  tools_cheatFinder = tools->addAction("Cheat &Finder ...");

  tools_stateManager = tools->addAction("&State Manager ...");

  tools_effectToggle = tools->addAction("Effect &Toggle ...");
  if(!SNES::PPU::SupportsLayerEnable && !SNES::DSP::SupportsChannelEnable)
    tools_effectToggle->setVisible(false);
  
  tools_manifestViewer = tools->addAction("&Manifest Viewer ...");
  
  tools_soundViewer = tools->addAction("Sound &Viewer ...");

  tools_debugger = tools->addAction("&Debugger ...");
  #if !defined(DEBUGGER)
  tools_debugger->setVisible(false);
  #endif

  help = menuBar->addMenu("&Help");

  help_documentation = help->addAction("&Documentation ...");

  help_license = help->addAction("&License ...");

  #if !defined(PLATFORM_OSX)
  help->addSeparator();
  #endif

  help_about = help->addAction("&About ...");
  help_about->setMenuRole(QAction::AboutRole);

  //canvas
  canvasContainer = new CanvasObject;
  canvasContainer->setAcceptDrops(true); {
    canvasContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    canvasContainer->setObjectName("backdrop");

    canvasLayout = new QVBoxLayout; {
      canvasLayout->setMargin(0);
      canvasLayout->setAlignment(Qt::AlignCenter);

      canvas = new CanvasWidget;
      canvas->setAcceptDrops(true);
      canvas->setFocusPolicy(Qt::StrongFocus);
      canvas->setAttribute(Qt::WA_PaintOnScreen, true);  //disable Qt painting on focus / resize
      canvas->setAttribute(Qt::WA_NoSystemBackground, true);
    }
    canvasLayout->addWidget(canvas);
  }
  canvasContainer->setLayout(canvasLayout);

  //status bar
  statusBar = new QStatusBar;
  statusBar->setSizeGripEnabled(false);
  statusBar->showMessage("");
  systemState = new QLabel;
  statusBar->addPermanentWidget(systemState);

  //layout
  layout = new QVBoxLayout;
  layout->setMargin(0);
  layout->setSpacing(0);
  #if !defined(PLATFORM_OSX)
  layout->addWidget(menuBar);
  #endif
  layout->addWidget(canvasContainer);
  layout->addWidget(statusBar);
  setLayout(layout);

  //cursor hide timer
  cursorTimer = new QTimer(this);
  cursorTimer->setSingleShot(true);
  cursorTimer->setInterval(5*1000);

  //slots
  connect(system_load, SIGNAL(triggered()), this, SLOT(loadCartridge()));
  connect(system_reload, SIGNAL(triggered()), this, SLOT(reloadCartridge()));
  connect(system_loadSpecial_bsxSlotted, SIGNAL(triggered()), this, SLOT(loadBsxSlottedCartridge()));
  connect(system_loadSpecial_bsx, SIGNAL(triggered()), this, SLOT(loadBsxCartridge()));
  connect(system_loadSpecial_sufamiTurbo, SIGNAL(triggered()), this, SLOT(loadSufamiTurboCartridge()));
  connect(system_loadSpecial_superGameBoy, SIGNAL(triggered()), this, SLOT(loadSuperGameBoyCartridge()));
  connect(system_saveMemoryPack, SIGNAL(triggered()), this, SLOT(saveMemoryPack()));
  connect(system_power, SIGNAL(triggered()), this, SLOT(power()));
  connect(system_reset, SIGNAL(triggered()), this, SLOT(reset()));
  connect(system_port1_none, SIGNAL(triggered()), this, SLOT(setPort1None()));
  connect(system_port1_gamepad, SIGNAL(triggered()), this, SLOT(setPort1Gamepad()));
  connect(system_port1_asciipad, SIGNAL(triggered()), this, SLOT(setPort1Asciipad()));
  connect(system_port1_multitap, SIGNAL(triggered()), this, SLOT(setPort1Multitap()));
  connect(system_port1_mouse, SIGNAL(triggered()), this, SLOT(setPort1Mouse()));
  connect(system_port1_nttdatakeypad, SIGNAL(triggered()), this, SLOT(setPort1NTTDataKeypad()));
  connect(system_port2_none, SIGNAL(triggered()), this, SLOT(setPort2None()));
  connect(system_port2_gamepad, SIGNAL(triggered()), this, SLOT(setPort2Gamepad()));
  connect(system_port2_asciipad, SIGNAL(triggered()), this, SLOT(setPort2Asciipad()));
  connect(system_port2_multitap, SIGNAL(triggered()), this, SLOT(setPort2Multitap()));
  connect(system_port2_mouse, SIGNAL(triggered()), this, SLOT(setPort2Mouse()));
  connect(system_port2_superscope, SIGNAL(triggered()), this, SLOT(setPort2SuperScope()));
  connect(system_port2_justifier, SIGNAL(triggered()), this, SLOT(setPort2Justifier()));
  connect(system_port2_justifiers, SIGNAL(triggered()), this, SLOT(setPort2Justifiers()));
  connect(system_exit, SIGNAL(triggered()), this, SLOT(quit()));
  connect(settings_videoMode_1x, SIGNAL(triggered()), this, SLOT(setVideoMode1x()));
  connect(settings_videoMode_2x, SIGNAL(triggered()), this, SLOT(setVideoMode2x()));
  connect(settings_videoMode_3x, SIGNAL(triggered()), this, SLOT(setVideoMode3x()));
  connect(settings_videoMode_4x, SIGNAL(triggered()), this, SLOT(setVideoMode4x()));
  connect(settings_videoMode_5x, SIGNAL(triggered()), this, SLOT(setVideoMode5x()));
  connect(settings_videoMode_max_normal, SIGNAL(triggered()), this, SLOT(setVideoModeMaxNormal()));
  connect(settings_videoMode_max_wide, SIGNAL(triggered()), this, SLOT(setVideoModeMaxWide()));
  connect(settings_videoMode_max_wideZoom, SIGNAL(triggered()), this, SLOT(setVideoModeMaxWideZoom()));
  connect(settings_videoMode_correctAspectRatio, SIGNAL(triggered()), this, SLOT(toggleAspectCorrection()));
  connect(settings_videoMode_ntsc, SIGNAL(triggered()), this, SLOT(setVideoNtsc()));
  connect(settings_videoMode_pal, SIGNAL(triggered()), this, SLOT(setVideoPal()));
  if(filter.opened()) {
    connect(settings_videoFilter_configure, SIGNAL(triggered()), this, SLOT(configureFilter()));
    for(unsigned i = 0; i < settings_videoFilter_list.size(); i++) {
      connect(settings_videoFilter_list[i], SIGNAL(triggered()), this, SLOT(setFilter()));
    }
  }
  connect(settings_smoothVideo, SIGNAL(triggered()), this, SLOT(toggleSmoothVideo()));
  connect(settings_muteAudio, SIGNAL(triggered()), this, SLOT(muteAudio()));
  connect(settings_emulationSpeed_slowest, SIGNAL(triggered()), this, SLOT(setSpeedSlowest()));
  connect(settings_emulationSpeed_slow, SIGNAL(triggered()), this, SLOT(setSpeedSlow()));
  connect(settings_emulationSpeed_normal, SIGNAL(triggered()), this, SLOT(setSpeedNormal()));
  connect(settings_emulationSpeed_fast, SIGNAL(triggered()), this, SLOT(setSpeedFast()));
  connect(settings_emulationSpeed_fastest, SIGNAL(triggered()), this, SLOT(setSpeedFastest()));
  connect(settings_emulationSpeed_syncVideo, SIGNAL(triggered()), this, SLOT(syncVideo()));
  connect(settings_emulationSpeed_syncAudio, SIGNAL(triggered()), this, SLOT(syncAudio()));
  connect(settings_configuration, SIGNAL(triggered()), this, SLOT(showConfigWindow()));
  connect(tools_movies_play, SIGNAL(triggered()), this, SLOT(playMovie()));
  connect(tools_movies_stop, SIGNAL(triggered()), this, SLOT(stopMovie()));
  connect(tools_movies_recordFromPowerOn, SIGNAL(triggered()), this, SLOT(recordMovieFromPowerOn()));
  connect(tools_movies_recordFromHere, SIGNAL(triggered()), this, SLOT(recordMovieFromHere()));
  connect(tools_captureScreenshot, SIGNAL(triggered()), this, SLOT(saveScreenshot()));
  connect(tools_captureSPC, SIGNAL(triggered()), this, SLOT(saveSPC()));
  connect(tools_cheatEditor, SIGNAL(triggered()), this, SLOT(showCheatEditor()));
  connect(tools_cheatFinder, SIGNAL(triggered()), this, SLOT(showCheatFinder()));
  connect(tools_stateManager, SIGNAL(triggered()), this, SLOT(showStateManager()));
  connect(tools_effectToggle, SIGNAL(triggered()), this, SLOT(showEffectToggle()));
  connect(tools_manifestViewer, SIGNAL(triggered()), this, SLOT(showManifestViewer()));
  connect(tools_soundViewer, SIGNAL(triggered()), this, SLOT(showSoundViewer()));
  connect(tools_debugger, SIGNAL(triggered()), this, SLOT(showDebugger()));
  connect(help_documentation, SIGNAL(triggered()), this, SLOT(showDocumentation()));
  connect(help_license, SIGNAL(triggered()), this, SLOT(showLicense()));
  connect(help_about, SIGNAL(triggered()), this, SLOT(showAbout()));

  syncUi();
}
예제 #16
0
OamViewer::OamViewer() {
  setObjectName("oam-viewer");
  setWindowTitle("Sprite Viewer");
  setGeometryString(&config().geometry.oamViewer);
  application.windowList.append(this);

  inRefreshCall = false;

  layout = new QHBoxLayout;
  layout->setAlignment(Qt::AlignLeft);
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  list = new QTreeWidget;
  list->setColumnCount(8);
  list->setHeaderLabels(QStringList() << "#" << "Size" << "X" << "Y" << "Char" << "Pri" << "Pal" << "Flags");
  list->setAllColumnsShowFocus(true);
  list->setAlternatingRowColors(true);
  list->setRootIsDecorated(false);
  list->setUniformRowHeights(true);
  list->setSortingEnabled(false);
  layout->addWidget(list);

  unsigned dw = list->fontMetrics().width('0');
  list->setColumnWidth(0, dw * 4);
  list->setColumnWidth(1, dw * 8);
  list->setColumnWidth(2, dw * 6);
  list->setColumnWidth(3, dw * 6);
  list->setColumnWidth(4, dw * 6);
  list->setColumnWidth(5, dw * 6);
  list->setColumnWidth(6, dw * 6);
  list->setColumnWidth(7, dw * 6);

  for(unsigned i = 0; i < 128; i++) {
    QTreeWidgetItem *item = new QTreeWidgetItem(list);
    item->setData(0, Qt::DisplayRole, i);
    item->setData(0, Qt::UserRole, QVariant(i));
    item->setTextAlignment(0, Qt::AlignRight);
    item->setTextAlignment(1, Qt::AlignHCenter);
    item->setTextAlignment(2, Qt::AlignRight);
    item->setTextAlignment(3, Qt::AlignRight);
    item->setTextAlignment(4, Qt::AlignRight);
    item->setTextAlignment(5, Qt::AlignRight);
    item->setTextAlignment(6, Qt::AlignRight);
    item->setTextAlignment(7, Qt::AlignLeft);
  }
  list->setCurrentItem(NULL);

  list->sortItems(0, Qt::AscendingOrder);
  list->setSortingEnabled(true);


  controlLayout = new QVBoxLayout;
  controlLayout->setAlignment(Qt::AlignTop);
  controlLayout->setSpacing(0);
  layout->addLayout(controlLayout);


  canvas = new OamCanvas;
  controlLayout->addWidget(canvas);

  autoUpdateBox = new QCheckBox("Auto update");
  controlLayout->addWidget(autoUpdateBox);

  refreshButton = new QPushButton("Refresh");
  controlLayout->addWidget(refreshButton);


  connect(refreshButton, SIGNAL(released()), this, SLOT(refresh()));
  connect(list, SIGNAL(itemSelectionChanged()), this, SLOT(onSelectedChanged()));
}