UI: Fix Qt 5.14 deprecation warnings

These functions should be available on current Qt.
master
jpark37 2020-01-20 22:13:16 -08:00
parent 500111e230
commit 263bf48baa
4 changed files with 15 additions and 14 deletions

View File

@ -180,8 +180,8 @@ void OutputTimer::UpdateStreamTimerDisplay()
int minutes = (remainingTime % 3600) / 60; int minutes = (remainingTime % 3600) / 60;
int hours = remainingTime / 3600; int hours = remainingTime / 3600;
QString text; QString text =
text.sprintf("%02d:%02d:%02d", hours, minutes, seconds); QString::asprintf("%02d:%02d:%02d", hours, minutes, seconds);
ui->streamTime->setText(text); ui->streamTime->setText(text);
} }
@ -199,8 +199,8 @@ void OutputTimer::UpdateRecordTimerDisplay()
int minutes = (remainingTime % 3600) / 60; int minutes = (remainingTime % 3600) / 60;
int hours = remainingTime / 3600; int hours = remainingTime / 3600;
QString text; QString text =
text.sprintf("%02d:%02d:%02d", hours, minutes, seconds); QString::asprintf("%02d:%02d:%02d", hours, minutes, seconds);
ui->recordTime->setText(text); ui->recordTime->setText(text);
} }

View File

@ -898,7 +898,7 @@ void OBSBasicSettings::LoadFormats()
audio ? AUDIO_STR : VIDEO_STR); audio ? AUDIO_STR : VIDEO_STR);
ui->advOutFFFormat->addItem( ui->advOutFFFormat->addItem(
itemText, qVariantFromValue(formatDesc)); itemText, QVariant::fromValue(formatDesc));
} }
format = ff_format_desc_next(format); format = ff_format_desc_next(format);
@ -921,7 +921,7 @@ static void AddCodec(QComboBox *combo, const ff_codec_desc *codec_desc)
CodecDesc cd(ff_codec_desc_name(codec_desc), CodecDesc cd(ff_codec_desc_name(codec_desc),
ff_codec_desc_id(codec_desc)); ff_codec_desc_id(codec_desc));
combo->addItem(itemText, qVariantFromValue(cd)); combo->addItem(itemText, QVariant::fromValue(cd));
} }
#define AV_ENCODER_DEFAULT_STR \ #define AV_ENCODER_DEFAULT_STR \
@ -937,7 +937,7 @@ static void AddDefaultCodec(QComboBox *combo, const ff_format_desc *formatDesc,
combo->removeItem(existingIdx); combo->removeItem(existingIdx);
combo->addItem(QString("%1 (%2)").arg(cd.name, AV_ENCODER_DEFAULT_STR), combo->addItem(QString("%1 (%2)").arg(cd.name, AV_ENCODER_DEFAULT_STR),
qVariantFromValue(cd)); QVariant::fromValue(cd));
} }
#define AV_ENCODER_DISABLE_STR \ #define AV_ENCODER_DISABLE_STR \
@ -984,7 +984,7 @@ void OBSBasicSettings::ReloadCodecs(const ff_format_desc *formatDesc)
ui->advOutFFAEncoder->model()->sort(0); ui->advOutFFAEncoder->model()->sort(0);
ui->advOutFFVEncoder->model()->sort(0); ui->advOutFFVEncoder->model()->sort(0);
QVariant disable = qVariantFromValue(CodecDesc()); QVariant disable = QVariant::fromValue(CodecDesc());
ui->advOutFFAEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable); ui->advOutFFAEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable);
ui->advOutFFVEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable); ui->advOutFFVEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable);

View File

@ -437,8 +437,8 @@ void OBSBasicStats::RecordingTimeLeft()
int minutes = totalMinutes % 60; int minutes = totalMinutes % 60;
int hours = totalMinutes / 60; int hours = totalMinutes / 60;
QString text; QString text = QString::asprintf("%d %s, %d %s", hours,
text.sprintf("%d %s, %d %s", hours, QT_TO_UTF8(QTStr("Hours")), minutes, QT_TO_UTF8(QTStr("Hours")), minutes,
QT_TO_UTF8(QTStr("Minutes"))); QT_TO_UTF8(QTStr("Minutes")));
recordTimeLeft->setText(text); recordTimeLeft->setText(text);
recordTimeLeft->setMinimumWidth(recordTimeLeft->width()); recordTimeLeft->setMinimumWidth(recordTimeLeft->width());

View File

@ -215,8 +215,8 @@ void OBSBasicStatusBar::UpdateStreamTime()
int minutes = totalMinutes % 60; int minutes = totalMinutes % 60;
int hours = totalMinutes / 60; int hours = totalMinutes / 60;
QString text; QString text = QString::asprintf("LIVE: %02d:%02d:%02d", hours, minutes,
text.sprintf("LIVE: %02d:%02d:%02d", hours, minutes, seconds); seconds);
streamTime->setText(text); streamTime->setText(text);
streamTime->setMinimumWidth(streamTime->width()); streamTime->setMinimumWidth(streamTime->width());
@ -260,7 +260,8 @@ void OBSBasicStatusBar::UpdateRecordTime()
int minutes = totalMinutes % 60; int minutes = totalMinutes % 60;
int hours = totalMinutes / 60; int hours = totalMinutes / 60;
text.sprintf("REC: %02d:%02d:%02d", hours, minutes, seconds); text = QString::asprintf("REC: %02d:%02d:%02d", hours, minutes,
seconds);
} }
recordTime->setText(text); recordTime->setText(text);