#!/usr/local/bin/ruby
require "qt2"
include Qt2
require "qt2table"
include Qt2table
require "qt2iconview"
include Qt2iconview
#*********************************************************************
#** Copyright (C) 2000 Trolltech AS.  All rights reserved.
#**
#** This file is part of Qt Designer.
#**
#** This file may be distributed and/or modified under the terms of the
#** GNU General Public License version 2 as published by the Free Software
#** Foundation and appearing in the file LICENSE.GPL included in the
#** packaging of this file.
#**
#** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
#** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#**
#** See http://www.trolltech.com/gpl/ for GPL licensing information.
#**
#** Contact info@trolltech.com if any conditions of this licensing are
#** not clear to you.
#**
#*********************************************************************

class MyDialog < QDialog
def initialize

   @image0_data = [   "32 32 10 1",
   ". c None",
   "# c #000000",
   "b c #00c200",
   "e c #313031",
   "h c #410000",
   "d c #5a595a",
   "g c #a4a1a4",
   "f c #c5c2c5",
   "a c #c5ffc5",
   "c c #ffffff",
   "...###..........................",
   "...#aa##........................",
   ".###baaa##......................",
   ".#cd##baaa##....................",
   ".#cccd##baaa##..##e.............",
   ".#cccccd##baaa##aaa##...........",
   ".#cccccccd##baaaaaaaa##.........",
   ".#cccccccccd##baaaaaaa#.........",
   ".#cccccfcffgg#bbbbaaaaa#........",
   ".#ccccccfcfffd#bbbbbbaa#........",
   ".#cccfcfcfcffgd##bh#bbba#.......",
   ".#ccccfcfffffffgd#dd##ba#.......",
   ".#cfcfcfcfffffffffgfgd#bb#......",
   ".#ccfcfffffffffgfgfgfgd#b#......",
   ".#cfcfcfffffffffgfgfggd#b#......",
   ".#fcfffffffffgfgfgggggd#b#......",
   ".#cfcfffffffffgfgfggggd#b#......",
   ".#fffffffffgfgfgggggggdhb#......",
   ".#ffffffffffgfgfggggggd#b#......",
   ".#ggfffffgfgfgggggggggd#b#......",
   ".#ddggffffgfgfggggggggd#b#......",
   "..##ddggfgfgggggggggggd#b#......",
   "....##ddgggfggggggggggd#b#......",
   "......##ddggggggggggggd#b#......",
   "........##ddggggggggggd#b#......",
   "..........##ddggggggggd#b#......",
   "............##ddggggggd#b###....",
   "..............##ddggggd#b#####..",
   "................##ddggd#b######.",
   "..................##ddd#b#####..",
   "....................##d#b###....",
   "......................####......"]

   @image0 = QPixmap.new(@image0_data)
   setName("MyDialog")
   setGeometry(0,0,487,284)
   setCaption(tr("A Dialog"))
   setSizeGripEnabled(true)
   setSizePolicy(QSizePolicy.new(5,5,sizePolicy::hasHeightForWidth()))

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

   @ButtonGroup1 = QButtonGroup.new(self)
   @ButtonGroup1.setName("ButtonGroup1")
   @ButtonGroup1.setTitle("&Choose")
   @ButtonGroup1.setMinimumSize(100,0)

   @radioApple = QRadioButton.new(@ButtonGroup1)
   @radioApple.setName("radioApple")
   @radioApple.setGeometry(10,60,60,20)
   @radioApple.setText(tr("&Apple"))

   @radioOrange = QRadioButton.new(@ButtonGroup1)
   @radioOrange.setName("radioOrange")
   @radioOrange.setGeometry(10,90,70,20)
   @radioOrange.setText(tr("&Orange"))

   @radioKiwi = QRadioButton.new(@ButtonGroup1)
   @radioKiwi.setName("radioKiwi")
   @radioKiwi.setGeometry(10,120,60,20)
   @radioKiwi.setText(tr("&Kiwi"))

   @radioBanana = QRadioButton.new(@ButtonGroup1)
   @radioBanana.setName("radioBanana")
   @radioBanana.setGeometry(10,30,70,20)
   @radioBanana.setText(tr("&Banana"))
   rgridlayout_25.addWidget(@ButtonGroup1,0,0)

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

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

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

   @Layout9.addWidget(@buttonHelp,0)

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

   @Layout9.addItem(@Horizontal_Spacing2_0)

   @buttonApply = QPushButton.new(@privateLayoutWidget_2)
   @buttonApply.setName("buttonApply")
   @buttonApply.setText(tr("&Apply"))
   @buttonApply.setAutoDefault(true)

   @Layout9.addWidget(@buttonApply,0)

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

   @Layout9.addWidget(@buttonOk,0)

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

   @Layout9.addWidget(@buttonCancel,0)
   rgridlayout_25.addMultiCellLayout(@Layout9,1,1,0,1)

   @TabWidget2 = QTabWidget.new(self)
   @TabWidget2.setName("TabWidget2")
   @TabWidget2.setSizePolicy(QSizePolicy.new(7,7,sizePolicy::hasHeightForWidth()))
   @TabWidget2.setMaximumSize(32767,32767)

   @Widget2 = QWidget.new(@TabWidget2)
   @Widget2.setName("Widget2")

   rhbox_16 = QHBoxLayout.new(@Widget2)
   rhbox_16.setMargin(11)
   rhbox_16.setSpacing(6)

   @listEditor = QListView.new(@Widget2)
   @listEditor.setName("listEditor")
   @listEditor.setRootIsDecorated(true)

   @listEditor.addColumn( tr("Column 1"))

   @listEditor.addColumn( tr("Another Column"))

   rlistviewitem_5 = QListViewItem.new(@listEditor)
   rlistviewitem_5.setText(0, tr("Item"))
   rlistviewitem_5.setText(1, tr(""))
   rlistviewitem_5.setPixmap(0,@image0)
   
   rlistviewitem_6 = QListViewItem.new(@listEditor,rlistviewitem_5)
   rlistviewitem_6.setText(0, tr("Item"))
   rlistviewitem_6.setText(1, tr(""))
      
   rlistviewitem_6.setOpen(TRUE)

   rlistviewitem_7 = QListViewItem.new(rlistviewitem_6)
   rlistviewitem_7.setText(0, tr("Sub Item"))
   rlistviewitem_7.setText(1, tr("Another cell"))
      
   rlistviewitem_7.setOpen(TRUE)

   rlistviewitem_8 = QListViewItem.new(rlistviewitem_7)
   rlistviewitem_8.setText(0, tr("Sub Item"))
   rlistviewitem_8.setText(1, tr(""))
      
   rlistviewitem_9 = QListViewItem.new(@listEditor,rlistviewitem_6)
   rlistviewitem_9.setText(0, tr("Item"))
   rlistviewitem_9.setText(1, tr("Something"))
      
   rlistviewitem_9.setOpen(TRUE)

   rlistviewitem_10 = QListViewItem.new(rlistviewitem_9)
   rlistviewitem_10.setText(0, tr("Sub Item"))
   rlistviewitem_10.setText(1, tr(""))
      
   rlistviewitem_11 = QListViewItem.new(rlistviewitem_9,rlistviewitem_10)
   rlistviewitem_11.setText(0, tr("Sub Item"))
   rlistviewitem_11.setText(1, tr(""))
      
   rlistviewitem_12 = QListViewItem.new(@listEditor,rlistviewitem_9)
   rlistviewitem_12.setText(0, tr("New Item"))
   rlistviewitem_12.setText(1, tr(""))
      
   rhbox_16.addWidget(@listEditor,0)

   @privateLayoutWidget_15 = QWidget.new(@Widget2)
   @privateLayoutWidget_15.setName("Layout4")
   @privateLayoutWidget_15.setMaximumSize(70,32767)

   @Layout4 = QVBoxLayout.new(@privateLayoutWidget_15)
   @Layout4.setMargin(0)
   @Layout4.setSpacing(6)

   @PushButton7 = QPushButton.new(@privateLayoutWidget_15)
   @PushButton7.setName("PushButton7")
   @PushButton7.setText(tr("Up"))
   @PushButton7.setMaximumSize(32767,32767)

   @Layout4.addWidget(@PushButton7,0)

   @PushButton8 = QPushButton.new(@privateLayoutWidget_15)
   @PushButton8.setName("PushButton8")
   @PushButton8.setText(tr("Down"))

   @Layout4.addWidget(@PushButton8,0)

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

   @Layout4.addItem(@Spacer1_13)

   rhbox_16.addWidget(@privateLayoutWidget_15,0)

   @Widget3 = QWidget.new(@TabWidget2)
   @Widget3.setName("Widget3")

   rhbox_17 = QHBoxLayout.new(@Widget3)
   rhbox_17.setMargin(11)
   rhbox_17.setSpacing(6)

   @slider = QSlider.new(@Widget3)
   @slider.setName("slider")
   @slider.setOrientation(Qt::Vertical)

   rhbox_17.addWidget(@slider,0)

   @lcdnumber = QLCDNumber.new(@Widget3)
   @lcdnumber.setName("lcdnumber")

   rhbox_17.addWidget(@lcdnumber,0)

   @tabTable = QWidget.new(@TabWidget2)
   @tabTable.setName("tabTable")

   rvbox_18 = QVBoxLayout.new(@tabTable)
   rvbox_18.setMargin(11)
   rvbox_18.setSpacing(6)

   @Table1 = QTable.new(@tabTable)
   @Table1.setName("Table1")
   @Table1.setNumRows(10)
   @Table1.setNumCols(10)

   rvbox_18.addWidget(@Table1,0)

   @tabIconVIew = QWidget.new(@TabWidget2)
   @tabIconVIew.setName("tabIconVIew")

   rvbox_21 = QVBoxLayout.new(@tabIconVIew)
   rvbox_21.setMargin(11)
   rvbox_21.setSpacing(6)

   @IconView1 = QIconView.new(@tabIconVIew)
   @IconView1.setName("IconView1")

   riconviewitem_19 = QIconViewItem.new(@IconView1)
   riconviewitem_19.setText(tr("Item1"))
   riconviewitem_19.setPixmap(@image0)

   riconviewitem_20 = QIconViewItem.new(@IconView1,riconviewitem_19)
   riconviewitem_20.setText(tr("Item2"))
   riconviewitem_20.setPixmap(@image0)

   rvbox_21.addWidget(@IconView1,0)

   @tabMisc = QWidget.new(@TabWidget2)
   @tabMisc.setName("tabMisc")

   @LineEdit1 = QLineEdit.new(@tabMisc)
   @LineEdit1.setName("LineEdit1")
   @LineEdit1.setGeometry(11,11,183,22)

   @SpinBox1 = QSpinBox.new(@tabMisc)
   @SpinBox1.setName("SpinBox1")
   @SpinBox1.setGeometry(11,39,183,23)

   @MultiLineEdit1 = QMultiLineEdit.new(@tabMisc)
   @MultiLineEdit1.setName("MultiLineEdit1")
   @MultiLineEdit1.setGeometry(11,68,183,118)

   @Slider5 = QSlider.new(@tabMisc)
   @Slider5.setName("Slider5")
   @Slider5.setGeometry(200,42,144,16)
   @Slider5.setOrientation(Qt::Horizontal)

   @Dial1 = QDial.new(@tabMisc)
   @Dial1.setName("Dial1")
   @Dial1.setGeometry(201,69,70,50)

   @LCDNumber2 = QLCDNumber.new(@tabMisc)
   @LCDNumber2.setName("LCDNumber2")
   @LCDNumber2.setGeometry(280,70,64,50)

   @ComboBox1 = QComboBox.new(@tabMisc)
   @ComboBox1.setName("ComboBox1")
   @ComboBox1.setGeometry(200,11,144,22)
   @ComboBox1.setAcceptDrops(true)
   @ComboBox1.setEditable(true)
   @ComboBox1.setAutoCompletion(true)

   @ListBox1 = QListBox.new(@tabMisc)
   @ListBox1.setName("ListBox1")
   @ListBox1.setGeometry(200,126,150,60)
   @ListBox1.setAcceptDrops(true)
   @ListBox1.insertItem(@image0,tr("New Item"))
   @ListBox1.insertItem(tr("New Item"))
   @ListBox1.insertItem(tr("New Item"))

   @TabWidget2.insertTab(@Widget2,tr("&Editor"))

   @TabWidget2.insertTab(@Widget3,tr("A&ppearance"))

   @TabWidget2.insertTab(@tabTable,tr("Table"))

   @TabWidget2.insertTab(@tabIconVIew,tr("IconView"))

   @TabWidget2.insertTab(@tabMisc,tr("TabMisc"))
   rgridlayout_25.addWidget(@TabWidget2,0,1)

