File indexing completed on 2024-04-28 05:38:15
0001 /*************************************************************************** 0002 * Copyright (C) 2007 by Romain Campioni * 0003 * Copyright (C) 2009 by Renaud Guezennec * 0004 * https://rolisteam.org/contact * 0005 * * 0006 * rolisteam is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0020 ***************************************************************************/ 0021 0022 #ifndef TOOLS_BAR_H 0023 #define TOOLS_BAR_H 0024 0025 #include <QAction> 0026 #include <QDockWidget> 0027 #include <QLCDNumber> 0028 #include <QLineEdit> 0029 #include <QPointer> 0030 #include <QResizeEvent> 0031 0032 #include "media/mediatype.h" 0033 #include "rwidgets/customs/diameterselector.h" 0034 #include "rwidgets/customs/realslider.h" 0035 #include "rwidgets/customs/vcolorselector.h" 0036 #include "rwidgets/rwidgets_global.h" 0037 0038 class VectorialMapController; 0039 0040 class HiddingButton : public QToolButton 0041 { 0042 Q_OBJECT 0043 public: 0044 HiddingButton(QWidget* w); 0045 0046 void addAction(QAction* act); 0047 }; 0048 0049 /** 0050 * @brief toolbar is a QWidget subclass which gathering all tool required for drawing maps. 0051 */ 0052 class RWIDGET_EXPORT ToolBox : public QWidget 0053 { 0054 Q_OBJECT 0055 0056 public: 0057 ToolBox(VectorialMapController* ctrl, QWidget* parent= nullptr); 0058 ~ToolBox(); 0059 void setImage(const QPixmap& img); 0060 0061 private slots: 0062 void setupUi(); 0063 void updateUi(); 0064 0065 private: 0066 void createActions(); /// utility function 0067 void makeTools(); /// utility function 0068 0069 private: 0070 QPointer<VectorialMapController> m_ctrl; 0071 0072 QWidget* m_centralWidget= nullptr; /// address to the main widget 0073 QLineEdit* m_npcNameTextEdit= nullptr; /// text line to define the npc name 0074 QLCDNumber* m_displayNPCCounter= nullptr; /// count how many npc have been created 0075 VColorSelector* m_colorSelector= nullptr; /// select a color 0076 DiameterSelector* m_lineDiameter= nullptr; /// select pen diameter 0077 QActionGroup* m_toolsGroup= nullptr; /// group all tools and manage which one is the current one 0078 0079 std::unique_ptr<RealSlider> m_zoomSlider; 0080 std::unique_ptr<QDoubleSpinBox> m_zoomSpinBox; 0081 std::unique_ptr<QLabel> m_smallScene; 0082 0083 // paiting or fow edition 0084 QAction* m_paintingModeAct= nullptr; 0085 QAction* m_veilModeAct= nullptr; 0086 QAction* m_unveilModeAct= nullptr; 0087 0088 // tools 0089 QAction* m_pencilAct= nullptr; 0090 QAction* m_lineAct= nullptr; 0091 QAction* m_rectAct= nullptr; 0092 QAction* m_rectFillAct= nullptr; 0093 QAction* m_elipseAct= nullptr; 0094 QAction* m_elipseFillAct= nullptr; 0095 QAction* m_textAct= nullptr; 0096 QAction* m_handAct= nullptr; 0097 QAction* m_addPCAct= nullptr; 0098 QAction* m_resetCountAct= nullptr; 0099 QAction* m_ruleAct= nullptr; 0100 QAction* m_pathAct= nullptr; 0101 QAction* m_anchorAct= nullptr; 0102 QAction* m_pipette= nullptr; 0103 QAction* m_bucketAct= nullptr; 0104 QAction* m_highlighterAct= nullptr; 0105 QAction* m_textWithBorderAct= nullptr; 0106 QComboBox* m_editionModeCombo= nullptr; 0107 QLabel* m_opacityLabel= nullptr; 0108 RealSlider* m_opacitySlider= nullptr; 0109 }; 0110 0111 #endif