diff --git a/es-app/src/views/gamelist/ISimpleGamelistView.cpp b/es-app/src/views/gamelist/ISimpleGamelistView.cpp index 01f45ca2c..4ee199b06 100644 --- a/es-app/src/views/gamelist/ISimpleGamelistView.cpp +++ b/es-app/src/views/gamelist/ISimpleGamelistView.cpp @@ -308,9 +308,7 @@ bool ISimpleGamelistView::input(InputConfig* config, Input input) else favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst"); - if (favoritesSorting && - static_cast(mRoot->getSystem()->getName()) != "recent" && - !isEditing) { + if (favoritesSorting && mRoot->getSystem()->getName() != "recent" && !isEditing) { FileData* entryToSelect; // Add favorite flag. if (!getCursor()->getFavorite()) { diff --git a/es-core/src/components/OptionListComponent.h b/es-core/src/components/OptionListComponent.h index d32a6b1e3..03ee3b3ef 100644 --- a/es-core/src/components/OptionListComponent.h +++ b/es-core/src/components/OptionListComponent.h @@ -119,8 +119,8 @@ public: if (!mEnabled) return true; // Move selection to previous. - unsigned int i = getSelectedId(); - int next = static_cast(i) - 1; + unsigned int i {getSelectedId()}; + int next {static_cast(i) - 1}; if (next < 0) next += static_cast(mEntries.size()); @@ -143,7 +143,7 @@ public: if (!mEnabled) return true; // Move selection to next. - unsigned int i = getSelectedId(); + unsigned int i {getSelectedId()}; int next = (i + 1) % mEntries.size(); mEntries.at(i).selected = false; mEntries.at(next).selected = true; @@ -424,7 +424,7 @@ private: auto font = Font::get(FONT_SIZE_MEDIUM); ComponentListRow row; - bool hasSelectedRow = false; + bool hasSelectedRow {false}; // If the exclusive selection flag has been set, i.e. only a single row can be selected // at a time, then make sure to gray out and disable any non-selected rows. @@ -452,7 +452,7 @@ private: textComponent.get()->setEnabled(false); } - OptionListData& e = *it; + OptionListData& e {*it}; if (mParent->mMultiSelect) { // Add checkbox. @@ -468,8 +468,8 @@ private: // Update checkbox state and selected value. row.makeAcceptInputHandler([this, &e, checkbox] { auto list = mMenu.getList(); - int cursorId = list->getCursorId(); - bool isEnabled = list->getChild(cursorId * 2)->getEnabled(); + int cursorId {list->getCursorId()}; + bool isEnabled {list->getChild(cursorId * 2)->getEnabled()}; if (mParent->mMultiExclusiveSelect && !isEnabled) return; @@ -483,7 +483,7 @@ private: if (mParent->mMultiExclusiveSelect) { for (unsigned int i = 0; i < mParent->mEntries.size(); ++i) { - bool isSelected = mParent->mEntries[cursorId].selected; + bool isSelected {mParent->mEntries[cursorId].selected}; for (unsigned int i = 0; i < list->getChildCount(); i += 2) { if (i == static_cast(cursorId) * 2) diff --git a/es-core/src/components/TextListComponent.h b/es-core/src/components/TextListComponent.h index c4d2cfc07..550934ac6 100644 --- a/es-core/src/components/TextListComponent.h +++ b/es-core/src/components/TextListComponent.h @@ -6,8 +6,8 @@ // Text list used for displaying and navigating the gamelist views. // -#ifndef ES_APP_COMPONENTS_TEXT_LIST_COMPONENT_H -#define ES_APP_COMPONENTS_TEXT_LIST_COMPONENT_H +#ifndef ES_CORE_COMPONENTS_TEXT_LIST_COMPONENT_H +#define ES_CORE_COMPONENTS_TEXT_LIST_COMPONENT_H #include "Log.h" #include "Sound.h" @@ -135,8 +135,8 @@ private: template TextListComponent::TextListComponent(Window* window) - : IList(window) - , mSelectorImage(window) + : IList {window} + , mSelectorImage {window} { mLoopOffset = 0; mLoopOffset2 = 0; @@ -192,7 +192,7 @@ template void TextListComponent::render(const glm::mat4& parentT startEntry = size() - screenCount; } - int listCutoff = startEntry + screenCount; + int listCutoff {startEntry + screenCount}; if (listCutoff > size()) listCutoff = size(); @@ -229,7 +229,7 @@ template void TextListComponent::render(const glm::mat4& parentT static_cast(std::round(dim.y))}); for (int i = startEntry; i < listCutoff; ++i) { - typename IList::Entry& entry = mEntries.at(static_cast(i)); + typename IList::Entry& entry {mEntries.at(static_cast(i))}; unsigned int color; if (mCursor == i && mSelectedColor) @@ -360,21 +360,21 @@ template void TextListComponent::update(int deltaTime) mLoopOffset2 = 0; // If we're not scrolling and this object's text exceeds our size, then loop it. - const float textLength = mFont - ->sizeText(Utils::String::toUpper( - mEntries.at(static_cast(mCursor)).name)) - .x; - const float limit = mSize.x - mHorizontalMargin * 2.0f; + const float textLength {mFont + ->sizeText(Utils::String::toUpper( + mEntries.at(static_cast(mCursor)).name)) + .x}; + const float limit {mSize.x - mHorizontalMargin * 2.0f}; if (textLength > limit) { // Loop the text. - const float speed = mFont->sizeText("ABCDEFGHIJKLMNOPQRSTUVWXYZ").x * 0.247f; - const float delay = 3000.0f; - const float scrollLength = textLength; - const float returnLength = speed * 1.5f; - const float scrollTime = (scrollLength * 1000.0f) / speed; - const float returnTime = (returnLength * 1000.0f) / speed; - const int maxTime = static_cast(delay + scrollTime + returnTime); + const float speed {mFont->sizeText("ABCDEFGHIJKLMNOPQRSTUVWXYZ").x * 0.247f}; + const float delay {3000.0f}; + const float scrollLength {textLength}; + const float returnLength {speed * 1.5f}; + const float scrollTime {(scrollLength * 1000.0f) / speed}; + const float returnTime {(returnLength * 1000.0f) / speed}; + const int maxTime {static_cast(delay + scrollTime + returnTime)}; mLoopTime += deltaTime; while (mLoopTime > maxTime) @@ -423,7 +423,7 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, { GuiComponent::applyTheme(theme, view, element, properties); - const ThemeData::ThemeElement* elem = theme->getElement(view, element, "textlist"); + const ThemeData::ThemeElement* elem {theme->getElement(view, element, "textlist")}; if (!elem) return; @@ -447,8 +447,8 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, } setFont(Font::getFromTheme(elem, properties, mFont)); - const float selectorHeight = - std::max(mFont->getHeight(1.0), static_cast(mFont->getSize())) * mLineSpacing; + const float selectorHeight { + std::max(mFont->getHeight(1.0), static_cast(mFont->getSize())) * mLineSpacing}; setSelectorHeight(selectorHeight); if (properties & ALIGNMENT) { @@ -501,4 +501,4 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, } } -#endif // ES_APP_COMPONENTS_TEXT_LIST_COMPONENT_H +#endif // ES_CORE_COMPONENTS_TEXT_LIST_COMPONENT_H