Skip to content

Commit 4e9b2c6

Browse files
committed
Added explicit namespaces to usages of file and service options to fix compilation issues
1 parent 246f6aa commit 4e9b2c6

14 files changed

+62
-43
lines changed

src/services/nextcloud/nextcloud.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ auto NextCloud::sendDavRequest(const QByteArray &method, const QString &path, co
9494
}
9595
}
9696

97-
return m_connector.customRequest(request, method, data, Option::Authenticated | options);
97+
return m_connector.customRequest(request, method, data, Services::Option::Authenticated | options);
9898
}
9999

100100
auto NextCloud::getPathUrl(const QString &path) const -> QString

src/services/nextcloud/nextcloudconnector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void NextCloudConnector::sendRequest(RestRequest &&container, QPromise<RestReply
129129
request.setUrl(url);
130130
}
131131

132-
if (container.options().testFlag(Option::Authenticated))
132+
if (container.options().testFlag(Services::Option::Authenticated))
133133
{
134134
request.setRawHeader("Authorization", NetworkUtils::basicAuthHeader(m_nc->loginName(), m_appPassword));
135135
}

src/services/rest/restserviceconnector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ auto RESTServiceConnector::enqueueRequest(RestRequest &&request, QPromise<RestRe
168168
request.id(m_nextQueueId);
169169
m_nextQueueId++;
170170

171-
if (request.options().testFlag(Option::LowPriority))
171+
if (request.options().testFlag(Services::Option::LowPriority))
172172
{
173173
m_requestQueueLowPriority.emplace(std::move(reply), std::move(request));
174174
}

src/services/rest/restserviceconnectorlocal.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void RESTServiceConnectorLocal::sendRequest(RestRequest &&container, QPromise<Re
9696
auto *requestor = makeRequestor();
9797
auto request = container.request();
9898

99-
if (container.options().testFlag(Option::Authenticated))
99+
if (container.options().testFlag(Services::Option::Authenticated))
100100
{
101101
// Workaround for google drive requests
102102
if (!m_config.authHeaderFormat.isEmpty())

src/services/spotify/api/albumapi.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ auto AlbumAPI::getAlbum(const QString &id, Options options) -> QFuture<SpotifyAl
4747
return QtFuture::makeReadyFuture(album);
4848
};
4949

50-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
50+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
51+
.then(callback)
52+
.unwrap();
5153
}
5254

5355
auto AlbumAPI::getAlbumTracks(const QString &id, Options options) -> QFuture<SpotifyTrackList>
@@ -80,7 +82,9 @@ auto AlbumAPI::getAlbumTracks(const QString &id, Options options) -> QFuture<Spo
8082
return QtFuture::makeReadyFuture(tracklist);
8183
};
8284

83-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
85+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
86+
.then(callback)
87+
.unwrap();
8488
}
8589

8690
auto AlbumAPI::getAlbumTracks(SpotifyAlbum &&album, Options options) -> QFuture<SpotifyAlbum>
@@ -104,7 +108,9 @@ auto AlbumAPI::getAlbumTracks(SpotifyAlbum &&album, Options options) -> QFuture<
104108
return QtFuture::makeReadyFuture(album);
105109
};
106110

107-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
111+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
112+
.then(callback)
113+
.unwrap();
108114
}
109115

110116
auto AlbumAPI::getAlbumTracks(SpotifyTrackList &&tracklist, Options options) -> QFuture<SpotifyTrackList>
@@ -126,5 +132,7 @@ auto AlbumAPI::getAlbumTracks(SpotifyTrackList &&tracklist, Options options) ->
126132
return QtFuture::makeReadyFuture(tracklist);
127133
};
128134

129-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
135+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
136+
.then(callback)
137+
.unwrap();
130138
}

src/services/spotify/api/playerapi.cpp

+16-15
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PlayerAPI::PlayerAPI(Spotify *parent) : m_spotify(parent)
2121

