Example #1
0
void RunnerWindow::createToolbar()
{
	toolbar = new AmeToolBar();
	addToolBar(toolbar);

        prevBtn = new AmeRectButton(AmeSystemIcon::GoPrevious, "Previous", this);
        connect(prevBtn, SIGNAL(clicked()), this, SLOT(onPrev()));

        nextBtn = new AmeRectButton(AmeSystemIcon::GoNext,"Next", this);
        connect(nextBtn, SIGNAL(clicked()), this, SLOT(onNext()));

        iconsBtn = new AmeRectButton(AmeSystemIcon::Icons, "Show as icons", this);
        listBtn = new AmeRectButton(AmeSystemIcon::List, "Show as list", this);
        columnsBtn = new AmeRectButton(AmeSystemIcon::Columns, "Show as list", this);


        toolbar->addWidget(prevBtn);
        toolbar->addWidget(nextBtn);
	toolbar->addSpace(60);
        toolbar->addWidget(iconsBtn);
        toolbar->addWidget(listBtn);
        toolbar->addWidget(columnsBtn);


}
Example #2
0
void ChessWidget::keyReleaseEvent(QKeyEvent * e)
{
  if ( !e )
    return;

  switch ( e->key() )
  {
  case Qt::Key_F2:
    onSave();
    break;

  case Qt::Key_F3:
    onLoad();
    break;

  case Qt::Key_PageUp:
    onNext();
    break;

  case Qt::Key_PageDown:
    onPrev();
    break;

  case Qt::Key_C:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onPutFEN();
    }
    break;

  case Qt::Key_V:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onGetFEN();
    }
    break;
  }
}
Example #3
0
void ChessWidget::createMenu()
{
  QMenu * gameMenu = menuBar()->addMenu(tr("&Game"));

  onNewAction_ = new QAction(tr("&New"), this);
  onNewAction_->setStatusTip(tr("Start new game"));

  onLoadAction_ = new QAction(tr("&Load"), this);
  onLoadAction_->setStatusTip(tr("Load previously saved game"));

  onSaveAction_ = new QAction(tr("&Save"), this);
  onSaveAction_->setStatusTip(tr("Save current game"));

  onPrevAction_ = new QAction(tr("&Undo move"), this);
  onPrevAction_->setStatusTip(tr("Undo last move. (only step of one color will be undone)"));

  onNextAction_ = new QAction(tr("&Redo move"), this);
  onNextAction_->setStatusTip(tr("Restore undone move"));

  onGoAction_ = new QAction(tr("&Go"), this);
  onGoAction_->setStatusTip(tr("Lets program make move"));

  onTurnBoardAction_ = new QAction(tr("&Turn board"), this);
  onTurnBoardAction_->setStatusTip(tr("Turn board to play another color"));
  onTurnBoardAction_->setCheckable(true);
  onTurnBoardAction_->setChecked(false);

  onHumanVsHumanAction_ = new QAction(tr("&Human vs. Human"), this);
  onHumanVsHumanAction_->setStatusTip(tr("Switch to Human with Human mode"));
  onHumanVsHumanAction_->setCheckable(true);
  onHumanVsHumanAction_->setChecked(false);

  QSettings settings(tr("Dimock"), tr("qchess"));
  onOpenBookAction_ = new QAction(tr("&Open book"), this);
  onOpenBookAction_->setStatusTip(tr("Use open book"));
  onOpenBookAction_->setCheckable(true);
  onOpenBookAction_->setChecked( settings.value(tr("open_book"), true).toBool() );

  onSettingsAction_ = new QAction(tr("Settin&gs"), this);
  onSettingsAction_->setStatusTip(tr("Change game settings"));

  gameMenu->addAction(onNewAction_);
  gameMenu->addAction(onLoadAction_);
  gameMenu->addAction(onSaveAction_);
  gameMenu->addAction(onPrevAction_);
  gameMenu->addAction(onNextAction_);
  gameMenu->addAction(onGoAction_);
  gameMenu->addAction(onTurnBoardAction_);
  gameMenu->addAction(onOpenBookAction_);
  gameMenu->addSeparator();
  gameMenu->addAction(onHumanVsHumanAction_);
  gameMenu->addSeparator();
  gameMenu->addAction(onSettingsAction_);

  connect(onNewAction_, SIGNAL(triggered()), this, SLOT(onNew()));
  connect(onLoadAction_, SIGNAL(triggered()), this, SLOT(onLoad()));
  connect(onSaveAction_, SIGNAL(triggered()), this, SLOT(onSave()));
  connect(onPrevAction_, SIGNAL(triggered()), this, SLOT(onPrev()));
  connect(onNextAction_, SIGNAL(triggered()), this, SLOT(onNext()));
  connect(onGoAction_, SIGNAL(triggered()), this, SLOT(onGo()));
  connect(onTurnBoardAction_, SIGNAL(toggled(bool)), this, SLOT(onTurnBoard(bool)));
  connect(onHumanVsHumanAction_, SIGNAL(toggled(bool)), this, SLOT(onHumanWithHumanMode(bool)));
  connect(onOpenBookAction_, SIGNAL(toggled(bool)), this, SLOT(onUseOpenBook(bool)));
  connect(onSettingsAction_, SIGNAL(triggered()), this, SLOT(onSettings()));
}