Skip to content

Commit

Permalink
fix curseforge file update
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed Jul 3, 2024
1 parent 0120bda commit e0f8700
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion modmanager.pro
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ unix {
INSTALLS += target

CONFIG(debug, debug|release) {
# QMAKE_CXXFLAGS_DEBUG += -g3 -O0
# QMAKE_CXXFLAGS_DEBUG += -g3 -O0
message("Currently in DEBUG mode.")
} else {
DEFINES += QT_NO_DEBUG QT_NO_DEBUG_OUTPUT
Expand Down
8 changes: 4 additions & 4 deletions src/curseforge/curseforgemod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ std::shared_ptr<Reply<QList<CurseforgeFileInfo> > > CurseforgeMod::acquireLatest

std::shared_ptr<Reply<QList<CurseforgeFileInfo>, int>> CurseforgeMod::acquireMoreFileList(GameVersion version, ModLoaderType::Type loaderType, bool clear)
{
if(allFileListGetter_ && allFileListGetter_->isRunning()) return allFileListGetter_;
allFileListGetter_ = api_->getModFiles(modInfo_.id(), clear? 0: modInfo().allFileList().size(), version, loaderType).asShared();
allFileListGetter_->setOnFinished(this, [=](const QList<CurseforgeFileInfo> &fileList, int count){
if(moreFileListGetter_ && moreFileListGetter_->isRunning()) return moreFileListGetter_;
moreFileListGetter_ = api_->getModFiles(modInfo_.id(), clear? 0: modInfo().allFileList().size(), version, loaderType).asShared();
moreFileListGetter_->setOnFinished(this, [=](const QList<CurseforgeFileInfo> &fileList, int count){
if(clear)
modInfo_.allFileList_ = fileList;
else
Expand All @@ -118,7 +118,7 @@ std::shared_ptr<Reply<QList<CurseforgeFileInfo>, int>> CurseforgeMod::acquireMor
}, [=](auto){
emit moreFileListReady({});
});
return allFileListGetter_;
return moreFileListGetter_;
}

const CurseforgeModInfo &CurseforgeMod::modInfo() const
Expand Down
2 changes: 1 addition & 1 deletion src/curseforge/curseforgemod.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CurseforgeMod : public QObject, public Tagable
bool gettingIcon_ = false;
std::unique_ptr<Reply<QString>> descriptionGetter_;
std::shared_ptr<Reply<QList<CurseforgeFileInfo>>> latestIndexedFileListGetter_;
std::shared_ptr<Reply<QList<CurseforgeFileInfo>, int>> allFileListGetter_;
std::shared_ptr<Reply<QList<CurseforgeFileInfo>, int>> moreFileListGetter_;
};

#endif // CURSEFORGEMOD_H
12 changes: 9 additions & 3 deletions src/local/localmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,19 @@ void LocalMod::checkCurseforgeUpdate(bool force)
emit checkCurseforgeUpdateStarted();
//update file list
if(force || curseforgeMod_->modInfo().allFileList().isEmpty()){
//TODO
curseforgeFileListGetter_ = curseforgeMod_->acquireMoreFileList();
curseforgeFileListGetter_ = curseforgeMod_->acquireMoreFileList(path()->info().gameVersion(), path()->info().loaderType());
curseforgeFileListGetter_->setOnFinished(this, [=](const QList<CurseforgeFileInfo> &, int count){
curseforgeUpdater_.findUpdate(modFile_->linker()->curseforgeFileInfo());
emit curseforgeUpdateReady(true);
}, [=](auto){
emit curseforgeUpdateReady(false);
// major version instead
curseforgeFileListGetter_ = curseforgeMod_->acquireMoreFileList(path()->info().gameVersion().majorVersion(), path()->info().loaderType());
curseforgeFileListGetter_->setOnFinished(this, [=](const QList<CurseforgeFileInfo> &, int count){
curseforgeUpdater_.findUpdate(modFile_->linker()->curseforgeFileInfo());
emit curseforgeUpdateReady(true);
}, [=](auto){
emit curseforgeUpdateReady(false);
});
});
}else {
curseforgeUpdater_.findUpdate(modFile_->linker()->curseforgeFileInfo());
Expand Down
2 changes: 1 addition & 1 deletion src/ui/framelesswrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool FramelessWrapper::nativeEvent(const QByteArray &eventType, void *message, l
titleBar_->setNormal();
}
*result = ::DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
break;
break;
}
}
return false;
Expand Down

0 comments on commit e0f8700

Please sign in to comment.