diff --git a/src/config/mouseinputbutton.h b/src/config/mouseinputbutton.h index 9a18b2d..8c5e4d7 100644 --- a/src/config/mouseinputbutton.h +++ b/src/config/mouseinputbutton.h @@ -1,77 +1,76 @@ /*************************************************************************** * Copyright 2009 Chani Armitage * Copyright 2010 Stefan Majewsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #ifndef PALAPELI_MOUSEINPUTBUTTON_H #define PALAPELI_MOUSEINPUTBUTTON_H #include "../engine/trigger.h" class QLabel; #include -class QToolButton; namespace Palapeli { class MouseInputButton : public QPushButton { Q_OBJECT public: explicit MouseInputButton(QWidget* parent = 0); QSize sizeHint() const Q_DECL_OVERRIDE; ///If unset, this button will not generate any wheel triggers. bool isMouseAllowed() const; void setMouseAllowed(bool mouseAllowed); ///If iunset, this button will not generate any wheel triggers. bool isWheelAllowed() const; void setWheelAllowed(bool wheelAllowed); bool isNoButtonAllowed() const; void setNoButtonAllowed(bool noButtonAllowed); bool showClearButton() const; void setShowClearButton(bool showClearButton); ///If set, a call to setTrigger() will not immediately change the trigger. Instead, the triggerRequest() signal will be fired, and the new trigger will be set only after confirmTrigger() has been called. bool requiresValidation() const; void setRequiresValidation(bool requiresValidation); Palapeli::Trigger trigger() const; Q_SIGNALS: void triggerChanged(const Palapeli::Trigger& newTrigger); void triggerRequest(const Palapeli::Trigger& newTrigger); public Q_SLOTS: void captureTrigger(); void clearTrigger(); void confirmTrigger(const Palapeli::Trigger& trigger); void setTrigger(const Palapeli::Trigger& trigger); protected: bool event(QEvent* event) Q_DECL_OVERRIDE; private: void updateAppearance(); void applyTrigger(const Palapeli::Trigger& newTrigger); void showModifiers(Qt::KeyboardModifiers modifiers); QLabel* m_iconLabel; QLabel* m_mainLabel; QLabel* m_clearButton; Palapeli::Trigger m_trigger, m_stagedTrigger; ///< m_stagedTrigger is the trigger which has been set with setTrigger(), but which is still waiting to be confirmed with confirmTrigger(). bool m_mouseAllowed, m_wheelAllowed; bool m_noButtonAllowed, m_requiresValidation; }; } #endif // PALAPELI_MOUSEINPUTBUTTON_H diff --git a/src/creator/puzzlecreator.h b/src/creator/puzzlecreator.h index 558f813..47a38ff 100644 --- a/src/creator/puzzlecreator.h +++ b/src/creator/puzzlecreator.h @@ -1,70 +1,69 @@ /*************************************************************************** * Copyright 2009, 2010 Stefan Majewsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #ifndef PALAPELI_PUZZLECREATOR_H #define PALAPELI_PUZZLECREATOR_H #include "slicerselector.h" #include class QStackedWidget; #include -class KComboBox; class KLineEdit; class KUrlRequester; namespace Pala { class Slicer; } namespace Palapeli { class Puzzle; class SlicerConfigWidget; class PuzzleCreatorDialog : public KAssistantDialog { Q_OBJECT public: PuzzleCreatorDialog(); Palapeli::Puzzle* result() const; private Q_SLOTS: void checkData(); void updateSlicerSelection(const Palapeli::SlicerSelection& selection); void createPuzzle(); private: Palapeli::Puzzle* m_result; //page items KPageWidgetItem* m_sourcePage; KPageWidgetItem* m_slicerPage; KPageWidgetItem* m_slicerConfigPage; //first page KUrlRequester* m_imageSelector; KLineEdit* m_nameEdit; KLineEdit* m_commentEdit; KLineEdit* m_authorEdit; //second/third page Palapeli::SlicerSelector* m_slicerSelector; QMap m_slicerConfigWidgets; QStackedWidget* m_slicerConfigMasterWidget; }; } #endif // PALAPELI_PUZZLECREATOR_H diff --git a/src/engine/constraintvisualizer.h b/src/engine/constraintvisualizer.h index 1fd2708..bc37424 100644 --- a/src/engine/constraintvisualizer.h +++ b/src/engine/constraintvisualizer.h @@ -1,80 +1,79 @@ /*************************************************************************** * Copyright 2009, 2010 Stefan Majewsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #ifndef PALAPELI_CONSTRAINTVISUALIZER_H #define PALAPELI_CONSTRAINTVISUALIZER_H #include "basics.h" class QPropertyAnimation; #include namespace Palapeli { - class CvHandleItem; class Scene; /* This class creates and manages a draggable frame around a Palapeli * scene, which is used to expand or contract the scene. The principal * Palapeli::Scene object is the puzzle table. When a puzzle is loaded, * the puzzle table and other scenes have their frames (i.e. constraint * visualizers) automatically set to surround the pieces closely. * * A scene can be locked by the user, via Scene::setConstrained(), in * which case the frame and surrounding areas darken and the frame * cannot be moved by pushing pieces against it, but the scene size * can still be changed by dragging the frame with the mouse. * * The scene is then said to be "constrained" and its constraint * visualizer object is "active" (ConstraintVisualizer::m_active true). */ class ConstraintVisualizer : public Palapeli::GraphicsObject { Q_OBJECT public: explicit ConstraintVisualizer(Palapeli::Scene* scene); bool isActive() const; void start (const QRectF& sceneRect, const int thickness); void stop(); public Q_SLOTS: void setActive(bool active); void update(const QRectF& sceneRect); private: enum Side { LeftSide = 0, RightSide, TopSide, BottomSide, SideCount }; enum HandlePosition { LeftHandle = 0, TopLeftHandle, TopHandle, TopRightHandle, RightHandle, BottomRightHandle, BottomHandle, BottomLeftHandle, HandleCount }; Palapeli::Scene* m_scene; bool m_active; QVector m_shadowItems, m_handleItems; QGraphicsPathItem* m_indicatorItem; QRectF m_sceneRect; QPropertyAnimation* m_animator; bool m_isStopped; qreal m_thickness; }; } #endif // PALAPELI_CONSTRAINTVISUALIZER_H diff --git a/src/engine/view.h b/src/engine/view.h index 4acabb2..8854ffa 100644 --- a/src/engine/view.h +++ b/src/engine/view.h @@ -1,96 +1,95 @@ /*************************************************************************** * Copyright 2009, 2010 Stefan Majewsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #ifndef PALAPELI_VIEW_H #define PALAPELI_VIEW_H #include namespace Palapeli { - class ConstraintVisualizer; class InteractorManager; class Scene; class Piece; class View : public QGraphicsView { Q_OBJECT Q_PROPERTY(QRectF viewportRect READ viewportRect WRITE setViewportRect) public: View(); void puzzleStarted(); Palapeli::InteractorManager* interactorManager() const; Palapeli::Scene* scene() const; QRectF viewportRect() const; void setViewportRect(const QRectF& viewportRect); void teleportPieces(Piece* piece, const QPointF& scPos); void toggleCloseUp(); void setCloseUp(bool onOff); void handleNewPieceSelection(); static const int MinimumZoomLevel; static const int MaximumZoomLevel; public Q_SLOTS: void logSceneChange(const QRectF &r); // IDW test. void setScene(Palapeli::Scene* scene); void moveViewportBy(const QPointF& sceneDelta); void zoomSliderInput(int level); void zoomIn(); void zoomOut(); void zoomBy(int delta); //delta = 0 -> no change, delta < 0 -> zoom out, delta > 0 -> zoom in void zoomTo(int level); //level = 100 -> actual size protected: void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; void keyReleaseEvent(QKeyEvent* event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE; void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE; Q_SIGNALS: void zoomLevelChanged(int level); void zoomAdjustable(bool adjustable); void teleport(Piece* p, const QPointF& scPos, View* v); void newPieceSelectionSeen(View* v); protected: virtual int calculateZoomRange(qreal distantScale, bool distantView); virtual qreal calculateCloseUpScale(); private Q_SLOTS: void startVictoryAnimation(); void adjustPointer(); private: Palapeli::InteractorManager* m_interactorManager; Palapeli::Scene* m_scene; QPointF m_dragPrevPos; int m_zoomLevel; int m_closeUpLevel; int m_distantLevel; bool m_isCloseUp; qreal m_dZoom; qreal m_minScale; QPoint m_mousePos; QPointF m_scenePos; bool m_adjustPointer; }; } #endif // PALAPELI_VIEW_H diff --git a/src/window/mainwindow.h b/src/window/mainwindow.h index dccd3e6..63cb813 100644 --- a/src/window/mainwindow.h +++ b/src/window/mainwindow.h @@ -1,49 +1,45 @@ /*************************************************************************** * Copyright 2009-2011 Stefan Majewsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #ifndef PALAPELI_MAINWINDOW_H #define PALAPELI_MAINWINDOW_H -class QStackedWidget; #include namespace Palapeli { class GamePlay; - class CollectionView; class Puzzle; - class PuzzleTableWidget; - class PuzzlePreview; class MainWindow : public KXmlGuiWindow { Q_OBJECT public: explicit MainWindow(const QString &path); protected: bool queryClose() Q_DECL_OVERRIDE; private Q_SLOTS: void enableMessages(); private: void setupActions(); Palapeli::GamePlay* m_game; }; } #endif // PALAPELI_MAINWINDOW_H