Fixed some warnings

0.8
Bruno Van de Velde 2019-04-06 11:52:55 +02:00
parent 14e29fbfff
commit 9af18a15ef
9 changed files with 37 additions and 37 deletions

View File

@ -35,11 +35,11 @@ struct KnobProperties : WidgetProperties
{
auto knob = std::dynamic_pointer_cast<tgui::Knob>(widget);
if (property == "Minimum")
knob->setMinimum(tgui::stof(value));
knob->setMinimum(tgui::stoi(value));
else if (property == "Maximum")
knob->setMaximum(tgui::stof(value));
knob->setMaximum(tgui::stoi(value));
else if (property == "Value")
knob->setValue(tgui::stof(value));
knob->setValue(tgui::stoi(value));
else if (property == "StartRotation")
knob->setStartRotation(tgui::stof(value));
else if (property == "EndRotation")
@ -54,9 +54,9 @@ struct KnobProperties : WidgetProperties
{
auto pair = WidgetProperties::initProperties(widget);
auto knob = std::dynamic_pointer_cast<tgui::Knob>(widget);
pair.first["Minimum"] = {"Float", tgui::to_string(knob->getMinimum())};
pair.first["Maximum"] = {"Float", tgui::to_string(knob->getMaximum())};
pair.first["Value"] = {"Float", tgui::to_string(knob->getValue())};
pair.first["Minimum"] = {"Int", tgui::to_string(knob->getMinimum())};
pair.first["Maximum"] = {"Int", tgui::to_string(knob->getMaximum())};
pair.first["Value"] = {"Int", tgui::to_string(knob->getValue())};
pair.first["StartRotation"] = {"Float", tgui::to_string(knob->getStartRotation())};
pair.first["EndRotation"] = {"Float", tgui::to_string(knob->getEndRotation())};
pair.first["ClockwiseTurning"] = {"Bool", tgui::Serializer::serialize(knob->getClockwiseTurning())};

View File

@ -1717,7 +1717,7 @@ void GuiBuilder::addPropertyValueTexture(const std::string& property, const sf::
texture->load(filename, partRect, middleRect);
onChange(tgui::Serializer::serialize(*texture));
}
catch (tgui::Exception& e)
catch (tgui::Exception&)
{
}

View File

@ -192,7 +192,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Returns whether this signal calls the connected functions when triggered
///
/// @param Is the signal enabled?
/// @return Is the signal enabled?
///
/// Signals are enabled by default. Temporarily disabling the signal is the better alternative to disconnecting the
/// handler and connecting it again a few lines later.

View File

@ -65,7 +65,7 @@ namespace tgui
bool SvgImage::isSet() const
{
return m_svg;
return (m_svg != nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1593,7 +1593,7 @@ namespace tgui
unsigned int maximum = static_cast<unsigned int>(m_items.size() * m_itemHeight);
if (m_showHorizontalGridLines && (m_gridLinesWidth > 0) && !m_items.empty())
maximum += (m_items.size() - 1) * m_gridLinesWidth;
maximum += static_cast<unsigned int>((m_items.size() - 1) * m_gridLinesWidth);
m_verticalScrollbar->setMaximum(maximum);
updateScrollbars();

View File

@ -107,14 +107,14 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void expandOrCollapseAll(std::vector<std::shared_ptr<TreeView::Node>>& nodes, bool expand)
void expandOrCollapseAll(std::vector<std::shared_ptr<TreeView::Node>>& nodes, bool expandNode)
{
for (auto& node : nodes)
{
if (!node->nodes.empty())
{
node->expanded = expand;
expandOrCollapseAll(node->nodes, expand);
node->expanded = expandNode;
expandOrCollapseAll(node->nodes, expandNode);
}
}
}
@ -1277,7 +1277,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool TreeView::expandOrCollapse(const std::vector<sf::String>& hierarchy, bool expand)
bool TreeView::expandOrCollapse(const std::vector<sf::String>& hierarchy, bool expandNode)
{
if (hierarchy.empty())
return false;
@ -1289,15 +1289,15 @@ namespace tgui
return false;
bool nodeChanged = false;
if (expand)
if (expandNode)
{
// When expanding, also expand all parents
auto* nodeToExpand = node;
while (nodeToExpand)
{
if (nodeToExpand->expanded != expand)
if (nodeToExpand->expanded != expandNode)
{
nodeToExpand->expanded = expand;
nodeToExpand->expanded = expandNode;
nodeChanged = true;
}
@ -1306,9 +1306,9 @@ namespace tgui
}
else // Collapsing
{
if (node->expanded != expand)
if (node->expanded != expandNode)
{
node->expanded = expand;
node->expanded = expandNode;
nodeChanged = true;
}
}
@ -1326,9 +1326,9 @@ namespace tgui
if (node->text.getString() != hierarchy.back())
continue;
if (node->expanded != expand)
if (node->expanded != expandNode)
{
node->expanded = expand;
node->expanded = expandNode;
markNodesDirty();
}

View File

@ -151,13 +151,13 @@ TEST_CASE("[Outline]")
outline1 += outline3;
REQUIRE(outline1 == tgui::Outline{7, 9, 11, 13});
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
outline4 += outline4;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
REQUIRE(outline4 == tgui::Outline{2, 4, 6, 8});
}
@ -167,13 +167,13 @@ TEST_CASE("[Outline]")
outline1 -= outline3;
REQUIRE(outline1 == tgui::Outline{-5, -5, -5, -5});
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
outline4 -= outline4;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
REQUIRE(outline4 == tgui::Outline{0, 0, 0, 0});
}

View File

@ -102,13 +102,13 @@ void testSavingWidget(std::string name, std::shared_ptr<WidgetType> widget, bool
WidgetType temp2;
temp2 = temp1;
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
temp2 = temp2;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
// Move constructor

View File

@ -149,7 +149,7 @@ TEST_CASE("[ChildWindow]")
childWindow->setTitleButtons(tgui::ChildWindow::TitleButton::None);
REQUIRE(childWindow->getTitleButtons() == tgui::ChildWindow::TitleButton::None);
int buttons = tgui::ChildWindow::TitleButton::Close | tgui::ChildWindow::TitleButton::Maximize | tgui::ChildWindow::TitleButton::Minimize;
unsigned int buttons = tgui::ChildWindow::TitleButton::Close | tgui::ChildWindow::TitleButton::Maximize | tgui::ChildWindow::TitleButton::Minimize;
childWindow->setTitleButtons(buttons);
REQUIRE(childWindow->getTitleButtons() == buttons);
}