id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29,437
|
ProfileSetupDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ProfileSetupDialog.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDialog>
#include <QIcon>
#include <QNetworkReply>
#include <QTimer>
#include <minecraft/auth/MinecraftAccount.h>
#include <memory>
#include "net/Download.h"
#include "net/Upload.h"
namespace Ui {
class ProfileSetupDialog;
}
class ProfileSetupDialog : public QDialog {
Q_OBJECT
public:
explicit ProfileSetupDialog(MinecraftAccountPtr accountToSetup, QWidget* parent = 0);
~ProfileSetupDialog();
enum class NameStatus { NotSet, Pending, Available, Exists, Error } nameStatus = NameStatus::NotSet;
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void nameEdited(const QString& name);
void startCheck();
void checkFinished();
void setupProfileFinished();
protected:
void scheduleCheck(const QString& name);
void checkName(const QString& name);
void setNameStatus(NameStatus status, QString errorString);
void setupProfile(const QString& profileName);
private:
MinecraftAccountPtr m_accountToSetup;
Ui::ProfileSetupDialog* ui;
QIcon goodIcon;
QIcon yellowIcon;
QIcon badIcon;
QAction* validityAction = nullptr;
QString queuedCheck;
bool isChecking = false;
bool isWorking = false;
QString currentCheck;
QTimer checkStartTimer;
std::shared_ptr<QByteArray> m_check_response;
Net::Download::Ptr m_check_task;
std::shared_ptr<QByteArray> m_profile_response;
Net::Upload::Ptr m_profile_task;
};
| 2,087
|
C++
|
.h
| 61
| 30.622951
| 104
| 0.752115
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,438
|
ChooseProviderDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ChooseProviderDialog.h
|
#pragma once
#include <QButtonGroup>
#include <QDialog>
namespace Ui {
class ChooseProviderDialog;
}
namespace ModPlatform {
enum class ResourceProvider;
}
class Mod;
class NetJob;
class ChooseProviderDialog : public QDialog {
Q_OBJECT
struct Response {
bool skip_all = false;
bool confirm_all = false;
bool try_others = false;
ModPlatform::ResourceProvider chosen;
};
public:
explicit ChooseProviderDialog(QWidget* parent, bool single_choice = false, bool allow_skipping = true);
~ChooseProviderDialog();
auto getResponse() const -> Response { return m_response; }
void setDescription(QString desc);
private slots:
void skipOne();
void skipAll();
void confirmOne();
void confirmAll();
private:
void addProviders();
void disableInput();
auto getSelectedProvider() const -> ModPlatform::ResourceProvider;
private:
Ui::ChooseProviderDialog* ui;
QButtonGroup m_providers;
Response m_response;
};
| 1,022
|
C++
|
.h
| 38
| 22.5
| 107
| 0.718718
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,442
|
ResourceUpdateDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ResourceUpdateDialog.h
|
#pragma once
#include "BaseInstance.h"
#include "ResourceDownloadTask.h"
#include "ReviewMessageBox.h"
#include "minecraft/mod/ModFolderModel.h"
#include "modplatform/CheckUpdateTask.h"
class Mod;
class ModrinthCheckUpdate;
class FlameCheckUpdate;
class ConcurrentTask;
class ResourceUpdateDialog final : public ReviewMessageBox {
Q_OBJECT
public:
explicit ResourceUpdateDialog(QWidget* parent,
BaseInstance* instance,
std::shared_ptr<ResourceFolderModel> resource_model,
QList<Resource*>& search_for,
bool include_deps,
bool filter_loaders);
void checkCandidates();
void appendResource(const CheckUpdateTask::Update& info, QStringList requiredBy = {});
const QList<ResourceDownloadTask::Ptr> getTasks();
auto indexDir() const -> QDir { return m_resource_model->indexDir(); }
auto noUpdates() const -> bool { return m_no_updates; };
auto aborted() const -> bool { return m_aborted; };
private:
auto ensureMetadata() -> bool;
private slots:
void onMetadataEnsured(Resource* resource);
void onMetadataFailed(Resource* resource,
bool try_others = false,
ModPlatform::ResourceProvider first_choice = ModPlatform::ResourceProvider::MODRINTH);
private:
QWidget* m_parent;
shared_qobject_ptr<ModrinthCheckUpdate> m_modrinth_check_task;
shared_qobject_ptr<FlameCheckUpdate> m_flame_check_task;
const std::shared_ptr<ResourceFolderModel> m_resource_model;
QList<Resource*>& m_candidates;
QList<Resource*> m_modrinth_to_update;
QList<Resource*> m_flame_to_update;
ConcurrentTask::Ptr m_second_try_metadata;
QList<std::tuple<Resource*, QString>> m_failed_metadata;
QList<std::tuple<Resource*, QString, QUrl>> m_failed_check_update;
QHash<QString, ResourceDownloadTask::Ptr> m_tasks;
BaseInstance* m_instance;
bool m_no_updates = false;
bool m_aborted = false;
bool m_include_deps = false;
bool m_filter_loaders = false;
};
| 2,172
|
C++
|
.h
| 50
| 35.24
| 112
| 0.676331
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,443
|
VersionSelectDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/VersionSelectDialog.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDialog>
#include <QSortFilterProxyModel>
#include "BaseVersionList.h"
class QVBoxLayout;
class QHBoxLayout;
class QDialogButtonBox;
class VersionSelectWidget;
class QPushButton;
class VersionProxyModel;
class VersionSelectDialog : public QDialog {
Q_OBJECT
public:
explicit VersionSelectDialog(BaseVersionList* vlist, QString title, QWidget* parent = 0, bool cancelable = true);
virtual ~VersionSelectDialog() = default;
int exec() override;
BaseVersion::Ptr selectedVersion() const;
void setCurrentVersion(const QString& version);
void setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter);
void setExactFilter(BaseVersionList::ModelRoles role, QString filter);
void setExactIfPresentFilter(BaseVersionList::ModelRoles role, QString filter);
void setEmptyString(QString emptyString);
void setEmptyErrorString(QString emptyErrorString);
void setResizeOn(int column);
private slots:
void on_refreshButton_clicked();
private:
void retranslate();
void selectRecommended();
private:
QString m_currentVersion;
VersionSelectWidget* m_versionWidget = nullptr;
QVBoxLayout* m_verticalLayout = nullptr;
QHBoxLayout* m_horizontalLayout = nullptr;
QPushButton* m_refreshButton = nullptr;
QDialogButtonBox* m_buttonBox = nullptr;
BaseVersionList* m_vlist = nullptr;
VersionProxyModel* m_proxyModel = nullptr;
int resizeOnColumn = -1;
Task* loadTask = nullptr;
};
| 2,121
|
C++
|
.h
| 55
| 34.981818
| 117
| 0.772572
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,444
|
BlockedModsDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/BlockedModsDialog.h
|
// SPDX-FileCopyrightText: 2022 Sefa Eyeoglu <contact@scrumplex.net>
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
// SPDX-FileCopyrightText: 2022 kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
//
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
* Copyright (C) 2022 kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include <QList>
#include <QString>
#include <QFileSystemWatcher>
#include "tasks/ConcurrentTask.h"
class QPushButton;
struct BlockedMod {
QString name;
QString websiteUrl;
QString hash;
bool matched;
QString localPath;
QString targetFolder;
};
QT_BEGIN_NAMESPACE
namespace Ui {
class BlockedModsDialog;
}
QT_END_NAMESPACE
class BlockedModsDialog : public QDialog {
Q_OBJECT
public:
BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods, QString hash_type = "sha1");
~BlockedModsDialog() override;
protected:
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
protected slots:
void done(int r) override;
private:
Ui::BlockedModsDialog* ui;
QList<BlockedMod>& m_mods;
QFileSystemWatcher m_watcher;
shared_qobject_ptr<ConcurrentTask> m_hashing_task;
QSet<QString> m_pending_hash_paths;
bool m_rehash_pending;
QPushButton* m_openMissingButton;
QString m_hash_type;
void openAll(bool missingOnly);
void addDownloadFolder();
void update();
void directoryChanged(QString path);
void setupWatch();
void watchPath(QString path, bool watch_recursive = false);
void scanPaths();
void scanPath(QString path, bool start_task);
void addHashTask(QString path);
void buildHashTask(QString path);
void checkMatchHash(QString hash, QString path);
void validateMatchedMods();
void runHashTask();
void hashTaskFinished();
bool checkValidPath(QString path);
bool allModsMatched();
};
QDebug operator<<(QDebug debug, const BlockedMod& m);
| 2,865
|
C++
|
.h
| 80
| 32.4375
| 135
| 0.752529
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,445
|
ProgressDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ProgressDialog.h
|
/// SPDX-License-Identifier: GPL-3.0-only
/*
* PrismLaucher - Minecraft Launcher
* Copyright (C) 2023 Rachel Powers <508861+Ryex@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDialog>
#include <QHash>
#include <QUuid>
#include <memory>
#include "QObjectPtr.h"
#include "tasks/Task.h"
#include "ui/widgets/SubTaskProgressBar.h"
class Task;
class SequentialTask;
namespace Ui {
class ProgressDialog;
}
class ProgressDialog : public QDialog {
Q_OBJECT
public:
explicit ProgressDialog(QWidget* parent = 0);
~ProgressDialog();
void updateSize(bool recenterParent = false);
int execWithTask(Task* task);
int execWithTask(std::unique_ptr<Task>&& task);
int execWithTask(std::unique_ptr<Task>& task);
void setSkipButton(bool present, QString label = QString());
Task* getTask();
public slots:
void onTaskStarted();
void onTaskFailed(QString failure);
void onTaskSucceeded();
void changeStatus(const QString& status);
void changeProgress(qint64 current, qint64 total);
void changeStepProgress(TaskStepProgress const& task_progress);
private slots:
void on_skipButton_clicked(bool checked);
protected:
virtual void keyPressEvent(QKeyEvent* e);
virtual void closeEvent(QCloseEvent* e);
private:
bool handleImmediateResult(QDialog::DialogCode& result);
void addTaskProgress(TaskStepProgress const& progress);
private:
Ui::ProgressDialog* ui;
Task* m_task;
QList<QMetaObject::Connection> m_taskConnections;
bool m_is_multi_step = false;
QHash<QUuid, SubTaskProgressBar*> taskProgress;
};
| 2,974
|
C++
|
.h
| 80
| 33.9875
| 80
| 0.739979
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,447
|
ExportInstanceDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ExportInstanceDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDialog>
#include <QModelIndex>
#include <memory>
#include "FastFileIconProvider.h"
#include "FileIgnoreProxy.h"
class BaseInstance;
using InstancePtr = std::shared_ptr<BaseInstance>;
namespace Ui {
class ExportInstanceDialog;
}
class ExportInstanceDialog : public QDialog {
Q_OBJECT
public:
explicit ExportInstanceDialog(InstancePtr instance, QWidget* parent = 0);
~ExportInstanceDialog();
virtual void done(int result);
private:
void doExport();
void loadPackIgnore();
void savePackIgnore();
QString ignoreFileName();
private:
Ui::ExportInstanceDialog* ui;
InstancePtr m_instance;
FileIgnoreProxy* proxyModel;
FastFileIconProvider icons;
private slots:
void rowsInserted(QModelIndex parent, int top, int bottom);
};
| 2,369
|
C++
|
.h
| 65
| 33.8
| 80
| 0.744115
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,448
|
CopyInstanceDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/CopyInstanceDialog.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDialog>
#include "BaseInstance.h"
#include "BaseVersion.h"
#include "InstanceCopyPrefs.h"
class BaseInstance;
namespace Ui {
class CopyInstanceDialog;
}
class CopyInstanceDialog : public QDialog {
Q_OBJECT
public:
explicit CopyInstanceDialog(InstancePtr original, QWidget* parent = 0);
~CopyInstanceDialog();
void updateDialogState();
QString instName() const;
QString instGroup() const;
QString iconKey() const;
const InstanceCopyPrefs& getChosenOptions() const;
public slots:
void help();
private slots:
void on_iconButton_clicked();
void on_instNameTextBox_textChanged(const QString& arg1);
// Checkboxes
void on_selectAllCheckbox_stateChanged(int state);
void on_copySavesCheckbox_stateChanged(int state);
void on_keepPlaytimeCheckbox_stateChanged(int state);
void on_copyGameOptionsCheckbox_stateChanged(int state);
void on_copyResPacksCheckbox_stateChanged(int state);
void on_copyShaderPacksCheckbox_stateChanged(int state);
void on_copyServersCheckbox_stateChanged(int state);
void on_copyModsCheckbox_stateChanged(int state);
void on_copyScreenshotsCheckbox_stateChanged(int state);
void on_symbolicLinksCheckbox_stateChanged(int state);
void on_hardLinksCheckbox_stateChanged(int state);
void on_recursiveLinkCheckbox_stateChanged(int state);
void on_dontLinkSavesCheckbox_stateChanged(int state);
void on_useCloneCheckbox_stateChanged(int state);
private:
void checkAllCheckboxes(const bool& b);
void updateSelectAllCheckbox();
void updateUseCloneCheckbox();
void updateLinkOptions();
/* data */
Ui::CopyInstanceDialog* ui;
QString InstIconKey;
InstancePtr m_original;
InstanceCopyPrefs m_selectedOptions;
bool m_cloneSupported = false;
bool m_linkSupported = false;
};
| 2,483
|
C++
|
.h
| 66
| 33.818182
| 75
| 0.768399
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,450
|
ScrollMessageBox.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ScrollMessageBox.h
|
#pragma once
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class ScrollMessageBox;
}
QT_END_NAMESPACE
class ScrollMessageBox : public QDialog {
Q_OBJECT
public:
ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body);
~ScrollMessageBox() override;
private:
Ui::ScrollMessageBox* ui;
};
| 363
|
C++
|
.h
| 15
| 21.333333
| 102
| 0.766082
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,451
|
NewsDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/NewsDialog.h
|
#pragma once
#include <QDialog>
#include <QHash>
#include "news/NewsEntry.h"
namespace Ui {
class NewsDialog;
}
class NewsDialog : public QDialog {
Q_OBJECT
public:
NewsDialog(QList<NewsEntryPtr> entries, QWidget* parent = nullptr);
~NewsDialog();
public slots:
void toggleArticleList();
private slots:
void selectedArticleChanged(const QString& new_title);
private:
Ui::NewsDialog* ui;
QHash<QString, NewsEntryPtr> m_entries;
bool m_article_list_hidden = false;
};
| 519
|
C++
|
.h
| 21
| 21.190476
| 71
| 0.732106
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,452
|
ImportResourceDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ImportResourceDialog.h
|
#pragma once
#include <QDialog>
#include <QItemSelection>
#include "minecraft/mod/tasks/LocalResourceParse.h"
#include "ui/instanceview/InstanceProxyModel.h"
namespace Ui {
class ImportResourceDialog;
}
class ImportResourceDialog : public QDialog {
Q_OBJECT
public:
explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = nullptr);
~ImportResourceDialog() override;
QString selectedInstanceKey;
private:
Ui::ImportResourceDialog* ui;
PackedResourceType m_resource_type;
QString m_file_path;
InstanceProxyModel* proxyModel;
private slots:
void selectionChanged(QItemSelection, QItemSelection);
void activated(QModelIndex);
};
| 717
|
C++
|
.h
| 23
| 27.73913
| 105
| 0.791849
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,453
|
InstallLoaderDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/InstallLoaderDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include "ui/pages/BasePageProvider.h"
class MinecraftInstance;
class PageContainer;
class PackProfile;
class QDialogButtonBox;
class InstallLoaderDialog final : public QDialog, protected BasePageProvider {
Q_OBJECT
public:
explicit InstallLoaderDialog(std::shared_ptr<PackProfile> instance, const QString& uid = QString(), QWidget* parent = nullptr);
QList<BasePage*> getPages() override;
QString dialogTitle() override;
void validate(BasePage* page);
void done(int result) override;
private:
std::shared_ptr<PackProfile> profile;
PageContainer* container;
QDialogButtonBox* buttons;
};
| 1,412
|
C++
|
.h
| 37
| 35.405405
| 131
| 0.762253
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,454
|
ExportToModListDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ExportToModListDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include <QList>
#include "minecraft/mod/Mod.h"
#include "modplatform/helpers/ExportToModList.h"
namespace Ui {
class ExportToModListDialog;
}
class ExportToModListDialog : public QDialog {
Q_OBJECT
public:
explicit ExportToModListDialog(QString name, QList<Mod*> mods, QWidget* parent = nullptr);
~ExportToModListDialog();
void done(int result) override;
protected slots:
void formatChanged(int index);
void triggerImp();
void trigger(int) { triggerImp(); };
void addExtra(ExportToModList::OptionalData option);
private:
QString extension();
void enableCustom(bool enabled);
QList<Mod*> m_mods;
bool m_template_changed;
QString m_name;
ExportToModList::Formats m_format = ExportToModList::Formats::HTML;
Ui::ExportToModListDialog* ui;
static const QHash<ExportToModList::Formats, QString> exampleLines;
};
| 1,666
|
C++
|
.h
| 46
| 33.108696
| 94
| 0.749224
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,457
|
ExportPackDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/ExportPackDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include "BaseInstance.h"
#include "FastFileIconProvider.h"
#include "FileIgnoreProxy.h"
#include "modplatform/ModIndex.h"
namespace Ui {
class ExportPackDialog;
}
class ExportPackDialog : public QDialog {
Q_OBJECT
public:
explicit ExportPackDialog(InstancePtr instance,
QWidget* parent = nullptr,
ModPlatform::ResourceProvider provider = ModPlatform::ResourceProvider::MODRINTH);
~ExportPackDialog();
void done(int result) override;
void validate();
private:
const InstancePtr instance;
Ui::ExportPackDialog* ui;
FileIgnoreProxy* proxy;
FastFileIconProvider icons;
const ModPlatform::ResourceProvider m_provider;
};
| 1,504
|
C++
|
.h
| 42
| 31.761905
| 112
| 0.734021
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,458
|
MSALoginDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/MSALoginDialog.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QTimer>
#include <QtCore/QEventLoop>
#include <QtWidgets/QDialog>
#include "minecraft/auth/AuthFlow.h"
#include "minecraft/auth/MinecraftAccount.h"
namespace Ui {
class MSALoginDialog;
}
class MSALoginDialog : public QDialog {
Q_OBJECT
public:
~MSALoginDialog();
static MinecraftAccountPtr newAccount(QWidget* parent);
int exec() override;
private:
explicit MSALoginDialog(QWidget* parent = 0);
protected slots:
void onTaskFailed(QString reason);
void onDeviceFlowStatus(QString status);
void onAuthFlowStatus(QString status);
void authorizeWithBrowser(const QUrl& url);
void authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn);
private:
Ui::MSALoginDialog* ui;
MinecraftAccountPtr m_account;
shared_qobject_ptr<AuthFlow> m_devicecode_task;
shared_qobject_ptr<AuthFlow> m_authflow_task;
QUrl m_url;
};
| 1,534
|
C++
|
.h
| 44
| 31.681818
| 81
| 0.764706
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,459
|
SkinManageDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/dialogs/skins/SkinManageDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include <QItemSelection>
#include <QPixmap>
#include "minecraft/auth/MinecraftAccount.h"
#include "minecraft/skins/SkinList.h"
namespace Ui {
class SkinManageDialog;
}
class SkinManageDialog : public QDialog {
Q_OBJECT
public:
explicit SkinManageDialog(QWidget* parent, MinecraftAccountPtr acct);
virtual ~SkinManageDialog();
void resizeEvent(QResizeEvent* event) override;
public slots:
void selectionChanged(QItemSelection, QItemSelection);
void activated(QModelIndex);
void delayed_scroll(QModelIndex);
void on_openDirBtn_clicked();
void on_fileBtn_clicked();
void on_urlBtn_clicked();
void on_userBtn_clicked();
void accept() override;
void on_capeCombo_currentIndexChanged(int index);
void on_steveBtn_toggled(bool checked);
void on_resetBtn_clicked();
void show_context_menu(const QPoint& pos);
bool eventFilter(QObject* obj, QEvent* ev) override;
void on_action_Rename_Skin_triggered(bool checked);
void on_action_Delete_Skin_triggered(bool checked);
private:
void setupCapes();
MinecraftAccountPtr m_acct;
Ui::SkinManageDialog* ui;
SkinList m_list;
QString m_selected_skin;
QHash<QString, QPixmap> m_capes;
QHash<QString, int> m_capes_idx;
};
| 2,050
|
C++
|
.h
| 57
| 32.578947
| 74
| 0.748111
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,460
|
VersionSelectWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/VersionSelectWidget.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QLineEdit>
#include <QSortFilterProxyModel>
#include <QWidget>
#include "BaseVersionList.h"
#include "VersionListView.h"
class VersionProxyModel;
class VersionListView;
class QVBoxLayout;
class QProgressBar;
class Filter;
class VersionSelectWidget : public QWidget {
Q_OBJECT
public:
explicit VersionSelectWidget(QWidget* parent);
~VersionSelectWidget();
//! loads the list if needed.
void initialize(BaseVersionList* vlist, bool forceLoad = false);
//! Starts a task that loads the list.
void loadList();
bool hasVersions() const;
BaseVersion::Ptr selectedVersion() const;
void selectRecommended();
void selectCurrent();
void selectSearch();
VersionListView* view();
void setCurrentVersion(const QString& version);
void setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter);
void setExactFilter(BaseVersionList::ModelRoles role, QString filter);
void setExactIfPresentFilter(BaseVersionList::ModelRoles role, QString filter);
void setFilter(BaseVersionList::ModelRoles role, Filter* filter);
void setEmptyString(QString emptyString);
void setEmptyErrorString(QString emptyErrorString);
void setEmptyMode(VersionListView::EmptyMode mode);
void setResizeOn(int column);
bool eventFilter(QObject* watched, QEvent* event) override;
signals:
void selectedVersionChanged(BaseVersion::Ptr version);
protected:
virtual void closeEvent(QCloseEvent*) override;
private slots:
void onTaskSucceeded();
void onTaskFailed(const QString& reason);
void changeProgress(qint64 current, qint64 total);
void currentRowChanged(const QModelIndex& current, const QModelIndex&);
private:
void preselect();
private:
QString m_currentVersion;
BaseVersionList* m_vlist = nullptr;
VersionProxyModel* m_proxyModel = nullptr;
int resizeOnColumn = 0;
Task::Ptr m_load_task;
bool preselectedAlready = false;
QVBoxLayout* verticalLayout = nullptr;
VersionListView* listView = nullptr;
QLineEdit* search;
QProgressBar* sneakyProgressBar = nullptr;
};
| 3,637
|
C++
|
.h
| 93
| 35.688172
| 83
| 0.751771
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,461
|
FocusLineEdit.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/FocusLineEdit.h
|
#include <QLineEdit>
class FocusLineEdit : public QLineEdit {
Q_OBJECT
public:
FocusLineEdit(QWidget* parent);
virtual ~FocusLineEdit() {}
protected:
void focusInEvent(QFocusEvent* e);
void mousePressEvent(QMouseEvent* me);
bool _selectOnMousePress;
};
| 286
|
C++
|
.h
| 11
| 22
| 42
| 0.731618
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,462
|
LanguageSelectionWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/LanguageSelectionWidget.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QWidget>
class QVBoxLayout;
class QTreeView;
class QLabel;
class Setting;
class QCheckBox;
class LanguageSelectionWidget : public QWidget {
Q_OBJECT
public:
explicit LanguageSelectionWidget(QWidget* parent = 0);
virtual ~LanguageSelectionWidget() {};
QString getSelectedLanguageKey() const;
void retranslate();
protected slots:
void languageRowChanged(const QModelIndex& current, const QModelIndex& previous);
void languageSettingChanged(const Setting&, const QVariant&);
private:
QVBoxLayout* verticalLayout = nullptr;
QTreeView* languageView = nullptr;
QLabel* helpUsLabel = nullptr;
QCheckBox* formatCheckbox = nullptr;
};
| 1,315
|
C++
|
.h
| 37
| 32.567568
| 85
| 0.767899
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,463
|
ModFilterWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ModFilterWidget.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QButtonGroup>
#include <QList>
#include <QListWidgetItem>
#include <QTabWidget>
#include "Version.h"
#include "VersionProxyModel.h"
#include "meta/VersionList.h"
#include "minecraft/MinecraftInstance.h"
#include "modplatform/ModIndex.h"
class MinecraftInstance;
namespace Ui {
class ModFilterWidget;
}
class ModFilterWidget : public QTabWidget {
Q_OBJECT
public:
struct Filter {
std::list<Version> versions;
std::list<ModPlatform::IndexedVersionType> releases;
ModPlatform::ModLoaderTypes loaders;
QString side;
bool hideInstalled;
QStringList categoryIds;
bool openSource;
bool operator==(const Filter& other) const
{
return hideInstalled == other.hideInstalled && side == other.side && loaders == other.loaders && versions == other.versions &&
releases == other.releases && categoryIds == other.categoryIds && openSource == other.openSource;
}
bool operator!=(const Filter& other) const { return !(*this == other); }
bool checkMcVersions(QStringList value)
{
for (auto mcVersion : versions)
if (value.contains(mcVersion.toString()))
return true;
return versions.empty();
}
};
static unique_qobject_ptr<ModFilterWidget> create(MinecraftInstance* instance, bool extended, QWidget* parent = nullptr);
virtual ~ModFilterWidget();
auto getFilter() -> std::shared_ptr<Filter>;
auto changed() const -> bool { return m_filter_changed; }
signals:
void filterChanged();
public slots:
void setCategories(const QList<ModPlatform::Category>&);
private:
ModFilterWidget(MinecraftInstance* instance, bool extendedSupport, QWidget* parent = nullptr);
void loadVersionList();
void prepareBasicFilter();
private slots:
void onVersionFilterChanged(int);
void onVersionFilterTextChanged(const QString& version);
void onLoadersFilterChanged();
void onSideFilterChanged();
void onHideInstalledFilterChanged();
void onShowAllVersionsChanged();
void onOpenSourceFilterChanged();
void onReleaseFilterChanged();
private:
Ui::ModFilterWidget* ui;
MinecraftInstance* m_instance = nullptr;
std::shared_ptr<Filter> m_filter;
bool m_filter_changed = false;
Meta::VersionList::Ptr m_version_list;
VersionProxyModel* m_versions_proxy = nullptr;
QList<ModPlatform::Category> m_categories;
};
| 4,029
|
C++
|
.h
| 103
| 34.398058
| 138
| 0.71209
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,464
|
SubTaskProgressBar.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/SubTaskProgressBar.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* PrismLaucher - Minecraft Launcher
* Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <QWidget>
#include "QObjectPtr.h"
namespace Ui {
class SubTaskProgressBar;
}
class SubTaskProgressBar : public QWidget {
Q_OBJECT
public:
static unique_qobject_ptr<SubTaskProgressBar> create(QWidget* parent = nullptr);
SubTaskProgressBar(QWidget* parent = nullptr);
~SubTaskProgressBar();
void setRange(int min, int max);
void setValue(int value);
void setStatus(QString status);
void setDetails(QString details);
private:
Ui::SubTaskProgressBar* ui;
};
| 1,285
|
C++
|
.h
| 37
| 31.972973
| 84
| 0.749396
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,465
|
EnvironmentVariables.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/EnvironmentVariables.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QMap>
#include <QWidget>
namespace Ui {
class EnvironmentVariables;
}
class EnvironmentVariables : public QWidget {
Q_OBJECT
public:
explicit EnvironmentVariables(QWidget* state = nullptr);
~EnvironmentVariables() override;
void initialize(bool instance, bool override, const QMap<QString, QVariant>& value);
bool eventFilter(QObject* watched, QEvent* event) override;
void retranslate();
bool override() const;
QMap<QString, QVariant> value() const;
private:
Ui::EnvironmentVariables* ui;
};
| 1,307
|
C++
|
.h
| 36
| 33.527778
| 88
| 0.75
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,467
|
PageContainer.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/PageContainer.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QListView>
#include <QModelIndex>
#include <QWidget>
#include "ui/pages/BasePageContainer.h"
#include "ui/pages/BasePageProvider.h"
class QLayout;
class IconLabel;
class QSortFilterProxyModel;
class PageModel;
class QLabel;
class QListView;
class QLineEdit;
class QStackedLayout;
class QGridLayout;
class PageContainer : public QWidget, public BasePageContainer {
Q_OBJECT
public:
explicit PageContainer(BasePageProvider* pageProvider, QString defaultId = QString(), QWidget* parent = 0);
virtual ~PageContainer() {}
void addButtons(QWidget* buttons);
void addButtons(QLayout* buttons);
/*
* Save any unsaved state and prepare to be closed.
* @return true if everything can be saved, false if there is something that requires attention
*/
bool prepareToClose();
bool saveAll();
/* request close - used by individual pages */
bool requestClose() override
{
if (m_container) {
return m_container->requestClose();
}
return false;
}
bool selectPage(QString pageId) override;
BasePage* selectedPage() const override;
BasePage* getPage(QString pageId) override;
const QList<BasePage*>& getPages() const;
void refreshContainer() override;
virtual void setParentContainer(BasePageContainer* container) { m_container = container; };
void changeEvent(QEvent*) override;
void hidePageList() { m_pageList->hide(); }
private:
void createUI();
void retranslate();
public slots:
void help();
signals:
/** Emitted when the currently selected page is changed */
void selectedPageChanged(BasePage* previous, BasePage* selected);
private slots:
void currentChanged(const QModelIndex& current);
void showPage(int row);
private:
BasePageContainer* m_container = nullptr;
BasePage* m_currentPage = 0;
QSortFilterProxyModel* m_proxyModel;
PageModel* m_model;
QStackedLayout* m_pageStack;
QListView* m_pageList;
QLabel* m_header;
IconLabel* m_iconHeader;
QGridLayout* m_layout;
};
| 3,666
|
C++
|
.h
| 101
| 32.70297
| 111
| 0.728938
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,468
|
LogView.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/LogView.h
|
#pragma once
#include <QAbstractItemView>
#include <QPlainTextEdit>
class QAbstractItemModel;
class LogView : public QPlainTextEdit {
Q_OBJECT
public:
explicit LogView(QWidget* parent = nullptr);
virtual ~LogView();
virtual void setModel(QAbstractItemModel* model);
QAbstractItemModel* model() const;
public slots:
void setWordWrap(bool wrapping);
void findNext(const QString& what, bool reverse);
void scrollToBottom();
protected slots:
void repopulate();
// note: this supports only appending
void rowsInserted(const QModelIndex& parent, int first, int last);
void rowsAboutToBeInserted(const QModelIndex& parent, int first, int last);
// note: this supports only removing from front
void rowsRemoved(const QModelIndex& parent, int first, int last);
void modelDestroyed(QObject* model);
protected:
QAbstractItemModel* m_model = nullptr;
QTextCharFormat* m_defaultFormat = nullptr;
bool m_scroll = false;
bool m_scrolling = false;
};
| 1,029
|
C++
|
.h
| 29
| 31.241379
| 79
| 0.743461
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,469
|
CustomCommands.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/CustomCommands.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QWidget>
namespace Ui {
class CustomCommands;
}
class CustomCommands : public QWidget {
Q_OBJECT
public:
explicit CustomCommands(QWidget* parent = 0);
virtual ~CustomCommands();
void initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit);
void retranslate();
bool checked() const;
QString prelaunchCommand() const;
QString wrapperCommand() const;
QString postexitCommand() const;
private:
Ui::CustomCommands* ui;
};
| 2,046
|
C++
|
.h
| 53
| 36
| 125
| 0.735146
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,472
|
ProgressWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ProgressWidget.h
|
// Licensed under the Apache-2.0 license. See README.md for details.
#pragma once
#include <QWidget>
#include <memory>
class Task;
class QProgressBar;
class QLabel;
class ProgressWidget : public QWidget {
Q_OBJECT
public:
explicit ProgressWidget(QWidget* parent = nullptr, bool show_label = true);
/** Whether to hide the widget automatically if it's watching no running task. */
void hideIfInactive(bool hide) { m_hide_if_inactive = hide; }
/** Reset the displayed progress to 0 */
void reset();
/** The text that shows up in the middle of the progress bar.
* By default it's '%p%', with '%p' being the total progress in percentage.
*/
void progressFormat(QString);
public slots:
/** Watch the progress of a task. */
void watch(const Task* task);
/** Watch the progress of a task, and start it if needed */
void start(const Task* task);
/** Blocking way of waiting for a task to finish. */
bool exec(std::shared_ptr<Task> task);
/** Un-hide the widget if needed. */
void show();
/** Make the widget invisible. */
void hide();
private slots:
void handleTaskFinish();
void handleTaskStatus(const QString& status);
void handleTaskProgress(qint64 current, qint64 total);
void taskDestroyed();
private:
QLabel* m_label = nullptr;
QProgressBar* m_bar = nullptr;
const Task* m_task = nullptr;
bool m_hide_if_inactive = false;
};
| 1,465
|
C++
|
.h
| 41
| 31.292683
| 85
| 0.684883
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,473
|
ProjectDescriptionPage.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ProjectDescriptionPage.h
|
#pragma once
#include <QTextBrowser>
#include "QObjectPtr.h"
QT_BEGIN_NAMESPACE
class VariableSizedImageObject;
QT_END_NAMESPACE
/** This subclasses QTextBrowser to provide additional capabilities
* to it, like allowing for images to be shown.
*/
class ProjectDescriptionPage final : public QTextBrowser {
Q_OBJECT
public:
ProjectDescriptionPage(QWidget* parent = nullptr);
void setMetaEntry(QString entry);
public slots:
/** Flushes the current processing happening in the page.
*
* Should be called when changing the page's content entirely, to
* prevent old tasks from changing the new content.
*/
void flush();
private:
shared_qobject_ptr<VariableSizedImageObject> m_image_text_object;
};
| 759
|
C++
|
.h
| 24
| 28
| 70
| 0.755158
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,474
|
VariableSizedImageObject.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/VariableSizedImageObject.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QObject>
#include <QString>
#include <QTextObjectInterface>
#include <QUrl>
#include <memory>
/** Custom image text object to be used instead of the normal one in ProjectDescriptionPage.
*
* Why? Because we want to re-scale images dynamically based on the document's size, in order to
* not have images being weirdly cropped out in different resolutions.
*/
class VariableSizedImageObject final : public QObject, public QTextObjectInterface {
Q_OBJECT
Q_INTERFACES(QTextObjectInterface)
struct ImageMetadata {
int posInDocument;
QUrl url;
QImage image;
int width;
int height;
};
public:
QSizeF intrinsicSize(QTextDocument* doc, int posInDocument, const QTextFormat& format) override;
void drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format) override;
void setMetaEntry(QString meta_entry) { m_meta_entry = meta_entry; }
public slots:
/** Stops all currently loading images from modifying the document.
*
* This does not stop the ongoing network tasks, it only prevents their result
* from impacting the document any further.
*/
void flush();
private:
/** Adds the image to the document, in the given position.
*/
void parseImage(QTextDocument* doc, std::shared_ptr<ImageMetadata> meta);
/** Loads an image from an external source, and adds it to the document.
*
* This uses m_meta_entry to cache the image.
*/
void loadImage(QTextDocument* doc, std::shared_ptr<ImageMetadata> meta);
private:
QString m_meta_entry;
QSet<QUrl> m_fetching_images;
};
| 2,442
|
C++
|
.h
| 62
| 35.451613
| 134
| 0.729422
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,475
|
CheckComboBox.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/CheckComboBox.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QComboBox>
#include <QLineEdit>
class CheckComboBox : public QComboBox {
Q_OBJECT
public:
explicit CheckComboBox(QWidget* parent = nullptr);
virtual ~CheckComboBox() = default;
void hidePopup() override;
QString defaultText() const;
void setDefaultText(const QString& text);
Qt::CheckState itemCheckState(int index) const;
void setItemCheckState(int index, Qt::CheckState state);
QString separator() const;
void setSeparator(const QString& separator);
QStringList checkedItems() const;
void setSourceModel(QAbstractItemModel* model);
public slots:
void setCheckedItems(const QStringList& items);
signals:
void checkedItemsChanged(const QStringList& items);
protected:
void paintEvent(QPaintEvent*) override;
private:
void emitCheckedItemsChanged();
bool eventFilter(QObject* receiver, QEvent* event) override;
void toggleCheckState(int index);
private:
QString m_default_text;
QString m_separator;
bool containerMousePress;
};
| 1,811
|
C++
|
.h
| 49
| 33.285714
| 74
| 0.751144
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,476
|
Common.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/Common.h
|
#pragma once
#include <QTextLayout>
/** Cuts out the text in textLayout into smaller pieces, according to the lineWidth.
* Returns a list of pairs, each containing the width of that line and that line's string, respectively.
* The total height of those lines is set in the last argument, 'height'.
*/
QList<std::pair<qreal, QString>> viewItemTextLayout(QTextLayout& textLayout, int lineWidth, qreal& height);
| 416
|
C++
|
.h
| 7
| 57.714286
| 107
| 0.773956
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,477
|
ErrorFrame.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ErrorFrame.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QFrame>
namespace Ui {
class ErrorFrame;
}
class ErrorFrame : public QFrame {
Q_OBJECT
public:
explicit ErrorFrame(QWidget* parent = 0);
~ErrorFrame();
void setTitle(QString text);
void setDescription(QString text);
void clear();
public slots:
void ellipsisHandler(const QString& link);
void boxClosed(int result);
private:
void updateHiddenState();
private:
Ui::ErrorFrame* ui;
QString desc;
class QMessageBox* currentBox = nullptr;
};
| 1,136
|
C++
|
.h
| 37
| 27.459459
| 75
| 0.73921
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,478
|
InfoFrame.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/InfoFrame.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QFrame>
#include "minecraft/mod/Mod.h"
#include "minecraft/mod/ResourcePack.h"
#include "minecraft/mod/TexturePack.h"
namespace Ui {
class InfoFrame;
}
class InfoFrame : public QFrame {
Q_OBJECT
public:
InfoFrame(QWidget* parent = nullptr);
~InfoFrame() override;
void setName(QString text = {});
void setDescription(QString text = {});
void setImage(QPixmap img = {});
void setLicense(QString text = {});
void setIssueTracker(QString text = {});
void clear();
void updateWithMod(Mod const& m);
void updateWithResource(Resource const& resource);
void updateWithResourcePack(ResourcePack& rp);
void updateWithTexturePack(TexturePack& tp);
static QString renderColorCodes(QString input);
public slots:
void descriptionEllipsisHandler(QString link);
void licenseEllipsisHandler(QString link);
void boxClosed(int result);
private:
void updateHiddenState();
private:
Ui::InfoFrame* ui;
QString m_description;
QString m_license;
class QMessageBox* m_current_box = nullptr;
};
| 2,601
|
C++
|
.h
| 70
| 34.085714
| 80
| 0.731533
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,479
|
WideBar.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/WideBar.h
|
#pragma once
#include <QAction>
#include <QMap>
#include <QMenu>
#include <QToolBar>
#include <memory>
class WideBar : public QToolBar {
Q_OBJECT
// Why: so we can enable / disable alt shortcuts in toolbuttons
// with toolbuttons using setDefaultAction, theres no alt shortcuts
Q_PROPERTY(bool useDefaultAction MEMBER m_use_default_action)
public:
explicit WideBar(const QString& title, QWidget* parent = nullptr);
explicit WideBar(QWidget* parent = nullptr);
~WideBar() override = default;
void addAction(QAction* action);
void addSeparator();
void insertSpacer(QAction* action);
void insertSeparator(QAction* before);
void insertActionBefore(QAction* before, QAction* action);
void insertActionAfter(QAction* after, QAction* action);
void insertWidgetBefore(QAction* before, QWidget* widget);
QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString());
void showVisibilityMenu(const QPoint&);
void addContextMenuAction(QAction* action);
// Ideally we would use a QBitArray for this, but it doesn't support string conversion,
// so using it in settings is very messy.
[[nodiscard]] QByteArray getVisibilityState() const;
void setVisibilityState(QByteArray&&);
void removeAction(QAction* action);
private:
struct BarEntry {
enum class Type { None, Action, Separator, Spacer } type = Type::None;
QAction* bar_action = nullptr;
QAction* menu_action = nullptr;
};
auto getMatching(QAction* act) -> QList<BarEntry>::iterator;
/** Used to distinguish between versions of the WideBar with different actions */
[[nodiscard]] QByteArray getHash() const;
[[nodiscard]] bool checkHash(QByteArray const&) const;
private:
QList<BarEntry> m_entries;
QList<QAction*> m_context_menu_actions;
bool m_use_default_action = false;
// Menu to toggle visibility from buttons in the bar
std::unique_ptr<QMenu> m_bar_menu = nullptr;
enum class MenuState { Fresh, Dirty } m_menu_state = MenuState::Dirty;
};
| 2,098
|
C++
|
.h
| 48
| 38.8125
| 91
| 0.724409
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,481
|
JavaSettingsWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/JavaSettingsWidget.h
|
#pragma once
#include <QWidget>
#include <BaseVersion.h>
#include <QObjectPtr.h>
#include <java/JavaChecker.h>
#include <qcheckbox.h>
#include <QIcon>
class QLineEdit;
class VersionSelectWidget;
class QSpinBox;
class QPushButton;
class QVBoxLayout;
class QHBoxLayout;
class QGroupBox;
class QGridLayout;
class QLabel;
class QToolButton;
class QSpacerItem;
/**
* This is a widget for all the Java settings dialogs and pages.
*/
class JavaSettingsWidget : public QWidget {
Q_OBJECT
public:
explicit JavaSettingsWidget(QWidget* parent);
virtual ~JavaSettingsWidget();
enum class JavaStatus { NotSet, Pending, Good, DoesNotExist, DoesNotStart, ReturnedInvalidData } javaStatus = JavaStatus::NotSet;
enum class ValidationStatus { Bad, JavaBad, AllOK };
void refresh();
void initialize();
ValidationStatus validate();
void retranslate();
bool permGenEnabled() const;
int permGenSize() const;
int minHeapSize() const;
int maxHeapSize() const;
QString javaPath() const;
bool autoDetectJava() const;
bool autoDownloadJava() const;
void updateThresholds();
protected slots:
void onSpinBoxValueChanged(int);
void memoryValueChanged();
void javaPathEdited(const QString& path);
void javaVersionSelected(BaseVersion::Ptr version);
void on_javaBrowseBtn_clicked();
void on_javaStatusBtn_clicked();
void javaDownloadBtn_clicked();
void checkFinished(const JavaChecker::Result& result);
protected: /* methods */
void checkJavaPathOnEdit(const QString& path);
void checkJavaPath(const QString& path);
void setJavaStatus(JavaStatus status);
void setupUi();
private: /* data */
VersionSelectWidget* m_versionWidget = nullptr;
QVBoxLayout* m_verticalLayout = nullptr;
QSpacerItem* m_verticalSpacer = nullptr;
QLineEdit* m_javaPathTextBox = nullptr;
QPushButton* m_javaBrowseBtn = nullptr;
QToolButton* m_javaStatusBtn = nullptr;
QHBoxLayout* m_horizontalLayout = nullptr;
QGroupBox* m_memoryGroupBox = nullptr;
QGridLayout* m_gridLayout_2 = nullptr;
QSpinBox* m_maxMemSpinBox = nullptr;
QLabel* m_labelMinMem = nullptr;
QLabel* m_labelMaxMem = nullptr;
QLabel* m_labelMaxMemIcon = nullptr;
QSpinBox* m_minMemSpinBox = nullptr;
QLabel* m_labelPermGen = nullptr;
QSpinBox* m_permGenSpinBox = nullptr;
QHBoxLayout* m_horizontalBtnLayout = nullptr;
QPushButton* m_javaDownloadBtn = nullptr;
QIcon goodIcon;
QIcon yellowIcon;
QIcon badIcon;
QGroupBox* m_autoJavaGroupBox = nullptr;
QVBoxLayout* m_veriticalJavaLayout = nullptr;
QCheckBox* m_autodetectJavaCheckBox = nullptr;
QCheckBox* m_autodownloadCheckBox = nullptr;
unsigned int observedMinMemory = 0;
unsigned int observedMaxMemory = 0;
unsigned int observedPermGenMemory = 0;
QString queuedCheck;
uint64_t m_availableMemory = 0ull;
shared_qobject_ptr<JavaChecker> m_checker;
JavaChecker::Result m_result;
QTimer* m_memoryTimer;
};
| 3,041
|
C++
|
.h
| 89
| 30.033708
| 133
| 0.747871
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,483
|
IconLabel.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/IconLabel.h
|
#pragma once
#include <QIcon>
#include <QWidget>
class QStyleOption;
/**
* This is a trivial widget that paints a QIcon of the specified size.
*/
class IconLabel : public QWidget {
Q_OBJECT
public:
/// Create a line separator. orientation is the orientation of the line.
explicit IconLabel(QWidget* parent, QIcon icon, QSize size);
virtual QSize sizeHint() const;
virtual void paintEvent(QPaintEvent*);
void setIcon(QIcon icon);
private:
QSize m_size;
QIcon m_icon;
};
| 515
|
C++
|
.h
| 19
| 23.684211
| 76
| 0.72449
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,484
|
LineSeparator.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/LineSeparator.h
|
#pragma once
#include <QWidget>
class QStyleOption;
class LineSeparator : public QWidget {
Q_OBJECT
public:
/// Create a line separator. orientation is the orientation of the line.
explicit LineSeparator(QWidget* parent, Qt::Orientation orientation = Qt::Horizontal);
QSize sizeHint() const;
void paintEvent(QPaintEvent*);
void initStyleOption(QStyleOption* option) const;
private:
Qt::Orientation m_orientation = Qt::Horizontal;
};
| 471
|
C++
|
.h
| 14
| 29.928571
| 90
| 0.750552
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,485
|
ProjectItem.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ProjectItem.h
|
#pragma once
#include <QStyledItemDelegate>
/* Custom data types for our custom list models :) */
enum UserDataTypes {
TITLE = 257, // QString
DESCRIPTION = 258, // QString
SELECTED = 259, // bool
INSTALLED = 260 // bool
};
/** This is an item delegate composed of:
* - An Icon on the left
* - A title
* - A description
* */
class ProjectItemDelegate final : public QStyledItemDelegate {
Q_OBJECT
public:
ProjectItemDelegate(QWidget* parent);
void paint(QPainter*, const QStyleOptionViewItem&, const QModelIndex&) const override;
};
| 592
|
C++
|
.h
| 20
| 26.6
| 90
| 0.687831
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,486
|
ThemeCustomizationWidget.h
|
PrismLauncher_PrismLauncher/launcher/ui/widgets/ThemeCustomizationWidget.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Tayou <git@tayou.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QWidget>
#include "translations/TranslationsModel.h"
enum ThemeFields { NONE = 0b0000, ICONS = 0b0001, WIDGETS = 0b0010, CAT = 0b0100 };
namespace Ui {
class ThemeCustomizationWidget;
}
class ThemeCustomizationWidget : public QWidget {
Q_OBJECT
public:
explicit ThemeCustomizationWidget(QWidget* parent = nullptr);
~ThemeCustomizationWidget() override;
void showFeatures(ThemeFields features);
void applySettings();
void loadSettings();
void retranslate();
private slots:
void applyIconTheme(int index);
void applyWidgetTheme(int index);
void applyCatTheme(int index);
void refresh();
signals:
int currentIconThemeChanged(int index);
int currentWidgetThemeChanged(int index);
int currentCatChanged(int index);
private:
Ui::ThemeCustomizationWidget* ui;
};
| 1,590
|
C++
|
.h
| 45
| 32.155556
| 83
| 0.75163
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,487
|
HintOverrideProxyStyle.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/HintOverrideProxyStyle.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QProxyStyle>
#include <iostream>
/// Used to override platform-specific behaviours which the launcher does work well with.
class HintOverrideProxyStyle : public QProxyStyle {
Q_OBJECT
public:
HintOverrideProxyStyle(QStyle* style) : QProxyStyle(style) {}
int styleHint(QStyle::StyleHint hint,
const QStyleOption* option = nullptr,
const QWidget* widget = nullptr,
QStyleHintReturn* returnData = nullptr) const override;
};
| 1,260
|
C++
|
.h
| 30
| 38.066667
| 89
| 0.731648
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,488
|
CatPack.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/CatPack.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDate>
#include <QFileInfo>
#include <QList>
#include <QString>
class CatPack {
public:
virtual ~CatPack() {}
virtual QString id() = 0;
virtual QString name() = 0;
virtual QString path() = 0;
};
class BasicCatPack : public CatPack {
public:
BasicCatPack(QString id, QString name) : m_id(id), m_name(name) {}
BasicCatPack(QString id) : BasicCatPack(id, id) {}
virtual QString id() override { return m_id; }
virtual QString name() override { return m_name; }
virtual QString path() override;
protected:
QString m_id;
QString m_name;
};
class FileCatPack : public BasicCatPack {
public:
FileCatPack(QString id, QFileInfo& fileInfo) : BasicCatPack(id), m_path(fileInfo.absoluteFilePath()) {}
FileCatPack(QFileInfo& fileInfo) : FileCatPack(fileInfo.baseName(), fileInfo) {}
virtual QString path() { return m_path; }
private:
QString m_path;
};
class JsonCatPack : public BasicCatPack {
public:
struct PartialDate {
int month;
int day;
};
struct Variant {
QString path;
PartialDate startTime;
PartialDate endTime;
};
JsonCatPack(QFileInfo& manifestInfo);
virtual QString path() override;
QString path(QDate now);
private:
QString m_default_path;
QList<Variant> m_variants;
};
| 2,854
|
C++
|
.h
| 83
| 31
| 107
| 0.708182
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,489
|
ITheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/ITheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Tayou <git@tayou.org>
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <MessageLevel.h>
#include <QMap>
#include <QPalette>
#include <QString>
class QStyle;
struct LogColors {
QMap<MessageLevel::Enum, QColor> background;
QMap<MessageLevel::Enum, QColor> foreground;
};
// TODO: rename to Theme; this is not an interface as it contains method implementations
class ITheme {
public:
virtual ~ITheme() {}
virtual void apply(bool initial);
virtual QString id() = 0;
virtual QString name() = 0;
virtual QString tooltip() = 0;
virtual bool hasStyleSheet() = 0;
virtual QString appStyleSheet() = 0;
virtual QString qtTheme() = 0;
virtual QPalette colorScheme() = 0;
virtual QColor fadeColor() = 0;
virtual double fadeAmount() = 0;
virtual LogColors logColorScheme() { return defaultLogColors(colorScheme()); }
virtual QStringList searchPaths() { return {}; }
static QPalette fadeInactive(QPalette in, qreal bias, QColor color);
static LogColors defaultLogColors(const QPalette& palette);
};
| 2,547
|
C++
|
.h
| 64
| 37.109375
| 88
| 0.72852
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,490
|
CustomTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/CustomTheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 Tayou <git@tayou.org>
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QFileInfo>
#include "ITheme.h"
class CustomTheme : public ITheme {
public:
CustomTheme(ITheme* baseTheme, QFileInfo& file, bool isManifest);
virtual ~CustomTheme() {}
QString id() override;
QString name() override;
QString tooltip() override;
bool hasStyleSheet() override;
QString appStyleSheet() override;
QPalette colorScheme() override;
double fadeAmount() override;
QColor fadeColor() override;
QString qtTheme() override;
LogColors logColorScheme() override { return m_logColors; }
QStringList searchPaths() override;
private:
bool read(const QString& path, bool& hasCustomLogColors);
QPalette m_palette;
QColor m_fadeColor;
double m_fadeAmount;
QString m_styleSheet;
QString m_name;
QString m_id;
QString m_widgets;
QString m_qssFilePath;
LogColors m_logColors;
/**
* The tooltip could be defined in the theme json,
* or composed of other fields that could be in there.
* like author, license, etc.
*/
QString m_tooltip = "";
};
| 2,627
|
C++
|
.h
| 71
| 33.690141
| 80
| 0.72011
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,491
|
BrightTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/BrightTheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 Tayou <git@tayou.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "FusionTheme.h"
class BrightTheme : public FusionTheme {
public:
virtual ~BrightTheme() {}
QString id() override;
QString name() override;
QString tooltip() override;
bool hasStyleSheet() override;
QString appStyleSheet() override;
QPalette colorScheme() override;
double fadeAmount() override;
QColor fadeColor() override;
};
| 1,869
|
C++
|
.h
| 48
| 36.395833
| 80
| 0.729373
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,492
|
SystemTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/SystemTheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 Tayou <git@tayou.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "ITheme.h"
class SystemTheme : public ITheme {
public:
SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme);
virtual ~SystemTheme() {}
void apply(bool initial) override;
QString id() override;
QString name() override;
QString tooltip() override;
QString qtTheme() override;
bool hasStyleSheet() override;
QString appStyleSheet() override;
QPalette colorScheme() override;
double fadeAmount() override;
QColor fadeColor() override;
private:
QPalette colorPalette;
QString widgetTheme;
QString themeName;
};
| 2,107
|
C++
|
.h
| 55
| 35.454545
| 88
| 0.730957
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,493
|
ThemeManager.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/ThemeManager.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 Tayou <git@tayou.org>
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDir>
#include <QLoggingCategory>
#include <QString>
#include <memory>
#include "IconTheme.h"
#include "ui/themes/CatPack.h"
#include "ui/themes/ITheme.h"
inline auto themeDebugLog()
{
return qDebug() << "[Theme]";
}
inline auto themeWarningLog()
{
return qWarning() << "[Theme]";
}
class ThemeManager {
public:
ThemeManager();
QList<IconTheme*> getValidIconThemes();
QList<ITheme*> getValidApplicationThemes();
bool isValidIconTheme(const QString& id);
bool isValidApplicationTheme(const QString& id);
QDir getIconThemesFolder();
QDir getApplicationThemesFolder();
QDir getCatPacksFolder();
void applyCurrentlySelectedTheme(bool initial = false);
void setIconTheme(const QString& name);
void setApplicationTheme(const QString& name, bool initial = false);
/// @brief Returns the background based on selected and with events (Birthday, XMas, etc.)
/// @param catName Optional, if you need a specific background.
/// @return
QString getCatPack(QString catName = "");
QList<CatPack*> getValidCatPacks();
const LogColors& getLogColors() { return m_logColors; }
void refresh();
private:
std::map<QString, std::unique_ptr<ITheme>> m_themes;
std::map<QString, IconTheme> m_icons;
QDir m_iconThemeFolder{ "iconthemes" };
QDir m_applicationThemeFolder{ "themes" };
QDir m_catPacksFolder{ "catpacks" };
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
QString m_defaultStyle;
QPalette m_defaultPalette;
LogColors m_logColors;
void initializeThemes();
void initializeCatPacks();
QString addTheme(std::unique_ptr<ITheme> theme);
ITheme* getTheme(QString themeId);
QString addIconTheme(IconTheme theme);
QString addCatPack(std::unique_ptr<CatPack> catPack);
void initializeIcons();
void initializeWidgets();
const QStringList builtinIcons{ "pe_colored", "pe_light", "pe_dark", "pe_blue", "breeze_light", "breeze_dark",
"OSX", "iOS", "flat", "flat_white", "multimc" };
};
| 2,899
|
C++
|
.h
| 75
| 34.706667
| 117
| 0.712407
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,494
|
DarkTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/DarkTheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2024 Tayou <git@tayou.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "FusionTheme.h"
class DarkTheme : public FusionTheme {
public:
virtual ~DarkTheme() {}
QString id() override;
QString name() override;
QString tooltip() override;
bool hasStyleSheet() override;
QString appStyleSheet() override;
QPalette colorScheme() override;
double fadeAmount() override;
QColor fadeColor() override;
};
| 1,865
|
C++
|
.h
| 48
| 36.3125
| 80
| 0.728776
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,495
|
IconTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/IconTheme.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QString>
class IconTheme {
public:
IconTheme(const QString& id, const QString& path);
IconTheme() = default;
bool load();
QString id();
QString path();
QString name();
private:
QString m_id;
QString m_path;
QString m_name;
};
| 1,038
|
C++
|
.h
| 32
| 29.5
| 74
| 0.722278
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,496
|
FusionTheme.h
|
PrismLauncher_PrismLauncher/launcher/ui/themes/FusionTheme.h
|
#pragma once
#include "ITheme.h"
class FusionTheme : public ITheme {
public:
virtual ~FusionTheme() {}
QString qtTheme() override;
};
| 148
|
C++
|
.h
| 7
| 18.142857
| 35
| 0.710145
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,499
|
AccessibleInstanceView_p.h
|
PrismLauncher_PrismLauncher/launcher/ui/instanceview/AccessibleInstanceView_p.h
|
#pragma once
#include <QtGui/qaccessible.h>
#include <QAbstractItemView>
#include <QAccessibleWidget>
#include "QtCore/qpointer.h"
#ifndef QT_NO_ACCESSIBILITY
#include "InstanceView.h"
// #include <QHeaderView>
class QAccessibleTableCell;
class QAccessibleTableHeaderCell;
class AccessibleInstanceView : public QAccessibleTableInterface, public QAccessibleObject {
public:
explicit AccessibleInstanceView(QWidget* w);
bool isValid() const override;
QAccessible::Role role() const override;
QAccessible::State state() const override;
QString text(QAccessible::Text t) const override;
QRect rect() const override;
QAccessibleInterface* childAt(int x, int y) const override;
int childCount() const override;
int indexOfChild(const QAccessibleInterface*) const override;
QAccessibleInterface* parent() const override;
QAccessibleInterface* child(int index) const override;
void* interface_cast(QAccessible::InterfaceType t) override;
// table interface
QAccessibleInterface* cellAt(int row, int column) const override;
QAccessibleInterface* caption() const override;
QAccessibleInterface* summary() const override;
QString columnDescription(int column) const override;
QString rowDescription(int row) const override;
int columnCount() const override;
int rowCount() const override;
// selection
int selectedCellCount() const override;
int selectedColumnCount() const override;
int selectedRowCount() const override;
QList<QAccessibleInterface*> selectedCells() const override;
QList<int> selectedColumns() const override;
QList<int> selectedRows() const override;
bool isColumnSelected(int column) const override;
bool isRowSelected(int row) const override;
bool selectRow(int row) override;
bool selectColumn(int column) override;
bool unselectRow(int row) override;
bool unselectColumn(int column) override;
QAbstractItemView* view() const;
void modelChange(QAccessibleTableModelChangeEvent* event) override;
protected:
// maybe vector
using ChildCache = QHash<int, QAccessible::Id>;
mutable ChildCache childToId;
virtual ~AccessibleInstanceView();
private:
inline int logicalIndex(const QModelIndex& index) const;
};
class AccessibleInstanceViewItem : public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface {
public:
AccessibleInstanceViewItem(QAbstractItemView* view, const QModelIndex& m_index);
void* interface_cast(QAccessible::InterfaceType t) override;
QObject* object() const override { return nullptr; }
QAccessible::Role role() const override;
QAccessible::State state() const override;
QRect rect() const override;
bool isValid() const override;
QAccessibleInterface* childAt(int, int) const override { return nullptr; }
int childCount() const override { return 0; }
int indexOfChild(const QAccessibleInterface*) const override { return -1; }
QString text(QAccessible::Text t) const override;
void setText(QAccessible::Text t, const QString& text) override;
QAccessibleInterface* parent() const override;
QAccessibleInterface* child(int) const override;
// cell interface
int columnExtent() const override;
QList<QAccessibleInterface*> columnHeaderCells() const override;
int columnIndex() const override;
int rowExtent() const override;
QList<QAccessibleInterface*> rowHeaderCells() const override;
int rowIndex() const override;
bool isSelected() const override;
QAccessibleInterface* table() const override;
// action interface
QStringList actionNames() const override;
void doAction(const QString& actionName) override;
QStringList keyBindingsForAction(const QString& actionName) const override;
private:
QPointer<QAbstractItemView> view;
QPersistentModelIndex m_index;
void selectCell();
void unselectCell();
friend class AccessibleInstanceView;
};
#endif /* !QT_NO_ACCESSIBILITY */
| 4,070
|
C++
|
.h
| 92
| 39.684783
| 137
| 0.770106
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,500
|
InstanceProxyModel.h
|
PrismLauncher_PrismLauncher/launcher/ui/instanceview/InstanceProxyModel.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QCollator>
#include <QSortFilterProxyModel>
class InstanceProxyModel : public QSortFilterProxyModel {
Q_OBJECT
public:
InstanceProxyModel(QObject* parent = 0);
protected:
QVariant data(const QModelIndex& index, int role) const override;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
bool subSortLessThan(const QModelIndex& left, const QModelIndex& right) const;
private:
QCollator m_naturalSort;
};
| 1,102
|
C++
|
.h
| 28
| 36.5
| 84
| 0.769663
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,501
|
VisualGroup.h
|
PrismLauncher_PrismLauncher/launcher/ui/instanceview/VisualGroup.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 Tayou <git@tayou.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QRect>
#include <QString>
#include <QStyleOption>
#include <QVector>
class InstanceView;
class QPainter;
class QModelIndex;
struct VisualRow {
QList<QModelIndex> items;
int height = 0;
int top = 0;
inline int size() const { return items.size(); }
inline QModelIndex& operator[](int i) { return items[i]; }
};
struct VisualGroup {
/* constructors */
VisualGroup(QString text, InstanceView* view);
explicit VisualGroup(const VisualGroup* other);
/* data */
InstanceView* view = nullptr;
QString text;
bool collapsed = false;
QVector<VisualRow> rows;
int firstItemIndex = 0;
int m_verticalPosition = 0;
/* logic */
/// update the internal list of items and flow them into the rows.
void update();
/// draw the header at y-position.
void drawHeader(QPainter* painter, const QStyleOptionViewItem& option) const;
/// height of the group, in total. includes a small bit of padding.
int totalHeight() const;
/// height of the group header, in pixels
static int headerHeight();
/// height of the group content, in pixels
int contentHeight() const;
/// the number of visual rows this group has
int numRows() const;
/// actually calculate the above value
int calculateNumRows() const;
/// the height at which this group starts, in pixels
int verticalPosition() const;
/// relative geometry - top of the row of the given item
int rowTopOf(const QModelIndex& index) const;
/// height of the row of the given item
int rowHeightOf(const QModelIndex& index) const;
/// x/y position of the given item inside the group (in items!)
QPair<int, int> positionOf(const QModelIndex& index) const;
enum HitResult { NoHit = 0x0, TextHit = 0x1, CheckboxHit = 0x2, HeaderHit = 0x4, BodyHit = 0x8 };
Q_DECLARE_FLAGS(HitResults, HitResult)
/// shoot! BANG! what did we hit?
HitResults hitScan(const QPoint& pos) const;
QList<QModelIndex> items() const;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(VisualGroup::HitResults)
| 3,575
|
C++
|
.h
| 90
| 36.222222
| 101
| 0.714492
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,502
|
AccessibleInstanceView.h
|
PrismLauncher_PrismLauncher/launcher/ui/instanceview/AccessibleInstanceView.h
|
#pragma once
#include <QObject>
#include <QString>
class QAccessibleInterface;
QAccessibleInterface* groupViewAccessibleFactory(const QString& classname, QObject* object);
| 174
|
C++
|
.h
| 5
| 33.4
| 92
| 0.856287
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,503
|
InstallJavaDialog.h
|
PrismLauncher_PrismLauncher/launcher/ui/java/InstallJavaDialog.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2024 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QDialog>
#include "BaseInstance.h"
#include "ui/pages/BasePageProvider.h"
class MinecraftInstance;
class PageContainer;
class PackProfile;
class QDialogButtonBox;
namespace Java {
class InstallDialog final : public QDialog, private BasePageProvider {
Q_OBJECT
public:
explicit InstallDialog(const QString& uid = QString(), BaseInstance* instance = nullptr, QWidget* parent = nullptr);
QList<BasePage*> getPages() override;
QString dialogTitle() override;
void validate(BasePage* selected);
void done(int result) override;
private:
PageContainer* container;
QDialogButtonBox* buttons;
};
} // namespace Java
| 1,422
|
C++
|
.h
| 39
| 33.897436
| 120
| 0.760727
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,504
|
VersionList.h
|
PrismLauncher_PrismLauncher/launcher/ui/java/VersionList.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2024 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "BaseVersionList.h"
#include "java/JavaMetadata.h"
#include "meta/Version.h"
namespace Java {
class VersionList : public BaseVersionList {
Q_OBJECT
public:
explicit VersionList(Meta::Version::Ptr m_version, QObject* parent = 0);
Task::Ptr getLoadTask() override;
bool isLoaded() override;
const BaseVersion::Ptr at(int i) const override;
int count() const override;
void sortVersions() override;
QVariant data(const QModelIndex& index, int role) const override;
RoleList providesRoles() const override;
protected slots:
void updateListData(QList<BaseVersion::Ptr>) override {}
protected:
Meta::Version::Ptr m_version;
QList<Java::MetadataPtr> m_vlist;
};
} // namespace Java
| 1,510
|
C++
|
.h
| 40
| 34.7
| 76
| 0.743151
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,506
|
CheckUpdateTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/CheckUpdateTask.h
|
#pragma once
#include "minecraft/mod/Mod.h"
#include "minecraft/mod/tasks/GetModDependenciesTask.h"
#include "modplatform/ModIndex.h"
#include "modplatform/ResourceAPI.h"
#include "tasks/Task.h"
class ResourceDownloadTask;
class ModFolderModel;
class CheckUpdateTask : public Task {
Q_OBJECT
public:
CheckUpdateTask(QList<Resource*>& resources,
std::list<Version>& mcVersions,
QList<ModPlatform::ModLoaderType> loadersList,
std::shared_ptr<ResourceFolderModel> resourceModel)
: Task()
, m_resources(resources)
, m_game_versions(mcVersions)
, m_loaders_list(std::move(loadersList))
, m_resource_model(std::move(resourceModel))
{}
struct Update {
QString name;
QString old_hash;
QString old_version;
QString new_version;
std::optional<ModPlatform::IndexedVersionType> new_version_type;
QString changelog;
ModPlatform::ResourceProvider provider;
shared_qobject_ptr<ResourceDownloadTask> download;
bool enabled = true;
public:
Update(QString name,
QString old_h,
QString old_v,
QString new_v,
std::optional<ModPlatform::IndexedVersionType> new_v_type,
QString changelog,
ModPlatform::ResourceProvider p,
shared_qobject_ptr<ResourceDownloadTask> t,
bool enabled = true)
: name(std::move(name))
, old_hash(std::move(old_h))
, old_version(std::move(old_v))
, new_version(std::move(new_v))
, new_version_type(std::move(new_v_type))
, changelog(std::move(changelog))
, provider(p)
, download(std::move(t))
, enabled(enabled)
{}
};
auto getUpdates() -> std::vector<Update>&& { return std::move(m_updates); }
auto getDependencies() -> QList<std::shared_ptr<GetModDependenciesTask::PackDependency>>&& { return std::move(m_deps); }
public slots:
bool abort() override = 0;
protected slots:
void executeTask() override = 0;
signals:
void checkFailed(Resource* failed, QString reason, QUrl recover_url = {});
protected:
QList<Resource*>& m_resources;
std::list<Version>& m_game_versions;
QList<ModPlatform::ModLoaderType> m_loaders_list;
std::shared_ptr<ResourceFolderModel> m_resource_model;
std::vector<Update> m_updates;
QList<std::shared_ptr<GetModDependenciesTask::PackDependency>> m_deps;
};
| 2,597
|
C++
|
.h
| 68
| 29.632353
| 124
| 0.633691
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,507
|
ModIndex.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/ModIndex.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QList>
#include <QMetaType>
#include <QString>
#include <QVariant>
#include <QVector>
#include <memory>
class QIODevice;
namespace ModPlatform {
enum ModLoaderType { NeoForge = 1 << 0, Forge = 1 << 1, Cauldron = 1 << 2, LiteLoader = 1 << 3, Fabric = 1 << 4, Quilt = 1 << 5 };
Q_DECLARE_FLAGS(ModLoaderTypes, ModLoaderType)
enum class ResourceProvider { MODRINTH, FLAME };
enum class ResourceType { MOD, RESOURCE_PACK, SHADER_PACK, MODPACK };
enum class DependencyType { REQUIRED, OPTIONAL, INCOMPATIBLE, EMBEDDED, TOOL, INCLUDE, UNKNOWN };
namespace ProviderCapabilities {
const char* name(ResourceProvider);
QString readableName(ResourceProvider);
QStringList hashType(ResourceProvider);
} // namespace ProviderCapabilities
struct ModpackAuthor {
QString name;
QString url;
};
struct DonationData {
QString id;
QString platform;
QString url;
};
struct IndexedVersionType {
enum class VersionType { Release = 1, Beta, Alpha, Unknown };
IndexedVersionType(const QString& type);
IndexedVersionType(const IndexedVersionType::VersionType& type);
IndexedVersionType(const IndexedVersionType& type);
IndexedVersionType() : IndexedVersionType(IndexedVersionType::VersionType::Unknown) {}
static const QString toString(const IndexedVersionType::VersionType& type);
static IndexedVersionType::VersionType enumFromString(const QString& type);
bool isValid() const { return m_type != IndexedVersionType::VersionType::Unknown; }
IndexedVersionType& operator=(const IndexedVersionType& other);
bool operator==(const IndexedVersionType& other) const { return m_type == other.m_type; }
bool operator==(const IndexedVersionType::VersionType& type) const { return m_type == type; }
bool operator!=(const IndexedVersionType& other) const { return m_type != other.m_type; }
bool operator!=(const IndexedVersionType::VersionType& type) const { return m_type != type; }
bool operator<(const IndexedVersionType& other) const { return m_type < other.m_type; }
bool operator<(const IndexedVersionType::VersionType& type) const { return m_type < type; }
bool operator<=(const IndexedVersionType& other) const { return m_type <= other.m_type; }
bool operator<=(const IndexedVersionType::VersionType& type) const { return m_type <= type; }
bool operator>(const IndexedVersionType& other) const { return m_type > other.m_type; }
bool operator>(const IndexedVersionType::VersionType& type) const { return m_type > type; }
bool operator>=(const IndexedVersionType& other) const { return m_type >= other.m_type; }
bool operator>=(const IndexedVersionType::VersionType& type) const { return m_type >= type; }
QString toString() const { return toString(m_type); }
IndexedVersionType::VersionType m_type;
};
struct Dependency {
QVariant addonId;
DependencyType type;
QString version;
};
struct IndexedVersion {
QVariant addonId;
QVariant fileId;
QString version;
QString version_number = {};
IndexedVersionType version_type;
QStringList mcVersion;
QString downloadUrl;
QString date;
QString fileName;
ModLoaderTypes loaders = {};
QString hash_type;
QString hash;
bool is_preferred = true;
QString changelog;
QList<Dependency> dependencies;
QString side; // this is for flame API
// For internal use, not provided by APIs
bool is_currently_selected = false;
};
struct ExtraPackData {
QList<DonationData> donate;
QString issuesUrl;
QString sourceUrl;
QString wikiUrl;
QString discordUrl;
QString status;
QString body;
};
struct IndexedPack {
using Ptr = std::shared_ptr<IndexedPack>;
QVariant addonId;
ResourceProvider provider;
QString name;
QString slug;
QString description;
QList<ModpackAuthor> authors;
QString logoName;
QString logoUrl;
QString websiteUrl;
QString side;
bool versionsLoaded = false;
QVector<IndexedVersion> versions;
// Don't load by default, since some modplatform don't have that info
bool extraDataLoaded = true;
ExtraPackData extraData;
// For internal use, not provided by APIs
[[nodiscard]] bool isVersionSelected(int index) const
{
if (!versionsLoaded)
return false;
return versions.at(index).is_currently_selected;
}
[[nodiscard]] bool isAnyVersionSelected() const
{
if (!versionsLoaded)
return false;
return std::any_of(versions.constBegin(), versions.constEnd(), [](auto const& v) { return v.is_currently_selected; });
}
};
struct OverrideDep {
QString quilt;
QString fabric;
QString slug;
ModPlatform::ResourceProvider provider;
};
inline auto getOverrideDeps() -> QList<OverrideDep>
{
return { { "634179", "306612", "API", ModPlatform::ResourceProvider::FLAME },
{ "720410", "308769", "KotlinLibraries", ModPlatform::ResourceProvider::FLAME },
{ "qvIfYCYJ", "P7dR8mSH", "API", ModPlatform::ResourceProvider::MODRINTH },
{ "lwVhp9o5", "Ha28R6CL", "KotlinLibraries", ModPlatform::ResourceProvider::MODRINTH } };
}
QString getMetaURL(ResourceProvider provider, QVariant projectID);
auto getModLoaderAsString(ModLoaderType type) -> const QString;
auto getModLoaderFromString(QString type) -> ModLoaderType;
constexpr bool hasSingleModLoaderSelected(ModLoaderTypes l) noexcept
{
auto x = static_cast<int>(l);
return x && !(x & (x - 1));
}
struct Category {
QString name;
QString id;
};
} // namespace ModPlatform
Q_DECLARE_METATYPE(ModPlatform::IndexedPack)
Q_DECLARE_METATYPE(ModPlatform::IndexedPack::Ptr)
Q_DECLARE_METATYPE(ModPlatform::ResourceProvider)
| 6,560
|
C++
|
.h
| 165
| 35.727273
| 130
| 0.731677
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,508
|
ResourceAPI.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/ResourceAPI.h
|
// SPDX-FileCopyrightText: 2023 flowln <flowlnlnln@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-only AND Apache-2.0
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QDebug>
#include <QList>
#include <QString>
#include <list>
#include <optional>
#include "../Version.h"
#include "modplatform/ModIndex.h"
#include "tasks/Task.h"
/* Simple class with a common interface for interacting with APIs */
class ResourceAPI {
public:
virtual ~ResourceAPI() = default;
struct SortingMethod {
// The index of the sorting method. Used to allow for arbitrary ordering in the list of methods.
// Used by Flame in the API request.
unsigned int index;
// The real name of the sorting, as used in the respective API specification.
// Used by Modrinth in the API request.
QString name;
// The human-readable name of the sorting, used for display in the UI.
QString readable_name;
};
struct SearchArgs {
ModPlatform::ResourceType type{};
int offset = 0;
std::optional<QString> search;
std::optional<SortingMethod> sorting;
std::optional<ModPlatform::ModLoaderTypes> loaders;
std::optional<std::list<Version> > versions;
std::optional<QString> side;
std::optional<QStringList> categoryIds;
bool openSource;
};
struct SearchCallbacks {
std::function<void(QJsonDocument&)> on_succeed;
std::function<void(QString const& reason, int network_error_code)> on_fail;
std::function<void()> on_abort;
};
struct VersionSearchArgs {
ModPlatform::IndexedPack pack;
std::optional<std::list<Version>> mcVersions;
std::optional<ModPlatform::ModLoaderTypes> loaders;
VersionSearchArgs(VersionSearchArgs const&) = default;
void operator=(VersionSearchArgs other)
{
pack = other.pack;
mcVersions = other.mcVersions;
loaders = other.loaders;
}
};
struct VersionSearchCallbacks {
std::function<void(QJsonDocument&, ModPlatform::IndexedPack)> on_succeed;
std::function<void(QString const& reason, int network_error_code)> on_fail;
};
struct ProjectInfoArgs {
ModPlatform::IndexedPack pack;
ProjectInfoArgs(ProjectInfoArgs const&) = default;
void operator=(ProjectInfoArgs other) { pack = other.pack; }
};
struct ProjectInfoCallbacks {
std::function<void(QJsonDocument&, const ModPlatform::IndexedPack&)> on_succeed;
std::function<void(QString const& reason)> on_fail;
std::function<void()> on_abort;
};
struct DependencySearchArgs {
ModPlatform::Dependency dependency;
Version mcVersion;
ModPlatform::ModLoaderTypes loader;
};
struct DependencySearchCallbacks {
std::function<void(QJsonDocument&, const ModPlatform::Dependency&)> on_succeed;
std::function<void(QString const& reason, int network_error_code)> on_fail;
};
public:
/** Gets a list of available sorting methods for this API. */
[[nodiscard]] virtual auto getSortingMethods() const -> QList<SortingMethod> = 0;
public slots:
[[nodiscard]] virtual Task::Ptr searchProjects(SearchArgs&&, SearchCallbacks&&) const
{
qWarning() << "TODO: ResourceAPI::searchProjects";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProject([[maybe_unused]] QString addonId,
[[maybe_unused]] std::shared_ptr<QByteArray> response) const
{
qWarning() << "TODO: ResourceAPI::getProject";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProjects([[maybe_unused]] QStringList addonIds,
[[maybe_unused]] std::shared_ptr<QByteArray> response) const
{
qWarning() << "TODO: ResourceAPI::getProjects";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProjectInfo(ProjectInfoArgs&&, ProjectInfoCallbacks&&) const
{
qWarning() << "TODO: ResourceAPI::getProjectInfo";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProjectVersions(VersionSearchArgs&&, VersionSearchCallbacks&&) const
{
qWarning() << "TODO: ResourceAPI::getProjectVersions";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getDependencyVersion(DependencySearchArgs&&, DependencySearchCallbacks&&) const
{
qWarning() << "TODO";
return nullptr;
}
protected:
[[nodiscard]] inline QString debugName() const { return "External resource API"; }
[[nodiscard]] inline auto getGameVersionsString(std::list<Version> mcVersions) const -> QString
{
QString s;
for (auto& ver : mcVersions) {
s += QString("\"%1\",").arg(ver.toString());
}
s.remove(s.length() - 1, 1); // remove last comma
return s;
}
};
| 6,463
|
C++
|
.h
| 159
| 34.377358
| 115
| 0.672238
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,509
|
EnsureMetadataTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/EnsureMetadataTask.h
|
#pragma once
#include "ModIndex.h"
#include "net/NetJob.h"
#include "modplatform/helpers/HashUtils.h"
#include "minecraft/mod/Resource.h"
#include "tasks/ConcurrentTask.h"
class Mod;
class QDir;
class EnsureMetadataTask : public Task {
Q_OBJECT
public:
EnsureMetadataTask(Resource*, QDir, ModPlatform::ResourceProvider = ModPlatform::ResourceProvider::MODRINTH);
EnsureMetadataTask(QList<Resource*>&, QDir, ModPlatform::ResourceProvider = ModPlatform::ResourceProvider::MODRINTH);
EnsureMetadataTask(QHash<QString, Resource*>&, QDir, ModPlatform::ResourceProvider = ModPlatform::ResourceProvider::MODRINTH);
~EnsureMetadataTask() = default;
Task::Ptr getHashingTask() { return m_hashing_task; }
public slots:
bool abort() override;
protected slots:
void executeTask() override;
private:
// FIXME: Move to their own namespace
auto modrinthVersionsTask() -> Task::Ptr;
auto modrinthProjectsTask() -> Task::Ptr;
auto flameVersionsTask() -> Task::Ptr;
auto flameProjectsTask() -> Task::Ptr;
// Helpers
enum class RemoveFromList { Yes, No };
void emitReady(Resource*, QString key = {}, RemoveFromList = RemoveFromList::Yes);
void emitFail(Resource*, QString key = {}, RemoveFromList = RemoveFromList::Yes);
// Hashes and stuff
auto createNewHash(Resource*) -> Hashing::Hasher::Ptr;
auto getExistingHash(Resource*) -> QString;
private slots:
void modrinthCallback(ModPlatform::IndexedPack& pack, ModPlatform::IndexedVersion& ver, Resource*);
void flameCallback(ModPlatform::IndexedPack& pack, ModPlatform::IndexedVersion& ver, Resource*);
signals:
void metadataReady(Resource*);
void metadataFailed(Resource*);
private:
QHash<QString, Resource*> m_resources;
QDir m_index_dir;
ModPlatform::ResourceProvider m_provider;
QHash<QString, ModPlatform::IndexedVersion> m_temp_versions;
ConcurrentTask::Ptr m_hashing_task;
Task::Ptr m_current_task;
};
| 1,997
|
C++
|
.h
| 47
| 38.12766
| 130
| 0.741335
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,510
|
ModrinthInstanceCreationTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.h
|
#pragma once
#include <optional>
#include "BaseInstance.h"
#include "InstanceCreationTask.h"
#include "modplatform/modrinth/ModrinthPackManifest.h"
class ModrinthCreationTask final : public InstanceCreationTask {
Q_OBJECT
public:
ModrinthCreationTask(QString staging_path,
SettingsObjectPtr global_settings,
QWidget* parent,
QString id,
QString version_id = {},
QString original_instance_id = {})
: InstanceCreationTask(), m_parent(parent), m_managed_id(std::move(id)), m_managed_version_id(std::move(version_id))
{
setStagingPath(staging_path);
setParentSettings(global_settings);
m_original_instance_id = std::move(original_instance_id);
}
bool abort() override;
bool updateInstance() override;
bool createInstance() override;
private:
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_internal_data = true, bool show_optional_dialog = true);
private:
QWidget* m_parent = nullptr;
QString m_minecraft_version, m_fabric_version, m_quilt_version, m_forge_version, m_neoForge_version;
QString m_managed_id, m_managed_version_id, m_managed_name;
std::vector<Modrinth::File> m_files;
Task::Ptr m_task;
std::optional<InstancePtr> m_instance;
QString m_root_path = "minecraft";
};
| 1,439
|
C++
|
.h
| 34
| 34.294118
| 134
| 0.668103
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,511
|
ModrinthCheckUpdate.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthCheckUpdate.h
|
#pragma once
#include "modplatform/CheckUpdateTask.h"
class ModrinthCheckUpdate : public CheckUpdateTask {
Q_OBJECT
public:
ModrinthCheckUpdate(QList<Resource*>& resources,
std::list<Version>& mcVersions,
QList<ModPlatform::ModLoaderType> loadersList,
std::shared_ptr<ResourceFolderModel> resourceModel)
: CheckUpdateTask(resources, mcVersions, std::move(loadersList), std::move(resourceModel))
, m_hash_type(ModPlatform::ProviderCapabilities::hashType(ModPlatform::ResourceProvider::MODRINTH).first())
{}
public slots:
bool abort() override;
protected slots:
void executeTask() override;
void getUpdateModsForLoader(std::optional<ModPlatform::ModLoaderTypes> loader);
void checkVersionsResponse(std::shared_ptr<QByteArray> response, std::optional<ModPlatform::ModLoaderTypes> loader);
void checkNextLoader();
private:
Task::Ptr m_job = nullptr;
QHash<QString, Resource*> m_mappings;
QString m_hash_type;
int m_loader_idx = 0;
};
| 1,084
|
C++
|
.h
| 25
| 36.2
| 120
| 0.706553
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,512
|
ModrinthPackIndex.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthPackIndex.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "modplatform/ModIndex.h"
#include <QNetworkAccessManager>
#include "BaseInstance.h"
namespace Modrinth {
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadExtraPackData(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr, const BaseInstance* inst);
auto loadIndexedPackVersion(QJsonObject& obj, QString hash_type = "sha512", QString filename_prefer = "") -> ModPlatform::IndexedVersion;
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr, const BaseInstance* inst) -> ModPlatform::IndexedVersion;
} // namespace Modrinth
| 1,361
|
C++
|
.h
| 27
| 48.666667
| 137
| 0.78238
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,513
|
ModrinthPackExportTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthPackExportTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QFuture>
#include <QFutureWatcher>
#include "BaseInstance.h"
#include "MMCZip.h"
#include "minecraft/MinecraftInstance.h"
#include "modplatform/modrinth/ModrinthAPI.h"
#include "tasks/Task.h"
class ModrinthPackExportTask : public Task {
Q_OBJECT
public:
ModrinthPackExportTask(const QString& name,
const QString& version,
const QString& summary,
bool optionalFiles,
InstancePtr instance,
const QString& output,
MMCZip::FilterFunction filter);
protected:
void executeTask() override;
bool abort() override;
private:
struct ResolvedFile {
QString sha1, sha512, url;
qint64 size;
Metadata::ModSide side;
};
static const QStringList PREFIXES;
static const QStringList FILE_EXTENSIONS;
// inputs
const QString name, version, summary;
const bool optionalFiles;
const InstancePtr instance;
MinecraftInstance* mcInstance;
const QDir gameRoot;
const QString output;
const MMCZip::FilterFunction filter;
ModrinthAPI api;
QFileInfoList files;
QMap<QString, QString> pendingHashes;
QMap<QString, ResolvedFile> resolvedFiles;
Task::Ptr task;
void collectFiles();
void collectHashes();
void makeApiRequest();
void parseApiResponse(std::shared_ptr<QByteArray> response);
void buildZip();
QByteArray generateIndex();
};
| 2,282
|
C++
|
.h
| 66
| 28.606061
| 74
| 0.692656
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,514
|
ModrinthPackManifest.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthPackManifest.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
* Copyright 2022 kb1000
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QMetaType>
#include <QByteArray>
#include <QCryptographicHash>
#include <QQueue>
#include <QString>
#include <QUrl>
#include <QVector>
#include "modplatform/ModIndex.h"
class MinecraftInstance;
namespace Modrinth {
struct File {
QString path;
QCryptographicHash::Algorithm hashAlgorithm;
QByteArray hash;
QQueue<QUrl> downloads;
bool required = true;
};
struct DonationData {
QString id;
QString platform;
QString url;
};
struct ModpackExtra {
QString body;
QString projectUrl;
QString issuesUrl;
QString sourceUrl;
QString wikiUrl;
QString discordUrl;
QList<DonationData> donate;
QString status;
};
struct ModpackVersion {
QString name;
QString version;
QString gameVersion;
ModPlatform::IndexedVersionType version_type;
QString changelog;
ModPlatform::ModLoaderTypes loaders = {};
QString id;
QString project_id;
QString date;
QString download_url;
};
struct Modpack {
QString id;
QString name;
QString description;
std::tuple<QString, QUrl> author;
QString iconName;
QUrl iconUrl;
bool versionsLoaded = false;
bool extraInfoLoaded = false;
ModpackExtra extra;
QVector<ModpackVersion> versions;
};
void loadIndexedPack(Modpack&, QJsonObject&);
void loadIndexedInfo(Modpack&, QJsonObject&);
void loadIndexedVersions(Modpack&, QJsonDocument&);
auto loadIndexedVersion(QJsonObject&) -> ModpackVersion;
auto validateDownloadUrl(QUrl) -> bool;
} // namespace Modrinth
Q_DECLARE_METATYPE(Modrinth::Modpack)
Q_DECLARE_METATYPE(Modrinth::ModpackVersion)
| 3,158
|
C++
|
.h
| 100
| 28.55
| 80
| 0.744063
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,515
|
ModrinthAPI.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/modrinth/ModrinthAPI.h
|
// SPDX-FileCopyrightText: 2022-2023 flowln <flowlnlnln@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "BuildConfig.h"
#include "modplatform/ModIndex.h"
#include "modplatform/helpers/NetworkResourceAPI.h"
#include <QDebug>
class ModrinthAPI : public NetworkResourceAPI {
public:
auto currentVersion(QString hash, QString hash_format, std::shared_ptr<QByteArray> response) -> Task::Ptr;
auto currentVersions(const QStringList& hashes, QString hash_format, std::shared_ptr<QByteArray> response) -> Task::Ptr;
auto latestVersion(QString hash,
QString hash_format,
std::optional<std::list<Version>> mcVersions,
std::optional<ModPlatform::ModLoaderTypes> loaders,
std::shared_ptr<QByteArray> response) -> Task::Ptr;
auto latestVersions(const QStringList& hashes,
QString hash_format,
std::optional<std::list<Version>> mcVersions,
std::optional<ModPlatform::ModLoaderTypes> loaders,
std::shared_ptr<QByteArray> response) -> Task::Ptr;
Task::Ptr getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const override;
static Task::Ptr getModCategories(std::shared_ptr<QByteArray> response);
static QList<ModPlatform::Category> loadCategories(std::shared_ptr<QByteArray> response, QString projectType);
static QList<ModPlatform::Category> loadModCategories(std::shared_ptr<QByteArray> response);
public:
[[nodiscard]] auto getSortingMethods() const -> QList<ResourceAPI::SortingMethod> override;
inline auto getAuthorURL(const QString& name) const -> QString { return "https://modrinth.com/user/" + name; };
static auto getModLoaderStrings(const ModPlatform::ModLoaderTypes types) -> const QStringList
{
QStringList l;
for (auto loader :
{ ModPlatform::NeoForge, ModPlatform::Forge, ModPlatform::Fabric, ModPlatform::Quilt, ModPlatform::LiteLoader }) {
if (types & loader) {
l << getModLoaderAsString(loader);
}
}
return l;
}
static auto getModLoaderFilters(ModPlatform::ModLoaderTypes types) -> const QString
{
QStringList l;
for (auto loader : getModLoaderStrings(types)) {
l << QString("\"categories:%1\"").arg(loader);
}
return l.join(',');
}
static auto getCategoriesFilters(QStringList categories) -> const QString
{
QStringList l;
for (auto cat : categories) {
l << QString("\"categories:%1\"").arg(cat);
}
return l.join(',');
}
static auto getSideFilters(QString side) -> const QString
{
if (side.isEmpty() || side == "both") {
return {};
}
if (side == "client")
return QString("\"client_side:required\",\"client_side:optional\"");
if (side == "server")
return QString("\"server_side:required\",\"server_side:optional\"");
return {};
}
private:
[[nodiscard]] static QString resourceTypeParameter(ModPlatform::ResourceType type)
{
switch (type) {
case ModPlatform::ResourceType::MOD:
return "mod";
case ModPlatform::ResourceType::RESOURCE_PACK:
return "resourcepack";
case ModPlatform::ResourceType::SHADER_PACK:
return "shader";
case ModPlatform::ResourceType::MODPACK:
return "modpack";
default:
qWarning() << "Invalid resource type for Modrinth API!";
break;
}
return "";
}
[[nodiscard]] QString createFacets(SearchArgs const& args) const
{
QStringList facets_list;
if (args.loaders.has_value() && args.loaders.value() != 0)
facets_list.append(QString("[%1]").arg(getModLoaderFilters(args.loaders.value())));
if (args.versions.has_value() && !args.versions.value().empty())
facets_list.append(QString("[%1]").arg(getGameVersionsArray(args.versions.value())));
if (args.side.has_value()) {
auto side = getSideFilters(args.side.value());
if (!side.isEmpty())
facets_list.append(QString("[%1]").arg(side));
}
if (args.categoryIds.has_value() && !args.categoryIds->empty())
facets_list.append(QString("[%1]").arg(getCategoriesFilters(args.categoryIds.value())));
if (args.openSource)
facets_list.append("[\"open_source:true\"]");
facets_list.append(QString("[\"project_type:%1\"]").arg(resourceTypeParameter(args.type)));
return QString("[%1]").arg(facets_list.join(','));
}
public:
[[nodiscard]] inline auto getSearchURL(SearchArgs const& args) const -> std::optional<QString> override
{
if (args.loaders.has_value() && args.loaders.value() != 0) {
if (!validateModLoaders(args.loaders.value())) {
qWarning() << "Modrinth - or our interface - does not support any the provided mod loaders!";
return {};
}
}
QStringList get_arguments;
get_arguments.append(QString("offset=%1").arg(args.offset));
get_arguments.append(QString("limit=25"));
if (args.search.has_value())
get_arguments.append(QString("query=%1").arg(args.search.value()));
if (args.sorting.has_value())
get_arguments.append(QString("index=%1").arg(args.sorting.value().name));
get_arguments.append(QString("facets=%1").arg(createFacets(args)));
return BuildConfig.MODRINTH_PROD_URL + "/search?" + get_arguments.join('&');
};
inline auto getInfoURL(QString const& id) const -> std::optional<QString> override
{
return BuildConfig.MODRINTH_PROD_URL + "/project/" + id;
};
inline auto getMultipleModInfoURL(QStringList ids) const -> QString
{
return BuildConfig.MODRINTH_PROD_URL + QString("/projects?ids=[\"%1\"]").arg(ids.join("\",\""));
};
inline auto getVersionsURL(VersionSearchArgs const& args) const -> std::optional<QString> override
{
QStringList get_arguments;
if (args.mcVersions.has_value())
get_arguments.append(QString("game_versions=[%1]").arg(getGameVersionsString(args.mcVersions.value())));
if (args.loaders.has_value())
get_arguments.append(QString("loaders=[\"%1\"]").arg(getModLoaderStrings(args.loaders.value()).join("\",\"")));
return QString("%1/project/%2/version%3%4")
.arg(BuildConfig.MODRINTH_PROD_URL, args.pack.addonId.toString(), get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
};
QString getGameVersionsArray(std::list<Version> mcVersions) const
{
QString s;
for (auto& ver : mcVersions) {
s += QString("\"versions:%1\",").arg(ver.toString());
}
s.remove(s.length() - 1, 1); // remove last comma
return s.isEmpty() ? QString() : s;
}
static inline auto validateModLoaders(ModPlatform::ModLoaderTypes loaders) -> bool
{
return loaders & (ModPlatform::NeoForge | ModPlatform::Forge | ModPlatform::Fabric | ModPlatform::Quilt | ModPlatform::LiteLoader);
}
[[nodiscard]] std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override
{
return args.dependency.version.length() != 0 ? QString("%1/version/%2").arg(BuildConfig.MODRINTH_PROD_URL, args.dependency.version)
: QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]")
.arg(BuildConfig.MODRINTH_PROD_URL)
.arg(args.dependency.addonId.toString())
.arg(args.mcVersion.toString())
.arg(getModLoaderStrings(args.loader).join("\",\""));
};
};
| 8,194
|
C++
|
.h
| 164
| 39.152439
| 139
| 0.605576
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,516
|
Packwiz.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/packwiz/Packwiz.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "modplatform/ModIndex.h"
#include <QString>
#include <QUrl>
#include <QVariant>
class QDir;
// Mod from launcher/minecraft/mod/Mod.h
class Mod;
namespace Packwiz {
auto getRealIndexName(const QDir& index_dir, QString normalized_index_name, bool should_match = false) -> QString;
class V1 {
public:
enum class Side { ClientSide = 1 << 0, ServerSide = 1 << 1, UniversalSide = ClientSide | ServerSide };
// can also represent other resources beside loader mods - but this is what packwiz calls it
struct Mod {
QString slug{};
QString name{};
QString filename{};
Side side{ Side::UniversalSide };
ModPlatform::ModLoaderTypes loaders;
QStringList mcVersions;
ModPlatform::IndexedVersionType releaseType;
// [download]
QString mode{};
QUrl url{};
QString hash_format{};
QString hash{};
// [update]
ModPlatform::ResourceProvider provider{};
QVariant file_id{};
QVariant project_id{};
QString version_number{};
public:
// This is a totally heuristic, but should work for now.
auto isValid() const -> bool { return !slug.isEmpty() && !project_id.isNull(); }
// Different providers can use different names for the same thing
// Modrinth-specific
auto mod_id() -> QVariant& { return project_id; }
auto version() -> QVariant& { return file_id; }
};
/* Generates the object representing the information in a mod.pw.toml file via
* its common representation in the launcher, when downloading mods.
* */
static auto createModFormat(const QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> Mod;
/* Generates the object representing the information in a mod.pw.toml file via
* its common representation in the launcher, plus a necessary slug.
* */
static auto createModFormat(const QDir& index_dir, ::Mod& internal_mod, QString slug) -> Mod;
/* Updates the mod index for the provided mod.
* This creates a new index if one does not exist already
* TODO: Ask the user if they want to override, and delete the old mod's files, or keep the old one.
* */
static void updateModIndex(const QDir& index_dir, Mod& mod);
/* Deletes the metadata for the mod with the given slug. If the metadata doesn't exist, it does nothing. */
static void deleteModIndex(const QDir& index_dir, QString& mod_slug);
/* Deletes the metadata for the mod with the given id. If the metadata doesn't exist, it does nothing. */
static void deleteModIndex(const QDir& index_dir, QVariant& mod_id);
/* Gets the metadata for a mod with a particular file name.
* If the mod doesn't have a metadata, it simply returns an empty Mod object.
* */
static auto getIndexForMod(const QDir& index_dir, QString slug) -> Mod;
/* Gets the metadata for a mod with a particular id.
* If the mod doesn't have a metadata, it simply returns an empty Mod object.
* */
static auto getIndexForMod(const QDir& index_dir, QVariant& mod_id) -> Mod;
static auto sideToString(Side side) -> QString;
static auto stringToSide(QString side) -> Side;
};
} // namespace Packwiz
| 4,113
|
C++
|
.h
| 87
| 42.068966
| 140
| 0.697878
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,517
|
ATLPackInstallTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/atlauncher/ATLPackInstallTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright 2021 Petr Mrazek <peterix@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <meta/VersionList.h>
#include "ATLPackManifest.h"
#include "InstanceTask.h"
#include "meta/Version.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "net/NetJob.h"
#include "settings/INISettingsObject.h"
#include <memory>
#include <optional>
namespace ATLauncher {
enum class InstallMode {
Install,
Reinstall,
Update,
};
class UserInteractionSupport {
public:
/**
* Requests a user interaction to select which optional mods should be installed.
*/
virtual std::optional<QVector<QString>> chooseOptionalMods(PackVersion version, QVector<ATLauncher::VersionMod> mods) = 0;
/**
* Requests a user interaction to select a component version from a given version list
* and constrained to a given Minecraft version.
*/
virtual QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) = 0;
/**
* Requests a user interaction to display a message.
*/
virtual void displayMessage(QString message) = 0;
virtual ~UserInteractionSupport() = default;
};
class PackInstallTask : public InstanceTask {
Q_OBJECT
public:
explicit PackInstallTask(UserInteractionSupport* support,
QString packName,
QString version,
InstallMode installMode = InstallMode::Install);
virtual ~PackInstallTask() { delete m_support; }
bool canAbort() const override { return true; }
bool abort() override;
protected:
virtual void executeTask() override;
private slots:
void onDownloadSucceeded();
void onDownloadFailed(QString reason);
void onDownloadAborted();
void onModsDownloaded();
void onModsExtracted();
private:
QString getDirForModType(ModType type, QString raw);
QString getVersionForLoader(QString uid);
QString detectLibrary(VersionLibrary library);
bool createLibrariesComponent(QString instanceRoot, std::shared_ptr<PackProfile> profile);
bool createPackComponent(QString instanceRoot, std::shared_ptr<PackProfile> profile);
void deleteExistingFiles();
void installConfigs();
void extractConfigs();
void downloadMods();
bool extractMods(const QMap<QString, VersionMod>& toExtract,
const QMap<QString, VersionMod>& toDecomp,
const QMap<QString, QString>& toCopy);
void install();
private:
UserInteractionSupport* m_support;
bool abortable = false;
NetJob::Ptr jobPtr;
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
InstallMode m_install_mode;
QString m_pack_name;
QString m_pack_safe_name;
QString m_version_name;
PackVersion m_version;
QMap<QString, VersionMod> modsToExtract;
QMap<QString, VersionMod> modsToDecomp;
QMap<QString, QString> modsToCopy;
QString archivePath;
QStringList jarmods;
Meta::Version::Ptr minecraftVersion;
QMap<QString, Meta::Version::Ptr> componentsToInstall;
QFuture<std::optional<QStringList>> m_extractFuture;
QFutureWatcher<std::optional<QStringList>> m_extractFutureWatcher;
QFuture<bool> m_modExtractFuture;
QFutureWatcher<bool> m_modExtractFutureWatcher;
};
} // namespace ATLauncher
| 4,887
|
C++
|
.h
| 124
| 34.774194
| 126
| 0.726294
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,518
|
ATLPackManifest.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/atlauncher/ATLPackManifest.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2020 Jamie Mansfield <jmansfield@cadixdev.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QJsonObject>
#include <QMap>
#include <QString>
#include <QVector>
namespace ATLauncher {
enum class PackType { Public, Private };
enum class ModType {
Root,
Forge,
Jar,
Mods,
Flan,
Dependency,
Ic2Lib,
DenLib,
Coremods,
MCPC,
Plugins,
Extract,
Decomp,
TexturePack,
ResourcePack,
ShaderPack,
TexturePackExtract,
ResourcePackExtract,
Millenaire,
Unknown
};
enum class DownloadType { Server, Browser, Direct, Unknown };
struct VersionLoader {
QString type;
bool latest;
bool recommended;
bool choose;
QString version;
};
struct VersionLibrary {
QString url;
QString file;
QString server;
QString md5;
DownloadType download;
QString download_raw;
};
struct VersionMod {
QString name;
QString version;
QString url;
QString file;
QString md5;
DownloadType download;
QString download_raw;
ModType type;
QString type_raw;
ModType extractTo;
QString extractTo_raw;
QString extractFolder;
ModType decompType;
QString decompType_raw;
QString decompFile;
QString description;
bool optional;
bool recommended;
bool selected;
bool hidden;
bool library;
QString group;
QVector<QString> depends;
QString colour;
QString warning;
bool client;
// computed
bool effectively_hidden;
};
struct VersionConfigs {
int filesize;
QString sha1;
};
struct VersionMessages {
QString install;
QString update;
};
struct VersionKeep {
QString base;
QString target;
};
struct VersionKeeps {
QVector<VersionKeep> files;
QVector<VersionKeep> folders;
};
struct VersionDelete {
QString base;
QString target;
};
struct VersionDeletes {
QVector<VersionDelete> files;
QVector<VersionDelete> folders;
};
struct PackVersionMainClass {
QString mainClass;
QString depends;
};
struct PackVersionExtraArguments {
QString arguments;
QString depends;
};
struct PackVersion {
QString version;
QString minecraft;
bool noConfigs;
PackVersionMainClass mainClass;
PackVersionExtraArguments extraArguments;
VersionLoader loader;
QVector<VersionLibrary> libraries;
QVector<VersionMod> mods;
VersionConfigs configs;
QMap<QString, QString> colours;
QMap<QString, QString> warnings;
VersionMessages messages;
VersionKeeps keeps;
VersionDeletes deletes;
};
void loadVersion(PackVersion& v, QJsonObject& obj);
} // namespace ATLauncher
| 4,100
|
C++
|
.h
| 159
| 22.163522
| 80
| 0.728016
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,519
|
ATLShareCode.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/atlauncher/ATLShareCode.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QJsonObject>
#include <QString>
#include <QVector>
namespace ATLauncher {
struct ShareCodeMod {
bool selected;
QString name;
};
struct ShareCode {
QString pack;
QString version;
QVector<ShareCodeMod> mods;
};
struct ShareCodeResponse {
bool error;
int code;
QString message;
ShareCode data;
};
void loadShareCodeResponse(ShareCodeResponse& r, QJsonObject& obj);
} // namespace ATLauncher
| 1,204
|
C++
|
.h
| 39
| 28.358974
| 74
| 0.751945
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,520
|
ATLPackIndex.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/atlauncher/ATLPackIndex.h
|
/*
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "ATLPackManifest.h"
#include <QMetaType>
#include <QString>
#include <QVector>
namespace ATLauncher {
struct IndexedVersion {
QString version;
QString minecraft;
};
struct IndexedPack {
int id;
int position;
QString name;
PackType type;
QVector<IndexedVersion> versions;
bool system;
QString description;
QString safeName;
};
void loadIndexedPack(IndexedPack& m, QJsonObject& obj);
} // namespace ATLauncher
Q_DECLARE_METATYPE(ATLauncher::IndexedPack)
| 1,154
|
C++
|
.h
| 38
| 27.710526
| 75
| 0.761518
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,521
|
NetworkResourceAPI.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/helpers/NetworkResourceAPI.h
|
// SPDX-FileCopyrightText: 2023 flowln <flowlnlnln@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <memory>
#include "modplatform/ResourceAPI.h"
class NetworkResourceAPI : public ResourceAPI {
public:
Task::Ptr searchProjects(SearchArgs&&, SearchCallbacks&&) const override;
Task::Ptr getProject(QString addonId, std::shared_ptr<QByteArray> response) const override;
Task::Ptr getProjectInfo(ProjectInfoArgs&&, ProjectInfoCallbacks&&) const override;
Task::Ptr getProjectVersions(VersionSearchArgs&&, VersionSearchCallbacks&&) const override;
Task::Ptr getDependencyVersion(DependencySearchArgs&&, DependencySearchCallbacks&&) const override;
protected:
[[nodiscard]] virtual auto getSearchURL(SearchArgs const& args) const -> std::optional<QString> = 0;
[[nodiscard]] virtual auto getInfoURL(QString const& id) const -> std::optional<QString> = 0;
[[nodiscard]] virtual auto getVersionsURL(VersionSearchArgs const& args) const -> std::optional<QString> = 0;
[[nodiscard]] virtual auto getDependencyURL(DependencySearchArgs const& args) const -> std::optional<QString> = 0;
};
| 1,154
|
C++
|
.h
| 19
| 57.210526
| 118
| 0.767936
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,522
|
HashUtils.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/helpers/HashUtils.h
|
#pragma once
#include <QCryptographicHash>
#include <QFuture>
#include <QFutureWatcher>
#include <QString>
#include "modplatform/ModIndex.h"
#include "tasks/Task.h"
namespace Hashing {
enum class Algorithm { Md4, Md5, Sha1, Sha256, Sha512, Murmur2, Unknown };
QString algorithmToString(Algorithm type);
Algorithm algorithmFromString(QString type);
QString hash(QIODevice* device, Algorithm type);
QString hash(QString fileName, Algorithm type);
QString hash(QByteArray data, Algorithm type);
class Hasher : public Task {
Q_OBJECT
public:
using Ptr = shared_qobject_ptr<Hasher>;
Hasher(QString file_path, Algorithm alg) : m_path(file_path), m_alg(alg) {}
Hasher(QString file_path, QString alg) : Hasher(file_path, algorithmFromString(alg)) {}
bool abort() override;
void executeTask() override;
QString getResult() const { return m_result; };
QString getPath() const { return m_path; };
signals:
void resultsReady(QString hash);
private:
QString m_result;
QString m_path;
Algorithm m_alg;
QFuture<QString> m_future;
QFutureWatcher<QString> m_watcher;
};
Hasher::Ptr createHasher(QString file_path, ModPlatform::ResourceProvider provider);
Hasher::Ptr createHasher(QString file_path, QString type);
} // namespace Hashing
| 1,301
|
C++
|
.h
| 36
| 32.916667
| 91
| 0.7536
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,523
|
ExportToModList.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/helpers/ExportToModList.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QList>
#include <QString>
#include "minecraft/mod/Mod.h"
namespace ExportToModList {
enum Formats { HTML, MARKDOWN, PLAINTXT, JSON, CSV, CUSTOM };
enum OptionalData { Authors = 1 << 0, Url = 1 << 1, Version = 1 << 2, FileName = 1 << 3 };
QString exportToModList(QList<Mod*> mods, Formats format, OptionalData extraData);
QString exportToModList(QList<Mod*> mods, QString lineTemplate);
} // namespace ExportToModList
| 1,188
|
C++
|
.h
| 27
| 42.37037
| 90
| 0.748059
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,524
|
OverrideUtils.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/helpers/OverrideUtils.h
|
#pragma once
#include <QString>
namespace Override {
/** This creates a file in `parent_folder` that holds information about which
* overrides are in `override_path`.
*
* If there's already an existing such file, it will be ovewritten.
*/
void createOverrides(const QString& name, const QString& parent_folder, const QString& override_path);
/** This reads an existing overrides archive, returning a list of overrides.
*
* If there's no such file in `parent_folder`, it will return an empty list.
*/
QStringList readOverrides(const QString& name, const QString& parent_folder);
} // namespace Override
| 618
|
C++
|
.h
| 15
| 39.4
| 102
| 0.764214
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,525
|
FlameInstanceCreationTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlameInstanceCreationTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "InstanceCreationTask.h"
#include <optional>
#include "minecraft/MinecraftInstance.h"
#include "modplatform/flame/FileResolvingTask.h"
#include "net/NetJob.h"
#include "ui/dialogs/BlockedModsDialog.h"
class FlameCreationTask final : public InstanceCreationTask {
Q_OBJECT
public:
FlameCreationTask(const QString& staging_path,
SettingsObjectPtr global_settings,
QWidget* parent,
QString id,
QString version_id,
QString original_instance_id = {})
: InstanceCreationTask(), m_parent(parent), m_managed_id(std::move(id)), m_managed_version_id(std::move(version_id))
{
setStagingPath(staging_path);
setParentSettings(global_settings);
m_original_instance_id = std::move(original_instance_id);
}
bool abort() override;
bool updateInstance() override;
bool createInstance() override;
private slots:
void idResolverSucceeded(QEventLoop&);
void setupDownloadJob(QEventLoop&);
void copyBlockedMods(QList<BlockedMod> const& blocked_mods);
void validateZIPResources(QEventLoop& loop);
QString getVersionForLoader(QString uid, QString loaderType, QString version, QString mcVersion);
private:
QWidget* m_parent = nullptr;
shared_qobject_ptr<Flame::FileResolvingTask> m_mod_id_resolver;
Flame::Manifest m_pack;
// Handle to allow aborting
Task::Ptr m_process_update_file_info_job = nullptr;
NetJob::Ptr m_files_job = nullptr;
QString m_managed_id, m_managed_version_id;
QList<std::pair<QString, QString>> m_ZIP_resources;
std::optional<InstancePtr> m_instance;
};
| 3,220
|
C++
|
.h
| 76
| 37.605263
| 124
| 0.7152
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,526
|
FlameCheckUpdate.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlameCheckUpdate.h
|
#pragma once
#include "Application.h"
#include "modplatform/CheckUpdateTask.h"
#include "net/NetJob.h"
class FlameCheckUpdate : public CheckUpdateTask {
Q_OBJECT
public:
FlameCheckUpdate(QList<Resource*>& resources,
std::list<Version>& mcVersions,
QList<ModPlatform::ModLoaderType> loadersList,
std::shared_ptr<ResourceFolderModel> resourceModel)
: CheckUpdateTask(resources, mcVersions, std::move(loadersList), std::move(resourceModel))
{}
public slots:
bool abort() override;
protected slots:
void executeTask() override;
private:
ModPlatform::IndexedPack getProjectInfo(ModPlatform::IndexedVersion& ver_info);
ModPlatform::IndexedVersion getFileInfo(int addonId, int fileId);
NetJob* m_net_job = nullptr;
bool m_was_aborted = false;
};
| 866
|
C++
|
.h
| 23
| 31.130435
| 98
| 0.704192
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,527
|
PackManifest.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/PackManifest.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QJsonObject>
#include <QMap>
#include <QString>
#include <QUrl>
#include <QVector>
#include "modplatform/ModIndex.h"
namespace Flame {
struct File {
int projectId = 0;
int fileId = 0;
// NOTE: the opposite to 'optional'
bool required = true;
ModPlatform::IndexedPack pack;
ModPlatform::IndexedVersion version;
// our
QString targetFolder = QStringLiteral("mods");
};
struct Modloader {
QString id;
bool primary = false;
};
struct Minecraft {
QString version;
QString libraries;
QVector<Flame::Modloader> modLoaders;
};
struct Manifest {
QString manifestType;
int manifestVersion = 0;
Flame::Minecraft minecraft;
QString name;
QString version;
QString author;
// File id -> File
QMap<int, Flame::File> files;
QString overrides;
bool is_loaded = false;
};
void loadManifest(Flame::Manifest& m, const QString& filepath);
} // namespace Flame
| 2,458
|
C++
|
.h
| 75
| 29.986667
| 80
| 0.723557
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,528
|
FlameModIndex.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlameModIndex.h
|
//
// Created by timoreo on 16/01/2022.
//
#pragma once
#include "modplatform/ModIndex.h"
#include <QNetworkAccessManager>
#include "BaseInstance.h"
namespace FlameMod {
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadURLs(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadBody(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
const BaseInstance* inst);
auto loadIndexedPackVersion(QJsonObject& obj, bool load_changelog = false) -> ModPlatform::IndexedVersion;
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr, const BaseInstance* inst) -> ModPlatform::IndexedVersion;
} // namespace FlameMod
| 886
|
C++
|
.h
| 18
| 43.166667
| 136
| 0.733796
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,529
|
FlamePackIndex.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlamePackIndex.h
|
#pragma once
#include <QList>
#include <QMetaType>
#include <QString>
#include <QVector>
#include "modplatform/ModIndex.h"
namespace Flame {
struct ModpackAuthor {
QString name;
QString url;
};
struct IndexedVersion {
int addonId;
int fileId;
QString version;
ModPlatform::IndexedVersionType version_type;
ModPlatform::ModLoaderTypes loaders = {};
QString mcVersion;
QString downloadUrl;
};
struct ModpackExtra {
QString websiteUrl;
QString wikiUrl;
QString issuesUrl;
QString sourceUrl;
};
struct IndexedPack {
int addonId;
QString name;
QString description;
QList<ModpackAuthor> authors;
QString logoName;
QString logoUrl;
bool versionsLoaded = false;
QVector<IndexedVersion> versions;
bool extraInfoLoaded = false;
ModpackExtra extra;
};
void loadIndexedPack(IndexedPack& m, QJsonObject& obj);
void loadIndexedInfo(IndexedPack&, QJsonObject&);
void loadIndexedPackVersions(IndexedPack& m, QJsonArray& arr);
} // namespace Flame
Q_DECLARE_METATYPE(Flame::IndexedPack)
| 1,073
|
C++
|
.h
| 43
| 21.581395
| 62
| 0.758824
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,530
|
FileResolvingTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FileResolvingTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2024 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QNetworkAccessManager>
#include "PackManifest.h"
#include "tasks/Task.h"
namespace Flame {
class FileResolvingTask : public Task {
Q_OBJECT
public:
explicit FileResolvingTask(const shared_qobject_ptr<QNetworkAccessManager>& network, Flame::Manifest& toProcess);
virtual ~FileResolvingTask() = default;
bool canAbort() const override { return true; }
bool abort() override;
const Flame::Manifest& getResults() const { return m_manifest; }
protected:
virtual void executeTask() override;
protected slots:
void netJobFinished();
private:
void getFlameProjects();
private: /* data */
shared_qobject_ptr<QNetworkAccessManager> m_network;
Flame::Manifest m_manifest;
std::shared_ptr<QByteArray> m_result;
Task::Ptr m_task;
};
} // namespace Flame
| 1,586
|
C++
|
.h
| 43
| 33.767442
| 117
| 0.741851
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,531
|
FlameAPI.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlameAPI.h
|
// SPDX-FileCopyrightText: 2023 flowln <flowlnlnln@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <QList>
#include <memory>
#include "modplatform/ModIndex.h"
#include "modplatform/ResourceAPI.h"
#include "modplatform/helpers/NetworkResourceAPI.h"
class FlameAPI : public NetworkResourceAPI {
public:
QString getModFileChangelog(int modId, int fileId);
QString getModDescription(int modId);
QList<ModPlatform::IndexedVersion> getLatestVersions(VersionSearchArgs&& args);
std::optional<ModPlatform::IndexedVersion> getLatestVersion(QList<ModPlatform::IndexedVersion> versions,
QList<ModPlatform::ModLoaderType> instanceLoaders,
ModPlatform::ModLoaderTypes fallback);
Task::Ptr getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const override;
Task::Ptr matchFingerprints(const QList<uint>& fingerprints, std::shared_ptr<QByteArray> response);
Task::Ptr getFiles(const QStringList& fileIds, std::shared_ptr<QByteArray> response) const;
Task::Ptr getFile(const QString& addonId, const QString& fileId, std::shared_ptr<QByteArray> response) const;
static Task::Ptr getCategories(std::shared_ptr<QByteArray> response, ModPlatform::ResourceType type);
static Task::Ptr getModCategories(std::shared_ptr<QByteArray> response);
static QList<ModPlatform::Category> loadModCategories(std::shared_ptr<QByteArray> response);
[[nodiscard]] QList<ResourceAPI::SortingMethod> getSortingMethods() const override;
static inline bool validateModLoaders(ModPlatform::ModLoaderTypes loaders)
{
return loaders & (ModPlatform::NeoForge | ModPlatform::Forge | ModPlatform::Fabric | ModPlatform::Quilt);
}
private:
static int getClassId(ModPlatform::ResourceType type)
{
switch (type) {
default:
case ModPlatform::ResourceType::MOD:
return 6;
case ModPlatform::ResourceType::RESOURCE_PACK:
return 12;
case ModPlatform::ResourceType::SHADER_PACK:
return 6552;
case ModPlatform::ResourceType::MODPACK:
return 4471;
}
}
static int getMappedModLoader(ModPlatform::ModLoaderType loaders)
{
// https://docs.curseforge.com/?http#tocS_ModLoaderType
switch (loaders) {
case ModPlatform::Forge:
return 1;
case ModPlatform::Cauldron:
return 2;
case ModPlatform::LiteLoader:
return 3;
case ModPlatform::Fabric:
return 4;
case ModPlatform::Quilt:
return 5;
case ModPlatform::NeoForge:
return 6;
}
return 0;
}
static const QStringList getModLoaderStrings(const ModPlatform::ModLoaderTypes types)
{
QStringList l;
for (auto loader : { ModPlatform::NeoForge, ModPlatform::Forge, ModPlatform::Fabric, ModPlatform::Quilt }) {
if (types & loader) {
l << QString::number(getMappedModLoader(loader));
}
}
return l;
}
static const QString getModLoaderFilters(ModPlatform::ModLoaderTypes types) { return "[" + getModLoaderStrings(types).join(',') + "]"; }
public:
[[nodiscard]] std::optional<QString> getSearchURL(SearchArgs const& args) const override
{
QStringList get_arguments;
get_arguments.append(QString("classId=%1").arg(getClassId(args.type)));
get_arguments.append(QString("index=%1").arg(args.offset));
get_arguments.append("pageSize=25");
if (args.search.has_value())
get_arguments.append(QString("searchFilter=%1").arg(args.search.value()));
if (args.sorting.has_value())
get_arguments.append(QString("sortField=%1").arg(args.sorting.value().index));
get_arguments.append("sortOrder=desc");
if (args.loaders.has_value() && args.loaders.value() != 0)
get_arguments.append(QString("modLoaderTypes=%1").arg(getModLoaderFilters(args.loaders.value())));
if (args.categoryIds.has_value() && !args.categoryIds->empty())
get_arguments.append(QString("categoryIds=[%1]").arg(args.categoryIds->join(",")));
if (args.versions.has_value() && !args.versions.value().empty())
get_arguments.append(QString("gameVersion=%1").arg(args.versions.value().front().toString()));
return "https://api.curseforge.com/v1/mods/search?gameId=432&" + get_arguments.join('&');
}
private:
[[nodiscard]] std::optional<QString> getInfoURL(QString const& id) const override
{
return QString("https://api.curseforge.com/v1/mods/%1").arg(id);
}
[[nodiscard]] std::optional<QString> getVersionsURL(VersionSearchArgs const& args) const override
{
auto addonId = args.pack.addonId.toString();
QString url = QString("https://api.curseforge.com/v1/mods/%1/files?pageSize=10000").arg(addonId);
if (args.mcVersions.has_value())
url += QString("&gameVersion=%1").arg(args.mcVersions.value().front().toString());
if (args.loaders.has_value() && ModPlatform::hasSingleModLoaderSelected(args.loaders.value())) {
int mappedModLoader = getMappedModLoader(static_cast<ModPlatform::ModLoaderType>(static_cast<int>(args.loaders.value())));
url += QString("&modLoaderType=%1").arg(mappedModLoader);
}
return url;
}
[[nodiscard]] std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override
{
auto addonId = args.dependency.addonId.toString();
auto url =
QString("https://api.curseforge.com/v1/mods/%1/files?pageSize=10000&gameVersion=%2").arg(addonId, args.mcVersion.toString());
if (args.loader && ModPlatform::hasSingleModLoaderSelected(args.loader)) {
int mappedModLoader = getMappedModLoader(static_cast<ModPlatform::ModLoaderType>(static_cast<int>(args.loader)));
url += QString("&modLoaderType=%1").arg(mappedModLoader);
}
return url;
}
};
| 6,281
|
C++
|
.h
| 123
| 41.577236
| 140
| 0.658195
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,532
|
FlamePackExportTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/flame/FlamePackExportTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "BaseInstance.h"
#include "MMCZip.h"
#include "minecraft/MinecraftInstance.h"
#include "modplatform/flame/FlameAPI.h"
#include "tasks/Task.h"
class FlamePackExportTask : public Task {
Q_OBJECT
public:
FlamePackExportTask(const QString& name,
const QString& version,
const QString& author,
bool optionalFiles,
InstancePtr instance,
const QString& output,
MMCZip::FilterFunction filter);
protected:
void executeTask() override;
bool abort() override;
private:
static const QString TEMPLATE;
static const QStringList FILE_EXTENSIONS;
// inputs
const QString name, version, author;
const bool optionalFiles;
const InstancePtr instance;
MinecraftInstance* mcInstance;
const QDir gameRoot;
const QString output;
const MMCZip::FilterFunction filter;
struct ResolvedFile {
int addonId;
int version;
bool enabled;
bool isMod;
QString name;
QString slug;
QString authors;
};
struct HashInfo {
QString name;
QString path;
bool enabled;
bool isMod;
};
FlameAPI api;
QFileInfoList files;
QMap<QString, HashInfo> pendingHashes{};
QMap<QString, ResolvedFile> resolvedFiles{};
Task::Ptr task;
void collectFiles();
void collectHashes();
void makeApiRequest();
void getProjectsInfo();
void buildZip();
QByteArray generateIndex();
QByteArray generateHTML();
};
| 2,441
|
C++
|
.h
| 76
| 26
| 74
| 0.677008
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,533
|
PackInstallTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/legacy_ftb/PackInstallTask.h
|
#pragma once
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#include "InstanceTask.h"
#include "PackHelpers.h"
#include "meta/Index.h"
#include "meta/Version.h"
#include "meta/VersionList.h"
#include "net/NetJob.h"
#include "net/NetJob.h"
#include <optional>
namespace LegacyFTB {
class PackInstallTask : public InstanceTask {
Q_OBJECT
public:
explicit PackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, Modpack pack, QString version);
virtual ~PackInstallTask() {}
bool canAbort() const override { return true; }
bool abort() override;
protected:
//! Entry point for tasks.
virtual void executeTask() override;
private:
void downloadPack();
void unzip();
void install();
private slots:
void onUnzipFinished();
void onUnzipCanceled();
private: /* data */
shared_qobject_ptr<QNetworkAccessManager> m_network;
bool abortable = false;
std::unique_ptr<QuaZip> m_packZip;
QFuture<std::optional<QStringList>> m_extractFuture;
QFutureWatcher<std::optional<QStringList>> m_extractFutureWatcher;
NetJob::Ptr netJobContainer;
QString archivePath;
Modpack m_pack;
QString m_version;
};
} // namespace LegacyFTB
| 1,239
|
C++
|
.h
| 41
| 26.487805
| 111
| 0.735865
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,534
|
PrivatePackManager.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/legacy_ftb/PrivatePackManager.h
|
#pragma once
#include <QFile>
#include <QSet>
#include <QString>
namespace LegacyFTB {
class PrivatePackManager {
public:
~PrivatePackManager() { save(); }
void load();
void save() const;
bool empty() const { return currentPacks.empty(); }
const QSet<QString>& getCurrentPackCodes() const { return currentPacks; }
void add(const QString& code)
{
currentPacks.insert(code);
dirty = true;
}
void remove(const QString& code)
{
currentPacks.remove(code);
dirty = true;
}
private:
QSet<QString> currentPacks;
QString m_filename = "private_packs.txt";
mutable bool dirty = false;
};
} // namespace LegacyFTB
| 702
|
C++
|
.h
| 28
| 20.535714
| 77
| 0.662182
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,535
|
PackFetchTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/legacy_ftb/PackFetchTask.h
|
#pragma once
#include <QByteArray>
#include <QObject>
#include <QTemporaryDir>
#include <memory>
#include "PackHelpers.h"
#include "net/NetJob.h"
namespace LegacyFTB {
class PackFetchTask : public QObject {
Q_OBJECT
public:
PackFetchTask(shared_qobject_ptr<QNetworkAccessManager> network) : QObject(nullptr), m_network(network) {};
virtual ~PackFetchTask() = default;
void fetch();
void fetchPrivate(const QStringList& toFetch);
private:
shared_qobject_ptr<QNetworkAccessManager> m_network;
NetJob::Ptr jobPtr;
std::shared_ptr<QByteArray> publicModpacksXmlFileData = std::make_shared<QByteArray>();
std::shared_ptr<QByteArray> thirdPartyModpacksXmlFileData = std::make_shared<QByteArray>();
bool parseAndAddPacks(QByteArray& data, PackType packType, ModpackList& list);
ModpackList publicPacks;
ModpackList thirdPartyPacks;
protected slots:
void fileDownloadFinished();
void fileDownloadFailed(QString reason);
void fileDownloadAborted();
signals:
void finished(ModpackList publicPacks, ModpackList thirdPartyPacks);
void failed(QString reason);
void aborted();
void privateFileDownloadFinished(Modpack modpack);
void privateFileDownloadFailed(QString reason, QString packCode);
};
} // namespace LegacyFTB
| 1,312
|
C++
|
.h
| 35
| 33.514286
| 111
| 0.76996
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,536
|
PackHelpers.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/legacy_ftb/PackHelpers.h
|
#pragma once
#include <QList>
#include <QMetaType>
#include <QString>
#include <QStringList>
namespace LegacyFTB {
// Header for structs etc...
enum class PackType { Public, ThirdParty, Private };
struct Modpack {
QString name;
QString description;
QString author;
QStringList oldVersions;
QString currentVersion;
QString mcVersion;
QString mods;
QString logo;
// Technical data
QString dir;
QString file; //<- Url in the xml, but doesn't make much sense
bool bugged = false;
bool broken = false;
PackType type;
QString packCode;
};
using ModpackList = QList<Modpack>;
} // namespace LegacyFTB
// We need it for the proxy model
Q_DECLARE_METATYPE(LegacyFTB::Modpack)
| 739
|
C++
|
.h
| 29
| 22.068966
| 67
| 0.727143
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,537
|
PackInstallTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/import_ftb/PackInstallTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QFuture>
#include <QFutureWatcher>
#include "InstanceTask.h"
#include "PackHelpers.h"
namespace FTBImportAPP {
class PackInstallTask : public InstanceTask {
Q_OBJECT
public:
explicit PackInstallTask(const Modpack& pack) : m_pack(pack) {}
virtual ~PackInstallTask() = default;
protected:
virtual void executeTask() override;
private slots:
void copySettings();
private:
QFuture<bool> m_copyFuture;
QFutureWatcher<bool> m_copyFutureWatcher;
const Modpack m_pack;
};
} // namespace FTBImportAPP
| 1,316
|
C++
|
.h
| 38
| 31.789474
| 74
| 0.749013
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,538
|
PackHelpers.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/import_ftb/PackHelpers.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QIcon>
#include <QList>
#include <QMetaType>
#include <QString>
#include <QVariant>
#include "modplatform/ResourceAPI.h"
namespace FTBImportAPP {
struct Modpack {
QString path;
// json data
QString uuid;
int id;
int versionId;
QString name;
QString version;
QString mcVersion;
int totalPlayTime;
// not needed for instance creation
QVariant jvmArgs;
std::optional<ModPlatform::ModLoaderType> loaderType;
QString loaderVersion;
QIcon icon;
};
using ModpackList = QList<Modpack>;
Modpack parseDirectory(QString path);
} // namespace FTBImportAPP
// We need it for the proxy model
Q_DECLARE_METATYPE(FTBImportAPP::Modpack)
| 1,455
|
C++
|
.h
| 46
| 28.869565
| 74
| 0.750536
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,539
|
SingleZipPackInstallTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/technic/SingleZipPackInstallTask.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "InstanceTask.h"
#include "net/NetJob.h"
#include <quazip/quazip.h>
#include <QFutureWatcher>
#include <QStringList>
#include <QUrl>
#include <optional>
namespace Technic {
class SingleZipPackInstallTask : public InstanceTask {
Q_OBJECT
public:
SingleZipPackInstallTask(const QUrl& sourceUrl, const QString& minecraftVersion);
bool canAbort() const override { return true; }
bool abort() override;
protected:
void executeTask() override;
private slots:
void downloadSucceeded();
void downloadFailed(QString reason);
void downloadProgressChanged(qint64 current, qint64 total);
void extractFinished();
void extractAborted();
private:
bool m_abortable = false;
QUrl m_sourceUrl;
QString m_minecraftVersion;
QString m_archivePath;
NetJob::Ptr m_filesNetJob;
std::unique_ptr<QuaZip> m_packZip;
QFuture<std::optional<QStringList>> m_extractFuture;
QFutureWatcher<std::optional<QStringList>> m_extractFutureWatcher;
};
} // namespace Technic
| 1,662
|
C++
|
.h
| 48
| 31.3125
| 85
| 0.7575
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,540
|
SolderPackManifest.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/technic/SolderPackManifest.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QJsonObject>
#include <QString>
#include <QVector>
namespace TechnicSolder {
struct Pack {
QString recommended;
QString latest;
QVector<QString> builds;
};
void loadPack(Pack& v, QJsonObject& obj);
struct PackBuildMod {
QString name;
QString version;
QString md5;
QString url;
};
struct PackBuild {
QString minecraft;
QVector<PackBuildMod> mods;
};
void loadPackBuild(PackBuild& v, QJsonObject& obj);
} // namespace TechnicSolder
| 1,247
|
C++
|
.h
| 40
| 28.675
| 74
| 0.750417
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,541
|
TechnicPackProcessor.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/technic/TechnicPackProcessor.h
|
/* Copyright 2020-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QString>
#include "settings/SettingsObject.h"
namespace Technic {
// not exporting it, only used in SingleZipPackInstallTask, InstanceImportTask and SolderPackInstallTask
class TechnicPackProcessor : public QObject {
Q_OBJECT
signals:
void succeeded();
void failed(QString reason);
public:
void run(SettingsObjectPtr globalSettings,
const QString& instName,
const QString& instIcon,
const QString& stagingPath,
const QString& minecraftVersion = QString(),
bool isSolder = false);
};
} // namespace Technic
| 1,228
|
C++
|
.h
| 33
| 33.030303
| 104
| 0.735294
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,542
|
SolderPackInstallTask.h
|
PrismLauncher_PrismLauncher/launcher/modplatform/technic/SolderPackInstallTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2021-2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <InstanceTask.h>
#include <net/NetJob.h>
#include <tasks/Task.h>
#include <QUrl>
#include <memory>
namespace Technic {
class SolderPackInstallTask : public InstanceTask {
Q_OBJECT
public:
explicit SolderPackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network,
const QUrl& solderUrl,
const QString& pack,
const QString& version,
const QString& minecraftVersion);
bool canAbort() const override { return true; }
bool abort() override;
protected:
//! Entry point for tasks.
virtual void executeTask() override;
private slots:
void fileListSucceeded();
void downloadSucceeded();
void downloadFailed(QString reason);
void downloadProgressChanged(qint64 current, qint64 total);
void downloadAborted();
void extractFinished();
void extractAborted();
private:
bool m_abortable = false;
shared_qobject_ptr<QNetworkAccessManager> m_network;
NetJob::Ptr m_filesNetJob;
QUrl m_solderUrl;
QString m_pack;
QString m_version;
QString m_minecraftVersion;
std::shared_ptr<QByteArray> m_response = std::make_shared<QByteArray>();
QTemporaryDir m_outputDir;
int m_modCount;
QFuture<bool> m_extractFuture;
QFutureWatcher<bool> m_extractFutureWatcher;
};
} // namespace Technic
| 2,955
|
C++
|
.h
| 77
| 33.558442
| 85
| 0.704324
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,547
|
PassthroughSetting.h
|
PrismLauncher_PrismLauncher/launcher/settings/PassthroughSetting.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QObject>
#include <memory>
#include "Setting.h"
/*!
* \brief A setting that 'overrides another.' based on the value of a 'gate' setting
* If 'gate' evaluates to true, the override stores and returns data
* If 'gate' evaluates to false, the original does,
*/
class PassthroughSetting : public Setting {
Q_OBJECT
public:
explicit PassthroughSetting(std::shared_ptr<Setting> overridden, std::shared_ptr<Setting> gate);
virtual QVariant defValue() const;
virtual QVariant get() const;
virtual void set(QVariant value);
virtual void reset();
private:
bool isOverriding() const;
protected:
std::shared_ptr<Setting> m_other;
std::shared_ptr<Setting> m_gate;
};
| 1,339
|
C++
|
.h
| 37
| 33.324324
| 100
| 0.742857
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,549
|
TranslationsModel.h
|
PrismLauncher_PrismLauncher/launcher/translations/TranslationsModel.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QAbstractListModel>
#include <memory>
#include <optional>
struct Language;
class TranslationsModel : public QAbstractListModel {
Q_OBJECT
public:
explicit TranslationsModel(QString path, QObject* parent = 0);
virtual ~TranslationsModel();
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent) const override;
bool selectLanguage(QString key);
void updateLanguage(QString key);
QModelIndex selectedIndex();
QString selectedLanguage();
void downloadIndex();
void setUseSystemLocale(bool useSystemLocale);
private:
QVector<Language>::Iterator findLanguage(const QString& key);
std::optional<Language> findLanguageAsOptional(const QString& key);
void reloadLocalFiles();
void downloadTranslation(QString key);
void downloadNext();
// hide copy constructor
TranslationsModel(const TranslationsModel&) = delete;
// hide assign op
TranslationsModel& operator=(const TranslationsModel&) = delete;
private slots:
void indexReceived();
void indexFailed(QString reason);
void dlFailed(QString reason);
void dlGood();
void translationDirChanged(const QString& path);
private: /* data */
struct Private;
std::unique_ptr<Private> d;
};
| 2,123
|
C++
|
.h
| 54
| 35.5
| 91
| 0.755588
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,550
|
POTranslator.h
|
PrismLauncher_PrismLauncher/launcher/translations/POTranslator.h
|
#pragma once
#include <QTranslator>
struct POTranslatorPrivate;
class POTranslator : public QTranslator {
Q_OBJECT
public:
explicit POTranslator(const QString& filename, QObject* parent = nullptr);
virtual ~POTranslator();
QString translate(const char* context, const char* sourceText, const char* disambiguation, int n) const override;
bool isEmpty() const override;
private:
POTranslatorPrivate* d;
};
| 438
|
C++
|
.h
| 13
| 30.076923
| 117
| 0.76247
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,551
|
LogModel.h
|
PrismLauncher_PrismLauncher/launcher/launch/LogModel.h
|
#pragma once
#include <QAbstractListModel>
#include <QString>
#include "MessageLevel.h"
class LogModel : public QAbstractListModel {
Q_OBJECT
public:
explicit LogModel(QObject* parent = 0);
int rowCount(const QModelIndex& parent = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const;
void append(MessageLevel::Enum, QString line);
void clear();
void suspend(bool suspend);
bool suspended();
QString toPlainText();
int getMaxLines();
void setMaxLines(int maxLines);
void setStopOnOverflow(bool stop);
void setOverflowMessage(const QString& overflowMessage);
void setLineWrap(bool state);
bool wrapLines() const;
enum Roles { LevelRole = Qt::UserRole };
private /* types */:
struct entry {
MessageLevel::Enum level;
QString line;
};
private: /* data */
QVector<entry> m_content;
int m_maxLines = 1000;
// first line in the circular buffer
int m_firstLine = 0;
// number of lines occupied in the circular buffer
int m_numLines = 0;
bool m_stopOnOverflow = false;
QString m_overflowMessage = "OVERFLOW";
bool m_suspended = false;
bool m_lineWrap = true;
private:
Q_DISABLE_COPY(LogModel)
};
| 1,269
|
C++
|
.h
| 41
| 26.146341
| 66
| 0.694901
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,552
|
LaunchTask.h
|
PrismLauncher_PrismLauncher/launcher/launch/LaunchTask.h
|
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2013-2021 MultiMC Contributors
*
* Authors: Orochimarufan <orochimarufan.x3@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QObjectPtr.h>
#include <minecraft/MinecraftInstance.h>
#include <QProcess>
#include "BaseInstance.h"
#include "LaunchStep.h"
#include "LogModel.h"
#include "MessageLevel.h"
class LaunchTask : public Task {
Q_OBJECT
protected:
explicit LaunchTask(MinecraftInstancePtr instance);
void init();
public:
enum State { NotStarted, Running, Waiting, Failed, Aborted, Finished };
public: /* methods */
static shared_qobject_ptr<LaunchTask> create(MinecraftInstancePtr inst);
virtual ~LaunchTask() = default;
void appendStep(shared_qobject_ptr<LaunchStep> step);
void prependStep(shared_qobject_ptr<LaunchStep> step);
void setCensorFilter(QMap<QString, QString> filter);
MinecraftInstancePtr instance() { return m_instance; }
void setPid(qint64 pid) { m_pid = pid; }
qint64 pid() { return m_pid; }
/**
* @brief prepare the process for launch (for multi-stage launch)
*/
virtual void executeTask() override;
/**
* @brief launch the armed instance
*/
void proceed();
/**
* @brief abort launch
*/
bool abort() override;
bool canAbort() const override;
shared_qobject_ptr<LogModel> getLogModel();
public:
void substituteVariables(QStringList& args) const;
void substituteVariables(QString& cmd) const;
QString censorPrivateInfo(QString in);
protected: /* methods */
virtual void emitFailed(QString reason) override;
virtual void emitSucceeded() override;
signals:
/**
* @brief emitted when the launch preparations are done
*/
void readyForLaunch();
void requestProgress(Task* task);
void requestLogging();
public slots:
void onLogLines(const QStringList& lines, MessageLevel::Enum defaultLevel = MessageLevel::Launcher);
void onLogLine(QString line, MessageLevel::Enum defaultLevel = MessageLevel::Launcher);
void onReadyForLaunch();
void onStepFinished();
void onProgressReportingRequested();
private: /*methods */
void finalizeSteps(bool successful, const QString& error);
protected: /* data */
MinecraftInstancePtr m_instance;
shared_qobject_ptr<LogModel> m_logModel;
QList<shared_qobject_ptr<LaunchStep>> m_steps;
QMap<QString, QString> m_censorFilter;
int currentStep = -1;
State state = NotStarted;
qint64 m_pid = -1;
};
| 3,948
|
C++
|
.h
| 105
| 33.838095
| 104
| 0.721873
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,553
|
TaskStepWrapper.h
|
PrismLauncher_PrismLauncher/launcher/launch/TaskStepWrapper.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <LoggedProcess.h>
#include <QObjectPtr.h>
#include <java/JavaChecker.h>
#include <launch/LaunchStep.h>
#include <net/Mode.h>
class TaskStepWrapper : public LaunchStep {
Q_OBJECT
public:
explicit TaskStepWrapper(LaunchTask* parent, Task::Ptr task) : LaunchStep(parent), m_task(task) {};
virtual ~TaskStepWrapper() = default;
void executeTask() override;
bool canAbort() const override;
void proceed() override;
public slots:
bool abort() override;
private slots:
void updateFinished();
private:
Task::Ptr m_task;
};
| 1,197
|
C++
|
.h
| 35
| 31.285714
| 103
| 0.743945
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,554
|
LaunchStep.h
|
PrismLauncher_PrismLauncher/launcher/launch/LaunchStep.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "MessageLevel.h"
#include "tasks/Task.h"
#include <QStringList>
class LaunchTask;
class LaunchStep : public Task {
Q_OBJECT
public: /* methods */
explicit LaunchStep(LaunchTask* parent);
virtual ~LaunchStep() = default;
signals:
void logLines(QStringList lines, MessageLevel::Enum level);
void logLine(QString line, MessageLevel::Enum level);
void readyForLaunch();
void progressReportingRequest();
public slots:
virtual void proceed() {};
// called in the opposite order than the Task launch(), used to clean up or otherwise undo things after the launch ends
virtual void finalize() {};
protected: /* data */
LaunchTask* m_parent;
};
| 1,326
|
C++
|
.h
| 36
| 33.722222
| 123
| 0.741231
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,555
|
LookupServerAddress.h
|
PrismLauncher_PrismLauncher/launcher/launch/steps/LookupServerAddress.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QObjectPtr.h>
#include <launch/LaunchStep.h>
#include <QDnsLookup>
#include "minecraft/launch/MinecraftTarget.h"
class LookupServerAddress : public LaunchStep {
Q_OBJECT
public:
explicit LookupServerAddress(LaunchTask* parent);
virtual ~LookupServerAddress() = default;
virtual void executeTask();
virtual bool abort();
virtual bool canAbort() const { return true; }
void setLookupAddress(const QString& lookupAddress);
void setOutputAddressPtr(MinecraftTarget::Ptr output);
private slots:
void on_dnsLookupFinished();
private:
void resolve(const QString& address, quint16 port);
QDnsLookup* m_dnsLookup;
QString m_lookupAddress;
MinecraftTarget::Ptr m_output;
};
| 1,363
|
C++
|
.h
| 37
| 33.594595
| 75
| 0.760061
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
29,557
|
CheckJava.h
|
PrismLauncher_PrismLauncher/launcher/launch/steps/CheckJava.h
|
/* Copyright 2013-2021 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <LoggedProcess.h>
#include <java/JavaChecker.h>
#include <launch/LaunchStep.h>
class CheckJava : public LaunchStep {
Q_OBJECT
public:
explicit CheckJava(LaunchTask* parent) : LaunchStep(parent) {};
virtual ~CheckJava() = default;
virtual void executeTask();
virtual bool canAbort() const { return false; }
private slots:
void checkJavaFinished(const JavaChecker::Result& result);
private:
void printJavaInfo(const QString& version, const QString& architecture, const QString& realArchitecture, const QString& vendor);
void printSystemInfo(bool javaIsKnown, bool javaIs64bit);
private:
QString m_javaPath;
QString m_javaSignature;
JavaChecker::Ptr m_JavaChecker;
};
| 1,355
|
C++
|
.h
| 35
| 35.571429
| 132
| 0.75723
|
PrismLauncher/PrismLauncher
| 5,558
| 625
| 571
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.