~ubuntu-branches/ubuntu/maverick/qgo/maverick

« back to all changes in this revision

Viewing changes to src/mainwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* mainwindow.h
 
3
*/
 
4
 
 
5
#ifndef MAINWINDOW_H
 
6
#define MAINWINDOW_H
 
7
 
 
8
#include "preferences.h"
 
9
#include "board.h"
 
10
#include "mainwidget.h"
 
11
#include "misc.h"
 
12
#include "setting.h"
 
13
#include <qmainwindow.h>
 
14
#include <qaction.h>
 
15
#include <qlayout.h>
 
16
#include <qlistview.h>
 
17
 
 
18
class Board;
 
19
class InterfaceHandler;
 
20
class QSplitter;
 
21
class QMultiLineEdit;
 
22
class StatusTip;
 
23
class qGoIF;
 
24
class QNewGameDlg; //SL added eb 12
 
25
 
 
26
struct ASCII_Import;
 
27
 
 
28
class MainWindow : public QMainWindow, public Misc<QString>
 
29
{
 
30
        Q_OBJECT
 
31
                
 
32
public:
 
33
        MainWindow(QWidget* parent = 0, const char* name = 0, WFlags f = WType_TopLevel);
 
34
        ~MainWindow();
 
35
        InterfaceHandler* getInterfaceHandler() const { return interfaceHandler; }
 
36
        Board* getBoard() const { return board; }
 
37
        void setApplicationStyle();
 
38
        bool preferencesAccept();
 
39
        void doOpen(const QString &fileName, const QString &filter=0, bool storedir=true);
 
40
        bool startComputerPlay(QNewGameDlg * dlg,const QString &fileName, const QString &filter, const QString &computer_path);
 
41
        int checkModified(bool interactive=true);
 
42
        void updateFont();
 
43
        static QString getFileExtension(const QString &fileName, bool defaultExt=true);
 
44
        void doScore(bool toggle) { mainWidget->doScore(toggle); }
 
45
        void doRealScore(bool toggle) { mainWidget->doRealScore(toggle); }
 
46
        MainWidget *getMainWidget() { return mainWidget; }
 
47
        bool reStoreWindowSize(QString, bool);
 
48
        bool preferencesSave(PreferencesDialog*);
 
49
        void updateBoard();
 
50
        void addObserver(const QString &name);
 
51
        void clearObserver() { ListView_observers->clear(); }
 
52
        QListView *getListView_observers() { return ListView_observers; }
 
53
        void updateObserverCnt();
 
54
        void setParent(qGoIF *w) { parent_ = w; }
 
55
        qGoIF *getParent() { return parent_; }
 
56
        void dlgSetPreferences(int tab=-1);
 
57
        QAction *get_fileQuit() { return fileQuit; }
 
58
        QAction *get_fileClose() { return fileClose; }
 
59
        int blackPlayerType, whitePlayerType ;
 
60
 
 
61
protected:
 
62
        void initActions();
 
63
        void initMenuBar();
 
64
        void initToolBar();
 
65
        void initStatusBar();
 
66
        void keyPressEvent(QKeyEvent *e);
 
67
        void closeEvent(QCloseEvent *e);
 
68
        bool doSave(QString fileName, bool force=false);
 
69
        void rememberLastDir(const QString &file);
 
70
//  bool eventFilter( QObject *obj, QEvent *ev ); //SL added eb 11
 
71
        
 
72
signals:
 
73
        void signal_closeevent();
 
74
        
 
75
public slots:
 
76
        void slotFileNewBoard();
 
77
        void slotFileNewGame();
 
78
        void slotFileOpen();
 
79
        bool slotFileSave();
 
80
        void slotFileClose();
 
81
        bool slotFileSaveAs();
 
82
        void slotFileImportASCII();
 
83
        void slotFileImportASCIIClipB();
 
84
        void slotFileExportASCII();
 
85
        void slotFileImportSgfClipB();
 
86
        void slotFileExportSgfClipB();
 
87
        void slotFileExportPic();
 
88
        void slotFileExportPicClipB();
 
89
        void slotEditCut();
 
90
        void slotEditPaste();
 
91
        void slotEditPasteBrother();
 
92
        void slotEditDelete();
 
93
        void slotEditNumberMoves();
 
94
        void slotEditMarkBrothers();
 
95
        void slotEditMarkSons();
 
96
        void slotNavBackward();
 
97
        void slotNavForward();
 
98
        void slotNavFirst();
 
99
        void slotNavLast();
 
100
        void slotNavLastByTime();
 
101
        void slotNavNextVar();
 
102
        void slotNavPrevVar();
 
103
        void slotNavNextComment();      //added
 
104
        void slotNavPrevComment();      //end add
 
105
        void slotNavIntersection(); //SL added eb 11
 
106
        void slotNavMainBranch();
 
107
        void slotNavStartVar();
 
108
        void slotNavNextBranch();
 
109
        void slotNavNthMove();
 
110
        void slotNavAutoplay(bool toggle);
 
111
        void slotNavEmptyBranch();
 
112
        void slotNavCloneNode();
 
113
        void slotNavSwapVariations();
 
114
        void slotSetPreferences();
 
115
        void slotSetGameInfo();
 
116
        void slotViewFileBar(bool toggle);
 
117
        void slotViewToolBar(bool toggle);
 
118
        void slotViewEditBar(bool toggle);
 
119
        void slotViewMenuBar(bool toggle);
 
120
        void slotViewStatusBar(bool toggle);
 
121
        void slotViewCoords(bool toggle);
 
122
        void slotViewSlider(bool toggle);
 
123
        void slotViewLeftSidebar();
 
124
        void slotViewSidebar(bool toggle);
 
125
        void slotViewComment(bool toggle);
 
126
        void slotViewVertComment(bool toggle);
 
127
        void slotViewPinComment(bool toggle);
 
128
        void slotViewIncreaseSize();
 
129
        void slotViewDecreaseSize();
 
130
        void slotViewSaveSize();
 
131
        void slotViewFullscreen(bool toggle);
 
132
        void slotHelpManual();
 
133
        void slotHelpSoundInfo();
 
134
        void slotHelpAbout();
 
135
        void slotHelpAboutQt();
 
136
        void slotToggleMarks();
 
137
        void slotTimerForward();
 
138
        void slot_editBoardInNewWindow();
 
139
        void slot_animateClick();
 
140
 
 
141
private:
 
142
        qGoIF *parent_;
 
143
        Board *board;
 
144
        InterfaceHandler *interfaceHandler;
 
145
        MainWidget *mainWidget;
 
146
  QString style;
 
147
        
 
148
        //      HelpViewer *helpViewer;
 
149
        StatusTip *statusTip;
 
150
        QLabel *statusMode, *statusTurn, *statusMark, *statusNav;
 
151
        
 
152
        QSplitter *splitter, *splitter_comment;
 
153
//      QMultiLineEdit *commentEdit;
 
154
        QTextEdit *commentEdit;
 
155
        QLineEdit *commentEdit2;
 
156
        QListView *ListView_observers;
 
157
        
 
158
        QToolBar *fileBar, *toolBar, *editBar;
 
159
        
 
160
        QPopupMenu *fileMenu, *importExportMenu, *editMenu, *navMenu, *settingsMenu, *viewMenu, *helpMenu;
 
161
        
 
162
        QAction *escapeFocus, *toggleEdit, *toggleMarks;
 
163
        QAction *fileNewBoard,*fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileClose,
 
164
                *fileImportASCII, *fileImportASCIIClipB,*fileExportASCII,
 
165
                *fileImportSgfClipB, *fileExportSgfClipB,
 
166
                *fileExportPic, *fileExportPicClipB,
 
167
                *fileQuit;
 
168
        QAction *editCut, *editPaste, *editPasteBrother, *editDelete, *editNumberMoves, *editMarkBrothers,
 
169
                *editMarkSons;
 
170
        QAction *navBackward, *navForward, *navFirst, *navLast, *navNextVar, *navPrevVar,
 
171
                *navMainBranch, *navStartVar, *navNextBranch, *navNthMove, *navAutoplay, *navEmptyBranch,
 
172
                *navCloneNode, *navSwapVariations, *navNextComment, *navPrevComment, *navIntersection ;       //SL added eb 11                               // added eb the 2 last
 
173
        QAction *setPreferences, *setGameInfo;
 
174
        QAction *viewFileBar, *viewToolBar, *viewEditBar, *viewMenuBar, *viewStatusBar, *viewCoords,
 
175
                *viewSlider, *viewSidebar, *viewComment, *viewVertComment, *viewPinComment, *viewIncreaseSize,
 
176
                *viewDecreaseSize, *viewSaveSize, *viewFullscreen;
 
177
        QAction *helpManual, *helpSoundInfo, *helpAboutApp, *helpAboutQt;
 
178
        QTimer *timer;
 
179
        
 
180
        float timerIntervals[6];
 
181
        bool isFullScreen;
 
182
 
 
183
        QGridLayout *mainWidgetGuiLayout;
 
184
};
 
185
 
 
186
#endif
 
187