2222
auto PlayerAPI::play() const -> QFuture<RestReply>
2323
{
24-
return m_spotify->put(QUrl(u"https://api.spotify.com/v1/me/player/play"_s), {}, Option::Authenticated);
24+
return m_spotify->put(QUrl(u"https://api.spotify.com/v1/me/player/play"_s), {}, Services::Option::Authenticated);
2525
}
2626

2727
auto PlayerAPI::play(const QString &deviceId, const QJsonObject &body) const -> QFuture<RestReply>
@@ -36,7 +36,7 @@ auto PlayerAPI::play(const QString &deviceId, const QJsonObject &body) const ->
3636

3737
const QJsonDocument content(body);
3838
return m_spotify->put(NetworkUtils::makeJsonRequest(url), content.toJson(QJsonDocument::JsonFormat::Compact),
39-
Option::Authenticated);
39+
Services::Option::Authenticated);
4040
}
4141

4242
auto PlayerAPI::play(const QString &uri) const -> QFuture<RestReply>
@@ -99,7 +99,7 @@ auto PlayerAPI::pause(const QString &deviceId) const -> QFuture<RestReply>
9999
url.setQuery(query);
100100
}
101101

102-
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
102+
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
103103
}
104104

105105
auto PlayerAPI::next() const -> QFuture<RestReply>
@@ -117,7 +117,7 @@ auto PlayerAPI::next(const QString &deviceId) const -> QFuture<RestReply>
117117
url.setQuery(query);
118118
}
119119

120-
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
120+
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
121121
}
122122

123123
auto PlayerAPI::previous() const -> QFuture<RestReply>
@@ -135,7 +135,7 @@ auto PlayerAPI::previous(const QString &deviceId) const -> QFuture<RestReply>
135135
url.setQuery(query);
136136
}
137137

138-
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
138+
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
139139
}
140140

141141
auto PlayerAPI::seek(int positionMs) const -> QFuture<RestReply>
@@ -155,7 +155,7 @@ auto PlayerAPI::seek(int positionMs, const QString &deviceId) const -> QFuture<R
155155

156156
url.setQuery(query);
157157

158-
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
158+
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
159159
}
160160

161161
auto PlayerAPI::getState() -> QFuture<SpotifyPlaybackState>
@@ -190,7 +190,7 @@ auto PlayerAPI::getState(const QStringList &additionalTypes, const QString &mark
190190
return QtFuture::makeReadyFuture(SpotifyPlaybackState::fromJson(QJsonDocument::fromJson(reply.data())));
191191
};
192192

193-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated).then(callback).unwrap();
193+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated).then(callback).unwrap();
194194
}
195195

196196
auto PlayerAPI::getCurrentlyPlaying() -> QFuture<SpotifyCurrentTrack>
@@ -227,7 +227,7 @@ auto PlayerAPI::getCurrentlyPlaying(const QStringList &additionalTypes, const QS
227227
return QtFuture::makeReadyFuture(SpotifyCurrentTrack::fromJson(reply.data()));
228228
};
229229

230-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated).then(callback).unwrap();
230+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated).then(callback).unwrap();
231231
}
232232

233233
auto PlayerAPI::transfer(const QStringList &deviceIds) const -> QFuture<RestReply>
@@ -243,7 +243,7 @@ auto PlayerAPI::transfer(const QStringList &deviceIds, bool play) const -> QFutu
243243

244244
const auto doc = QJsonDocument(body);
245245
return m_spotify->put(NetworkUtils::makeJsonRequest(url), doc.toJson(QJsonDocument::Compact),
246-
Option::Authenticated);
246+
Services::Option::Authenticated);
247247
}
248248

249249
auto PlayerAPI::devices() -> QFuture<SpotifyDeviceList>
@@ -256,7 +256,7 @@ auto PlayerAPI::devices() -> QFuture<SpotifyDeviceList>
256256
return SpotifyDevice::fromJson(devices);
257257
};
258258

259-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated).then(callback);
259+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated).then(callback);
260260
}
261261

