Move the Button enum to WorldSpaceWidget

coverity_scan
scrawl 9 years ago
parent 41c571d4f4
commit 18320b2cd0

@ -126,8 +126,8 @@ void CSVRender::PagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (CSVWidget::SceneToolToggle2::Button_Terrain, Mask_Terrain, "Terrain");
tool->addButton (CSVWidget::SceneToolToggle2::Button_Fog, Mask_Fog, "Fog", "", true);
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain");
tool->addButton (Button_Fog, Mask_Fog, "Fog", "", true);
}
void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (

@ -171,8 +171,8 @@ void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (CSVWidget::SceneToolToggle2::Button_Terrain, Mask_Terrain, "Terrain", "", true);
tool->addButton (CSVWidget::SceneToolToggle2::Button_Fog, Mask_Fog, "Fog");
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain", "", true);
tool->addButton (Button_Fog, Mask_Fog, "Fog");
}
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()

@ -296,9 +296,9 @@ void CSVRender::WorldspaceWidget::setEditLock (bool locked)
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
tool->addButton (CSVWidget::SceneToolToggle2::Button_Reference, Mask_Reference, "Instances");
tool->addButton (CSVWidget::SceneToolToggle2::Button_Water, Mask_Water, "Water");
tool->addButton (CSVWidget::SceneToolToggle2::Button_Pathgrid, Mask_Pathgrid, "Pathgrid");
tool->addButton (Button_Reference, Mask_Reference, "Instances");
tool->addButton (Button_Water, Mask_Water, "Water");
tool->addButton (Button_Pathgrid, Mask_Pathgrid, "Pathgrid");
}
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)

@ -142,6 +142,17 @@ namespace CSVRender
protected:
/// Visual elements in a scene
/// @note do not change the enumeration values, they are used in pre-existing button file names!
enum ButtonId
{
Button_Reference = 0x1,
Button_Pathgrid = 0x2,
Button_Water = 0x4,
Button_Fog = 0x8,
Button_Terrain = 0x10
};
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool);

@ -77,11 +77,11 @@ void CSVWidget::SceneToolToggle2::showPanel (const QPoint& position)
mFirst->setFocus (Qt::OtherFocusReason);
}
void CSVWidget::SceneToolToggle2::addButton (ButtonId id, unsigned int mask,
void CSVWidget::SceneToolToggle2::addButton (unsigned int id, unsigned int mask,
const QString& name, const QString& tooltip, bool disabled)
{
std::ostringstream stream;
stream << mSingleIcon << static_cast<unsigned int>(id);
stream << mSingleIcon << id;
PushButton *button = new PushButton (QIcon (QPixmap (stream.str().c_str())),
PushButton::Type_Toggle, tooltip.isEmpty() ? name: tooltip, mPanel);

@ -54,19 +54,11 @@ namespace CSVWidget
virtual void showPanel (const QPoint& position);
/// Visual elements in a scene
/// @note do not change the enumeration values, they are used in pre-existing button file names!
enum ButtonId
{
Button_Reference = 0x1,
Button_Pathgrid = 0x2,
Button_Water = 0x4,
Button_Fog = 0x8,
Button_Terrain = 0x10
};
/// \param buttonId used to compose the icon filename
/// \param mask used for the reported getSelectionMask() / setSelectionMask()
/// \attention After the last button has been added, setSelection must be called at
/// least once to finalise the layout.
void addButton (ButtonId buttonId, unsigned int mask,
void addButton (unsigned int buttonId, unsigned int mask,
const QString& name, const QString& tooltip = "", bool disabled = false);
unsigned int getSelectionMask() const;

Loading…
Cancel
Save