-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to allow auto save while playing #3088
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
#include "Engine.h" | ||
#include "debug.h" | ||
#include "ToolTip.h" | ||
#include "LedCheckbox.h" | ||
|
||
#include "LcdSpinBox.h" | ||
#include "FileDialog.h" | ||
|
||
|
@@ -124,7 +124,8 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) : | |
#endif | ||
m_backgroundArtwork( QDir::toNativeSeparators( ConfigManager::inst()->backgroundArtwork() ) ), | ||
m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() ), | ||
m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() ), | ||
m_disableAutoSave( !ConfigManager::inst()->value( "ui", "disableautosave" ).toInt() ), | ||
m_disableRunningAutoSave( !ConfigManager::inst()->value( "ui", "disablerunningautosave" ).toInt() ), | ||
m_saveInterval( ConfigManager::inst()->value( "ui", "saveinterval" ).toInt() < 1 ? | ||
MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES : | ||
ConfigManager::inst()->value( "ui", "saveinterval" ).toInt() ), | ||
|
@@ -645,7 +646,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) : | |
|
||
TabWidget * auto_save_tw = new TabWidget( | ||
tr( "Auto save" ).toUpper(), performance ); | ||
auto_save_tw->setFixedHeight( 100 ); | ||
auto_save_tw->setFixedHeight( 110 ); | ||
|
||
m_saveIntervalSlider = new QSlider( Qt::Horizontal, auto_save_tw ); | ||
m_saveIntervalSlider->setRange( 1, 20 ); | ||
|
@@ -662,27 +663,37 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) : | |
m_saveIntervalLbl->setGeometry( 10, 40, 200, 24 ); | ||
setAutoSaveInterval( m_saveIntervalSlider->value() ); | ||
|
||
LedCheckBox * autoSave = new LedCheckBox( | ||
tr( "Enable auto save feature" ), auto_save_tw ); | ||
autoSave->move( 10, 70 ); | ||
autoSave->setChecked( m_enableAutoSave ); | ||
connect( autoSave, SIGNAL( toggled( bool ) ), | ||
m_autoSave = new LedCheckBox( | ||
tr( "Enable auto-save" ), auto_save_tw ); | ||
m_autoSave->move( 10, 70 ); | ||
m_autoSave->setChecked( m_disableAutoSave ); | ||
connect( m_autoSave, SIGNAL( toggled( bool ) ), | ||
this, SLOT( toggleAutoSave( bool ) ) ); | ||
if( ! m_enableAutoSave ){ m_saveIntervalSlider->setEnabled( false ); } | ||
|
||
QPushButton * saveIntervalResetBtn = new QPushButton( | ||
m_runningAutoSave = new LedCheckBox( | ||
tr( "Allow auto-save while playing" ), auto_save_tw ); | ||
m_runningAutoSave->move( 20, 90 ); | ||
m_runningAutoSave->setChecked( m_disableRunningAutoSave ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
connect( m_runningAutoSave, SIGNAL( toggled( bool ) ), | ||
this, SLOT( toggleRunningAutoSave( bool ) ) ); | ||
|
||
QPushButton * autoSaveResetBtn = new QPushButton( | ||
embed::getIconPixmap( "reload" ), "", auto_save_tw ); | ||
saveIntervalResetBtn->setGeometry( 290, 50, 28, 28 ); | ||
connect( saveIntervalResetBtn, SIGNAL( clicked() ), this, | ||
SLOT( resetAutoSaveInterval() ) ); | ||
ToolTip::add( bufsize_reset_btn, tr( "Reset to default-value" ) ); | ||
autoSaveResetBtn->setGeometry( 290, 70, 28, 28 ); | ||
connect( autoSaveResetBtn, SIGNAL( clicked() ), this, | ||
SLOT( resetAutoSave() ) ); | ||
ToolTip::add( autoSaveResetBtn, tr( "Reset to default-value" ) ); | ||
|
||
QPushButton * saventervalBtn = new QPushButton( | ||
QPushButton * saveIntervalBtn = new QPushButton( | ||
embed::getIconPixmap( "help" ), "", auto_save_tw ); | ||
saventervalBtn->setGeometry( 320, 50, 28, 28 ); | ||
connect( saventervalBtn, SIGNAL( clicked() ), this, | ||
saveIntervalBtn->setGeometry( 320, 70, 28, 28 ); | ||
connect( saveIntervalBtn, SIGNAL( clicked() ), this, | ||
SLOT( displaySaveIntervalHelp() ) ); | ||
|
||
m_saveIntervalSlider->setEnabled( m_disableAutoSave ); | ||
m_runningAutoSave->setVisible( m_disableAutoSave ); | ||
|
||
|
||
perf_layout->addWidget( auto_save_tw ); | ||
perf_layout->addSpacing( 10 ); | ||
|
||
|
@@ -825,7 +836,6 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) : | |
|
||
|
||
|
||
|
||
QWidget * midi = new QWidget( ws ); | ||
QVBoxLayout * midi_layout = new QVBoxLayout( midi ); | ||
midi_layout->setSpacing( 0 ); | ||
|
@@ -1017,10 +1027,12 @@ void SetupDialog::accept() | |
QString::number( m_hqAudioDev ) ); | ||
ConfigManager::inst()->setValue( "ui", "smoothscroll", | ||
QString::number( m_smoothScroll ) ); | ||
ConfigManager::inst()->setValue( "ui", "enableautosave", | ||
QString::number( m_enableAutoSave ) ); | ||
ConfigManager::inst()->setValue( "ui", "disableautosave", | ||
QString::number( !m_disableAutoSave ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
ConfigManager::inst()->setValue( "ui", "saveinterval", | ||
QString::number( m_saveInterval ) ); | ||
ConfigManager::inst()->setValue( "ui", "disablerunningautosave", | ||
QString::number( !m_disableRunningAutoSave ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idem. |
||
ConfigManager::inst()->setValue( "ui", "oneinstrumenttrackwindow", | ||
QString::number( m_oneInstrumentTrackWindow ) ); | ||
ConfigManager::inst()->setValue( "ui", "compacttrackbuttons", | ||
|
@@ -1200,15 +1212,25 @@ void SetupDialog::toggleSmoothScroll( bool _enabled ) | |
|
||
|
||
|
||
|
||
void SetupDialog::toggleAutoSave( bool _enabled ) | ||
{ | ||
m_enableAutoSave = _enabled; | ||
m_disableAutoSave = _enabled; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. disable means enable, etc. |
||
m_saveIntervalSlider->setEnabled( _enabled ); | ||
m_runningAutoSave->setVisible( _enabled ); | ||
setAutoSaveInterval( m_saveIntervalSlider->value() ); | ||
} | ||
|
||
|
||
|
||
|
||
void SetupDialog::toggleRunningAutoSave( bool _enabled ) | ||
{ | ||
m_disableRunningAutoSave = _enabled; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
void SetupDialog::toggleCompactTrackButtons( bool _enabled ) | ||
|
@@ -1489,20 +1511,19 @@ void SetupDialog::setAutoSaveInterval( int value ) | |
m_saveInterval = value; | ||
m_saveIntervalSlider->setValue( m_saveInterval ); | ||
QString minutes = m_saveInterval > 1 ? tr( "minutes" ) : tr( "minute" ); | ||
m_saveIntervalLbl->setText( tr( "Auto save interval: %1 %2" ).arg( | ||
QString::number( m_saveInterval ), minutes ) ); | ||
minutes = QString( "%1 %2" ).arg( QString::number( m_saveInterval ), minutes ); | ||
minutes = m_disableAutoSave ? minutes : tr( "Disabled" ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If not disable, it is disabled. |
||
m_saveIntervalLbl->setText( tr( "Auto-save interval: %1" ).arg( minutes ) ); | ||
} | ||
|
||
|
||
|
||
|
||
void SetupDialog::resetAutoSaveInterval() | ||
void SetupDialog::resetAutoSave() | ||
{ | ||
if( m_enableAutoSave ) | ||
{ | ||
setAutoSaveInterval( MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES ); | ||
} | ||
|
||
setAutoSaveInterval( MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES ); | ||
m_autoSave->setChecked( true ); | ||
m_runningAutoSave->setChecked( true ); | ||
} | ||
|
||
|
||
|
@@ -1512,7 +1533,9 @@ void SetupDialog::displaySaveIntervalHelp() | |
{ | ||
QWhatsThis::showText( QCursor::pos(), | ||
tr( "Set the time between automatic backup to %1.\n" | ||
"Remember to also save your project manually." ).arg( | ||
"Remember to also save your project manually. " | ||
"You can also choose to disable saving while playing, " | ||
"something some older systems find difficult." ).arg( | ||
ConfigManager::inst()->recoveryFile() ) ); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double negations should be avoided; "enable" should be preferred over "disable". This code does not make sense, because it looks like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm looking at clearing this up now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed