- // initialize sizes
- const int fontHeight = QFontMetrics(m_messageLabel->font()).height();
- const int zoomWidgetHeight = m_zoomWidget->minimumSizeHint().height();
- const int contentHeight = qMax(fontHeight, zoomWidgetHeight);
-
- m_messageLabel->setMinimumTextHeight(contentHeight);
- m_spaceInfo->setFixedHeight(contentHeight - 5);
- m_progressBar->setFixedSize(200, contentHeight);
- m_zoomWidget->setFixedSize(150, contentHeight);
-
+ m_showProgressBarTimer = new QTimer(this);
+ m_showProgressBarTimer->setInterval(500);
+ m_showProgressBarTimer->setSingleShot(true);
+ connect(m_showProgressBarTimer, &QTimer::timeout, this, &DolphinStatusBar::updateProgressInfo);
+
+ // initialize text updater delay timer
+ m_delayUpdateTimer = new QTimer(this);
+ m_delayUpdateTimer->setInterval(UpdateDelay);
+ m_delayUpdateTimer->setSingleShot(true);
+ connect(m_delayUpdateTimer, &QTimer::timeout,
+ this, &DolphinStatusBar::updateLabelText);
+
+ // Initialize top layout and size policies
+ const int fontHeight = QFontMetrics(m_label->font()).height();
+ const int zoomSliderHeight = m_zoomSlider->minimumSizeHint().height();
+ const int buttonHeight = m_stopButton->height();
+ const int contentHeight = qMax(qMax(fontHeight, zoomSliderHeight), buttonHeight);
+
+ QFontMetrics fontMetrics(m_label->font());
+
+ m_label->setFixedHeight(contentHeight);
+ m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+
+ m_zoomSlider->setMaximumWidth(fontMetrics.averageCharWidth() * 15);
+
+ m_spaceInfo->setFixedHeight(contentHeight);
+ m_spaceInfo->setMaximumWidth(fontMetrics.averageCharWidth() * 25);
+ m_spaceInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+
+ m_progressBar->setFixedHeight(zoomSliderHeight);
+ m_progressBar->setMaximumWidth(fontMetrics.averageCharWidth() * 20);
+
+ QHBoxLayout* topLayout = new QHBoxLayout(this);
+ topLayout->setContentsMargins(2, 0, 2, 0);
+ topLayout->setSpacing(4);
+ topLayout->addWidget(m_label, 1);
+ topLayout->addWidget(m_zoomLabel);
+ topLayout->addWidget(m_zoomSlider, 1);
+ topLayout->addWidget(m_spaceInfo, 1);
+ topLayout->addWidget(m_stopButton);
+ topLayout->addWidget(m_progressTextLabel);
+ topLayout->addWidget(m_progressBar);
+
+ setVisible(GeneralSettings::showStatusBar());