Commit d78f7d70 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added automatic backup and automatic backup interval to the GUI

parent 6422aa6f
......@@ -39,17 +39,17 @@ void VLMCSettingsDefault::load( const QString& part )
void VLMCSettingsDefault::loadVLMCDefaults( const QString& part )
{
SettingsManager* settingsMan = SettingsManager::getInstance();
QVariant defaultOutputPFS = "30";
QVariant defaultTrackNb = "64";
settingsMan->setValue( part,
"VLMCOutPutFPS", defaultOutputPFS );
"VLMCOutPutFPS", "30" );
settingsMan->setValue( part,
"VLMCTracksNb",
defaultTrackNb );
"64" );
settingsMan->setValue( part,
"VLMCWorkspace",
QDir::homePath() );
settingsMan->setValue( part, "AutomaticBackup", true );
settingsMan->setValue( part, "AutomaticBackupInterval", 5 );
return ;
}
......
......@@ -29,21 +29,41 @@ VLMCPreferences::VLMCPreferences( QWidget *parent )
: PreferenceWidget( parent )
{
m_ui.setupUi(this);
setAutomaticSaveLabelVisiblity( m_ui.automaticSave->isChecked() );
connect( m_ui.automaticSave, SIGNAL( stateChanged(int) ), this, SLOT( setAutomaticSaveLabelVisiblity( int ) ) );
}
VLMCPreferences::~VLMCPreferences() { }
VLMCPreferences::~VLMCPreferences()
{
}
void VLMCPreferences::setAutomaticSaveLabelVisiblity( int visible )
{
setAutomaticSaveLabelVisiblity( visible != 0 );
}
void VLMCPreferences::setAutomaticSaveLabelVisiblity( bool visible )
{
m_ui.automaticSaveInterval->setVisible( visible );
m_ui.automaticSaveIntervalLabel->setVisible( visible );
m_ui.minutesLabel->setVisible( visible );
}
void VLMCPreferences::load()
{
SettingsManager* settMan = SettingsManager::getInstance();
const QString& part = m_defaults ? "default" : m_settName;
QString outputFPS = settMan->getValue( part, "VLMCOutPutFPS" )->get().toString();
QString tracksNb = settMan->getValue( part, "VLMCTracksNb" )->get().toString();
QString outputFPS = settMan->getValue( part, "VLMCOutPutFPS" )->get().toString();
QString tracksNb = settMan->getValue( part, "VLMCTracksNb" )->get().toString();
bool autoSave = settMan->getValue( part, "AutomaticBackup" )->get().toBool();
QString autoSaveInterval = settMan->getValue( part, "AutomaticBackupInterval" )->get().toString();
m_ui.outputFPS->setText( outputFPS );
m_ui.tracksNb->setText( tracksNb );
m_ui.automaticSave->setChecked( autoSave );
m_ui.automaticSaveInterval->setText( autoSaveInterval );
setAutomaticSaveLabelVisiblity( autoSave );
}
void VLMCPreferences::save()
......@@ -51,7 +71,11 @@ void VLMCPreferences::save()
SettingsManager* settMan = SettingsManager::getInstance();
QVariant outputFPS( m_ui.outputFPS->text() );
QVariant tracksNb( m_ui.tracksNb->text() );
QVariant autoSave( m_ui.automaticSave->isChecked() );
QVariant autoSaveInterval( m_ui.automaticSaveInterval->text() );
settMan->setValue( m_settName, "VLMCOutPutFPS", outputFPS );
settMan->setValue( m_settName, "VLMCTracksNb", tracksNb );
settMan->setValue( m_settName, "AutomaticBackup", autoSave );
settMan->setValue( m_settName, "AutomaticBackupInterval", autoSaveInterval );
}
......@@ -30,12 +30,18 @@
class VLMCPreferences : public PreferenceWidget
{
//Q_OBJECT
Q_OBJECT
public:
VLMCPreferences( QWidget *parent = 0 );
~VLMCPreferences();
void load();
void save();
private slots:
void setAutomaticSaveLabelVisiblity( bool visible );
void setAutomaticSaveLabelVisiblity( int visible );
private:
Ui::VLMCPreferences m_ui;
};
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>140</height>
<width>415</width>
<height>304</height>
</rect>
</property>
<property name="windowTitle">
......@@ -21,7 +21,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QLineEdit" name="outputFPS">
<property name="text">
<string>25</string>
......@@ -38,7 +38,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="2">
<widget class="QLineEdit" name="tracksNb">
<property name="text">
<string>64</string>
......@@ -48,7 +48,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="6" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -61,6 +61,59 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="automaticSaveLabell">
<property name="text">
<string>Automatic save</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="automaticSave">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="automaticSaveIntervalLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatic save interval</string>
</property>
</widget>
</item>
<item row="3" column="2">
<layout class="QHBoxLayout" name="saveIntervalLabel">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLineEdit" name="automaticSaveInterval"/>
</item>
<item>
<widget class="QLabel" name="minutesLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>minutes</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment