2
* mainwindow.cpp - qGo's main window
7
#include "mainwindow.h"
8
#include "mainwidget.h"
13
#include "newgame_gui.h"
14
#include "newlocalgame_gui.h"
15
#include "gameinfo_gui.h"
16
#include "interfacehandler.h"
17
#include "komispinbox.h"
18
#include "nthmove_gui.h"
19
#include "normaltools_gui.h"
20
#include "parserdefs.h"
23
#include "qnewgamedlg.h"
24
#include "qgo_interface.h"
28
#include <qstatusbar.h>
29
#include <qmessagebox.h>
30
#include <qapplication.h>
32
#include <qwhatsthis.h>
33
#include <qplatinumstyle.h>
34
#include <qmotifstyle.h>
35
#include <qmotifplusstyle.h>
36
#include <qcdestyle.h>
37
#include <qsgistyle.h>
38
#include <qfiledialog.h>
39
#include <qcheckbox.h>
40
#include <qsplitter.h>
41
//#include <qmultilineedit.h>
42
#include <qtextedit.h>
43
#include <qpushbutton.h>
44
#include <qradiobutton.h>
45
#include <qcombobox.h>
47
#include <qlineedit.h>
50
#include <qtabwidget.h>
54
#include ICON_GAMEINFO
56
#include ICON_FILENEWBOARD
58
#include ICON_FILEOPEN
59
#include ICON_FILESAVE
60
#include ICON_FILESAVEAS
61
#include ICON_TRANSFORM
63
#include ICON_RIGHTARROW
64
#include ICON_LEFTARROW
65
#include ICON_RIGHTCOMMENT //added eb 2
66
#include ICON_LEFTCOMMENT // end add eb 2
67
#include ICON_TWO_RIGHTARROW
68
#include ICON_TWO_LEFTARROW
69
#include ICON_NEXT_VAR
70
#include ICON_PREV_VAR
71
#include ICON_MAIN_BRANCH
72
#include ICON_START_VAR
73
#include ICON_NEXT_BRANCH
74
#include ICON_AUTOPLAY
78
#include ICON_INCREASE_SIZE
79
#include ICON_DECREASE_SIZE
80
#include ICON_FULLSCREEN
81
#include ICON_WHATSTHIS
83
#include ICON_NAV_INTERSECTION
84
#include ICON_COMPUTER_PLAY
89
MainWindow::MainWindow(QWidget* parent, const char* name, WFlags f)
90
: QMainWindow(parent, name, f), Misc<QString>()
93
// this is very dirty : we do this because there seem to be no clean way to backtrack to the ClientWindow, which has stored the style :-(
94
style = setting->readEntry("DEFAULT_STYLE") ;
96
setProperty("icon", setting->image0);
102
setFocusPolicy(QWidget::StrongFocus);
104
setIcon(setting->image0);
111
if (!setting->readBoolEntry("FILEBAR"))
112
viewFileBar->setOn(false);
113
if (!setting->readBoolEntry("TOOLBAR"))
114
viewToolBar->setOn(false);
115
if (!setting->readBoolEntry("EDITBAR"))
116
viewEditBar->setOn(false);
118
interfaceHandler = 0;
120
// VIEW_COMMENT: 0 = see BOARDVERTCOMMENT, 1 = hor, 2 = ver
121
// BOARDVERCOMMENT: 0 = hor, 1 = ver, 2 = not shown
122
if (setting->readIntEntry("VIEW_COMMENT") == 2 ||
123
setting->readIntEntry("VIEW_COMMENT") == 0 && setting->readIntEntry("BOARDVERTCOMMENT_0"))
125
// show vertical comment
126
splitter = new QSplitter(Horizontal, this);
127
mainWidget = new MainWidget(splitter, "MainWidget");
128
splitter_comment = new QSplitter(Vertical, splitter);
132
splitter = new QSplitter(Vertical, this);
133
mainWidget = new MainWidget(splitter, "MainWidget");
134
splitter_comment = new QSplitter(Horizontal, splitter);
136
splitter->setOpaqueResize(false);
138
// mainWidget = new MainWidget(splitter, "MainWidget");
140
mainWidgetGuiLayout = new QGridLayout(mainWidget, 1, 1, 0, 0);
141
if (setting->readBoolEntry("SIDEBAR_LEFT"))
143
mainWidgetGuiLayout->addWidget(mainWidget->toolsFrame, 0, 0);
144
mainWidgetGuiLayout->addWidget(mainWidget->boardFrame, 0, 1);
149
mainWidgetGuiLayout->addWidget(mainWidget->toolsFrame, 0, 1);
150
mainWidgetGuiLayout->addWidget(mainWidget->boardFrame, 0, 0);
153
board = mainWidget->board;
155
// Connect the mouseMove event of the board with the status bar coords widget
156
connect(board, SIGNAL(coordsChanged(int, int, int)), statusTip, SLOT(slotStatusTipCoords(int, int, int)));
158
commentEdit = new QTextEdit(splitter_comment, "comments"); //eb16
159
ListView_observers = new QListView(splitter_comment, "observers");
160
splitter->setResizeMode(mainWidget, QSplitter::KeepSize);
161
splitter_comment->setResizeMode(ListView_observers, QSplitter::KeepSize);
162
ListView_observers->addColumn(tr("Observers") + " ");
163
ListView_observers->setProperty("focusPolicy", (int)QListView::NoFocus );
164
ListView_observers->setProperty("resizePolicy", (int)QListView::AutoOneFit );
165
ListView_observers->addColumn(tr("Rk"));
166
ListView_observers->setProperty("focusPolicy", (int)QListView::NoFocus );
167
ListView_observers->setProperty("resizePolicy", (int)QListView::AutoOneFit );
168
ListView_observers->setSorting(1);
169
// disable sorting; else sort rank would sort by rank string (col 2) instead of rank key (col 3, invisible)
170
ListView_observers->setSorting(-1);
172
commentEdit->setWordWrap(QTextEdit::WidgetWidth);
173
commentEdit2 = mainWidget->commentEdit2;
174
// connect(commentEdit2, SIGNAL(returnPressed()), board, SLOT(modifiedComment()));
175
connect(commentEdit, SIGNAL(textChanged()), board, SLOT(updateComment()));
176
connect(commentEdit2, SIGNAL(returnPressed()), board, SLOT(updateComment2()));
178
// Connect Ctrl-E with MainWidget 'Edit' button. We need this to control the button
179
// even when the sidebar is hidden.
180
// connect(toggleEdit, SIGNAL(activated()), mainWidget->modeButton, SLOT(animateClick()));
182
setCentralWidget(splitter);
184
interfaceHandler = mainWidget->interfaceHandler;
185
CHECK_PTR(interfaceHandler);
186
interfaceHandler->fileImportASCII = fileImportASCII;
187
interfaceHandler->fileImportASCIIClipB = fileImportASCIIClipB;
188
interfaceHandler->fileImportSgfClipB = fileImportSgfClipB;
189
interfaceHandler->navForward = navForward;
190
interfaceHandler->navBackward = navBackward;
191
interfaceHandler->navFirst = navFirst;
192
interfaceHandler->navLast = navLast;
193
interfaceHandler->navNextVar = navNextVar;
194
interfaceHandler->navPrevVar = navPrevVar;
195
interfaceHandler->navStartVar = navStartVar;
196
interfaceHandler->navMainBranch = navMainBranch;
197
interfaceHandler->navNextBranch = navNextBranch;
198
interfaceHandler->navPrevComment = navPrevComment;
199
interfaceHandler->navNextComment = navNextComment;
200
interfaceHandler->navIntersection = navIntersection; //SL added eb 11
201
interfaceHandler->editCut = editCut;
202
interfaceHandler->editPaste = editPaste;
203
interfaceHandler->editPasteBrother = editPasteBrother;
204
interfaceHandler->editDelete = editDelete;
205
interfaceHandler->navEmptyBranch = navEmptyBranch;
206
interfaceHandler->navCloneNode = navCloneNode;
207
interfaceHandler->navNthMove = navNthMove;
208
interfaceHandler->navAutoplay = navAutoplay;
209
interfaceHandler->navSwapVariations = navSwapVariations;
210
interfaceHandler->commentEdit = commentEdit;
211
interfaceHandler->commentEdit2 = commentEdit2;
212
interfaceHandler->statusMode = statusMode;
213
interfaceHandler->statusTurn = statusTurn;
214
interfaceHandler->statusMark = statusMark;
215
interfaceHandler->statusNav = statusNav;
216
interfaceHandler->slider = mainWidget->slider;
217
interfaceHandler->mainWidget = mainWidget;
219
// Create a timer instance
220
// timerInterval = 2; // 1000 msec
221
timer = new QTimer(this);
222
connect(timer, SIGNAL(timeout()), this, SLOT(slotTimerForward()));
223
timerIntervals[0] = (float) 0.1;
224
timerIntervals[1] = 0.5;
225
timerIntervals[2] = 1.0;
226
timerIntervals[3] = 2.0;
227
timerIntervals[4] = 3.0;
228
timerIntervals[5] = 5.0;
232
// restore board window
233
reStoreWindowSize("0", false);
238
MainWindow::~MainWindow()
264
delete importExportMenu;
276
delete fileImportASCII;
277
delete fileImportASCIIClipB;
278
delete fileExportASCII;
279
delete fileImportSgfClipB;
280
delete fileExportSgfClipB;
281
delete fileExportPic;
282
delete fileExportPicClipB;
286
delete editPasteBrother;
288
delete editNumberMoves;
289
delete editMarkBrothers;
297
delete navMainBranch;
299
delete navNextBranch;
300
delete navPrevComment;
301
delete navNextComment;
302
delete navIntersection; //SL added eb 11
305
delete navEmptyBranch;
307
delete navSwapVariations;
308
delete setPreferences;
314
delete viewStatusBar;
318
delete viewVertComment;
319
delete viewPinComment;
320
delete viewIncreaseSize;
321
delete viewDecreaseSize;
323
delete viewFullscreen;
325
delete helpSoundInfo;
330
void MainWindow::initActions()
333
QPixmap exitIcon, fileNewboardIcon, fileNewIcon, fileOpenIcon, fileSaveIcon, fileSaveAsIcon,
334
transformIcon, charIcon, cutIcon, pasteIcon, deleteIcon,
335
nextCommentIcon, previousCommentIcon, navIntersectionIcon,
336
rightArrowIcon, leftArrowIcon,two_rightArrowIcon, two_leftArrowIcon,
337
prevVarIcon, nextVarIcon, startVarIcon, mainBranchIcon, nextBranchIcon, autoplayIcon,
338
prefsIcon, infoIcon, increaseIcon, decreaseIcon, fullscreenIcon, manualIcon;
340
prefsIcon = QPixmap(const_cast<const char**>(package_settings_xpm));
341
infoIcon = QPixmap(const_cast<const char**>(idea_xpm));
342
exitIcon = QPixmap(const_cast<const char**>(exit_xpm));
343
fileNewboardIcon = QPixmap(const_cast<const char**>(newboard_xpm));
344
fileNewIcon = QPixmap(const_cast<const char**>(filenew_xpm));
345
fileOpenIcon = QPixmap(const_cast<const char**>(fileopen_xpm));
346
fileSaveIcon = QPixmap(const_cast<const char**>(filesave_xpm));
347
fileSaveAsIcon = QPixmap(const_cast<const char**>(filesaveas_xpm));
348
transformIcon = QPixmap(const_cast<const char**>(transform_xpm));
349
charIcon = QPixmap(const_cast<const char**>(charset_xpm));
350
cutIcon = QPixmap(const_cast<const char**>(editcut_xpm));
351
pasteIcon = QPixmap(const_cast<const char**>(editpaste_xpm));
352
deleteIcon = QPixmap(const_cast<const char**>(editdelete_xpm));
353
rightArrowIcon = QPixmap(const_cast<const char**>(rightarrow_xpm));
354
leftArrowIcon = QPixmap(const_cast<const char**>(leftarrow_xpm));
355
nextCommentIcon = QPixmap(const_cast<const char**>(rightcomment_xpm));
356
previousCommentIcon = QPixmap(const_cast<const char**>(leftcomment_xpm));
357
two_rightArrowIcon = QPixmap(const_cast<const char**>(two_rightarrow_xpm));
358
two_leftArrowIcon = QPixmap(const_cast<const char**>(two_leftarrow_xpm));
359
nextVarIcon = QPixmap(const_cast<const char**>(down_xpm));
360
prevVarIcon = QPixmap(const_cast<const char**>(up_xpm));
361
mainBranchIcon = QPixmap(const_cast<const char**>(start_xpm));
362
startVarIcon = QPixmap(const_cast<const char**>(top_xpm));
363
nextBranchIcon = QPixmap(const_cast<const char**>(bottom_xpm));
364
increaseIcon = QPixmap(const_cast<const char**>(viewmagplus_xpm));
365
decreaseIcon = QPixmap(const_cast<const char**>(viewmagminus_xpm));
366
fullscreenIcon = QPixmap(const_cast<const char**>(window_fullscreen_xpm));
367
manualIcon = QPixmap(const_cast<const char**>(help_xpm));
368
autoplayIcon = QPixmap(const_cast<const char**>(player_pause_xpm));
369
navIntersectionIcon = QPixmap(const_cast<const char**>(navIntersection_xpm)); //SL added eb 11
372
prefsIcon = QPixmap(ICON_PREFS);
373
infoIcon = QPixmap(ICON_GAMEINFO);
374
exitIcon = QPixmap(ICON_EXIT);
375
fileNewboardIcon = QPixmap(ICON_FILENEWBOARD);
376
fileNewIcon = QPixmap(ICON_FILENEW);
377
fileOpenIcon = QPixmap(ICON_FILEOPEN);
378
fileSaveIcon = QPixmap(ICON_FILESAVE);
379
fileSaveAsIcon = QPixmap(ICON_FILESAVEAS);
380
transformIcon = QPixmap(ICON_TRANSFORM);
381
charIcon = QPixmap(ICON_CHARSET);
382
cutIcon = QPixmap(ICON_CUT);
383
pasteIcon = QPixmap(ICON_PASTE);
384
deleteIcon = QPixmap(ICON_DELETE);
385
rightArrowIcon = QPixmap(ICON_RIGHTARROW);
386
leftArrowIcon = QPixmap(ICON_LEFTARROW);
387
nextCommentIcon = QPixmap(ICON_RIGHTCOMMENT); //added eb
388
previousCommentIcon = QPixmap(ICON_LEFTCOMMENT); //added eb
389
two_rightArrowIcon = QPixmap(ICON_TWO_RIGHTARROW);
390
two_leftArrowIcon = QPixmap(ICON_TWO_LEFTARROW);
391
nextVarIcon = QPixmap(ICON_NEXT_VAR);
392
prevVarIcon = QPixmap(ICON_PREV_VAR);
393
startVarIcon = QPixmap(ICON_START_VAR);
394
mainBranchIcon = QPixmap(ICON_MAIN_BRANCH);
395
nextBranchIcon = QPixmap(ICON_NEXT_BRANCH);
396
increaseIcon = QPixmap(ICON_INCREASE_SIZE);
397
decreaseIcon = QPixmap(ICON_DECREASE_SIZE);
398
fullscreenIcon = QPixmap(ICON_FULLSCREEN);
399
manualIcon = QPixmap(ICON_MANUAL);
400
autoplayIcon = QPixmap(ICON_AUTOPLAY);
401
navIntersectionIcon = QPixmap(ICON_NAV_INTERSECTION); //SL added eb 11
409
// Escape focus: Escape key to get the focus from comment field to main window.
410
escapeFocus = new QAction(this);
411
escapeFocus->setAccel(Key_Escape);
412
connect(escapeFocus, SIGNAL(activated()), this, SLOT(setFocus()));
414
// Toggle game mode: Normal / Edit - Ctrl-E
415
toggleEdit = new QAction(this);
416
toggleEdit->setAccel(QAccel::stringToKey(tr("Ctrl+E")));
417
// connect in constructor, as we need the mainwidget instance first.
419
// Toggle through the marks - Ctrl-T
420
toggleMarks = new QAction(this);
421
toggleMarks->setAccel(QAccel::stringToKey(tr("Ctrl+T")));
422
connect(toggleMarks, SIGNAL(activated()), this, SLOT(slotToggleMarks()));
428
fileNewBoard = new QAction(tr("New"), fileNewboardIcon, tr("New &Board"),
429
QAccel::stringToKey(tr("Ctrl+B")), this);
430
fileNewBoard->setStatusTip(tr("Creates a new board"));
431
fileNewBoard->setWhatsThis(tr("New\n\nCreates a new board."));
432
connect(fileNewBoard, SIGNAL(activated()), this, SLOT(slotFileNewBoard()));
435
fileNew = new QAction(tr("New game"), fileNewIcon, tr("&New game"),
436
QAccel::stringToKey(tr("Ctrl+N")), this);
437
fileNew->setStatusTip(tr("Creates a new game on this board"));
438
fileNew->setWhatsThis(tr("New\n\nCreates a new game on this board."));
439
connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNewGame()));
442
fileOpen = new QAction(tr("Open"), fileOpenIcon, tr("&Open"),
443
QAccel::stringToKey(tr("Ctrl+O")), this);
444
fileOpen->setStatusTip(tr("Open a sgf file"));
445
fileOpen->setWhatsThis(tr("Open\n\nOpen a sgf file."));
446
connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
449
fileSave = new QAction(tr("Save"), fileSaveIcon, tr("&Save"),
450
QAccel::stringToKey(tr("Ctrl+S")), this);
451
fileSave->setStatusTip(tr("Save a sgf file"));
452
fileSave->setWhatsThis(tr("Save\n\nSave a sgf file."));
453
connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
456
fileSaveAs = new QAction(tr("Save As"), fileSaveAsIcon, tr("Save &As"), 0, this);
457
fileSaveAs->setStatusTip(tr("Save a sgf file under a new name"));
458
fileSaveAs->setWhatsThis(tr("Save As\n\nSave a sgf file under a new name."));
459
connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
462
fileClose = new QAction(tr("Close"), tr("&Close"), QAccel::stringToKey(tr("Ctrl+W")), this);
463
fileClose->setStatusTip(tr("Close this board"));
464
fileClose->setWhatsThis(tr("Exit\n\nClose this board."));
465
connect(fileClose, SIGNAL(activated()), this, SLOT(slotFileClose()));
468
fileImportASCII = new QAction(tr("Import ASCII"), charIcon, tr("Import &ASCII"), 0, this);
469
fileImportASCII->setStatusTip(tr("Import an ASCII file as new variation"));
470
fileImportASCII->setWhatsThis(tr("Import ASCII\n\nImport an ASCII file as new variation."));
471
connect(fileImportASCII, SIGNAL(activated()), this, SLOT(slotFileImportASCII()));
473
// File ImportASCIIClipB
474
fileImportASCIIClipB = new QAction(tr("Import ASCII from clipboard"), charIcon,
475
tr("Import ASCII from &clipboard"), 0, this);
476
fileImportASCIIClipB->setStatusTip(tr("Import an ASCII board as new variation from the clipboard"));
477
fileImportASCIIClipB->setWhatsThis(tr("Import ASCII from clipboard\n\nImport an ASCII file as new variation from the clipboard."));
478
connect(fileImportASCIIClipB, SIGNAL(activated()), this, SLOT(slotFileImportASCIIClipB()));
481
fileExportASCII = new QAction(tr("Export ASCII"), charIcon, tr("&Export ASCII"), 0, this);
482
fileExportASCII->setStatusTip(tr("Export current board to ASCII"));
483
fileExportASCII->setWhatsThis(tr("Export ASCII\n\nExport current board to ASCII."));
484
connect(fileExportASCII, SIGNAL(activated()), this, SLOT(slotFileExportASCII()));
486
// File ImportSgfClipB
487
fileImportSgfClipB = new QAction(tr("Import SGF from clipboard"), fileOpenIcon,
488
tr("Import SGF &from clipboard"), 0, this);
489
fileImportSgfClipB->setStatusTip(tr("Import a complete game in SGF format from clipboard"));
490
fileImportSgfClipB->setWhatsThis(tr("Import SGF from clipboard\n\n"
491
"Import a complete game in SGF format from clipboard."));
492
connect(fileImportSgfClipB, SIGNAL(activated()), this, SLOT(slotFileImportSgfClipB()));
494
// File ExportSgfClipB
495
fileExportSgfClipB = new QAction(tr("Export SGF to clipboard"), fileSaveIcon,
496
tr("Export SGF &to clipboard"), 0, this);
497
fileExportSgfClipB->setStatusTip(tr("Export a complete game in SGF format to clipboard"));
498
fileExportSgfClipB->setWhatsThis(tr("Export SGF to clipboard\n\n"
499
"Export a complete game in SGF format to clipboard."));
500
connect(fileExportSgfClipB, SIGNAL(activated()), this, SLOT(slotFileExportSgfClipB()));
503
fileExportPic = new QAction(tr("Export Image"), transformIcon, tr("Export &Image"), 0, this);
504
fileExportPic->setStatusTip(tr("Export current board to an image"));
505
fileExportPic->setWhatsThis(tr("Export Image\n\nExport current board to an image."));
506
connect(fileExportPic, SIGNAL(activated()), this, SLOT(slotFileExportPic()));
509
fileExportPicClipB = new QAction(tr("Export Image to clipboard"), transformIcon,
510
tr("E&xport Image to clipboard"), 0, this);
511
fileExportPicClipB->setStatusTip(tr("Export current board to the clipboard as image"));
512
fileExportPicClipB->setWhatsThis(tr("Export Image to clipboard\n\nExport current board to the clipboard as image."));
513
connect(fileExportPicClipB, SIGNAL(activated()), this, SLOT(slotFileExportPicClipB()));
516
fileQuit = new QAction(tr("Exit"), exitIcon, tr("E&xit"),
517
QAccel::stringToKey(tr("Ctrl+Q")), this);
518
fileQuit->setStatusTip(tr("Quits the application"));
519
fileQuit->setWhatsThis(tr("Exit\n\nQuits the application."));
520
connect(fileQuit, SIGNAL(activated()), this, SLOT(slotFileClose()));//(qGo*)qApp, SLOT(quit()));
526
editCut = new QAction(tr("Cut"), cutIcon, tr("&Cut"),
527
QAccel::stringToKey(tr("Ctrl+X")), this);
528
editCut->setStatusTip(tr("Cut this and all following positions"));
529
editCut->setWhatsThis(tr("Cut\n\nCut this and all following positions."));
530
connect(editCut, SIGNAL(activated()), this, SLOT(slotEditCut()));
533
editPaste = new QAction(tr("Paste"), pasteIcon, tr("&Paste"),
534
QAccel::stringToKey(tr("Ctrl+P")), this);
535
editPaste->setStatusTip(tr("Paste as son of the current move"));
536
editPaste->setWhatsThis(tr("Paste\n\nPaste as son of the current move."));
537
connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
539
// Edit paste as brother
540
editPasteBrother = new QAction(tr("Paste as brother"), tr("Paste as &brother"), 0, this);
541
editPasteBrother->setStatusTip(tr("Paste as brother of the current move"));
542
editPasteBrother->setWhatsThis(tr("Paste\n\nPaste as brother of the current move."));
543
connect(editPasteBrother, SIGNAL(activated()), this, SLOT(slotEditPasteBrother()));
546
editDelete = new QAction(tr("Delete"), deleteIcon, tr("&Delete"),
547
QAccel::stringToKey(tr("Ctrl+D")), this);
548
editDelete->setStatusTip(tr("Delete this and all following positions"));
549
editDelete->setWhatsThis(tr("Delete\n\nDelete this and all following positions."));
550
connect(editDelete, SIGNAL(activated()), this, SLOT(slotEditDelete()));
553
editNumberMoves = new QAction(tr("Number Moves"), tr("&Number Moves"),
554
QAccel::stringToKey(tr("Shift+F2")), this);
555
editNumberMoves->setStatusTip(tr("Mark all moves with the number of their turn"));
556
editNumberMoves->setWhatsThis(tr("Number moves\n\nMark all moves with the number of their turn."));
557
connect(editNumberMoves, SIGNAL(activated()), this, SLOT(slotEditNumberMoves()));
559
// Edit mark brothers
560
editMarkBrothers = new QAction(tr("Mark brothers"), tr("Mark &brothers"),
561
QAccel::stringToKey(tr("Shift+F3")), this);
562
editMarkBrothers->setStatusTip(tr("Mark all brothers of the current move"));
563
editMarkBrothers->setWhatsThis(tr("Mark brothers\n\nMark all brothers of the current move."));
564
connect(editMarkBrothers, SIGNAL(activated()), this, SLOT(slotEditMarkBrothers()));
567
editMarkSons = new QAction(tr("Mark sons"), tr("Mark &sons"),
568
QAccel::stringToKey(tr("Shift+F4")), this);
569
editMarkSons->setStatusTip(tr("Mark all sons of the current move"));
570
editMarkSons->setWhatsThis(tr("Mark sons\n\nMark all sons of the current move."));
571
connect(editMarkSons, SIGNAL(activated()), this, SLOT(slotEditMarkSons()));
576
// Navigation Backward
577
navBackward = new QAction(tr("Previous move (Left)"), leftArrowIcon, tr("&Previous move") + "\t" + tr("Left"),
579
navBackward->setStatusTip(tr("To previous move"));
580
navBackward->setWhatsThis(tr("Previous move\n\nMove one move backward."));
581
connect(navBackward, SIGNAL(activated()), this, SLOT(slotNavBackward()));
583
// Navigation Forward
584
navForward = new QAction(tr("Next move (Right)"), rightArrowIcon, tr("&Next move") + "\t" + tr("Right"), 0, this);
585
navForward->setStatusTip(tr("To next move"));
586
navForward->setWhatsThis(tr("Next move\n\nMove one move forward."));
587
connect(navForward, SIGNAL(activated()), this, SLOT(slotNavForward()));
590
navFirst = new QAction(tr("First move (Home)"), two_leftArrowIcon, tr("&First move") + "\t" + tr("Home"), 0, this);
591
navFirst->setStatusTip(tr("To first move"));
592
navFirst->setWhatsThis(tr("First move\n\nMove to first move."));
593
connect(navFirst, SIGNAL(activated()), this, SLOT(slotNavFirst()));
596
navLast = new QAction(tr("Last move (End)"), two_rightArrowIcon, tr("&Last move") + "\t" + tr("End"), 0, this);
597
navLast->setStatusTip(tr("To last move"));
598
navLast->setWhatsThis(tr("Last move\n\nMove to last move."));
599
connect(navLast, SIGNAL(activated()), this, SLOT(slotNavLast()));
601
// Navigation previous variation
602
navPrevVar = new QAction(tr("Previous variation (Up)"), prevVarIcon, tr("P&revious variation") + "\t" + tr("Up"), 0, this);
603
navPrevVar->setStatusTip(tr("To previous variation"));
604
navPrevVar->setWhatsThis(tr("Previous variation\n\nMove to the previous variation of this move."));
605
connect(navPrevVar, SIGNAL(activated()), this, SLOT(slotNavPrevVar()));
607
// Navigation next variation
608
navNextVar = new QAction(tr("Next variation (Down)"), nextVarIcon, tr("N&ext variation") + "\t" + tr("Down"), 0, this);
609
navNextVar->setStatusTip(tr("To next variation"));
610
navNextVar->setWhatsThis(tr("Next variation\n\nMove to the next variation of this move."));
611
connect(navNextVar, SIGNAL(activated()), this, SLOT(slotNavNextVar()));
613
// Navigation main branch
614
navMainBranch = new QAction(tr("Main Branch"), mainBranchIcon, tr("&Main branch"), Key_Insert, this);
615
navMainBranch->setStatusTip(tr("To main branch"));
616
navMainBranch->setWhatsThis(tr("Main Branch\n\nMove to the main branch where variation started."));
617
connect(navMainBranch, SIGNAL(activated()), this, SLOT(slotNavMainBranch()));
619
// Navigation variation start
620
navStartVar = new QAction(tr("Variation start"), startVarIcon, tr("Variation &start"), Key_PageUp, this);
621
navStartVar->setStatusTip(tr("To top of variation"));
622
navStartVar->setWhatsThis(tr("Variation start\n\nMove to the top variation of this branch."));
623
connect(navStartVar, SIGNAL(activated()), this, SLOT(slotNavStartVar()));
625
// Navigation next branch
626
navNextBranch = new QAction(tr("Next branch"), nextBranchIcon, tr("Next &branch"), Key_PageDown, this);
627
navNextBranch->setStatusTip(tr("To next branch starting a variation"));
628
navNextBranch->setWhatsThis(tr("Next branch\n\nMove to the next branch starting a variation."));
629
connect(navNextBranch, SIGNAL(activated()), this, SLOT(slotNavNextBranch()));
631
// Navigation goto Nth move
632
navNthMove = new QAction(tr("Goto move"), tr("&Goto Move"), QAccel::stringToKey(tr("Ctrl+G")) , this);
633
navNthMove->setStatusTip(tr("Goto a move of main branch by number"));
634
navNthMove->setWhatsThis(tr("Goto move\n\nGoto a move of main branch by number."));
635
connect(navNthMove, SIGNAL(activated()), this, SLOT(slotNavNthMove()));
637
// Navigation Autoplay
638
navAutoplay = new QAction(tr("Autoplay"), autoplayIcon, tr("&Autoplay"),
639
QAccel::stringToKey(tr("Ctrl+A")), this, 0, true);
640
navAutoplay->setOn(false);
641
navAutoplay->setStatusTip(tr("Start/Stop autoplaying current game"));
642
navAutoplay->setWhatsThis(tr("Autoplay\n\nStart/Stop autoplaying current game."));
643
connect(navAutoplay, SIGNAL(toggled(bool)), this, SLOT(slotNavAutoplay(bool)));
645
// Navigation empty branch
646
navEmptyBranch = new QAction(tr("Empty branch"), tr("Empt&y branch"), 0, this);
647
navEmptyBranch->setStatusTip(tr("Create an empty branch"));
648
navEmptyBranch->setWhatsThis(tr("Empty branch\n\nCreate an empty branch."));
649
connect(navEmptyBranch, SIGNAL(activated()), this, SLOT(slotNavEmptyBranch()));
651
// Navigation duplicate move
652
navCloneNode = new QAction(tr("Duplicate move"), tr("D&uplicate move"), 0, this);
653
navCloneNode->setStatusTip(tr("Copies and duplicates this move"));
654
navCloneNode->setWhatsThis(tr("Duplicate move\n\nCopies and duplicates this move."));
655
connect(navCloneNode, SIGNAL(activated()), this, SLOT(slotNavCloneNode()));
657
// Navigation swap variations
658
navSwapVariations = new QAction(tr("Swap variations"), tr("S&wap variations"), 0, this);
659
navSwapVariations->setStatusTip(tr("Swap current move with previous variation"));
660
navSwapVariations->setWhatsThis(tr("Swap variations\n\nSwap current move with previous variation."));
661
connect(navSwapVariations, SIGNAL(activated()), this, SLOT(slotNavSwapVariations()));
663
// Navigation previous comment
664
navPrevComment = new QAction(tr("Previous commented move"), previousCommentIcon, tr("Previous &commented move") , 0, this); //added eb
665
navPrevComment->setStatusTip(tr("To previous comment"));
666
navPrevComment->setWhatsThis(tr("Previous comment\n\nMove to the previous move that has a comment"));
667
connect(navPrevComment, SIGNAL(activated()), this, SLOT(slotNavPrevComment()));
669
// Navigation next comment
670
navNextComment = new QAction(tr("Next commented move"), nextCommentIcon, tr("Next c&ommented move") , 0, this);
671
navNextComment->setStatusTip(tr("To next comment"));
672
navNextComment->setWhatsThis(tr("Next comment\n\nMove to the next move that has a comment"));
673
connect(navNextComment, SIGNAL(activated()), this, SLOT(slotNavNextComment())); // end add eb
675
// Navigation to clicked intersection added eb 11
676
navIntersection = new QAction(tr("Goto stone at clicked move"), navIntersectionIcon, tr("Goto clic&ked move") , 0, this);
677
navIntersection->setStatusTip(tr("To clicked move"));
678
navIntersection->setWhatsThis(tr("Click on a board intersection\n\nMove to the stone played at this intersection (if any)"));
679
connect(navIntersection, SIGNAL(activated()), this, SLOT(slotNavIntersection())); // end add eb
685
// Settings Preferences
686
setPreferences = new QAction(tr("Preferences"), prefsIcon, tr("&Preferences"),
687
QAccel::stringToKey(tr("Alt+P")), this);
688
setPreferences->setStatusTip(tr("Edit the preferences"));
689
setPreferences->setWhatsThis(tr("Preferences\n\nEdit the applications preferences."));
690
connect(setPreferences, SIGNAL(activated()), this, SLOT(slotSetPreferences()));
693
setGameInfo = new QAction(tr("Game Info"), infoIcon, tr("&Game Info"),
694
QAccel::stringToKey(tr("Ctrl+I")), this);
695
setGameInfo->setStatusTip(tr("Display game information"));
696
setGameInfo->setWhatsThis(tr("Game Info\n\nDisplay game information."));
697
connect(setGameInfo, SIGNAL(activated()), this, SLOT(slotSetGameInfo()));
702
// View Filebar toggle
703
viewFileBar = new QAction(tr("File toolbar"), tr("&File toolbar"), 0, this, 0, true);
704
viewFileBar->setOn(true);
705
viewFileBar->setStatusTip(tr("Enables/disables the file toolbar"));
706
viewFileBar->setWhatsThis(tr("File toolbar\n\nEnables/disables the file toolbar."));
707
connect(viewFileBar, SIGNAL(toggled(bool)), this, SLOT(slotViewFileBar(bool)));
709
// View Toolbar toggle
710
viewToolBar = new QAction(tr("Navigation toolbar"), tr("Navigation &toolbar"), 0, this, 0, true);
711
viewToolBar->setOn(true);
712
viewToolBar->setStatusTip(tr("Enables/disables the navigation toolbar"));
713
viewToolBar->setWhatsThis(tr("Navigation toolbar\n\nEnables/disables the navigation toolbar."));
714
connect(viewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool)));
716
// View Editbar toggle
717
viewEditBar = new QAction(tr("Edit toolbar"), tr("&Edit toolbar"), 0, this, 0, true);
718
viewEditBar->setOn(true);
719
viewEditBar->setStatusTip(tr("Enables/disables the edit toolbar"));
720
viewEditBar->setWhatsThis(tr("Edit toolbar\n\nEnables/disables the edit toolbar."));
721
connect(viewEditBar, SIGNAL(toggled(bool)), this, SLOT(slotViewEditBar(bool)));
723
// View Menubar toggle
724
viewMenuBar = new QAction(tr("Menubar"), tr("&Menubar"),
725
QAccel::stringToKey(tr("F7")), this, 0, true);
726
viewMenuBar->setOn(true);
727
viewMenuBar->setStatusTip(tr("Enables/disables the menubar"));
728
viewMenuBar->setWhatsThis(tr("Menubar\n\nEnables/disables the menubar."));
729
connect(viewMenuBar, SIGNAL(toggled(bool)), this, SLOT(slotViewMenuBar(bool)));
731
// View Statusbar toggle
732
viewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true);
733
viewStatusBar->setOn(true);
734
viewStatusBar->setStatusTip(tr("Enables/disables the statusbar"));
735
viewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar."));
736
connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));
738
// View Coordinates toggle
739
viewCoords = new QAction(tr("Coordinates"), tr("C&oordinates"),
740
QAccel::stringToKey(tr("F8")), this, 0, true);
741
viewCoords->setOn(false);
742
viewCoords->setStatusTip(tr("Enables/disables the coordinates"));
743
viewCoords->setWhatsThis(tr("Coordinates\n\nEnables/disables the coordinates."));
744
connect(viewCoords, SIGNAL(toggled(bool)), this, SLOT(slotViewCoords(bool)));
746
// View Slider toggle
747
viewSlider = new QAction(tr("Slider"), tr("Sli&der"),
748
QAccel::stringToKey(tr("Ctrl+F8")), this, 0, true);
749
viewSlider->setOn(false);
750
viewSlider->setStatusTip(tr("Enables/disables the slider"));
751
viewSlider->setWhatsThis(tr("Slider\n\nEnables/disables the slider."));
752
connect(viewSlider, SIGNAL(toggled(bool)), this, SLOT(slotViewSlider(bool)));
754
// View Sidebar toggle
755
viewSidebar = new QAction(tr("Sidebar"), tr("Side&bar"),
756
QAccel::stringToKey(tr("F9")), this, 0, true);
757
viewSidebar->setOn(true);
758
viewSidebar->setStatusTip(tr("Enables/disables the sidebar"));
759
viewSidebar->setWhatsThis(tr("Sidebar\n\nEnables/disables the sidebar."));
760
connect(viewSidebar, SIGNAL(toggled(bool)), this, SLOT(slotViewSidebar(bool)));
762
// View Comment toggle
763
viewComment = new QAction(tr("Comment"), tr("&Comment"),
764
QAccel::stringToKey(tr("F10")), this, 0, true);
765
viewComment->setOn(true);
766
viewComment->setStatusTip(tr("Enables/disables the comment field"));
767
viewComment->setWhatsThis(tr("Comment field\n\nEnables/disables the comment field."));
768
connect(viewComment, SIGNAL(toggled(bool)), this, SLOT(slotViewComment(bool)));
770
// View Vertical Comment toggle
771
viewVertComment = new QAction(tr("Vertical comment"), tr("&Vertical comment"),
772
QAccel::stringToKey(tr("Shift+F10")), this, 0, true);
773
viewVertComment->setOn(setting->readIntEntry("VIEW_COMMENT") == 2 ||
774
setting->readIntEntry("VIEW_COMMENT") == 0 && setting->readIntEntry("BOARDVERTCOMMENT_0"));
775
viewVertComment->setStatusTip(tr("Enables/disables a vertical direction of the comment field"));
776
viewVertComment->setWhatsThis(tr("Vertical comment field\n\n"
777
"Enables/disables a vertical direction of the comment field.\n\nNote: This setting is temporary for this board. In order to set permanent horizontal/vertical comment use 'Preferences'."));
778
connect(viewVertComment, SIGNAL(toggled(bool)), this, SLOT(slotViewVertComment(bool)));
781
viewPinComment = new QAction(tr("Pin comment"), tr("&Pin comment"),
782
QAccel::stringToKey(tr("Ctrl+F10")), this, 0, true);
783
viewPinComment->setOn(false);
784
viewPinComment->setStatusTip(tr("Enables/disables pinning the comment field"));
785
viewPinComment->setWhatsThis(tr("Pin comment field\n\nEnables/disables pinning the comment field."));
786
connect(viewPinComment, SIGNAL(toggled(bool)), this, SLOT(slotViewPinComment(bool)));
788
// View Increase Size
789
viewIncreaseSize = new QAction(tr("Zoom In"), increaseIcon, tr("Zoom &In"),
790
QAccel::stringToKey(tr("Alt++")), this);
791
viewIncreaseSize->setStatusTip(tr("Zooms in the board"));
792
viewIncreaseSize->setWhatsThis(tr("Zoom In\n\nZooms in the board."));
793
connect(viewIncreaseSize, SIGNAL(activated()), this, SLOT(slotViewIncreaseSize()));
795
// View Decrease Size
796
viewDecreaseSize = new QAction(tr("Zoom Out"), decreaseIcon, tr("Zoom &Out"),
797
QAccel::stringToKey(tr("Alt+-")), this);
798
viewDecreaseSize->setStatusTip(tr("Zooms out the board"));
799
viewDecreaseSize->setWhatsThis(tr("Zoom Out\n\nZooms out the board."));
800
connect(viewDecreaseSize, SIGNAL(activated()), this, SLOT(slotViewDecreaseSize()));
803
viewSaveSize = new QAction(tr("Save size"), tr("Save si&ze"),
804
QAccel::stringToKey("Alt+0"), this, 0, false);
805
viewSaveSize->setStatusTip(tr("Save the current window size"));
806
viewSaveSize->setWhatsThis(tr("Save size\n\n"
807
"Saves the current window size and restores it on the next program start.\n\nUse ALT + <number key> to store own sizes\nRestore with CTRL + <number key>\n\n<0> is default value at program start.\n<9> is default for edit window."));
808
connect(viewSaveSize, SIGNAL(activated()), this, SLOT(slotViewSaveSize()));
811
viewFullscreen = new QAction(tr("Fullscreen"), fullscreenIcon, tr("&Fullscreen"),
812
QAccel::stringToKey(tr("F11")), this, 0, true);
813
viewFullscreen->setOn(false);
814
viewFullscreen->setStatusTip(tr("Enable/disable fullscreen mode"));
815
viewFullscreen->setWhatsThis(tr("Fullscreen\n\nEnable/disable fullscreen mode."));
816
connect(viewFullscreen, SIGNAL(toggled(bool)), this, SLOT(slotViewFullscreen(bool)));
822
helpManual = new QAction(tr("Manual"), manualIcon, tr("&Manual"),
823
QAccel::stringToKey(tr("F1")), this);
824
helpManual->setStatusTip(tr("Opens the manual"));
825
helpManual->setWhatsThis(tr("Help\n\nOpens the manual of the application."));
826
connect(helpManual, SIGNAL(activated()), this, SLOT(slotHelpManual()));
829
helpSoundInfo = new QAction(tr("Sound Info"), tr("&Sound"), 0, this);
830
helpSoundInfo->setStatusTip(tr("Short info on sound availability"));
831
helpSoundInfo->setWhatsThis(tr("Sound Info\n\nViews a message box with a short comment about sound."));
832
connect(helpSoundInfo, SIGNAL(activated()), this, SLOT(slotHelpSoundInfo()));
835
helpAboutApp = new QAction(tr("About"), tr("&About..."), 0, this);
836
helpAboutApp->setStatusTip(tr("About the application"));
837
helpAboutApp->setWhatsThis(tr("About\n\nAbout the application."));
838
connect(helpAboutApp, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
841
helpAboutQt = new QAction(tr("About Qt"), tr("About &Qt..."), 0, this);
842
helpAboutQt->setStatusTip(tr("About Qt"));
843
helpAboutQt->setWhatsThis(tr("About Qt\n\nAbout Qt."));
844
connect(helpAboutQt, SIGNAL(activated()), this, SLOT(slotHelpAboutQt()));
846
// Disable some toolbuttons at startup
847
navForward->setEnabled(false);
848
navBackward->setEnabled(false);
849
navFirst->setEnabled(false);
850
navLast->setEnabled(false);
851
navPrevVar->setEnabled(false);
852
navNextVar->setEnabled(false);
853
navMainBranch->setEnabled(false);
854
navStartVar->setEnabled(false);
855
navNextBranch->setEnabled(false);
856
navSwapVariations->setEnabled(false);
857
navPrevComment->setEnabled(false);
858
navNextComment->setEnabled(false);
859
navIntersection->setEnabled(false); //SL added eb 11
860
editPaste->setEnabled(false);
861
editPasteBrother->setEnabled(false);
864
void MainWindow::initMenuBar()
867
QIconSet wtIcon(QPixmap(const_cast<const char**>(contexthelp_xpm)));
869
QIconSet wtIcon(QPixmap(ICON_WHATSTHIS));
872
// submenu Import/Export
873
importExportMenu = new QPopupMenu();
874
importExportMenu->insertTearOffHandle();
875
fileImportASCII->addTo(importExportMenu);
876
fileImportASCIIClipB->addTo(importExportMenu);
877
fileExportASCII->addTo(importExportMenu);
878
importExportMenu->insertSeparator();
879
fileImportSgfClipB->addTo(importExportMenu);
880
fileExportSgfClipB->addTo(importExportMenu);
881
importExportMenu->insertSeparator();
882
fileExportPic->addTo(importExportMenu);
883
fileExportPicClipB->addTo(importExportMenu);
885
// menuBar entry fileMenu
886
fileMenu = new QPopupMenu();
887
fileMenu->insertTearOffHandle();
888
fileNewBoard->addTo(fileMenu);
889
fileNew->addTo(fileMenu);
890
fileOpen->addTo(fileMenu);
891
fileSave->addTo(fileMenu);
892
fileSaveAs->addTo(fileMenu);
893
fileClose->addTo(fileMenu);
894
fileMenu->insertSeparator();
895
fileMenu->insertItem(tr("&Import/Export"), importExportMenu);
896
fileMenu->insertSeparator();
897
fileQuit->addTo(fileMenu);
899
// menuBar entry editMenu
900
editMenu = new QPopupMenu();
901
editMenu->insertTearOffHandle();
902
editCut->addTo(editMenu);
903
editPaste->addTo(editMenu);
904
editPasteBrother->addTo(editMenu);
905
editDelete->addTo(editMenu);
906
editMenu->insertSeparator();
907
editNumberMoves->addTo(editMenu);
908
editMarkBrothers->addTo(editMenu);
909
editMarkSons->addTo(editMenu);
911
// menuBar entry navMenu
912
navMenu = new QPopupMenu();
913
navMenu->insertTearOffHandle();
914
navFirst->addTo(navMenu);
915
navBackward->addTo(navMenu);
916
navForward->addTo(navMenu);
917
navLast->addTo(navMenu);
918
navMenu->insertSeparator();
919
navMainBranch->addTo(navMenu);
920
navStartVar->addTo(navMenu);
921
navPrevVar->addTo(navMenu);
922
navNextVar->addTo(navMenu);
923
navNextBranch->addTo(navMenu);
924
navMenu->insertSeparator();
925
navNthMove->addTo(navMenu);
926
navAutoplay->addTo(navMenu);
927
navMenu->insertSeparator();
928
navEmptyBranch->addTo(navMenu);
929
navCloneNode->addTo(navMenu);
930
navSwapVariations->addTo(navMenu);
931
navMenu->insertSeparator(); //added eb
932
navPrevComment->addTo(navMenu);
933
navNextComment->addTo(navMenu); // end add
936
// menuBar entry settingsMenu
937
settingsMenu = new QPopupMenu();
938
settingsMenu->insertTearOffHandle();
939
setPreferences->addTo(settingsMenu);
940
setGameInfo->addTo(settingsMenu);
942
// menuBar entry viewMenu
943
viewMenu = new QPopupMenu();
944
viewMenu->insertTearOffHandle();
945
viewFileBar->addTo(viewMenu);
946
viewToolBar->addTo(viewMenu);
947
viewEditBar->addTo(viewMenu);
948
viewMenuBar->addTo(viewMenu);
949
viewStatusBar->addTo(viewMenu);
950
viewCoords->addTo(viewMenu);
951
viewSlider->addTo(viewMenu);
952
viewSidebar->addTo(viewMenu);
953
viewComment->addTo(viewMenu);
954
viewVertComment->addTo(viewMenu);
955
viewPinComment->addTo(viewMenu);
956
viewMenu->insertSeparator();
957
viewIncreaseSize->addTo(viewMenu);
958
viewDecreaseSize->addTo(viewMenu);
959
viewMenu->insertSeparator();
960
viewSaveSize->addTo(viewMenu);
961
viewMenu->insertSeparator();
962
viewFullscreen->addTo(viewMenu);
964
// menuBar entry helpMenu
965
helpMenu = new QPopupMenu();
966
helpManual->addTo(helpMenu);
967
helpMenu->insertItem(wtIcon, tr("What's &This?"), this, SLOT(whatsThis()), SHIFT+Key_F1);
968
helpMenu->insertSeparator();
969
helpSoundInfo->addTo(helpMenu);
970
helpMenu->insertSeparator();
971
helpAboutApp->addTo(helpMenu);
972
helpAboutQt->addTo(helpMenu);
974
// menubar configuration
975
menuBar()->insertItem(tr("&File"), fileMenu);
976
menuBar()->insertItem(tr("&Edit"), editMenu);
977
menuBar()->insertItem(tr("&Navigation"), navMenu);
978
menuBar()->insertItem(tr("&Settings"), settingsMenu);
979
menuBar()->insertItem(tr("&View"), viewMenu);
980
menuBar()->insertSeparator();
981
menuBar()->insertItem(tr("&Help"), helpMenu);
984
void MainWindow::initToolBar()
987
fileBar = new QToolBar(this, "filebar");
989
fileNew->addTo(fileBar);
990
fileOpen->addTo(fileBar);
991
fileSave->addTo(fileBar);
992
fileSaveAs->addTo(fileBar);
994
// Navigation toolbar
995
toolBar = new QToolBar(this, "toolbar");
997
navFirst->addTo(toolBar);
998
navBackward->addTo(toolBar);
999
navForward->addTo(toolBar);
1000
navLast->addTo(toolBar);
1002
toolBar->addSeparator();
1004
navMainBranch->addTo(toolBar);
1005
navStartVar->addTo(toolBar);
1006
navPrevVar->addTo(toolBar);
1007
navNextVar->addTo(toolBar);
1008
navNextBranch->addTo(toolBar);
1010
toolBar->addSeparator();
1011
navPrevComment->addTo(toolBar); // added eb 2
1012
navNextComment->addTo(toolBar);
1013
navIntersection->addTo(toolBar); //SL added eb 11
1014
toolBar->addSeparator(); //end add eb 2
1016
navAutoplay->addTo(toolBar);
1018
toolBar->addSeparator();
1020
QWhatsThis::whatsThisButton(toolBar);
1022
toolBar->addSeparator();
1024
// setPreferences->addTo(toolBar);
1025
setGameInfo->addTo(toolBar);
1028
editBar = new QToolBar(this, "editbar");
1030
editCut->addTo(editBar);
1031
editPaste->addTo(editBar);
1032
editDelete->addTo(editBar);
1035
void MainWindow::initStatusBar()
1037
// The coords widget
1038
statusTip = new StatusTip(statusBar());
1039
statusBar()->addWidget(statusTip);
1040
statusBar()->show();
1041
statusBar()->setSizeGripEnabled(true);
1042
statusBar()->message(tr("Ready.")); // Normal indicator
1043
connect(statusTip, SIGNAL(clearStatusBar()), statusBar(), SLOT(clear()));
1046
statusTurn = new QLabel(statusBar());
1047
statusTurn->setAlignment(AlignCenter | SingleLine);
1048
statusTurn->setText(" 0 ");
1049
statusBar()->addWidget(statusTurn, 0, true); // Permanent indicator
1050
QToolTip::add(statusTurn, tr("Current move"));
1051
QWhatsThis::add(statusTurn, tr("Move\nDisplays the number of the current turn and the last move played."));
1054
statusNav = new QLabel(statusBar());
1055
statusNav->setAlignment(AlignCenter | SingleLine);
1056
statusNav->setText(" 0/0 ");
1057
statusBar()->addWidget(statusNav, 0, true); // Permanent indicator
1058
QToolTip::add(statusNav, tr("Brothers / sons"));
1059
QWhatsThis::add(statusNav, tr("Navigation\nShows the brothers and sons of the current move."));
1062
statusMode = new QLabel(statusBar());
1063
statusMode->setAlignment(AlignCenter | SingleLine);
1064
statusMode->setText(" " + QObject::tr("N", "Board status line: normal mode") + " ");
1065
statusBar()->addWidget(statusMode, 0, true); // Permanent indicator
1066
QToolTip::add(statusMode, tr("Current mode"));
1067
QWhatsThis::add(statusMode,
1068
tr("Mode\nShows the current mode. 'N' for normal mode, 'E' for edit mode."));
1071
statusMark = new QLabel(statusBar());
1072
statusMark->setAlignment(AlignCenter | SingleLine);
1073
statusMark->setText(" - ");
1074
statusBar()->addWidget(statusMark, 0, true); // Permanent indicator
1075
QToolTip::add(statusMark, tr("Current edit mark"));
1076
QWhatsThis::add(statusMark, tr("Mark\nShows the current edit mark. '-' in normal mode."));
1079
void MainWindow::slotFileNewBoard()
1081
setting->qgo->addBoardWindow();
1084
void MainWindow::slotFileNewGame()
1086
if (!checkModified())
1089
if (board->getGameMode() == modeNormal)
1091
NewLocalGameDialog dlg(this, tr("newgame"), true);
1093
if (dlg.exec() == QDialog::Accepted)
1095
GameData *d = new GameData;
1096
d->size = dlg.boardSizeSpin->value();
1097
d->komi = (float)dlg.komiSpin->value() / 10.0;
1098
d->handicap = dlg.handicapSpin->value();
1099
d->playerBlack = dlg.playerBlackEdit->text();
1100
d->rankBlack = dlg.playerBlackRkEdit->text();
1101
d->playerWhite = dlg.playerWhiteEdit->text();
1102
d->rankWhite = dlg.playerWhiteRkEdit->text();
1106
d->byoTime = dlg.byoTimeSpin->value();
1113
NewGameDialog dlg(this, tr("newgame"), true);
1115
if (dlg.exec() == QDialog::Accepted)
1117
GameData *d = new GameData;
1118
d->size = dlg.boardSizeSpin->value();
1119
d->komi = (float)dlg.komiSpin->value() / 10.0;
1120
d->handicap = dlg.handicapSpin->value();
1121
d->playerBlack = dlg.playerBlackEdit->text();
1122
d->playerWhite = dlg.playerWhiteEdit->text();
1126
d->byoTime = dlg.byoTimeSpin->value();
1132
interfaceHandler->normalTools->komi->setText(QString::number(board->getGameData()->komi));
1133
interfaceHandler->normalTools->handicap->setText(QString::number(board->getGameData()->handicap));
1135
statusBar()->message(tr("New board prepared."));
1138
void MainWindow::slotFileOpen()
1140
if (!checkModified())
1142
QString fileName(QFileDialog::getOpenFileName(setting->readEntry("LAST_DIR"),
1143
tr("SGF Files (*.sgf);;MGT Files (*.mgt);;XML Files (*.xml);;All Files (*)"), this));
1144
if (fileName.isEmpty())
1146
doOpen(fileName, getFileExtension(fileName));
1149
QString MainWindow::getFileExtension(const QString &fileName, bool defaultExt)
1157
int pos=0, oldpos=-1, len = fileName.length();
1159
while ((pos = fileName.find('.', ++pos)) != -1 && pos < len)
1163
filter = fileName.mid(oldpos+1, fileName.length()-pos).upper();
1168
void MainWindow::doOpen(const QString &fileName, const QString &filter, bool storedir)
1170
// qDebug("doOpen - fileName: %s - filter: %s", fileName.latin1(), filter.latin1());
1172
if (setting->readBoolEntry("REM_DIR") && storedir)
1173
rememberLastDir(fileName);
1175
if (board->openSGF(fileName, filter))
1176
statusBar()->message(fileName + " " + tr("loaded."));
1179
bool MainWindow::startComputerPlay(QNewGameDlg * dlg, const QString &fileName, const QString &filter, const QString &computer_path)
1181
GameData *d = new GameData;
1182
d->size = dlg->getSize();
1183
d->komi = dlg->getKomi();
1184
d->handicap = dlg->getHandicap();
1185
d->playerBlack = dlg->getPlayerBlackName();
1186
//d->rankBlack = dlg.playerBlackRkEdit->text();
1187
d->playerWhite = dlg->getPlayerWhiteName();
1188
//d->rankWhite = dlg.playerWhiteRkEdit->text();
1192
d->byoTime = dlg->getTime();
1194
d->oneColorGo = dlg->getOneColorGo();
1196
blackPlayerType = dlg->getPlayerBlackType();
1197
whitePlayerType = dlg->getPlayerWhiteType();
1201
if (!board->startComputerPlay(dlg,fileName, filter, computer_path))
1207
bool MainWindow::slotFileSave()
1210
if ((fileName = board->getGameData()->fileName).isEmpty())
1212
if (setting->readBoolEntry("REM_DIR"))
1213
fileName = setting->readEntry("LAST_DIR:");
1215
fileName = QString::null;
1216
return doSave(fileName, false);
1219
return doSave(board->getGameData()->fileName, true);
1222
bool MainWindow::slotFileSaveAs()
1224
if (setting->readBoolEntry("REM_DIR"))
1225
return doSave(setting->readEntry("LAST_DIR"), false);
1226
return doSave(0, false);
1229
bool MainWindow::doSave(QString fileName, bool force)
1233
if (fileName == NULL ||
1234
fileName.isNull() ||
1235
fileName.isEmpty() ||
1236
QDir(fileName).exists())
1239
QString base = board->getCandidateFileName();
1240
if (fileName == NULL || fileName.isNull() || fileName.isEmpty())
1243
fileName.append(base);
1246
while (QFile(fileName).exists())
1250
number = number.number(i++);
1251
fileName = base + "-";
1252
fileName = fileName + number;
1253
fileName = fileName + ".sgf";
1258
fileName = QFileDialog::getSaveFileName(fileName,
1259
tr("SGF Files (*.sgf);;All Files (*)"),
1262
if (fileName.isEmpty())
1265
if (getFileExtension(fileName, false).isEmpty())
1266
fileName.append(".sgf");
1268
// Confirm overwriting file.
1269
if (!force && QFile(fileName).exists())
1270
if (QMessageBox::information(this, PACKAGE,
1271
tr("This file already exists. Do you want to overwrite it?"),
1272
tr("Yes"), tr("No"), 0, 0, 1) == 1)
1275
board->getGameData()->fileName = fileName;
1277
if (setting->readBoolEntry("REM_DIR"))
1278
rememberLastDir(fileName);
1280
if (!board->saveBoard(fileName))
1282
QMessageBox::warning(this, PACKAGE, tr("Cannot save SGF file."));
1286
statusBar()->message(fileName + " " + tr("saved."));
1287
board->setModified(false);
1291
void MainWindow::slotFileClose()
1293
if (checkModified() == 1)
1295
board->setModified(false); // Prevent to ask a second time in qGo::quit()
1300
void MainWindow::slotFileImportSgfClipB()
1302
// check wheter it's an edit board during online game
1303
if (getInterfaceHandler()->refreshButton->text() != tr("Update") && !checkModified())
1306
if (!board->importSGFClipboard())
1307
QMessageBox::warning(this, PACKAGE, tr("Cannot load from clipboard. Is it empty?"));
1309
statusBar()->message(tr("SGF imported."));
1312
void MainWindow::slotFileExportSgfClipB()
1314
if (!board->exportSGFtoClipB())
1315
QMessageBox::warning(this, PACKAGE, tr("Failed to export SGF to clipboard."));
1317
statusBar()->message(tr("SGF exported."));
1320
void MainWindow::slotFileImportASCII()
1322
QString fileName(QFileDialog::getOpenFileName(QString::null,
1323
tr("Text Files (*.txt);;All Files (*)"),
1325
if (fileName.isEmpty())
1328
board->importASCII(fileName);
1329
statusBar()->message(tr("ASCII imported."));
1332
void MainWindow::slotFileImportASCIIClipB()
1334
if (!board->importASCII(NULL, true))
1335
QMessageBox::warning(this, PACKAGE, tr("Importing ASCII failed. Clipboard empty?"));
1337
statusBar()->message(tr("ASCII imported."));
1340
void MainWindow::slotFileExportASCII()
1342
board->exportASCII();
1343
statusBar()->message(tr("Ready."));
1346
void MainWindow::slotFileExportPic()
1348
QString *filter = new QString("");
1349
QString fileName = QFileDialog::getSaveFileName(
1351
"PNG (*.png);;BMP (*.bmp);;XPM (*.xpm);;XBM (*.xbm);;PNM (*.pnm);;GIF (*.gif);;JPEG (*.jpeg);;MNG (*.mng)",
1354
tr("Export image as"),
1359
if (fileName.isEmpty())
1362
//fileName.append(".").append(filter->left(3).lower());
1364
// Confirm overwriting file.
1365
if ( QFile::exists( fileName ) )
1366
if (QMessageBox::information(this, PACKAGE,
1367
tr("This file already exists. Do you want to overwrite it?"),
1368
tr("Yes"), tr("No"), 0, 0, 1) == 1)
1371
//QString filter = dlg.selectedFilter().left(3);
1372
board->exportPicture(fileName, filter->left(3));
1376
void MainWindow::slotFileExportPicClipB()
1378
board->exportPicture(NULL, NULL, true);
1381
void MainWindow::slotEditCut()
1386
void MainWindow::slotEditPaste()
1391
void MainWindow::slotEditPasteBrother()
1393
board->pasteNode(true);
1396
void MainWindow::slotEditDelete()
1398
board->deleteNode();
1401
void MainWindow::slotEditNumberMoves()
1403
board->numberMoves();
1406
void MainWindow::slotEditMarkBrothers()
1408
board->markVariations(false);
1411
void MainWindow::slotEditMarkSons()
1413
board->markVariations(true);
1416
void MainWindow::slotNavBackward()
1418
board->previousMove();
1421
void MainWindow::slotNavForward()
1426
void MainWindow::slotNavFirst()
1428
board->gotoFirstMove();
1431
void MainWindow::slotNavLast()
1433
board->gotoLastMove();
1436
// this slot is used for edit window to navigate to last made move
1437
void MainWindow::slotNavLastByTime()
1439
board->gotoLastMoveByTime();
1442
void MainWindow::slotNavNextVar()
1444
board->nextVariation();
1447
void MainWindow::slotNavPrevVar()
1449
board->previousVariation();
1452
void MainWindow::slotNavNextComment() //added eb
1454
board->nextComment();
1457
void MainWindow::slotNavPrevComment()
1459
board->previousComment();
1462
void MainWindow::slotNavStartVar()
1464
board->gotoVarStart();
1467
void MainWindow::slotNavMainBranch()
1469
board->gotoMainBranch();
1472
void MainWindow::slotNavNextBranch()
1474
board->gotoNextBranch();
1477
void MainWindow::slotNavIntersection() // added eb 11
1479
board->navIntersection();
1484
void MainWindow::slotNavNthMove()
1486
NthMoveDialog dlg(this, tr("entermove"), true);
1487
dlg.moveSpinBox->setValue(board->getCurrentMoveNumber());
1488
dlg.moveSpinBox->setFocus();
1490
if (dlg.exec() == QDialog::Accepted)
1491
board->gotoNthMove(dlg.moveSpinBox->value());
1494
void MainWindow::slotNavAutoplay(bool toggle)
1499
statusBar()->message(tr("Autoplay stopped."));
1503
if (setting->readIntEntry("TIMER_INTERVAL") < 0)
1504
setting->writeIntEntry("TIMER_INTERVAL", 0);
1505
else if (setting->readIntEntry("TIMER_INTERVAL") > 5)
1506
setting->writeIntEntry("TIMER_INTERVAL", 5);
1507
// check if time info available from sgf file
1508
if (setting->readBoolEntry("SGF_TIME_TAGS") && board->getGameData()->timeSystem != none)
1509
// set time to 1 sec
1512
// set time interval as selected
1513
timer->start(int(timerIntervals[setting->readIntEntry("TIMER_INTERVAL")] * 1000));
1514
statusBar()->message(tr("Autoplay started."));
1518
void MainWindow::slotNavEmptyBranch()
1523
void MainWindow::slotNavCloneNode()
1525
board->duplicateNode();
1526
statusBar()->message(tr("Variation duplicated."));
1529
void MainWindow::slotNavSwapVariations()
1531
if (board->swapVariations())
1532
statusBar()->message(tr("Variations swapped."));
1534
statusBar()->message(tr("No previous variation available."));
1537
void MainWindow::slotSetPreferences()
1540
dlgSetPreferences(-1);
1543
void MainWindow::dlgSetPreferences(int tab)
1545
PreferencesDialog dlg(this, tr("preferences"), true);
1549
// set to default tab - no check for Qt 2.3.x
1550
if (dlg.tabWidget->count() <= tab+1)
1551
dlg.tabWidget->setCurrentPage(tab);
1555
dlg.styleListBox->setCurrentItem(setting->readIntEntry("STYLE"));
1556
dlg.woodListBox->setCurrentItem(setting->readIntEntry("SKIN"));
1557
dlg.languageComboBox->insertStringList(setting->getAvailableLanguages());
1558
dlg.languageComboBox->setCurrentItem(setting->convertLanguageCodeToNumber());
1559
dlg.commentComboBox->setCurrentItem(setting->readIntEntry("VIEW_COMMENT"));
1560
dlg.stonesShadowCheckBox->setChecked(setting->readBoolEntry("STONES_SHADOW"));
1561
dlg.stonesShellsCheckBox->setChecked(setting->readBoolEntry("STONES_SHELLS"));
1562
dlg.stoneSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_STONE"));
1563
dlg.autoplaySoundCheckBox->setChecked(setting->readBoolEntry("SOUND_AUTOPLAY"));
1564
dlg.talkSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_TALK"));
1565
dlg.matchSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_MATCH"));
1566
dlg.passSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_PASS"));
1567
dlg.gameEndSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_GAMEEND"));
1568
dlg.timeSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_TIME"));
1569
dlg.saySoundCheckBox->setChecked(setting->readBoolEntry("SOUND_SAY"));
1570
dlg.enterSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_ENTER"));
1571
dlg.leaveSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_LEAVE"));
1572
dlg.disConnectSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_DISCONNECT"));
1573
dlg.connectSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_CONNECT"));
1574
dlg.variationComboBox->setCurrentItem(setting->readIntEntry("VAR_GHOSTS"));
1575
dlg.coordsCheckBox->setChecked(setting->readBoolEntry("BOARD_COORDS"));
1576
dlg.toolTipCoordsCheckBox->setChecked(setting->readBoolEntry("BOARD_COORDS_TIP"));
1577
dlg.cursorCheckBox->setChecked(setting->readBoolEntry("CURSOR"));
1578
dlg.smallerMarksCheckBox->setChecked(setting->readBoolEntry("SMALL_MARKS"));
1579
dlg.boldMarksCheckBox->setChecked(setting->readBoolEntry("BOLD_MARKS"));
1580
dlg.adjustFontSizeCheckBox->setChecked(setting->readBoolEntry("ADJ_FONT"));
1581
dlg.smallerStonesCheckBox->setChecked(setting->readBoolEntry("SMALL_STONES"));
1582
dlg.tooltipsCheckBox->setChecked(!(setting->readBoolEntry("TOOLTIPS")));
1583
dlg.timerComboBox->setCurrentItem(setting->readIntEntry("TIMER_INTERVAL"));
1584
dlg.BYTimeSpin->setValue(setting->readIntEntry("BY_TIMER"));
1585
dlg.sgfTimeTagsCheckBox->setChecked(setting->readBoolEntry("SGF_TIME_TAGS"));
1586
dlg.sliderCheckBox->setChecked(setting->readBoolEntry("SLIDER"));
1587
dlg.sidebarCheckBox->setChecked(setting->readBoolEntry("SIDEBAR"));
1588
dlg.sidebarLeftCheckBox->setChecked(setting->readBoolEntry("SIDEBAR_LEFT"));
1589
// dlg.rememberFontCheckBox->setChecked(setting->readBoolEntry("REM_FONT"));
1590
dlg.variableFontCheckBox->setChecked(setting->readBoolEntry("VAR_FONT"));
1593
dlg.blackStoneEdit->setText(QString(QChar(setting->charset->blackStone)));
1594
dlg.whiteStoneEdit->setText(QString(QChar(setting->charset->whiteStone)));
1595
dlg.starPointEdit->setText(QString(QChar(setting->charset->starPoint)));
1596
dlg.emptyPointEdit->setText(QString(QChar(setting->charset->emptyPoint)));
1597
dlg.hBorderEdit->setText(QString(QChar(setting->charset->hBorder)));
1598
dlg.vBorderEdit->setText(QString(QChar(setting->charset->vBorder)));
1599
dlg.addBrotherCheckBox->setChecked(setting->addImportAsBrother);
1602
dlg.fastLoadCheckBox->setChecked(board->fastLoad);
1603
dlg.rememberDirCheckBox->setChecked(setting->readBoolEntry("REM_DIR"));
1604
dlg.codecListBox->setCurrentItem(setting->readIntEntry("CODEC"));
1606
// Client Window tab
1607
dlg.LineEdit_watch->setText(setting->readEntry("WATCH"));
1608
dlg.LineEdit_exclude->setText(setting->readEntry("EXCLUDE"));
1609
dlg.CheckBox_extUserInfo->setChecked(setting->readBoolEntry("EXTUSERINFO"));
1610
dlg.LineEdit_computer->setText(setting->readEntry("COMPUTER_PATH")); //SL added eb 12
1611
dlg.computerButtonWhite->setChecked(setting->readBoolEntry("COMPUTER_WHITE"));
1612
dlg.computerButtonBlack->setChecked(setting->readBoolEntry("COMPUTER_BLACK"));
1613
dlg.humanButtonWhite->setChecked(!setting->readBoolEntry("COMPUTER_WHITE"));
1614
dlg.humanButtonBlack->setChecked(!setting->readBoolEntry("COMPUTER_BLACK"));
1615
dlg.computerSizeSpin->setValue(setting->readIntEntry("COMPUTER_SIZE"));
1616
dlg.computerHandicapSpin->setValue(setting->readIntEntry("COMPUTER_HANDICAP"));
1621
dlg.boardSizeSpin->setValue(setting->readIntEntry("DEFAULT_SIZE"));
1622
dlg.timeSpin->setValue(setting->readIntEntry("DEFAULT_TIME"));
1623
dlg.BYSpin->setValue(setting->readIntEntry("DEFAULT_BY"));
1624
dlg.komiSpinDefault->setValue(setting->readIntEntry("DEFAULT_KOMI"));
1625
dlg.automaticNegotiationCheckBox->setChecked(setting->readBoolEntry("DEFAULT_AUTONEGO"));
1628
// do some size changes
1629
QSize qs = dlg.pb_add->minimumSizeHint();
1630
if (dlg.pb_new->minimumSizeHint().width() > qs.width())
1631
qs = dlg.pb_new->minimumSizeHint();
1632
if (dlg.pb_delete->minimumSizeHint().width() > qs.width())
1633
qs = dlg.pb_delete->minimumSizeHint();
1637
dlg.pb_add->setMaximumSize(qs);
1638
dlg.pb_new->setMaximumSize(qs);
1639
dlg.pb_delete->setMaximumSize(qs);
1641
dlg.pb_add->resize( QSize().expandedTo(qs));
1642
dlg.pb_new->resize( QSize().expandedTo(qs));
1643
dlg.pb_delete->resize( QSize().expandedTo(qs));
1645
if (dlg.exec() == QDialog::Accepted)
1647
preferencesSave(&dlg);
1648
preferencesAccept();
1652
bool MainWindow::preferencesSave(PreferencesDialog *dlg)
1656
setting->writeIntEntry("STYLE", dlg->styleListBox->currentItem());
1657
setting->writeIntEntry("SKIN", dlg->woodListBox->currentItem());
1658
setting->writeEntry("LANG", setting->convertNumberToLanguage(dlg->languageComboBox->currentItem()));
1659
setting->writeIntEntry("VIEW_COMMENT", dlg->commentComboBox->currentItem());
1660
setting->writeBoolEntry("STONES_SHADOW", dlg->stonesShadowCheckBox->isChecked());
1661
setting->writeBoolEntry("STONES_SHELLS", dlg->stonesShellsCheckBox->isChecked());
1662
setting->writeBoolEntry("SOUND_STONE", dlg->stoneSoundCheckBox->isChecked());
1663
setting->writeBoolEntry("SOUND_AUTOPLAY", dlg->autoplaySoundCheckBox->isChecked());
1664
setting->writeBoolEntry("SOUND_TALK", dlg->talkSoundCheckBox->isChecked());
1665
setting->writeBoolEntry("SOUND_MATCH", dlg->matchSoundCheckBox->isChecked());
1666
setting->writeBoolEntry("SOUND_GAMEEND", dlg->passSoundCheckBox->isChecked());
1667
setting->writeBoolEntry("SOUND_PASS", dlg->gameEndSoundCheckBox->isChecked());
1668
setting->writeBoolEntry("SOUND_TIME", dlg->timeSoundCheckBox->isChecked());
1669
setting->writeBoolEntry("SOUND_SAY", dlg->saySoundCheckBox->isChecked());
1670
setting->writeBoolEntry("SOUND_ENTER", dlg->enterSoundCheckBox->isChecked());
1671
setting->writeBoolEntry("SOUND_LEAVE", dlg->leaveSoundCheckBox->isChecked());
1672
setting->writeBoolEntry("SOUND_DISCONNECT", dlg->disConnectSoundCheckBox->isChecked());
1673
setting->writeBoolEntry("SOUND_CONNECT", dlg->connectSoundCheckBox->isChecked());
1674
setting->writeIntEntry("VAR_GHOSTS", dlg->variationComboBox->currentItem());
1675
setting->writeBoolEntry("BOARD_COORDS", dlg->coordsCheckBox->isChecked());
1676
setting->writeBoolEntry("SLIDER", dlg->sliderCheckBox->isChecked());
1677
setting->writeBoolEntry("SIDEBAR", dlg->sidebarCheckBox->isChecked());
1678
setting->writeBoolEntry("SIDEBAR_LEFT", dlg->sidebarLeftCheckBox->isChecked());
1679
setting->writeBoolEntry("BOARD_COORDS_TIP", dlg->toolTipCoordsCheckBox->isChecked());
1680
setting->writeBoolEntry("CURSOR", dlg->cursorCheckBox->isChecked());
1681
setting->writeBoolEntry("SMALL_MARKS", dlg->smallerMarksCheckBox->isChecked());
1682
setting->writeBoolEntry("BOLD_MARKS", dlg->boldMarksCheckBox->isChecked());
1683
setting->writeBoolEntry("ADJ_FONT", dlg->adjustFontSizeCheckBox->isChecked());
1684
setting->writeBoolEntry("SMALL_STONES", dlg->smallerStonesCheckBox->isChecked());
1685
setting->writeBoolEntry("TOOLTIPS", !(dlg->tooltipsCheckBox->isChecked()));
1686
setting->writeIntEntry("BY_TIMER", dlg->BYTimeSpin->text().toInt());
1687
setting->writeIntEntry("TIMER_INTERVAL", dlg->timerComboBox->currentItem());
1688
setting->writeBoolEntry("SGF_TIME_TAGS", dlg->sgfTimeTagsCheckBox->isChecked());
1689
setting->charset->blackStone = dlg->blackStoneEdit->text().at(0).latin1();
1690
setting->charset->whiteStone = dlg->whiteStoneEdit->text().at(0).latin1();
1691
setting->charset->starPoint = dlg->starPointEdit->text().at(0).latin1();
1692
setting->charset->emptyPoint = dlg->emptyPointEdit->text().at(0).latin1();
1693
setting->charset->hBorder = dlg->hBorderEdit->text().at(0).latin1();
1694
setting->charset->vBorder = dlg->vBorderEdit->text().at(0).latin1();
1695
setting->addImportAsBrother = dlg->addBrotherCheckBox->isChecked();
1696
setting->fastLoad = dlg->fastLoadCheckBox->isChecked();
1697
setting->writeBoolEntry("REM_DIR", dlg->rememberDirCheckBox->isChecked());
1698
// setting->writeBoolEntry("REM_FONT", dlg->rememberFontCheckBox->isChecked());
1699
setting->writeBoolEntry("VAR_FONT", dlg->variableFontCheckBox->isChecked());
1700
setting->writeIntEntry("CODEC", dlg->codecListBox->currentItem());
1702
// Client Window Tab
1703
setting->writeEntry("WATCH", dlg->LineEdit_watch->text());
1704
setting->writeEntry("EXCLUDE", dlg->LineEdit_exclude->text());
1705
setting->writeBoolEntry("EXTUSERINFO", dlg->CheckBox_extUserInfo->isChecked());
1706
setting->writeIntEntry("DEFAULT_SIZE", dlg->boardSizeSpin->text().toInt());
1707
setting->writeIntEntry("DEFAULT_TIME", dlg->timeSpin->text().toInt());
1708
setting->writeIntEntry("DEFAULT_BY", dlg->BYSpin->text().toInt());
1709
setting->writeIntEntry("DEFAULT_KOMI", dlg->komiSpinDefault->text().toFloat());
1710
setting->writeBoolEntry("DEFAULT_AUTONEGO", dlg->automaticNegotiationCheckBox->isChecked());
1714
setting->writeEntry("COMPUTER_PATH", dlg->LineEdit_computer->text()); //SL added eb 12
1715
setting->writeBoolEntry("COMPUTER_WHITE", dlg->computerButtonWhite->isChecked());
1716
setting->writeBoolEntry("COMPUTER_BLACK", dlg->computerButtonBlack->isChecked());
1717
setting->writeIntEntry("COMPUTER_SIZE", dlg->computerSizeSpin->text().toInt());
1718
setting->writeIntEntry("COMPUTER_HANDICAP", dlg->computerHandicapSpin->text().toInt());
1723
void MainWindow::updateBoard()
1726
viewSlider->setOn(setting->readBoolEntry("SLIDER"));
1727
viewSidebar->setOn(setting->readBoolEntry("SIDEBAR"));
1728
viewCoords->setOn(setting->readBoolEntry("BOARD_COORDS"));
1729
// viewComment->setOn(setting->readIntEntry("VIEW_COMMENT"));
1731
if (setting->readIntEntry("VIEW_COMMENT"))
1733
// viewVertComment->setEnabled(true);
1734
viewVertComment->setOn(setting->readIntEntry("VIEW_COMMENT") == 2);
1738
QToolTip::setEnabled(setting->readBoolEntry("TOOLTIPS"));
1740
if (timer->isActive())
1742
if (setting->readBoolEntry("SGF_TIME_TAGS") && board->getGameData()->timeSystem != none)
1743
timer->changeInterval(1000);
1745
timer->changeInterval(int(timerIntervals[setting->readIntEntry("TIMER_INVERVAL")] * 1000));
1749
board->fastLoad = setting->fastLoad;
1751
slotViewLeftSidebar();
1752
board->setVariationDisplay(static_cast<VariationDisplay>(setting->readIntEntry("VAR_GHOSTS")));
1753
board->setShowCursor(setting->readBoolEntry("CURSOR"));
1754
board->changeSize(); // For smaller stones
1757
bool MainWindow::preferencesAccept()
1760
setApplicationStyle();
1762
// Update all boards with settings
1763
setting->qgo->updateAllBoardSettings();
1764
setting->qgo->updateFont();
1766
return true;//result;
1769
void MainWindow::slotSetGameInfo()
1771
GameInfoDialog dlg(this, "gameinfo", true);
1773
dlg.playerWhiteEdit->setText(board->getGameData()->playerWhite);
1775
dlg.playerBlackEdit->setText(board->getGameData()->playerBlack);
1776
dlg.whiteRankEdit->setText(board->getGameData()->rankWhite);
1777
dlg.blackRankEdit->setText(board->getGameData()->rankBlack);
1778
dlg.komiSpin->setValue((int)(board->getGameData()->komi * 10.0));
1779
dlg.handicapSpin->setValue(board->getGameData()->handicap);
1780
dlg.resultEdit->setText(board->getGameData()->result);
1781
dlg.dateEdit->setText(board->getGameData()->date);
1782
dlg.placeEdit->setText(board->getGameData()->place);
1783
dlg.copyrightEdit->setText(board->getGameData()->copyright);
1784
dlg.gameNameEdit->setText(board->getGameData()->gameName);
1786
if (dlg.exec() == QDialog::Accepted)
1788
board->getGameData()->playerWhite = dlg.playerWhiteEdit->text();
1789
board->getGameData()->playerBlack = dlg.playerBlackEdit->text();
1790
board->getGameData()->rankWhite = dlg.whiteRankEdit->text();
1791
board->getGameData()->rankBlack = dlg.blackRankEdit->text();
1792
board->getGameData()->komi = (float)dlg.komiSpin->value() / 10.0;
1793
board->getGameData()->handicap = dlg.handicapSpin->value();
1794
board->getGameData()->result = dlg.resultEdit->text();
1795
board->getGameData()->date = dlg.dateEdit->text();
1796
board->getGameData()->place = dlg.placeEdit->text();
1797
board->getGameData()->copyright = dlg.copyrightEdit->text();
1798
board->getGameData()->gameName = dlg.gameNameEdit->text();
1800
board->isModified = true;
1801
board->updateCaption(); // Update caption in any case
1804
interfaceHandler->normalTools->komi->setText(QString::number(board->getGameData()->komi));
1805
interfaceHandler->normalTools->handicap->setText(QString::number(board->getGameData()->handicap));
1808
void MainWindow::slotViewFileBar(bool toggle)
1815
setting->writeBoolEntry("FILEBAR", toggle);
1817
statusBar()->message(tr("Ready."));
1820
void MainWindow::slotViewToolBar(bool toggle)
1828
setting->writeBoolEntry("TOOLBAR", toggle);
1830
statusBar()->message(tr("Ready."));
1833
void MainWindow::slotViewEditBar(bool toggle)
1840
setting->writeBoolEntry("EDITBAR", toggle);
1842
statusBar()->message(tr("Ready."));
1845
void MainWindow::slotViewMenuBar(bool toggle)
1852
statusBar()->message(tr("Ready."));
1855
void MainWindow::slotViewStatusBar(bool toggle)
1859
statusBar()->hide();
1860
// Disconnect this signal, if the statusbar is hidden, we dont need it
1861
disconnect(board, SIGNAL(coordsChanged(int, int, int)), statusTip, SLOT(slotStatusTipCoords(int, int, int)));
1865
statusBar()->show();
1866
// Connect the mouseMove event of the board with the status bar coords widget
1867
connect(board, SIGNAL(coordsChanged(int, int, int)), statusTip, SLOT(slotStatusTipCoords(int, int, int)));
1870
statusBar()->message(tr("Ready."));
1873
void MainWindow::slotViewCoords(bool toggle)
1876
board->setShowCoords(false);
1878
board->setShowCoords(true);
1880
statusBar()->message(tr("Ready."));
1883
void MainWindow::slotViewSlider(bool toggle)
1886
mainWidget->toggleSlider(false);
1888
mainWidget->toggleSlider(true);
1890
statusBar()->message(tr("Ready."));
1893
void MainWindow::slotViewComment(bool toggle)
1895
// setting->writeIntEntry("VIEW_COMMENT", toggle ? viewVertComment->isOn() ? 2 : 1 : 0);
1898
commentEdit->hide();
1899
commentEdit2->hide();
1900
viewVertComment->setEnabled(false);
1902
ListView_observers->hide();
1908
commentEdit->show();
1909
commentEdit2->show();
1910
viewVertComment->setEnabled(true);
1912
ListView_observers->show();
1917
statusBar()->message(tr("Ready."));
1920
void MainWindow::slotViewVertComment(bool toggle)
1922
// setting->writeIntEntry("VIEW_COMMENT", toggle ? 2 : 1);
1923
splitter->setOrientation(toggle ? Horizontal : Vertical);
1924
splitter->setResizeMode(mainWidget, QSplitter::KeepSize);
1925
splitter_comment->setOrientation(!toggle ? Horizontal : Vertical);
1926
splitter_comment->setResizeMode(ListView_observers, QSplitter::KeepSize);
1929
// set sidbar left or right
1930
void MainWindow::slotViewLeftSidebar()
1932
mainWidgetGuiLayout->remove(mainWidget->boardFrame);
1933
mainWidgetGuiLayout->remove(mainWidget->toolsFrame);
1935
if (setting->readBoolEntry("SIDEBAR_LEFT"))
1937
mainWidgetGuiLayout->addWidget(mainWidget->toolsFrame, 0, 0);
1938
mainWidgetGuiLayout->addWidget(mainWidget->boardFrame, 0, 1);
1943
mainWidgetGuiLayout->addWidget(mainWidget->toolsFrame, 0, 1);
1944
mainWidgetGuiLayout->addWidget(mainWidget->boardFrame, 0, 0);
1948
void MainWindow::slotViewSidebar(bool toggle)
1950
interfaceHandler->toggleSidebar(toggle);
1951
setting->writeBoolEntry("SIDEBAR", toggle);
1953
statusBar()->message(tr("Ready."));
1956
void MainWindow::slotViewPinComment(bool toggle)
1960
commentEdit->reparent(splitter, QPoint(0, 0), true);
1961
viewComment->setOn(true);
1962
viewVertComment->setEnabled(true);
1966
commentEdit->reparent(this, WType_TopLevel, QPoint(0, 0), true);
1967
commentEdit->setGeometry(200, 100, 400, 200);
1968
viewComment->setOn(true);
1969
viewVertComment->setEnabled(false);
1971
statusBar()->message(tr("Ready."));
1974
void MainWindow::slotViewIncreaseSize()
1976
board->increaseSize();
1979
void MainWindow::slotViewDecreaseSize()
1981
board->decreaseSize();
1984
void MainWindow::slotViewSaveSize()
1986
reStoreWindowSize("0", true);
1989
void MainWindow::slotViewFullscreen(bool toggle)
1996
isFullScreen = toggle;
1999
void MainWindow::slotHelpManual()
2001
setting->qgo->openManual();
2004
void MainWindow::slotHelpSoundInfo()
2007
setting->qgo->testSound(true);
2010
void MainWindow::slotHelpAbout()
2012
setting->qgo->slotHelpAbout();
2015
void MainWindow::slotHelpAboutQt()
2017
QMessageBox::aboutQt(this);
2020
void MainWindow::slotToggleMarks()
2022
interfaceHandler->toggleMarks();
2025
void MainWindow::slotTimerForward()
2027
static int eventCounter = 0;
2028
static int moveHasTimeInfo = 0;
2030
if (timer->isActive() && setting->readBoolEntry("SGF_TIME_TAGS") && board->getGameData()->timeSystem != none)
2032
bool isBlacksTurn = board->getBoardHandler()->getBlackTurn();
2034
// decrease time info
2039
tmp = interfaceHandler->normalTools->pb_timeBlack->text();
2041
tmp = interfaceHandler->normalTools->pb_timeWhite->text();
2046
switch (tmp.contains(":"))
2050
pos1 = tmp.find(":") ;
2051
seconds += tmp.left(pos1).toInt()*3600;
2054
pos2 = tmp.findRev(":", -1);
2055
seconds += tmp.mid(pos1, pos2-pos1).toInt()*60;
2056
seconds += tmp.mid(pos2+1, 2).toInt();
2059
if (tmp.contains("-"))
2063
int openMoves = ((pos1 = tmp.find("/")) != -1 ? tmp.right(tmp.length() - pos1 - 1).toInt() : -1);
2065
// set stones using sgf's time info
2066
Move *m = board->getBoardHandler()->getTree()->getCurrent();
2068
interfaceHandler->setTimes(isBlacksTurn, seconds, openMoves);
2070
if (m->getMoveNumber() == 0)
2071
board->nextMove(setting->readBoolEntry("SOUND_AUTOPLAY"));
2072
else if (m->son == 0)
2075
navAutoplay->setOn(false);
2076
statusBar()->message(tr("Autoplay stopped."));
2078
else if (!m->son->getTimeinfo())
2080
// no time info at this node; use settings
2081
int time = int(timerIntervals[setting->readIntEntry("TIMER_INTERVAL")]);
2082
if ((time > 1 && (++eventCounter%time == 0) || time <= 1) &&
2083
!board->nextMove(setting->readBoolEntry("SOUND_AUTOPLAY")))
2086
navAutoplay->setOn(false);
2087
statusBar()->message(tr("Autoplay stopped."));
2090
// indicate move to have time Info
2091
moveHasTimeInfo = 2;
2093
else if (m->son->getTimeLeft() >= seconds || moveHasTimeInfo > 0)
2095
// check if byoyomi period changed
2096
if (board->getGameData()->timeSystem == canadian &&
2097
m->son->getOpenMoves() > openMoves+1 && moveHasTimeInfo == 0)
2099
if (seconds > (m->son->getTimeLeft() - board->getGameData()->byoTime))
2103
if (!board->nextMove(setting->readBoolEntry("SOUND_AUTOPLAY")))
2106
navAutoplay->setOn(false);
2107
statusBar()->message(tr("Autoplay stopped."));
2110
if (moveHasTimeInfo > 0)
2114
else if ((!board->nextMove(setting->readBoolEntry("SOUND_AUTOPLAY")) || !isActiveWindow())
2115
&& timer->isActive())
2118
navAutoplay->setOn(false);
2119
statusBar()->message(tr("Autoplay stopped."));
2123
void MainWindow::setApplicationStyle()
2125
if (setting->readIntEntry("STYLE") < 0 || setting->readIntEntry("STYLE") > 6)
2126
setting->writeEntry("STYLE", "0");
2128
switch (setting->readIntEntry("STYLE"))
2131
//qApp->setStyle(NULL);
2132
qApp->setStyle(style);
2136
qApp->setStyle(new QWindowsStyle);
2140
qApp->setStyle(new QPlatinumStyle);
2144
qApp->setStyle(new QMotifStyle);
2148
qApp->setStyle(new QMotifPlusStyle);
2152
//qApp->setStyle(new QCDEStyle);
2156
//qApp->setStyle(new QSGIStyle);
2160
qWarning("Unrecognized style!");
2164
// store and restore window properties
2165
bool MainWindow::reStoreWindowSize(QString strKey, bool store)
2169
// store window size, format, comment format
2170
setting->writeIntEntry("BOARDVERTCOMMENT_" + strKey, !viewComment->isOn() ? 2 : viewVertComment->isOn());
2171
setting->writeBoolEntry("BOARDFULLSCREEN_" + strKey, isFullScreen);
2173
setting->writeEntry("BOARDWINDOW_" + strKey,
2174
QString::number(pos().x()) + DELIMITER +
2175
QString::number(pos().y()) + DELIMITER +
2176
QString::number(size().width()) + DELIMITER +
2177
QString::number(size().height()));
2179
setting->writeEntry("BOARDSPLITTER_" + strKey,
2180
QString::number(splitter->sizes().first()) + DELIMITER +
2181
QString::number(splitter->sizes().last()) + DELIMITER +
2182
QString::number(splitter_comment->sizes().first()) + DELIMITER +
2183
QString::number(splitter_comment->sizes().last()));
2185
statusBar()->message(tr("Window size saved.") + " (" + strKey + ")");
2189
// restore board window
2190
QString s = setting->readEntry("BOARDWINDOW_" + strKey);
2193
// do not resize until end of this procedure
2194
board->lockResize = true;
2196
if (setting->readBoolEntry("BOARDFULLSCREEN_" + strKey))
2197
viewFullscreen->setOn(true);
2200
viewFullscreen->setOn(false);
2202
p.setX(element(s, 0, DELIMITER).toInt());
2203
p.setY(element(s, 1, DELIMITER).toInt());
2205
sz.setWidth(element(s, 2, DELIMITER).toInt());
2206
sz.setHeight(element(s, 3, DELIMITER).toInt());
2211
if (setting->readIntEntry("BOARDVERTCOMMENT_" + strKey) == 2)
2213
// do not view comment
2214
viewComment->setOn(false);
2219
viewComment->setOn(true);
2221
viewVertComment->setOn(setting->readIntEntry("VIEW_COMMENT") == 2 ||
2222
setting->readIntEntry("VIEW_COMMENT") == 0 && setting->readIntEntry("BOARDVERTCOMMENT_" + strKey));
2224
// restore splitter in board window
2225
s = setting->readEntry("BOARDSPLITTER_" + strKey);
2230
i = element(s, 2, DELIMITER).toInt();
2231
j = element(s, 3, DELIMITER).toInt();
2234
splitter_comment->setSizes(w1);
2237
i = element(s, 0, DELIMITER).toInt();
2238
j = element(s, 1, DELIMITER).toInt();
2241
splitter->setSizes(w1);
2245
// do some other stuff
2246
// maybe not correct set at startup time
2247
slotViewCoords(viewCoords->isOn());
2250
board->lockResize = false;
2251
board->changeSize();
2253
statusBar()->message(tr("Window size restored.") + " (" + strKey + ")");
2255
// update current move
2256
board->refreshDisplay();
2259
// window sizes not found
2266
void MainWindow::keyPressEvent(QKeyEvent *e)
2268
// check for window resize command = number button
2269
if (e->key() >= Key_0 && e->key() <= Key_9)
2271
QString strKey = QString::number(e->key() - Key_0);
2273
if (e->state() & AltButton)
2276
reStoreWindowSize(strKey, true);
2279
else if (e->state() & ControlButton)
2282
if (!reStoreWindowSize(strKey, false))
2284
// sizes not found -> leave
2293
bool localGame = true;
2294
// don't view last moves while observing or playing
2295
if (getBoard()->getGameMode() == modeObserve ||
2296
getBoard()->getGameMode() == modeMatch ||
2297
getBoard()->getGameMode() == modeTeach)
2310
board->openSGF("foo.sgf");
2314
board->saveBoard("foo.sgf");
2318
board->openSGF("foo.xml", "XML");
2325
if (localGame || (getBoard()->getGameMode() == modeObserve))
2330
if (localGame || (getBoard()->getGameMode() == modeObserve))
2361
void MainWindow::closeEvent(QCloseEvent *e)
2363
// qDebug("MainWindow::closeEvent(QCloseEvent *e)");
2364
if (getBoard()->getGameMode() == modeObserve || checkModified() == 1)
2366
emit signal_closeevent();
2367
//qGo::removeBoardWindow(this);
2369
QTimer::singleShot(1000, (QWidget*)parent_, SLOT(slot_closeevent()));
2371
qWarning("*** BOARD CANNOT BE DELETED");
2378
int MainWindow::checkModified(bool interactive)
2380
if (!board->isModified)
2386
switch (QMessageBox::warning(this, PACKAGE,
2387
tr("You modified the game.\nDo you want to save your changes?"),
2388
tr("Yes"), tr("No"), tr("Cancel"),
2392
return slotFileSave() && !board->isModified;
2401
qWarning("Unknown messagebox input.");
2408
void MainWindow::rememberLastDir(const QString &file)
2410
int pos = 0, lastpos = -1;
2412
while ((pos = file.find('/', pos)) != -1 && pos++ < static_cast<int>(file.length()))
2417
setting->writeEntry("LAST_DIR", "");
2420
setting->writeEntry("LAST_DIR", file.left(lastpos));
2422
// qDebug("LAST DIR: %s", qGo::getSettings()->lastDir.latin1());
2425
void MainWindow::updateFont()
2428
setFont(setting->fontComments);
2431
ListView_observers->setFont(setting->fontLists);
2433
// rest: standard font
2434
mainWidget->setFont(setting->fontStandard);
2435
mainWidget->normalTools->pb_timeWhite->setFont(setting->fontClocks);
2436
mainWidget->normalTools->pb_timeBlack->setFont(setting->fontClocks);
2439
QPalette pal = commentEdit2->palette();
2440
pal.setColor(QColorGroup::Base, setting->colorBackground);
2441
commentEdit2->setPalette(pal);
2442
ListView_observers->setPalette(pal);
2443
pal = commentEdit->palette();
2444
pal.setColor(QColorGroup::Base, setting->colorBackground);
2445
commentEdit->setPalette(pal);
2448
// used in slot_editBoardInNewWindow()
2449
void MainWindow::slot_animateClick()
2451
getInterfaceHandler()->refreshButton->animateClick();
2454
void MainWindow::slot_editBoardInNewWindow()
2456
// online mode -> don't score, open new Window instead
2457
MainWindow *w = setting->qgo->addBoardWindow();
2458
w->reStoreWindowSize("9", false);
2461
w->getInterfaceHandler()->toggleMode();
2462
w->getInterfaceHandler()->toggleMode();
2463
// create update button
2464
w->getInterfaceHandler()->refreshButton->setText(tr("Update"));
2465
QToolTip::add(w->getInterfaceHandler()->refreshButton, tr("Update from online game"));
2466
QWhatsThis::add(w->getInterfaceHandler()->refreshButton, tr("Update from online game to local board and supersede own changes."));
2467
w->getInterfaceHandler()->refreshButton->setEnabled(true);
2468
connect(w->getInterfaceHandler()->refreshButton, SIGNAL(clicked()), this, SLOT(slotFileExportSgfClipB()));
2469
connect(w->getInterfaceHandler()->refreshButton, SIGNAL(clicked()), w, SLOT(slotFileImportSgfClipB()));
2470
connect(w->getInterfaceHandler()->refreshButton, SIGNAL(clicked()), w, SLOT(slotNavLastByTime()));
2471
QTimer::singleShot(100, w, SLOT(slot_animateClick()));
2474
void MainWindow::updateObserverCnt()
2476
ListView_observers->setColumnText(0, tr("Observers") + " (" + QString::number(ListView_observers->childCount()) + ")");
2477
ListView_observers->setSorting(2);
2478
ListView_observers->sort();
2479
ListView_observers->setSorting(-1);
2482
void MainWindow::addObserver(const QString &name)
2484
QString name_without_rank = element(name, 0);
2485
QString rank = element(name, 1);
2486
QString rankkey = rkToKey(rank) + name_without_rank;
2488
new QListViewItem(ListView_observers, name_without_rank, rank, rankkey);
2489
// ListView_observer->addItem
2493
// enable/disable Menu items
2494
void MainWindow::setOnlineMenu(bool onlineMenu)
2498
fileNew->setEnabled(false);
2499
fileOpen->setEnabled(false);
2500
fileImportASCII->setEnabled(false);
2501
fileImportASCIIClipB->setEnabled(false);
2502
fileImportSgfClipB->setEnabled(false);
2503
editCut->setEnabled(false);
2504
editPaste->setEnabled(false);
2505
editPasteBrother->setEnabled(false);
2506
editDelete->setEnabled(false);
2507
editNumberMoves->setEnabled(false);
2508
editMarkBrothers->setEnabled(false);
2509
editMarkSons->setEnabled(false);
2510
navNthMove->setEnabled(false);
2511
navAutoplay->setEnabled(false);
2512
navEmptyBranch->setEnabled(false);
2513
navCloneNode->setEnabled(false);
2515
getMainWidget()->slider->hide();
2516
getMainWidget()->sliderLeftLabel->hide();
2517
getMainWidget()->sliderRightLabel->hide();
2518
getFileBar()->hide();
2519
getToolBar()->hide();
2520
getEditBar()->hide();
2524
fileNew->setEnabled(true);
2525
fileOpen->setEnabled(true);
2526
fileImportASCII->setEnabled(true);
2527
fileImportASCIIClipB->setEnabled(true);
2528
fileImportSgfClipB->setEnabled(true);
2529
editCut->setEnabled(true);
2530
editPaste->setEnabled(true);
2531
editPasteBrother->setEnabled(true);
2532
editDelete->setEnabled(true);
2533
editNumberMoves->setEnabled(true);
2534
editMarkBrothers->setEnabled(true);
2535
editMarkSons->setEnabled(true);
2536
navNthMove->setEnabled(true);
2537
navAutoplay->setEnabled(true);
2538
navEmptyBranch->setEnabled(true);
2539
navCloneNode->setEnabled(true);
2541
if (setting->readBoolEntry("SLIDER"))
2543
getMainWidget()->slider->show();
2544
getMainWidget()->sliderLeftLabel->show();
2545
getMainWidget()->sliderRightLabel->show();
2547
if (setting->readBoolEntry("FILEBAR"))
2548
getFileBar()->show();
2549
if (setting->readBoolEntry("TOOLBAR"))
2550
getToolBar()->show();
2551
if (setting->readBoolEntry("EDITBAR"))
2552
getEditBar()->show();