mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-24 10:16:00 +03:00
Suppress remove null widget warning
And improve text format for translation work.
This commit is contained in:
parent
e45e29b431
commit
8a7179195f
1 changed files with 18 additions and 8 deletions
|
@ -752,21 +752,31 @@ void PropertiesWidget::configure()
|
|||
// Speed widget
|
||||
if (Preferences::instance()->isSpeedWidgetEnabled())
|
||||
{
|
||||
if (!m_speedWidget || !qobject_cast<SpeedWidget *>(m_speedWidget))
|
||||
if (!qobject_cast<SpeedWidget *>(m_speedWidget))
|
||||
{
|
||||
m_ui->speedLayout->removeWidget(m_speedWidget);
|
||||
delete m_speedWidget;
|
||||
m_speedWidget = new SpeedWidget {this};
|
||||
if (m_speedWidget)
|
||||
{
|
||||
m_ui->speedLayout->removeWidget(m_speedWidget);
|
||||
delete m_speedWidget;
|
||||
}
|
||||
|
||||
m_speedWidget = new SpeedWidget(this);
|
||||
m_ui->speedLayout->addWidget(m_speedWidget);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_speedWidget || !qobject_cast<QLabel *>(m_speedWidget))
|
||||
if (!qobject_cast<QLabel *>(m_speedWidget))
|
||||
{
|
||||
m_ui->speedLayout->removeWidget(m_speedWidget);
|
||||
delete m_speedWidget;
|
||||
auto *label = new QLabel(tr("<center><b>Speed graphs are disabled</b><p>You may change this setting in Advanced Options </center>"), this);
|
||||
if (m_speedWidget)
|
||||
{
|
||||
m_ui->speedLayout->removeWidget(m_speedWidget);
|
||||
delete m_speedWidget;
|
||||
}
|
||||
|
||||
const auto displayText = QString::fromLatin1("<center><b>%1</b><p>%2</p></center>")
|
||||
.arg(tr("Speed graphs are disabled"), tr("You can enable it in Advanced Options"));
|
||||
auto *label = new QLabel(displayText, this);
|
||||
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
m_speedWidget = label;
|
||||
m_ui->speedLayout->addWidget(m_speedWidget);
|
||||
|
|
Loading…
Reference in a new issue