262262
auto PlayerAPI::repeat(SpotifyRepeatMode mode) const -> QFuture<RestReply>
@@ -291,7 +291,7 @@ auto PlayerAPI::repeat(const QString &state, const QString &deviceId) const -> Q
291291
}
292292

293293
url.setQuery(query);
294-
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
294+
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
295295
}
296296

297297
auto PlayerAPI::volume(int volumePercent) const -> QFuture<RestReply>
@@ -310,7 +310,7 @@ auto PlayerAPI::volume(int volumePercent, const QString &deviceId) const -> QFut
310310
}
311311

312312
url.setQuery(query);
313-
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
313+
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
314314
}
315315

316316
auto PlayerAPI::shuffle(bool state) const -> QFuture<RestReply>
@@ -329,7 +329,7 @@ auto PlayerAPI::shuffle(bool state, const QString &deviceId) const -> QFuture<Re
329329
}
330330

331331
url.setQuery(query);
332-
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
332+
return m_spotify->put(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
333333
}
334334

335335
auto PlayerAPI::getRecentlyPlayed(int limit) const -> QFuture<RestReply>
@@ -364,7 +364,8 @@ auto PlayerAPI::getRecentlyPlayed(const QDateTime &after, const QDateTime &befor
364364
query.addQueryItem(u"limit"_s, QString::number(std::clamp(limit, 0, MAX_RECENTLY_PLAYED)));
365365

366366
url.setQuery(query);
367-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | Option::LowPriority);
367+
return m_spotify->get(NetworkUtils::makeJsonRequest(url),
368+
Services::Option::Authenticated | Services::Option::LowPriority);
368369
}
369370

370371
auto PlayerAPI::addToQueue(const QString &uri) const -> QFuture<RestReply>
@@ -390,5 +391,5 @@ auto PlayerAPI::addToQueue(const QString &uri, const QString &deviceId) const ->
390391
}
391392

392393
url.setQuery(query);
393-
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Option::Authenticated);
394+
return m_spotify->post(NetworkUtils::makeJsonRequest(url), {}, Services::Option::Authenticated);
394395
}

src/services/spotify/api/playlistsapi.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ auto PlaylistsAPI::getPlaylist(const QString &id, Options options) -> QFuture<Sp
4040
return QtFuture::makeReadyFuture(SpotifyPlaylist::fromJson(reply.data()));
4141
};
4242

43-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
43+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
44+
.then(callback)
45+
.unwrap();
4446
}
4547

4648
auto PlaylistsAPI::getPlaylistTracks(const QString &id, Options options) -> QFuture<SpotifyTrackList>
@@ -73,7 +75,9 @@ auto PlaylistsAPI::getPlaylistTracks(const QString &id, Options options) -> QFut
7375
return QtFuture::makeReadyFuture(tracklist);
7476
};
7577

76-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
78+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
79+
.then(callback)
80+
.unwrap();
7781
}
7882

7983
auto PlaylistsAPI::getPlaylistTracks(SpotifyTrackList &&tracklist, Options options) -> QFuture<SpotifyTrackList>
@@ -95,7 +99,9 @@ auto PlaylistsAPI::getPlaylistTracks(SpotifyTrackList &&tracklist, Options optio
9599
return QtFuture::makeReadyFuture(tracklist);
96100
};
97101

98-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
102+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
103+
.then(callback)
104+
.unwrap();
99105
}
100106

101107
auto PlaylistsAPI::updatePlaylist(const PlaylistConfig &config, Options options) const -> QFuture<RestReply>

src/services/spotify/api/tracksapi.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ auto TracksAPI::getTrack(const QString &id, Options options) -> QFuture<SpotifyT
3939
return QtFuture::makeReadyFuture(SpotifyTrack::fromJson(reply.data()));
4040
};
4141

42-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
42+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
43+
.then(callback)
44+
.unwrap();
4345
}
4446

4547
auto TracksAPI::getTracks(const QStringList &ids, Options options) -> QFuture<std::vector<SpotifyTrack>>
@@ -88,7 +90,9 @@ auto TracksAPI::getTracks(const QStringList &ids, std::vector<SpotifyTrack> &&pr
8890
return QtFuture::makeReadyFuture(previous);
8991
};
9092

