summaryrefslogtreecommitdiff
path: root/src/media_library.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2014-09-14 13:32:40 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2014-09-14 13:32:40 +0200
commit67f2903c42289cb2971868928b7a5b210ce4ac65 (patch)
tree6516e3707c9909a0ab878b29863068ee9eb6b18e /src/media_library.cpp
parent0efe79b47506f8885b216016ede180ca4c81db2f (diff)
settings: add option to disable data fetching delay in media library and playlist editor
Diffstat (limited to 'src/media_library.cpp')
-rw-r--r--src/media_library.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/media_library.cpp b/src/media_library.cpp
index 2ec1acf9..496cc3a6 100644
--- a/src/media_library.cpp
+++ b/src/media_library.cpp
@@ -48,9 +48,6 @@ MediaLibrary *myLibrary;
namespace {
-const auto ml_wtimeout = 250;
-const auto fetch_delay = boost::posix_time::milliseconds(ml_wtimeout);
-
bool hasTwoColumns;
size_t itsLeftColStartX;
size_t itsLeftColWidth;
@@ -149,6 +146,8 @@ public:
MediaLibrary::MediaLibrary()
: m_timer(boost::posix_time::from_time_t(0))
+, m_window_timeout(Config.data_fetching_delay ? 250 : 500)
+, m_fetching_delay(boost::posix_time::milliseconds(Config.data_fetching_delay ? 250 : -1))
{
hasTwoColumns = 0;
itsLeftColWidth = COLS/3-1;
@@ -342,7 +341,7 @@ void MediaLibrary::update()
}
if (!Tags.empty()
- && ((Albums.reallyEmpty() && Global::Timer - m_timer > fetch_delay) || m_albums_update_request)
+ && ((Albums.reallyEmpty() && Global::Timer - m_timer > m_fetching_delay) || m_albums_update_request)
)
{
Albums.clearSearchResults();
@@ -390,7 +389,7 @@ void MediaLibrary::update()
}
if (!Albums.empty()
- && ((Songs.reallyEmpty() && Global::Timer - m_timer > fetch_delay) || m_songs_update_request)
+ && ((Songs.reallyEmpty() && Global::Timer - m_timer > m_fetching_delay) || m_songs_update_request)
)
{
Songs.clearSearchResults();
@@ -427,7 +426,7 @@ void MediaLibrary::update()
int MediaLibrary::windowTimeout()
{
if (Albums.reallyEmpty() || Songs.reallyEmpty())
- return ml_wtimeout;
+ return m_window_timeout;
else
return Screen<WindowType>::windowTimeout();
}