#connections of main form
   
   Qt2::connect(@buttonOk, QSIGNAL("clicked()"), self, QSLOT("accept()"))   
   Qt2::connect(@buttonCancel, QSIGNAL("clicked()"), self, QSLOT("reject()"))   
   Qt2::connect(@slider, QSIGNAL("valueChanged(int)"), @lcdnumber, QSLOT("display(int)"))   
   Qt2::connect(@PushButton7, QSIGNAL("clicked()"), self, "upClicked()")   
   Qt2::connect(@PushButton8, QSIGNAL("clicked()"), self, "downClicked()")   
   Qt2::connect(@Slider5, QSIGNAL("valueChanged(int)"), @Dial1, QSLOT("setValue(int)"))   
   Qt2::connect(@Dial1, QSIGNAL("valueChanged(int)"), @Slider5, QSLOT("setValue(int)"))   
   Qt2::connect(@Dial1, QSIGNAL("valueChanged(int)"), @LCDNumber2, QSLOT("display(int)"))   
   Qt2::connect(@ListBox1, QSIGNAL("highlighted(const QString&)"), @ComboBox1, QSLOT("setEditText(const QString&)"))

#taborders

   QWidget::setTabOrder(@radioBanana,@radioApple)
   QWidget::setTabOrder(@radioApple,@radioOrange)
   QWidget::setTabOrder(@radioOrange,@radioKiwi)
   QWidget::setTabOrder(@radioKiwi,@listEditor)
   QWidget::setTabOrder(@listEditor,@TabWidget2)
   QWidget::setTabOrder(@TabWidget2,@PushButton8)
   QWidget::setTabOrder(@PushButton8,@PushButton7)
   QWidget::setTabOrder(@PushButton7,@buttonCancel)
   QWidget::setTabOrder(@buttonCancel,@buttonOk)
   QWidget::setTabOrder(@buttonOk,@buttonApply)
   QWidget::setTabOrder(@buttonApply,@buttonHelp)
   QWidget::setTabOrder(@buttonHelp,@slider)
   QWidget::setTabOrder(@slider,@Table1)
   QWidget::setTabOrder(@Table1,@IconView1)end


def downClicked()   
   QMessageBox::informationButtonText(nil,"Unimplemented slot","downClicked() is not implemented.")
end

def upClicked()   
   QMessageBox::informationButtonText(nil,"Unimplemented slot","upClicked() 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
