Skip to content

Commit

Permalink
chore(gui): add this to all emitted signals
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Jun 8, 2024
1 parent 1b730e4 commit 4dadfdf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/gui/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ void Window::resetStatusBar() {

void IndeterminateProgressWorker::run(const std::function<void()>& fn) {
fn();
emit taskFinished();
emit this->taskFinished();
}

void SavePackFileWorker::run(Window* window, const QString& savePath, bool async) {
Expand All @@ -1397,12 +1397,12 @@ void SavePackFileWorker::run(Window* window, const QString& savePath, bool async
}
int currentEntry = 0;
bool success = window->packFile->bake(savePath.toStdString(), [this, loop_=loop.get(), &currentEntry](const std::string&, const Entry&) {
emit progressUpdated(++currentEntry);
emit this->progressUpdated(++currentEntry);
if (loop_) {
loop_->processEvents();
}
});
emit taskFinished(success);
emit this->taskFinished(success);
}

void ExtractPackFileWorker::run(Window* window, const QString& saveDir, const std::function<bool(const QString&)>& predicate) {
Expand Down Expand Up @@ -1468,7 +1468,7 @@ void ExtractPackFileWorker::run(Window* window, const QString& saveDir, const st
#endif
auto filePath = saveDir + QDir::separator() + dir + QDir::separator() + filename.c_str();
window->writeEntryToFile(filePath, entry);
emit progressUpdated(++currentEntry);
emit this->progressUpdated(++currentEntry);
}
}
for (const auto& [directory, entries] : window->packFile->getUnbakedEntries()) {
Expand All @@ -1486,26 +1486,26 @@ void ExtractPackFileWorker::run(Window* window, const QString& saveDir, const st
for (const auto& entry : entries) {
auto filePath = saveDir + QDir::separator() + dir + QDir::separator() + entry.getFilename().c_str();
window->writeEntryToFile(filePath, entry);
emit progressUpdated(++currentEntry);
emit this->progressUpdated(++currentEntry);
}
}
emit taskFinished();
emit this->taskFinished();
}

void ScanSteamGamesWorker::run() {
QList<std::tuple<QString, QIcon, QDir>> sourceGames;

if (Options::get<bool>(OPT_DISABLE_STEAM_SCANNER)) {
emit taskFinished({});
emit this->taskFinished(sourceGames);
return;
}

SAPP sapp;
if (!sapp) {
emit taskFinished({});
emit this->taskFinished(sourceGames);
return;
}

QList<std::tuple<QString, QIcon, QDir>> sourceGames;

// Add Steam games
for (auto appID : sapp.getInstalledApps()) {
if (!sapp.isAppUsingSourceEngine(appID) && !sapp.isAppUsingSource2Engine(appID)) {
Expand Down Expand Up @@ -1573,5 +1573,5 @@ void ScanSteamGamesWorker::run() {
std::sort(sourceGames.begin(), sourceGames.end(), [](const auto& lhs, const auto& rhs) {
return std::get<0>(lhs) < std::get<0>(rhs);
});
emit taskFinished(sourceGames);
emit this->taskFinished(sourceGames);
}

0 comments on commit 4dadfdf

Please sign in to comment.