91-
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Option::Authenticated | options).then(callback).unwrap();
93+
return m_spotify->get(NetworkUtils::makeJsonRequest(url), Services::Option::Authenticated | options)
94+
.then(callback)
95+
.unwrap();
9296
}
9397

9498
auto TracksAPI::getNextBatch(const QStringList &ids, const std::vector<SpotifyTrack> &previous) -> QStringList

src/services/spotify/spotifyconnectorserver.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ void SpotifyConnectorServer::disconnectService()
5353

5454
void SpotifyConnectorServer::sendRequest(RestRequest &&container, QPromise<RestReply> &&promise)
5555
{
56-
auto request =
57-
container.options().testFlag(Option::Authenticated) ? addAuthHeader(container.request()) : container.request();
56+
auto request = container.options().testFlag(Services::Option::Authenticated) ? addAuthHeader(container.request())
57+
: container.request();
5858
QNetworkReply *reply = nullptr;
5959

6060
switch (container.type())

src/tools/audio/audiosaveload.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ auto AudioSaveLoad::loadProjects(const QObject *context, FileListResult &&files)
5454
}
5555
}
5656

57-
auto futureContents = File::getDataAsync(fileNames, Option::AllowCache);
57+
auto futureContents = File::getDataAsync(fileNames, Files::Option::AllowCache);
5858

5959
return futureContents.then([context](const std::vector<FileDataResult> &contents) {
6060
qCDebug(gmAudioSaveLoad()) << "Found audio projects.";
@@ -79,7 +79,7 @@ auto AudioSaveLoad::findMissingFilesAsync(const QList<AudioFile *> &audioFiles,
7979

8080
const auto filePaths = getFilePathsToCheck(audioFiles, basePath);
8181

82-
auto futureCheckResult = File::checkAsync(filePaths, Option::AllowCache);
82+
auto futureCheckResult = File::checkAsync(filePaths, Files::Option::AllowCache);
8383
return futureCheckResult
8484
.then([audioFiles, basePath](const FileMultiCheckResult &multiResult) {
8585
const auto foundPaths = multiResult.existing();

src/tools/audio/playlist/resolvingaudioplaylist.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ auto ResolvingAudioPlaylist::unwrapSpotify(qsizetype index, const AudioFile &fil
150150
switch (type)
151151
{
152152
case SpotifyUtils::SpotifyType::Playlist:
153-
return Spotify::instance()->playlists.getPlaylistTracks(id, Option::None).then(callback);
153+
return Spotify::instance()->playlists.getPlaylistTracks(id, Services::Option::None).then(callback);
154154
case SpotifyUtils::SpotifyType::Album:
155-
return Spotify::instance()->albums.getAlbumTracks(id, Option::None).then(callback);
155+
return Spotify::instance()->albums.getAlbumTracks(id, Services::Option::None).then(callback);
156156
default:
157157
qCCritical(gmAudioPlaylistResolving())
158158
<< "loadPlaylistRecursiveSpotify(): not implemented for container type" << (int)type;
@@ -166,7 +166,7 @@ auto ResolvingAudioPlaylist::unwrapYouTube(qsizetype index, const AudioFile &fil
166166
if (!id.isValid()) return QtFuture::makeReadyFuture();
167167

168168
return YouTube::instance()
169-
->getPlaylistInfoAsync(id, Option::None)
169+
->getPlaylistInfoAsync(id, Services::Option::None)
170170
.then([this, index](const YouTubePlaylist &playlist) {
171171
QList<AudioFile *> files;
172172
files.reserve(playlist.streams.size());
@@ -226,7 +226,7 @@ void ResolvingAudioPlaylist::loadSpotifyTitles(const QList<AudioFile *> &tracks)
226226
}
227227
};
228228

229-
Spotify::instance()->tracks.getTracks(trackIds, Option::LowPriority).then(callback);
229+
Spotify::instance()->tracks.getTracks(trackIds, Services::Option::LowPriority).then(callback);
230230
}
231231

232232
auto ResolvingAudioPlaylist::isPlaylist(const QString &file) -> bool

src/tools/audio/thumbnails/loaders/fileimageloader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ auto FileImageLoader::loadImageAsync(const QString &path) -> QFuture<QPixmap>
1515
return QtFuture::makeReadyFuture(pixmap);
1616
}
1717

18-
auto future = File::getDataAsync(path, Option::AllowCache | Option::LowPriority);
18+
auto future = File::getDataAsync(path, Files::Option::AllowCache | Files::Option::LowPriority);
1919

2020
const auto callback = [path](const FileDataResult &result) {
2121
return QtConcurrent::run(loadFromFileResult, path, result);

src/tools/audio/thumbnails/loaders/spotifyimageloader.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ auto SpotifyImageLoader::loadPlaylistImageAsync(const QString &id) -> QFuture<QP
8282
{
8383
const auto playlistCallback = [id](const SpotifyPlaylist &playlist) {
8484
const auto url = playlist.images.front().url;
85-
auto future = Services::Spotify::instance()->get(url, Option::LowPriority);
85+
auto future = Services::Spotify::instance()->get(url, Services::Option::LowPriority);
8686

8787
const auto imageCallback = [id, url](const RestReply &reply) {
8888
QPixmap image;
@@ -99,7 +99,7 @@ auto SpotifyImageLoader::loadPlaylistImageAsync(const QString &id) -> QFuture<QP
9999
return future.then(imageCallback);
100100
};
101101

102-
auto future = Spotify::instance()->playlists.getPlaylist(id, Option::LowPriority);
102+
auto future = Spotify::instance()->playlists.getPlaylist(id, Services::Option::LowPriority);
103103
return future.then(playlistCallback).unwrap();
104104
}
105105

@@ -114,7 +114,7 @@ void SpotifyImageLoader::startRequest(SpotifyUtils::SpotifyType type)
114114

115115
qCDebug(gmAudioSpotifyImageLoader()) << "Sending batch request:" << url;
116116

117-
auto future = Spotify::instance()->get(url, Option::Authenticated | Option::LowPriority);
117+
auto future = Spotify::instance()->get(url, Services::Option::Authenticated | Services::Option::LowPriority);
118118
future.then([type](RestReply &&reply) { receivedRequest(std::move(reply), type); });
119119

120120
// Start timer again if there still are ids in the queue
@@ -158,7 +158,7 @@ void SpotifyImageLoader::receivedRequest(RestReply &&reply, SpotifyUtils::Spotif
158158
}
159159

160160
const auto request = QNetworkRequest(url);
161-
auto future = Spotify::instance()->get(request, Option::LowPriority);
161+
auto future = Spotify::instance()->get(request, Services::Option::LowPriority);
162162

163163
const auto callback = [id, url](const RestReply &imageReply) {
164164
QPixmap image;

src/tools/audio/thumbnails/loaders/youtubeimageloader.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ auto YouTubeImageLoader::loadImageAsync(const VideoId &id, QNetworkAccessManager
2222

2323
// Get video info
2424
return YouTube::instance()
25-
->getStreamInfoAsync(id, Option::LowPriority)
25+
->getStreamInfoAsync(id, Services::Option::LowPriority)
2626
.then([networkManager](const YouTubeVideo &video) { return loadImageAsync(video, networkManager); })
2727
.unwrap();
2828
}
@@ -61,7 +61,7 @@ auto YouTubeImageLoader::loadImageAsync(const PlaylistId &id, QNetworkAccessMana
6161

6262
// Get video info
6363
return YouTube::instance()
64-
->getPlaylistInfoAsync(id, Option::LowPriority)
64+
->getPlaylistInfoAsync(id, Services::Option::LowPriority)
6565
.then([networkManager](const YouTubePlaylist &playlist) { return loadImageAsync(playlist, networkManager); })
6666
.unwrap();
6767

0 commit comments

Comments
 (0)