diff options
author | Christian Pointner <equinox@spreadspace.org> | 2016-01-17 05:41:16 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2016-01-17 05:41:16 (GMT) |
commit | 82bba8d8082a838985d5cee831cd18fbd4f61a2a (patch) | |
tree | f4637ad20e15ee1d25777d7117e00d7be9824470 /src | |
parent | ebdce0f75cc8a6c5aa38d8f0e3727b0e99a2b618 (diff) |
add first test for vu-meter
Diffstat (limited to 'src')
-rw-r--r-- | src/rhlibrary/player_widget.go | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/rhlibrary/player_widget.go b/src/rhlibrary/player_widget.go index 33fa88d..7581b45 100644 --- a/src/rhlibrary/player_widget.go +++ b/src/rhlibrary/player_widget.go @@ -71,10 +71,36 @@ func addStopButton(grid *gtk.Grid, p *player.PlayerChan) (err error) { return } +func addMeter(grid *gtk.Grid, p *player.PlayerChan) (err error) { + var mgrid *gtk.Grid + if mgrid, err = gtk.GridNew(); err != nil { + return + } + mgrid.SetOrientation(gtk.ORIENTATION_VERTICAL) + mgrid.SetColumnSpacing(3) + + var left, right *gtk.LevelBar + if left, err = gtk.LevelBarNewForInterval(0, 30); err != nil { + return + } + if right, err = gtk.LevelBarNewForInterval(0, 30); err != nil { + return + } + left.SetMode(gtk.LEVEL_BAR_MODE_DISCRETE) + right.SetMode(gtk.LEVEL_BAR_MODE_DISCRETE) + left.SetValue(8) + right.SetValue(17) + mgrid.Add(left) + mgrid.Add(right) + + grid.Add(mgrid) + return +} + func getPlayerWidget(p *player.PlayerChan) (gtk.IWidget, error) { + var err error var grid *gtk.Grid - grid, err := gtk.GridNew() - if err != nil { + if grid, err = gtk.GridNew(); err != nil { return nil, err } grid.SetOrientation(gtk.ORIENTATION_HORIZONTAL) @@ -89,6 +115,14 @@ func getPlayerWidget(p *player.PlayerChan) (gtk.IWidget, error) { if err = addStopButton(grid, p); err != nil { return nil, err } + if err = addMeter(grid, p); err != nil { + return nil, err + } - return grid, nil + var frame *gtk.Frame + if frame, err = gtk.FrameNew("player"); err != nil { + return nil, err + } + frame.Add(grid) + return frame, nil } |