Skip to content

Commit

Permalink
Merge branch 'release-1.4.x' of https://github.com/PolyMC/PolyMC into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
fn2006 committed Jul 28, 2022
2 parents 781c8d6 + b7490b4 commit 8688aa1
Show file tree
Hide file tree
Showing 17 changed files with 1,007 additions and 144 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ set(Launcher_HELP_URL "https://polymc.org/wiki/help-pages/%1" CACHE STRING "URL
######## Set version numbers ########
set(Launcher_VERSION_MAJOR 1)
set(Launcher_VERSION_MINOR 4)
set(Launcher_VERSION_HOTFIX 0)
set(Launcher_VERSION_HOTFIX 1)

# Build number
set(Launcher_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
Expand Down
5 changes: 3 additions & 2 deletions launcher/MMCZip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ bool MMCZip::createModdedJar(QString sourceJarPath, QString targetJarPath, const
QSet<QString> addedFiles;

// Modify the jar
for (auto i = mods.constEnd(); i != mods.constBegin(); --i)
// This needs to be done in reverse-order to ensure we respect the loading order of components
for (auto i = mods.crbegin(); i != mods.crend(); i++)
{
const Mod* mod = *i;
const auto* mod = *i;
// do not merge disabled mods.
if (!mod->enabled())
continue;
Expand Down
6 changes: 4 additions & 2 deletions launcher/QObjectPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ class shared_qobject_ptr
{
return m_ptr;
}
bool operator==(const shared_qobject_ptr<T>& other) {
template<typename U>
bool operator==(const shared_qobject_ptr<U>& other) const {
return m_ptr == other.m_ptr;
}
bool operator!=(const shared_qobject_ptr<T>& other) {
template<typename U>
bool operator!=(const shared_qobject_ptr<U>& other) const {
return m_ptr != other.m_ptr;
}

Expand Down
11 changes: 9 additions & 2 deletions launcher/minecraft/auth/AccountList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ QStringList AccountList::profileNames() const {

void AccountList::addAccount(const MinecraftAccountPtr account)
{
// NOTE: Do not allow adding something that's already there
if(m_accounts.contains(account)) {
// NOTE: Do not allow adding something that's already there. We shouldn't let it continue
// because of the signal / slot connections after this.
if (m_accounts.contains(account)) {
qDebug() << "Tried to add account that's already on the accounts list!";
return;
}

Expand All @@ -123,6 +125,8 @@ void AccountList::addAccount(const MinecraftAccountPtr account)
if(profileId.size()) {
auto existingAccount = findAccountByProfileId(profileId);
if(existingAccount != -1) {
qDebug() << "Replacing old account with a new one with the same profile ID!";

MinecraftAccountPtr existingAccountPtr = m_accounts[existingAccount];
m_accounts[existingAccount] = account;
if(m_defaultAccount == existingAccountPtr) {
Expand All @@ -138,9 +142,12 @@ void AccountList::addAccount(const MinecraftAccountPtr account)

// if we don't have this profileId yet, add the account to the end
int row = m_accounts.count();
qDebug() << "Inserting account at index" << row;

beginInsertRows(QModelIndex(), row, row);
m_accounts.append(account);
endInsertRows();

onListChanged();
}

Expand Down
7 changes: 7 additions & 0 deletions launcher/modplatform/flame/FileResolvingTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Flame::FileResolvingTask::FileResolvingTask(const shared_qobject_ptr<QNetworkAcc
: m_network(network), m_toProcess(toProcess)
{}

bool Flame::FileResolvingTask::abort()
{
if (m_dljob)
return m_dljob->abort();
return true;
}

void Flame::FileResolvingTask::executeTask()
{
setStatus(tr("Resolving mod IDs..."));
Expand Down
3 changes: 3 additions & 0 deletions launcher/modplatform/flame/FileResolvingTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class FileResolvingTask : public Task
explicit FileResolvingTask(const shared_qobject_ptr<QNetworkAccessManager>& network, Flame::Manifest &toProcess);
virtual ~FileResolvingTask() {};

bool canAbort() const override { return true; }
bool abort() override;

const Flame::Manifest &getResults() const
{
return m_toProcess;
Expand Down
Loading

0 comments on commit 8688aa1

Please sign in to comment.