Replace forever with Q_FOREVER
This commit is contained in:
parent
4ea57d1181
commit
80bea31b98
@ -293,7 +293,7 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
|||||||
QObject::connect(worker->process_, &QProcess::readyReadStandardError, this, &WorkerPool::ProcessReadyReadStandardError);
|
QObject::connect(worker->process_, &QProcess::readyReadStandardError, this, &WorkerPool::ProcessReadyReadStandardError);
|
||||||
|
|
||||||
// Create a server, find an unused name and start listening
|
// 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 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);
|
const QString name = QStringLiteral("%1_%2").arg(local_server_name_).arg(unique_number);
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ bool CommandlineOptions::Parse() {
|
|||||||
|
|
||||||
// Parse the arguments
|
// Parse the arguments
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
int c = getopt_long(argc_, argv_, L"hptusqrfv:c:alk:i:oyg:w:", kOptions, nullptr);
|
int c = getopt_long(argc_, argv_, L"hptusqrfv:c:alk:i:oyg:w:", kOptions, nullptr);
|
||||||
#else
|
#else
|
||||||
|
@ -131,7 +131,7 @@ void LocalRedirectServer::WriteTemplate() const {
|
|||||||
|
|
||||||
static const QRegularExpression tr_regexp(QStringLiteral("tr\\(\"([^\"]+)\"\\)"));
|
static const QRegularExpression tr_regexp(QStringLiteral("tr\\(\"([^\"]+)\"\\)"));
|
||||||
qint64 offset = 0;
|
qint64 offset = 0;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
QRegularExpressionMatch re_match = tr_regexp.match(page_data, offset);
|
QRegularExpressionMatch re_match = tr_regexp.match(page_data, offset);
|
||||||
if (!re_match.hasMatch()) break;
|
if (!re_match.hasMatch()) break;
|
||||||
offset = re_match.capturedStart();
|
offset = re_match.capturedStart();
|
||||||
|
@ -53,7 +53,7 @@ void StyleSheetLoader::SetStyleSheet(QWidget *widget, const QString &filename) {
|
|||||||
}
|
}
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
QString stylesheet;
|
QString stylesheet;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
QString line = stream.readLine();
|
QString line = stream.readLine();
|
||||||
stylesheet.append(line);
|
stylesheet.append(line);
|
||||||
if (stream.atEnd()) break;
|
if (stream.atEnd()) break;
|
||||||
|
@ -65,7 +65,7 @@ bool PulseDeviceFinder::Reconnect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the context to be connected.
|
// Wait for the context to be connected.
|
||||||
forever {
|
Q_FOREVER {
|
||||||
const pa_context_state state = pa_context_get_state(context_);
|
const pa_context_state state = pa_context_get_state(context_);
|
||||||
if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) {
|
if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) {
|
||||||
qLog(Warning) << "Connection to pulseaudio failed";
|
qLog(Warning) << "Connection to pulseaudio failed";
|
||||||
@ -90,7 +90,7 @@ retry:
|
|||||||
ListDevicesState state;
|
ListDevicesState state;
|
||||||
pa_context_get_sink_info_list(context_, &PulseDeviceFinder::GetSinkInfoCallback, &state);
|
pa_context_get_sink_info_list(context_, &PulseDeviceFinder::GetSinkInfoCallback, &state);
|
||||||
|
|
||||||
forever {
|
Q_FOREVER {
|
||||||
if (state.finished) {
|
if (state.finished) {
|
||||||
return state.devices;
|
return state.devices;
|
||||||
}
|
}
|
||||||
|
@ -1897,9 +1897,9 @@ void Playlist::RemoveItemsNotInQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
// Find a place to start - first row that isn't in the queue
|
// Find a place to start - first row that isn't in the queue
|
||||||
forever {
|
Q_FOREVER {
|
||||||
if (start >= rowCount()) return;
|
if (start >= rowCount()) return;
|
||||||
if (!queue_->ContainsSourceRow(start) && current_row() != start) break;
|
if (!queue_->ContainsSourceRow(start) && current_row() != start) break;
|
||||||
start++;
|
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
|
// Figure out how many rows to remove - keep going until we find a row that is in the queue
|
||||||
int count = 1;
|
int count = 1;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
if (start + count >= rowCount()) break;
|
if (start + count >= rowCount()) break;
|
||||||
if (queue_->ContainsSourceRow(start + count) || current_row() == start + count) break;
|
if (queue_->ContainsSourceRow(start + count) || current_row() == start + count) break;
|
||||||
count++;
|
count++;
|
||||||
|
@ -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;
|
QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QLatin1Char('.') + last_save_extension;
|
||||||
|
|
||||||
QFileInfo fileinfo;
|
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);
|
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;
|
if (filename.isEmpty()) return;
|
||||||
fileinfo.setFile(filename);
|
fileinfo.setFile(filename);
|
||||||
|
@ -62,7 +62,7 @@ SongList M3UParser::Load(QIODevice *device, const QString &playlist_path, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
SongList ret;
|
SongList ret;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
if (line.startsWith(QLatin1Char('#'))) {
|
if (line.startsWith(QLatin1Char('#'))) {
|
||||||
// Extended info or comment.
|
// Extended info or comment.
|
||||||
if (type == M3UType::EXTENDED && line.startsWith(QLatin1String("#EXT"))) {
|
if (type == M3UType::EXTENDED && line.startsWith(QLatin1String("#EXT"))) {
|
||||||
|
@ -253,7 +253,7 @@ void SpotifyService::Authenticate() {
|
|||||||
int port = redirect_url.port();
|
int port = redirect_url.port();
|
||||||
int port_max = port + 10;
|
int port_max = port + 10;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
forever {
|
Q_FOREVER {
|
||||||
server_->set_port(port);
|
server_->set_port(port);
|
||||||
if (server_->Listen()) {
|
if (server_->Listen()) {
|
||||||
success = true;
|
success = true;
|
||||||
|
@ -321,7 +321,7 @@ void Transcoder::Start() {
|
|||||||
|
|
||||||
Q_EMIT LogLine(tr("Transcoding %1 files using %2 threads").arg(queued_jobs_.count()).arg(max_threads()));
|
Q_EMIT LogLine(tr("Transcoding %1 files using %2 threads").arg(queued_jobs_.count()).arg(max_threads()));
|
||||||
|
|
||||||
forever {
|
Q_FOREVER {
|
||||||
StartJobStatus status = MaybeStartNextJob();
|
StartJobStatus status = MaybeStartNextJob();
|
||||||
if (status == StartJobStatus::AllThreadsBusy || status == StartJobStatus::NoMoreJobs) break;
|
if (status == StartJobStatus::AllThreadsBusy || status == StartJobStatus::NoMoreJobs) break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user