Class: Ruber::RubyRunner::RubyOptionsWidget

Inherits:
ProjectConfigWidget show all
Defined in:
plugins/ruby_runner/ruby_runner.rb

Overview

TODO:

Put this class inside the namespace after it’s been changed from Ruber (as rbuic puts all classes starting with K in the KDE namespace)

Widget to use to set the ruby_options setting.

It is made by a KDE::LineEdit and the corresponding Qt::Label. It already provides the signal property to be used by SettingsDialogContainer (set to text_changed(QString)).

Plugin developers should only need to put this widget inside their project widget and give it the appropriate name (usually _grp__ruby_options, where grp is the group specified in RubyRunnerPlugin.new)

If something fancier is needed, the underlying label and line edit widgets can be accessed using the label_widget and text_widget methods.

Instance Attribute Summary

Attributes inherited from ProjectConfigWidget

project

Instance Method Summary (collapse)

Signal Summary

API for feature ruby_runner

Constructor Details

- (RubyOptionsWidget) initialize(parent = nil)

Creates a new instance

Parameters:

  • parent (Qt::Widget) (defaults to: nil)

    the parent widget



86
87
88
89
90
91
# File 'plugins/ruby_runner/ruby_runner.rb', line 86

def initialize parent = nil
  super
  @ui = Ui::RubyRunnerPluginOptionWidget.new
  @ui.setupUi self
  connect @ui.text, SIGNAL('textChanged(QString)'), self, SIGNAL('text_changed(QString)')
end

Instance Method Details

- (Qt::Label) label_widget

The label widget.

This is useful, for example, if you don’t like the default label.

Returns:

  • (Qt::Label)

    the label widget



100
101
102
# File 'plugins/ruby_runner/ruby_runner.rb', line 100

def label_widget
  @ui.label
end

- (<String>) text

Converts the contents of the line edit to an array

Returns:

  • (<String>)

    an array of shell tokens



130
131
132
# File 'plugins/ruby_runner/ruby_runner.rb', line 130

def text
  Shellwords.split_with_quotes @ui.text.text
end

- (Object) text=(val)

Sets the text in the line edit

Parameters:

  • val (<String>)

    an array of strings, with each string being a shell token



121
122
123
# File 'plugins/ruby_runner/ruby_runner.rb', line 121

def text= val
  @ui.text.text = val.join ' '
end

- (KDE::LineEdit) text_widget

The line edit widget widget.

In most cases, you shouldn’t need to use this

Returns:

  • (KDE::LineEdit)

    the line edit widget



112
113
114
# File 'plugins/ruby_runner/ruby_runner.rb', line 112

def text_widget
  @ui.text
end

Signal Details

- text_changed(QString text)

Signal emitted whenever the text inside the line edit changes.

Parameters:

  • text (String)

    the new content of the line edit