4545#include " Engine.h"
4646#include " debug.h"
4747#include " ToolTip.h"
48- # include " LedCheckbox.h "
48+
4949#include " LcdSpinBox.h"
5050#include " FileDialog.h"
5151
@@ -124,7 +124,8 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
124124#endif
125125 m_backgroundArtwork ( QDir::toNativeSeparators( ConfigManager::inst()->backgroundArtwork() ) ),
126126 m_smoothScroll( ConfigManager::inst()->value( " ui" , " smoothscroll" ).toInt() ),
127- m_enableAutoSave( ConfigManager::inst()->value( " ui" , " enableautosave" ).toInt() ),
127+ m_disableAutoSave( !ConfigManager::inst()->value( " ui" , " disableautosave" ).toInt() ),
128+ m_disableRunningAutoSave( !ConfigManager::inst()->value( " ui" , " disablerunningautosave" ).toInt() ),
128129 m_saveInterval( ConfigManager::inst()->value( " ui" , " saveinterval" ).toInt() < 1 ?
129130 MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES :
130131 ConfigManager::inst()->value( " ui" , " saveinterval" ).toInt() ),
@@ -645,7 +646,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
645646
646647 TabWidget * auto_save_tw = new TabWidget (
647648 tr ( " Auto save" ).toUpper (), performance );
648- auto_save_tw->setFixedHeight ( 100 );
649+ auto_save_tw->setFixedHeight ( 110 );
649650
650651 m_saveIntervalSlider = new QSlider ( Qt::Horizontal, auto_save_tw );
651652 m_saveIntervalSlider->setRange ( 1 , 20 );
@@ -662,25 +663,37 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
662663 m_saveIntervalLbl->setGeometry ( 10 , 40 , 200 , 24 );
663664 setAutoSaveInterval ( m_saveIntervalSlider->value () );
664665
665- LedCheckBox * autoSave = new LedCheckBox (
666- tr ( " Enable auto save feature " ), auto_save_tw );
667- autoSave ->move ( 10 , 70 );
668- autoSave ->setChecked ( m_enableAutoSave );
669- connect ( autoSave , SIGNAL ( toggled ( bool ) ),
666+ m_autoSave = new LedCheckBox (
667+ tr ( " Enable auto- save" ), auto_save_tw );
668+ m_autoSave ->move ( 10 , 70 );
669+ m_autoSave ->setChecked ( m_disableAutoSave );
670+ connect ( m_autoSave , SIGNAL ( toggled ( bool ) ),
670671 this , SLOT ( toggleAutoSave ( bool ) ) );
671- if ( ! m_enableAutoSave ){ m_saveIntervalSlider->setEnabled ( false ); }
672672
673- QPushButton * saveIntervalResetBtn = new QPushButton (
673+ m_runningAutoSave = new LedCheckBox (
674+ tr ( " Allow auto-save while playing" ), auto_save_tw );
675+ m_runningAutoSave->move ( 20 , 90 );
676+ m_runningAutoSave->setChecked ( m_disableRunningAutoSave );
677+ connect ( m_runningAutoSave, SIGNAL ( toggled ( bool ) ),
678+ this , SLOT ( toggleRunningAutoSave ( bool ) ) );
679+
680+ if ( ! m_disableAutoSave )
681+ {
682+ m_saveIntervalSlider->setEnabled ( false );
683+ m_runningAutoSave->setHidden ( true );
684+ }
685+
686+ QPushButton * autoSaveResetBtn = new QPushButton (
674687 embed::getIconPixmap ( " reload" ), " " , auto_save_tw );
675- saveIntervalResetBtn ->setGeometry ( 290 , 50 , 28 , 28 );
676- connect ( saveIntervalResetBtn , SIGNAL ( clicked () ), this ,
677- SLOT ( resetAutoSaveInterval () ) );
688+ autoSaveResetBtn ->setGeometry ( 290 , 70 , 28 , 28 );
689+ connect ( autoSaveResetBtn , SIGNAL ( clicked () ), this ,
690+ SLOT ( resetAutoSave () ) );
678691 ToolTip::add ( bufsize_reset_btn, tr ( " Reset to default-value" ) );
679692
680- QPushButton * saventervalBtn = new QPushButton (
693+ QPushButton * saveIntervalBtn = new QPushButton (
681694 embed::getIconPixmap ( " help" ), " " , auto_save_tw );
682- saventervalBtn ->setGeometry ( 320 , 50 , 28 , 28 );
683- connect ( saventervalBtn , SIGNAL ( clicked () ), this ,
695+ saveIntervalBtn ->setGeometry ( 320 , 70 , 28 , 28 );
696+ connect ( saveIntervalBtn , SIGNAL ( clicked () ), this ,
684697 SLOT ( displaySaveIntervalHelp () ) );
685698
686699 perf_layout->addWidget ( auto_save_tw );
@@ -1017,10 +1030,12 @@ void SetupDialog::accept()
10171030 QString::number ( m_hqAudioDev ) );
10181031 ConfigManager::inst ()->setValue ( " ui" , " smoothscroll" ,
10191032 QString::number ( m_smoothScroll ) );
1020- ConfigManager::inst ()->setValue ( " ui" , " enableautosave " ,
1021- QString::number ( m_enableAutoSave ) );
1033+ ConfigManager::inst ()->setValue ( " ui" , " disableautosave " ,
1034+ QString::number ( !m_disableAutoSave ) );
10221035 ConfigManager::inst ()->setValue ( " ui" , " saveinterval" ,
10231036 QString::number ( m_saveInterval ) );
1037+ ConfigManager::inst ()->setValue ( " ui" , " disablerunningautosave" ,
1038+ QString::number ( !m_disableRunningAutoSave ) );
10241039 ConfigManager::inst ()->setValue ( " ui" , " oneinstrumenttrackwindow" ,
10251040 QString::number ( m_oneInstrumentTrackWindow ) );
10261041 ConfigManager::inst ()->setValue ( " ui" , " compacttrackbuttons" ,
@@ -1202,13 +1217,21 @@ void SetupDialog::toggleSmoothScroll( bool _enabled )
12021217
12031218void SetupDialog::toggleAutoSave ( bool _enabled )
12041219{
1205- m_enableAutoSave = _enabled;
1220+ m_disableAutoSave = _enabled;
12061221 m_saveIntervalSlider->setEnabled ( _enabled );
1222+ m_runningAutoSave->setHidden ( ! _enabled );
1223+ setAutoSaveInterval ( m_saveIntervalSlider->value () );
12071224}
12081225
12091226
12101227
12111228
1229+ void SetupDialog::toggleRunningAutoSave ( bool _enabled )
1230+ {
1231+ m_disableRunningAutoSave = _enabled;
1232+ }
1233+
1234+
12121235
12131236
12141237void SetupDialog::toggleCompactTrackButtons ( bool _enabled )
@@ -1489,20 +1512,19 @@ void SetupDialog::setAutoSaveInterval( int value )
14891512 m_saveInterval = value;
14901513 m_saveIntervalSlider->setValue ( m_saveInterval );
14911514 QString minutes = m_saveInterval > 1 ? tr ( " minutes" ) : tr ( " minute" );
1492- m_saveIntervalLbl->setText ( tr ( " Auto save interval: %1 %2" ).arg (
1493- QString::number ( m_saveInterval ), minutes ) );
1515+ minutes = QString ( " %1 %2" ).arg ( QString::number ( m_saveInterval ), minutes );
1516+ minutes = m_disableAutoSave ? minutes : tr ( " Disabled" );
1517+ m_saveIntervalLbl->setText ( tr ( " Auto-save interval: %1" ).arg ( minutes ) );
14941518}
14951519
14961520
14971521
14981522
1499- void SetupDialog::resetAutoSaveInterval ()
1523+ void SetupDialog::resetAutoSave ()
15001524{
1501- if ( m_enableAutoSave )
1502- {
1503- setAutoSaveInterval ( MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES );
1504- }
1505-
1525+ setAutoSaveInterval ( MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES );
1526+ m_autoSave->setChecked ( true );
1527+ m_runningAutoSave->setChecked ( true );
15061528}
15071529
15081530
@@ -1512,7 +1534,9 @@ void SetupDialog::displaySaveIntervalHelp()
15121534{
15131535 QWhatsThis::showText ( QCursor::pos (),
15141536 tr ( " Set the time between automatic backup to %1.\n "
1515- " Remember to also save your project manually." ).arg (
1537+ " Remember to also save your project manually. "
1538+ " You can also choose to allow saving while playing, "
1539+ " something some older systems find difficult." ).arg (
15161540 ConfigManager::inst ()->recoveryFile () ) );
15171541}
15181542
0 commit comments