Skip to content

Commit

Permalink
Updated to latest flashpointinstall from OFILb
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Sep 18, 2020
1 parent 138fdde commit 57e358c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions src/flashpointinstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ Qx::GenericError Install::JSONConfigReader::readInto()
QString Install::CLIFp::parametersFromStandard(QString originalAppPath, QString originalAppParams)
{
if(originalAppPath == DBTable_Add_App::ENTRY_MESSAGE)
return MSG_ARG.arg(originalAppParams);
return MSG_ARG.arg(originalAppParams) + " -q";
else if(originalAppPath == DBTable_Add_App::ENTRY_EXTRAS)
return EXTRA_ARG.arg(originalAppParams);
return EXTRA_ARG.arg(originalAppParams) + " -q";
else
return APP_ARG.arg(originalAppPath) + " " + PARAM_ARG.arg(originalAppParams);
return APP_ARG.arg(originalAppPath) + " " + PARAM_ARG.arg(originalAppParams) + " -q";
}

//===============================================================================================================
Expand Down Expand Up @@ -731,10 +731,16 @@ QSqlError Install::initialPlaylistQuery(DBQueryBuffer& resultBuffer, QSet<QStrin
if(!mainQuery.exec())
return mainQuery.lastError();

// Create size query
// Create size query and bind selected playlists
QSqlQuery sizeQuery(fpDB);
sizeQuery.setForwardOnly(true);
sizeQuery.prepare(sizeQueryCommand);
for(const QString& playlist : selectedPlaylists)
sizeQuery.addBindValue(playlist);

// Execute query and return if error occurs
if(!sizeQuery.exec())
return sizeQuery.lastError();

// Get query size
sizeQuery.next();
Expand All @@ -750,7 +756,7 @@ QSqlError Install::initialPlaylistQuery(DBQueryBuffer& resultBuffer, QSet<QStrin
}
}

QSqlError Install::initialPlaylistGameQuery(QList<QPair<DBQueryBuffer, QUuid>>& resultBuffer, const QList<QUuid>& knownPlaylistsToQuery) const
QSqlError Install::initialPlaylistGameQuery(QList<DBQueryBuffer>& resultBuffer, const QList<QUuid>& knownPlaylistsToQuery) const
{
// Ensure return buffer is empty
resultBuffer.clear();
Expand All @@ -761,7 +767,7 @@ QSqlError Install::initialPlaylistGameQuery(QList<QPair<DBQueryBuffer, QUuid>>&
for(QUuid playlistID : knownPlaylistsToQuery) // Naturally returns empty list if no playlists are selected
{
// Query all games for the current playlist
QString baseQueryCommand = "SELECT `" + DBTable_Playlist_Game::COLUMN_LIST.join("`,`") + "` FROM " + DBTable_Playlist_Game::NAME + " WHERE " +
QString baseQueryCommand = "SELECT %1 FROM " + DBTable_Playlist_Game::NAME + " WHERE " +
DBTable_Playlist_Game::COL_PLAYLIST_ID + " = '" + playlistID.toString(QUuid::WithoutBraces) + "'";
QString mainQueryCommand = baseQueryCommand.arg("`" + DBTable_Playlist_Game::COLUMN_LIST.join("`,`") + "`");
QString sizeQueryCommand = baseQueryCommand.arg(GENERAL_QUERY_SIZE_COMMAND);
Expand All @@ -775,7 +781,7 @@ QSqlError Install::initialPlaylistGameQuery(QList<QPair<DBQueryBuffer, QUuid>>&
return queryError;

// Add result to buffer
resultBuffer.append(qMakePair(queryResult, playlistID));
resultBuffer.append(queryResult);
}

// Return invalid SqlError
Expand Down
4 changes: 2 additions & 2 deletions src/flashpointinstall.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Install
static inline const QString EXE_NAME = "CLIFp.exe";
static inline const QString APP_ARG = R"(--exe="%1")";
static inline const QString PARAM_ARG = R"(--param="%1")";
static inline const QString EXTRA_ARG = R"(--extra-"%1"")";
static inline const QString EXTRA_ARG = R"(--extra-"%1")";
static inline const QString MSG_ARG = R"(--msg="%1")";

// Class functions
Expand Down Expand Up @@ -335,7 +335,7 @@ class Install
QSqlError initialGameQuery(QList<DBQueryBuffer>& resultBuffer, QSet<QString> selectedPlatforms) const;
QSqlError initialAddAppQuery(DBQueryBuffer& resultBuffer) const;
QSqlError initialPlaylistQuery(DBQueryBuffer& resultBuffer, QSet<QString> selectedPlaylists) const;
QSqlError initialPlaylistGameQuery(QList<QPair<DBQueryBuffer, QUuid>>& resultBuffer, const QList<QUuid>& knownPlaylistsToQuery) const;
QSqlError initialPlaylistGameQuery(QList<DBQueryBuffer>& resultBuffer, const QList<QUuid>& knownPlaylistsToQuery) const;

// Queries - CLIFp
QSqlError queryEntryID(DBQueryBuffer& resultBuffer, QUuid appID) const;
Expand Down

0 comments on commit 57e358c

Please sign in to comment.