Mercurial > minori
diff src/anime.cpp @ 3:190ded9438c0
Fix many warnings
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 12 Aug 2023 11:57:25 -0400 |
parents | 23d0d9319a00 |
children | 1d82f6e04d7d |
line wrap: on
line diff
--- a/src/anime.cpp Sat Aug 12 03:16:26 2023 -0400 +++ b/src/anime.cpp Sat Aug 12 11:57:25 2023 -0400 @@ -118,7 +118,7 @@ AnimeList::AnimeList() {} AnimeList::AnimeList(const AnimeList& l) { - for (int i = 0; i < l.Size(); i++) { + for (unsigned long long i = 0; i < l.Size(); i++) { anime_list.push_back(Anime(l[i])); } name = l.name; @@ -138,7 +138,7 @@ } int AnimeList::GetAnimeIndex(Anime& anime) const { - for (int i = 0; i < Size(); i++) { + for (unsigned long long i = 0; i < Size(); i++) { if (&anime_list.at(i) == &anime) { // lazy return i; } @@ -166,10 +166,12 @@ int AnimeListWidgetModel::rowCount(const QModelIndex& parent) const { return list.Size(); + (void)(parent); } int AnimeListWidgetModel::columnCount(const QModelIndex& parent) const { return NB_COLUMNS; + (void)(parent); } QVariant AnimeListWidgetModel::headerData(const int section, const Qt::Orientation orientation, const int role) const { @@ -336,8 +338,7 @@ menu->setTitle(tr("Column visibility")); menu->setToolTipsVisible(true); - for (int i = 0; i < AnimeListWidgetModel::NB_COLUMNS; i++) - { + for (int i = 0; i < AnimeListWidgetModel::NB_COLUMNS; i++) { if (i == AnimeListWidgetModel::AL_TITLE) continue; const auto column_name = model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString(); @@ -357,42 +358,45 @@ } menu->addSeparator(); - QAction *resetAction = menu->addAction(tr("Reset to defaults"), this, [this]() - { + QAction *resetAction = menu->addAction(tr("Reset to defaults"), this, [this]() { for (int i = 0, count = header()->count(); i < count; ++i) { SetColumnDefaults(); } // SaveSettings(); }); - menu->popup(QCursor::pos()); + (void)(resetAction); } void AnimeListWidget::DisplayListMenu() { /* throw out any other garbage */ const QModelIndexList selected_items = selectionModel()->selectedRows(); - if (selected_items.size() != 1 || !selected_items.first().isValid()) + if (selected_items.size() != 1 || !selected_items.first().isValid()) { return; + } const QModelIndex index = model->index(selected_items.first().row()); Anime* anime = model->GetAnimeFromIndex(index); - if (!anime) + if (!anime) { return; + } } void AnimeListWidget::ItemDoubleClicked() { /* throw out any other garbage */ const QModelIndexList selected_items = selectionModel()->selectedRows(); - if (selected_items.size() != 1 || !selected_items.first().isValid()) + if (selected_items.size() != 1 || !selected_items.first().isValid()) { return; + } /* TODO: after we implement our sort model, we have to use mapToSource here... */ const QModelIndex index = model->index(selected_items.first().row()); Anime* anime = model->GetAnimeFromIndex(index); - if (!anime) + if (!anime) { return; + } InformationDialog* dialog = new InformationDialog(*anime, model, this); @@ -414,19 +418,19 @@ setItemsExpandable(false); setRootIsDecorated(false); setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, &QAbstractItemView::doubleClicked, this, &ItemDoubleClicked); - connect(this, &QWidget::customContextMenuRequested, this, &DisplayListMenu); + connect(this, &QAbstractItemView::doubleClicked, this, &AnimeListWidget::ItemDoubleClicked); + connect(this, &QWidget::customContextMenuRequested, this, &AnimeListWidget::DisplayListMenu); /* Enter & return keys */ connect(new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut), - &QShortcut::activated, this, &ItemDoubleClicked); + &QShortcut::activated, this, &AnimeListWidget::ItemDoubleClicked); connect(new QShortcut(Qt::Key_Enter, this, nullptr, nullptr, Qt::WidgetShortcut), - &QShortcut::activated, this, &ItemDoubleClicked); + &QShortcut::activated, this, &AnimeListWidget::ItemDoubleClicked); header()->setStretchLastSection(false); header()->setContextMenuPolicy(Qt::CustomContextMenu); - connect(header(), &QWidget::customContextMenuRequested, this, &DisplayColumnHeaderMenu); + connect(header(), &QWidget::customContextMenuRequested, this, &AnimeListWidget::DisplayColumnHeaderMenu); // if(!session.config.anime_list.columns) { SetColumnDefaults(); // } @@ -450,6 +454,8 @@ anilist.UpdateAnimeList(&anime_lists, session.config.anilist.user_id); break; } + default: + break; } }