Auto save timer setting

This commit is contained in:
Oskar Wallgren
2016-01-23 06:11:49 +01:00
parent adb25eccad
commit cfb2c7201f
5 changed files with 141 additions and 22 deletions

View File

@@ -30,6 +30,7 @@
#include <QtCore/QList>
#include <QMainWindow>
#include "ConfigManager.h"
#include "SubWindow.h"
class QAction;
@@ -81,11 +82,31 @@ public:
///
bool mayChangeProject(bool stopPlayback);
void autoSaveTimerStart()
// Auto save timer intervals. The slider in SetupDialog.cpp wants
// minutes and the rest milliseconds.
static const int DEFAULT_SAVE_INTERVAL_MINUTES = 2;
static const int DEFAULT_AUTO_SAVE_INTERVAL = DEFAULT_SAVE_INTERVAL_MINUTES * 60 * 1000;
static const int m_autoSaveShortTime = 10 * 1000; // 10s short loop
void autoSaveTimerReset( int msec = ConfigManager::inst()->
value( "ui", "saveinterval" ).toInt()
* 60 * 1000 )
{
m_autoSaveTimer.start( 1000 * 60 ); // 1 minute
if( msec < m_autoSaveShortTime ) // No 'saveinterval' in .lmmsrc.xml
{
msec = DEFAULT_AUTO_SAVE_INTERVAL;
}
m_autoSaveTimer.start( msec );
}
int getAutoSaveTimerInterval()
{
return m_autoSaveTimer.interval();
}
void runAutoSave();
enum SessionState
{
Normal,
@@ -155,7 +176,6 @@ public slots:
void redo();
void autoSave();
void runAutoSave();
protected:
virtual void closeEvent( QCloseEvent * _ce );
@@ -204,6 +224,7 @@ private:
QBasicTimer m_updateTimer;
QTimer m_autoSaveTimer;
int m_autoSaveInterval;
friend class GuiApplication;

View File

@@ -44,7 +44,6 @@ class QSlider;
class TabBar;
class SetupDialog : public QDialog
{
Q_OBJECT
@@ -84,6 +83,11 @@ private slots:
void setDefaultSoundfont( const QString & _sf );
void setBackgroundArtwork( const QString & _ba );
// performance settings widget
void setAutoSaveInterval( int time );
void resetAutoSaveInterval();
void displaySaveIntervalHelp();
// audio settings widget
void audioInterfaceChanged( const QString & _driver );
void displayAudioHelp();
@@ -175,6 +179,10 @@ private:
bool m_smoothScroll;
bool m_enableAutoSave;
int m_saveInterval;
QSlider * m_saveIntervalSlider;
QLabel * m_saveIntervalLbl;
bool m_oneInstrumentTrackWindow;
bool m_compactTrackButtons;
bool m_syncVSTPlugins;