#################################################
#   Copyright (C) 2005 by Brian Arnold
#   brian@ae6gn.com
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the
#   Free Software Foundation, Inc.,
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#################################################

# Form implementation generated from reading ui file 'options2.ui'
#
# Created: Fri Oct 28 21:24:25 2005
#      by: The QtRuby User Interface Compiler (rbuic)
#
# WARNING! All changes made in this file will be lost!


# require 'Korundum'

class Options < KDE::Dialog

    slots 'languageChange()',
    'setDefaultColor()',
    'ok()',
    'iconClicked()',
    'cancel()'

    attr_reader :kbtnOK
    attr_reader :kbtnCancel
    attr_reader :gbLamps
    attr_reader :textLabel1
    attr_reader :ledColor
    attr_reader :kbtnSetColorDefault
    attr_reader :kIconView

    attr_writer :color
    attr_reader :color
    attr_writer :return
    attr_reader :return

    @@image0_data =
["32 32 112 2",
"#p c #00da00",
"#t c #00e200",
"#Q c #00e600",
"#s c #00ea00",
"#a c #00f200",
"#K c #00f600",
".G c #00fa00",
".z c #00ff00",
".y c #08e608",
".F c #08ee08",
".A c #08f208",
".O c #08fa08",
".N c #08ff08",
".B c #10ea10",
".R c #10ff10",
".6 c #189518",
"#w c #18ae18",
"#l c #18b218",
".M c #18d618",
".x c #18da18",
".T c #18ff18",
".C c #20b220",
".H c #20ca20",
".S c #20ff20",
"#i c #298929",
".3 c #29ff29",
".w c #319931",
".0 c #31ff31",
".Z c #39ff39",
"#b c #414c41",
"#P c #415541",
".q c #416d41",
".P c #417941",
".W c #41ff41",
".1 c #4a554a",
".I c #4a5d4a",
"#J c #4a614a",
".p c #4a6d4a",
"#z c #4ab24a",
".Y c #4aff4a",
".h c #525552",
".o c #525952",
".L c #525d52",
".r c #526552",
".D c #527552",
".X c #52ff52",
".s c #5a595a",
".U c #5a5d5a",
"#G c #5a615a",
".v c #5a655a",
".4 c #5aff5a",
".g c #625d62",
"#R c #626162",
".5 c #62ff62",
".n c #6a696a",
".E c #6a6d6a",
"#A c #6a716a",
"#M c #6aba6a",
".8 c #6aff6a",
".i c #737173",
".K c #737573",
"#v c #737973",
"#L c #73ba73",
"#o c #73ff73",
"#u c #7b757b",
"#h c #7bff7b",
"#d c #838183",
".f c #838583",
"#B c #839d83",
"#. c #83ff83",
".u c #8b898b",
".9 c #8bff8b",
"#y c #948d94",
".t c #949994",
"## c #94ff94",
"#x c #9c919c",
"#c c #9c959c",
"#I c #9c999c",
"#e c #9cff9c",
"#N c #a4a1a4",
"#g c #a4ffa4",
"#q c #ac9dac",
"#D c #aca5ac",
"#H c #acaeac",
"#F c #acbeac",
"#r c #acffac",
".j c #b4aab4",
"#T c #b4aeb4",
"#m c #b4b6b4",
"#f c #b4ffb4",
".m c #bdbebd",
"#k c #bdffbd",
".7 c #c5c2c5",
"#j c #c5ffc5",
"#S c #cdc2cd",
"#O c #cdc6cd",
".J c #cdcacd",
"#n c #cdffcd",
".Q c #d5cad5",
".e c #d5ced5",
"#C c #ded6de",
"#E c #e6e6e6",
".V c #eee2ee",
".k c #eee6ee",
".2 c #eeeaee",
".a c #eeeeee",
".d c #f6eaf6",
".# c #f6eef6",
"Qt c #f6f2f6",
".c c #ffeeff",
".l c #fff2ff",
".b c #fff6ff",
"Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#",
".aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt",
"Qt.#.b.c.b.c.b.c.b.d.e.f.g.h.g.h.g.h.g.i.j.k.b.c.b.c.b.c.b.cQt.#",
".aQt.a.b.a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#o#h.5.8.X.W.0.Z.T.R.z#z.K.g#mQt.#",
".aQt#A.h.C.z.z.N.S.Z.W.4.4.5.5.5.4.4.X.Y.Z.0.S.R.z.z#B.s.h#C.aQt",
"Qt.#.j.h.D.G.z.z.T.3.Z.W.4.X.5.X.5.Y.W.Z.W.3.T.N.N.C#D.h#u.dQt.#",
".aQt#E.s.h.H.z.z.N.T.S.0.Z.W.Z.W.Z.W.0.0.3.T.N.N#t#F#G.h#H.b.aQt",
"Qt.#.b#I.g#J.O.z.z.N.T.S.0.0.W.0.Z.0.Z.S.T.R.N#K#L.u.g.n.d.cQt.#",
".aQt.a.d.E.h.P.O.z.z.N.R.R.S.S.S.S.S.T.R.N.N#K#M#N.o.o#O.a.b.aQt",
"Qt.#.b.c.e.s.g.P.y.z.z.z.N.N.R.R.R.R.R.N.N#t#L#N.g.h#c.c.b.cQt.#",
".aQt.a.b.a.J.o.h#P.6#a.z.z.z.z.z.z.N.z.z.C#F.u.h.h#x.a.b.a.b.aQt",
"Qt.#.b.c.b.c.Q#G.g.h#b#i#l#p#s#Q.y#w#z#B#D#R.g.s#c.#.b.c.b.cQt.#",
".aQt.a.b.a.b.a.V.f.h.h.h.E.s.K#u.K#x.K.s.h.h.n#O.a.b.a.b.a.b.aQt",
"Qt.#.b.c.b.c.b.c.l#S#c.h.g.h.g.h.g.h.g.h#u#T.d.c.b.c.b.c.b.cQt.#",
".aQt.a.b.a.b.a.b.a.b.a.2#m#q.f.f.f#y#m#C.2.b.a.b.a.b.a.b.a.b.aQt",
"Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#Qt.#",
".aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt.aQt"]


    def initialize(parent = nil, name = nil, modal = false, fl = 0)
        super

        @image0 = Qt::Pixmap.new(@@image0_data)

        if name.nil?
        	setName("Options")
        end


        @kbtnOK = KDE::PushButton.new(self, "kbtnOK")
        @kbtnOK.setGeometry( Qt::Rect.new(290, 240, 150, 31) )

        @kbtnCancel = KDE::PushButton.new(self, "kbtnCancel")
        @kbtnCancel.setGeometry( Qt::Rect.new(130, 240, 151, 31) )

        @gbLamps = Qt::GroupBox.new(self, "gbLamps")
        @gbLamps.setGeometry( Qt::Rect.new(130, 10, 310, 220) )

        @textLabel1 = Qt::Label.new(@gbLamps, "textLabel1")
        @textLabel1.setGeometry( Qt::Rect.new(15, 45, 90, 21) )
        @textLabel1_font = Qt::Font.new(@textLabel1.font())
        @textLabel1.setFont(@textLabel1_font)

        @ledColor = KDE::ColorButton.new(@gbLamps, "ledColor")
        @ledColor.setGeometry( Qt::Rect.new(110, 40, 71, 31) )
        @ledColor.setColor( Qt::Color.new(0, 255, 0) )

        @kbtnSetColorDefault = KDE::PushButton.new(@gbLamps, "kbtnSetColorDefault")
        @kbtnSetColorDefault.setGeometry( Qt::Rect.new(190, 40, 110, 31) )

        @kIconView = KDE::IconView.new(self, "kIconView")
        @kIconView.setGeometry( Qt::Rect.new(10, 11, 112, 260) )
        @kIconView.setItemTextPos( KDE::IconView::Right )
        @kIconView.setArrangement( KDE::IconView::TopToBottom )
        KDE::IconViewItem.new(@kIconView, "Lamps", @image0)
        languageChange()
        resize( Qt::Size.new(450, 281).expandedTo(minimumSizeHint()) )
        clearWState( WState_Polished )

        Qt::Object.connect(@kbtnCancel, SIGNAL("clicked()"), self, SLOT("cancel()") )
        Qt::Object.connect(@kbtnOK, SIGNAL("clicked()"), self, SLOT("ok()") )
        Qt::Object.connect(@kbtnSetColorDefault, SIGNAL("clicked()"), self, SLOT("setDefaultColor()") )
        Qt::Object.connect(@kIconView, SIGNAL("executed(QIconViewItem*)"), self, SLOT("iconClicked()") )


        self.color = Qt::Color.new(0, 255, 0)
    end

    #
    #  Sets the strings of the subwidgets using the current
    #  language.
    #
    def languageChange()
        setCaption(trUtf8("Options - KEnigma"))
        @kbtnOK.setText( trUtf8("O&K") )
        @kbtnOK.setAccel( Qt::KeySequence.new(trUtf8("Alt+K")) )
        @kbtnCancel.setText( trUtf8("Ca&ncel") )
        @kbtnCancel.setAccel( Qt::KeySequence.new(trUtf8("Alt+N")) )
        @gbLamps.setTitle( trUtf8("Lamp Options") )
        @textLabel1.setText( trUtf8("Lamp Color:") )
        @ledColor.setText( nil )
        @kbtnSetColorDefault.setText( trUtf8("Set to Def&ault") )
        @kbtnSetColorDefault.setAccel( Qt::KeySequence.new(trUtf8("Alt+A")) )
    end
    protected :languageChange


    def setDefaultColor(*k)
      @ledColor.setColor( Qt::Color.new(0, 255, 0) )
    end

    def ok(*k)
      self.color = @ledColor.color
      self.hide
      self.return = 1
    end

    def iconClicked(*k)
      item = @kIconView.currentItem
      print item.text
    end

    def cancel(*k)
      @ledColor.setColor(self.color)
      self.return = 0
      self.close
    end

end