[vlmc-devel] Fix QTimer running with its interval of 0

Yikai Lu git at videolan.org
Mon Mar 7 17:10:00 CET 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Mar  8 00:49:22 2016 +0900| [a77f16f4f068912c519679cc1b28e2c890ebf0a1] | committer: Hugo Beauzée-Luyssen

Fix QTimer running with its interval of 0

By letting SettingValue "setLimits" and making it Clamped, we avoid it being 0.

Also, have QTimer run with the interval saved as SettingValue, not just start()

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/a77f16f4f068912c519679cc1b28e2c890ebf0a1
---

 src/Project/Project.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index 3800e51..6c36d83 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -60,7 +60,8 @@ Project::Project( Settings* settings )
     SettingValue    *automaticBackupInterval = settings->createVar( SettingValue::Int, "vlmc/AutomaticBackupInterval", 5,
                                     QT_TRANSLATE_NOOP( "PreferenceWidget", "Automatic save interval" ),
                                     QT_TRANSLATE_NOOP( "PreferenceWidget", "This is the interval that VLMC will wait "
-                                                       "between two automatic save" ), SettingValue::Nothing );
+                                                       "between two automatic save" ), SettingValue::Clamped );
+    automaticBackupInterval->setLimits(1, QVariant(QVariant::Invalid));
 
     connect( m_timer, SIGNAL( timeout() ), this, SLOT(autoSaveRequired() ) );
     connect( this, SIGNAL( destroyed() ), m_timer, SLOT( stop() ) );
@@ -69,8 +70,6 @@ Project::Project( Settings* settings )
              this, SLOT( autoSaveEnabledChanged( QVariant ) ) );
     connect( automaticBackupInterval, SIGNAL( changed( QVariant ) ), this,
              SLOT( autoSaveIntervalChanged( QVariant ) ) );
-
-    m_timer->start();
 }
 
 Project::~Project()



More information about the Vlmc-devel mailing list