#!/usr/local/bin/ruby
require "qt2"
include Qt2

class MyDialog < QDialog
def initialize(parent=nil,name="",modal=false,f=0)
   setName("MyDialog")
   resize( 508,282)
   setCaption(tr("Help Browser"))
   setSizeGripEnabled(true)

   rgridlayout_3 = QGridLayout.new(self)
   rgridlayout_3.setMargin(11)
   rgridlayout_3.setSpacing(6)

   @privateLayoutWidget_2 = self
   @privateLayoutWidget_2.setName("Layout1")

   @Layout1 = QHBoxLayout.new(nil)
   @Layout1.setMargin(0)
   @Layout1.setSpacing(6)

   @buttonHelp = QPushButton.new(@privateLayoutWidget_2)
   @buttonHelp.setName("buttonHelp")
   @buttonHelp.setText(tr("&Help"))
   @buttonHelp.setAutoDefault(true)

   @Layout1.addWidget(@buttonHelp,0)

   @Horizontal_Spacing2_0 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )

   @Layout1.addItem(@Horizontal_Spacing2_0)

   @buttonOk = QPushButton.new(@privateLayoutWidget_2)
   @buttonOk.setName("buttonOk")
   @buttonOk.setText(tr("&OK"))
   @buttonOk.setAutoDefault(true)
   @buttonOk.setDefault(false)

   @Layout1.addWidget(@buttonOk,0)

   @buttonCancel = QPushButton.new(@privateLayoutWidget_2)
   @buttonCancel.setName("buttonCancel")
   @buttonCancel.setText(tr("&Cancel"))
   @buttonCancel.setAutoDefault(true)

   @Layout1.addWidget(@buttonCancel,0)
   rgridlayout_3.addMultiCellLayout(@Layout1,3,3,0,3)

   @TextBrowser1 = QTextBrowser.new(self)
   @TextBrowser1.setName("TextBrowser1")
   @TextBrowser1.setSource("/#{`echo $QTDIR`.chop!}/doc/html/index.html")
   rgridlayout_3.addMultiCellWidget(@TextBrowser1,1,1,0,3)

   @ComboBox3 = QComboBox.new(self)
   @ComboBox3.setName("ComboBox3")
   @ComboBox3.setEditable(true)
   rgridlayout_3.addWidget(@ComboBox3,0,0)

   @PushButton9 = QPushButton.new(self)
   @PushButton9.setName("PushButton9")
   @PushButton9.setMaximumSize(90,32767)
   @PushButton9.setText(tr("Go to"))
   @PushButton9.setAutoDefault(true)
   @PushButton9.setDefault(true)
   rgridlayout_3.addWidget(@PushButton9,0,3)

   @TextLabel1 = QLabel.new(self)
   @TextLabel1.setName("TextLabel1")
   @TextLabel1.setText(tr(""))
   rgridlayout_3.addMultiCellWidget(@TextLabel1,2,2,0,3)

   @PushButton11 = QPushButton.new(self)
   @PushButton11.setName("PushButton11")
   @PushButton11.setEnabled(false)
   @PushButton11.setMaximumSize(40,32767)
   @PushButton11.setText(tr(">"))
   rgridlayout_3.addWidget(@PushButton11,0,2)

   @PushButton10 = QPushButton.new(self)
   @PushButton10.setName("PushButton10")
   @PushButton10.setEnabled(false)
   @PushButton10.setMaximumSize(40,32767)
   @PushButton10.setText(tr("<"))
   rgridlayout_3.addWidget(@PushButton10,0,1)

#connections of main form
   
   Qt2::connect(@buttonOk, QSIGNAL("clicked()"), self, QSLOT("accept()"))   
   Qt2::connect(@buttonCancel, QSIGNAL("clicked()"), self, QSLOT("reject()"))   
   Qt2::connect(@TextBrowser1, QSIGNAL("highlighted(const QString&)"), @TextLabel1, QSLOT("setText(const QString&)"))   
   Qt2::connect(@PushButton9, QSIGNAL("clicked()"), self, "setHome()")   
   Qt2::connect(@PushButton10, QSIGNAL("clicked()"), @TextBrowser1, QSLOT("backward()"))   
   Qt2::connect(@TextBrowser1, QSIGNAL("backwardAvailable(bool)"), @PushButton10, QSLOT("setEnabled(bool)"))   
   Qt2::connect(@TextBrowser1, QSIGNAL("forwardAvailable(bool)"), @PushButton11, QSLOT("setEnabled(bool)"))   
   Qt2::connect(@PushButton11, QSIGNAL("clicked()"), @TextBrowser1, QSLOT("forward()"))

#taborders
end


def setHome()   
   QMessageBox::information(nil,"Unimplemented slot","setHome() is not implemented.")
end
end
#main roop for displaying form

a = QApplication.new([$0]+ARGV)
codec = QTextCodec.codecForName('UTF-8')
a.setDefaultCodec(codec)
#for close to quit program
Qt2::connect(QApplication::qApp,QSIGNAL("lastWindowClosed()"),
   QApplication::qApp,QSLOT("quit()"))
myform = MyDialog.new
a.setMainWidget(myform)
myform.show()
a.exec
