mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
removed not needed games dir
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1714 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6c0b5ba3b
commit
2319711d9d
11 changed files with 1 additions and 3733 deletions
|
@ -98,7 +98,6 @@ DEPENDPATH += . \
|
||||||
gui \
|
gui \
|
||||||
lang \
|
lang \
|
||||||
util \
|
util \
|
||||||
games\qbackgammon \
|
|
||||||
gui\bwgraph \
|
gui\bwgraph \
|
||||||
gui\chat \
|
gui\chat \
|
||||||
gui\connect \
|
gui\connect \
|
||||||
|
@ -233,10 +232,6 @@ HEADERS += rshare.h \
|
||||||
gui/advsearch/advancedsearchdialog.h \
|
gui/advsearch/advancedsearchdialog.h \
|
||||||
gui/advsearch/expressionwidget.h \
|
gui/advsearch/expressionwidget.h \
|
||||||
gui/advsearch/guiexprelement.h \
|
gui/advsearch/guiexprelement.h \
|
||||||
games/qbackgammon/bgwindow.h \
|
|
||||||
games/qbackgammon/bgwidget.h \
|
|
||||||
games/qbackgammon/bgboard.h \
|
|
||||||
games/qbackgammon/optionsdlg.h \
|
|
||||||
gui/elastic/graphwidget.h \
|
gui/elastic/graphwidget.h \
|
||||||
gui/elastic/edge.h \
|
gui/elastic/edge.h \
|
||||||
gui/elastic/arrow.h \
|
gui/elastic/arrow.h \
|
||||||
|
@ -442,10 +437,6 @@ SOURCES += main.cpp \
|
||||||
gui/advsearch/advancedsearchdialog.cpp \
|
gui/advsearch/advancedsearchdialog.cpp \
|
||||||
gui/advsearch/expressionwidget.cpp \
|
gui/advsearch/expressionwidget.cpp \
|
||||||
gui/advsearch/guiexprelement.cpp \
|
gui/advsearch/guiexprelement.cpp \
|
||||||
games/qbackgammon/bgwindow.cpp \
|
|
||||||
games/qbackgammon/bgwidget.cpp \
|
|
||||||
games/qbackgammon/bgboard.cpp \
|
|
||||||
games/qbackgammon/optionsdlg.cpp \
|
|
||||||
gui/elastic/graphwidget.cpp \
|
gui/elastic/graphwidget.cpp \
|
||||||
gui/elastic/edge.cpp \
|
gui/elastic/edge.cpp \
|
||||||
gui/elastic/arrow.cpp \
|
gui/elastic/arrow.cpp \
|
||||||
|
|
|
@ -1,24 +1,7 @@
|
||||||
RetroShare Todo list
|
RetroShare Todo list
|
||||||
====================================================================
|
====================================================================
|
||||||
|
|
||||||
|
Projects list and Todo list on Wiki:
|
||||||
* start minimized [enabel,disable start minimized](Options->General)
|
|
||||||
* Auto Login [enabel,disable Auto Login](Options->General)
|
|
||||||
* enable/disable Toasters from (Options->Notify)
|
|
||||||
|
|
||||||
* collapse sources in Downloads [similar ares,emule](TransfersDialog)
|
|
||||||
* Contacts Manager(Adressbook) for Messages ( similar Thunderbirds Adressbook feature)
|
|
||||||
|
|
||||||
* Proxy support
|
|
||||||
* DynDNS support
|
|
||||||
|
|
||||||
* partial multi source download ("swarming")
|
|
||||||
|
|
||||||
* setCacheDirectory/getCacheDirectory (Customizable Directories for cache folder)
|
|
||||||
* setChannelsDirectory/getChannelsDirectory (Customizable Directories for channels folder)
|
|
||||||
|
|
||||||
|
|
||||||
See the Rest of the Projects list and Todo list on Wiki:
|
|
||||||
http://retroshare.sourceforge.net/wiki/index.php/Development
|
http://retroshare.sourceforge.net/wiki/index.php/Development
|
||||||
|
|
||||||
http://retroshare.sourceforge.net/wiki/index.php/To_do_list
|
http://retroshare.sourceforge.net/wiki/index.php/To_do_list
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,166 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#ifndef BGBOARD_H
|
|
||||||
#define BGBOARD_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QFrame>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class BgEngine;
|
|
||||||
|
|
||||||
enum { checker0Color, checker1Color, point0Color, point1Color, feltColor, caseColor };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Move {
|
|
||||||
int startPoint;
|
|
||||||
int dieValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct moveScore {
|
|
||||||
std::vector<Move> moves;
|
|
||||||
float score;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BgBoard : public QFrame
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
BgBoard( QWidget *parent = 0 );
|
|
||||||
QSize sizeHint() const;
|
|
||||||
int activePlayer();
|
|
||||||
void setColor( int item, QColor color );
|
|
||||||
QColor getColor( int item );
|
|
||||||
void setPlayerType( int player, int opponent );
|
|
||||||
int getPlayerType( int player );
|
|
||||||
void setAutoRoll( int player, bool value );
|
|
||||||
bool getAutoRoll( int player );
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void unsetSingleClick();
|
|
||||||
void undo();
|
|
||||||
void startNewGame();
|
|
||||||
void hint();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void playerChanged( int player );
|
|
||||||
void gameOver( int points );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void paintEvent( QPaintEvent *event );
|
|
||||||
void paintBoard( QPainter &painter );
|
|
||||||
void paintChecker( QPainter &painter ); // paint the checker being dragged
|
|
||||||
void paintStaticCheckers( QPainter &painter );
|
|
||||||
void paintDice( QPainter &painter, std::vector<int> dice );
|
|
||||||
void paintCheck( QPainter &painter, QPoint &pos, int player );
|
|
||||||
|
|
||||||
void mousePressEvent( QMouseEvent *event );
|
|
||||||
void mouseMoveEvent( QMouseEvent *event );
|
|
||||||
void mouseReleaseEvent( QMouseEvent *event );
|
|
||||||
void mouseDoubleClickEvent( QMouseEvent *event );
|
|
||||||
|
|
||||||
private:
|
|
||||||
float board_height;
|
|
||||||
float point_width;
|
|
||||||
float point_height;
|
|
||||||
float home_width;
|
|
||||||
float board_width;
|
|
||||||
float checker_size;
|
|
||||||
float case_width;
|
|
||||||
float die_size;
|
|
||||||
float die_spot_size;
|
|
||||||
|
|
||||||
int m_draggingChecker; //when dragging a checker, the pip from which it came; -1 otherwise
|
|
||||||
double checkerX, checkerY;
|
|
||||||
|
|
||||||
void moveDone();
|
|
||||||
int rollDie();
|
|
||||||
void rollDice();
|
|
||||||
void changePlayer();
|
|
||||||
|
|
||||||
void error( QString string );
|
|
||||||
|
|
||||||
void computeMove( int *points, std::vector<int> &dice, std::vector<moveScore> &moveList, int player );
|
|
||||||
float pointsScore( int *points, int player );
|
|
||||||
bool moveChecker( Move move );
|
|
||||||
void moveComputer();
|
|
||||||
|
|
||||||
std::vector<int> diceInitial;
|
|
||||||
std::vector<int> diceLeft;
|
|
||||||
std::vector<Move> movesMade;
|
|
||||||
|
|
||||||
bool m_canBearOff [2];
|
|
||||||
bool diceRolled;
|
|
||||||
bool newGame;
|
|
||||||
|
|
||||||
int playerType [2];
|
|
||||||
bool autoRoll [2];
|
|
||||||
|
|
||||||
void definePoints();
|
|
||||||
int checkerHit( const QPoint &pos );
|
|
||||||
QRect cellRect[28];
|
|
||||||
QPoint checkerPosAllowed[28][5]; // allowed checker positions
|
|
||||||
//only display 5 checkers on each pip.
|
|
||||||
QRect dieRect [2]; //where the dice are
|
|
||||||
|
|
||||||
QPoint checkerPos; // current checker position
|
|
||||||
QPoint checkerPosInitial; // checker position before beginning move
|
|
||||||
int PointCount [28]; //number of checkers on each pip
|
|
||||||
int initialPointCount [28];
|
|
||||||
int staticPointCount [28]; //this is what we draw
|
|
||||||
|
|
||||||
QColor bgColor [6];
|
|
||||||
QBrush bgBrush [6];
|
|
||||||
|
|
||||||
int m_activePlayer; //players are 0 and 1
|
|
||||||
inline int activePlayerSign() { return ( 2 * m_activePlayer - 1 ) ; } //their signs are -1 and 1
|
|
||||||
|
|
||||||
int minDieValue( std::vector<int> &dice );
|
|
||||||
int maxDieValue( std::vector<int> &dice );
|
|
||||||
std::vector<int>::iterator minDie( std::vector<int> &dice );
|
|
||||||
std::vector<int>::iterator maxDie( std::vector<int> &dice );
|
|
||||||
|
|
||||||
QTimer *m_ClickTimer;
|
|
||||||
bool m_ClickTimeout;
|
|
||||||
bool checkerBeingDragged;
|
|
||||||
bool m_clicked; //button pressed down
|
|
||||||
|
|
||||||
int maxMovePossible;
|
|
||||||
|
|
||||||
float rand1, rand2, rand3, rand4;
|
|
||||||
|
|
||||||
bool isValidSingleMove( int *points, Move move );
|
|
||||||
bool isValidTotalMove( int *startpoints, std::vector<Move> &move, int maxMovePossible );
|
|
||||||
bool movePossible( int *points, std::vector<int> &dice, int player );
|
|
||||||
bool canBearOff( int *points, int player );
|
|
||||||
int getMaxMovePossible( int *startpoints, std::vector<int> &dice, int player );
|
|
||||||
int updateTemps( int *oldPoints, int *newPoints, std::vector<int> &oldDice, std::vector<int> &newDice, int startPoint, std::vector<int>::iterator &die, int player );
|
|
||||||
void pushMove( int *newPoints, std::vector<Move> &move, std::vector<moveScore> &list );
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //BGBOARD_H
|
|
||||||
|
|
||||||
|
|
|
@ -1,145 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "bgwidget.h"
|
|
||||||
#include "bgwindow.h"
|
|
||||||
#include "bgboard.h"
|
|
||||||
#include "optionsdlg.h"
|
|
||||||
|
|
||||||
BgWidget::BgWidget()
|
|
||||||
{
|
|
||||||
bgBoard = new BgBoard;
|
|
||||||
|
|
||||||
connect( bgBoard, SIGNAL( gameOver( int ) ), this, SLOT( changeScore( int ) ) );
|
|
||||||
connect( bgBoard, SIGNAL( gameOver( int ) ), this, SLOT( newGame() ) );
|
|
||||||
|
|
||||||
for ( int i = 0; i < 2; ++i ) {
|
|
||||||
score[ i ] = 0;
|
|
||||||
name[ i ] = tr( "Player ") + QString::number( i + 1 ) ;
|
|
||||||
nameLabel[ i ] = new QLabel( name[ i ] );
|
|
||||||
scoreLabel[ i ] = new QLabel( QString::number( score[ i ] ) );
|
|
||||||
|
|
||||||
bgBoard->setAutoRoll( i, false );
|
|
||||||
bgBoard->setPlayerType( i, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
mainGroupBox = new QGroupBox;
|
|
||||||
QGridLayout *mainLayout = new QGridLayout;
|
|
||||||
|
|
||||||
gridGroupBox = new QGroupBox;
|
|
||||||
QGridLayout *layout = new QGridLayout;
|
|
||||||
|
|
||||||
layout->addWidget( nameLabel[0], 0, 0 );
|
|
||||||
layout->addWidget( nameLabel[1], 1, 0 );
|
|
||||||
layout->addWidget( scoreLabel[0], 0, 1 );
|
|
||||||
layout->addWidget( scoreLabel[1], 1, 1 );
|
|
||||||
|
|
||||||
mainLayout->addWidget(bgBoard,0,0,3,3);
|
|
||||||
mainLayout->addLayout(layout,5,1);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWidget::undo()
|
|
||||||
{
|
|
||||||
bgBoard->undo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWidget::newGame()
|
|
||||||
{
|
|
||||||
bgBoard->startNewGame();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWidget::changeScore( int points )
|
|
||||||
{//points may be positive or negative; if points > 0 current player has won and points added; if points < 0 current player lost, points added to opponent
|
|
||||||
int player = bgBoard->activePlayer();
|
|
||||||
if ( points > 0 ) {
|
|
||||||
score[ player ] += points;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
player = 1 - player;
|
|
||||||
score[ player ] -= points;
|
|
||||||
}
|
|
||||||
QString s = QString::number( score[ player ] );
|
|
||||||
scoreLabel[ player ]->setText(s);
|
|
||||||
|
|
||||||
QMessageBox::StandardButton reply;
|
|
||||||
|
|
||||||
reply = QMessageBox::information(this, tr("QBackgammon"), name[ player ]+tr( " wins!" ) );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWidget::hint()
|
|
||||||
{
|
|
||||||
bgBoard->hint();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWidget::options()
|
|
||||||
{
|
|
||||||
optionsDlg = new OptionsDlg( );
|
|
||||||
for ( int i = 0; i < 6; ++i ) {
|
|
||||||
optionsDlg->color[ i ] = bgBoard->getColor( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( int i = 0; i < 2; ++i ) {
|
|
||||||
optionsDlg->pLineEdit[ i ]->setText( name[ i ] );
|
|
||||||
optionsDlg->pComboBox[ i ]->setCurrentIndex( bgBoard->getPlayerType( i ) );
|
|
||||||
|
|
||||||
|
|
||||||
if ( bgBoard->getAutoRoll( i ) ) {
|
|
||||||
optionsDlg->autoRollCheckBox[ i ]->setCheckState( Qt::Checked );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
optionsDlg->autoRollCheckBox[ i ]->setCheckState( Qt::Unchecked );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ( optionsDlg->exec() ) {
|
|
||||||
QString str0 = optionsDlg->pLineEdit[ 0 ]->text();
|
|
||||||
nameLabel[ 0 ]->setText( str0 );
|
|
||||||
name[ 0 ] = str0;
|
|
||||||
QString str1 = optionsDlg->pLineEdit[ 1 ]->text();
|
|
||||||
nameLabel[ 1 ]->setText( str1 );
|
|
||||||
name[ 1 ] = str1;
|
|
||||||
|
|
||||||
for ( int i = 0; i < 6; ++i ) {
|
|
||||||
bgBoard->setColor( i, optionsDlg->color[ i ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( int i = 0; i < 2; ++i ) {
|
|
||||||
bgBoard->setPlayerType( i, optionsDlg->pComboBox[ i ]->currentIndex() );
|
|
||||||
|
|
||||||
if ( optionsDlg->autoRollCheckBox[ i ]->checkState() == Qt::Checked ) {
|
|
||||||
bgBoard->setAutoRoll( i, true );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bgBoard->setAutoRoll( i, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#ifndef BGWIDGET_H
|
|
||||||
#define BGWIDGET_H
|
|
||||||
|
|
||||||
#include <QFrame>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class BgBoard;
|
|
||||||
class QLabel;
|
|
||||||
class QLCDNumber;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class OptionsDlg;
|
|
||||||
class QColor;
|
|
||||||
|
|
||||||
class BgWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
BgWidget();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void undo();
|
|
||||||
void newGame();
|
|
||||||
void changeScore( int );
|
|
||||||
void hint();
|
|
||||||
void options();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void widget_undoCalled();
|
|
||||||
void widget_newGame();
|
|
||||||
void widget_hint();
|
|
||||||
|
|
||||||
private:
|
|
||||||
BgBoard *bgBoard;
|
|
||||||
QLabel *labela;
|
|
||||||
QLabel *labelb;
|
|
||||||
|
|
||||||
QString name [ 2];
|
|
||||||
QGroupBox *horizontalGroupBox;
|
|
||||||
|
|
||||||
QGroupBox *gridGroupBox;
|
|
||||||
QGroupBox *mainGroupBox;
|
|
||||||
QLabel *nameLabel [2];
|
|
||||||
|
|
||||||
QLabel *scoreLabel [2];
|
|
||||||
QLineEdit *lineEdits [2];
|
|
||||||
|
|
||||||
int score [2];
|
|
||||||
|
|
||||||
OptionsDlg *optionsDlg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BGWIDGET_H
|
|
||||||
|
|
|
@ -1,153 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "bgwindow.h"
|
|
||||||
#include "bgwidget.h"
|
|
||||||
|
|
||||||
BgWindow::BgWindow(QWidget* parent, Qt::WFlags flags)
|
|
||||||
: QMainWindow(parent, flags)
|
|
||||||
{
|
|
||||||
bgWidget = new BgWidget;
|
|
||||||
setCentralWidget( bgWidget );
|
|
||||||
|
|
||||||
createActions();
|
|
||||||
createMenus();
|
|
||||||
statusBar()->showMessage(tr("Ready"));
|
|
||||||
|
|
||||||
setWindowTitle(tr("QBackgammon"));
|
|
||||||
resize(600,600);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Destructor. */
|
|
||||||
BgWindow::~BgWindow()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::createActions()
|
|
||||||
{
|
|
||||||
newAct = new QAction( tr( "&New Game"), this );
|
|
||||||
newAct->setShortcut( tr( "Ctrl+O") );
|
|
||||||
undoAct = new QAction( tr( "&Undo" ), this );
|
|
||||||
undoAct->setShortcut( tr( "Ctrl+Z") );
|
|
||||||
resignAct = new QAction( tr( "Resign" ), this );
|
|
||||||
optionsAct = new QAction( tr( "Options" ), this );
|
|
||||||
hintAct = new QAction( tr( "Hint" ), this );
|
|
||||||
quitAct = new QAction( tr( "Quit" ), this );
|
|
||||||
aboutAct = new QAction( tr( "About" ), this );
|
|
||||||
|
|
||||||
connect( newAct, SIGNAL( triggered() ), this, SLOT(newGame() ) );
|
|
||||||
connect( undoAct, SIGNAL( triggered() ), bgWidget, SLOT( undo() ));
|
|
||||||
connect( resignAct, SIGNAL( triggered() ), this, SLOT( resign() ) );
|
|
||||||
connect( optionsAct, SIGNAL( triggered() ), bgWidget, SLOT( options() ) );
|
|
||||||
connect( hintAct, SIGNAL( triggered() ), bgWidget, SLOT( hint() ) );
|
|
||||||
connect( quitAct, SIGNAL( triggered() ), this, SLOT( quit() ) );
|
|
||||||
connect( aboutAct, SIGNAL( triggered() ), this, SLOT( about() ) );
|
|
||||||
connect( this, SIGNAL( newGameCalled() ), bgWidget, SLOT( newGame() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::createMenus()
|
|
||||||
{
|
|
||||||
fileMenu = new QMenu(tr("&File"), this );
|
|
||||||
fileMenu->addAction( newAct);
|
|
||||||
fileMenu->addAction( undoAct );
|
|
||||||
fileMenu->addAction( resignAct );
|
|
||||||
fileMenu->addAction( optionsAct );
|
|
||||||
fileMenu->addAction( hintAct );
|
|
||||||
fileMenu->addAction( quitAct );
|
|
||||||
fileMenu->addAction( aboutAct );
|
|
||||||
|
|
||||||
menuBar()->addMenu(fileMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::newGame()
|
|
||||||
{
|
|
||||||
//FIXME check to see if this is a brand new game first
|
|
||||||
QMessageBox::StandardButton reply;
|
|
||||||
reply = QMessageBox::question(this, tr("QBackgammon"),
|
|
||||||
tr("Are you sure you want to start a new game?\n"
|
|
||||||
"The current one will be lost."),
|
|
||||||
QMessageBox::Yes | QMessageBox::No );
|
|
||||||
if (reply == QMessageBox::Yes) {
|
|
||||||
bgWidget->newGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::undo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::resign()
|
|
||||||
{
|
|
||||||
QMessageBox::StandardButton reply;
|
|
||||||
reply = QMessageBox::question(this, tr("QBackgammon"),
|
|
||||||
tr("Are you sure you want to resign?"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No );
|
|
||||||
if ( reply == QMessageBox::Yes ) {
|
|
||||||
bgWidget->changeScore( -1 );
|
|
||||||
bgWidget->newGame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::quit()
|
|
||||||
{
|
|
||||||
QMessageBox::StandardButton reply;
|
|
||||||
reply = QMessageBox::question(this, tr("QBackgammon"),
|
|
||||||
tr("Are you sure you want to quit?"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No );
|
|
||||||
if ( reply == QMessageBox::Yes ) {
|
|
||||||
emit callQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::about()
|
|
||||||
{
|
|
||||||
QMessageBox::StandardButton reply;
|
|
||||||
reply = QMessageBox::information( this, tr( "QBackgammon" ),
|
|
||||||
tr("QBackgammon\n(C) Daren Sawkey 2006\ndaren@sawkey.net\nReleased under GPL"),
|
|
||||||
QMessageBox::Ok );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::show()
|
|
||||||
{
|
|
||||||
|
|
||||||
if(!this->isVisible()) {
|
|
||||||
QMainWindow::show();
|
|
||||||
} else {
|
|
||||||
QMainWindow::activateWindow();
|
|
||||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
|
||||||
QMainWindow::raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BgWindow::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#ifndef BGWINDOW_H
|
|
||||||
#define BGWINDOW_H
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
class QAction;
|
|
||||||
class QLabel;
|
|
||||||
class QMenu;
|
|
||||||
class QTextEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class BgWidget;
|
|
||||||
|
|
||||||
class BgWindow : public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//BgWindow();
|
|
||||||
|
|
||||||
/** Default Constructor */
|
|
||||||
BgWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
||||||
|
|
||||||
/** Destructor. */
|
|
||||||
~BgWindow();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void undoCalled();
|
|
||||||
void newGameCalled();
|
|
||||||
void WchangeScore();
|
|
||||||
void callQuit();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/** Called when this dialog is to be displayed */
|
|
||||||
void show();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void newGame();
|
|
||||||
void undo();
|
|
||||||
void quit();
|
|
||||||
void resign();
|
|
||||||
void about();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void createActions();
|
|
||||||
void createMenus();
|
|
||||||
void updateActions();
|
|
||||||
|
|
||||||
BgWidget *bgWidget;
|
|
||||||
|
|
||||||
QAction *newAct;
|
|
||||||
QAction *undoAct;
|
|
||||||
QAction *resignAct;
|
|
||||||
QAction *hintAct;
|
|
||||||
QAction *quitAct;
|
|
||||||
QAction *optionsAct;
|
|
||||||
QAction *aboutAct;
|
|
||||||
|
|
||||||
QMenu *fileMenu;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,142 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "optionsdlg.h"
|
|
||||||
|
|
||||||
OptionsDlg::OptionsDlg( QWidget *parent )
|
|
||||||
: QDialog( parent )
|
|
||||||
{
|
|
||||||
rowLayout[ 0 ] = new QHBoxLayout;
|
|
||||||
rowLayout[ 1 ] = new QHBoxLayout;
|
|
||||||
rowLayout[ 2 ] = new QHBoxLayout;
|
|
||||||
rowLayout[ 3 ] = new QHBoxLayout;
|
|
||||||
|
|
||||||
for ( int i = 0; i < 2; ++i ) {
|
|
||||||
QString str = "Player " + QString::number( i + 1 );
|
|
||||||
pGroupBox[ i ] = new QGroupBox( str );
|
|
||||||
pLineEdit[ i ] = new QLineEdit;
|
|
||||||
pColorButton[ i ] = new QPushButton( tr( "Color" ) );
|
|
||||||
pComboBox[ i ] = new QComboBox;
|
|
||||||
pComboBox[ i ]->addItem( tr( "Human" ) );
|
|
||||||
pComboBox[ i ]->addItem( tr( "Computer" ) );
|
|
||||||
autoRollCheckBox[ i ] = new QCheckBox( tr( "auto roll" ) );
|
|
||||||
|
|
||||||
rowLayout[ i ]->addWidget( pLineEdit[ i ] );
|
|
||||||
rowLayout[ i ]->addWidget( pColorButton[ i ] );
|
|
||||||
rowLayout[ i ]->addWidget( pComboBox[ i ] );
|
|
||||||
rowLayout[ i ]->addWidget( autoRollCheckBox[ i ] );
|
|
||||||
pGroupBox[ i ]->setLayout( rowLayout[ i ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
colorGroupBox = new QGroupBox( tr( "Colors" ) );
|
|
||||||
colorLabel = new QLabel( tr( "Colors:" ) );
|
|
||||||
color1Button = new QPushButton( tr( "Points (1)" ) );
|
|
||||||
color2Button = new QPushButton( tr( "Points (2)" ) );
|
|
||||||
color3Button = new QPushButton( tr( "Board" ) );
|
|
||||||
color4Button = new QPushButton( tr( "Case" ) );
|
|
||||||
|
|
||||||
rowLayout[ 2 ]->addWidget( color1Button );
|
|
||||||
rowLayout[ 2 ]->addWidget( color2Button );
|
|
||||||
rowLayout[ 2 ]->addWidget( color3Button );
|
|
||||||
rowLayout[ 2 ]->addWidget( color4Button );
|
|
||||||
colorGroupBox->setLayout( rowLayout[ 2 ] );
|
|
||||||
|
|
||||||
|
|
||||||
okButton = new QPushButton( tr( "Ok" ) );
|
|
||||||
cancelButton = new QPushButton( tr( "Cancel" ) );
|
|
||||||
okButton->setDefault( true ); //FIXME why doesn't this work?
|
|
||||||
okButton->setFocus();
|
|
||||||
|
|
||||||
rowLayout[ 3 ]->addStretch( 1 );
|
|
||||||
rowLayout[ 3 ]->addWidget( okButton );
|
|
||||||
rowLayout[ 3 ]->addWidget( cancelButton );
|
|
||||||
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
|
|
||||||
mainLayout->addWidget( pGroupBox[ 0 ] );
|
|
||||||
mainLayout->addWidget( pGroupBox[ 1 ] );
|
|
||||||
mainLayout->addWidget( colorGroupBox );
|
|
||||||
mainLayout->addLayout( rowLayout[ 3 ] );
|
|
||||||
|
|
||||||
setLayout( mainLayout );
|
|
||||||
|
|
||||||
connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
|
|
||||||
connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
|
|
||||||
connect( pColorButton[ 0 ], SIGNAL( clicked() ), this, SLOT( setColor0() ) );
|
|
||||||
connect( pColorButton[ 1 ], SIGNAL( clicked() ), this, SLOT( setColor1() ) );
|
|
||||||
connect( color1Button, SIGNAL( clicked() ), this, SLOT( setColor2() ) );
|
|
||||||
connect( color2Button, SIGNAL( clicked() ), this, SLOT( setColor3() ) );
|
|
||||||
connect( color3Button, SIGNAL( clicked() ), this, SLOT( setColor4() ) );
|
|
||||||
connect( color4Button, SIGNAL( clicked() ), this, SLOT( setColor5() ) );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OptionsDlg::~OptionsDlg()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor0()//FIXME how to make these functions into a single 1? (problem, how to connect the pushbuttons)
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 0 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 0 ] = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor1()
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 1 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 1 ] = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor2()
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 2 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 2 ] = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor3()
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 3 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 3 ] = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor4()
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 4 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 4 ] = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDlg::setColor5()
|
|
||||||
{
|
|
||||||
QColor newColor = QColorDialog::getColor( color[ 5 ], this);
|
|
||||||
if ( newColor.isValid() )
|
|
||||||
color[ 5 ] = newColor;
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
/****************************************************************
|
|
||||||
* RetroShare is distributed under the following license:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007, RetroShare Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#ifndef OPTIONSDLG_H
|
|
||||||
#define OPTIONSDLG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QGroupBox;
|
|
||||||
class QPushButton;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QComboBox;
|
|
||||||
class QCheckBox;
|
|
||||||
|
|
||||||
class OptionsDlg : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
OptionsDlg( QWidget *parent = 0 );
|
|
||||||
|
|
||||||
~OptionsDlg();
|
|
||||||
QLineEdit *pLineEdit [2];
|
|
||||||
|
|
||||||
QColor color [6];
|
|
||||||
QComboBox *pComboBox [2];
|
|
||||||
|
|
||||||
QCheckBox *autoRollCheckBox [2];
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setColor0();
|
|
||||||
void setColor1();
|
|
||||||
void setColor2();
|
|
||||||
void setColor3();
|
|
||||||
void setColor4();
|
|
||||||
void setColor5();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QGroupBox *pGroupBox [2];
|
|
||||||
QGroupBox *colorGroupBox;
|
|
||||||
|
|
||||||
QPushButton *pColorButton [2];
|
|
||||||
|
|
||||||
QLabel *colorLabel;
|
|
||||||
QPushButton *color1Button;
|
|
||||||
QPushButton *color2Button;
|
|
||||||
QPushButton *color3Button;
|
|
||||||
QPushButton *color4Button;
|
|
||||||
|
|
||||||
|
|
||||||
QPushButton *okButton;
|
|
||||||
QPushButton *cancelButton;
|
|
||||||
|
|
||||||
QHBoxLayout *rowLayout [4];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue