Class Ui::Qt4::Widgets::ChatWidget
In: ui/qt/widgets/chatwidget.rb
Parent: Qt::Widget

Methods

new   new_command  

Public Class methods

[Source]

     # File ui/qt/widgets/chatwidget.rb, line 162
162:         def initialize
163:           super
164:           
165:           @bot = IrcBot.new()
166:           
167:           
168:           @layout1 = Qt::GridLayout.new(self)
169:           @splitter = Qt::Splitter.new(self)
170:           @browser = Qt::TextBrowser.new
171:           @browser.text= "your current <b>nick</b> is: #{@nick}. Use /nick to modify it."
172:           @users = Qt::ListWidget.new
173:           
174:           @splitter.addWidget(@browser)
175:           @splitter.addWidget(@users)
176:           
177:           @cmd = CommandLine.new
178:           @layout1.addWidget(@splitter, 0, 0, 1, 1)
179:           @layout1.addWidget(@cmd)
180:           
181:           connect @cmd, SIGNAL('returnPressed()'), self, SLOT('new_command()')
182:           
183:           @bot.browser = @browser
184:           @bot.users = @users
185:           @bot.exec
186:         end

Public Instance methods

[Source]

     # File ui/qt/widgets/chatwidget.rb, line 188
188:         def new_command()
189:           input = @cmd.last_command
190:           return if ( (input == nil) || (input.size == 0) )
191:           
192:           if input =~ /^\/nick\s(.+)$/i
193:             @bot.change_nick($1)
194:           else
195:             @browser.append "#{@nick}> #{input}"
196:             msg = "PRIVMSG #dradis :#{input}\n"
197:             p msg
198:             @bot.send(msg)
199:             begin
200:               #output = @controller.parse_command(input)
201:             rescue
202:               output = "[error] #{$!}"
203:               $logger.error {$@.join("\n\t")}
204:               #@base.textConsole.append "error]\t" + $!
205:               #@base.textConsole.append $!.backtrace.sort.join("\n\t")
206:               #@base.textConsole.append $@.join("\n\t")
207:             end
208:           end
209:         end

[Validate]