foxygit / Torlinkc Log in
commits tags

/src/ui/app_state.cpp · 953 B

raw
#include "torlinkc/ui/app_state.hpp"

namespace torlinkc::ui {

std::optional<Category> sectionToCategory(Section s) {
  switch (s) {
    case Section::All:
      return Category::All;
    case Section::Games:
      return Category::Games;
    case Section::Movies:
      return Category::Movies;
    case Section::TV:
      return Category::TV;
    case Section::Anime:
      return Category::Anime;
    case Section::Downloads:
    case Section::Seeding:
      return std::nullopt;
  }
  return Category::All;
}

std::string sectionLabel(Section s) {
  switch (s) {
    case Section::All:
      return "All";
    case Section::Games:
      return "Games";
    case Section::Movies:
      return "Movies";
    case Section::TV:
      return "TV";
    case Section::Anime:
      return "Anime";
    case Section::Downloads:
      return "Downloads";
    case Section::Seeding:
      return "Seeding";
  }
  return "All";
}

}  // namespace torlinkc::ui