core: make getCloudURL() return an std::string

Let's use std::string in the core. Notably, I'd like to make
the numerous main() functions mostly independent of Qt. Some
things will have to remain, such as argument parsing, of course.

This changes the API: instead of returning an error code and
taking a pointer to the actual return-value, return an
std::optional<std::string>> that is set if the function succeeds.

Returning an empty string in the error case might be simpler,
but oh well...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-24 22:05:28 +01:00 committed by bstoeger
parent 8e106b0449
commit c6cd10a43f
7 changed files with 54 additions and 48 deletions

View file

@ -84,9 +84,9 @@ int main(int argc, char **argv)
if (!defaultFile.isEmpty())
files.push_back(QString(prefs.default_filename));
} else if (prefs.default_file_behavior == CLOUD_DEFAULT_FILE) {
QString cloudURL;
if (getCloudURL(cloudURL) == 0)
files.push_back(cloudURL);
auto cloudURL = getCloudURL();
if (cloudURL)
files.push_back(QString::fromStdString(*cloudURL));
}
}
if (!files.isEmpty()) {