rename snake_case to camelCase

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
(cherry picked from commit 44894a29b1784cfa8a04807c17d21169230ff922)
This commit is contained in:
Trial97 2024-10-27 03:05:30 +02:00 committed by github-actions[bot]
parent 3d55236fdf
commit 1d9c97803a
7 changed files with 38 additions and 38 deletions

View File

@ -99,7 +99,7 @@ void ModPage::triggerSearch()
updateSelectionButton(); updateSelectionButton();
static_cast<ModModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), changed); static_cast<ModModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), changed);
m_fetch_progress.watch(m_model->activeSearchJob().get()); m_fetchProgress.watch(m_model->activeSearchJob().get());
} }
QMap<QString, QString> ModPage::urlHandlers() const QMap<QString, QString> ModPage::urlHandlers() const

View File

@ -30,7 +30,7 @@ void ResourcePackResourcePage::triggerSearch()
updateSelectionButton(); updateSelectionButton();
static_cast<ResourcePackResourceModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt()); static_cast<ResourcePackResourceModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt());
m_fetch_progress.watch(m_model->activeSearchJob().get()); m_fetchProgress.watch(m_model->activeSearchJob().get());
} }
QMap<QString, QString> ResourcePackResourcePage::urlHandlers() const QMap<QString, QString> ResourcePackResourcePage::urlHandlers() const

View File

