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 ) ...@@ -39,17 +39,17 @@ void VLMCSettingsDefault::load( const QString& part )
void VLMCSettingsDefault::loadVLMCDefaults( const QString& part ) void VLMCSettingsDefault::loadVLMCDefaults( const QString& part )
{ {
SettingsManager* settingsMan = SettingsManager::getInstance(); SettingsManager* settingsMan = SettingsManager::getInstance();
QVariant defaultOutputPFS = "30";
QVariant defaultTrackNb = "64";
settingsMan->setValue( part, settingsMan->setValue( part,
"VLMCOutPutFPS", defaultOutputPFS ); "VLMCOutPutFPS", "30" );
settingsMan->setValue( part, settingsMan->setValue( part,
"VLMCTracksNb", "VLMCTracksNb",
defaultTrackNb ); "64" );
settingsMan->setValue( part, settingsMan->setValue( part,
"VLMCWorkspace", "VLMCWorkspace",
QDir::homePath() ); QDir::homePath() );
settingsMan->setValue( part, "AutomaticBackup", true );
settingsMan->setValue( part, "AutomaticBackupInterval", 5 );
return ; return ;
} }
......
...@@ -29,21 +29,41 @@ VLMCPreferences::VLMCPreferences( QWidget *parent ) ...@@ -29,21 +29,41 @@ VLMCPreferences::VLMCPreferences( QWidget *parent )
: PreferenceWidget( parent ) : PreferenceWidget( parent )
{ {
m_ui.setupUi(this); 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() void VLMCPreferences::load()
{ {
SettingsManager* settMan = SettingsManager::getInstance(); SettingsManager* settMan = SettingsManager::getInstance();
const QString& part = m_defaults ? "default" : m_settName; const QString& part = m_defaults ? "default" : m_settName;
QString outputFPS = settMan->getValue( part, "VLMCOutPutFPS" )->get().toString(); QString outputFPS = settMan->getValue( part, "VLMCOutPutFPS" )->get().toString();
QString tracksNb = settMan->getValue( part, "VLMCTracksNb" )->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.outputFPS->setText( outputFPS );
m_ui.tracksNb->setText( tracksNb ); m_ui.tracksNb->setText( tracksNb );
m_ui.automaticSave->setChecked( autoSave );
m_ui.automaticSaveInterval->setText( autoSaveInterval );
setAutomaticSaveLabelVisiblity( autoSave );
} }
void VLMCPreferences::save() void VLMCPreferences::save()
...@@ -51,7 +71,11 @@ void VLMCPreferences::save() ...@@ -51,7 +71,11 @@ void VLMCPreferences::save()
SettingsManager* settMan = SettingsManager::getInstance(); SettingsManager* settMan = SettingsManager::getInstance();
QVariant outputFPS( m_ui.outputFPS->text() ); QVariant outputFPS( m_ui.outputFPS->text() );
QVariant tracksNb( m_ui.tracksNb->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, "VLMCOutPutFPS", outputFPS );
settMan->setValue( m_settName, "VLMCTracksNb", tracksNb ); settMan->setValue( m_settName, "VLMCTracksNb", tracksNb );
settMan->setValue( m_settName, "AutomaticBackup", autoSave );
settMan->setValue( m_settName, "AutomaticBackupInterval", autoSaveInterval );
} }
...@@ -30,12 +30,18 @@ ...@@ -30,12 +30,18 @@
class VLMCPreferences : public PreferenceWidget class VLMCPreferences : public PreferenceWidget
{ {
//Q_OBJECT Q_OBJECT
public: public:
VLMCPreferences( QWidget *parent = 0 ); VLMCPreferences( QWidget *parent = 0 );
~VLMCPreferences(); ~VLMCPreferences();
void load(); void load();
void save(); void save();
private slots:
void setAutomaticSaveLabelVisiblity( bool visible );
void setAutomaticSaveLabelVisiblity( int visible );
private: private:
Ui::VLMCPreferences m_ui; Ui::VLMCPreferences m_ui;
}; };
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>415</width>
<height>140</height> <height>304</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QLineEdit" name="outputFPS"> <widget class="QLineEdit" name="outputFPS">
<property name="text"> <property name="text">
<string>25</string> <string>25</string>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="2">
<widget class="QLineEdit" name="tracksNb"> <widget class="QLineEdit" name="tracksNb">
<property name="text"> <property name="text">
<string>64</string> <string>64</string>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="6" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -61,6 +61,59 @@ ...@@ -61,6 +61,59 @@
</property> </property>
</spacer> </spacer>
</item> </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> </layout>
</widget> </widget>
<resources/> <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