Replace forever with Q_FOREVER

This commit is contained in:
Jonas Kvinge 2024-08-25 06:24:02 +02:00
parent 4ea57d1181
commit 80bea31b98
10 changed files with 13 additions and 13 deletions

View File

@ -293,7 +293,7 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
QObject::connect(worker->process_, &QProcess::readyReadStandardError, this, &WorkerPool::ProcessReadyReadStandardError);
// Create a server, find an unused name and start listening
forever {
Q_FOREVER {
const quint32 unique_number = QRandomGenerator::global()->bounded(static_cast<quint32>(quint64(this) & 0xFFFFFFFF));
const QString name = QStringLiteral("%1_%2").arg(local_server_name_).arg(unique_number);

View File

@ -206,7 +206,7 @@ bool CommandlineOptions::Parse() {
// Parse the arguments
bool ok = false;
forever {
Q_FOREVER {
#ifdef Q_OS_WIN32
int c = getopt_long(argc_, argv_, L"hptusqrfv:c:alk:i:oyg:w:", kOptions, nullptr);
#else

View File

@ -131,7 +131,7 @@ void LocalRedirectServer::WriteTemplate() const {
static const QRegularExpression tr_regexp(QStringLiteral("tr\\(\"([^\"]+)\"\\)"));
qint64 offset = 0;
forever {
Q_FOREVER {
QRegularExpressionMatch re_match = tr_regexp.match(page_data, offset);
if (!re_match.hasMatch()) break;
offset = re_match.capturedStart();

View File

@ -53,7 +53,7 @@ void StyleSheetLoader::SetStyleSheet(QWidget *widget, const QString &filename) {
}
QTextStream stream(&file);
QString stylesheet;
forever {
Q_FOREVER {
QString line = stream.readLine();
stylesheet.append(line);
if (stream.atEnd()) break;

View File

@ -65,7 +65,7 @@ bool PulseDeviceFinder::Reconnect() {
}
// Wait for the context to be connected.
forever {
Q_FOREVER {
const pa_context_state state = pa_context_get_state(context_);
if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) {
qLog(Warning) << "Connection to pulseaudio failed";
@ -90,7 +90,7 @@ retry:
ListDevicesState state;
pa_context_get_sink_info_list(context_, &PulseDeviceFinder::GetSinkInfoCallback, &state);
forever {
Q_FOREVER {
if (state.finished) {
return state.devices;
}

View File

@ -1897,9 +1897,9 @@ void Playlist::RemoveItemsNotInQueue() {
}
int start = 0;
forever {
Q_FOREVER {
// Find a place to start - first row that isn't in the queue
forever {
Q_FOREVER {
if (start >= rowCount()) return;
if (!queue_->ContainsSourceRow(start) && current_row() != start) break;
start++;
@ -1907,7 +1907,7 @@ void Playlist::RemoveItemsNotInQueue() {
// Figure out how many rows to remove - keep going until we find a row that is in the queue
int count = 1;
forever {
Q_FOREVER {
if (start + count >= rowCount()) break;
if (queue_->ContainsSourceRow(start + count) || current_row() == start + count) break;
count++;

View File

@ -256,7 +256,7 @@ void PlaylistManager::SaveWithUI(const int id, const QString &playlist_name) {
QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QLatin1Char('.') + last_save_extension;
QFileInfo fileinfo;
forever {
Q_FOREVER {
filename = QFileDialog::getSaveFileName(nullptr, tr("Save playlist", "Title of the playlist save dialog."), filename, parser()->filters(PlaylistParser::Type::Save), &last_save_filter);
if (filename.isEmpty()) return;
fileinfo.setFile(filename);

View File

@ -62,7 +62,7 @@ SongList M3UParser::Load(QIODevice *device, const QString &playlist_path, const
}
SongList ret;
forever {
Q_FOREVER {
if (line.startsWith(QLatin1Char('#'))) {
// Extended info or comment.
if (type == M3UType::EXTENDED && line.startsWith(QLatin1String("#EXT"))) {

View File

@ -253,7 +253,7 @@ void SpotifyService::Authenticate() {
int port = redirect_url.port();
int port_max = port + 10;
bool success = false;
forever {
Q_FOREVER {
server_->set_port(port);
if (server_->Listen()) {
success = true;

View File

@ -321,7 +321,7 @@ void Transcoder::Start() {
Q_EMIT LogLine(tr("Transcoding %1 files using %2 threads").arg(queued_jobs_.count()).arg(max_threads()));
forever {
Q_FOREVER {
StartJobStatus status = MaybeStartNextJob();
if (status == StartJobStatus::AllThreadsBusy || status == StartJobStatus::NoMoreJobs) break;
}