mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +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 TIMER_MSEC 1000 /* periodic timer for gathering statistics */
|
||||||
|
#define STATUS_MSG_THROTTLE_MSEC 250
|
||||||
|
|
||||||
#ifndef COLLECTION_SIZE
|
#ifndef COLLECTION_SIZE
|
||||||
#define COLLECTION_SIZE 99999
|
#define COLLECTION_SIZE 99999
|
||||||
@ -805,6 +806,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
,m_allPlaylistsListMaxCount(0)
|
,m_allPlaylistsListMaxCount(0)
|
||||||
,m_allPlaylistsGridMaxCount(0)
|
,m_allPlaylistsGridMaxCount(0)
|
||||||
,m_playlistEntryDialog(NULL)
|
,m_playlistEntryDialog(NULL)
|
||||||
|
,m_statusMessageElapsedTimer()
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
QDir playlistDir(settings->paths.directory_playlist);
|
QDir playlistDir(settings->paths.directory_playlist);
|
||||||
@ -1036,6 +1038,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
m_searchLineEdit->setFocus();
|
m_searchLineEdit->setFocus();
|
||||||
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
|
m_statusMessageElapsedTimer.start();
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
||||||
#endif
|
#endif
|
||||||
@ -1784,7 +1788,14 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
|||||||
msecDuration = 1000;
|
msecDuration = 1000;
|
||||||
|
|
||||||
if (status->currentMessage().isEmpty() || flush)
|
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()
|
void MainWindow::deferReloadPlaylists()
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <retro_assert.h>
|
#include <retro_assert.h>
|
||||||
@ -480,6 +481,7 @@ private:
|
|||||||
int m_allPlaylistsListMaxCount;
|
int m_allPlaylistsListMaxCount;
|
||||||
int m_allPlaylistsGridMaxCount;
|
int m_allPlaylistsGridMaxCount;
|
||||||
PlaylistEntryDialog *m_playlistEntryDialog;
|
PlaylistEntryDialog *m_playlistEntryDialog;
|
||||||
|
QElapsedTimer m_statusMessageElapsedTimer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user