Skip to content

Commit

Permalink
Fixed some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
texus committed Apr 6, 2019
1 parent 14e29fb commit 9af18a1
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions gui-builder/include/WidgetProperties/KnobProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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())};
Expand Down
2 changes: 1 addition & 1 deletion gui-builder/src/GuiBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&)
{
}

Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Signal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/TGUI/SvgImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace tgui

bool SvgImage::isSet() const
{
return m_svg;
return (m_svg != nullptr);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/TGUI/Widgets/ListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions src/TGUI/Widgets/TreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -1306,9 +1306,9 @@ namespace tgui
}
else // Collapsing
{
if (node->expanded != expand)
if (node->expanded != expandNode)
{
node->expanded = expand;
node->expanded = expandNode;
nodeChanged = true;
}
}
Expand All @@ -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();
}

Expand Down
20 changes: 10 additions & 10 deletions tests/Outline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand All @@ -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});
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Widgets/ChildWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9af18a1

Please sign in to comment.