SHARE
TWEET

XMMS2 Ruby Qt4 main loop

a guest Mar 13th, 2011 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class XmmsConnectToQt4 < Qt::Object
  2.   def initialize(connection)
  3.     unless @running
  4.       @client = connection
  5.       @fd = @client.io_fd
  6.       @reader = Qt::SocketNotifier.new(@fd, Qt::SocketNotifier::Read)
  7.       @writer = Qt::SocketNotifier.new(@fd, Qt::SocketNotifier::Write)
  8.  
  9.       @client.io_on_need_out do |flag| # Why flag is not boolean again?
  10.         @writer.enabled = (flag != 0)
  11.       end
  12.  
  13.       @reader.connect(SIGNAL 'activated(int)') { @client.io_in_handle }
  14.       @writer.connect(SIGNAL 'activated(int)') do
  15.         if @client.io_want_out
  16.           @client.io_out_handle
  17.         end
  18.       end
  19.  
  20.       @reader.enabled = true
  21.       @writer.enabled = true
  22.     end
  23.  
  24.     @running ||= true
  25.     self
  26.   end
  27. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top