From b0d2b24c6f552b5a54b0f3c3c2b00d596a5ad9c1 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Fri, 24 Jun 2022 09:37:33 -0300 Subject: Change model Part to Segment --- bass_player.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'bass_player.rb') diff --git a/bass_player.rb b/bass_player.rb index 6cb73c4..b625523 100644 --- a/bass_player.rb +++ b/bass_player.rb @@ -12,7 +12,7 @@ module BassPlayer property(:duration) { '' } property(:current_song) { 0 } property(:model) { QML::ArrayModel.new(:title, :duration) } - property(:part_model) { + property(:segment_model) { QML::ArrayModel.new(:name, :from, :to) } @@ -54,23 +54,23 @@ module BassPlayer self.current_song = model[song][:title] puts "Setting current song to #{self.current_song}" end - part_model.clear - parts = Song.first(title: self.current_song).parts.map do |part| + segment_model.clear + segments = Song.first(title: self.current_song).segments.map do |segment| { - name: part.name, - from: ms_to_time(part.from), - to: ms_to_time(part.to) + name: segment.name, + from: ms_to_time(segment.from), + to: ms_to_time(segment.to) } end - for part in parts - part_model << part + for segment in segments + segment_model << segment end end def add_segment(name, from, to) song = Song.first(title: current_song) - Part.create( + Segment.create( name: name, from: from, to: to, song_id: song.id ) -- cgit v1.2.3-70-g09d2