Beispiel #1
0
//! [4]
void MainWindow::createActions()
{
    assistantAct = new QAction(tr("Help Contents"), this);
    assistantAct->setShortcut(QKeySequence::HelpContents);
    connect(assistantAct, SIGNAL(triggered()), this, SLOT(showDocumentation()));
//! [4]

    openAct = new QAction(tr("&Open..."), this);
    openAct->setShortcut(QKeySequence::Open);
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    clearAct = new QAction(tr("&Clear"), this);
    clearAct->setShortcut(tr("Ctrl+C"));
    connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear()));

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction(tr("&About"), this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
//! [5]
}
Beispiel #2
0
void DocumentationWidget::nextDocumentation()
{
  if ((mDocumentationHistoryPos + 1) < mpDocumentationHistoryList->count()) {
    mDocumentationHistoryPos++;
    showDocumentation(mpDocumentationHistoryList->at(mDocumentationHistoryPos).mpLibraryTreeItem);
  }
}
Beispiel #3
0
void DocumentationWidget::previousDocumentation()
{
  if (mDocumentationHistoryPos > 0) {
    mDocumentationHistoryPos--;
    showDocumentation(mpDocumentationHistoryList->at(mDocumentationHistoryPos).mpLibraryTreeItem);
  }
}
Beispiel #4
0
int main(int argc, char** argv) {
  if (argc != 3) {
    showDocumentation();
    return -1;
  }
  
  const char *command = NULL;
  for (int i = 0; i < sizeof(kMap) / sizeof(CommandMap); ++i) {
    if (strcasecmp(argv[1], kMap[i].command) == 0) {
      command = kMap[i].axcommand;
      break;
    }
  }  
  if (!command) {
    showDocumentation();
    return -1;
  }
  
  int file = open(argv[2], O_WRONLY);
  if (file == -1) {
    showDocumentation();
    fprintf(stderr, "Unable to open file %s (%d)\n", argv[2], errno);
    return errno;
  }
  ssize_t size = write(file, command, strlen(command));
  if (size == -1) {
    showDocumentation();
    fprintf(stderr, "Unable to perform %s (%d)\n", command, errno);
    close(file);
    return errno;
  }
  
  return close(file);
    
    
}
Beispiel #5
0
void MainWindow::createActions()
{

	connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(m_ui->actionDocumentation, SIGNAL(triggered()), this, SLOT(showDocumentation()));
	connect(m_ui->actionExport, SIGNAL(triggered()), this, SLOT(exportToKME()));
	connect(m_ui->actionGraph, SIGNAL(triggered()), this, SLOT(viewGraph()));
	connect(m_ui->actionJoints, SIGNAL(triggered()), this, SLOT(viewJoints()));
	connect(m_ui->actionNao_Academics, SIGNAL(triggered()), this, SLOT(setNaoAcademics()));
	connect(m_ui->actionNao_RC_Edition, SIGNAL(triggered()), this, SLOT(setNaoRC()));
	connect(m_ui->actionNew, SIGNAL(triggered()), this, SLOT(newFile()));
	connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(openFile()));
	connect(m_ui->actionOpen_Robot, SIGNAL(triggered()), this, SLOT(loadNewRobot()));
	connect(m_ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));

	connect(dlg, SIGNAL(slidersClosed(bool)),m_ui->actionJoints, SLOT(setChecked(bool)));
	connect(m_ui->poseEditor, SIGNAL(cellChanged(int, int)), this, SLOT(somethingChanged()));

	//Pose Editor
	connect(m_ui->moveUpPoseButton, SIGNAL(clicked()), this, SLOT(moveUpAction()));
	connect(m_ui->moveDownPoseButton, SIGNAL(clicked()), this, SLOT(moveDownAction()));
	connect(m_ui->swapPoseButton, SIGNAL(clicked()), this, SLOT(swapAction()));
	connect(m_ui->removePoseButton, SIGNAL(clicked()), this, SLOT(removeAction()));
	connect(m_ui->storePoseButton, SIGNAL(clicked()), this, SLOT(storePoseAction()));
	connect(m_ui->insertPoseButton, SIGNAL(clicked()), this, SLOT(insertPoseAction()));

	//Play Motion
	connect(m_ui->gotoPoseButton, SIGNAL(clicked()), this, SLOT(gotoPoseAction()));
	connect(m_ui->stepPoseButton, SIGNAL(clicked()), this, SLOT(stepPoseAction()));
	connect(m_ui->playMotionButton, SIGNAL(clicked()), this, SLOT(playMotionAction()));
	connect(m_ui->stiffOn, SIGNAL(clicked()), this, SLOT(stiffOnAction()));
	connect(m_ui->stiffOff, SIGNAL(clicked()), this, SLOT(stiffOffAction()));

	//Networking
	connect(m_ui->connectButton, SIGNAL(clicked()), this, SLOT(connectAction()));

	//Sliders
	connect(dlg->jointsUI, SIGNAL(poseChanged()), this, SLOT(sendPose()));

}
Beispiel #6
0
void MainWindow::createActions()
{
	// Open
	m_newAction = StandardAction::openNew(this, SLOT(newFile()), this);
	m_openAction = StandardAction::open(this, SLOT(open()), this);
	m_openRecentAction = StandardAction::openRecent(this, SLOT(loadUrl(Url)), this);
	m_saveAction = StandardAction::save(this, SLOT(save()), this);
	m_saveAsAction = StandardAction::saveAs(this, SLOT(saveAs()), this);
	m_reloadAction = new Action(Icon(QLatin1String("view-refresh")), tr("Reloa&d"), this, QLatin1String("file_reload"));
	m_reloadAction->setShortcut(QKeySequence::Refresh);
	m_reloadAction->setStatusTip(tr("Reload the current document"));
	m_reloadAction->setWhatsThis(tr("<p>Reload the current document from disk.</p>"));
	connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
	m_closeAction = StandardAction::close(this, SLOT(closeFile()), this);
	m_exitAction = StandardAction::quit(this, SLOT(close()), this);

	m_newAction->setStatusTip(tr("Create a new document"));
	m_openAction->setStatusTip(tr("Open an existing file"));
	m_openRecentAction->setStatusTip(tr("Open a recently opened file"));
	m_saveAction->setStatusTip(tr("Save the current document to disk"));
	m_saveAsAction->setStatusTip(tr("Save the document under a new name"));
	m_closeAction->setStatusTip(tr("Close the current document"));
	m_exitAction->setStatusTip(tr("Exit the application"));

	m_newAction->setWhatsThis(tr("<p>Create a new document.</p>"));
	m_openAction->setWhatsThis(tr("<p>Open an existing file.</p>"));
	m_openRecentAction->setWhatsThis(tr("<p>Open a recently opened file.</p>"));
	m_saveAction->setWhatsThis(tr("<p>Save the current document to disk.</p>"));
	m_saveAsAction->setWhatsThis(tr("<p>Save the document under a new name.</p>"));
	m_closeAction->setWhatsThis(tr("<p>Close the current document.</p>"));
	m_exitAction->setWhatsThis(tr("<p>Exit the application.</p>"));

	// View
	m_buildAction = new Action(Icon(QLatin1String("run-build")), tr("&Build"), this, QLatin1String("build"));
	m_buildAction->setShortcut(tr("Ctrl+B", "View|Build"));
	m_buildAction->setStatusTip(tr("Build preview"));
	m_buildAction->setWhatsThis(tr("<p>Generate preview by building the current TikZ code in the editor.</p>"));
	connect(m_buildAction, SIGNAL(triggered()), m_tikzPreviewController, SLOT(regeneratePreview()));

	m_viewLogAction = new Action(Icon(QLatin1String("run-build-file")), tr("View &Log"), this, QLatin1String("view_log"));
	m_viewLogAction->setStatusTip(tr("View log messages produced by the last executed process"));
	m_viewLogAction->setWhatsThis(tr("<p>Show the log messages produced by the last executed process in the Messages box.</p>"));
	connect(m_viewLogAction, SIGNAL(triggered()), this, SLOT(updateLog()));

	// Configure
	m_configureAction = StandardAction::preferences(this, SLOT(configure()), this);
	m_configureAction->setText(tr("&Configure %1...").arg(KtikzApplication::applicationName()));
	m_configureAction->setStatusTip(tr("Configure the settings of this application"));
	m_configureAction->setWhatsThis(tr("<p>Configure the settings of this application.</p>"));

#ifdef KTIKZ_USE_KDE
	addActionCloneToCollection(QLatin1String("toggle_preview"), m_previewDock->toggleViewAction());
	addActionCloneToCollection(QLatin1String("toggle_log"), m_logDock->toggleViewAction());
#endif

	// Help
	m_showTikzDocAction = new Action(Icon(QLatin1String("help-contents")), tr("TikZ &Manual"), this, QLatin1String("show_tikz_doc"));
	m_showTikzDocAction->setStatusTip(tr("Show the manual of TikZ and PGF"));
	m_showTikzDocAction->setWhatsThis(tr("<p>Show the manual of TikZ and PGF.</p>"));
	connect(m_showTikzDocAction, SIGNAL(triggered()), this, SLOT(showTikzDocumentation()));

#ifdef KTIKZ_USE_KDE
	m_whatsThisAction = KStandardAction::whatsThis(this, SLOT(toggleWhatsThisMode()), this);
#else
	m_helpAction = new QAction(Icon(QLatin1String("help-contents")), tr("%1 &Handbook").arg(KtikzApplication::applicationName()), this);
	m_helpAction->setStatusTip(tr("Show the application's documentation"));
	m_helpAction->setShortcut(QKeySequence::HelpContents);
	connect(m_helpAction, SIGNAL(triggered()), this, SLOT(showDocumentation()));

	m_whatsThisAction = QWhatsThis::createAction(this);
	m_whatsThisAction->setIcon(Icon(QLatin1String("help-contextual")));
	m_whatsThisAction->setStatusTip(tr("Show simple description of any widget"));

	m_aboutAction = new QAction(QIcon(QLatin1String(":/icons/qtikz-22.png")), tr("&About %1").arg(KtikzApplication::applicationName()), this);
	m_aboutAction->setStatusTip(tr("Show the application's About box"));
	connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(about()));

	m_aboutQtAction = new QAction(QIcon(QLatin1String(":/icons/qt-logo-22.png")), tr("About &Qt"), this);
	m_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
	connect(m_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
#endif
}
Beispiel #7
0
MainWindow::MainWindow() : QbWindow(config.geometry.mainWindow) {
  setObjectName("main-window");
  setWindowTitle(utf8() << bsnesTitle << " v" << bsnesVersion);

  //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_load->setIcon(QIcon(":/16x16/document-open.png"));
    system_loadSpecial = system->addMenu("Load Special");
    system_loadSpecial->setIcon(QIcon(":/16x16/document-open.png"));
      system_loadSpecial_bsxSlotted = system_loadSpecial->addAction("Load BS-X Slotted Cartridge ...");
      system_loadSpecial_bsxSlotted->setIcon(QIcon(":/16x16/document-open.png"));
      system_loadSpecial_bsx = system_loadSpecial->addAction("Load BS-X Cartridge ...");
      system_loadSpecial_bsx->setIcon(QIcon(":/16x16/document-open.png"));
      system_loadSpecial_sufamiTurbo = system_loadSpecial->addAction("Load Sufami Turbo Cartridge ...");
      system_loadSpecial_sufamiTurbo->setIcon(QIcon(":/16x16/document-open.png"));
      system_loadSpecial_superGameBoy = system_loadSpecial->addAction("Load Super Game Boy Cartridge ...");
      system_loadSpecial_superGameBoy->setIcon(QIcon(":/16x16/document-open.png"));
    system->addSeparator();
    system->addAction(system_power = new QbCheckAction("Power", 0));
    system_reset = system->addAction("Reset");
    system_reset->setIcon(QIcon(":/16x16/view-refresh.png"));
    system->addSeparator();
    system_port1 = system->addMenu("Controller Port 1");
    system_port1->setIcon(QIcon(":/16x16/input-gaming.png"));
      system_port1->addAction(system_port1_none = new QbRadioAction("None", 0));
      system_port1->addAction(system_port1_joypad = new QbRadioAction("Joypad", 0));
      system_port1->addAction(system_port1_multitap = new QbRadioAction("Multitap", 0));
      system_port1->addAction(system_port1_mouse = new QbRadioAction("Mouse", 0));
    system_port2 = system->addMenu("Controller Port 2");
    system_port2->setIcon(QIcon(":/16x16/input-gaming.png"));
      system_port2->addAction(system_port2_none = new QbRadioAction("None", 0));
      system_port2->addAction(system_port2_joypad = new QbRadioAction("Joypad", 0));
      system_port2->addAction(system_port2_multitap = new QbRadioAction("Multitap", 0));
      system_port2->addAction(system_port2_mouse = new QbRadioAction("Mouse", 0));
      system_port2->addAction(system_port2_superscope = new QbRadioAction("Super Scope", 0));
      system_port2->addAction(system_port2_justifier = new QbRadioAction("Justifier", 0));
      system_port2->addAction(system_port2_justifiers = new QbRadioAction("Two Justifiers", 0));
    #if !defined(PLATFORM_OSX)
    system->addSeparator();
    #endif
    system_exit = system->addAction("Exit");
    system_exit->setIcon(QIcon(":/16x16/process-stop.png"));
    system_exit->setMenuRole(QAction::QuitRole);

  settings = menuBar->addMenu("Settings");
    settings_videoMode = settings->addMenu("Video Mode");
    settings_videoMode->setIcon(QIcon(":/16x16/video-display.png"));
      settings_videoMode->addAction(settings_videoMode_1x = new QbRadioAction("Scale 1x", 0));
      settings_videoMode->addAction(settings_videoMode_2x = new QbRadioAction("Scale 2x", 0));
      settings_videoMode->addAction(settings_videoMode_3x = new QbRadioAction("Scale 3x", 0));
      settings_videoMode->addAction(settings_videoMode_4x = new QbRadioAction("Scale 4x", 0));
      settings_videoMode->addAction(settings_videoMode_max = new QbRadioAction("Scale Max", 0));
      settings_videoMode->addSeparator();
      settings_videoMode->addAction(settings_videoMode_correctAspectRatio = new QbCheckAction("Correct Aspect Ratio", 0));
      settings_videoMode->addAction(settings_videoMode_fullscreen = new QbCheckAction("Fullscreen", 0));
      settings_videoMode->addSeparator();
      settings_videoMode->addAction(settings_videoMode_ntsc = new QbRadioAction("NTSC", 0));
      settings_videoMode->addAction(settings_videoMode_pal = new QbRadioAction("PAL", 0));

    if(filter.opened()) {
      settings_videoFilter = settings->addMenu("Video Filter");
      settings_videoFilter->setIcon(QIcon(":/16x16/image-x-generic.png"));

      settings_videoFilter_configure = settings_videoFilter->addAction("Configure Active Filter ...");
      settings_videoFilter_configure->setIcon(QIcon(":/16x16/preferences-desktop.png"));
      settings_videoFilter->addSeparator();

      settings_videoFilter->addAction(settings_videoFilter_none = new QbRadioAction("None", 0));
      settings_videoFilter_list.add(settings_videoFilter_none);

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

    settings->addAction(settings_smoothVideo = new QbCheckAction("Smooth Video Output", 0));
    settings->addSeparator();
    settings->addAction(settings_muteAudio = new QbCheckAction("Mute Audio Output", 0));
    settings->addSeparator();
    settings_emulationSpeed = settings->addMenu("Emulation Speed");
    settings_emulationSpeed->setIcon(QIcon(":/16x16/appointment-new.png"));
      settings_emulationSpeed->addAction(settings_emulationSpeed_slowest = new QbRadioAction("50%", 0));
      settings_emulationSpeed->addAction(settings_emulationSpeed_slow = new QbRadioAction("75%", 0));
      settings_emulationSpeed->addAction(settings_emulationSpeed_normal = new QbRadioAction("100%", 0));
      settings_emulationSpeed->addAction(settings_emulationSpeed_fast = new QbRadioAction("150%", 0));
      settings_emulationSpeed->addAction(settings_emulationSpeed_fastest = new QbRadioAction("200%", 0));
      settings_emulationSpeed->addSeparator();
      settings_emulationSpeed->addAction(settings_emulationSpeed_syncVideo = new QbCheckAction("Sync Video", 0));
      settings_emulationSpeed->addAction(settings_emulationSpeed_syncAudio = new QbCheckAction("Sync Audio", 0));
    settings_configuration = settings->addAction("Configuration ...");
    settings_configuration->setIcon(QIcon(":/16x16/preferences-desktop.png"));
    settings_configuration->setMenuRole(QAction::PreferencesRole);

  tools = menuBar->addMenu("Tools");
    tools_cheatEditor = tools->addAction("Cheat Editor ...");
    tools_cheatEditor->setIcon(QIcon(":/16x16/accessories-text-editor.png"));
    tools_cheatFinder = tools->addAction("Cheat Finder ...");
    tools_cheatFinder->setIcon(QIcon(":/16x16/system-search.png"));
    tools_stateManager = tools->addAction("State Manager ...");
    tools_stateManager->setIcon(QIcon(":/16x16/system-file-manager.png"));
    tools->addSeparator();
    tools_captureScreenshot = tools->addAction("Capture Screenshot");
    tools_captureScreenshot->setIcon(QIcon(":/16x16/image-x-generic.png"));
    tools_debugger = tools->addAction("Debugger ...");
    tools_debugger->setIcon(QIcon(":/16x16/utilities-terminal.png"));
    #if !defined(DEBUGGER)
    tools_debugger->setVisible(false);
    #endif

  help = menuBar->addMenu("Help");
    help_documentation = help->addAction("Documentation ...");
    help_documentation->setIcon(QIcon(":/16x16/text-x-generic.png"));
    help_license = help->addAction("License ...");
    help_license->setIcon(QIcon(":/16x16/text-x-generic.png"));
    #if !defined(PLATFORM_OSX)
    help->addSeparator();
    #endif
    help_about = help->addAction("About ...");
    help_about->setIcon(QIcon(":/16x16/help-browser.png"));
    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

      QPalette palette;
      palette.setColor(QPalette::Window, QColor(0, 0, 0));
      canvas->setPalette(palette);
      canvas->setAutoFillBackground(true);
    }
    canvasLayout->addWidget(canvas);
  }
  canvasContainer->setLayout(canvasLayout);

  //status bar
  statusBar = new QStatusBar;
  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);

  //slots
  connect(system_load, SIGNAL(triggered()), this, SLOT(loadCartridge()));
  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_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_joypad, SIGNAL(triggered()), this, SLOT(setPort1Joypad()));
  connect(system_port1_multitap, SIGNAL(triggered()), this, SLOT(setPort1Multitap()));
  connect(system_port1_mouse, SIGNAL(triggered()), this, SLOT(setPort1Mouse()));
  connect(system_port2_none, SIGNAL(triggered()), this, SLOT(setPort2None()));
  connect(system_port2_joypad, SIGNAL(triggered()), this, SLOT(setPort2Joypad()));
  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_max, SIGNAL(triggered()), this, SLOT(setVideoModeMax()));
  connect(settings_videoMode_correctAspectRatio, SIGNAL(triggered()), this, SLOT(toggleAspectCorrection()));
  connect(settings_videoMode_fullscreen, SIGNAL(triggered()), this, SLOT(toggleFullscreen()));
  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_cheatEditor, SIGNAL(triggered()), this, SLOT(showCheatEditor()));
  connect(tools_cheatFinder, SIGNAL(triggered()), this, SLOT(showCheatFinder()));
  connect(tools_stateManager, SIGNAL(triggered()), this, SLOT(showStateManager()));
  connect(tools_captureScreenshot, SIGNAL(triggered()), this, SLOT(saveScreenshot()));
  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();
}
Beispiel #8
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();
}
Beispiel #9
0
MainWindow::MainWindow() : QbWindow(config().geometry.mainWindow) {
  setObjectName("main-window");
  setWindowTitle(string() << bsnesTitle << " v" << bsnesVersion);
  setCloseOnEscape(false);

  //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_load->setIcon(QIcon(":/16x16/document-open.png"));

  system_loadSpecial = system->addMenu("Load &Special");
  system_loadSpecial->setIcon(QIcon(":/16x16/document-open.png"));

  system_loadSpecial_bsxSlotted = system_loadSpecial->addAction("Load BS-X &Slotted Cartridge ...");
  system_loadSpecial_bsxSlotted->setIcon(QIcon(":/16x16/document-open.png"));

  system_loadSpecial_bsx = system_loadSpecial->addAction("Load &BS-X Cartridge ...");
  system_loadSpecial_bsx->setIcon(QIcon(":/16x16/document-open.png"));

  system_loadSpecial_sufamiTurbo = system_loadSpecial->addAction("Load Sufami &Turbo Cartridge ...");
  system_loadSpecial_sufamiTurbo->setIcon(QIcon(":/16x16/document-open.png"));

  system_loadSpecial_superGameBoy = system_loadSpecial->addAction("Load Super &Game Boy Cartridge ...");
  system_loadSpecial_superGameBoy->setIcon(QIcon(":/16x16/document-open.png"));

  system->addSeparator();

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

  system_reset = system->addAction("&Reset");
  system_reset->setIcon(QIcon(":/16x16/view-refresh.png"));

  system->addSeparator();

  system_port1 = system->addMenu("Controller Port &1");
  system_port1->setIcon(QIcon(":/16x16/input-gaming.png"));
  system_port1->addAction(system_port1_none = new QbRadioAction("&None", 0));
  system_port1->addAction(system_port1_gamepad = new QbRadioAction("&Gamepad", 0));
  system_port1->addAction(system_port1_asciipad = new QbRadioAction("&asciiPad", 0));
  system_port1->addAction(system_port1_multitap = new QbRadioAction("&Multitap", 0));
  system_port1->addAction(system_port1_mouse = new QbRadioAction("&Mouse", 0));

  system_port2 = system->addMenu("Controller Port &2");
  system_port2->setIcon(QIcon(":/16x16/input-gaming.png"));
  system_port2->addAction(system_port2_none = new QbRadioAction("&None", 0));
  system_port2->addAction(system_port2_gamepad = new QbRadioAction("&Gamepad", 0));
  system_port2->addAction(system_port2_asciipad = new QbRadioAction("&asciiPad", 0));
  system_port2->addAction(system_port2_multitap = new QbRadioAction("&Multitap", 0));
  system_port2->addAction(system_port2_mouse = new QbRadioAction("&Mouse", 0));
  system_port2->addAction(system_port2_superscope = new QbRadioAction("&Super Scope", 0));
  system_port2->addAction(system_port2_justifier = new QbRadioAction("&Justifier", 0));
  system_port2->addAction(system_port2_justifiers = new QbRadioAction("Two &Justifiers", 0));

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

  system_exit = system->addAction("E&xit");
  system_exit->setIcon(QIcon(":/16x16/process-stop.png"));
  system_exit->setMenuRole(QAction::QuitRole);

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

  settings_videoMode = settings->addMenu("Video &Mode");
  settings_videoMode->setIcon(QIcon(":/16x16/video-display.png"));

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

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

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

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

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

  settings_videoMode->addSeparator();

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

  settings_videoMode->addSeparator();

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

  if(filter.opened()) {
    settings_videoFilter = settings->addMenu("Video &Filter");
    settings_videoFilter->setIcon(QIcon(":/16x16/image-x-generic.png"));

    settings_videoFilter_configure = settings_videoFilter->addAction("&Configure Active Filter ...");
    settings_videoFilter_configure->setIcon(QIcon(":/16x16/preferences-desktop.png"));
    settings_videoFilter->addSeparator();

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

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

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

  settings->addSeparator();

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

  settings->addSeparator();

  settings_emulationSpeed = settings->addMenu("Emulation &Speed");
  settings_emulationSpeed->setIcon(QIcon(":/16x16/appointment-new.png"));

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

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

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

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

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

  settings_emulationSpeed->addSeparator();

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

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

  settings_configuration = settings->addAction("&Configuration ...");
  settings_configuration->setIcon(QIcon(":/16x16/preferences-desktop.png"));
  settings_configuration->setMenuRole(QAction::PreferencesRole);

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

  tools_movies = tools->addMenu("&Movies");
  tools_movies->setIcon(QIcon(":/16x16/applications-multimedia.png"));

  tools_movies_play = tools_movies->addAction("Play Movie ...");
  tools_movies_play->setIcon(QIcon(":/16x16/media-playback-start.png"));

  tools_movies_stop = tools_movies->addAction("Stop");
  tools_movies_stop->setIcon(QIcon(":/16x16/media-playback-stop.png"));

  tools_movies_recordFromPowerOn = tools_movies->addAction("Record Movie (and restart system)");
  tools_movies_recordFromPowerOn->setIcon(QIcon(":/16x16/media-record.png"));

  tools_movies_recordFromHere = tools_movies->addAction("Record Movie (starting from here)");
  tools_movies_recordFromHere->setIcon(QIcon(":/16x16/media-record.png"));

  tools_captureScreenshot = tools->addAction("&Capture Screenshot");
  tools_captureScreenshot->setIcon(QIcon(":/16x16/image-x-generic.png"));

  tools->addSeparator();

  tools_dialog = tools->addAction("&Tools Dialog ...");
  tools_dialog->setIcon(QIcon(":/16x16/preferences-desktop.png"));

  tools_debugger = tools->addAction("&Debugger ...");
  tools_debugger->setIcon(QIcon(":/16x16/utilities-terminal.png"));
  #if !defined(DEBUGGER)
  tools_debugger->setVisible(false);
  #endif

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

  help_documentation = help->addAction("&Documentation ...");
  help_documentation->setIcon(QIcon(":/16x16/text-x-generic.png"));

  help_license = help->addAction("&License ...");
  help_license->setIcon(QIcon(":/16x16/text-x-generic.png"));

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

  help_about = help->addAction("&About ...");
  help_about->setIcon(QIcon(":/16x16/help-browser.png"));
  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

      QPalette palette;
      palette.setColor(QPalette::Window, QColor(0, 0, 0));
      canvas->setPalette(palette);
      canvas->setAutoFillBackground(true);
    }
    canvasLayout->addWidget(canvas);
  }
  canvasContainer->setLayout(canvasLayout);

  //status bar
  statusBar = new QStatusBar;
  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);

  //slots
  connect(system_load, SIGNAL(triggered()), this, SLOT(loadCartridge()));
  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_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_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_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_debugger, SIGNAL(triggered()), this, SLOT(showDebugger()));
  connect(tools_dialog, SIGNAL(triggered()), this, SLOT(showToolsDialog()));
  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();
}