Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/AppSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct General {
bool fullscreen = true;
bool mouse_support = true;
bool verify_files = true;
bool scan_on_launch = true;
bool show_missing_games = false;
QString locale;
QString theme;
Expand Down
8 changes: 4 additions & 4 deletions src/backend/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Backend::Backend(const CliArgs& args)
QObject::connect(m_api_private->settings().keyEditorPtr(), &model::KeyEditor::keysChanged,
m_api_public->keysPtr(), &model::Keys::refresh_keys);
QObject::connect(m_api_private->settingsPtr(), &model::Settings::providerReloadingRequested,
[this](){ onScanRequested(); });
[this](){ onScanRequested(true); });

QObject::connect(m_api_public, &model::ApiObject::favoritesChanged,
[this](){ onFavoritesChanged(); });
Expand Down Expand Up @@ -241,13 +241,13 @@ void Backend::start()
{
m_api_private->settings().postInit();
onProcessFinished();
onScanRequested();
onScanRequested(AppSettings::general.scan_on_launch);
}

void Backend::onScanRequested()
void Backend::onScanRequested(const bool force_refresh)
{
m_api_public->clearGameData();
m_providerman->run();
m_providerman->run(force_refresh);
}

void Backend::onScanFinished()
Expand Down
2 changes: 1 addition & 1 deletion src/backend/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Backend {
ProcessLauncher* m_launcher;
ProviderManager* m_providerman;

void onScanRequested();
void onScanRequested(bool force_refresh = false);
void onScanFinished();
void onFavoritesChanged();
void onProcessLaunched();
Expand Down
11 changes: 11 additions & 0 deletions src/backend/model/internal/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ void Settings::setVerifyFiles(bool new_val)
emit verifyFilesChanged();
}

void Settings::setScanOnLaunch(bool new_val)
{
if (new_val == AppSettings::general.scan_on_launch)
return;

AppSettings::general.scan_on_launch = new_val;
AppSettings::save_config();

emit scanOnLaunchChanged();
}

void Settings::setShowMissingGames(bool new_val)
{
if (new_val == AppSettings::general.show_missing_games)
Expand Down
7 changes: 7 additions & 0 deletions src/backend/model/internal/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class Settings : public QObject {
Q_PROPERTY(bool verifyFiles
READ verifyFiles WRITE setVerifyFiles
NOTIFY verifyFilesChanged)
Q_PROPERTY(bool scanOnLaunch
READ scanOnLaunch WRITE setScanOnLaunch
NOTIFY scanOnLaunchChanged)
Q_PROPERTY(bool showMissingGames
READ showMissingGames WRITE setShowMissingGames
NOTIFY showMissingGamesChanged)
Expand All @@ -66,6 +69,9 @@ class Settings : public QObject {
bool verifyFiles() const { return AppSettings::general.verify_files; }
void setVerifyFiles(bool);

bool scanOnLaunch() const { return AppSettings::general.scan_on_launch; }
void setScanOnLaunch(bool);

bool showMissingGames() const { return AppSettings::general.show_missing_games; }
void setShowMissingGames(bool);

Expand All @@ -82,6 +88,7 @@ class Settings : public QObject {
void fullscreenChanged();
void mouseSupportChanged();
void verifyFilesChanged();
void scanOnLaunchChanged();
void showMissingGamesChanged();
void gameDirsChanged();
void androidDirsChanged();
Expand Down
6 changes: 6 additions & 0 deletions src/backend/parsers/SettingsFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ConfigEntryMaps::ConfigEntryMaps()
{ QStringLiteral("fullscreen"), GeneralOption::FULLSCREEN },
{ QStringLiteral("input-mouse-support"), GeneralOption::MOUSE_SUPPORT },
{ QStringLiteral("verify-files"), GeneralOption::VERIFY_FILES },
{ QStringLiteral("scan-on-launch"), GeneralOption::SCAN_ON_LAUNCH },
{ QStringLiteral("show-missing-games"), GeneralOption::SHOW_MISSING_GAMES },
{ QStringLiteral("locale"), GeneralOption::LOCALE },
{ QStringLiteral("theme"), GeneralOption::THEME },
Expand Down Expand Up @@ -176,6 +177,10 @@ void LoadContext::handle_general_attrib(const size_t lineno, const QString& key,
if (!store_bool_maybe(val, AppSettings::general.verify_files))
log_needs_bool(lineno, key);
break;
case ConfigEntryGeneralOption::SCAN_ON_LAUNCH:
if (!store_bool_maybe(val, AppSettings::general.scan_on_launch))
log_needs_bool(lineno, key);
break;
case ConfigEntryGeneralOption::SHOW_MISSING_GAMES:
if (!store_bool_maybe(val, AppSettings::general.show_missing_games))
log_needs_bool(lineno, key);
Expand Down Expand Up @@ -312,6 +317,7 @@ void SaveContext::print_general(QTextStream& stream) const
{ GeneralOption::FULLSCREEN, AppSettings::general.fullscreen ? STR_TRUE : STR_FALSE },
{ GeneralOption::MOUSE_SUPPORT, AppSettings::general.mouse_support ? STR_TRUE : STR_FALSE },
{ GeneralOption::VERIFY_FILES, AppSettings::general.verify_files ? STR_TRUE : STR_FALSE },
{ GeneralOption::SCAN_ON_LAUNCH, AppSettings::general.scan_on_launch ? STR_TRUE : STR_FALSE },
{ GeneralOption::SHOW_MISSING_GAMES, AppSettings::general.show_missing_games ? STR_TRUE : STR_FALSE },
{ GeneralOption::LOCALE, AppSettings::general.locale },
{ GeneralOption::THEME, theme_path },
Expand Down
1 change: 1 addition & 0 deletions src/backend/parsers/SettingsFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum class ConfigEntryGeneralOption : unsigned char {
FULLSCREEN,
MOUSE_SUPPORT,
VERIFY_FILES,
SCAN_ON_LAUNCH,
SHOW_MISSING_GAMES,
LOCALE,
THEME,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/providers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ target_sources(pegasus-backend PRIVATE
ProviderUtils.h
SearchContext.cpp
SearchContext.h
GameDataCache.cpp
GameDataCache.h
)


Expand Down
Loading
Loading