|
|
@ -42,9 +42,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
Knights::Knights(TDECmdLineArgs *Args, TQWidget *parent, const char *name) : TDEMainWindow(parent, name)
|
|
|
|
Knights::Knights(TDECmdLineArgs *Args, TQWidget *parent, const char *name) : TDEMainWindow(parent, name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
InitAll = TRUE;
|
|
|
|
InitAll = true;
|
|
|
|
ResizeFlag = TRUE;
|
|
|
|
ResizeFlag = true;
|
|
|
|
Minimized = FALSE;
|
|
|
|
Minimized = false;
|
|
|
|
args = Args;
|
|
|
|
args = Args;
|
|
|
|
SplashScreen = NULL;
|
|
|
|
SplashScreen = NULL;
|
|
|
|
setFocusPolicy( TQWidget::ClickFocus );
|
|
|
|
setFocusPolicy( TQWidget::ClickFocus );
|
|
|
@ -128,7 +128,7 @@ void Knights::aboutToQuit(void)
|
|
|
|
TQDir userdir( TQDir::homeDirPath(), "game.[0-9][0-9]*;log.[0-9][0-9]*" );
|
|
|
|
TQDir userdir( TQDir::homeDirPath(), "game.[0-9][0-9]*;log.[0-9][0-9]*" );
|
|
|
|
for ( int i = 0; i < userdir.count(); i++ )
|
|
|
|
for ( int i = 0; i < userdir.count(); i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
userdir.remove( userdir.absFilePath(userdir[i]), TRUE );
|
|
|
|
userdir.remove( userdir.absFilePath(userdir[i]), true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,7 +153,7 @@ void Knights::KillAll(void)
|
|
|
|
delete MainFrame;
|
|
|
|
delete MainFrame;
|
|
|
|
delete myAccel;
|
|
|
|
delete myAccel;
|
|
|
|
delete Resource;
|
|
|
|
delete Resource;
|
|
|
|
InitAll = TRUE;
|
|
|
|
InitAll = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -169,7 +169,7 @@ bool Knights::init( void )
|
|
|
|
BirthAll();
|
|
|
|
BirthAll();
|
|
|
|
SelectTheme(-1,-1);
|
|
|
|
SelectTheme(-1,-1);
|
|
|
|
Resource->setAudio();
|
|
|
|
Resource->setAudio();
|
|
|
|
ResizeFlag = FALSE;
|
|
|
|
ResizeFlag = false;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Connect Accelerators
|
|
|
|
Connect Accelerators
|
|
|
@ -201,7 +201,7 @@ bool Knights::init( void )
|
|
|
|
|
|
|
|
|
|
|
|
/* Configure self */
|
|
|
|
/* Configure self */
|
|
|
|
setCentralWidget( MainFrame );
|
|
|
|
setCentralWidget( MainFrame );
|
|
|
|
InitAll = FALSE;
|
|
|
|
InitAll = false;
|
|
|
|
resizeMainFrame();
|
|
|
|
resizeMainFrame();
|
|
|
|
show();
|
|
|
|
show();
|
|
|
|
setStatusBar( READY );
|
|
|
|
setStatusBar( READY );
|
|
|
@ -220,7 +220,7 @@ bool Knights::init( void )
|
|
|
|
delete Wizard;
|
|
|
|
delete Wizard;
|
|
|
|
resizeMainFrame();
|
|
|
|
resizeMainFrame();
|
|
|
|
/* if( !Resource->Accepted_License )
|
|
|
|
/* if( !Resource->Accepted_License )
|
|
|
|
return FALSE;*/
|
|
|
|
return false;*/
|
|
|
|
Resource->Config_Version = CONFIG_VERSION;
|
|
|
|
Resource->Config_Version = CONFIG_VERSION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -250,7 +250,7 @@ bool Knights::init( void )
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -262,45 +262,45 @@ void Knights::initMenus( void )
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
matchMenu menu
|
|
|
|
matchMenu menu
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
matchMenu->setCheckable(TRUE);
|
|
|
|
matchMenu->setCheckable(true);
|
|
|
|
// MENU_DRAW
|
|
|
|
// MENU_DRAW
|
|
|
|
matchMenu->insertItem( i18n( "&Draw" ), drawMenu, MENU_DRAW );
|
|
|
|
matchMenu->insertItem( i18n( "&Draw" ), drawMenu, MENU_DRAW );
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, false );
|
|
|
|
// MENU_RETRACT
|
|
|
|
// MENU_RETRACT
|
|
|
|
matchMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("edit-undo"), TDEIcon::Small ) ),
|
|
|
|
matchMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("edit-undo"), TDEIcon::Small ) ),
|
|
|
|
i18n( "&Retract Move" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_RETRACT );
|
|
|
|
i18n( "&Retract Move" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_RETRACT );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_RETRACT, i18n( "Select this to retract your last move." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_RETRACT, i18n( "Select this to retract your last move." ) );
|
|
|
|
// MENU_RESIGN
|
|
|
|
// MENU_RESIGN
|
|
|
|
matchMenu->insertItem( i18n( "Resign" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_RESIGN );
|
|
|
|
matchMenu->insertItem( i18n( "Resign" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_RESIGN );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_RESIGN, i18n( "Use this to concede the match to your opponent." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_RESIGN, i18n( "Use this to concede the match to your opponent." ) );
|
|
|
|
// MENU_CALL_FLAG
|
|
|
|
// MENU_CALL_FLAG
|
|
|
|
matchMenu->insertItem( i18n( "&Call Flag" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_CALL_FLAG );
|
|
|
|
matchMenu->insertItem( i18n( "&Call Flag" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_CALL_FLAG );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_CALL_FLAG, i18n( "Use this to declare the match over, due to your opponent being out of time." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_CALL_FLAG, i18n( "Use this to declare the match over, due to your opponent being out of time." ) );
|
|
|
|
// MENU_HINT
|
|
|
|
// MENU_HINT
|
|
|
|
matchMenu->insertItem( i18n( "&Hint" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_HINT );
|
|
|
|
matchMenu->insertItem( i18n( "&Hint" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_HINT );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_HINT, i18n( "This will ask your opponent for a hint." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_HINT, i18n( "This will ask your opponent for a hint." ) );
|
|
|
|
// MENU_MOVE_NOW
|
|
|
|
// MENU_MOVE_NOW
|
|
|
|
matchMenu->insertItem( i18n( "Move &Now" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_MOVE_NOW );
|
|
|
|
matchMenu->insertItem( i18n( "Move &Now" ), Core, TQ_SLOT(matchMenu(int)), 0, MENU_MOVE_NOW );
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_MOVE_NOW, i18n( "Clicking this option will force your opponent to move immediately." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_MOVE_NOW, i18n( "Clicking this option will force your opponent to move immediately." ) );
|
|
|
|
// MENU_ORIENTATION
|
|
|
|
// MENU_ORIENTATION
|
|
|
|
matchMenu->insertItem( i18n( "&Flip View" ), Core, TQ_SLOT(matchMenu(int)), Key_F2, MENU_ORIENTATION );
|
|
|
|
matchMenu->insertItem( i18n( "&Flip View" ), Core, TQ_SLOT(matchMenu(int)), Key_F2, MENU_ORIENTATION );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_ORIENTATION, i18n( "This will reverse the chessboard's orientation by 180 degrees." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_ORIENTATION, i18n( "This will reverse the chessboard's orientation by 180 degrees." ) );
|
|
|
|
// MENU_PONDER
|
|
|
|
// MENU_PONDER
|
|
|
|
matchMenu->insertItem( i18n( "&Ponder" ), this, TQ_SLOT(Settings(int)), 0, MENU_PONDER );
|
|
|
|
matchMenu->insertItem( i18n( "&Ponder" ), this, TQ_SLOT(Settings(int)), 0, MENU_PONDER );
|
|
|
|
matchMenu->setItemChecked( MENU_PONDER, Resource->OPTION_Ponder );
|
|
|
|
matchMenu->setItemChecked( MENU_PONDER, Resource->OPTION_Ponder );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_PONDER, i18n( "This toggles your opponent's ability to think while it's your turn." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_PONDER, i18n( "This toggles your opponent's ability to think while it's your turn." ) );
|
|
|
|
matchMenu->insertSeparator();
|
|
|
|
matchMenu->insertSeparator();
|
|
|
|
// MENU_PAUSE
|
|
|
|
// MENU_PAUSE
|
|
|
|
matchMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("media-playback-pause"), TDEIcon::Small ) ),
|
|
|
|
matchMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("media-playback-pause"), TDEIcon::Small ) ),
|
|
|
|
i18n( "Pause" ), this, TQ_SLOT( Settings(int) ), Key_F12, MENU_PAUSE );
|
|
|
|
i18n( "Pause" ), this, TQ_SLOT( Settings(int) ), Key_F12, MENU_PAUSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, false );
|
|
|
|
matchMenu->setWhatsThis( MENU_PAUSE, i18n( "Select this to pause the clock for this match." ) );
|
|
|
|
matchMenu->setWhatsThis( MENU_PAUSE, i18n( "Select this to pause the clock for this match." ) );
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
drawMenu menu
|
|
|
|
drawMenu menu
|
|
|
@ -332,12 +332,12 @@ void Knights::initMenus( void )
|
|
|
|
// MENU_SAVE
|
|
|
|
// MENU_SAVE
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-save"), TDEIcon::Small ) ),
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-save"), TDEIcon::Small ) ),
|
|
|
|
i18n( "&Save Match" ), this, TQ_SLOT( SaveGame() ), CTRL+Key_S, MENU_SAVE );
|
|
|
|
i18n( "&Save Match" ), this, TQ_SLOT( SaveGame() ), CTRL+Key_S, MENU_SAVE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, false );
|
|
|
|
fileMenu->setWhatsThis( MENU_SAVE, i18n( "The Save command will allow you to store a copy of your current match for later use." ) );
|
|
|
|
fileMenu->setWhatsThis( MENU_SAVE, i18n( "The Save command will allow you to store a copy of your current match for later use." ) );
|
|
|
|
// MENU_SAVEAS
|
|
|
|
// MENU_SAVEAS
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-save"), TDEIcon::Small ) ),
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-save"), TDEIcon::Small ) ),
|
|
|
|
i18n( "Save Match &As..." ), this, TQ_SLOT( SaveGameAs() ), CTRL+Key_A, MENU_SAVEAS );
|
|
|
|
i18n( "Save Match &As..." ), this, TQ_SLOT( SaveGameAs() ), CTRL+Key_A, MENU_SAVEAS );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, false );
|
|
|
|
fileMenu->setWhatsThis( MENU_SAVEAS, i18n( "The Save command will allow you to store a copy of your current match for later use." ) );
|
|
|
|
fileMenu->setWhatsThis( MENU_SAVEAS, i18n( "The Save command will allow you to store a copy of your current match for later use." ) );
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
// MENU_CONNECT
|
|
|
|
// MENU_CONNECT
|
|
|
@ -348,17 +348,17 @@ void Knights::initMenus( void )
|
|
|
|
// MENU_PRINT
|
|
|
|
// MENU_PRINT
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-print"), TDEIcon::Small ) ),
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("document-print"), TDEIcon::Small ) ),
|
|
|
|
i18n( "&Print Notation..." ), Core, TQ_SLOT( print() ), CTRL+Key_P, MENU_PRINT );
|
|
|
|
i18n( "&Print Notation..." ), Core, TQ_SLOT( print() ), CTRL+Key_P, MENU_PRINT );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, false );
|
|
|
|
fileMenu->setWhatsThis( MENU_PRINT, i18n( "The Print command will allow you to print this game's notation on your printer." ) );
|
|
|
|
fileMenu->setWhatsThis( MENU_PRINT, i18n( "The Print command will allow you to print this game's notation on your printer." ) );
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
// MENU_CLOSE
|
|
|
|
// MENU_CLOSE
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("window-close"), TDEIcon::Small ) ),
|
|
|
|
fileMenu->insertItem( TQIconSet( Resource->LoadIcon( TQString("window-close"), TDEIcon::Small ) ),
|
|
|
|
i18n( "&Close Match" ), Core, TQ_SLOT( clearMatch() ), CTRL+Key_W, MENU_CLOSE );
|
|
|
|
i18n( "&Close Match" ), Core, TQ_SLOT( clearMatch() ), CTRL+Key_W, MENU_CLOSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, false );
|
|
|
|
fileMenu->setWhatsThis( MENU_CLOSE, i18n( "This command removes the current match." ) );
|
|
|
|
fileMenu->setWhatsThis( MENU_CLOSE, i18n( "This command removes the current match." ) );
|
|
|
|
// MENU_CLOSEALL
|
|
|
|
// MENU_CLOSEALL
|
|
|
|
fileMenu->insertItem( i18n( "Close All" ), Core, TQ_SLOT( clearAll() ), 0, MENU_CLOSEALL );
|
|
|
|
fileMenu->insertItem( i18n( "Close All" ), Core, TQ_SLOT( clearAll() ), 0, MENU_CLOSEALL );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, false );
|
|
|
|
fileMenu->setWhatsThis( MENU_CLOSEALL, i18n( "This command will remove all matches that are currently loaded." ) );
|
|
|
|
fileMenu->setWhatsThis( MENU_CLOSEALL, i18n( "This command will remove all matches that are currently loaded." ) );
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
fileMenu->insertSeparator();
|
|
|
|
// MENU_QUIT
|
|
|
|
// MENU_QUIT
|
|
|
@ -382,7 +382,7 @@ void Knights::initMenus( void )
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
tutorialMenu menu
|
|
|
|
tutorialMenu menu
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
tutorialMenu->setCheckable(TRUE);
|
|
|
|
tutorialMenu->setCheckable(true);
|
|
|
|
// MENU_OPEN_TUTORIAL
|
|
|
|
// MENU_OPEN_TUTORIAL
|
|
|
|
tutorialMenu->insertItem( i18n( "Begin a Tutorial" ), this, TQ_SLOT(Settings(int)), 0, MENU_OPEN_TUTORIAL );
|
|
|
|
tutorialMenu->insertItem( i18n( "Begin a Tutorial" ), this, TQ_SLOT(Settings(int)), 0, MENU_OPEN_TUTORIAL );
|
|
|
|
// tutorialMenu->setWhatsThis( MENU_OPEN_TUTORIAL, i18n( "" ) );
|
|
|
|
// tutorialMenu->setWhatsThis( MENU_OPEN_TUTORIAL, i18n( "" ) );
|
|
|
@ -429,11 +429,11 @@ void Knights::resizeMainFrame(void)
|
|
|
|
/* enable or disable games in the menu */
|
|
|
|
/* enable or disable games in the menu */
|
|
|
|
if( Resource->servers.count() )
|
|
|
|
if( Resource->servers.count() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileMenu->setItemEnabled( MENU_CONNECT, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CONNECT, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileMenu->setItemEnabled( MENU_CONNECT, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CONNECT, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
@ -446,7 +446,7 @@ bool Knights::event( TQEvent *e )
|
|
|
|
if( e->type() == EVENT_Del_IO_Net )
|
|
|
|
if( e->type() == EVENT_Del_IO_Net )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
netConnect();
|
|
|
|
netConnect();
|
|
|
|
return TRUE;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TDEMainWindow::event( e );
|
|
|
|
return TDEMainWindow::event( e );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -525,7 +525,7 @@ void Knights::hideEvent( TQHideEvent* )
|
|
|
|
if( !Resource->OPTION_Pause_On_Minimize )
|
|
|
|
if( !Resource->OPTION_Pause_On_Minimize )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
Core->matchMenu( MENU_PAUSEALL );
|
|
|
|
Core->matchMenu( MENU_PAUSEALL );
|
|
|
|
Minimized = TRUE;
|
|
|
|
Minimized = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -537,7 +537,7 @@ void Knights::showEvent( TQShowEvent* )
|
|
|
|
if( !Minimized )
|
|
|
|
if( !Minimized )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
Core->matchMenu( MENU_PAUSEALL );
|
|
|
|
Core->matchMenu( MENU_PAUSEALL );
|
|
|
|
Minimized = FALSE;
|
|
|
|
Minimized = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -700,14 +700,14 @@ void Knights::setClocks( void )
|
|
|
|
blackTimeLabel->setText( Core->clock( BLACK ) );
|
|
|
|
blackTimeLabel->setText( Core->clock( BLACK ) );
|
|
|
|
if( Core->flag( WHITE ) )
|
|
|
|
if( Core->flag( WHITE ) )
|
|
|
|
if( Core->blackInput() == PLAYERLOCAL )
|
|
|
|
if( Core->blackInput() == PLAYERLOCAL )
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, true );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, false );
|
|
|
|
if( Core->flag( BLACK ) )
|
|
|
|
if( Core->flag( BLACK ) )
|
|
|
|
if( Core->whiteInput() == PLAYERLOCAL )
|
|
|
|
if( Core->whiteInput() == PLAYERLOCAL )
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, true );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_CALL_FLAG, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -731,24 +731,24 @@ void Knights::setNotation( void )
|
|
|
|
if( list == NULL )
|
|
|
|
if( list == NULL )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Disable Save & Print Functions */
|
|
|
|
/* Disable Save & Print Functions */
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, false );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, false );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, false );
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( Core->modified() )
|
|
|
|
if( Core->modified() )
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, true );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVE, false );
|
|
|
|
/* Core->onMove is called before it is updated by Match->slot_Move. Because of this, the following
|
|
|
|
/* Core->onMove is called before it is updated by Match->slot_Move. Because of this, the following
|
|
|
|
if statement checks for the wrong player's turn. On purpose */
|
|
|
|
if statement checks for the wrong player's turn. On purpose */
|
|
|
|
if( ( Core->inputOnMove() == PLAYERLOCAL ) && ( Core->inputOnMove(TRUE) == PLAYERPC ) && list->count() )
|
|
|
|
if( ( Core->inputOnMove() == PLAYERLOCAL ) && ( Core->inputOnMove(true) == PLAYERPC ) && list->count() )
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, true );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RETRACT, false );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_SAVEAS, true );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_PRINT, true );
|
|
|
|
|
|
|
|
|
|
|
|
/* Create the List */
|
|
|
|
/* Create the List */
|
|
|
|
for( IT = list->begin(); IT != list->end(); ++IT )
|
|
|
|
for( IT = list->begin(); IT != list->end(); ++IT )
|
|
|
@ -796,25 +796,25 @@ void Knights::initMatch( void )
|
|
|
|
/* Are there any players? ( ie - is this a match or a null? */
|
|
|
|
/* Are there any players? ( ie - is this a match or a null? */
|
|
|
|
if( ( Core->whiteInput() == Null ) || ( Core->blackInput() == Null ) )
|
|
|
|
if( ( Core->whiteInput() == Null ) || ( Core->blackInput() == Null ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, false );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, FALSE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, false );
|
|
|
|
whiteTimeLabel->setText( "" );
|
|
|
|
whiteTimeLabel->setText( "" );
|
|
|
|
blackTimeLabel->setText( "" );
|
|
|
|
blackTimeLabel->setText( "" );
|
|
|
|
setStatusBar( READY );
|
|
|
|
setStatusBar( READY );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSE, true );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, TRUE );
|
|
|
|
fileMenu->setItemEnabled( MENU_CLOSEALL, true );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_ORIENTATION, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Is there a local player? */
|
|
|
|
/* Is there a local player? */
|
|
|
|
if( ( Core->whiteInput() == PLAYERLOCAL ) || ( Core->blackInput() == PLAYERLOCAL ) )
|
|
|
|
if( ( Core->whiteInput() == PLAYERLOCAL ) || ( Core->blackInput() == PLAYERLOCAL ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, true );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, true );
|
|
|
|
/* Is there also a PC player? */
|
|
|
|
/* Is there also a PC player? */
|
|
|
|
if( ( Core->whiteInput() == PLAYERPC ) || ( Core->blackInput() == PLAYERPC ) )
|
|
|
|
if( ( Core->whiteInput() == PLAYERPC ) || ( Core->blackInput() == PLAYERPC ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -822,23 +822,23 @@ void Knights::initMatch( void )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_DRAW, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_RESIGN, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Is there a PC player? */
|
|
|
|
/* Is there a PC player? */
|
|
|
|
if( ( Core->whiteInput() == PLAYERPC ) || ( Core->blackInput() == PLAYERPC ) )
|
|
|
|
if( ( Core->whiteInput() == PLAYERPC ) || ( Core->blackInput() == PLAYERPC ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, true );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, true );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, true );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, TRUE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_MOVE_NOW, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_HINT, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PONDER, false );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, FALSE );
|
|
|
|
matchMenu->setItemEnabled( MENU_PAUSE, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Is there a TCP player? */
|
|
|
|
/* Is there a TCP player? */
|
|
|
|
// if( ( Core->whiteInput() == PLAYERTCP ) || ( Core->blackInput() == PLAYERTCP ) )
|
|
|
|
// if( ( Core->whiteInput() == PLAYERTCP ) || ( Core->blackInput() == PLAYERTCP ) )
|
|
|
@ -914,7 +914,7 @@ void Knights::newMatch( void )
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
void Knights::openKeyBindingDialog( void )
|
|
|
|
void Knights::openKeyBindingDialog( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KKeyDialog::configureKeys( myAccel, TRUE, this );
|
|
|
|
KKeyDialog::configureKeys( myAccel, true, this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -957,15 +957,15 @@ void Knights::Settings(int opt)
|
|
|
|
bool Knights::SaveGame( void )
|
|
|
|
bool Knights::SaveGame( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* We use 'Null' to indicate the current match */
|
|
|
|
/* We use 'Null' to indicate the current match */
|
|
|
|
return Core->save( Null, FALSE, FALSE );
|
|
|
|
return Core->save( Null, false, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool Knights::SaveGamePrompt( void )
|
|
|
|
bool Knights::SaveGamePrompt( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Core->save( Null, TRUE, FALSE );
|
|
|
|
return Core->save( Null, true, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool Knights::SaveGameAs( void )
|
|
|
|
bool Knights::SaveGameAs( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Core->save( Null, FALSE, TRUE );
|
|
|
|
return Core->save( Null, false, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -995,8 +995,8 @@ void Knights::boardSmaller( void )
|
|
|
|
///////////////////////////////////////
|
|
|
|
///////////////////////////////////////
|
|
|
|
void Knights::installThemes( void )
|
|
|
|
void Knights::installThemes( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool localFlag(FALSE);
|
|
|
|
bool localFlag(false);
|
|
|
|
bool installError(FALSE);
|
|
|
|
bool installError(false);
|
|
|
|
unsigned int loop;
|
|
|
|
unsigned int loop;
|
|
|
|
TQString allerror;
|
|
|
|
TQString allerror;
|
|
|
|
TQString fileFilter( "KB* KC* KS*|" );
|
|
|
|
TQString fileFilter( "KB* KC* KS*|" );
|
|
|
@ -1018,13 +1018,13 @@ void Knights::installThemes( void )
|
|
|
|
if( !TDEIO::NetAccess::copy( files[loop], KURL( TQString( TQDir::homeDirPath() + "/.knights/" + files[loop].filename() ) ) ) )
|
|
|
|
if( !TDEIO::NetAccess::copy( files[loop], KURL( TQString( TQDir::homeDirPath() + "/.knights/" + files[loop].filename() ) ) ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Nope, can't copy it anywhere */
|
|
|
|
/* Nope, can't copy it anywhere */
|
|
|
|
installError = TRUE;
|
|
|
|
installError = true;
|
|
|
|
allerror += "\n\n" + TQString( TQDir::homeDirPath() + "/.knights/"
|
|
|
|
allerror += "\n\n" + TQString( TQDir::homeDirPath() + "/.knights/"
|
|
|
|
+ files[loop].filename() ) + " - " + TDEIO::NetAccess::lastErrorString();
|
|
|
|
+ files[loop].filename() ) + " - " + TDEIO::NetAccess::lastErrorString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
localFlag = TRUE;
|
|
|
|
localFlag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|