コード例 #1
0
void MainWindow::on_pbOpen_clicked()
{
    QModelIndexList selRows = ui->tvGames->selectionModel()->selectedRows();

    if(selRows.size() == 0)
    {
        std::cout << "No items selected" << std::endl;
        return;
    }

    QModelIndex selectedElement = selRows.at(0);
    QString text = _gamesModel->data(_gamesModel->index(selectedElement.row(), 0)).toString();

    if(!openGame(text.toInt()))
    {
        QMessageBox msg;
        msg.setText(QString("Cannot open game #") + text);
        msg.exec();
    }
    else
    {
        cout << "Open complete" << endl;
        ui->cbvGame->setChessboard(&_player->chessBoard());
    }
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: IlyaGusev/BreakOut
void MainWindow::openMain(){
    scene->deleteLater();
    scene = new Menu;

    connect(scene, SIGNAL(signalGame()), this, SLOT(openGame()));
    connect(scene, SIGNAL(signalEditor()), this, SLOT(openEditor()));
    connect(scene, SIGNAL(signalMusic()), this, SLOT(slotMusic()));
    connect(scene, SIGNAL(signalExit()), this, SLOT(exit()));

    setupView();
}
コード例 #3
0
ファイル: startwindow.cpp プロジェクト: Purple-Jesus/Field
/**
 * @brief StartWindow::StartWindow
 * @param parent
 * Constructor of the StartWindow-class
 * connects the signals of the Buttons and the LineEdit
 */
StartWindow::StartWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::StartWindow)
{
    ui->setupUi(this);
    server = new MyServer(this);
    socket = new MySocket(this);
    setW = new SetWindow(this);
    numb = 0;

    connect(ui->lineEdit, SIGNAL(editingFinished()), this, SLOT(getName()));
    connect(ui->startGameButton, SIGNAL(clicked()), this, SLOT(openGame()));
    connect(ui->joinGameButton, SIGNAL(clicked()), this, SLOT(joinGame()));
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: IlyaGusev/BreakOut
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), scene(new Menu), view (new QGraphicsView)
{
    music = Phonon::createPlayer(Phonon::MusicCategory,
                                 Phonon::MediaSource(":/music/Fly12.mp3"));
    music->play();
    connect(music, SIGNAL(aboutToFinish()), this , SLOT(slotRepeat()));

    connect(scene, SIGNAL(signalGame()), this, SLOT(openGame()));
    connect(scene, SIGNAL(signalEditor()), this, SLOT(openEditor()));
    connect(scene, SIGNAL(signalExit()), this, SLOT(exit()));
    connect(scene, SIGNAL(signalMusic()), this, SLOT(slotMusic()));

    setupView();
}
コード例 #5
0
void KJumpingCube::initKAction() {
  KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection());
  KStdGameAction::load(this, SLOT(openGame()), actionCollection());
  KStdGameAction::save(this, SLOT(save()), actionCollection());
  KStdGameAction::saveAs(this, SLOT(saveAs()), actionCollection());
  KStdGameAction::quit(this, SLOT(close()), actionCollection());

  hintAction = KStdGameAction::hint(view, SLOT(getHint()), actionCollection());
  stopAction = new KAction(i18n("Stop &Thinking"), "stop",
  Qt::Key_Escape, this, SLOT(stop()), actionCollection(), "game_stop");
  stopAction->setEnabled(false);
  undoAction = KStdGameAction::undo(this, SLOT(undo()), actionCollection());
  undoAction->setEnabled(false);
  KStdAction::preferences(this, SLOT(showOptions()), actionCollection());

  setupGUI();
}
コード例 #6
0
ファイル: mainwindow.cpp プロジェクト: gperciva/meaws
bool MainWindow::nextExercise()
{
	if (game_->multipleExercises())
	{
		if (exercise_ != NULL)
			delete exercise_;
		exercise_ =
		    game_->getNextExercise(exercise_->getTryScore());
		if (exercise_ != NULL)
			setupExercise();
		return true;
	}
	else
	{
		return openGame(false);
	}
	return false;
}
コード例 #7
0
ファイル: pwidget.cpp プロジェクト: nielsslot/kdegamess60
pWidget::pWidget()
#ifndef Q_OS_SYMBIAN
  : KXmlGuiWindow(0),
#else
  : QMainWindow(0),
#endif
    dill(0),
    m_dealer(0),
    m_bubbles(0)
{
    setObjectName( "pwidget" );
    current_pwidget = this;
    // KCrash::setEmergencySaveFunction(::saveGame);

    // Game
// TODO actions
#if 0
    KStandardGameAction::gameNew(this, SLOT(newGame()), actionCollection());
    KStandardGameAction::restart(this, SLOT(restart()), actionCollection());
    KStandardGameAction::load(this, SLOT(openGame()), actionCollection());
    recent = KStandardGameAction::loadRecent(this, SLOT(openGame(const KUrl&)), actionCollection());
    recent->loadEntries(KGlobal::config()->group( QString() ));

    KStandardGameAction::save(this, SLOT(saveGame()), actionCollection());
    KStandardGameAction::quit(this, SLOT(close()), actionCollection());

    // Move
    undo = KStandardGameAction::undo(this, SLOT(undoMove()), actionCollection());
    redo = KStandardGameAction::redo(this, SLOT(redoMove()), actionCollection());

    KAction *a;
    a = actionCollection()->addAction("choose_game");
    a->setText(i18n("&Choose Game..."));
    connect( a, SIGNAL( triggered( bool ) ), SLOT( chooseGame() ) );

    a = actionCollection()->addAction("change_game_type");
    a->setText(i18n("Change Game Type..."));
    connect( a, SIGNAL( triggered( bool ) ), SLOT( slotShowGameSelectionScreen() ) );

    a = actionCollection()->addAction("random_set");
    a->setText(i18n("Random Cards"));
    connect( a, SIGNAL( triggered( bool ) ), SLOT( slotPickRandom() ) );
    a->setShortcuts( KShortcut( Qt::Key_F9 ) );

    if (!qgetenv("KDE_DEBUG").isEmpty()) // developer shortcut
    {
        a = actionCollection()->addAction("snapshot");
        a->setText(i18n("Take Game Preview Snapshots"));
        connect( a, SIGNAL( triggered( bool ) ), SLOT( slotSnapshot() ) );
        a->setShortcuts( KShortcut( Qt::Key_F8 ) );
    }

    a = actionCollection()->addAction("select_deck");
    a->setText(i18n("Select Deck..."));
    connect( a, SIGNAL( triggered( bool ) ), SLOT( slotSelectDeck() ) );
    a->setShortcuts( KShortcut( Qt::Key_F10 ) );


    a = actionCollection()->addAction("game_stats");
    a->setText(i18n("Statistics"));
    connect( a, SIGNAL( triggered( bool ) ), SLOT(showStats()) );

    gamehelpaction = actionCollection()->addAction("help_game");
    connect( gamehelpaction, SIGNAL( triggered( bool ) ), SLOT(helpGame()));
    gamehelpaction->setShortcuts( KShortcut( Qt::Key_F2 ) );

    // Game type dependent actions
    hintaction = KStandardGameAction::hint( 0, 0, actionCollection() );

    demoaction = KStandardGameAction::demo( 0, 0, actionCollection() );

    drawaction = actionCollection()->addAction("move_draw");
    drawaction->setText( i18nc("Take one or more cards from the deck, flip them, and place them in play", "Dra&w") );
    drawaction->setIcon( KIcon("kpat") );
    drawaction->setShortcut( Qt::Key_Space );

    dealaction = actionCollection()->addAction("move_deal");
    dealaction->setText( i18nc("Deal a new row of cards from the deck", "Dea&l") );
    dealaction->setIcon( KIcon("kpat") );
    dealaction->setShortcut( Qt::Key_Enter );

    redealaction = actionCollection()->addAction("move_redeal");
    redealaction->setText( i18nc("Collect the cards in play, shuffle them and redeal them", "&Redeal") );
    redealaction->setIcon( KIcon("roll") );
    redealaction->setShortcut( Qt::Key_R );

    dropaction = actionCollection()->addAction("move_drop");
    dropaction->setText( i18nc("Automatically move cards to the foundation piles", "Dro&p") );
    dropaction->setIcon( KIcon("legalmoves") );
    dropaction->setShortcut( Qt::Key_P );

    // Configuration actions
    KConfigGroup cg(KGlobal::config(), settings_group );

    autodropaction = new KToggleAction(i18n("&Enable Autodrop"), this);
    actionCollection()->addAction("enable_autodrop", autodropaction);
    connect( autodropaction, SIGNAL( triggered( bool ) ), SLOT(enableAutoDrop()) );
    autodropaction->setChecked( cg.readEntry("Autodrop", true) );

    solveraction = new KToggleAction(i18n("E&nable Solver"), this);
    actionCollection()->addAction("enable_solver", solveraction);
    connect( solveraction, SIGNAL( triggered( bool ) ), SLOT( enableSolver() ) );
    solveraction->setChecked( cg.readEntry("Solver", true) );

    rememberstateaction = new KToggleAction(i18n("&Remember State on Exit"), this);
    actionCollection()->addAction("remember_state", rememberstateaction);
    connect( rememberstateaction, SIGNAL( triggered( bool ) ), SLOT( enableRememberState() ) );
    rememberstateaction->setChecked( cg.readEntry("RememberStateOnExit", false) );
#endif

    foreach( const DealerInfo * di, DealerInfoList::self()->games() )
    {
        foreach( int id, di->ids )
            m_dealer_map.insert( id, di );
        if ( QString(di->name).toLower() == "freecell" )
            m_freeCellId = di->ids.first();
    }
コード例 #8
0
ファイル: mainwindow.cpp プロジェクト: gperciva/meaws
void MainWindow::on_action_Open_Single_Exercise_triggered()
{
	if (openGame(false))
		updateMain(EXERCISE);
}
コード例 #9
0
ファイル: mainwindow.cpp プロジェクト: gperciva/meaws
// Exercise actions
void MainWindow::on_action_Open_Game_triggered()
{
	if (openGame(true))
		updateMain(EXERCISE);
}
コード例 #10
0
ファイル: Main.cpp プロジェクト: diafero/PlasmaShop
/* VaultShopMain */
VaultShopMain::VaultShopMain()
{
    // Basic Form Settings
    setWindowTitle("VaultShop " PLASMASHOP_VERSION);
    //setWindowIcon(QIcon(":/res/VaultShop.png"));

    // Set up actions
    fActions[kFileOpenVault] = new QAction(qStdIcon("document-open"), tr("&Load Vault..."), this);
    fActions[kFileSaveVault] = new QAction(qStdIcon("document-save"), tr("&Save Vault"), this);
    fActions[kFileExit] = new QAction(tr("E&xit"), this);
    fActions[kVaultOpenNode] = new QAction(tr("Subscribe to &Node..."), this);

    fActions[kNodeUnLink] = new QAction(tr("Remove"), this);
    fActions[kNodeLink] = new QAction(tr("Add Node..."), this);
    fActions[kNodeCreate] = new QAction(tr("Create Node"), this);
    fActions[kNodeUnsubscribe] = new QAction(tr("Un-subscribe"), this);
    //fActions[kNodeRenameVault] = new QAction(tr("Rename Vault..."), this);

    fActions[kFileOpenVault]->setShortcut(Qt::CTRL + Qt::Key_O);
    fActions[kFileSaveVault]->setShortcut(Qt::CTRL + Qt::Key_S);
    fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4);
    fActions[kVaultOpenNode]->setShortcut(Qt::Key_F2);

    // Main Menus
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(fActions[kFileOpenVault]);
    fileMenu->addAction(fActions[kFileSaveVault]);
    fileMenu->addSeparator();
    fileMenu->addAction(fActions[kFileExit]);

    QMenu* vaultMenu = menuBar()->addMenu(tr("&Vault"));
    vaultMenu->addAction(fActions[kVaultOpenNode]);

    // Toolbars
    QToolBar* fileTbar = addToolBar(tr("File Toolbar"));
    fileTbar->setObjectName("FileToolBar");
    fileTbar->addAction(fActions[kFileOpenVault]);
    fileTbar->addAction(fActions[kFileSaveVault]);
    statusBar();

    // Main Splitter
    QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
    splitter->setObjectName("Splitter");

    // Node Browser
    fVaultTree = new QTreeWidget(splitter);
    fVaultTree->setUniformRowHeights(true);
    fVaultTree->setHeaderHidden(true);
    fVaultTree->setContextMenuPolicy(Qt::CustomContextMenu);

    // Property Editor
    fNodeTab = new QTabWidget(splitter);
    fGenericEditor = new QVaultNode(fNodeTab);
    fNodeTab->addTab(fGenericEditor, tr("Node Properties"));
    fCustomEditor = NULL;
    fSavEditor = NULL;
    fEditorTabPreference = 0;

    // Layout
    splitter->addWidget(fVaultTree);
    splitter->addWidget(fNodeTab);
    setCentralWidget(splitter);
    splitter->setSizes(QList<int>() << 160 << 320);

    // Global UI Signals
    connect(fActions[kFileExit], SIGNAL(triggered()), this, SLOT(close()));
    connect(fActions[kFileOpenVault], SIGNAL(triggered()), this, SLOT(openGame()));
    connect(fActions[kFileSaveVault], SIGNAL(triggered()), this, SLOT(performSave()));
    connect(fActions[kVaultOpenNode], SIGNAL(triggered()), this, SLOT(openNode()));
    connect(fActions[kNodeUnLink], SIGNAL(triggered()), this, SLOT(unlinkNode()));
    connect(fActions[kNodeLink], SIGNAL(triggered()), this, SLOT(linkNode()));
    connect(fActions[kNodeCreate], SIGNAL(triggered()), this, SLOT(createNode()));
    connect(fActions[kNodeUnsubscribe], SIGNAL(triggered()), this, SLOT(closeNode()));
    //connect(fActions[kNodeRenameVault], SIGNAL(triggered()), this, SLOT(renameVault()));

    connect(fVaultTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
            this, SLOT(treeItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(fVaultTree, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(treeContextMenu(const QPoint&)));
    connect(fNodeTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
    connect(fGenericEditor, SIGNAL(typeModified()), this, SLOT(typeModified()));
    connect(this, SIGNAL(nodeChanged(unsigned int)), this, SLOT(refreshNode(unsigned int)));

    // Load UI Settings
    QSettings settings("PlasmaShop", "VaultShop");
    resize(settings.value("WinSize", QSize(480, 600)).toSize());
    if (settings.contains("WinPos"))
        move(settings.value("WinPos").toPoint());
    if (settings.value("WinMaximized", false).toBool())
        showMaximized();

    if (settings.contains("WinState"))
        restoreState(settings.value("WinState").toByteArray());

    fLastDir = settings.value("LastDir").toString();
    if (!fLastDir.isEmpty())
        loadGame(fLastDir);
}