[Summary] Updated Auto Lock Timer according to PRD

[Reviewed] GZharun
This commit is contained in:
nikolay 2014-08-11 13:11:37 +03:00
parent 65035584c9
commit 68b323a1a7
6 changed files with 37 additions and 27 deletions

View file

@ -1183,7 +1183,7 @@ Editor::lock_timeout_callback ()
if( !ARDOUR_UI::instance()->screen_lock_is_allowed() ) if( !ARDOUR_UI::instance()->screen_lock_is_allowed() )
return false; // Returning false will effectively disconnect us from the timer callback. return false; // Returning false will effectively disconnect us from the timer callback.
if (delta.tv_sec > ARDOUR_UI::config()->get_auto_lock_timer ()) if (delta.tv_sec >= 60 * ARDOUR_UI::config()->get_auto_lock_timer ())
{ {
lock (); lock ();
/* don't call again. Returning false will effectively /* don't call again. Returning false will effectively

View file

@ -93,7 +93,7 @@ TracksControlPanel::TracksControlPanel ()
, _bit_depth_combo (get_combo_box_text ("bit_depth_combo")) , _bit_depth_combo (get_combo_box_text ("bit_depth_combo"))
, _frame_rate_combo (get_combo_box_text ("frame_rate_combo")) , _frame_rate_combo (get_combo_box_text ("frame_rate_combo"))
, _browse_button(get_waves_button("browse_default_folder")) , _browse_button(get_waves_button("browse_default_folder"))
, _auto_lock_timer_spin_button(get_spin_button("auto_lock_timer_spin_button")) , _auto_lock_timer_combo(get_combo_box_text("auto_lock_timer_combo"))
, _have_control (false) , _have_control (false)
, _ignore_changes (0) , _ignore_changes (0)
{ {

View file

@ -74,9 +74,9 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
Gtk::ComboBoxText& _file_type_combo; Gtk::ComboBoxText& _file_type_combo;
Gtk::ComboBoxText& _bit_depth_combo; Gtk::ComboBoxText& _bit_depth_combo;
Gtk::ComboBoxText& _frame_rate_combo; Gtk::ComboBoxText& _frame_rate_combo;
Gtk::Label& _latency_label; Gtk::ComboBoxText& _auto_lock_timer_combo;
Gtk::Label& _latency_label;
Gtk::Label& _default_open_path; Gtk::Label& _default_open_path;
Gtk::SpinButton& _auto_lock_timer_spin_button;
#include "tracks_control_panel.logic.h" #include "tracks_control_panel.logic.h"
}; };

View file

@ -18,6 +18,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <stdio.h>
#include "tracks_control_panel.h" #include "tracks_control_panel.h"
#include "waves_button.h" #include "waves_button.h"
@ -47,6 +48,7 @@ using namespace Gtk;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
using namespace Glib; using namespace Glib;
using namespace std;
#define dbg_msg(a) MessageDialog (a, PROGRAM_NAME).run(); #define dbg_msg(a) MessageDialog (a, PROGRAM_NAME).run();
@ -150,7 +152,7 @@ TracksControlPanel::init ()
populate_file_type_combo(); populate_file_type_combo();
populate_bit_depth_combo(); populate_bit_depth_combo();
populate_frame_rate_combo(); populate_frame_rate_combo();
populate_auto_lock_timer(); populate_auto_lock_timer_combo();
_audio_settings_tab_button.set_active(true); _audio_settings_tab_button.set_active(true);
} }
@ -560,6 +562,29 @@ TracksControlPanel::populate_frame_rate_combo()
return; return;
} }
void
TracksControlPanel::populate_auto_lock_timer_combo()
{
using namespace std;
vector<string> lock_time_strings;
lock_time_strings.push_back("0 Min");
lock_time_strings.push_back("1 Min");
lock_time_strings.push_back("3 Min");
lock_time_strings.push_back("5 Min");
lock_time_strings.push_back("10 Min");
lock_time_strings.push_back("15 Min");
int time = ARDOUR_UI::config()->get_auto_lock_timer();
stringstream ss;
ss << time;
string str_time = ss.str() + " Min";
set_popdown_strings (_auto_lock_timer_combo, lock_time_strings);
_auto_lock_timer_combo.set_sensitive (lock_time_strings.size() > 1);
_auto_lock_timer_combo.set_active_text( str_time );
}
void void
TracksControlPanel::refresh_session_settings_info() TracksControlPanel::refresh_session_settings_info()
{ {
@ -575,23 +600,6 @@ TracksControlPanel::refresh_session_settings_info()
_frame_rate_combo.set_active_text( TimecodeFormat_to_string(session->config.get_timecode_format()) ); _frame_rate_combo.set_active_text( TimecodeFormat_to_string(session->config.get_timecode_format()) );
} }
void
TracksControlPanel::populate_auto_lock_timer()
{
using namespace std;
using namespace Gtk;
_auto_lock_timer_spin_button.set_max_length(3);
_auto_lock_timer_spin_button.set_numeric(true);
_auto_lock_timer_spin_button.set_update_policy(UPDATE_ALWAYS);
_auto_lock_timer_spin_button.set_range(0, 999);
_auto_lock_timer_spin_button.set_increments(1,1);
int time = ARDOUR_UI::config()->get_auto_lock_timer();
_auto_lock_timer_spin_button.set_value(time);
}
void void
TracksControlPanel::populate_default_session_path() TracksControlPanel::populate_default_session_path()
{ {
@ -1264,8 +1272,10 @@ TracksControlPanel::save_auto_lock_time()
{ {
using namespace std; using namespace std;
string s = _auto_lock_timer_spin_button.get_text(); string s = _auto_lock_timer_combo.get_active_text();
int time = atoi(s);
char * pEnd;
int time = strtol( s.c_str(), &pEnd, 10 );
ARDOUR_UI::config()->set_auto_lock_timer(time); ARDOUR_UI::config()->set_auto_lock_timer(time);
ARDOUR_UI::config()->save_state(); ARDOUR_UI::config()->save_state();

View file

@ -100,7 +100,7 @@
void populate_file_type_combo(); void populate_file_type_combo();
void populate_bit_depth_combo(); void populate_bit_depth_combo();
void populate_frame_rate_combo(); void populate_frame_rate_combo();
void populate_auto_lock_timer(); void populate_auto_lock_timer_combo();
// Engine State update callback handlers // Engine State update callback handlers
void on_port_registration_update(); void on_port_registration_update();

View file

@ -239,8 +239,8 @@
<Label style="generic_control" text="SESSION FRAME RATE" x="24" y="100"/> <Label style="generic_control" text="SESSION FRAME RATE" x="24" y="100"/>
<ComboBoxText style="generic_control" id="frame_rate_combo" x="215" y="100" width="150" height="20" /> <ComboBoxText style="generic_control" id="frame_rate_combo" x="215" y="100" width="150" height="20" />
<Label style="generic_control" text="AUTO LOCK TIMER" x="24" y="175"/> <Label style="generic_control" text="AUTO LOCK TIMER" x="24" y="175"/>
<SpinButton style="generic_control" id="auto_lock_timer_spin_button" x="215" y="175" width="150" height="20" /> <ComboBoxText style="generic_control" id="auto_lock_timer_combo" x="215" y="175" width="150" height="20" />
<Label style="generic_control" text="DEFAULT FOLDER FOR NEW SESSION" x = "24" y = "230" /> <Label style="generic_control" text="DEFAULT FOLDER FOR NEW SESSION" x = "24" y = "230" />
<Button <Button
id = "browse_default_folder" id = "browse_default_folder"