chore:fixed some codeql warnings
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
9a57fddaaf
commit
f7fd6f566f
36 changed files with 176 additions and 217 deletions
|
@ -45,7 +45,9 @@
|
|||
|
||||
#include "net/ApiDownload.h"
|
||||
|
||||
AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent,
|
||||
const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods)
|
||||
: QAbstractListModel(parent), m_version(version), m_mods(mods)
|
||||
{
|
||||
// fill mod index
|
||||
|
@ -233,7 +235,7 @@ void AtlOptionalModListModel::clearAll()
|
|||
emit dataChanged(AtlOptionalModListModel::index(0, EnabledColumn), AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn));
|
||||
}
|
||||
|
||||
void AtlOptionalModListModel::toggleMod(ATLauncher::VersionMod mod, int index)
|
||||
void AtlOptionalModListModel::toggleMod(const ATLauncher::VersionMod& mod, int index)
|
||||
{
|
||||
auto enable = !m_selection[mod.name];
|
||||
|
||||
|
@ -251,7 +253,7 @@ void AtlOptionalModListModel::toggleMod(ATLauncher::VersionMod mod, int index)
|
|||
setMod(mod, index, enable);
|
||||
}
|
||||
|
||||
void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool enable, bool shouldEmit)
|
||||
void AtlOptionalModListModel::setMod(const ATLauncher::VersionMod& mod, int index, bool enable, bool shouldEmit)
|
||||
{
|
||||
if (m_selection[mod.name] == enable)
|
||||
return;
|
||||
|
@ -313,7 +315,7 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
|
|||
}
|
||||
}
|
||||
|
||||
AtlOptionalModDialog::AtlOptionalModDialog(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
AtlOptionalModDialog::AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods)
|
||||
: QDialog(parent), ui(new Ui::AtlOptionalModDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
|
|
@ -55,7 +55,7 @@ class AtlOptionalModListModel : public QAbstractListModel {
|
|||
DescriptionColumn,
|
||||
};
|
||||
|
||||
AtlOptionalModListModel(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods);
|
||||
AtlOptionalModListModel(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods);
|
||||
|
||||
QVector<QString> getResult();
|
||||
|
||||
|
@ -78,8 +78,8 @@ class AtlOptionalModListModel : public QAbstractListModel {
|
|||
void clearAll();
|
||||
|
||||
private:
|
||||
void toggleMod(ATLauncher::VersionMod mod, int index);
|
||||
void setMod(ATLauncher::VersionMod mod, int index, bool enable, bool shouldEmit = true);
|
||||
void toggleMod(const ATLauncher::VersionMod& mod, int index);
|
||||
void setMod(const ATLauncher::VersionMod& mod, int index, bool enable, bool shouldEmit = true);
|
||||
|
||||
private:
|
||||
NetJob::Ptr m_jobPtr;
|
||||
|
@ -97,7 +97,7 @@ class AtlOptionalModDialog : public QDialog {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AtlOptionalModDialog(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods);
|
||||
AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods);
|
||||
~AtlOptionalModDialog() override;
|
||||
|
||||
QVector<QString> getResult() { return listModel->getResult(); }
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
AtlUserInteractionSupportImpl::AtlUserInteractionSupportImpl(QWidget* parent) : m_parent(parent) {}
|
||||
|
||||
std::optional<QVector<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(ATLauncher::PackVersion version,
|
||||
std::optional<QVector<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods)
|
||||
{
|
||||
AtlOptionalModDialog optionalModDialog(m_parent, version, mods);
|
||||
|
|
|
@ -48,7 +48,8 @@ class AtlUserInteractionSupportImpl : public QObject, public ATLauncher::UserInt
|
|||
|
||||
private:
|
||||
QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) override;
|
||||
std::optional<QVector<QString>> chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods) override;
|
||||
std::optional<QVector<QString>> chooseOptionalMods(const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods) override;
|
||||
void displayMessage(QString message) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -106,9 +106,6 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
|
|||
}
|
||||
|
||||
auto pack = m_modpacks.at(pos);
|
||||
if (role == Qt::ToolTipRole) {
|
||||
}
|
||||
|
||||
switch (role) {
|
||||
case Qt::ToolTipRole:
|
||||
return tr("Minecraft %1").arg(pack.mcVersion);
|
||||
|
|
|
@ -213,7 +213,7 @@ void ListModel::fill(ModpackList modpacks_)
|
|||
endResetModel();
|
||||
}
|
||||
|
||||
void ListModel::addPack(Modpack modpack)
|
||||
void ListModel::addPack(const Modpack& modpack)
|
||||
{
|
||||
beginResetModel();
|
||||
this->modpacks.append(modpack);
|
||||
|
|
|
@ -62,7 +62,7 @@ class ListModel : public QAbstractListModel {
|
|||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
void fill(ModpackList modpacks);
|
||||
void addPack(Modpack modpack);
|
||||
void addPack(const Modpack& modpack);
|
||||
void clear();
|
||||
void remove(int row);
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void Page::ftbPackDataDownloadAborted()
|
|||
CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)->show();
|
||||
}
|
||||
|
||||
void Page::ftbPrivatePackDataDownloadSuccessfully(Modpack pack)
|
||||
void Page::ftbPrivatePackDataDownloadSuccessfully(const Modpack& pack)
|
||||
{
|
||||
privateListModel->addPack(pack);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class Page : public QWidget, public ModpackProviderBasePage {
|
|||
void ftbPackDataDownloadFailed(QString reason);
|
||||
void ftbPackDataDownloadAborted();
|
||||
|
||||
void ftbPrivatePackDataDownloadSuccessfully(Modpack pack);
|
||||
void ftbPrivatePackDataDownloadSuccessfully(const Modpack& pack);
|
||||
void ftbPrivatePackDataDownloadFailed(QString reason, QString packCode);
|
||||
|
||||
void onSortingSelectionChanged(QString data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue