gui: Add UI controls for changing pause status
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
1c99042efd
commit
05148ba832
|
@ -22,6 +22,17 @@ void get_object(const std::string &, Glib::RefPtr<T> &);
|
|||
/*
|
||||
* Control functions
|
||||
*/
|
||||
static void on_config_pause()
|
||||
{
|
||||
Gtk::SpinButton *count;
|
||||
Gtk::CheckButton *enabled;
|
||||
|
||||
builder->get_widget("o_pause_count", count);
|
||||
builder->get_widget("o_pause_enabled", enabled);
|
||||
|
||||
audio :: pause_after(enabled->get_active(), count->get_value());
|
||||
}
|
||||
|
||||
static void on_play()
|
||||
{
|
||||
get_button("o_play")->hide();
|
||||
|
@ -51,6 +62,19 @@ static void on_track_loaded(library :: Song &song)
|
|||
duration->set_text(song.track->length_str);
|
||||
}
|
||||
|
||||
static void on_pause_count_changed(bool enabled, unsigned int count)
|
||||
{
|
||||
Gtk::CheckButton *p_enabled;
|
||||
Gtk::SpinButton *p_count;
|
||||
builder->get_widget("o_pause_enabled", p_enabled);
|
||||
builder->get_widget("o_pause_count", p_count);
|
||||
|
||||
if (p_enabled->get_active() != enabled)
|
||||
p_enabled->set_active(enabled);
|
||||
if (p_count->get_value() != count)
|
||||
p_count->set_value(count);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Collection manager functions
|
||||
|
@ -258,6 +282,8 @@ Gtk::Window *connect_wires()
|
|||
Glib::RefPtr<Gtk::ListStore> list;
|
||||
Glib::RefPtr<Gtk::CellRendererToggle> toggle;
|
||||
Gtk::TreeView *treeview;
|
||||
Gtk::SpinButton *count;
|
||||
Gtk::CheckButton *enabled;
|
||||
|
||||
builder = Gtk::Builder::create();
|
||||
builder->add_from_file("gui/ocarina6.glade");
|
||||
|
@ -268,6 +294,13 @@ Gtk::Window *connect_wires()
|
|||
cb->on_play = on_play;
|
||||
cb->on_pause = on_pause;
|
||||
cb->on_track_loaded = on_track_loaded;
|
||||
cb->on_pause_count_changed = on_pause_count_changed;
|
||||
|
||||
builder->get_widget("o_pause_count", count);
|
||||
builder->get_widget("o_pause_enabled", enabled);
|
||||
count->signal_changed().connect(sigc::ptr_fun(on_config_pause));
|
||||
enabled->signal_toggled().connect(sigc::ptr_fun(on_config_pause));
|
||||
|
||||
connect_button("o_play", audio::play);
|
||||
connect_button("o_pause", audio::pause);
|
||||
connect_button("o_stop", audio::stop);
|
||||
|
|
|
@ -48,6 +48,34 @@ void change_page(unsigned int page)
|
|||
notebook->set_current_page(page);
|
||||
}
|
||||
|
||||
void pause_toggle()
|
||||
{
|
||||
Gtk::CheckButton *check;
|
||||
get_builder()->get_widget("o_pause_enabled", check);
|
||||
check->set_active(!check->get_active());
|
||||
}
|
||||
|
||||
void inc_pause()
|
||||
{
|
||||
Gtk::SpinButton *spin;
|
||||
get_builder()->get_widget("o_pause_count", spin);
|
||||
spin->spin(Gtk::SPIN_STEP_FORWARD, 1);
|
||||
}
|
||||
|
||||
void dec_pause()
|
||||
{
|
||||
Gtk::SpinButton *spin;
|
||||
get_builder()->get_widget("o_pause_count", spin);
|
||||
spin->spin(Gtk::SPIN_STEP_BACKWARD, 1);
|
||||
}
|
||||
|
||||
void set_pause(unsigned int value)
|
||||
{
|
||||
Gtk::SpinButton *spin;
|
||||
get_builder()->get_widget("o_pause_count", spin);
|
||||
spin->set_value(value);
|
||||
}
|
||||
|
||||
/* Library tab tests */
|
||||
bool test_1()
|
||||
{
|
||||
|
@ -106,9 +134,34 @@ bool test_1()
|
|||
click_button("o_play");
|
||||
break;
|
||||
case 20:
|
||||
pause_toggle();
|
||||
break;
|
||||
case 21:
|
||||
pause_toggle();
|
||||
break;
|
||||
case 22:
|
||||
inc_pause();
|
||||
break;
|
||||
case 23:
|
||||
inc_pause();
|
||||
break;
|
||||
case 24:
|
||||
pause_toggle();
|
||||
break;
|
||||
case 25:
|
||||
dec_pause();
|
||||
break;
|
||||
case 26:
|
||||
dec_pause();
|
||||
break;
|
||||
case 27:
|
||||
set_pause(3);
|
||||
break;
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
case 32:
|
||||
break;
|
||||
default:
|
||||
end_test();
|
||||
|
|
Loading…
Reference in New Issue