File indexing completed on 2021-12-21 12:50:21

0001 /*
0002  *  ksokoban - a Sokoban game by KDE
0003  *  Copyright (C) 1998  Anders Widell  <d95-awi@nada.kth.se>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License
0016  *  along with this program; if not, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef MAINWINDOW_H
0021 #define MAINWINDOW_H
0022 
0023 #include <KMainWindow>
0024 #include <KHelpMenu>
0025 #include <QUrl>
0026 #include "Bookmark.h"
0027 #include "InternalCollections.h"
0028 
0029 class PlayField;
0030 class QMenu;
0031 class QAction;
0032 class QFocusEvent;
0033 class QDragEnterEvent;
0034 class QDropEvent;
0035 class LevelCollection;
0036 
0037 class MainWindow : public KMainWindow {
0038   Q_OBJECT
0039 public:
0040   MainWindow();
0041   ~MainWindow() override;
0042 
0043   void openURL(const QUrl &_url);
0044 
0045 public slots:
0046   void changeCollection(int id);
0047   void updateAnimMenu(int id);
0048   void setBookmark(int id);
0049   void goToBookmark(int id);
0050 
0051   void loadLevels();
0052 
0053 protected:
0054   void focusInEvent(QFocusEvent*) override;
0055   void createCollectionMenu(QMenu* collection_);
0056   //virtual void dragEnterEvent(QDragEnterEvent*);
0057   void dropEvent(QDropEvent*) override;
0058 
0059 private:
0060   InternalCollections internalCollections_;
0061   LevelCollection *externalCollection_;
0062   QMenuBar        *menu_;
0063   PlayField       *playField_;
0064   Bookmark        *bookmarks_[10];
0065   int              currentCollection_;
0066 
0067   QMenu      *game_;
0068   QMenu      *collection_;
0069   QMenu      *animation_;
0070   QMenu      *bookmarkMenu_;
0071   QMenu      *setBM_;
0072   QMenu      *goToBM_;
0073   QAction    *qa_slow, *qa_medium, *qa_fast, *qa_off, *setBM_act[10], *goToBM_act[10], **level_act;
0074   KHelpMenu        *help_;
0075   int              checkedCollection_;
0076   int              checkedAnim_;
0077 
0078   void updateBookmark(int num);
0079 
0080   void updateAnim(int val);
0081 };
0082 
0083 #endif  /* MAINWINDOW_H */