mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 17:10:12 +00:00
Qt: throttle status bar messages
This commit is contained in:
parent
fea09f7382
commit
2faa250174
@ -63,6 +63,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#define TIMER_MSEC 1000 /* periodic timer for gathering statistics */
|
||||
#define STATUS_MSG_THROTTLE_MSEC 250
|
||||
|
||||
#ifndef COLLECTION_SIZE
|
||||
#define COLLECTION_SIZE 99999
|
||||
@ -805,6 +806,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
,m_allPlaylistsListMaxCount(0)
|
||||
,m_allPlaylistsGridMaxCount(0)
|
||||
,m_playlistEntryDialog(NULL)
|
||||
,m_statusMessageElapsedTimer()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
@ -1036,6 +1038,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
m_searchLineEdit->setFocus();
|
||||
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
m_statusMessageElapsedTimer.start();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
||||
#endif
|
||||
@ -1784,7 +1788,14 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
||||
msecDuration = 1000;
|
||||
|
||||
if (status->currentMessage().isEmpty() || flush)
|
||||
status->showMessage(msg, msecDuration);
|
||||
{
|
||||
if (m_statusMessageElapsedTimer.elapsed() >= STATUS_MSG_THROTTLE_MSEC)
|
||||
{
|
||||
qint64 msgDuration = qMax(msecDuration, STATUS_MSG_THROTTLE_MSEC);
|
||||
m_statusMessageElapsedTimer.restart();
|
||||
status->showMessage(msg, msgDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::deferReloadPlaylists()
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QImage>
|
||||
#include <QPointer>
|
||||
#include <QProgressBar>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
extern "C" {
|
||||
#include <retro_assert.h>
|
||||
@ -480,6 +481,7 @@ private:
|
||||
int m_allPlaylistsListMaxCount;
|
||||
int m_allPlaylistsGridMaxCount;
|
||||
PlaylistEntryDialog *m_playlistEntryDialog;
|
||||
QElapsedTimer m_statusMessageElapsedTimer;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user