File indexing completed on 2024-05-12 16:23:35

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2013 by Linuxstopmotion contributors;              *
0003  *   see the AUTHORS file for details.                                     *
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                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 #ifndef TOOLSMENU_H
0021 #define TOOLSMENU_H
0022 
0023 #include <QWidget>
0024 
0025 class QShortcut;
0026 class QTimer;
0027 class QWidget;
0028 class RunAnimationHandler;
0029 class ModelHandler;
0030 class CameraHandler;
0031 class FrameBar;
0032 class Ui_Form;
0033 
0034 /**
0035  * The tools menu on the left side in the application.
0036  *
0037  * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad
0038  */
0039 class ToolsMenu : public QWidget {
0040     Q_OBJECT
0041 public:
0042     /**
0043      * Sets up the toolsmenu.
0044      * @param parent the parent of the widget.
0045      */
0046     ToolsMenu( RunAnimationHandler *runAnimationHandler,
0047             ModelHandler *modelHandler, CameraHandler *cameraHandler,
0048             FrameBar *frameBar, QWidget *parent = 0 );
0049 
0050     ~ToolsMenu();
0051 
0052     /**
0053      * Retranslates the strings.
0054      * This function is called after a new translator has been installed so that
0055      * the program strings are retranslated to the new language.
0056      */
0057     void retranslateStrings();
0058 
0059 public slots:
0060 
0061     /**
0062      * Activates or deactivates the captureGroup
0063      * @param activate true if the group should be activated.
0064      */
0065     void activateCaptureGroup(bool activate);
0066 
0067     /**
0068      * This slot is notified when the size of the model changes so that menuframe
0069      * menu options can be adjusted (activated/deactivated, etc).
0070      * @param modelSize the new size of the model.
0071      */
0072     void fixNavigationButtons(int modelSize);
0073 
0074 private:
0075     Ui_Form* ui;
0076 
0077     RunAnimationHandler *runAnimationHandler;
0078     ModelHandler *modelHandler;
0079     CameraHandler *cameraHandler;
0080     FrameBar *frameBar;
0081 
0082     QShortcut *loopAccel;
0083     QShortcut *playAccel;
0084     QShortcut *mixAccel;
0085     QShortcut *diffAccel;
0086     QShortcut *playbackAccel;
0087     QTimer *captureTimer;
0088 
0089     /**
0090      * Creates connections, adds icons to the buttons and sets
0091      * different properties.
0092      */
0093     void setupUi();
0094 
0095     /**
0096      * Creates key accelerators (keyboard shortcuts)
0097      * More can be found in the function MainWindowGUI::createAccelerators().
0098      */
0099     void createAccelerators();
0100 
0101 private slots:
0102 
0103     /**
0104      * Slot for notified the toolsmenu when the viewing mode changes, so that widgets
0105      * can be updated.
0106      * @param index the new viewing mode.
0107      */
0108     void changeViewingMode(int index);
0109 
0110     /**
0111      * Slot for notified the toolsmenu when the unit mode changes.
0112      * @param index the new unit mode.
0113      */
0114     void changeUnitMode(int index);
0115 
0116     /**
0117      * Slot for updating the slider value when running in automatic mode.
0118      * @param value the new slider value.
0119      */
0120     void updateSliderValue(int value);
0121 
0122     /**
0123      * Slot for setting the camera mode to mixing.
0124      * Used by the shortcut key.
0125      */
0126     void setMixingMode();
0127 
0128     /**
0129      * Slot for setting the camera mode to Diffing.
0130      * Used by the shortcut key.
0131      */
0132     void setDiffingMode();
0133 
0134     /**
0135      * Slot for setting the camera mode to Playback.
0136      * Used by the shortcut key.
0137      */
0138     void setPlaybackMode();
0139 
0140     /**
0141      * Slot for being notified when the camera is turned on so that
0142      * it disable of some buttons.
0143      * @param isOn true if the camera is turned on.
0144      */
0145     void cameraOn(bool isOn);
0146 
0147 signals:
0148     void viewingModeChanged();
0149 };
0150 
0151 #endif