@ -55,7 +55,7 @@
namespace ResourceDownload { namespace ResourceDownload {
ResourcePage::ResourcePage(ResourceDownloadDialog* parent, BaseInstance& base_instance) ResourcePage::ResourcePage(ResourceDownloadDialog* parent, BaseInstance& base_instance)
: QWidget(parent), m_base_instance(base_instance), m_ui(new Ui::ResourcePage), m_parent_dialog(parent), m_fetch_progress(this, false) : QWidget(parent), m_baseInstance(base_instance), m_ui(new Ui::ResourcePage), m_parentDialog(parent), m_fetchProgress(this, false)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -64,18 +64,18 @@ ResourcePage::ResourcePage(ResourceDownloadDialog* parent, BaseInstance& base_in
m_ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
m_ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); m_ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300);
m_search_timer.setTimerType(Qt::TimerType::CoarseTimer); m_searchTimer.setTimerType(Qt::TimerType::CoarseTimer);
m_search_timer.setSingleShot(true); m_searchTimer.setSingleShot(true);
connect(&m_search_timer, &QTimer::timeout, this, &ResourcePage::triggerSearch); connect(&m_searchTimer, &QTimer::timeout, this, &ResourcePage::triggerSearch);
// hide progress bar to prevent weird artifact // hide progress bar to prevent weird artifact
m_fetch_progress.hide(); m_fetchProgress.hide();
m_fetch_progress.hideIfInactive(true); m_fetchProgress.hideIfInactive(true);
m_fetch_progress.setFixedHeight(24); m_fetchProgress.setFixedHeight(24);
m_fetch_progress.progressFormat(""); m_fetchProgress.progressFormat("");
m_ui->verticalLayout->insertWidget(1, &m_fetch_progress); m_ui->verticalLayout->insertWidget(1, &m_fetchProgress);
m_ui->packView->setItemDelegate(new ProjectItemDelegate(this)); m_ui->packView->setItemDelegate(new ProjectItemDelegate(this));
m_ui->packView->installEventFilter(this); m_ui->packView->installEventFilter(this);
@ -121,10 +121,10 @@ auto ResourcePage::eventFilter(QObject* watched, QEvent* event) -> bool
keyEvent->accept(); keyEvent->accept();
return true; return true;
} else { } else {
if (m_search_timer.isActive()) if (m_searchTimer.isActive())
m_search_timer.stop(); m_searchTimer.stop();
m_search_timer.start(350); m_searchTimer.start(350);
} }
} else if (watched == m_ui->packView) { } else if (watched == m_ui->packView) {
if (keyEvent->key() == Qt::Key_Return) { if (keyEvent->key() == Qt::Key_Return) {
@ -248,7 +248,7 @@ void ResourcePage::updateUi()
void ResourcePage::updateSelectionButton() void ResourcePage::updateSelectionButton()
{ {
if (!isOpened || m_selected_version_index < 0) { if (!isOpened || m_selectedVersionIndex < 0) {
m_ui->resourceSelectionButton->setEnabled(false); m_ui->resourceSelectionButton->setEnabled(false);
return; return;
} }
@ -258,7 +258,7 @@ void ResourcePage::updateSelectionButton()
if (current_pack->versionsLoaded && current_pack->versions.empty()) { if (current_pack->versionsLoaded && current_pack->versions.empty()) {
m_ui->resourceSelectionButton->setEnabled(false); m_ui->resourceSelectionButton->setEnabled(false);
qWarning() << tr("No version available for the selected pack"); qWarning() << tr("No version available for the selected pack");
} else if (!current_pack->isVersionSelected(m_selected_version_index)) } else if (!current_pack->isVersionSelected(m_selectedVersionIndex))
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString())); m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
else else
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString())); m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
@ -327,18 +327,18 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelI
void ResourcePage::onVersionSelectionChanged(int) void ResourcePage::onVersionSelectionChanged(int)
{ {
m_selected_version_index = m_ui->versionSelectionBox->currentData().toInt(); m_selectedVersionIndex = m_ui->versionSelectionBox->currentData().toInt();
updateSelectionButton(); updateSelectionButton();
} }
void ResourcePage::addResourceToDialog(ModPlatform::IndexedPack::Ptr pack, ModPlatform::IndexedVersion& version) void ResourcePage::addResourceToDialog(ModPlatform::IndexedPack::Ptr pack, ModPlatform::IndexedVersion& version)
{ {
m_parent_dialog->addResource(pack, version); m_parentDialog->addResource(pack, version);
} }
void ResourcePage::removeResourceFromDialog(const QString& pack_name) void ResourcePage::removeResourceFromDialog(const QString& pack_name)
{ {
m_parent_dialog->removeResource(pack_name); m_parentDialog->removeResource(pack_name);
} }
void ResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack, void ResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack,
@ -355,14 +355,14 @@ void ResourcePage::removeResourceFromPage(const QString& name)
void ResourcePage::onResourceSelected() void ResourcePage::onResourceSelected()
{ {
if (m_selected_version_index < 0) if (m_selectedVersionIndex < 0)
return; return;
auto current_pack = getCurrentPack(); auto current_pack = getCurrentPack();
if (!current_pack || !current_pack->versionsLoaded || current_pack->versions.size() < m_selected_version_index) if (!current_pack || !current_pack->versionsLoaded || current_pack->versions.size() < m_selectedVersionIndex)
return; return;
auto& version = current_pack->versions[m_selected_version_index]; auto& version = current_pack->versions[m_selectedVersionIndex];
if (version.downloadUrl.isNull()) { if (version.downloadUrl.isNull()) {
CustomMessageBox::selectable(this, tr("How?"), CustomMessageBox::selectable(this, tr("How?"),
"You managed to select a resource that doesn't have a download link. Because of this missing " "You managed to select a resource that doesn't have a download link. Because of this missing "
@ -409,14 +409,14 @@ void ResourcePage::openUrl(const QUrl& url)
} }
} }
if (!page.isNull() && !m_do_not_jump_to_mod) { if (!page.isNull() && !m_doNotJumpToMod) {
const QString slug = match.captured(1); const QString slug = match.captured(1);
// ensure the user isn't opening the same mod // ensure the user isn't opening the same mod
if (auto current_pack = getCurrentPack(); current_pack && slug != current_pack->slug) { if (auto current_pack = getCurrentPack(); current_pack && slug != current_pack->slug) {
m_parent_dialog->selectPage(page); m_parentDialog->selectPage(page);
auto newPage = m_parent_dialog->selectedPage(); auto newPage = m_parentDialog->selectedPage();
QLineEdit* searchEdit = newPage->m_ui->searchEdit; QLineEdit* searchEdit = newPage->m_ui->searchEdit;
auto model = newPage->m_model; auto model = newPage->m_model;
@ -460,7 +460,7 @@ void ResourcePage::openProject(QVariant projectID)
m_ui->resourceFilterButton->hide(); m_ui->resourceFilterButton->hide();
m_ui->packView->hide(); m_ui->packView->hide();
m_ui->resourceSelectionButton->hide(); m_ui->resourceSelectionButton->hide();
m_do_not_jump_to_mod = true; m_doNotJumpToMod = true;
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
@ -478,10 +478,10 @@ void ResourcePage::openProject(QVariant projectID)
connect(okBtn, &QPushButton::clicked, this, [this] { connect(okBtn, &QPushButton::clicked, this, [this] {
onResourceSelected(); onResourceSelected();
m_parent_dialog->accept(); m_parentDialog->accept();
}); });
connect(cancelBtn, &QPushButton::clicked, m_parent_dialog, &ResourceDownloadDialog::reject); connect(cancelBtn, &QPushButton::clicked, m_parentDialog, &ResourceDownloadDialog::reject);
m_ui->gridLayout_4->addWidget(buttonBox, 1, 2); m_ui->gridLayout_4->addWidget(buttonBox, 1, 2);
auto jump = [this, okBtn] { auto jump = [this, okBtn] {

View File

@ -62,7 +62,7 @@ class ResourcePage : public QWidget, public BasePage {
[[nodiscard]] bool setCurrentPack(ModPlatform::IndexedPack::Ptr); [[nodiscard]] bool setCurrentPack(ModPlatform::IndexedPack::Ptr);
[[nodiscard]] auto getCurrentPack() const -> ModPlatform::IndexedPack::Ptr; [[nodiscard]] auto getCurrentPack() const -> ModPlatform::IndexedPack::Ptr;
[[nodiscard]] auto getDialog() const -> const ResourceDownloadDialog* { return m_parent_dialog; } [[nodiscard]] auto getDialog() const -> const ResourceDownloadDialog* { return m_parentDialog; }
[[nodiscard]] auto getModel() const -> ResourceModel* { return m_model; } [[nodiscard]] auto getModel() const -> ResourceModel* { return m_model; }
protected: protected:
@ -99,22 +99,22 @@ class ResourcePage : public QWidget, public BasePage {
virtual void openUrl(const QUrl&); virtual void openUrl(const QUrl&);
public: public:
BaseInstance& m_base_instance; BaseInstance& m_baseInstance;
protected: protected:
Ui::ResourcePage* m_ui; Ui::ResourcePage* m_ui;
ResourceDownloadDialog* m_parent_dialog = nullptr; ResourceDownloadDialog* m_parentDialog = nullptr;
ResourceModel* m_model = nullptr; ResourceModel* m_model = nullptr;
int m_selected_version_index = -1; int m_selectedVersionIndex = -1;
ProgressWidget m_fetch_progress; ProgressWidget m_fetchProgress;
// Used to do instant searching with a delay to cache quick changes // Used to do instant searching with a delay to cache quick changes
QTimer m_search_timer; QTimer m_searchTimer;
bool m_do_not_jump_to_mod = false; bool m_doNotJumpToMod = false;
}; };
} // namespace ResourceDownload } // namespace ResourceDownload

View File

@ -31,7 +31,7 @@ void ShaderPackResourcePage::triggerSearch()
updateSelectionButton(); updateSelectionButton();
static_cast<ShaderPackResourceModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt()); static_cast<ShaderPackResourceModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt());
m_fetch_progress.watch(m_model->activeSearchJob().get()); m_fetchProgress.watch(m_model->activeSearchJob().get());
} }
QMap<QString, QString> ShaderPackResourcePage::urlHandlers() const QMap<QString, QString> ShaderPackResourcePage::urlHandlers() const

View File

@ -209,7 +209,7 @@ auto FlameShaderPackPage::shouldDisplay() const -> bool
unique_qobject_ptr<ModFilterWidget> FlameModPage::createFilterWidget() unique_qobject_ptr<ModFilterWidget> FlameModPage::createFilterWidget()
{ {
return ModFilterWidget::create(&static_cast<MinecraftInstance&>(m_base_instance), false, this); return ModFilterWidget::create(&static_cast<MinecraftInstance&>(m_baseInstance), false, this);
} }
void FlameModPage::prepareProviderCategories() void FlameModPage::prepareProviderCategories()

View File

@ -144,7 +144,7 @@ auto ModrinthShaderPackPage::shouldDisplay() const -> bool
unique_qobject_ptr<ModFilterWidget> ModrinthModPage::createFilterWidget() unique_qobject_ptr<ModFilterWidget> ModrinthModPage::createFilterWidget()
{ {
return ModFilterWidget::create(&static_cast<MinecraftInstance&>(m_base_instance), true, this); return ModFilterWidget::create(&static_cast<MinecraftInstance&>(m_baseInstance), true, this);
} }
void ModrinthModPage::prepareProviderCategories() void ModrinthModPage::prepareProviderCategories()