diff options
Diffstat (limited to 'qtruby/rubylib')
122 files changed, 2667 insertions, 2667 deletions
diff --git a/qtruby/rubylib/designer/examples/colortool/colornameform.ui b/qtruby/rubylib/designer/examples/colortool/colornameform.ui index 50f2d6de..e03897e5 100644 --- a/qtruby/rubylib/designer/examples/colortool/colornameform.ui +++ b/qtruby/rubylib/designer/examples/colortool/colornameform.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <class>ColorNameForm</class> -<widget class="QDialog"> +<widget class="TQDialog"> <property name="name"> <cstring>ColorNameForm</cstring> </property> @@ -19,7 +19,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>colorLabel</cstring> </property> @@ -39,7 +39,7 @@ <bool>true</bool> </property> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout4</cstring> </property> @@ -47,7 +47,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout1</cstring> </property> @@ -55,7 +55,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>TextLabel2</cstring> </property> @@ -66,7 +66,7 @@ <cstring>colorLineEdit</cstring> </property> </widget> - <widget class="QLineEdit"> + <widget class="TQLineEdit"> <property name="name"> <cstring>colorLineEdit</cstring> </property> @@ -90,7 +90,7 @@ </size> </property> </spacer> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout4</cstring> </property> @@ -115,7 +115,7 @@ </size> </property> </spacer> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>okPushButton</cstring> </property> @@ -126,7 +126,7 @@ <bool>true</bool> </property> </widget> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>cancelPushButton</cstring> </property> @@ -161,7 +161,7 @@ <slot>validate()</slot> </slots> <functions> - <function>setColors( const QMap<QString, QColor> & colors )</function> + <function>setColors( const TQMap<TQString, TQColor> & colors )</function> </functions> <pixmapinproject/> <layoutdefaults spacing="6" margin="11"/> diff --git a/qtruby/rubylib/designer/examples/colortool/findform.ui b/qtruby/rubylib/designer/examples/colortool/findform.ui index 3e627945..0107fabe 100644 --- a/qtruby/rubylib/designer/examples/colortool/findform.ui +++ b/qtruby/rubylib/designer/examples/colortool/findform.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <class>FindForm</class> -<widget class="QDialog"> +<widget class="TQDialog"> <property name="name"> <cstring>FindForm</cstring> </property> @@ -19,7 +19,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout11</cstring> </property> @@ -27,7 +27,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>TextLabel3</cstring> </property> @@ -38,7 +38,7 @@ <cstring>findLineEdit</cstring> </property> </widget> - <widget class="QLineEdit"> + <widget class="TQLineEdit"> <property name="name"> <cstring>findLineEdit</cstring> </property> @@ -62,7 +62,7 @@ </size> </property> </spacer> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout10</cstring> </property> @@ -87,7 +87,7 @@ </size> </property> </spacer> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>findPushButton</cstring> </property> @@ -98,7 +98,7 @@ <bool>true</bool> </property> </widget> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>closePushButton</cstring> </property> @@ -128,7 +128,7 @@ <include location="local" impldecl="in implementation">findform.ui.h</include> </includes> <signals> - <signal>lookfor(const QString&)</signal> + <signal>lookfor(const TQString&)</signal> </signals> <slots> <slot>find()</slot> diff --git a/qtruby/rubylib/designer/examples/colortool/main.rb b/qtruby/rubylib/designer/examples/colortool/main.rb index 9ebe84cb..539da700 100644 --- a/qtruby/rubylib/designer/examples/colortool/main.rb +++ b/qtruby/rubylib/designer/examples/colortool/main.rb @@ -1,19 +1,19 @@ -require 'Qt'
+retquire 'Qt'
-require 'mainform.rb'
-require 'mainform.ui.rb'
+retquire 'mainform.rb'
+retquire 'mainform.ui.rb'
-require 'colornameform.rb'
-require 'colornameform.ui.rb'
+retquire 'colornameform.rb'
+retquire 'colornameform.ui.rb'
-require 'optionsform.rb'
+retquire 'optionsform.rb'
-require 'findform.rb'
-require 'findform.ui.rb'
+retquire 'findform.rb'
+retquire 'findform.ui.rb'
-require 'qmake_image_collection.rb'
+retquire 'qmake_image_collection.rb'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
w = MainForm.new
a.mainWidget = w
w.show
diff --git a/qtruby/rubylib/designer/examples/colortool/mainform.ui b/qtruby/rubylib/designer/examples/colortool/mainform.ui index 6c89baca..f4081882 100644 --- a/qtruby/rubylib/designer/examples/colortool/mainform.ui +++ b/qtruby/rubylib/designer/examples/colortool/mainform.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>MainForm</class> -<widget class="QMainWindow"> +<widget class="TQMainWindow"> <property name="name"> <cstring>MainForm</cstring> </property> @@ -19,7 +19,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QWidgetStack"> + <widget class="TQWidgetStack"> <property name="name"> <cstring>colorWidgetStack</cstring> </property> @@ -29,7 +29,7 @@ <property name="frameShadow"> <enum>Plain</enum> </property> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>tablePage</cstring> </property> @@ -40,7 +40,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QTable"> + <widget class="TQTable"> <column> <property name="text"> <string>Name</string> @@ -71,7 +71,7 @@ </widget> </hbox> </widget> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>iconsPage</cstring> </property> @@ -82,7 +82,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QIconView"> + <widget class="TQIconView"> <property name="name"> <cstring>colorIconView</cstring> </property> @@ -496,15 +496,15 @@ </connection> <connection> <sender>colorIconView</sender> - <signal>currentChanged(QIconViewItem*)</signal> + <signal>currentChanged(TQIconViewItem*)</signal> <receiver>MainForm</receiver> - <slot>changedIconColor(QIconViewItem*)</slot> + <slot>changedIconColor(TQIconViewItem*)</slot> </connection> <connection> <sender>viewActionGroup</sender> - <signal>selected(QAction*)</signal> + <signal>selected(TQAction*)</signal> <receiver>MainForm</receiver> - <slot>changeView(QAction*)</slot> + <slot>changeView(TQAction*)</slot> </connection> <connection> <sender>editAddAction</sender> @@ -548,38 +548,38 @@ <include location="local" impldecl="in implementation">mainform.ui.h</include> </includes> <forwards> - <forward>class QString;</forward> - <forward>class QColor;</forward> + <forward>class TQString;</forward> + <forward>class TQColor;</forward> </forwards> <variables> - <variable>QStringList m_comments;</variable> - <variable>QString m_filename;</variable> + <variable>TQStringList m_comments;</variable> + <variable>TQString m_filename;</variable> <variable>bool m_changed;</variable> <variable>bool m_table_dirty;</variable> <variable>bool m_icons_dirty;</variable> <variable>int m_clip_as;</variable> <variable>bool m_show_web;</variable> - <variable>QClipboard *clipboard;</variable> + <variable>TQClipboard *clipboard;</variable> <variable>FindForm *findForm;</variable> - <variable>QMap<QString,QColor> m_colors;</variable> + <variable>TQMap<TQString,TQColor> m_colors;</variable> </variables> <slots> <slot>fileNew()</slot> <slot>fileOpen()</slot> <slot>fileSave()</slot> <slot>fileSaveAs()</slot> - <slot>closeEvent( QCloseEvent * )</slot> + <slot>closeEvent( TQCloseEvent * )</slot> <slot>fileExit()</slot> <slot>editCut()</slot> <slot>editCopy()</slot> <slot>editFind()</slot> - <slot>lookfor( const QString & text )</slot> + <slot>lookfor( const TQString & text )</slot> <slot>helpIndex()</slot> <slot>helpContents()</slot> <slot>helpAbout()</slot> <slot>changedTableColor( int row, int )</slot> - <slot>changedIconColor( QIconViewItem * item )</slot> - <slot>changeView( QAction * action )</slot> + <slot>changedIconColor( TQIconViewItem * item )</slot> + <slot>changeView( TQAction * action )</slot> <slot>editAdd()</slot> <slot>editOptions()</slot> <slot>aboutToShow()</slot> @@ -588,11 +588,11 @@ <function access="private">init()</function> <function>clearData( bool fillWithDefaults )</function> <function>populate()</function> - <function returnType="QPixmap">colorSwatch( const QColor color )</function> - <function>load( const QString & filename )</function> + <function returnType="TQPixmap">colorSwatch( const TQColor color )</function> + <function>load( const TQString & filename )</function> <function returnType="bool">okToClear()</function> - <function>changedColor( const QString & name )</function> - <function returnType="bool">isWebColor( QColor color )</function> + <function>changedColor( const TQString & name )</function> + <function returnType="bool">isWebColor( TQColor color )</function> <function>loadSettings()</function> <function>saveSettings()</function> </functions> diff --git a/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb b/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb index 471233bd..3f4f5945 100644 --- a/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb +++ b/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb @@ -10,7 +10,7 @@ class MainForm APP_KEY = "/ColorTool/" def init() - @clipboard = Qt::Application.clipboard() + @clipboard = TQt::Application.clipboard() if @clipboard.supportsSelection() @clipboard.selectionMode = true end @@ -33,23 +33,23 @@ def clearData( fillWithDefaults ) @comments.clear() if fillWithDefaults - @colors["black"] = Qt::black - @colors["blue"] = Qt::blue - @colors["cyan"] = Qt::cyan - @colors["darkblue"] = Qt::darkBlue - @colors["darkcyan"] = Qt::darkCyan - @colors["darkgray"] = Qt::darkGray - @colors["darkgreen"] = Qt::darkGreen - @colors["darkmagenta"] = Qt::darkMagenta - @colors["darkred"] = Qt::darkRed - @colors["darkyellow"] = Qt::darkYellow - @colors["gray"] = Qt::gray - @colors["green"] = Qt::green - @colors["lightgray"] = Qt::lightGray - @colors["magenta"] = Qt::magenta - @colors["red"] = Qt::red - @colors["white"] = Qt::white - @colors["yellow"] = Qt::yellow + @colors["black"] = TQt::black + @colors["blue"] = TQt::blue + @colors["cyan"] = TQt::cyan + @colors["darkblue"] = TQt::darkBlue + @colors["darkcyan"] = TQt::darkCyan + @colors["darkgray"] = TQt::darkGray + @colors["darkgreen"] = TQt::darkGreen + @colors["darkmagenta"] = TQt::darkMagenta + @colors["darkred"] = TQt::darkRed + @colors["darkyellow"] = TQt::darkYellow + @colors["gray"] = TQt::gray + @colors["green"] = TQt::green + @colors["lightgray"] = TQt::lightGray + @colors["magenta"] = TQt::magenta + @colors["red"] = TQt::red + @colors["white"] = TQt::white + @colors["yellow"] = TQt::yellow end populate() @@ -65,7 +65,7 @@ def populate() @colorTable.numRows = @colors.length if ! @colors.empty? - pixmap = Qt::Pixmap.new( 22, 22 ) + pixmap = TQt::Pixmap.new( 22, 22 ) row = 0 @colors.sort.each do |pair| key = pair[0] @@ -75,7 +75,7 @@ def populate() @colorTable.setPixmap( row, COL_NAME, pixmap ); @colorTable.setText( row, COL_HEX, color.name().upcase() ) if @show_web - item = Qt::CheckTableItem.new( @colorTable, "" ) + item = TQt::CheckTableItem.new( @colorTable, "" ) item.checked = webColor?( color ) @colorTable.setItem( row, COL_WEB, item ) end @@ -98,16 +98,16 @@ def populate() @colorIconView.clear() @colors.each do |key, data| - Qt::IconViewItem.new( @colorIconView, key, colorSwatch(data) ) + TQt::IconViewItem.new( @colorIconView, key, colorSwatch(data) ) end @icons_dirty = false end end def colorSwatch( color ) - pixmap = Qt::Pixmap.new( 80, 80 ) + pixmap = TQt::Pixmap.new( 80, 80 ) pixmap.fill( white ) - painter = Qt::Painter.new + painter = TQt::Painter.new painter.begin( pixmap ) painter.pen = NoPen painter.brush = color @@ -131,7 +131,7 @@ def fileOpen() return end - filename = Qt::FileDialog.getOpenFileName( + filename = TQt::FileDialog.getOpenFileName( nil, "Colors (*.txt)", self, "file open", "Color Tool -- File Open" ) if ! filename.nil? @@ -147,9 +147,9 @@ def fileSave() return end - file = Qt::File.new( @filename ) - if file.open( Qt::IO_WriteOnly ) - stream = Qt::TextStream.new( file ) + file = TQt::File.new( @filename ) + if file.open( TQt::IO_WriteOnly ) + stream = TQt::TextStream.new( file ) if ! @comments.empty? stream << @comments + "\n" << "\n" end @@ -167,13 +167,13 @@ def fileSave() end def fileSaveAs() - filename = Qt::FileDialog.getSaveFileName( + filename = TQt::FileDialog.getSaveFileName( nil, "Colors (*.txt)", self, "file save as", "Color Tool -- File Save As" ) if ! filename.nil? ans = 0 - if Qt::File.exists( filename ) - ans = Qt::MessageBox.warning( + if TQt::File.exists( filename ) + ans = TQt::MessageBox.warning( self, "Color Tool -- Overwrite File", "Overwrite\n'#{filename}'?" , "&Yes", "&No", nil, 1, 1 ) @@ -191,17 +191,17 @@ def load( filename ) clearData( false ) @filename = filename regex = Regexp.new( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" ) - file = Qt::File.new( filename ) - if file.open( Qt::IO_ReadOnly ) + file = TQt::File.new( filename ) + if file.open( TQt::IO_ReadOnly ) statusBar().message( "Loading '#{filename}'..." ) - stream = Qt::TextStream.new( file ) + stream = TQt::TextStream.new( file ) while ! stream.eof() line = stream.readLine() m = regex.match( line ) if m.nil? @comments += line else - @colors[m[4]] = Qt::Color.new(m[1].to_i,m[2].to_i,m[3].to_i ) + @colors[m[4]] = TQt::Color.new(m[1].to_i,m[2].to_i,m[3].to_i ) end end file.close() @@ -227,7 +227,7 @@ def okToClear() msg = "Colors '#{@filename}'\n" end msg += "has been changed." - ans = Qt::MessageBox.information( + ans = TQt::MessageBox.information( self, "Color Tool -- Unsaved Changes", msg, "&Save", "Cancel", "&Abandon", @@ -249,7 +249,7 @@ end def fileExit() if okToClear() saveSettings() - Qt::Application.exit( 0 ) + TQt::Application.exit( 0 ) end end @@ -321,8 +321,8 @@ end def editFind() if ! @findForm @findForm = FindForm.new( self ) - connect( @findForm, SIGNAL( 'lookfor(const QString&)' ), - self, SLOT( 'lookfor(const QString&)' ) ) + connect( @findForm, SIGNAL( 'lookfor(const TQString&)' ), + self, SLOT( 'lookfor(const TQString&)' ) ) end @findForm.show() end @@ -425,19 +425,19 @@ end def editAdd() - color = Qt::white + color = TQt::white if ! @colors.empty? visible = @colorWidgetStack.visibleWidget() if visible == @tablePage - color = Qt::Color.new(@colorTable.text( @colorTable.currentRow(), + color = TQt::Color.new(@colorTable.text( @colorTable.currentRow(), @colorTable.currentColumn() )) else - color = Qt::Color.new(@colorIconView.currentItem().text()) + color = TQt::Color.new(@colorIconView.currentItem().text()) end end - color = Qt::ColorDialog.getColor( color, self ) + color = TQt::ColorDialog.getColor( color, self ) if color.valid? - pixmap = Qt::Pixmap.new( 80, 10 ) + pixmap = TQt::Pixmap.new( 80, 10 ) pixmap.fill( color ) colorForm = ColorNameForm.new( self, "color", true ) colorForm.setColors( @colors ) @@ -445,7 +445,7 @@ def editAdd() if colorForm.exec() name = colorForm.colorLineEdit.text() @colors[name] = color - pixmap = Qt::Pixmap.new( 22, 22 ) + pixmap = TQt::Pixmap.new( 22, 22 ) pixmap.fill( color ) row = @colorTable.currentRow() @colorTable.insertRows( row, 1 ) @@ -453,13 +453,13 @@ def editAdd() @colorTable.setPixmap( row, COL_NAME, pixmap ) @colorTable.setText( row, COL_HEX, color.name().upcase() ) if @show_web - item = Qt::CheckTableItem.new( @colorTable, "" ) + item = TQt::CheckTableItem.new( @colorTable, "" ) item.checked = webColor?( color ) @colorTable.setItem( row, COL_WEB, item ) end @colorTable.setCurrentCell( row, 0 ) - Qt::IconViewItem.new( @colorIconView, name, + TQt::IconViewItem.new( @colorIconView, name, colorSwatch( color ) ) @changed = true end @@ -493,8 +493,8 @@ def editOptions() end def loadSettings() - settings = Qt::Settings.new - settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY ) + settings = TQt::Settings.new + settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY ) windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 550 ) windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 500 ) windowX = settings.readNumEntry( APP_KEY + "WindowX", 0 ) @@ -511,8 +511,8 @@ def loadSettings() end def saveSettings() - settings = Qt::Settings.new - settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY ) + settings = TQt::Settings.new + settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY ) settings.writeEntry( APP_KEY + "WindowWidth", width() ) settings.writeEntry( APP_KEY + "WindowHeight", height() ) settings.writeEntry( APP_KEY + "WindowX", x() ) diff --git a/qtruby/rubylib/designer/examples/colortool/optionsform.ui b/qtruby/rubylib/designer/examples/colortool/optionsform.ui index 1bb7e8ef..15bc71c4 100644 --- a/qtruby/rubylib/designer/examples/colortool/optionsform.ui +++ b/qtruby/rubylib/designer/examples/colortool/optionsform.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <class>OptionsForm</class> -<widget class="QDialog"> +<widget class="TQDialog"> <property name="name"> <cstring>OptionsForm</cstring> </property> @@ -19,7 +19,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QGroupBox"> + <widget class="TQGroupBox"> <property name="name"> <cstring>GroupBox2</cstring> </property> @@ -30,7 +30,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>webCheckBox</cstring> </property> @@ -43,7 +43,7 @@ </widget> </hbox> </widget> - <widget class="QButtonGroup"> + <widget class="TQButtonGroup"> <property name="name"> <cstring>ButtonGroup1</cstring> </property> @@ -54,7 +54,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QRadioButton"> + <widget class="TQRadioButton"> <property name="name"> <cstring>hexRadioButton</cstring> </property> @@ -65,7 +65,7 @@ <bool>true</bool> </property> </widget> - <widget class="QRadioButton"> + <widget class="TQRadioButton"> <property name="name"> <cstring>nameRadioButton</cstring> </property> @@ -73,7 +73,7 @@ <string>&Name, e.g. light blue</string> </property> </widget> - <widget class="QRadioButton"> + <widget class="TQRadioButton"> <property name="name"> <cstring>rgbRadioButton</cstring> </property> @@ -83,7 +83,7 @@ </widget> </vbox> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout5</cstring> </property> @@ -108,7 +108,7 @@ </size> </property> </spacer> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>okPushButton</cstring> </property> @@ -119,7 +119,7 @@ <bool>true</bool> </property> </widget> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>cancelPushButton</cstring> </property> diff --git a/qtruby/rubylib/designer/rbuic/LICENSE.GPL b/qtruby/rubylib/designer/rbuic/LICENSE.GPL index 3e51afd8..853306c0 100644 --- a/qtruby/rubylib/designer/rbuic/LICENSE.GPL +++ b/qtruby/rubylib/designer/rbuic/LICENSE.GPL @@ -109,9 +109,9 @@ above, provided that you also meet all of these conditions: these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) + the Program is not retquired to print an announcement.) -These requirements apply to the modified work as a whole. If +These retquirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those @@ -177,7 +177,7 @@ However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - 5. You are not required to accept this License, since you have not + 5. You are not retquired to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by @@ -263,14 +263,14 @@ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +TO THE TQUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + 12. IN NO EVENT UNLESS RETQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSETQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER diff --git a/qtruby/rubylib/designer/rbuic/domtool.cpp b/qtruby/rubylib/designer/rbuic/domtool.cpp index 65ea3a71..e42933b9 100644 --- a/qtruby/rubylib/designer/rbuic/domtool.cpp +++ b/qtruby/rubylib/designer/rbuic/domtool.cpp @@ -51,9 +51,9 @@ \sa hasProperty() */ -TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) +TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -68,9 +68,9 @@ TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, co /*! \overload */ -TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) +TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ) { - TQString comment; + TTQString comment; return readProperty( e, name, defValue, comment ); } @@ -79,9 +79,9 @@ TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, co \sa readProperty() */ -bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) +bool DomTool::hasProperty( const TTQDomElement& e, const TTQString& name ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -92,13 +92,13 @@ bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) return false; } -TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& type ) +TTQStringList DomTool::propertiesOfType( const TTQDomElement& e, const TTQString& type ) { - TQStringList result; - TQDomElement n; + TTQStringList result; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); + TTQDomElement n2 = n.firstChild().toElement(); if ( n2.tagName() == type ) result += n.attribute( "name" ); } @@ -107,20 +107,20 @@ TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& t } -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue ) +TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue ) { - TQString dummy; + TTQString dummy; return elementToVariant( e, defValue, dummy ); } /*! Interprets element \a e as variant and returns the result of the interpretation. */ -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ) +TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue, TTQString &comment ) { - TQVariant v; + TTQVariant v; if ( e.tagName() == "rect" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -133,9 +133,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQRect( x, y, w, h ) ); + v = TTQVariant( TTQRect( x, y, w, h ) ); } else if ( e.tagName() == "point" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -144,9 +144,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQPoint( x, y ) ); + v = TTQVariant( TTQPoint( x, y ) ); } else if ( e.tagName() == "size" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -155,12 +155,12 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQSize( w, h ) ); + v = TTQVariant( TTQSize( w, h ) ); } else if ( e.tagName() == "color" ) { - v = TQVariant( readColor( e ) ); + v = TTQVariant( readColor( e ) ); } else if ( e.tagName() == "font" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQFont f( defValue.toFont() ); + TTQDomElement n3 = e.firstChild().toElement(); + TTQFont f( defValue.toFont() ); while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) f.setFamily( n3.firstChild().toText().data() ); @@ -176,58 +176,58 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def f.setStrikeOut( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = TQVariant( f ); + v = TTQVariant( f ); } else if ( e.tagName() == "string" ) { - v = TQVariant( e.firstChild().toText().data() ); - TQDomElement n = e; + v = TTQVariant( e.firstChild().toText().data() ); + TTQDomElement n = e; n = n.nextSibling().toElement(); if ( n.tagName() == "comment" ) comment = n.firstChild().toText().data(); } else if ( e.tagName() == "cstring" ) { - v = TQVariant( TQCString( e.firstChild().toText().data() ) ); + v = TTQVariant( TTQCString( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "number" ) { bool ok = true; - v = TQVariant( e.firstChild().toText().data().toInt( &ok ) ); + v = TTQVariant( e.firstChild().toText().data().toInt( &ok ) ); if ( !ok ) - v = TQVariant( e.firstChild().toText().data().toDouble() ); + v = TTQVariant( e.firstChild().toText().data().toDouble() ); } else if ( e.tagName() == "bool" ) { - TQString t = e.firstChild().toText().data(); - v = TQVariant( t == "true" || t == "1", 0 ); + TTQString t = e.firstChild().toText().data(); + v = TTQVariant( t == "true" || t == "1", 0 ); } else if ( e.tagName() == "pixmap" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "iconset" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "image" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "enum" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "set" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "sizepolicy" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQSizePolicy sp; + TTQDomElement n3 = e.firstChild().toElement(); + TTQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = TQVariant( sp ); + v = TTQVariant( sp ); } else if ( e.tagName() == "cursor" ) { - v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) ); + v = TTQVariant( TTQCursor( e.firstChild().toText().data().toInt() ) ); } else if ( e.tagName() == "stringlist" ) { - TQStringList lst; - TQDomElement n; + TTQStringList lst; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) lst << n.firstChild().toText().data(); - v = TQVariant( lst ); + v = TTQVariant( lst ); } else if ( e.tagName() == "date" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -239,9 +239,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQDate( y, m, d ) ); + v = TTQVariant( TTQDate( y, m, d ) ); } else if ( e.tagName() == "time" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -253,9 +253,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQTime( h, m, s ) ); + v = TTQVariant( TTQTime( h, m, s ) ); } else if ( e.tagName() == "datetime" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d ; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { @@ -273,7 +273,7 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQDateTime( TQDate( y, mo, d ), TQTime( h, mi, s ) ) ); + v = TTQVariant( TTQDateTime( TTQDate( y, mo, d ), TTQTime( h, mi, s ) ) ); } return v; } @@ -282,9 +282,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def /*! Returns the color which is returned in the dom element \a e. */ -TQColor DomTool::readColor( const TQDomElement &e ) +TTQColor DomTool::readColor( const TTQDomElement &e ) { - TQDomElement n = e.firstChild().toElement(); + TTQDomElement n = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n.isNull() ) { if ( n.tagName() == "red" ) @@ -296,7 +296,7 @@ TQColor DomTool::readColor( const TQDomElement &e ) n = n.nextSibling().toElement(); } - return TQColor( r, g, b ); + return TTQColor( r, g, b ); } /*! @@ -306,9 +306,9 @@ TQColor DomTool::readColor( const TQDomElement &e ) \sa hasAttribute() */ -TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) +TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -322,9 +322,9 @@ TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, c /*! \overload */ -TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) +TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ) { - TQString comment; + TTQString comment; return readAttribute( e, name, defValue, comment ); } @@ -333,9 +333,9 @@ TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, c \sa readAttribute() */ -bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) +bool DomTool::hasAttribute( const TTQDomElement& e, const TTQString& name ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -346,7 +346,7 @@ bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) return false; } -static bool toBool( const TQString& s ) +static bool toBool( const TTQString& s ) { return s == "true" || s.toInt() != 0; } @@ -354,11 +354,11 @@ static bool toBool( const TQString& s ) /*! Convert Qt 2.x format to Qt 3.0 format if necessary */ -void DomTool::fixDocument( TQDomDocument& doc ) +void DomTool::fixDocument( TTQDomDocument& doc ) { - TQDomElement e; - TQDomNode n; - TQDomNodeList nl; + TTQDomElement e; + TTQDomNode n; + TTQDomNodeList nl; int i = 0; e = doc.firstChild().toElement(); @@ -374,8 +374,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) // in 3.0, we need to fix a spelling error if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) { for ( i = 0; i < (int) nl.length(); i++ ) { - TQDomElement el = nl.item(i).toElement(); - TQString s = el.attribute( "name" ); + TTQDomElement el = nl.item(i).toElement(); + TTQString s = el.attribute( "name" ); if ( s == "resizeable" ) { el.removeAttribute( "name" ); el.setAttribute( "name", "resizable" ); @@ -391,8 +391,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) e.setAttribute("stdsetdef", 1 ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); if ( name == "resizeable" ) @@ -416,8 +416,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "attribute" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -428,8 +428,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -440,8 +440,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "class" ) { name = n2.firstChild().toText().data(); e.setAttribute( "class", name ); diff --git a/qtruby/rubylib/designer/rbuic/domtool.h b/qtruby/rubylib/designer/rbuic/domtool.h index e83e106b..cf3bfc65 100644 --- a/qtruby/rubylib/designer/rbuic/domtool.h +++ b/qtruby/rubylib/designer/rbuic/domtool.h @@ -30,23 +30,23 @@ #include <tqvariant.h> #include <tqnamespace.h> -class QDomElement; -class QDomDocument; +class TQDomElement; +class TQDomDocument; class DomTool : public Qt { public: - static TQVariant readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); - static TQVariant readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ); - static bool hasProperty( const TQDomElement& e, const TQString& name ); - static TQStringList propertiesOfType( const TQDomElement& e, const TQString& type ); - static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue ); - static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ); - static TQVariant readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); - static TQVariant readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ); - static bool hasAttribute( const TQDomElement& e, const TQString& name ); - static TQColor readColor( const TQDomElement &e ); - static void fixDocument( TQDomDocument& ); + static TTQVariant readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ); + static TTQVariant readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ); + static bool hasProperty( const TTQDomElement& e, const TTQString& name ); + static TTQStringList propertiesOfType( const TTQDomElement& e, const TTQString& type ); + static TTQVariant elementToVariant( const TTQDomElement& e, const TTQVariant& defValue ); + static TTQVariant elementToVariant( const TTQDomElement& e, const TTQVariant& defValue, TTQString &comment ); + static TTQVariant readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ); + static TTQVariant readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ); + static bool hasAttribute( const TTQDomElement& e, const TTQString& name ); + static TTQColor readColor( const TTQDomElement &e ); + static void fixDocument( TTQDomDocument& ); }; diff --git a/qtruby/rubylib/designer/rbuic/embed.cpp b/qtruby/rubylib/designer/rbuic/embed.cpp index a1cf0a3f..365eaf7d 100644 --- a/qtruby/rubylib/designer/rbuic/embed.cpp +++ b/qtruby/rubylib/designer/rbuic/embed.cpp @@ -51,15 +51,15 @@ struct EmbedImage { int width, height, depth; int numColors; - QRgb* colorTable; - TQString name; - TQString cname; + TQRgb* colorTable; + TTQString name; + TTQString cname; bool alpha; }; -static TQString convertToCIdentifier( const char *s ) +static TTQString convertToCIdentifier( const char *s ) { - TQString r = s; + TTQString r = s; int len = r.length(); if ( len > 0 && !isalpha( (char)r[0].latin1() ) ) r[0] = '_'; @@ -71,16 +71,16 @@ static TQString convertToCIdentifier( const char *s ) } -static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) +static ulong embedData( TTQTextStream& out, const uchar* input, int nbytes ) { #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION - TQByteArray bazip( qCompress( input, nbytes ) ); + TTQByteArray bazip( qCompress( input, nbytes ) ); ulong len = bazip.size(); #else ulong len = nbytes; #endif static const char hexdigits[] = "0123456789abcdef"; - TQString s; + TTQString s; for ( int i=0; i<(int)len; i++ ) { if ( (i%14) == 0 ) { s += "\n "; @@ -105,10 +105,10 @@ static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) return len; } -static void embedData( TQTextStream& out, const QRgb* input, int n ) +static void embedData( TTQTextStream& out, const TQRgb* input, int n ) { out << hex; - const QRgb *v = input; + const TQRgb *v = input; for ( int i=0; i<n; i++ ) { if ( (i%14) == 0 ) out << "\n "; @@ -120,37 +120,37 @@ static void embedData( TQTextStream& out, const QRgb* input, int n ) out << dec; // back to decimal mode } -void Uic::embed( TQTextStream& out, const char* project, const TQStringList& images ) +void Uic::embed( TTQTextStream& out, const char* project, const TTQStringList& images ) { - TQString cProject = convertToCIdentifier( project ); + TTQString cProject = convertToCIdentifier( project ); - TQStringList::ConstIterator it; + TTQStringList::ConstIterator it; out << "# Image collection for project '" << project << "'." << endl; out << "#" << endl; out << "# Generated from reading image files: " << endl; for ( it = images.begin(); it != images.end(); ++it ) out << "# " << *it << endl; out << "#" << endl; - out << "# Created: " << TQDateTime::currentDateTime().toString() << endl; + out << "# Created: " << TTQDateTime::currentDateTime().toString() << endl; out << "# by: The QtRuby User Interface Compiler (rbuic)" << endl; out << "#" << endl; out << "# WARNING! All changes made in this file will be lost!" << endl; out << endl; if (hasKDEwidget) { - out << "require 'Korundum'" << endl; + out << "retquire 'Korundum'" << endl; } else { - out << "require 'Qt'" << endl; + out << "retquire 'Qt'" << endl; } out << endl; - out << indent << "class MimeSourceFactory_" << cProject << " < Qt::MimeSourceFactory" << endl; + out << indent << "class MimeSourceFactory_" << cProject << " < TQt::MimeSourceFactory" << endl; out << endl; - TQPtrList<EmbedImage> list_image; + TTQPtrList<EmbedImage> list_image; int image_count = 0; for ( it = images.begin(); it != images.end(); ++it ) { - TQImage img; + TTQImage img; if ( !img.load( *it ) ) { fprintf( stderr, "rbuic: cannot load image file %s\n", (*it).latin1() ); continue; @@ -160,19 +160,19 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima e->height = img.height(); e->depth = img.depth(); e->numColors = img.numColors(); - e->colorTable = new QRgb[e->numColors]; + e->colorTable = new TQRgb[e->numColors]; e->alpha = img.hasAlphaBuffer(); - memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb)); - TQFileInfo fi( *it ); + memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(TQRgb)); + TTQFileInfo fi( *it ); e->name = fi.fileName(); - e->cname = TQString("@@image_%1").arg( image_count++); + e->cname = TTQString("@@image_%1").arg( image_count++); list_image.append( e ); out << "# " << *it << endl; - TQString imgname = (const char *)e->cname; + TTQString imgname = (const char *)e->cname; - TQString s; + TTQString s; if ( e->depth == 1 ) - img = img.convertBitOrder(TQImage::BigEndian); + img = img.convertBitOrder(TTQImage::BigEndian); out << indent << imgname << "_data = ["; embedData( out, img.bits(), img.numBytes() ); out << "]\n\n"; @@ -192,7 +192,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima { out << indent << "\"" << e->name << "\"" << " => [" << e->cname << "_data, " << e->width << ", " << e->height << ", " << e->depth << ", " - << (e->numColors ? e->cname + "_ctable" : TQString::fromLatin1( "[]" ) ) << ", " + << (e->numColors ? e->cname + "_ctable" : TTQString::fromLatin1( "[]" ) ) << ", " << (e->alpha ? "true" : "false") << "]," << endl; e = list_image.next(); } @@ -212,28 +212,28 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "if @@embed_images[name].nil?" << endl; ++indent; - out << indent << "return Qt::Image.new()" << endl; + out << indent << "return TQt::Image.new()" << endl; --indent; out << indent << "end" << endl; out << indent << endl; #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION out << indent << "baunzip = qUncompress( @@embed_images[name][0].pack(\"C*\")," << endl; out << indent << " @@embed_images[name][0].length )" << endl; - out << indent << "img = Qt::Image.new( baunzip.data," << endl; + out << indent << "img = TQt::Image.new( baunzip.data," << endl; out << indent << " @@embed_images[name][1]," << endl; out << indent << " @@embed_images[name][2]," << endl; out << indent << " @@embed_images[name][3]," << endl; out << indent << " @@embed_images[name][4]," << endl; out << indent << " @@embed_images[name][4].length," << endl; - out << indent << " Qt::Image::BigEndian )" << endl; + out << indent << " TQt::Image::BigEndian )" << endl; #else - out << indent << "img = Qt::Image.new( @@embed_images[name][0].pack(\"C*\")," << endl; + out << indent << "img = TQt::Image.new( @@embed_images[name][0].pack(\"C*\")," << endl; out << indent << " @@embed_images[name][1]," << endl; out << indent << " @@embed_images[name][2]," << endl; out << indent << " @@embed_images[name][3]," << endl; out << indent << " @@embed_images[name][4]," << endl; out << indent << " @@embed_images[name][4].length," << endl; - out << indent << " Qt::Image::BigEndian )" << endl; + out << indent << " TQt::Image::BigEndian )" << endl; #endif out << indent << "if @@embed_images[name][5]" << endl; ++indent; @@ -250,14 +250,14 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "img = uic_findImage(abs_name)" << endl; out << indent << "if img.nil?" << endl; ++indent; - out << indent << "Qt::MimeSourceFactory.removeFactory(self)" << endl; - out << indent << "s = Qt::MimeSourceFactory.defaultFactory().data(abs_name);" << endl; - out << indent << "Qt::MimeSourceFactory.addFactory(self)" << endl; + out << indent << "TQt::MimeSourceFactory.removeFactory(self)" << endl; + out << indent << "s = TQt::MimeSourceFactory.defaultFactory().data(abs_name);" << endl; + out << indent << "TQt::MimeSourceFactory.addFactory(self)" << endl; out << indent << "return s" << endl; --indent; out << indent << "end" << endl; - out << indent << "Qt::MimeSourceFactory.defaultFactory().setImage(abs_name, img)" << endl; - out << indent << "return Qt::MimeSourceFactory.defaultFactory().data(abs_name)" << endl; + out << indent << "TQt::MimeSourceFactory.defaultFactory().setImage(abs_name, img)" << endl; + out << indent << "return TQt::MimeSourceFactory.defaultFactory().data(abs_name)" << endl; --indent; out << indent << "end" << endl; --indent; @@ -273,7 +273,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "def StaticInitImages_" << cProject << ".qInitImages" << endl; ++indent; out << indent << "factory = MimeSourceFactory_" << cProject << ".new()" << endl; - out << indent << "Qt::MimeSourceFactory.defaultFactory().addFactory(factory)" << endl; + out << indent << "TQt::MimeSourceFactory.defaultFactory().addFactory(factory)" << endl; out << indent << "@@factories['MimeSourceFactory_" << cProject << "'] = factory" << endl; --indent; out << indent << "end" << endl; @@ -282,7 +282,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima ++indent; out << indent << "for values in @@factories" << endl; ++indent; - out << indent << "Qt::MimeSourceFactory.defaultFactory().removeFactory(values)" << endl; + out << indent << "TQt::MimeSourceFactory.defaultFactory().removeFactory(values)" << endl; --indent; out << indent << "end" << endl; out << indent << "@@factories = nil" << endl; diff --git a/qtruby/rubylib/designer/rbuic/form.cpp b/qtruby/rubylib/designer/rbuic/form.cpp index d6c842c0..eb9d6ee7 100644 --- a/qtruby/rubylib/designer/rbuic/form.cpp +++ b/qtruby/rubylib/designer/rbuic/form.cpp @@ -42,7 +42,7 @@ #include <zlib.h> -static TQByteArray unzipXPM( TQString data, ulong& length ) +static TTQByteArray unzipXPM( TTQString data, ulong& length ) { const int lengthOffset = 4; int baSize = data.length() / 2 + lengthOffset; @@ -68,13 +68,13 @@ static TQByteArray unzipXPM( TQString data, ulong& length ) ba[1] = ( length & 0x00ff0000 ) >> 16; ba[2] = ( length & 0x0000ff00 ) >> 8; ba[3] = ( length & 0x000000ff ); - TQByteArray baunzip = qUncompress( ba, baSize ); + TTQByteArray baunzip = qUncompress( ba, baSize ); delete[] ba; return baunzip; } -static TQString imageDataName(TQString name) { - TQString result = name + "_data"; +static TTQString imageDataName(TTQString name) { + TTQString result = name + "_data"; result.replace("@", "@@"); return result; } @@ -84,33 +84,33 @@ static TQString imageDataName(TQString name) { \sa createFormDecl(), createObjectImpl() */ -void Uic::createFormImpl( const TQDomElement &e ) +void Uic::createFormImpl( const TTQDomElement &e ) { - TQDomElement n; - TQDomNodeList nl; + TTQDomElement n; + TTQDomNodeList nl; int i; - TQString objClass = getClassName( e ); + TTQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - TQString objName = getObjectName( e ); + TTQString objName = getObjectName( e ); if (hasKDEwidget) { - out << indent << "require 'Korundum'" << endl << endl; + out << indent << "retquire 'Korundum'" << endl << endl; } else { - out << indent << "require 'Qt'" << endl << endl; + out << indent << "retquire 'Qt'" << endl << endl; } - // generate local and local includes required - TQStringList globalIncludes, localIncludes; - TQStringList::Iterator it; - TQStringList sqlClasses; + // generate local and local includes retquired + TTQStringList globalIncludes, localIncludes; + TTQStringList::Iterator it; + TTQStringList sqlClasses; - TQMap<TQString, CustomInclude> customWidgetIncludes; - TQMap<TQString, TQString> functionImpls; + TTQMap<TTQString, CustomInclude> customWidgetIncludes; + TTQMap<TTQString, TTQString> functionImpls; // find additional slots - TQStringList extraSlots; - TQStringList extraSlotTypes; + TTQStringList extraSlots; + TTQStringList extraSlotTypes; nl = e.parentNode().toElement().elementsByTagName( "slot" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -119,7 +119,7 @@ void Uic::createFormImpl( const TQDomElement &e ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - TQString slotName = n.firstChild().toText().data().stripWhiteSpace(); + TTQString slotName = n.firstChild().toText().data().stripWhiteSpace(); if ( slotName.endsWith( ";" ) ) slotName = slotName.left( slotName.length() - 1 ); @@ -128,7 +128,7 @@ void Uic::createFormImpl( const TQDomElement &e ) } // find signals - TQStringList extraSignals; + TTQStringList extraSignals; nl = e.parentNode().toElement().elementsByTagName( "signal" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -137,19 +137,19 @@ void Uic::createFormImpl( const TQDomElement &e ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - TQString sigName = n.firstChild().toText().data().stripWhiteSpace(); + TTQString sigName = n.firstChild().toText().data().stripWhiteSpace(); if ( sigName.endsWith( ";" ) ) sigName = sigName.left( sigName.length() - 1 ); extraSignals += sigName; } //find additional functions - TQStringList extraFunctions; + TTQStringList extraFunctions; for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "functions" ) { // compatibility - for ( TQDomElement n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + for ( TTQDomElement n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "function" ) { - TQString fname; + TTQString fname; if( !n2.attribute("name").isNull() ) { fname = n2.attribute( "name" ); @@ -165,11 +165,11 @@ void Uic::createFormImpl( const TQDomElement &e ) } } } else if ( n.tagName() == "customwidgets" ) { - TQDomElement n2 = n.firstChild().toElement(); + TTQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "customwidget" ) { - TQDomElement n3 = n2.firstChild().toElement(); - TQString cl, header; + TTQDomElement n3 = n2.firstChild().toElement(); + TTQString cl, header; WidgetDatabaseRecord *r = new WidgetDatabaseRecord; while ( !n3.isNull() ) { if ( n3.tagName() == "class" ) { @@ -253,7 +253,7 @@ void Uic::createFormImpl( const TQDomElement &e ) ++indent; // additional attributes (from Designer) - TQStringList publicVars, protectedVars, privateVars; + TTQStringList publicVars, protectedVars, privateVars; nl = e.parentNode().toElement().elementsByTagName( "variable" ); for ( i = 0; i < (int)nl.length(); i++ ) { n = nl.item( i ).toElement(); @@ -261,8 +261,8 @@ void Uic::createFormImpl( const TQDomElement &e ) // Someday it should be uncommented. //if ( n.parentNode().toElement().tagName() != "variables" ) // continue; - TQString access = n.attribute( "access", "protected" ); - TQString var = n.firstChild().toText().data().stripWhiteSpace(); + TTQString access = n.attribute( "access", "protected" ); + TTQString var = n.firstChild().toText().data().stripWhiteSpace(); if ( var.endsWith( ";" ) ) var.truncate(var.length() - 1); if ( access == "public" ) @@ -288,10 +288,10 @@ void Uic::createFormImpl( const TQDomElement &e ) // additional includes (local or global ) and forward declaractions nl = e.parentNode().toElement().elementsByTagName( "include" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQDomElement n2 = nl.item(i).toElement(); - TQString s = n2.firstChild().toText().data(); + TTQDomElement n2 = nl.item(i).toElement(); + TTQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) != "local" ) { - if ( s.right( 5 ) == ".ui.h" && !TQFile::exists( s ) ) + if ( s.right( 5 ) == ".ui.h" && !TTQFile::exists( s ) ) continue; if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" ) continue; @@ -301,10 +301,10 @@ void Uic::createFormImpl( const TQDomElement &e ) // do the local includes afterwards, since global includes have priority on clashes for ( i = 0; i < (int) nl.length(); i++ ) { - TQDomElement n2 = nl.item(i).toElement(); - TQString s = n2.firstChild().toText().data(); + TTQDomElement n2 = nl.item(i).toElement(); + TTQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) == "local" &&!globalIncludes.contains( s ) ) { - if ( s.right( 5 ) == ".ui.h" && !TQFile::exists( s ) ) + if ( s.right( 5 ) == ".ui.h" && !TTQFile::exists( s ) ) continue; if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" ) continue; @@ -315,8 +315,8 @@ void Uic::createFormImpl( const TQDomElement &e ) // additional custom widget headers nl = e.parentNode().toElement().elementsByTagName( "header" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQDomElement n2 = nl.item(i).toElement(); - TQString s = n2.firstChild().toText().data(); + TTQDomElement n2 = nl.item(i).toElement(); + TTQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) != "local" ) globalIncludes += s; else @@ -325,17 +325,17 @@ void Uic::createFormImpl( const TQDomElement &e ) // grab slots/funcs defined in ui.h files - for(TQStringList::Iterator it = localIncludes.begin(); it != localIncludes.end(); ++it) + for(TTQStringList::Iterator it = localIncludes.begin(); it != localIncludes.end(); ++it) { if((*it).right( 5 ) == ".ui.h") { - TQFile f((*it)); + TTQFile f((*it)); if( f.open( IO_ReadOnly ) ) { - TQRegExp re("^def\\s+([a-zA-Z0-9_]+)\\s.*$"); - TQRegExp re2("^end\\s*$"); - TQTextStream t( &f ); - TQString s, s2, s3; + TTQRegExp re("^def\\s+([a-zA-Z0-9_]+)\\s.*$"); + TTQRegExp re2("^end\\s*$"); + TTQTextStream t( &f ); + TTQString s, s2, s3; while ( !t.eof() ) { s = t.readLine(); @@ -366,7 +366,7 @@ void Uic::createFormImpl( const TQDomElement &e ) for ( it = tags.begin(); it != tags.end(); ++it ) { nl = e.parentNode().toElement().elementsByTagName( *it ); for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget - TQString name = getClassName( nl.item(i).toElement() ); + TTQString name = getClassName( nl.item(i).toElement() ); if ( name == "Spacer" ) { globalIncludes += "tqlayout.h"; globalIncludes += "tqapplication.h"; @@ -375,8 +375,8 @@ void Uic::createFormImpl( const TQDomElement &e ) if ( name.mid( 4 ) == "ListView" ) globalIncludes += "tqheader.h"; if ( name != objClass ) { - int wid = WidgetDatabase::idFromClassName( name.replace( TQRegExp("^Qt::"), "Q" ) ); - TQMap<TQString, CustomInclude>::Iterator it = customWidgetIncludes.find( name ); + int wid = WidgetDatabase::idFromClassName( name.replace( TTQRegExp("^TQt::"), "Q" ) ); + TTQMap<TTQString, CustomInclude>::Iterator it = customWidgetIncludes.find( name ); if ( it == customWidgetIncludes.end() ) globalIncludes += WidgetDatabase::includeFile( wid ); } @@ -385,9 +385,9 @@ void Uic::createFormImpl( const TQDomElement &e ) dbConnections = unique( dbConnections ); if ( dbConnections.count() ) - sqlClasses += "Qt::SqlDatabase"; + sqlClasses += "TQt::SqlDatabase"; if ( dbCursors.count() ) - sqlClasses += "Qt::SqlCursor"; + sqlClasses += "TQt::SqlCursor"; bool dbForm = false; if ( dbForms[ "(default)" ].count() ) dbForm = true; @@ -401,38 +401,38 @@ void Uic::createFormImpl( const TQDomElement &e ) } } if ( dbForm || subDbForms ) { - sqlClasses += "Qt::SqlForm"; - sqlClasses += "Qt::SqlRecord"; + sqlClasses += "TQt::SqlForm"; + sqlClasses += "TQt::SqlRecord"; } if (globalIncludes.findIndex("tqdatatable.h") >= 0) - sqlClasses += "Qt::DataTable"; + sqlClasses += "TQt::DataTable"; if (globalIncludes.findIndex("qtableview.h") >= 0) - sqlClasses += "Qt::TableView"; + sqlClasses += "TQt::TableView"; if (globalIncludes.findIndex("tqdatabrowser.h") >= 0) - sqlClasses += "Qt::DataBrowser"; + sqlClasses += "TQt::DataBrowser"; out << endl; - // find out what images are required - TQStringList requiredImages; + // find out what images are retquired + TTQStringList retquiredImages; static const char *imgTags[] = { "pixmap", "iconset", 0 }; for ( i = 0; imgTags[i] != 0; i++ ) { nl = e.parentNode().toElement().elementsByTagName( imgTags[i] ); for ( int j = 0; j < (int) nl.length(); j++ ) { - TQString img = "@"; - requiredImages += (img + nl.item(j).firstChild().toText().data()); + TTQString img = "@"; + retquiredImages += (img + nl.item(j).firstChild().toText().data()); } } // register the object and unify its name - TQString loadFunction(objName); + TTQString loadFunction(objName); objName = registerObject( objName ); - TQStringList images; - TQStringList xpmImages; + TTQStringList images; + TTQStringList xpmImages; if ( pixmapLoaderFunction.isEmpty() && !externPixmaps ) { // create images @@ -443,19 +443,19 @@ void Uic::createFormImpl( const TQDomElement &e ) nl = n.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQString img = registerObject( nl.item(i).toElement().attribute( "name" ) ); - if ( !requiredImages.contains( img ) ) + TTQString img = registerObject( nl.item(i).toElement().attribute( "name" ) ); + if ( !retquiredImages.contains( img ) ) continue; - TQDomElement tmp = nl.item(i).firstChild().toElement(); + TTQDomElement tmp = nl.item(i).firstChild().toElement(); if ( tmp.tagName() != "data" ) continue; - TQString format = tmp.attribute("format", "PNG" ); - TQString data = tmp.firstChild().toText().data(); + TTQString format = tmp.attribute("format", "PNG" ); + TTQString data = tmp.firstChild().toText().data(); if ( format == "XPM.GZ" ) { xpmImages += img; ulong length = tmp.attribute("length").toULong(); - TQByteArray baunzip = unzipXPM( data, length ); + TTQByteArray baunzip = unzipXPM( data, length ); // shouldn't we test the initial `length' against the // resulting `length' to catch corrupt UIC files? int a = 0; @@ -484,13 +484,13 @@ void Uic::createFormImpl( const TQDomElement &e ) ++indent; int a ; for ( a = 0; a < (int) (data.length()/2)-1; a++ ) { - out << "0x" << TQString(data[2*a]) << TQString(data[2*a+1]) << ","; + out << "0x" << TTQString(data[2*a]) << TTQString(data[2*a+1]) << ","; if ( a % 12 == 11 ) out << endl << " "; else out << " "; } - out << "0x" << TQString(data[2*a]) << TQString(data[2*a+1]) << " ].pack \"C*\"" << endl; + out << "0x" << TTQString(data[2*a]) << TTQString(data[2*a+1]) << " ].pack \"C*\"" << endl; --indent; out << endl; } @@ -504,12 +504,12 @@ void Uic::createFormImpl( const TQDomElement &e ) /* out << indent << "def uic_load_pixmap_" << loadFunction << "( data )" << endl; ++indent; - out << indent << "pix = Qt::Pixmap.new()" << endl; - out << indent << "m = Qt::MimeSourceFactory.defaultFactory().data(data)" << endl; + out << indent << "pix = TQt::Pixmap.new()" << endl; + out << indent << "m = TQt::MimeSourceFactory.defaultFactory().data(data)" << endl; out << endl; out << indent << "if ! m.nil?" << endl; ++indent; - out << indent << "Qt::ImageDrag.decode(m, pix)" << endl; + out << indent << "TQt::ImageDrag.decode(m, pix)" << endl; --indent; out << indent << "end" << endl; out << endl; @@ -520,20 +520,20 @@ void Uic::createFormImpl( const TQDomElement &e ) out << endl; pixmapLoaderFunction = "uic_load_pixmap_" + loadFunction; */ - pixmapLoaderFunction = "Qt::Pixmap.fromMimeSource"; + pixmapLoaderFunction = "TQt::Pixmap.fromMimeSource"; } // constructor(s) - if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) { + if ( objClass == "TQt::Dialog" || objClass == "TQt::Wizard" ) { out << indent << "def initialize(parent = nil, name = nil, modal = false, fl = 0)" << endl; ++indent; out << indent << "super" << endl; - } else if ( objClass == "Qt::Widget") { + } else if ( objClass == "TQt::Widget") { out << indent << "def initialize(parent = nil, name = nil, fl = 0)" << endl; ++indent; out << indent << "super" << endl; - } else if ( objClass == "Qt::MainWindow" ) { + } else if ( objClass == "TQt::MainWindow" ) { out << indent << "def initialize(parent = nil, name = nil, fl = WType_TopLevel)" << endl; ++indent; out << indent << "super" << endl; @@ -548,9 +548,9 @@ void Uic::createFormImpl( const TQDomElement &e ) // create pixmaps for all images if ( !images.isEmpty() ) { - TQStringList::Iterator it; + TTQStringList::Iterator it; for ( it = images.begin(); it != images.end(); ++it ) { - out << indent << (*it) << " = Qt::Pixmap.new()" << endl; + out << indent << (*it) << " = TQt::Pixmap.new()" << endl; out << indent << (*it) << ".loadFromData(" << imageDataName(*it) << ", " << imageDataName(*it) << ".length, \"PNG\")" << endl; } out << endl; @@ -558,7 +558,7 @@ void Uic::createFormImpl( const TQDomElement &e ) // create pixmaps for all images if ( !xpmImages.isEmpty() ) { for ( it = xpmImages.begin(); it != xpmImages.end(); ++it ) { - out << indent << (*it) << " = Qt::Pixmap.new(" << imageDataName(*it) << ")" << endl; + out << indent << (*it) << " = TQt::Pixmap.new(" << imageDataName(*it) << ")" << endl; } out << endl; } @@ -567,21 +567,21 @@ void Uic::createFormImpl( const TQDomElement &e ) out << indent << "statusBar()" << endl; // set the properties - TQSize geometry( 0, 0 ); + TTQSize geometry( 0, 0 ); for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - TQString prop = n.attribute("name"); - TQDomElement n2 = n.firstChild().toElement(); - TQString value = setObjectProperty( objClass, TQString::null, prop, n2, stdset ); + TTQString prop = n.attribute("name"); + TTQDomElement n2 = n.firstChild().toElement(); + TTQString value = setObjectProperty( objClass, TTQString::null, prop, n2, stdset ); if ( value.isEmpty() ) continue; if ( prop == "geometry" && n2.tagName() == "rect") { - TQDomElement n3 = n2.firstChild().toElement(); + TTQDomElement n3 = n2.firstChild().toElement(); while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) geometry.setWidth( n3.firstChild().toText().data().toInt() ); @@ -590,11 +590,11 @@ void Uic::createFormImpl( const TQDomElement &e ) n3 = n3.nextSibling().toElement(); } } else { - TQString call; + TTQString call; if ( stdset ) { call = mkStdSet( prop ) + "(" + value + ")"; } else { - call = "setProperty(\"" + prop + "\", Qt::Variant.new(" + value + "))"; + call = "setProperty(\"" + prop + "\", TQt::Variant.new(" + value + "))"; } if ( n2.tagName() == "string" ) { @@ -612,20 +612,20 @@ void Uic::createFormImpl( const TQDomElement &e ) out << endl; - // create all children, some forms have special requirements + // create all children, some forms have special retquirements - if ( objClass == "Qt::Wizard" ) + if ( objClass == "TQt::Wizard" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, "self" ); - TQString comment; - TQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + TTQString page = createObjectImpl( n, objClass, "self" ); + TTQString comment; + TTQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); out << indent << "addPage(" << page << ", "<< trcall( label ) << ")" << endl; trout << indent << "setTitle( " << page << ", " << trcall( label, comment ) << " )" << endl; - TQVariant def( false, 0 ); + TTQVariant def( false, 0 ); if ( DomTool::hasAttribute( n, "backEnabled" ) ) out << indent << "setBackEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << ");" << endl; if ( DomTool::hasAttribute( n, "nextEnabled" ) ) @@ -654,20 +654,20 @@ void Uic::createFormImpl( const TQDomElement &e ) out << endl; for ( it = dbConnections.begin(); it != dbConnections.end(); ++it ) { if ( !(*it).isEmpty() && (*it) != "(default)") { - out << indent << (*it) << "Connection = Qt::SqlDatabase.database(\"" <<(*it) << "\");" << endl; + out << indent << (*it) << "Connection = TQt::SqlDatabase.database(\"" <<(*it) << "\");" << endl; } } nl = e.parentNode().toElement().elementsByTagName( "widget" ); for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget n = nl.item(i).toElement(); - TQString s = getClassName( n ); - if ( s == "Qt::DataBrowser" || s == "Qt::DataView" ) { - TQString objName = getObjectName( n ); - TQString tab = getDatabaseInfo( n, "table" ); - TQString con = getDatabaseInfo( n, "connection" ); - out << indent << objName << "Form = Qt::SqlForm.new(self, \"" << objName << "Form\")" << endl; - TQDomElement n2; + TTQString s = getClassName( n ); + if ( s == "TQt::DataBrowser" || s == "TQt::DataView" ) { + TTQString objName = getObjectName( n ); + TTQString tab = getDatabaseInfo( n, "table" ); + TTQString con = getDatabaseInfo( n, "connection" ); + out << indent << objName << "Form = TQt::SqlForm.new(self, \"" << objName << "Form\")" << endl; + TTQDomElement n2; for ( n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) createFormImpl( n2, objName, con, tab ); out << indent << objName << ".setForm(" << objName << "Form)" << endl; @@ -713,7 +713,7 @@ void Uic::createFormImpl( const TQDomElement &e ) // take minimumSizeHint() into account, for height-for-width widgets if ( !geometry.isNull() ) { - out << indent << "resize( Qt::Size.new(" << geometry.width() << ", " + out << indent << "resize( TQt::Size.new(" << geometry.width() << ", " << geometry.height() << ").expandedTo(minimumSizeHint()) )" << endl; out << indent << "clearWState( WState_Polished )" << endl; } @@ -724,8 +724,8 @@ void Uic::createFormImpl( const TQDomElement &e ) out << endl; nl = n.elementsByTagName( "connection" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQString sender, receiver, signal, slot; - for ( TQDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + TTQString sender, receiver, signal, slot; + for ( TTQDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "sender" ) sender = n2.firstChild().toText().data(); else if ( n2.tagName() == "receiver" ) @@ -750,17 +750,17 @@ void Uic::createFormImpl( const TQDomElement &e ) if ( receiver == objName ) receiver = "self"; - out << indent << "Qt::Object.connect(" << sender + out << indent << "TQt::Object.connect(" << sender << ", TQT_SIGNAL(\"" << signal << "\"), "<< receiver << ", TQT_SLOT(\"" << slot << "\") )" << endl; } } else if ( n.tagName() == "tabstops" ) { // setup tab order out << endl; - TQString lastName; - TQDomElement n2 = n.firstChild().toElement(); + TTQString lastName; + TTQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "tabstop" ) { - TQString name = n2.firstChild().toText().data(); + TTQString name = n2.firstChild().toText().data(); name = registeredName( name ); if ( !lastName.isEmpty() ) out << indent << "setTabOrder(" << lastName << ", " << name << ")" << endl; @@ -774,7 +774,7 @@ void Uic::createFormImpl( const TQDomElement &e ) // QtRuby - FIXME: what the heck is this ? // buddies bool firstBuddy = true; - for ( TQValueList<Buddy>::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { + for ( TTQValueList<Buddy>::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { if ( isObjectRegistered( (*buddy).buddy ) ) { if ( firstBuddy ) { out << endl; @@ -795,7 +795,7 @@ void Uic::createFormImpl( const TQDomElement &e ) - // handle application events if required + // handle application events if retquired bool needFontEventHandler = false; bool needSqlTableEventHandler = false; bool needSqlDataBrowserEventHandler = false; @@ -803,13 +803,13 @@ void Uic::createFormImpl( const TQDomElement &e ) for ( i = 0; i < (int) nl.length(); i++ ) { if ( !DomTool::propertiesOfType( nl.item(i).toElement() , "font" ).isEmpty() ) needFontEventHandler = true; - TQString s = getClassName( nl.item(i).toElement() ); - if ( s == "Qt::DataTable" || s == "Qt::DataBrowser" ) { + TTQString s = getClassName( nl.item(i).toElement() ); + if ( s == "TQt::DataTable" || s == "TQt::DataBrowser" ) { if ( !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) continue; - if ( s == "Qt::DataTable" ) + if ( s == "TQt::DataTable" ) needSqlTableEventHandler = true; - if ( s == "Qt::DataBrowser" ) + if ( s == "TQt::DataBrowser" ) needSqlDataBrowserEventHandler = true; } if ( needFontEventHandler && needSqlTableEventHandler && needSqlDataBrowserEventHandler ) @@ -829,10 +829,10 @@ void Uic::createFormImpl( const TQDomElement &e ) out << " ret = super( ev ) " << endl; if ( needFontEventHandler ) { ++indent; - out << " if ev.type() == Qt::Event::ApplicationFontChange " << endl; + out << " if ev.type() == TQt::Event::ApplicationFontChange " << endl; for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); - TQStringList list = DomTool::propertiesOfType( n, "font" ); + TTQStringList list = DomTool::propertiesOfType( n, "font" ); for ( it = list.begin(); it != list.end(); ++it ) createExclusiveProperty( n, *it ); } @@ -854,12 +854,12 @@ void Uic::createFormImpl( const TQDomElement &e ) ++indent; if ( needSqlTableEventHandler ) { for ( i = 0; i < (int) nl.length(); i++ ) { - TQString s = getClassName( nl.item(i).toElement() ); - if ( s == "Qt::DataTable" ) { + TTQString s = getClassName( nl.item(i).toElement() ); + if ( s == "TQt::DataTable" ) { n = nl.item(i).toElement(); - TQString c = TQString("@") + getObjectName( n ); - TQString conn = getDatabaseInfo( n, "connection" ); - TQString tab = getDatabaseInfo( n, "table" ); + TTQString c = TTQString("@") + getObjectName( n ); + TTQString conn = getDatabaseInfo( n, "connection" ); + TTQString tab = getDatabaseInfo( n, "table" ); if ( !( conn.isEmpty() || tab.isEmpty() ) ) { out << indent << "if " << "!" << c << ".nil?" << endl; ++indent; @@ -868,12 +868,12 @@ void Uic::createFormImpl( const TQDomElement &e ) out << indent << "if !cursor.nil?" << endl; ++indent; if ( conn == "(default)" ) - out << indent << "cursor = Qt::SqlCursor.new(\"" << tab << "\")" << endl; + out << indent << "cursor = TQt::SqlCursor.new(\"" << tab << "\")" << endl; else - out << indent << "cursor = Qt::SqlCursor.new(\"" << tab << "\", true, " << conn << "Connection)" << endl; + out << indent << "cursor = TQt::SqlCursor.new(\"" << tab << "\", true, " << conn << "Connection)" << endl; out << indent << "if " << c << ".readOnly? " << endl; ++indent; - out << indent << "cursor.mode = Qt::SqlCursor::ReadOnly" << endl; + out << indent << "cursor.mode = TQt::SqlCursor::ReadOnly" << endl; --indent; out << indent << "end " << endl; out << indent << c << ".setSqlCursor(cursor, false, true)" << endl; @@ -882,7 +882,7 @@ void Uic::createFormImpl( const TQDomElement &e ) out << indent << "end" << endl; out << indent << "if !cursor.active?" << endl; ++indent; - out << indent << c << ".refresh(Qt::DataTable::RefreshAll)" << endl; + out << indent << c << ".refresh(TQt::DataTable::RefreshAll)" << endl; --indent; out << indent << "end" << endl; --indent; @@ -894,12 +894,12 @@ void Uic::createFormImpl( const TQDomElement &e ) if ( needSqlDataBrowserEventHandler ) { nl = e.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQString s = getClassName( nl.item(i).toElement() ); - if ( s == "Qt::DataBrowser" ) { - TQString obj = getObjectName( nl.item(i).toElement() ); - TQString tab = getDatabaseInfo( nl.item(i).toElement(), + TTQString s = getClassName( nl.item(i).toElement() ); + if ( s == "TQt::DataBrowser" ) { + TTQString obj = getObjectName( nl.item(i).toElement() ); + TTQString tab = getDatabaseInfo( nl.item(i).toElement(), "table" ); - TQString conn = getDatabaseInfo( nl.item(i).toElement(), + TTQString conn = getDatabaseInfo( nl.item(i).toElement(), "connection" ); if ( !(tab).isEmpty() ) { out << indent << "if " << obj << endl; @@ -907,9 +907,9 @@ void Uic::createFormImpl( const TQDomElement &e ) out << indent << "if !" << obj << ".sqlCursor()" << endl; ++indent; if ( conn == "(default)" ) - out << indent << "cursor = Qt::SqlCursor.new(\"" << tab << "\")" << endl; + out << indent << "cursor = TQt::SqlCursor.new(\"" << tab << "\")" << endl; else - out << indent << "cursor = Qt::SqlCursor.new(\"" << tab << "\", true, " << conn << "Connection)" << endl; + out << indent << "cursor = TQt::SqlCursor.new(\"" << tab << "\", true, " << conn << "Connection)" << endl; out << indent << obj << ".setSqlCursor(cursor, true)" << endl; out << indent << obj << ".refresh()" << endl; out << indent << obj << ".first()" << endl; @@ -942,11 +942,11 @@ void Uic::createFormImpl( const TQDomElement &e ) int astart = (*it).find('('); out << indent << "def " << (*it).left(astart) << "(*k)" << endl; bool createWarning = true; - TQString fname = Parser::cleanArgs( *it ); - TQMap<TQString, TQString>::Iterator fit = functionImpls.find( fname ); + TTQString fname = Parser::cleanArgs( *it ); + TTQMap<TTQString, TTQString>::Iterator fit = functionImpls.find( fname ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TTQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); createWarning = body.simplifyWhiteSpace().isEmpty(); if ( !createWarning ) out << body << endl; @@ -967,11 +967,11 @@ void Uic::createFormImpl( const TQDomElement &e ) out << endl; int astart = (*it).find('('); out << indent << "def " << (*it).left(astart) << "(*k)" << endl; - TQString fname = Parser::cleanArgs( *it ); - TQMap<TQString, TQString>::Iterator fit = functionImpls.find( fname ); + TTQString fname = Parser::cleanArgs( *it ); + TTQMap<TTQString, TTQString>::Iterator fit = functionImpls.find( fname ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TTQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); body.simplifyWhiteSpace().isEmpty(); out << body << endl; } @@ -992,17 +992,17 @@ void Uic::createFormImpl( const TQDomElement &e ) Traverses recursively over all children. */ -void Uic::createFormImpl( const TQDomElement& e, const TQString& form, const TQString& connection, const TQString& table ) +void Uic::createFormImpl( const TTQDomElement& e, const TTQString& form, const TTQString& connection, const TTQString& table ) { if ( e.tagName() == "widget" && - e.attribute( "class" ) != "Qt::DataTable" ) { - TQString field = getDatabaseInfo( e, "field" ); + e.attribute( "class" ) != "TQt::DataTable" ) { + TTQString field = getDatabaseInfo( e, "field" ); if ( !field.isEmpty() ) { if ( isWidgetInTable( e, connection, table ) ) out << indent << form << "Form.insert(" << getObjectName( e ) << ", " << fixString( field ) << ")" << endl; } } - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { createFormImpl( n, form, connection, table ); } @@ -1011,7 +1011,7 @@ void Uic::createFormImpl( const TQDomElement& e, const TQString& form, const TQS // Generate a QtRuby signal/slot definition. -void Uic::rubySlot(TQStringList::Iterator &it) +void Uic::rubySlot(TTQStringList::Iterator &it) { out << indent << "'" << (*it) << "'"; } diff --git a/qtruby/rubylib/designer/rbuic/globaldefs.h b/qtruby/rubylib/designer/rbuic/globaldefs.h index aebf63c3..4286ec03 100644 --- a/qtruby/rubylib/designer/rbuic/globaldefs.h +++ b/qtruby/rubylib/designer/rbuic/globaldefs.h @@ -27,17 +27,17 @@ #define BOXLAYOUT_DEFAULT_SPACING 6 #ifndef NO_STATIC_COLORS -static TQColor *backColor1 = 0; -static TQColor *backColor2 = 0; -static TQColor *selectedBack = 0; +static TTQColor *backColor1 = 0; +static TTQColor *backColor2 = 0; +static TTQColor *selectedBack = 0; static void init_colors() { if ( backColor1 ) return; - backColor1 = new TQColor( 236, 245, 255 ); - backColor2 = new TQColor( 250, 250, 250 ); - selectedBack = new TQColor( 221, 221, 221 ); + backColor1 = new TTQColor( 236, 245, 255 ); + backColor2 = new TTQColor( 250, 250, 250 ); + selectedBack = new TTQColor( 221, 221, 221 ); } #endif diff --git a/qtruby/rubylib/designer/rbuic/main.cpp b/qtruby/rubylib/designer/rbuic/main.cpp index 4bebf46c..7e2a4f83 100644 --- a/qtruby/rubylib/designer/rbuic/main.cpp +++ b/qtruby/rubylib/designer/rbuic/main.cpp @@ -48,7 +48,7 @@ #include <zlib.h> #define RBUIC_VERSION "0.9" -void getDBConnections( Uic& uic, TQString& s); +void getDBConnections( Uic& uic, TTQString& s); int main( int argc, char * argv[] ) { @@ -56,7 +56,7 @@ int main( int argc, char * argv[] ) bool execCode = false; bool subcl = false; bool imagecollection = false; - TQStringList images; + TTQStringList images; const char *error = 0; const char* fileName = 0; const char* className = 0; @@ -66,14 +66,14 @@ int main( int argc, char * argv[] ) bool nofwd = false; bool useKDE = false; bool fix = false; - TQApplication app(argc, argv, false); - TQString uicClass; + TTQApplication app(argc, argv, false); + TTQString uicClass; for ( int n = 1; n < argc && error == 0; n++ ) { - TQCString arg = argv[n]; + TTQCString arg = argv[n]; if ( arg[0] == '-' ) { // option - TQCString opt = &arg[1]; + TTQCString opt = &arg[1]; if ( opt[0] == 'o' ) { // output redirection if ( opt[1] == '\0' ) { if ( !(n < argc-1) ) { @@ -132,7 +132,7 @@ int main( int argc, char * argv[] ) error = "Missing indent"; break; } - tabstop = TQCString(argv[++n]).toUInt(&ok); + tabstop = TTQCString(argv[++n]).toUInt(&ok); } else tabstop = opt.mid(1).toUInt(&ok); @@ -174,7 +174,7 @@ int main( int argc, char * argv[] ) "\t-o file\t\tWrite output to file rather than stdout\n" "\t-p indent\tSet the indent in spaces (0 to use a tab)\n" "\t-nofwd\t\tOmit imports of custom widgets\n" - "\t-kde\t\tUse kde widgets, require 'Korundum' extension\n" + "\t-kde\t\tUse kde widgets, retquire 'Korundum' extension\n" "\t-tr func\tUse func(...) rather than trUtf8(...) for i18n\n" "\t-x\t\tGenerate extra code to test the class\n" "\t-version\tDisplay version of rbuic\n" @@ -185,7 +185,7 @@ int main( int argc, char * argv[] ) Uic::setIndent(indent); - TQFile fileOut; + TTQFile fileOut; if ( outputFile ) { fileOut.setName( outputFile ); if (!fileOut.open( IO_WriteOnly ) ) @@ -193,25 +193,25 @@ int main( int argc, char * argv[] ) } else { fileOut.open( IO_WriteOnly, stdout ); } - TQTextStream out( &fileOut ); + TTQTextStream out( &fileOut ); if ( imagecollection ) { - out.setEncoding( TQTextStream::Latin1 ); + out.setEncoding( TTQTextStream::Latin1 ); Uic::embed( out, projectName, images ); return 0; } - out.setEncoding( TQTextStream::UnicodeUTF8 ); - TQFile file( fileName ); + out.setEncoding( TTQTextStream::UnicodeUTF8 ); + TTQFile file( fileName ); if ( !file.open( IO_ReadOnly ) ) qFatal( "rbuic: Could not open file '%s' ", fileName ); - TQDomDocument doc; - TQString errMsg; + TTQDomDocument doc; + TTQString errMsg; int errLine; if ( !doc.setContent( &file, &errMsg, &errLine ) ) - qFatal( TQString("rbuic: Failed to parse %s: ") + errMsg + TQString (" in line %d\n"), fileName, errLine ); + qFatal( TTQString("rbuic: Failed to parse %s: ") + errMsg + TTQString (" in line %d\n"), fileName, errLine ); DomTool::fixDocument( doc ); @@ -223,7 +223,7 @@ int main( int argc, char * argv[] ) if ( !subcl ) { out << "# Form implementation generated from reading ui file '" << fileName << "'" << endl; out << "#" << endl; - out << "# Created: " << TQDateTime::currentDateTime().toString() << endl; + out << "# Created: " << TTQDateTime::currentDateTime().toString() << endl; out << "# by: The QtRuby User Interface Compiler (rbuic)" << endl; out << "#" << endl; out << "# WARNING! All changes made in this file will be lost!" << endl; @@ -242,12 +242,12 @@ int main( int argc, char * argv[] ) out << indent << "KDE::CmdLineArgs.init(ARGV, about)" << endl; out << indent << "a = KDE::Application.new" << endl; } else { - out << indent << "a = Qt::Application.new(ARGV)" << endl; + out << indent << "a = TQt::Application.new(ARGV)" << endl; } - TQString s; + TTQString s; getDBConnections( uic, s); out << s; - out << indent << "w = " << (subcl? TQString::fromLatin1(className) : uicClass) << ".new" << endl; + out << indent << "w = " << (subcl? TTQString::fromLatin1(className) : uicClass) << ".new" << endl; out << indent << "a.mainWidget = w" << endl; out << indent << "w.show" << endl; out << indent << "a.exec" << endl; @@ -258,20 +258,20 @@ int main( int argc, char * argv[] ) return 0; } -void getDBConnections( Uic& uic, TQString& s) +void getDBConnections( Uic& uic, TTQString& s) { int num = 0; - for ( TQStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) { + for ( TTQStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) { if ( !(*it).isEmpty()) { - TQString inc = (num ? TQString::number(num+1) : TQString::null); + TTQString inc = (num ? TTQString::number(num+1) : TTQString::null); s += "\n # Connection to database " + (*it) + "\n\n"; - s += " DRIVER" + inc + " =\t\t'QMYSQL3'" + (inc?"":" # appropriate driver") + "\n"; + s += " DRIVER" + inc + " =\t\t'TQMYSQL3'" + (inc?"":" # appropriate driver") + "\n"; s += " DATABASE" + inc + " =\t\t'foo'" + (inc?"":" # name of your database") + "\n"; s += " USER" + inc + "=\t\t'john'" + (inc?"":" # username") + "\n"; s += " PASSWORD" + inc + "=\t\t'ZxjGG34s'" + (inc?"":" # password for USER") + "\n"; s += " HOST" + inc + "=\t\t'localhost'" + (inc?"":" # host on which the database is running") + "\n"; s += "\n"; - s += " $db" + inc + " = Qt::SqlDatabase.addDatabase( DRIVER" + inc; + s += " $db" + inc + " = TQt::SqlDatabase.addDatabase( DRIVER" + inc; if (inc) s+= ", '" + (*it) + "'"; s += " )\n"; @@ -281,7 +281,7 @@ void getDBConnections( Uic& uic, TQString& s) s += " $db" + inc + ".hostName = HOST" + inc + "\n"; s += "\n"; s += " if !$db" + inc + ".open\n"; - s += " Qt::MessageBox.information( nil, 'Unable to open database',\n"; + s += " TQt::MessageBox.information( nil, 'Unable to open database',\n"; s += " $db" + inc + ".lastError().databaseText() + \"\\n\")\n"; s += " exit 1\n"; s += " end\n"; diff --git a/qtruby/rubylib/designer/rbuic/object.cpp b/qtruby/rubylib/designer/rbuic/object.cpp index 2d05e0b6..bb1422b1 100644 --- a/qtruby/rubylib/designer/rbuic/object.cpp +++ b/qtruby/rubylib/designer/rbuic/object.cpp @@ -41,19 +41,19 @@ \sa createObjectImpl() */ -void Uic::createObjectDecl( const TQDomElement& e ) +void Uic::createObjectDecl( const TTQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { out << indent << registerObject(getLayoutName(e) ) << endl; } else { - TQString objClass = getClassName( e ); + TTQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - TQString objName = getObjectName( e ); + TTQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; - // ignore QLayoutWidgets - if ( objClass == "Qt::LayoutWidget" ) + // ignore TQLayoutWidgets + if ( objClass == "TQt::LayoutWidget" ) return; // register the object and unify its name @@ -68,27 +68,27 @@ void Uic::createObjectDecl( const TQDomElement& e ) Children are not traversed recursively. */ -void Uic::createAttrDecl( const TQDomElement& e ) +void Uic::createAttrDecl( const TTQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { // out << indent << registerObject(getLayoutName(e) ) << endl; } else { - TQString objClass = getClassName( e ); + TTQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - TQString objName = getObjectName( e ); + TTQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; - // ignore QLayoutWidgets - if ( objClass == "Qt::LayoutWidget" ) + // ignore TQLayoutWidgets + if ( objClass == "TQt::LayoutWidget" ) return; // register the object and unify its name objName = registerObject( objName ); - TQString attr(objName); - attr.replace(TQChar('@'), "attr_reader :"); + TTQString attr(objName); + attr.replace(TTQChar('@'), "attr_reader :"); out << indent << attr << endl; - TQDomElement n = getObjectProperty( e, "font"); + TTQDomElement n = getObjectProperty( e, "font"); // if ( !n.isNull() ) // out << indent << objName + "_font" << endl; } @@ -107,17 +107,17 @@ void Uic::createAttrDecl( const TQDomElement& e ) static bool createdCentralWidget = false; -TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& par, const TQString& layout ) +TTQString Uic::createObjectImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& par, const TTQString& layout ) { - TQString parent( par ); + TTQString parent( par ); if ( parent == "self" && isMainWindow ) { if ( !createdCentralWidget ) - out << indent << "setCentralWidget(Qt::Widget.new(self, \"qt_central_widget\"))" << endl; + out << indent << "setCentralWidget(TQt::Widget.new(self, \"qt_central_widget\"))" << endl; createdCentralWidget = true; parent = "centralWidget()"; } - TQDomElement n; - TQString objClass, objName, fullObjName; + TTQDomElement n; + TTQString objClass, objName, fullObjName; int numItems = 0; int numColumns = 0; int numRows = 0; @@ -130,8 +130,8 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla return objName; objName = getObjectName( e ); - TQString definedName = objName; - bool isTmpObject = objName.isEmpty() || objClass == "Qt::LayoutWidget"; + TTQString definedName = objName; + bool isTmpObject = objName.isEmpty() || objClass == "TQt::LayoutWidget"; if ( isTmpObject ) { if ( objClass[0] == 'Q' ) objName = objClass.mid( 4 ); @@ -141,17 +141,17 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla bool isLine = objClass == "Line"; if ( isLine ) - objClass = "Qt::Frame"; + objClass = "TQt::Frame"; out << endl; - if ( objClass == "Qt::LayoutWidget" ) { + if ( objClass == "TQt::LayoutWidget" ) { if ( layout.isEmpty() ) { // register the object and unify its name objName = registerObject( objName ); - out << indent << (isTmpObject ? TQString::fromLatin1("") : TQString::null) << objName << " = Qt::Widget.new(" << parent << ", '" << objName << "')" << endl; + out << indent << (isTmpObject ? TTQString::fromLatin1("") : TTQString::null) << objName << " = TQt::Widget.new(" << parent << ", '" << objName << "')" << endl; } else { // the layout widget is not necessary, hide it by creating its child in the parent - TQString result; + TTQString result; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if (tags.contains( n.tagName() ) ) result = createObjectImpl( n, parentClass, parent, layout ); @@ -162,7 +162,7 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla // Layouts don't go into the class instance dictionary. // FIXME PerlQt: fullObjName isn't used anymore => remove fullObjName = objName; - } else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) { + } else if ( objClass != "TQt::ToolBar" && objClass != "TQt::MenuBar" ) { // register the object and unify its name objName = registerObject( objName ); @@ -174,8 +174,8 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla else fullObjName = objName; - if ( objClass == "Qt::AxWidget" ) { - TQString controlId; + if ( objClass == "TQt::AxWidget" ) { + TTQString controlId; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) { controlId = n.firstChild().toElement().text(); @@ -193,10 +193,10 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - TQString prop = n.attribute("name"); + TTQString prop = n.attribute("name"); if ( prop == "database" ) continue; - TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TTQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; if ( prop == "name" ) @@ -210,26 +210,26 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla if ( isLine && prop == "orientation" ) { prop = "frameShape"; if ( value.right(10) == "Horizontal" ) - value = "Qt::Frame::HLine"; + value = "TQt::Frame::HLine"; else - value = "Qt::Frame::VLine"; + value = "TQt::Frame::VLine"; if ( !hadFrameShadow ) { prop = "frameStyle"; - value += " | Qt::Frame::Sunken"; + value += " | TQt::Frame::Sunken"; } } if ( prop == "buttonGroupId" ) { - if ( parentClass == "Qt::ButtonGroup" ) + if ( parentClass == "TQt::ButtonGroup" ) out << indent << parent << ".insert( " << fullObjName << "," << value << ")" << endl; continue; } if ( prop == "frameworkCode" ) continue; - if ( objClass == "Qt::MultiLineEdit" && - TQRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) + if ( objClass == "TQt::MultiLineEdit" && + TTQRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) continue; - TQString call = fullObjName + "."; + TTQString call = fullObjName + "."; if (! call.startsWith("@")) { call.prepend("@"); } @@ -238,7 +238,7 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla call += mkStdSet( prop ) + "( "; call += value + " )"; } else { - call += "setProperty( \"" + prop + "\", Qt::Variant.new(" ; + call += "setProperty( \"" + prop + "\", TQt::Variant.new(" ; call += value + " ) )"; } @@ -249,8 +249,8 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla out << indent << call << endl; } } else if ( n.tagName() == "item" ) { - TQString call; - TQString value; + TTQString call; + TTQString value; if ( objClass.mid( 4 ) == "ListBox" ) { call = createListBoxItemImpl( n, fullObjName, &value ); @@ -274,7 +274,7 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla trout << indent << call << endl; } } else if ( objClass.mid( 4 ) == "ListView" ) { - call = createListViewItemImpl( n, fullObjName, TQString::null ); + call = createListViewItemImpl( n, fullObjName, TTQString::null ); if ( !call.isEmpty() ) { if ( numItems == 0 ) trout << indent << fullObjName << ".clear()" << endl; @@ -284,8 +284,8 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla if ( !call.isEmpty() ) numItems++; } else if ( n.tagName() == "column" || n.tagName() == "row" ) { - TQString call; - TQString value; + TTQString call; + TTQString value; if ( objClass.mid( 4 ) == "ListView" ) { call = createListViewColumnImpl( n, fullObjName, &value ); @@ -294,7 +294,7 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla trout << indent << fullObjName << ".header().setLabel( " << numColumns++ << ", " << value << " )\n"; } - } else if ( objClass == "Qt::Table" || objClass == "Qt::DataTable" ) { + } else if ( objClass == "TQt::Table" || objClass == "TQt::DataTable" ) { bool isCols = ( n.tagName() == "column" ); call = createTableRowColumnImpl( n, fullObjName, &value ); if ( !call.isEmpty() ) { @@ -309,40 +309,40 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla } } - // create all children, some widgets have special requirements + // create all children, some widgets have special retquirements - if ( objClass == "Qt::TabWidget" ) { + if ( objClass == "TQt::TabWidget" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, fullObjName ); - TQString comment; - TQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + TTQString page = createObjectImpl( n, objClass, fullObjName ); + TTQString comment; + TTQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); out << indent << fullObjName << ".insertTab(" << page << ", " << trcall( label ) << ")" << endl; trout << indent << fullObjName << ".changeTab( " << page << ", " << trcall( label, comment ) << " )" << endl; } } - } else if ( objClass == "Qt::WidgetStack" ) { + } else if ( objClass == "TQt::WidgetStack" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, objName ); + TTQString page = createObjectImpl( n, objClass, objName ); int id = DomTool::readAttribute( n, "id", "" ).toInt(); out << indent << fullObjName << ".addWidget( " << page << ", " << id << " )" << endl; } } - } else if ( objClass == "Qt::ToolBox" ) { + } else if ( objClass == "TQt::ToolBox" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, objName ); - TQString comment; - TQString label = DomTool::readAttribute( n, "label", comment ).toString(); + TTQString page = createObjectImpl( n, objClass, objName ); + TTQString comment; + TTQString label = DomTool::readAttribute( n, "label", comment ).toString(); out << indent << fullObjName << ".addItem( " << page << ", \"\" )" << endl; trout << indent << fullObjName << ".setItemLabel( " << fullObjName << ".indexOf(" << page << "), " << trcall( label, comment ) << " )" << endl; } } - } else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) { // standard widgets + } else if ( objClass != "TQt::ToolBar" && objClass != "TQt::MenuBar" ) { // standard widgets for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) createObjectImpl( n, objClass, fullObjName ); @@ -364,13 +364,13 @@ TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentCla application font or palette change handlers in createFormImpl(). */ -void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ) +void Uic::createExclusiveProperty( const TTQDomElement & e, const TTQString& exclusiveProp ) { - TQDomElement n; - TQString objClass = getClassName( e ); + TTQDomElement n; + TTQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - TQString objName = getObjectName( e ); + TTQString objName = getObjectName( e ); if ( objClass.isEmpty() ) return; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { @@ -378,13 +378,13 @@ void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclu bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - TQString prop = n.attribute("name"); + TTQString prop = n.attribute("name"); if ( prop != exclusiveProp ) continue; - TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TTQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; - out << indent << indent << objName << ".setProperty(\"" << prop << "\", Qt::Variant.new(" << value << "))" << endl; + out << indent << indent << objName << ".setProperty(\"" << prop << "\", TQt::Variant.new(" << value << "))" << endl; } } } @@ -394,11 +394,11 @@ void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclu Resource::saveProperty() and DomTool::elementToVariant. If you change one, change all. */ -TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ) +TTQString Uic::setObjectProperty( const TTQString& objClass, const TTQString& obj, const TTQString &prop, const TTQDomElement &e, bool stdset ) { - TQString v; + TTQString v; if ( e.tagName() == "rect" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -411,11 +411,11 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Rect.new(%1, %2, %3, %4)"; + v = "TQt::Rect.new(%1, %2, %3, %4)"; v = v.arg(x).arg(y).arg(w).arg(h); } else if ( e.tagName() == "point" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -424,10 +424,10 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Point.new(%1, %2)"; + v = "TQt::Point.new(%1, %2)"; v = v.arg(x).arg(y); } else if ( e.tagName() == "size" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -436,10 +436,10 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Size.new(%1, %2)"; + v = "TQt::Size.new(%1, %2)"; v = v.arg(w).arg(h); } else if ( e.tagName() == "color" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "red" ) @@ -450,17 +450,17 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, b = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Color.new(%1, %2, %3)"; + v = "TQt::Color.new(%1, %2, %3)"; v = v.arg(r).arg(g).arg(b); } else if ( e.tagName() == "font" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQString fontname; + TTQDomElement n3 = e.firstChild().toElement(); + TTQString fontname; if ( !obj.isEmpty() ) { fontname = obj + "_font"; - out << indent << fontname << " = Qt::Font.new(" << obj << ".font())" << endl; + out << indent << fontname << " = TQt::Font.new(" << obj << ".font())" << endl; } else { fontname = registerObject( "f" ); - out << indent << fontname << " = Qt::Font.new(font())" << endl; + out << indent << fontname << " = TQt::Font.new(font())" << endl; } while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) @@ -487,23 +487,23 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, v = fontname; } } else if ( e.tagName() == "string" ) { - TQString txt = e.firstChild().toText().data(); - TQString com = getComment( e.parentNode() ); + TTQString txt = e.firstChild().toText().data(); + TTQString com = getComment( e.parentNode() ); - if ( prop == "toolTip" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { + if ( prop == "toolTip" && objClass != "TQt::Action" && objClass != "TQt::ActionGroup" ) { if ( !obj.isEmpty() ) - trout << indent << "Qt::ToolTip.add( " << obj << ", " + trout << indent << "TQt::ToolTip.add( " << obj << ", " << trcall( txt, com ) << " )" << endl; else - trout << indent << "Qt::ToolTip.add( self, " + trout << indent << "TQt::ToolTip.add( self, " << trcall( txt, com ) << " )" << endl; - } else if ( prop == "whatsThis" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { + } else if ( prop == "whatsThis" && objClass != "TQt::Action" && objClass != "TQt::ActionGroup" ) { if ( !obj.isEmpty() ) - trout << indent << "Qt::WhatsThis.add(" << obj << ", " << trcall( txt, com ) << ")" << endl; + trout << indent << "TQt::WhatsThis.add(" << obj << ", " << trcall( txt, com ) << ")" << endl; else - trout << indent << "Qt::WhatsThis.add(self," << trcall( txt, com ) << ")" << endl; + trout << indent << "TQt::WhatsThis.add(self," << trcall( txt, com ) << ")" << endl; } else if (e.parentNode().toElement().attribute("name") == "accel") { - v = "Qt::KeySequence.new(" + trcall( txt, com ) + ")"; + v = "TQt::KeySequence.new(" + trcall( txt, com ) + ")"; } else { v = trcall( txt, com ); } @@ -511,9 +511,9 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, v = "\"%1\""; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "number" ) { - // FIXME: hack. QtRuby needs a TQKeySequence to build an accel + // FIXME: hack. QtRuby needs a TTQKeySequence to build an accel if( e.parentNode().toElement().attribute("name") == "accel" ) - v = "Qt::KeySequence.new(%1)"; + v = "TQt::KeySequence.new(%1)"; else v = "%1"; v = v.arg( e.firstChild().toText().data() ); @@ -521,22 +521,22 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, if ( stdset ) v = "%1"; else - v = "Qt::Variant.new(%1, 0)"; + v = "TQt::Variant.new(%1, 0)"; v = v.arg( mkBool( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "pixmap" ) { v = e.firstChild().toText().data(); if( !externPixmaps ) v.prepend( '@' ); if ( !pixmapLoaderFunction.isEmpty() ) { - v.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - v.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + v.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + v.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( e.tagName() == "iconset" ) { - v = "Qt::IconSet.new(%1)"; - TQString s = e.firstChild().toText().data(); + v = "TQt::IconSet.new(%1)"; + TTQString s = e.firstChild().toText().data(); if ( !pixmapLoaderFunction.isEmpty() ) { - s.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - s.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + s.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + s.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } else { s.prepend("@"); } @@ -545,22 +545,22 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, v = e.firstChild().toText().data() + ".convertToImage()"; } else if ( e.tagName() == "enum" ) { v = "%1::%2"; - TQString oc = objClass; - TQString ev = e.firstChild().toText().data(); - if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename TQListView::Manual of WithMode enum in 3.0 - oc = "Qt::ScrollView"; + TTQString oc = objClass; + TTQString ev = e.firstChild().toText().data(); + if ( oc == "TQt::ListView" && ev == "Manual" ) // #### workaround, rename TTQListView::Manual of WithMode enum in 3.0 + oc = "TQt::ScrollView"; v = v.arg( oc ).arg( ev ); } else if ( e.tagName() == "set" ) { - TQString keys( e.firstChild().toText().data() ); - TQStringList lst = TQStringList::split( '|', keys ); + TTQString keys( e.firstChild().toText().data() ); + TTQStringList lst = TTQStringList::split( '|', keys ); v = ""; #if defined(Q_CC_EDG) // workaround for EDG bug reproduced with MIPSpro C++ 7.3.? // and KAI C++ 4.0e that will be fixed in KAI C++ 4.0f - TQStringList::Iterator it = lst.begin(); + TTQStringList::Iterator it = lst.begin(); for ( ; it != lst.end(); ++it ) { #else - for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + for ( TTQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { #endif v += objClass + "::" + *it; if ( it != lst.fromLast() ) @@ -568,30 +568,30 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, } v += ""; } else if ( e.tagName() == "sizepolicy" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQSizePolicy sp; + TTQDomElement n3 = e.firstChild().toElement(); + TTQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - TQString tmp = (obj.isEmpty() ? TQString::fromLatin1("self") : obj) + "."; - v = "Qt::SizePolicy.new(%1, %2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth())"; + TTQString tmp = (obj.isEmpty() ? TTQString::fromLatin1("self") : obj) + "."; + v = "TQt::SizePolicy.new(%1, %2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth())"; v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() ); } else if ( e.tagName() == "palette" ) { - TQPalette pal; + TTQPalette pal; bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; - TQDomElement n; + TTQDomElement n; if ( no_pixmaps ) { n = e.firstChild().toElement(); while ( !n.isNull() ) { - TQColorGroup cg; + TTQColorGroup cg; if ( n.tagName() == "active" ) { cg = loadColorGroup( n ); pal.setActive( cg ); @@ -605,19 +605,19 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, n = n.nextSibling().toElement(); } } - if ( no_pixmaps && pal == TQPalette( pal.active().button(), pal.active().background() ) ) { - v = "Qt::Palette.new(Qt::Color.new(%1,%2,%3), Qt::Color.new(%1,%2,%3))"; + if ( no_pixmaps && pal == TTQPalette( pal.active().button(), pal.active().background() ) ) { + v = "TQt::Palette.new(TQt::Color.new(%1,%2,%3), TQt::Color.new(%1,%2,%3))"; v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); } else { - TQString palette = "pal"; + TTQString palette = "pal"; if ( !pal_used ) { - out << indent << palette << " = Qt::Palette.new()" << endl; + out << indent << palette << " = TQt::Palette.new()" << endl; pal_used = true; } - TQString cg = "cg"; + TTQString cg = "cg"; if ( !cg_used ) { - out << indent << cg << " = Qt::ColorGroup.new()" << endl; + out << indent << cg << " = TQt::ColorGroup.new()" << endl; cg_used = true; } n = e.firstChild().toElement(); @@ -640,10 +640,10 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, v = palette; } } else if ( e.tagName() == "cursor" ) { - v = "Qt::Cursor.new(%1)"; + v = "TQt::Cursor.new(%1)"; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "date" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -655,10 +655,10 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Date.new(%1,%2,%3)"; + v = "TQt::Date.new(%1,%2,%3)"; v = v.arg(y).arg(m).arg(d); } else if ( e.tagName() == "time" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -670,10 +670,10 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::Time.new(%1, %2, %3)"; + v = "TQt::Time.new(%1, %2, %3)"; v = v.arg(h).arg(m).arg(s); } else if ( e.tagName() == "datetime" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { @@ -691,12 +691,12 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = "Qt::DateTime.new(Qt::Date.new(%1, %2, %3), Qt::Time.new(%4, %5, %6))"; + v = "TQt::DateTime.new(TQt::Date.new(%1, %2, %3), TQt::Time.new(%4, %5, %6))"; v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s); } else if ( e.tagName() == "stringlist" ) { - TQStringList l; - TQDomElement n3 = e.firstChild().toElement(); - TQString listname; + TTQStringList l; + TTQDomElement n3 = e.firstChild().toElement(); + TTQString listname; if ( !obj.isEmpty() ) { listname = obj + "_strlist"; out << indent << listname << " = ["; @@ -736,9 +736,9 @@ TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, /*! Extracts a named object property from \a e. */ -TQDomElement Uic::getObjectProperty( const TQDomElement& e, const TQString& name ) +TTQDomElement Uic::getObjectProperty( const TTQDomElement& e, const TTQString& name ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { diff --git a/qtruby/rubylib/designer/rbuic/parser.cpp b/qtruby/rubylib/designer/rbuic/parser.cpp index 11dfe060..8cfe5da4 100644 --- a/qtruby/rubylib/designer/rbuic/parser.cpp +++ b/qtruby/rubylib/designer/rbuic/parser.cpp @@ -27,25 +27,25 @@ #include <tqobject.h> #include <tqstringlist.h> -class NormalizeObject : public QObject +class NormalizeObject : public TQObject { public: - NormalizeObject() : TQObject() {} - static TQCString normalizeSignalSlot( const char *signalSlot ) { return TQObject::normalizeSignalSlot( signalSlot ); } + NormalizeObject() : TTQObject() {} + static TTQCString normalizeSignalSlot( const char *signalSlot ) { return TTQObject::normalizeSignalSlot( signalSlot ); } }; -TQString Parser::cleanArgs( const TQString &func ) +TTQString Parser::cleanArgs( const TTQString &func ) { - TQString slot( func ); + TTQString slot( func ); int begin = slot.find( "(" ) + 1; - TQString args = slot.mid( begin ); + TTQString args = slot.mid( begin ); args = args.left( args.find( ")" ) ); - TQStringList lst = TQStringList::split( ',', args ); - TQString res = slot.left( begin ); - for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + TTQStringList lst = TTQStringList::split( ',', args ); + TTQString res = slot.left( begin ); + for ( TTQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { if ( it != lst.begin() ) res += ","; - TQString arg = *it; + TTQString arg = *it; int pos = 0; if ( ( pos = arg.find( "&" ) ) != -1 ) { arg = arg.left( pos + 1 ); @@ -55,7 +55,7 @@ TQString Parser::cleanArgs( const TQString &func ) arg = arg.simplifyWhiteSpace(); if ( ( pos = arg.find( ':' ) ) != -1 ) arg = arg.left( pos ).simplifyWhiteSpace() + ":" + arg.mid( pos + 1 ).simplifyWhiteSpace(); - TQStringList l = TQStringList::split( ' ', arg ); + TTQStringList l = TTQStringList::split( ' ', arg ); if ( l.count() == 2 ) { if ( l[ 0 ] != "const" && l[ 0 ] != "unsigned" && l[ 0 ] != "var" ) arg = l[ 0 ]; @@ -67,5 +67,5 @@ TQString Parser::cleanArgs( const TQString &func ) } res += ")"; - return TQString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); + return TTQString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); } diff --git a/qtruby/rubylib/designer/rbuic/parser.h b/qtruby/rubylib/designer/rbuic/parser.h index ace96d9e..e03f1b1c 100644 --- a/qtruby/rubylib/designer/rbuic/parser.h +++ b/qtruby/rubylib/designer/rbuic/parser.h @@ -26,7 +26,7 @@ class Parser { public: - static TQString cleanArgs( const TQString &func ); + static TTQString cleanArgs( const TTQString &func ); }; diff --git a/qtruby/rubylib/designer/rbuic/subclassing.cpp b/qtruby/rubylib/designer/rbuic/subclassing.cpp index e6a876f0..ef19cf53 100644 --- a/qtruby/rubylib/designer/rbuic/subclassing.cpp +++ b/qtruby/rubylib/designer/rbuic/subclassing.cpp @@ -39,20 +39,20 @@ \sa createSubDecl() */ -void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) +void Uic::createSubImpl( const TTQDomElement &e, const TTQString& subClass ) { - TQDomElement n; - TQDomNodeList nl; + TTQDomElement n; + TTQDomNodeList nl; int i; - TQStringList::Iterator it, it2, it3; + TTQStringList::Iterator it, it2, it3; - TQString objClass = getClassName( e ); + TTQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; if (hasKDEwidget) { - out << indent << "require 'Korundum'" << endl; + out << indent << "retquire 'Korundum'" << endl; } else { - out << indent << "require 'Qt'" << endl; + out << indent << "retquire 'Qt'" << endl; } out << endl; out << indent << "class " << subClass << " < " << nameOfClass << endl; @@ -61,7 +61,7 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) ++indent; // constructor - if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) { + if ( objClass == "TQt::Dialog" || objClass == "TQt::Wizard" ) { out << indent << "# Constructs a " << subClass << " which is a child of 'parent', with the " << endl; out << indent << "# name 'name' and widget flags set to 'fl' " << endl; out << indent << "# " << endl; @@ -82,10 +82,10 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) out << endl; // find additional slots - TQStringList publicSlots, protectedSlots, privateSlots; - TQStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes; - TQStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier; - TQMap<TQString, TQString> functionImpls; + TTQStringList publicSlots, protectedSlots, privateSlots; + TTQStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes; + TTQStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier; + TTQMap<TTQString, TTQString> functionImpls; nl = e.parentNode().toElement().elementsByTagName( "slot" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -94,12 +94,12 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - TQString returnType = n.attribute( "returnType", "void" ); - TQString slotName = n.firstChild().toText().data().stripWhiteSpace(); + TTQString returnType = n.attribute( "returnType", "void" ); + TTQString slotName = n.firstChild().toText().data().stripWhiteSpace(); if ( slotName.endsWith( ";" ) ) slotName = slotName.left( slotName.length() - 1 ); - TQString specifier = n.attribute( "specifier" ); - TQString access = n.attribute( "access" ); + TTQString specifier = n.attribute( "specifier" ); + TTQString access = n.attribute( "access" ); if ( access == "protected" ) { protectedSlots += slotName; protectedSlotTypes += returnType; @@ -119,7 +119,7 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) // compatibility with early 3.0 betas nl = e.parentNode().toElement().elementsByTagName( "function" ); for ( i = 0; i < (int) nl.length(); i++ ) { - TQString fname = n.attribute( "name" ); + TTQString fname = n.attribute( "name" ); fname = Parser::cleanArgs( fname ); functionImpls.insert( fname, n.firstChild().toText().data() ); } @@ -127,8 +127,8 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) if ( !publicSlots.isEmpty() ) { for ( it = publicSlots.begin(), it2 = publicSlotTypes.begin(), it3 = publicSlotSpecifier.begin(); it != publicSlots.end(); ++it, ++it2, ++it3 ) { - TQString pure; - TQString type = *it2; + TTQString pure; + TTQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) @@ -149,8 +149,8 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) if ( !protectedSlots.isEmpty() ) { for ( it = protectedSlots.begin(), it2 = protectedSlotTypes.begin(), it3 = protectedSlotSpecifier.begin(); it != protectedSlots.end(); ++it, ++it2, ++it3 ) { - TQString pure; - TQString type = *it2; + TTQString pure; + TTQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) @@ -173,8 +173,8 @@ void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) if ( !privateSlots.isEmpty() ) { for ( it = privateSlots.begin(), it2 = privateSlotTypes.begin(), it3 = privateSlotSpecifier.begin(); it != privateSlots.end(); ++it, ++it2, ++it3 ) { - TQString pure; - TQString type = *it2; + TTQString pure; + TTQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) diff --git a/qtruby/rubylib/designer/rbuic/uic.cpp b/qtruby/rubylib/designer/rbuic/uic.cpp index 07fb377a..106e9879 100644 --- a/qtruby/rubylib/designer/rbuic/uic.cpp +++ b/qtruby/rubylib/designer/rbuic/uic.cpp @@ -67,42 +67,42 @@ void RubyIndent::calc() } -TQString Uic::getComment( const TQDomNode& n ) +TTQString Uic::getComment( const TTQDomNode& n ) { - TQDomNode child = n.firstChild(); + TTQDomNode child = n.firstChild(); while ( !child.isNull() ) { if ( child.toElement().tagName() == "comment" ) return child.toElement().firstChild().toText().data(); child = child.nextSibling(); } - return TQString::null; + return TTQString::null; } -TQString Uic::mkBool( bool b ) +TTQString Uic::mkBool( bool b ) { return b? "true" : "false"; } -TQString Uic::mkBool( const TQString& s ) +TTQString Uic::mkBool( const TTQString& s ) { return mkBool( s == "true" || s == "1" ); } -bool Uic::toBool( const TQString& s ) +bool Uic::toBool( const TTQString& s ) { return s == "true" || s.toInt() != 0; } -TQString Uic::fixString( const TQString &str ) +TTQString Uic::fixString( const TTQString &str ) { - TQString s( str ); - s.replace( TQRegExp( "\\\\" ), "\\\\" ); - s.replace( TQRegExp( "\"" ), "\\\"" ); - s.replace( TQRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" ); + TTQString s( str ); + s.replace( TTQRegExp( "\\\\" ), "\\\\" ); + s.replace( TTQRegExp( "\"" ), "\\\"" ); + s.replace( TTQRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" ); return "\"" + s + "\""; } -TQString Uic::trcall( const TQString& sourceText, const TQString& comment ) +TTQString Uic::trcall( const TTQString& sourceText, const TTQString& comment ) { if ( sourceText.isEmpty() && comment.isEmpty() ) return "nil"; @@ -112,19 +112,19 @@ TQString Uic::trcall( const TQString& sourceText, const TQString& comment ) return trmacro + "(" + fixString( sourceText ) + "," + fixString( comment ) + ")"; } -TQString Uic::mkStdSet( const TQString& prop ) +TTQString Uic::mkStdSet( const TTQString& prop ) { - return TQString( "set" ) + prop[0].upper() + prop.mid(1); + return TTQString( "set" ) + prop[0].upper() + prop.mid(1); } -bool Uic::isEmptyFunction( const TQString& fname ) +bool Uic::isEmptyFunction( const TTQString& fname ) { - TQMap<TQString, TQString>::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) ); + TTQMap<TTQString, TTQString>::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TTQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); return body.simplifyWhiteSpace().isEmpty(); } // For now ruby functions are always empty, until a rubyeditor Qt Designer plugin exists.. @@ -139,9 +139,9 @@ bool Uic::isEmptyFunction( const TQString& fname ) The class Uic encapsulates the user interface compiler (uic). */ -Uic::Uic( const TQString &fn, TQTextStream &outStream, TQDomDocument doc, - bool subcl, const TQString &trm, const TQString& subClass, - bool omitForwardDecls, TQString &uicClass, bool useKDE ) +Uic::Uic( const TTQString &fn, TTQTextStream &outStream, TTQDomDocument doc, + bool subcl, const TTQString &trm, const TTQString& subClass, + bool omitForwardDecls, TTQString &uicClass, bool useKDE ) : out( outStream ), trout( &languageChangeBody ), trmacro( trm ), nofwd( omitForwardDecls ) { @@ -164,16 +164,16 @@ Uic::Uic( const TQString &fn, TQTextStream &outStream, TQDomDocument doc, uiFileVersion = doc.firstChild().toElement().attribute("version"); stdsetdef = toBool( doc.firstChild().toElement().attribute("stdsetdef") ); - TQDomElement e = doc.firstChild().firstChild().toElement(); - TQDomElement widget; + TTQDomElement e = doc.firstChild().firstChild().toElement(); + TTQDomElement widget; while ( !e.isNull() ) { if ( e.tagName() == "widget" ) { widget = e; } else if ( e.tagName() == "pixmapinproject" ) { externPixmaps = true; } else if ( e.tagName() == "layoutdefaults" ) { - defSpacing = e.attribute( "spacing", TQString::number( defSpacing ) ).toInt(); - defMargin = e.attribute( "margin", TQString::number( defMargin ) ).toInt(); + defSpacing = e.attribute( "spacing", TTQString::number( defSpacing ) ).toInt(); + defMargin = e.attribute( "margin", TTQString::number( defMargin ) ).toInt(); } e = e.nextSibling().toElement(); } @@ -193,26 +193,26 @@ Uic::Uic( const TQString &fn, TQTextStream &outStream, TQDomDocument doc, /*! Extracts a pixmap loader function from \a e */ -TQString Uic::getPixmapLoaderFunction( const TQDomElement& e ) +TTQString Uic::getPixmapLoaderFunction( const TTQDomElement& e ) { - TQDomElement n; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "pixmapfunction" ) return n.firstChild().toText().data(); } - return TQString::null; + return TTQString::null; } /*! Extracts the forms class name from \a e */ -TQString Uic::getFormClassName( const TQDomElement& e ) +TTQString Uic::getFormClassName( const TTQDomElement& e ) { - TQDomElement n; - TQString cn; + TTQDomElement n; + TTQString cn; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "class" ) { - TQString s = n.firstChild().toText().data(); + TTQString s = n.firstChild().toText().data(); int i; while ( ( i = s.find(' ' )) != -1 ) s[i] = '_'; @@ -224,16 +224,16 @@ TQString Uic::getFormClassName( const TQDomElement& e ) /*! Extracts a Ruby class name from \a e. */ -TQString Uic::getClassName( const TQDomElement& e ) +TTQString Uic::getClassName( const TTQDomElement& e ) { - TQString s = e.attribute( "class" ); + TTQString s = e.attribute( "class" ); if ( s.isEmpty() && e.tagName() == "toolbar" ) - s = "Qt::ToolBar"; + s = "TQt::ToolBar"; else if ( s.isEmpty() && e.tagName() == "menubar" ) - s = "Qt::MenuBar"; + s = "TQt::MenuBar"; else { - TQRegExp r("^([QK])(\\S+)"); + TTQRegExp r("^([QK])(\\S+)"); if( r.search( s ) != -1 ) { if (r.cap(1) == "K") { hasKDEwidget = true; @@ -242,7 +242,7 @@ TQString Uic::getClassName( const TQDomElement& e ) if (s.startsWith("Qext")) { s = "Qext::" + r.cap(2).mid(4); } else { - s = "Qt::" + r.cap(2); + s = "TQt::" + r.cap(2); } } } @@ -255,11 +255,11 @@ TQString Uic::getClassName( const TQDomElement& e ) /*! Returns TRUE if database framework code is generated, else FALSE. */ -bool Uic::isFrameworkCodeGenerated( const TQDomElement& e ) +bool Uic::isFrameworkCodeGenerated( const TTQDomElement& e ) { - TQDomElement n = getObjectProperty( e, "frameworkCode" ); + TTQDomElement n = getObjectProperty( e, "frameworkCode" ); if ( n.attribute("name") == "frameworkCode" && - !DomTool::elementToVariant( n.firstChild().toElement(), TQVariant( true, 0 ) ).toBool() ) + !DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant( true, 0 ) ).toBool() ) return false; return true; } @@ -267,36 +267,36 @@ bool Uic::isFrameworkCodeGenerated( const TQDomElement& e ) /*! Extracts an object name from \a e. It's stored in the 'name' property. */ -TQString Uic::getObjectName( const TQDomElement& e ) +TTQString Uic::getObjectName( const TTQDomElement& e ) { - TQDomElement n = getObjectProperty( e, "name" ); + TTQDomElement n = getObjectProperty( e, "name" ); if ( n.firstChild().toElement().tagName() == "cstring" ) return n.firstChild().toElement().firstChild().toText().data(); - return TQString::null; + return TTQString::null; } /*! Extracts an layout name from \a e. It's stored in the 'name' - property of the preceeding sibling (the first child of a QLayoutWidget). + property of the preceeding sibling (the first child of a TQLayoutWidget). */ -TQString Uic::getLayoutName( const TQDomElement& e ) +TTQString Uic::getLayoutName( const TTQDomElement& e ) { - TQDomElement p = e.parentNode().toElement(); - TQString tail = TQString::null; + TTQDomElement p = e.parentNode().toElement(); + TTQString tail = TTQString::null; - if ( getClassName(p) != "Qt::LayoutWidget" ) + if ( getClassName(p) != "TQt::LayoutWidget" ) tail = "Layout"; - TQDomElement n = getObjectProperty( p, "name" ); + TTQDomElement n = getObjectProperty( p, "name" ); if ( n.firstChild().toElement().tagName() == "cstring" ) return n.firstChild().toElement().firstChild().toText().data() + tail; return e.tagName(); } -TQString Uic::getDatabaseInfo( const TQDomElement& e, const TQString& tag ) +TTQString Uic::getDatabaseInfo( const TTQDomElement& e, const TTQString& tag ) { - TQDomElement n; - TQDomElement n1; + TTQDomElement n; + TTQDomElement n1; int child = 0; // database info is a stringlist stored in this order if ( tag == "connection" ) @@ -306,27 +306,27 @@ TQString Uic::getDatabaseInfo( const TQDomElement& e, const TQString& tag ) else if ( tag == "field" ) child = 2; else - return TQString::null; + return TTQString::null; n = getObjectProperty( e, "database" ); if ( n.firstChild().toElement().tagName() == "stringlist" ) { // find correct stringlist entry - TQDomElement n1 = n.firstChild().firstChild().toElement(); + TTQDomElement n1 = n.firstChild().firstChild().toElement(); for ( int i = 0; i < child && !n1.isNull(); ++i ) n1 = n1.nextSibling().toElement(); if ( n1.isNull() ) - return TQString::null; + return TTQString::null; return n1.firstChild().toText().data(); } - return TQString::null; + return TTQString::null; } -void Uic::registerLayouts( const TQDomElement &e ) +void Uic::registerLayouts( const TTQDomElement &e ) { if ( layouts.contains(e.tagName()) ) createObjectDecl(e); - TQDomNodeList nl = e.childNodes(); + TTQDomNodeList nl = e.childNodes(); for ( int i = 0; i < (int) nl.length(); ++i ) registerLayouts( nl.item(i).toElement() ); } @@ -335,59 +335,59 @@ void Uic::registerLayouts( const TQDomElement &e ) /*! Returns include file for class \a className or a null string. */ -TQString Uic::getInclude( const TQString& className ) +TTQString Uic::getInclude( const TTQString& className ) { int wid = WidgetDatabase::idFromClassName( className ); if ( wid != -1 ) return WidgetDatabase::includeFile( wid ); - return TQString::null; + return TTQString::null; } -void Uic::createActionDecl( const TQDomElement& e ) +void Uic::createActionDecl( const TTQDomElement& e ) { - TQString objName = getObjectName( e ); + TTQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; out << indent << objName << endl; if ( e.tagName() == "actiongroup" ) { - for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + for ( TTQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) createActionDecl( n ); } } } -void Uic::createActionImpl( const TQDomElement &n, const TQString &parent ) +void Uic::createActionImpl( const TTQDomElement &n, const TTQString &parent ) { - for ( TQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { - TQString objName = registerObject( getObjectName( ae ) ); + for ( TTQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { + TTQString objName = registerObject( getObjectName( ae ) ); if ( ae.tagName() == "action" ) - out << indent << objName << "= Qt::Action.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl; + out << indent << objName << "= TQt::Action.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl; else if ( ae.tagName() == "actiongroup" ) - out << indent << objName << "= Qt::ActionGroup.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl; + out << indent << objName << "= TQt::ActionGroup.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl; else continue; bool subActionsDone = false; bool hasMenuText = false; - TQString actionText; - for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + TTQString actionText; + for ( TTQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "property" ) { bool stdset = stdsetdef; if ( n2.hasAttribute( "stdset" ) ) stdset = toBool( n2.attribute( "stdset" ) ); - TQString prop = n2.attribute("name"); + TTQString prop = n2.attribute("name"); if ( prop == "name" ) continue; - TQString value = setObjectProperty( "Qt::Action", objName, prop, n2.firstChild().toElement(), stdset ); + TTQString value = setObjectProperty( "TQt::Action", objName, prop, n2.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; - TQString call = objName + "."; + TTQString call = objName + "."; if ( stdset ) { call += mkStdSet( prop ) + "(" + value + ")"; } else { call += "setProperty( \"" + prop + "\", "; - call += "Qt::Variant.new(" + value + "))"; + call += "TQt::Variant.new(" + value + "))"; } if (prop == "menuText") @@ -405,13 +405,13 @@ void Uic::createActionImpl( const TQDomElement &n, const TQString &parent ) subActionsDone = true; } } - // workaround for loading pre-3.3 files expecting bogus TQAction behavior + // workaround for loading pre-3.3 files expecting bogus TTQAction behavior if (!hasMenuText && !actionText.isEmpty() && uiFileVersion < "3.3") trout << indent << objName << ".setMenuText(" << actionText << ")" << endl; } } -TQString get_dock( const TQString &d ) +TTQString get_dock( const TTQString &d ) { if ( d == "0" ) return "DockUnmanaged"; @@ -430,27 +430,27 @@ TQString get_dock( const TQString &d ) return ""; } -void Uic::createToolbarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent ) +void Uic::createToolbarImpl( const TTQDomElement &n, const TTQString &parentClass, const TTQString &parent ) { - TQDomNodeList nl = n.elementsByTagName( "toolbar" ); + TTQDomNodeList nl = n.elementsByTagName( "toolbar" ); for ( int i = 0; i < (int) nl.length(); i++ ) { - TQDomElement ae = nl.item( i ).toElement(); - TQString dock = get_dock( ae.attribute( "dock" ) ); - TQString objName = "@" + getObjectName( ae ); - out << indent << objName << " = Qt::ToolBar.new(\"\", self, " << dock << ")" << endl; + TTQDomElement ae = nl.item( i ).toElement(); + TTQString dock = get_dock( ae.attribute( "dock" ) ); + TTQString objName = "@" + getObjectName( ae ); + out << indent << objName << " = TQt::ToolBar.new(\"\", self, " << dock << ")" << endl; createObjectImpl( ae, parentClass, parent ); - for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + for ( TTQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "action" ) { out << indent << "@" << n2.attribute( "name" ) << ".addTo( " << objName << " )" << endl; } else if ( n2.tagName() == "separator" ) { out << indent << objName << ".addSeparator;" << endl; } else if ( n2.tagName() == "widget" ) { if ( n2.attribute( "class" ) != "Spacer" ) { - createObjectImpl( n2, "Qt::ToolBar", objName ); + createObjectImpl( n2, "TQt::ToolBar", objName ); } else { - TQString child = createSpacerImpl( n2, parentClass, parent, objName ); - out << indent << "Qt::Application.sendPostedEvents( " << objName - << ", Qt::Event::ChildInserted)" << endl; + TTQString child = createSpacerImpl( n2, parentClass, parent, objName ); + out << indent << "TQt::Application.sendPostedEvents( " << objName + << ", TQt::Event::ChildInserted)" << endl; out << indent << objName << ".boxLayout().addItem(" << child << ")" << endl; } } @@ -458,21 +458,21 @@ void Uic::createToolbarImpl( const TQDomElement &n, const TQString &parentClass, } } -void Uic::createMenuBarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent ) +void Uic::createMenuBarImpl( const TTQDomElement &n, const TTQString &parentClass, const TTQString &parent ) { - TQString objName = "@" + getObjectName( n ); - out << indent << objName << " = Qt::MenuBar.new( self, \"" << objName.mid(1) << "\" )" << endl; + TTQString objName = "@" + getObjectName( n ); + out << indent << objName << " = TQt::MenuBar.new( self, \"" << objName.mid(1) << "\" )" << endl; createObjectImpl( n, parentClass, parent ); int i = 0; - TQDomElement c = n.firstChild().toElement(); + TTQDomElement c = n.firstChild().toElement(); while ( !c.isNull() ) { if ( c.tagName() == "item" ) { - TQString itemName = "@" + c.attribute( "name" ); + TTQString itemName = "@" + c.attribute( "name" ); out << endl; - out << indent << itemName << " = Qt::PopupMenu.new( self )" << endl; + out << indent << itemName << " = TQt::PopupMenu.new( self )" << endl; createPopupMenuImpl( c, parentClass, itemName ); out << indent << objName << ".insertItem( \"\", " << itemName << ", " << i << " )" << endl; - TQString findItem(objName + ".findItem(%1)"); + TTQString findItem(objName + ".findItem(%1)"); findItem = findItem.arg(i); trout << indent << "if !" << findItem << ".nil?" << endl; trout << indent << indent << findItem << ".setText( " << trcall( c.attribute( "text" ) ) << " )" << endl; @@ -486,16 +486,16 @@ void Uic::createMenuBarImpl( const TQDomElement &n, const TQString &parentClass, } } -void Uic::createPopupMenuImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ) +void Uic::createPopupMenuImpl( const TTQDomElement &e, const TTQString &parentClass, const TTQString &parent ) { int i = 0; - for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + for ( TTQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) { - TQDomElement n2 = n.nextSibling().toElement(); + TTQDomElement n2 = n.nextSibling().toElement(); if ( n2.tagName() == "item" ) { // the action has a sub menu - TQString itemName = "@" + n2.attribute( "name" ); - TQString itemText = n2.attribute( "text" ); - out << indent << itemName << " = Qt::PopupMenu.new( self )" << endl; + TTQString itemName = "@" + n2.attribute( "name" ); + TTQString itemText = n2.attribute( "text" ); + out << indent << itemName << " = TQt::PopupMenu.new( self )" << endl; out << indent << indent << parent << ".insertItem( @" << n.attribute( "name" ) << ".iconSet(),"; out << trcall( itemText ) << ", " << itemName << " )" << endl; trout << indent << parent << ".changeItem( " << parent << ".idAt( " << i << " ), "; @@ -516,17 +516,17 @@ void Uic::createPopupMenuImpl( const TQDomElement &e, const TQString &parentClas Creates implementation of an listbox item tag. */ -TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &parent, - TQString *value ) +TTQString Uic::createListBoxItemImpl( const TTQDomElement &e, const TTQString &parent, + TTQString *value ) { - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString com; - TQString pix; + TTQDomElement n = e.firstChild().toElement(); + TTQString txt; + TTQString com; + TTQString pix; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - TQString attrib = n.attribute("name"); - TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); + TTQString attrib = n.attribute("name"); + TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -536,8 +536,8 @@ TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &pare pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -557,16 +557,16 @@ TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &pare Creates implementation of an iconview item tag. */ -TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &parent ) +TTQString Uic::createIconViewItemImpl( const TTQDomElement &e, const TTQString &parent ) { - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString com; - TQString pix; + TTQDomElement n = e.firstChild().toElement(); + TTQString txt; + TTQString com; + TTQString pix; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - TQString attrib = n.attribute("name"); - TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); + TTQString attrib = n.attribute("name"); + TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -576,8 +576,8 @@ TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &par pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -585,24 +585,24 @@ TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &par } if ( pix.isEmpty() ) - return "Qt::IconViewItem.new(" + parent + ", " + trcall( txt, com ) + ")"; + return "TQt::IconViewItem.new(" + parent + ", " + trcall( txt, com ) + ")"; else - return "Qt::IconViewItem.new(" + parent + ", " + trcall( txt, com ) + ", " + pix + ")"; + return "TQt::IconViewItem.new(" + parent + ", " + trcall( txt, com ) + ", " + pix + ")"; } /*! Creates implementation of an listview item tag. */ -TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &parent, - const TQString &parentItem ) +TTQString Uic::createListViewItemImpl( const TTQDomElement &e, const TTQString &parent, + const TTQString &parentItem ) { - TQString s; + TTQString s; - TQDomElement n = e.firstChild().toElement(); + TTQDomElement n = e.firstChild().toElement(); bool hasChildren = e.elementsByTagName( "item" ).count() > 0; - TQString item; + TTQString item; if ( hasChildren ) { item = registerObject( "item" ); @@ -619,26 +619,26 @@ TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &par } if ( !parentItem.isEmpty() ) - s += "Qt::ListViewItem.new(" + parentItem + ", " + lastItem + ")\n"; + s += "TQt::ListViewItem.new(" + parentItem + ", " + lastItem + ")\n"; else - s += "Qt::ListViewItem.new(" + parent + ", " + lastItem + ")\n"; + s += "TQt::ListViewItem.new(" + parent + ", " + lastItem + ")\n"; - TQStringList textes; - TQStringList pixmaps; + TTQStringList textes; + TTQStringList pixmaps; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - TQString attrib = n.attribute("name"); - TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); + TTQString attrib = n.attribute("name"); + TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() ); if ( attrib == "text" ) textes << v.toString(); else if ( attrib == "pixmap" ) { - TQString pix = v.toString(); + TTQString pix = v.toString(); if (!pix.isEmpty()) { pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } pixmaps << pix; } @@ -651,9 +651,9 @@ TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &par for ( int i = 0; i < (int)textes.count(); ++i ) { if ( !textes[ i ].isEmpty() ) - s += indent + item + ".setText(" + TQString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n"; + s += indent + item + ".setText(" + TTQString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n"; if ( !pixmaps[ i ].isEmpty() ) - s += indent + item + ".setPixmap(" + TQString::number( i ) + ", " + pixmaps[ i ] + ")\n"; + s += indent + item + ".setPixmap(" + TTQString::number( i ) + ", " + pixmaps[ i ] + ")\n"; } lastItem = item; @@ -664,18 +664,18 @@ TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &par Creates implementation of an listview column tag. */ -TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &parent, - TQString *value ) +TTQString Uic::createListViewColumnImpl( const TTQDomElement &e, const TTQString &parent, + TTQString *value ) { - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString com; - TQString pix; + TTQDomElement n = e.firstChild().toElement(); + TTQString txt; + TTQString com; + TTQString pix; bool clickable = false, resizeable = false; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - TQString attrib = n.attribute("name"); - TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); + TTQString attrib = n.attribute("name"); + TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -685,8 +685,8 @@ TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &p pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( attrib == "clickable" ) clickable = v.toBool(); @@ -699,7 +699,7 @@ TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &p if ( value ) *value = trcall( txt, com ); - TQString s; + TTQString s; s = indent + parent + ".addColumn(" + trcall( txt, com ) + ")\n"; if ( !pix.isEmpty() ) s += indent + parent + ".header().setLabel(" + parent + ".header().count() - 1," + pix + ", " + trcall( txt, com ) + ")\n"; @@ -711,28 +711,28 @@ TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &p return s; } -TQString Uic::createTableRowColumnImpl( const TQDomElement &e, const TQString &parent, - TQString *value ) +TTQString Uic::createTableRowColumnImpl( const TTQDomElement &e, const TTQString &parent, + TTQString *value ) { - TQString objClass = getClassName( e.parentNode().toElement() ); - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString com; - TQString pix; - TQString field; + TTQString objClass = getClassName( e.parentNode().toElement() ); + TTQDomElement n = e.firstChild().toElement(); + TTQString txt; + TTQString com; + TTQString pix; + TTQString field; bool isRow = e.tagName() == "row"; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - TQString attrib = n.attribute("name"); - TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); + TTQString attrib = n.attribute("name"); + TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); } else if ( attrib == "pixmap" ) { pix = v.toString(); if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( attrib == "field" ) field = v.toString(); @@ -745,32 +745,32 @@ TQString Uic::createTableRowColumnImpl( const TQDomElement &e, const TQString &p // ### This generated code sucks! We have to set the number of // rows/cols before and then only do setLabel/() - // ### careful, though, since TQDataTable has an API which makes this code pretty good + // ### careful, though, since TTQDataTable has an API which makes this code pretty good - TQString s; + TTQString s; if ( isRow ) { s = indent + parent + ".setNumRows(" + parent + ".numRows() + 1 )\n"; if ( pix.isEmpty() ) s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1, " + trcall( txt, com ) + ")\n"; else - s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1, Qt::IconSet.new(@" + s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1, TQt::IconSet.new(@" + pix + " ), " + trcall( txt, com ) + ")\n"; } else { - if ( objClass == "Qt::Table" ) { + if ( objClass == "TQt::Table" ) { s = indent + parent + ".setNumCols(" + parent + ".numCols() + 1)\n"; if ( pix.isEmpty() ) s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1, " + trcall( txt, com ) + ")\n"; else - s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1, Qt::IconSet.new(@" + s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1, TQt::IconSet.new(@" + pix + " ), " + trcall( txt, com ) + ")\n"; - } else if ( objClass == "Qt::DataTable" ) { + } else if ( objClass == "TQt::DataTable" ) { if ( !txt.isEmpty() && !field.isEmpty() ) { if ( pix.isEmpty() ) out << indent << parent << ".addColumn(" << fixString( field ) << ", " << trcall( txt, com ) << ")" << endl; else - out << indent << parent << ".addColumn(" << fixString( field ) << ", " << trcall( txt, com ) << ", Qt::IconSet.new(@" << pix << "))" << endl; + out << indent << parent << ".addColumn(" << fixString( field ) << ", " << trcall( txt, com ) << ", TQt::IconSet.new(@" << pix << "))" << endl; } } } @@ -780,32 +780,32 @@ TQString Uic::createTableRowColumnImpl( const TQDomElement &e, const TQString &p /*! Creates the implementation of a layout tag. Called from createObjectImpl(). */ -TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout ) +TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& parent, const TTQString& layout ) { - TQDomElement n; - TQString objClass, objName; + TTQDomElement n; + TTQString objClass, objName; objClass = e.tagName(); - TQString qlayout = "Qt::VBoxLayout.new"; + TTQString qlayout = "TQt::VBoxLayout.new"; if ( objClass == "hbox" ) - qlayout = "Qt::HBoxLayout.new"; + qlayout = "TQt::HBoxLayout.new"; else if ( objClass == "grid" ) - qlayout = "Qt::GridLayout.new"; + qlayout = "TQt::GridLayout.new"; bool isGrid = e.tagName() == "grid" ; objName = registerObject( getLayoutName( e ) ); layoutObjects += objName; - TQString margin = DomTool::readProperty( e, "margin", defMargin ).toString(); - TQString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString(); - TQString resizeMode = DomTool::readProperty( e, "resizeMode", TQString::null ).toString(); + TTQString margin = DomTool::readProperty( e, "margin", defMargin ).toString(); + TTQString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString(); + TTQString resizeMode = DomTool::readProperty( e, "resizeMode", TTQString::null ).toString(); - TQString optcells; + TTQString optcells; if ( isGrid ) optcells = "1, 1, "; - if ( (parentClass == "Qt::GroupBox" || parentClass == "Qt::ButtonGroup") && layout.isEmpty() ) { + if ( (parentClass == "TQt::GroupBox" || parentClass == "TQt::ButtonGroup") && layout.isEmpty() ) { // special case for group box - out << indent << parent << ".setColumnLayout( 0, Qt::Vertical )" << endl; + out << indent << parent << ".setColumnLayout( 0, TQt::Vertical )" << endl; out << indent << parent << ".layout().setSpacing(" << spacing << ")" << endl; out << indent << parent << ".layout().setMargin(" << margin << ")" << endl; out << indent << objName << " = " << qlayout << "(" << parent << ".layout() )" << endl; @@ -822,15 +822,15 @@ TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentCla out << ", " << optcells << margin << ", " << spacing << ", '" << objName.mid(1) << "')" << endl; } if ( !resizeMode.isEmpty() ) - out << indent << objName << ".setResizeMode( Qt::Layout::" << resizeMode << " )" << endl; + out << indent << objName << ".setResizeMode( TQt::Layout::" << resizeMode << " )" << endl; if ( !isGrid ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "spacer" ) { - TQString child = createSpacerImpl( n, parentClass, parent, objName ); + TTQString child = createSpacerImpl( n, parentClass, parent, objName ); out << indent << objName << ".addItem(" << child << ")" << endl; } else if ( tags.contains( n.tagName() ) ) { - TQString child = createObjectImpl( n, parentClass, parent, objName ); + TTQString child = createObjectImpl( n, parentClass, parent, objName ); if ( isLayout( child ) ) out << indent << objName << ".addLayout(" << child << ")" << endl; else @@ -839,7 +839,7 @@ TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentCla } } else { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - TQDomElement ae = n; + TTQDomElement ae = n; int row = ae.attribute( "row" ).toInt(); int col = ae.attribute( "column" ).toInt(); int rowspan = ae.attribute( "rowspan" ).toInt(); @@ -849,7 +849,7 @@ TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentCla if ( colspan < 1 ) colspan = 1; if ( n.tagName() == "spacer" ) { - TQString child = createSpacerImpl( n, parentClass, parent, objName ); + TTQString child = createSpacerImpl( n, parentClass, parent, objName ); if ( rowspan * colspan != 1 ) out << indent << objName << ".addMultiCell(" << child << ", " << row << ", " << row + rowspan - 1 << ", " << col << ", " << col + colspan - 1 << ")" << endl; @@ -857,9 +857,9 @@ TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentCla out << indent << objName << ".addItem(" << child << ", " << row << ", " << col << ")" << endl; } else if ( tags.contains( n.tagName() ) ) { - TQString child = createObjectImpl( n, parentClass, parent, objName ); + TTQString child = createObjectImpl( n, parentClass, parent, objName ); out << endl; - TQString o = "Widget"; + TTQString o = "Widget"; if ( isLayout( child ) ) o = "Layout"; if ( rowspan * colspan != 1 ) @@ -877,31 +877,31 @@ TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentCla -TQString Uic::createSpacerImpl( const TQDomElement &e, const TQString& /*parentClass*/, const TQString& /*parent*/, const TQString& /*layout*/) +TTQString Uic::createSpacerImpl( const TTQDomElement &e, const TTQString& /*parentClass*/, const TTQString& /*parent*/, const TTQString& /*layout*/) { - TQDomElement n; - TQString objClass, objName; + TTQDomElement n; + TTQString objClass, objName; objClass = e.tagName(); objName = registerObject( getObjectName( e ) ); - TQSize size = DomTool::readProperty( e, "sizeHint", TQSize( 0, 0 ) ).toSize(); - TQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); + TTQSize size = DomTool::readProperty( e, "sizeHint", TTQSize( 0, 0 ) ).toSize(); + TTQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); bool isVspacer = DomTool::readProperty( e, "orientation", "Horizontal" ) == "Vertical"; if ( sizeType != "Expanding" && sizeType != "MinimumExpanding" && DomTool::hasProperty( e, "geometry" ) ) { // compatibility Qt 2.2 - TQRect geom = DomTool::readProperty( e, "geometry", TQRect(0,0,0,0) ).toRect(); + TTQRect geom = DomTool::readProperty( e, "geometry", TTQRect(0,0,0,0) ).toRect(); size = geom.size(); } if ( isVspacer ) - out << indent << objName << " = Qt::SpacerItem.new(" + out << indent << objName << " = TQt::SpacerItem.new(" << size.width() << ", " << size.height() - << ", Qt::SizePolicy::Minimum, Qt::SizePolicy::" << sizeType << ")" << endl; + << ", TQt::SizePolicy::Minimum, TQt::SizePolicy::" << sizeType << ")" << endl; else - out << indent << objName << " = Qt::SpacerItem.new(" + out << indent << objName << " = TQt::SpacerItem.new(" << size.width() << ", " << size.height() - << ", Qt::SizePolicy::" << sizeType << ", Qt::SizePolicy::Minimum)" << endl; + << ", TQt::SizePolicy::" << sizeType << ", TQt::SizePolicy::Minimum)" << endl; return objName; } @@ -916,34 +916,34 @@ static const char* const ColorRole[] = { /*! Creates a colorgroup with name \a name from the color group \a cg */ -void Uic::createColorGroupImpl( const TQString& name, const TQDomElement& e ) +void Uic::createColorGroupImpl( const TTQString& name, const TTQDomElement& e ) { - TQColorGroup cg; + TTQColorGroup cg; int r = -1; - TQDomElement n = e.firstChild().toElement(); - TQString color; + TTQDomElement n = e.firstChild().toElement(); + TTQString color; while ( !n.isNull() ) { if ( n.tagName() == "color" ) { r++; - TQColor col = DomTool::readColor( n ); - color = "Qt::Color.new(%1,%2,%3)"; + TTQColor col = DomTool::readColor( n ); + color = "TQt::Color.new(%1,%2,%3)"; color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() ); if ( col == white ) color = "white"; else if ( col == black ) color = "black"; if ( n.nextSibling().toElement().tagName() != "pixmap" ) { - out << indent << name << ".setColor(Qt::ColorGroup::" << ColorRole[r] << ", " << color << ")" << endl; + out << indent << name << ".setColor(TQt::ColorGroup::" << ColorRole[r] << ", " << color << ")" << endl; } } else if ( n.tagName() == "pixmap" ) { - TQString pixmap = n.firstChild().toText().data(); + TTQString pixmap = n.firstChild().toText().data(); pixmap.prepend("@"); if ( !pixmapLoaderFunction.isEmpty() ) { - pixmap.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); - pixmap.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); + pixmap.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) ); + pixmap.append( TTQString( externPixmaps ? "\"" : "" ) + ")" ); } - out << indent << name << ".setBrush(Qt::ColorGroup::" - << ColorRole[r] << ", Qt::Brush.new(" << color << ", " << pixmap << "))" << endl; + out << indent << name << ".setBrush(TQt::ColorGroup::" + << ColorRole[r] << ", TQt::Brush.new(" << color << ", " << pixmap << "))" << endl; } n = n.nextSibling().toElement(); } @@ -953,16 +953,16 @@ void Uic::createColorGroupImpl( const TQString& name, const TQDomElement& e ) Auxiliary function to load a color group. The colorgroup must not contain pixmaps. */ -TQColorGroup Uic::loadColorGroup( const TQDomElement &e ) +TTQColorGroup Uic::loadColorGroup( const TTQDomElement &e ) { - TQColorGroup cg; + TTQColorGroup cg; int r = -1; - TQDomElement n = e.firstChild().toElement(); - TQColor col; + TTQDomElement n = e.firstChild().toElement(); + TTQColor col; while ( !n.isNull() ) { if ( n.tagName() == "color" ) { r++; - cg.setColor( (TQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); + cg.setColor( (TTQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); } n = n.nextSibling().toElement(); } @@ -973,10 +973,10 @@ TQColorGroup Uic::loadColorGroup( const TQDomElement &e ) the database \a connection and \a table. */ -bool Uic::isWidgetInTable( const TQDomElement& e, const TQString& connection, const TQString& table ) +bool Uic::isWidgetInTable( const TTQDomElement& e, const TTQString& connection, const TTQString& table ) { - TQString conn = getDatabaseInfo( e, "connection" ); - TQString tab = getDatabaseInfo( e, "table" ); + TTQString conn = getDatabaseInfo( e, "connection" ); + TTQString tab = getDatabaseInfo( e, "table" ); if ( conn == connection && tab == table ) return true; return false; @@ -986,17 +986,17 @@ bool Uic::isWidgetInTable( const TQDomElement& e, const TQString& connection, co Registers all database connections, cursors and forms. */ -void Uic::registerDatabases( const TQDomElement& e ) +void Uic::registerDatabases( const TTQDomElement& e ) { - TQDomElement n; - TQDomNodeList nl; + TTQDomElement n; + TTQDomNodeList nl; int i; nl = e.parentNode().toElement().elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); ++i ) { n = nl.item(i).toElement(); - TQString conn = getDatabaseInfo( n, "connection" ); - TQString tab = getDatabaseInfo( n, "table" ); - TQString fld = getDatabaseInfo( n, "field" ); + TTQString conn = getDatabaseInfo( n, "connection" ); + TTQString tab = getDatabaseInfo( n, "table" ); + TTQString fld = getDatabaseInfo( n, "field" ); if ( !conn.isNull() ) { dbConnections += conn; if ( !tab.isNull() ) { @@ -1016,7 +1016,7 @@ void Uic::registerDatabases( const TQDomElement& e ) \sa registeredName(), isObjectRegistered() */ -TQString Uic::registerObject( const TQString& name ) +TTQString Uic::registerObject( const TTQString& name ) { if ( objectNames.isEmpty() ) { // some temporary variables we need @@ -1025,7 +1025,7 @@ TQString Uic::registerObject( const TQString& name ) objectNames += "cg"; objectNames += "pal"; } - TQString result("@"); + TTQString result("@"); result += name; int i; while ( ( i = result.find(' ' )) != -1 ) { @@ -1034,10 +1034,10 @@ TQString Uic::registerObject( const TQString& name ) if ( objectNames.contains( result ) ) { int i = 2; - while ( objectNames.contains( result + "_" + TQString::number(i) ) ) + while ( objectNames.contains( result + "_" + TTQString::number(i) ) ) i++; result += "_"; - result += TQString::number(i); + result += TTQString::number(i); } objectNames += result; objectMapper.insert( name, result ); @@ -1050,7 +1050,7 @@ TQString Uic::registerObject( const TQString& name ) \sa registerObject(), isObjectRegistered() */ -TQString Uic::registeredName( const TQString& name ) +TTQString Uic::registeredName( const TTQString& name ) { if ( !objectMapper.contains( name ) ) return name; @@ -1060,24 +1060,24 @@ TQString Uic::registeredName( const TQString& name ) /*! Returns whether the object \a name was registered yet or not. */ -bool Uic::isObjectRegistered( const TQString& name ) +bool Uic::isObjectRegistered( const TTQString& name ) { return objectMapper.contains( name ); } /*! - Unifies the entries in stringlist \a list. Should really be a TQStringList feature. + Unifies the entries in stringlist \a list. Should really be a TTQStringList feature. */ -TQStringList Uic::unique( const TQStringList& list ) +TTQStringList Uic::unique( const TTQStringList& list ) { - TQStringList result; + TTQStringList result; if ( list.isEmpty() ) return result; - TQStringList l = list; + TTQStringList l = list; l.sort(); result += l.first(); - for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) { + for ( TTQStringList::Iterator it = l.begin(); it != l.end(); ++it ) { if ( *it != result.last() ) result += *it; } @@ -1089,7 +1089,7 @@ TQStringList Uic::unique( const TQStringList& list ) /*! Creates an instance of class \a objClass, with parent \a parent and name \a objName */ -TQString Uic::createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ) +TTQString Uic::createObjectInstance( const TTQString& objClass, const TTQString& parent, const TTQString& objName ) { if ( objClass.mid( 4 ) == "ComboBox" ) { @@ -1098,7 +1098,7 @@ TQString Uic::createObjectInstance( const TQString& objClass, const TQString& pa return objClass + ".new(" + parent + ", \"" + objName.mid(1) + "\")"; } -bool Uic::isLayout( const TQString& name ) const +bool Uic::isLayout( const TTQString& name ) const { return layoutObjects.contains( name ); } diff --git a/qtruby/rubylib/designer/rbuic/uic.h b/qtruby/rubylib/designer/rbuic/uic.h index ddfcc1be..18177ee7 100644 --- a/qtruby/rubylib/designer/rbuic/uic.h +++ b/qtruby/rubylib/designer/rbuic/uic.h @@ -37,12 +37,12 @@ public: void setTabStop(uint n) {tabStop = n; calc();} void operator++() {++current; calc();} void operator--() {--current; calc();} - operator TQString() {return indstr;} + operator TTQString() {return indstr;} private: uint tabStop; uint current; - TQString indstr; + TTQString indstr; void calc(); }; @@ -51,95 +51,95 @@ private: class Uic : public Qt { public: - Uic( const TQString &fn, TQTextStream& out, TQDomDocument doc, bool subcl, - const TQString &trm, const TQString& subclname, bool omitForwardDecls, - TQString &uicClass, bool useKDE ); + Uic( const TTQString &fn, TTQTextStream& out, TTQDomDocument doc, bool subcl, + const TTQString &trm, const TTQString& subclname, bool omitForwardDecls, + TTQString &uicClass, bool useKDE ); static void setIndent(const RubyIndent &rubyind) {indent = rubyind;} - void createFormImpl( const TQDomElement &e ); - - void createSubImpl( const TQDomElement &e, const TQString& subclname ); - - void createObjectDecl( const TQDomElement& e ); - void createAttrDecl( const TQDomElement& e ); - void createActionDecl( const TQDomElement& e ); - void createActionImpl( const TQDomElement& e, const TQString &parent ); - void createToolbarImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); - void createMenuBarImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); - void createPopupMenuImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); - TQString createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - TQString createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - TQString createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ); - TQString createSpacerImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - void createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ); - TQString createListBoxItemImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); - TQString createIconViewItemImpl( const TQDomElement &e, const TQString &parent ); - TQString createListViewColumnImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); - TQString createTableRowColumnImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); - TQString createListViewItemImpl( const TQDomElement &e, const TQString &parent, - const TQString &parentItem ); - void createColorGroupImpl( const TQString& cg, const TQDomElement& e ); - TQColorGroup loadColorGroup( const TQDomElement &e ); - - TQDomElement getObjectProperty( const TQDomElement& e, const TQString& name ); - TQString getPixmapLoaderFunction( const TQDomElement& e ); - TQString getFormClassName( const TQDomElement& e ); - TQString getClassName( const TQDomElement& e ); - TQString getObjectName( const TQDomElement& e ); - TQString getLayoutName( const TQDomElement& e ); - TQString getInclude( const TQString& className ); - - TQString setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ); - - TQString registerObject( const TQString& name ); - TQString registeredName( const TQString& name ); - bool isObjectRegistered( const TQString& name ); - TQStringList unique( const TQStringList& ); - - TQString trcall( const TQString& sourceText, const TQString& comment = "" ); - - static void embed( TQTextStream& out, const char* project, const TQStringList& images ); - - friend void getDBConnections(Uic& uic, TQString& s); + void createFormImpl( const TTQDomElement &e ); + + void createSubImpl( const TTQDomElement &e, const TTQString& subclname ); + + void createObjectDecl( const TTQDomElement& e ); + void createAttrDecl( const TTQDomElement& e ); + void createActionDecl( const TTQDomElement& e ); + void createActionImpl( const TTQDomElement& e, const TTQString &parent ); + void createToolbarImpl( const TTQDomElement &e, const TTQString &parentClass, const TTQString &parent ); + void createMenuBarImpl( const TTQDomElement &e, const TTQString &parentClass, const TTQString &parent ); + void createPopupMenuImpl( const TTQDomElement &e, const TTQString &parentClass, const TTQString &parent ); + TTQString createObjectImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& parent, const TTQString& layout = TTQString::null ); + TTQString createLayoutImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& parent, const TTQString& layout = TTQString::null ); + TTQString createObjectInstance( const TTQString& objClass, const TTQString& parent, const TTQString& objName ); + TTQString createSpacerImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& parent, const TTQString& layout = TTQString::null ); + void createExclusiveProperty( const TTQDomElement & e, const TTQString& exclusiveProp ); + TTQString createListBoxItemImpl( const TTQDomElement &e, const TTQString &parent, TTQString *value = 0 ); + TTQString createIconViewItemImpl( const TTQDomElement &e, const TTQString &parent ); + TTQString createListViewColumnImpl( const TTQDomElement &e, const TTQString &parent, TTQString *value = 0 ); + TTQString createTableRowColumnImpl( const TTQDomElement &e, const TTQString &parent, TTQString *value = 0 ); + TTQString createListViewItemImpl( const TTQDomElement &e, const TTQString &parent, + const TTQString &parentItem ); + void createColorGroupImpl( const TTQString& cg, const TTQDomElement& e ); + TTQColorGroup loadColorGroup( const TTQDomElement &e ); + + TTQDomElement getObjectProperty( const TTQDomElement& e, const TTQString& name ); + TTQString getPixmapLoaderFunction( const TTQDomElement& e ); + TTQString getFormClassName( const TTQDomElement& e ); + TTQString getClassName( const TTQDomElement& e ); + TTQString getObjectName( const TTQDomElement& e ); + TTQString getLayoutName( const TTQDomElement& e ); + TTQString getInclude( const TTQString& className ); + + TTQString setObjectProperty( const TTQString& objClass, const TTQString& obj, const TTQString &prop, const TTQDomElement &e, bool stdset ); + + TTQString registerObject( const TTQString& name ); + TTQString registeredName( const TTQString& name ); + bool isObjectRegistered( const TTQString& name ); + TTQStringList unique( const TTQStringList& ); + + TTQString trcall( const TTQString& sourceText, const TTQString& comment = "" ); + + static void embed( TTQTextStream& out, const char* project, const TTQStringList& images ); + + friend void getDBConnections(Uic& uic, TTQString& s); static bool hasKDEwidget; private: - void registerLayouts ( const TQDomElement& e ); - - TQTextStream& out; - TQTextOStream trout; - TQString languageChangeBody; - TQStringList objectNames; - TQMap<TQString,TQString> objectMapper; - TQStringList tags; - TQStringList layouts; - TQString formName; - TQString lastItem; - TQString trmacro; + void registerLayouts ( const TTQDomElement& e ); + + TTQTextStream& out; + TTQTextOStream trout; + TTQString languageChangeBody; + TTQStringList objectNames; + TTQMap<TTQString,TTQString> objectMapper; + TTQStringList tags; + TTQStringList layouts; + TTQString formName; + TTQString lastItem; + TTQString trmacro; bool nofwd; static RubyIndent indent; struct Buddy { - Buddy( const TQString& k, const TQString& b ) + Buddy( const TTQString& k, const TTQString& b ) : key( k ), buddy( b ) {} Buddy(){} // for valuelist - TQString key; - TQString buddy; + TTQString key; + TTQString buddy; bool operator==( const Buddy& other ) const { return (key == other.key); } }; struct CustomInclude { - TQString header; - TQString location; + TTQString header; + TTQString location; }; - TQValueList<Buddy> buddies; + TTQValueList<Buddy> buddies; - TQStringList layoutObjects; - bool isLayout( const TQString& name ) const; + TTQStringList layoutObjects; + bool isLayout( const TTQString& name ) const; uint item_used : 1; uint cg_used : 1; @@ -147,35 +147,35 @@ private: uint stdsetdef : 1; uint externPixmaps : 1; - TQString uiFileVersion; - TQString nameOfClass; - TQString pixmapLoaderFunction; + TTQString uiFileVersion; + TTQString nameOfClass; + TTQString pixmapLoaderFunction; - void registerDatabases( const TQDomElement& e ); - bool isWidgetInTable( const TQDomElement& e, const TQString& connection, const TQString& table ); - bool isFrameworkCodeGenerated( const TQDomElement& e ); - TQString getDatabaseInfo( const TQDomElement& e, const TQString& tag ); - void createFormImpl( const TQDomElement& e, const TQString& form, const TQString& connection, const TQString& table ); - TQStringList dbConnections; - TQMap< TQString, TQStringList > dbCursors; - TQMap< TQString, TQStringList > dbForms; + void registerDatabases( const TTQDomElement& e ); + bool isWidgetInTable( const TTQDomElement& e, const TTQString& connection, const TTQString& table ); + bool isFrameworkCodeGenerated( const TTQDomElement& e ); + TTQString getDatabaseInfo( const TTQDomElement& e, const TTQString& tag ); + void createFormImpl( const TTQDomElement& e, const TTQString& form, const TTQString& connection, const TTQString& table ); + TTQStringList dbConnections; + TTQMap< TTQString, TTQStringList > dbCursors; + TTQMap< TTQString, TTQStringList > dbForms; static bool isMainWindow; - static TQString mkBool( bool b ); - static TQString mkBool( const TQString& s ); - bool toBool( const TQString& s ); - static TQString fixString( const TQString &str ); + static TTQString mkBool( bool b ); + static TTQString mkBool( const TTQString& s ); + bool toBool( const TTQString& s ); + static TTQString fixString( const TTQString &str ); static bool onlyAscii; - static TQString mkStdSet( const TQString& prop ); - static TQString getComment( const TQDomNode& n ); + static TTQString mkStdSet( const TTQString& prop ); + static TTQString getComment( const TTQDomNode& n ); int defSpacing, defMargin; - TQString fileName; + TTQString fileName; bool writeSlotImpl; - bool isEmptyFunction( const TQString& fname ); - TQMap<TQString, TQString> functionImpls; + bool isEmptyFunction( const TTQString& fname ); + TTQMap<TTQString, TTQString> functionImpls; - void rubySlot(TQStringList::Iterator &it); + void rubySlot(TTQStringList::Iterator &it); }; #endif diff --git a/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp b/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp index 2538d0ae..cc4779a2 100644 --- a/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp +++ b/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp @@ -41,17 +41,17 @@ const int dbsize = 300; const int dbcustom = 200; const int dbdictsize = 211; static WidgetDatabaseRecord* db[ dbsize ]; -static TQDict<int> *className2Id = 0; +static TTQDict<int> *className2Id = 0; static int dbcount = 0; static int dbcustomcount = 200; -static TQStrList *wGroups; -static TQStrList *invisibleGroups; +static TTQStrList *wGroups; +static TTQStrList *invisibleGroups; static bool whatsThisLoaded = false; -static QPluginManager<WidgetInterface> *widgetPluginManager = 0; +static TQPluginManager<WidgetInterface> *widgetPluginManager = 0; static bool plugins_set_up = false; static bool was_in_setup = false; -TQCleanupHandler<QPluginManager<WidgetInterface> > cleanup_manager; +TTQCleanupHandler<TQPluginManager<WidgetInterface> > cleanup_manager; WidgetDatabaseRecord::WidgetDatabaseRecord() { @@ -113,18 +113,18 @@ void WidgetDatabase::setupDataBase( int id ) return; #endif - wGroups = new QStrList; - invisibleGroups = new QStrList; + wGroups = new TQStrList; + invisibleGroups = new TQStrList; invisibleGroups->append( "Forms" ); invisibleGroups->append( "Temp" ); - className2Id = new TQDict<int>( dbdictsize ); + className2Id = new TTQDict<int>( dbdictsize ); className2Id->setAutoDelete( true ); WidgetDatabaseRecord *r = 0; r = new WidgetDatabaseRecord; r->iconSet = "pushbutton.xpm"; - r->name = "TQPushButton"; + r->name = "TTQPushButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Push Button"; @@ -132,7 +132,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "toolbutton.xpm"; - r->name = "TQToolButton"; + r->name = "TTQToolButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Tool Button"; @@ -140,7 +140,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "radiobutton.xpm"; - r->name = "TQRadioButton"; + r->name = "TTQRadioButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Radio Button"; @@ -148,7 +148,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "checkbox.xpm"; - r->name = "TQCheckBox"; + r->name = "TTQCheckBox"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Check Box"; @@ -156,7 +156,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "groupbox.xpm"; - r->name = "TQGroupBox"; + r->name = "TTQGroupBox"; r->group = widgetGroup( "Containers" ); r->toolTip = "Group Box"; r->isContainer = true; @@ -165,7 +165,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "buttongroup.xpm"; - r->name = "TQButtonGroup"; + r->name = "TTQButtonGroup"; r->group = widgetGroup( "Containers" ); r->toolTip = "Button Group"; r->isContainer = true; @@ -174,7 +174,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "frame.xpm"; - r->name = "TQFrame"; + r->name = "TTQFrame"; r->group = widgetGroup( "Containers" ); r->toolTip = "Frame"; r->isContainer = true; @@ -183,7 +183,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "tabwidget.xpm"; - r->name = "TQTabWidget"; + r->name = "TTQTabWidget"; r->group = widgetGroup( "Containers" ); r->toolTip = "Tabwidget"; r->isContainer = true; @@ -193,7 +193,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "listbox.xpm"; - r->name = "TQListBox"; + r->name = "TTQListBox"; r->group = widgetGroup( "Views" ); r->toolTip = "List Box"; @@ -201,7 +201,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "listview.xpm"; - r->name = "TQListView"; + r->name = "TTQListView"; r->group = widgetGroup( "Views" ); r->toolTip = "List View"; @@ -210,7 +210,7 @@ void WidgetDatabase::setupDataBase( int id ) #if !defined(QT_NO_ICONVIEW) || defined(UIC) r = new WidgetDatabaseRecord; r->iconSet = "iconview.xpm"; - r->name = "TQIconView"; + r->name = "TTQIconView"; r->group = widgetGroup( "Views" ); r->toolTip = "Icon View"; @@ -220,7 +220,7 @@ void WidgetDatabase::setupDataBase( int id ) #if !defined(QT_NO_TABLE) r = new WidgetDatabaseRecord; r->iconSet = "table.xpm"; - r->name = "TQTable"; + r->name = "TTQTable"; r->group = widgetGroup( "Views" ); r->toolTip = "Table"; @@ -231,7 +231,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "datatable.xpm"; r->includeFile = "tqdatatable.h"; - r->name = "TQDataTable"; + r->name = "TTQDataTable"; r->group = widgetGroup( "Database" ); r->toolTip = "Data Table"; @@ -240,7 +240,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "lineedit.xpm"; - r->name = "TQLineEdit"; + r->name = "TTQLineEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Line Edit"; @@ -248,7 +248,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "spinbox.xpm"; - r->name = "TQSpinBox"; + r->name = "TTQSpinBox"; r->group = widgetGroup( "Input" ); r->toolTip = "Spin Box"; @@ -256,7 +256,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "dateedit.xpm"; - r->name = "QDateEdit"; + r->name = "TQDateEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Date Edit"; r->includeFile = "tqdatetimeedit.h"; @@ -265,7 +265,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "timeedit.xpm"; - r->name = "QTimeEdit"; + r->name = "TQTimeEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Time Edit"; r->includeFile = "tqdatetimeedit.h"; @@ -274,7 +274,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "datetimeedit.xpm"; - r->name = "QDateTimeEdit"; + r->name = "TQDateTimeEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Date-Time Edit"; r->includeFile = "tqdatetimeedit.h"; @@ -283,7 +283,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "multilineedit.xpm"; - r->name = "TQMultiLineEdit"; + r->name = "TTQMultiLineEdit"; r->group = widgetGroup( "Temp" ); r->toolTip = "Multi Line Edit"; @@ -291,7 +291,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "richtextedit.xpm"; - r->name = "TQTextEdit"; + r->name = "TTQTextEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Richtext Editor"; @@ -299,7 +299,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "combobox.xpm"; - r->name = "TQComboBox"; + r->name = "TTQComboBox"; r->group = widgetGroup( "Input" ); r->toolTip = "Combo Box"; @@ -307,7 +307,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "slider.xpm"; - r->name = "TQSlider"; + r->name = "TTQSlider"; r->group = widgetGroup( "Input" ); r->toolTip = "Slider"; @@ -315,7 +315,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "scrollbar.xpm"; - r->name = "TQScrollBar"; + r->name = "TTQScrollBar"; r->group = widgetGroup( "Input" ); r->toolTip = "Scrollbar"; @@ -323,7 +323,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "dial.xpm"; - r->name = "TQDial"; + r->name = "TTQDial"; r->group = widgetGroup( "Input" ); r->toolTip = "Dial"; @@ -331,7 +331,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "label.xpm"; - r->name = "TQLabel"; + r->name = "TTQLabel"; r->group = widgetGroup( "Temp" ); r->toolTip = "Label"; @@ -357,7 +357,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "lcdnumber.xpm"; - r->name = "QLCDNumber"; + r->name = "TQLCDNumber"; r->group = widgetGroup( "Display" ); r->toolTip = "LCD Number"; @@ -375,7 +375,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "progress.xpm"; - r->name = "TQProgressBar"; + r->name = "TTQProgressBar"; r->group = widgetGroup( "Display" ); r->toolTip = "Progress Bar"; @@ -383,7 +383,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "textview.xpm"; - r->name = "TQTextView"; + r->name = "TTQTextView"; r->group = widgetGroup( "Temp" ); r->toolTip = "Text View"; @@ -391,7 +391,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "textbrowser.xpm"; - r->name = "TQTextBrowser"; + r->name = "TTQTextBrowser"; r->group = widgetGroup( "Display" ); r->toolTip = "Text Browser"; @@ -407,35 +407,35 @@ void WidgetDatabase::setupDataBase( int id ) append( r ); r = new WidgetDatabaseRecord; - r->name = "TQWidget"; + r->name = "TTQWidget"; r->isForm = true; r->group = widgetGroup( "Forms" ); append( r ); r = new WidgetDatabaseRecord; - r->name = "TQDialog"; + r->name = "TTQDialog"; r->group = widgetGroup( "Forms" ); r->isForm = true; append( r ); r = new WidgetDatabaseRecord; - r->name = "TQWizard"; + r->name = "TTQWizard"; r->group = widgetGroup( "Forms" ); r->isContainer = true; append( r ); r = new WidgetDatabaseRecord; - r->name = "QDesignerWizard"; + r->name = "TQDesignerWizard"; r->group = widgetGroup( "Forms" ); r->isContainer = true; append( r ); r = new WidgetDatabaseRecord; - r->name = "QLayoutWidget"; + r->name = "TQLayoutWidget"; r->group = widgetGroup( "Temp" ); r->includeFile = ""; r->isContainer = true; @@ -443,7 +443,7 @@ void WidgetDatabase::setupDataBase( int id ) append( r ); r = new WidgetDatabaseRecord; - r->name = "TQSplitter"; + r->name = "TTQSplitter"; r->group = widgetGroup( "Temp" ); r->includeFile = "tqsplitter.h"; r->isContainer = true; @@ -452,7 +452,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "tabwidget.xpm"; - r->name = "QDesignerTabWidget"; + r->name = "TQDesignerTabWidget"; r->group = widgetGroup( "Temp" ); r->isContainer = true; @@ -460,7 +460,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "tabwidget.xpm"; - r->name = "QDesignerWidget"; + r->name = "TQDesignerWidget"; r->group = widgetGroup( "Temp" ); r->isContainer = true; @@ -468,7 +468,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "tabwidget.xpm"; - r->name = "QDesignerDialog"; + r->name = "TQDesignerDialog"; r->group = widgetGroup( "Temp" ); r->isContainer = true; @@ -476,7 +476,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "TQMainWindow"; + r->name = "TTQMainWindow"; r->includeFile = "tqmainwindow.h"; r->group = widgetGroup( "Temp" ); r->isContainer = true; @@ -486,7 +486,7 @@ void WidgetDatabase::setupDataBase( int id ) #ifndef QT_NO_SQL r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "TQDataBrowser"; + r->name = "TTQDataBrowser"; r->includeFile = "tqdatabrowser.h"; r->group = widgetGroup( "Database" ); r->toolTip = "Data Browser"; @@ -497,7 +497,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "TQDataView"; + r->name = "TTQDataView"; r->includeFile = "tqdataview.h"; r->group = widgetGroup( "Database" ); r->toolTip = "Data View"; @@ -517,8 +517,8 @@ void WidgetDatabase::setupPlugins() if ( plugins_set_up ) return; plugins_set_up = true; - TQStringList widgets = widgetManager()->featureList(); - for ( TQStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { + TTQStringList widgets = widgetManager()->featureList(); + for ( TTQStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { if ( hasWidget( *it ) ) continue; WidgetDatabaseRecord *r = new WidgetDatabaseRecord; @@ -528,11 +528,11 @@ void WidgetDatabase::setupPlugins() continue; #ifndef UIC - TQIconSet icon = iface->iconSet( *it ); + TTQIconSet icon = iface->iconSet( *it ); if ( !icon.pixmap().isNull() ) - r->icon = new TQIconSet( icon ); + r->icon = new TTQIconSet( icon ); #endif - TQString grp = iface->group( *it ); + TTQString grp = iface->group( *it ); if ( grp.isEmpty() ) grp = "3rd party widgets"; r->group = widgetGroup( grp ); @@ -570,19 +570,19 @@ int WidgetDatabase::startCustom() Returns the iconset which represents the class registered as \a id. */ -TQIconSet WidgetDatabase::iconSet( int id ) +TTQIconSet WidgetDatabase::iconSet( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQIconSet(); + return TTQIconSet(); #if !defined(UIC) && !defined(RESOURCE) if ( !r->icon ) - r->icon = new TQIconSet( PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Small ), + r->icon = new TTQIconSet( PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Small ), PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Large ) ); return *r->icon; #else - return TQIconSet(); + return TTQIconSet(); #endif } @@ -590,12 +590,12 @@ TQIconSet WidgetDatabase::iconSet( int id ) Returns the classname of the widget which is registered as \a id. */ -TQString WidgetDatabase::className( int id ) +TTQString WidgetDatabase::className( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQString::null; + return TTQString::null; return r->name; } @@ -603,12 +603,12 @@ TQString WidgetDatabase::className( int id ) Returns the group to which the widget registered as \a id belongs. */ -TQString WidgetDatabase::group( int id ) +TTQString WidgetDatabase::group( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQString::null; + return TTQString::null; return r->group; } @@ -616,12 +616,12 @@ TQString WidgetDatabase::group( int id ) id. */ -TQString WidgetDatabase::toolTip( int id ) +TTQString WidgetDatabase::toolTip( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQString::null; + return TTQString::null; return r->toolTip; } @@ -629,12 +629,12 @@ TQString WidgetDatabase::toolTip( int id ) as \a id. */ -TQString WidgetDatabase::whatsThis( int id ) +TTQString WidgetDatabase::whatsThis( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQString::null; + return TTQString::null; return r->whatsThis; } @@ -642,12 +642,12 @@ TQString WidgetDatabase::whatsThis( int id ) Returns the include file if the widget which is registered as \a id. */ -TQString WidgetDatabase::includeFile( int id ) +TTQString WidgetDatabase::includeFile( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return TQString::null; + return TTQString::null; if ( r->includeFile.isNull() ) return r->name.lower() + ".h"; return r->includeFile; @@ -677,24 +677,24 @@ bool WidgetDatabase::isContainer( int id ) return r->isContainer || r->isForm; } -TQString WidgetDatabase::createWidgetName( int id ) +TTQString WidgetDatabase::createWidgetName( int id ) { setupDataBase( id ); - TQString n = className( id ); - if ( n == "QLayoutWidget" ) + TTQString n = className( id ); + if ( n == "TQLayoutWidget" ) n = "Layout"; if ( n[ 0 ] == 'Q' ) n = n.mid( 1 ); WidgetDatabaseRecord *r = at( id ); if ( !r ) return n; - n += TQString::number( ++r->nameCounter ); + n += TTQString::number( ++r->nameCounter ); return n; } /*! Returns the id for \a name or -1 if \a name is unknown. */ -int WidgetDatabase::idFromClassName( const TQString &name ) +int WidgetDatabase::idFromClassName( const TTQString &name ) { setupDataBase( -1 ); if ( name.isEmpty() ) @@ -703,7 +703,7 @@ int WidgetDatabase::idFromClassName( const TQString &name ) if ( i ) return *i; if ( name == "FormWindow" ) - return idFromClassName( "QLayoutWidget" ); + return idFromClassName( "TQLayoutWidget" ); #ifdef UIC #ifndef NO_UI_PLUGINS setupDataBase( -2 ); @@ -715,7 +715,7 @@ int WidgetDatabase::idFromClassName( const TQString &name ) return -1; } -bool WidgetDatabase::hasWidget( const TQString &name ) +bool WidgetDatabase::hasWidget( const TTQString &name ) { return className2Id->find( name ) != 0; } @@ -738,7 +738,7 @@ void WidgetDatabase::insert( int index, WidgetDatabaseRecord *r ) db[ index ] = r; className2Id->insert( r->name, new int( index ) ); if ( index < dbcustom ) - dbcount = QMAX( dbcount, index ); + dbcount = TQMAX( dbcount, index ); } void WidgetDatabase::append( WidgetDatabaseRecord *r ) @@ -748,14 +748,14 @@ void WidgetDatabase::append( WidgetDatabaseRecord *r ) insert( dbcount++, r ); } -TQString WidgetDatabase::widgetGroup( const TQString &g ) +TTQString WidgetDatabase::widgetGroup( const TTQString &g ) { if ( wGroups->find( g ) == -1 ) wGroups->append( g ); return g; } -bool WidgetDatabase::isGroupEmpty( const TQString &grp ) +bool WidgetDatabase::isGroupEmpty( const TTQString &grp ) { WidgetDatabaseRecord *r = 0; for ( int i = 0; i < dbcount; ++i ) { @@ -767,12 +767,12 @@ bool WidgetDatabase::isGroupEmpty( const TQString &grp ) return true; } -TQString WidgetDatabase::widgetGroup( int i ) +TTQString WidgetDatabase::widgetGroup( int i ) { setupDataBase( -1 ); if ( i >= 0 && i < (int)wGroups->count() ) return wGroups->at( i ); - return TQString::null; + return TTQString::null; } int WidgetDatabase::numWidgetGroups() @@ -781,7 +781,7 @@ int WidgetDatabase::numWidgetGroups() return wGroups->count(); } -bool WidgetDatabase::isGroupVisible( const TQString &g ) +bool WidgetDatabase::isGroupVisible( const TTQString &g ) { setupDataBase( -1 ); return invisibleGroups->find( g ) == -1; @@ -805,16 +805,16 @@ bool WidgetDatabase::isWhatsThisLoaded() return whatsThisLoaded; } -void WidgetDatabase::loadWhatsThis( const TQString &docPath ) +void WidgetDatabase::loadWhatsThis( const TTQString &docPath ) { - TQString whatsthisFile = docPath + "/whatsthis"; - TQFile f( whatsthisFile ); + TTQString whatsthisFile = docPath + "/whatsthis"; + TTQFile f( whatsthisFile ); if ( !f.open( IO_ReadOnly ) ) return; - TQTextStream ts( &f ); + TTQTextStream ts( &f ); while ( !ts.atEnd() ) { - TQString s = ts.readLine(); - TQStringList l = TQStringList::split( " | ", s ); + TTQString s = ts.readLine(); + TTQStringList l = TTQStringList::split( " | ", s ); int id = idFromClassName( l[ 1 ] ); WidgetDatabaseRecord *r = at( id ); if ( r ) @@ -823,10 +823,10 @@ void WidgetDatabase::loadWhatsThis( const TQString &docPath ) whatsThisLoaded = true; } -QPluginManager<WidgetInterface> *widgetManager() +TTQPluginManager<WidgetInterface> *widgetManager() { if ( !widgetPluginManager ) { - widgetPluginManager = new QPluginManager<WidgetInterface>( IID_Widget, TQApplication::libraryPaths(), "/designer" ); + widgetPluginManager = new TQPluginManager<WidgetInterface>( IID_Widget, TTQApplication::libraryPaths(), "/designer" ); cleanup_manager.add( &widgetPluginManager ); } return widgetPluginManager; diff --git a/qtruby/rubylib/designer/rbuic/widgetdatabase.h b/qtruby/rubylib/designer/rbuic/widgetdatabase.h index acfe10c2..ebcfc00d 100644 --- a/qtruby/rubylib/designer/rbuic/widgetdatabase.h +++ b/qtruby/rubylib/designer/rbuic/widgetdatabase.h @@ -27,16 +27,16 @@ #include <private/qpluginmanager_p.h> -extern QPluginManager<WidgetInterface> *widgetManager(); +extern TQPluginManager<WidgetInterface> *widgetManager(); struct WidgetDatabaseRecord { WidgetDatabaseRecord(); ~WidgetDatabaseRecord(); - TQString iconSet, name, group, toolTip, whatsThis, includeFile; + TTQString iconSet, name, group, toolTip, whatsThis, includeFile; uint isContainer : 1; uint isForm : 1; - TQIconSet *icon; + TTQIconSet *icon; int nameCounter; }; @@ -50,35 +50,35 @@ public: static int count(); static int startCustom(); - static TQIconSet iconSet( int id ); - static TQString className( int id ); - static TQString group( int id ); - static TQString toolTip( int id ); - static TQString whatsThis( int id ); - static TQString includeFile( int id ); + static TTQIconSet iconSet( int id ); + static TTQString className( int id ); + static TTQString group( int id ); + static TTQString toolTip( int id ); + static TTQString whatsThis( int id ); + static TTQString includeFile( int id ); static bool isForm( int id ); static bool isContainer( int id ); - static int idFromClassName( const TQString &name ); - static TQString createWidgetName( int id ); + static int idFromClassName( const TTQString &name ); + static TTQString createWidgetName( int id ); static WidgetDatabaseRecord *at( int index ); static void insert( int index, WidgetDatabaseRecord *r ); static void append( WidgetDatabaseRecord *r ); - static TQString widgetGroup( const TQString &g ); - static TQString widgetGroup( int i ); + static TTQString widgetGroup( const TTQString &g ); + static TTQString widgetGroup( int i ); static int numWidgetGroups(); - static bool isGroupVisible( const TQString &g ); - static bool isGroupEmpty( const TQString &grp ); + static bool isGroupVisible( const TTQString &g ); + static bool isGroupEmpty( const TTQString &grp ); static int addCustomWidget( WidgetDatabaseRecord *r ); static bool isCustomWidget( int id ); static bool isWhatsThisLoaded(); - static void loadWhatsThis( const TQString &docPath ); + static void loadWhatsThis( const TTQString &docPath ); - static bool hasWidget( const TQString &name ); + static bool hasWidget( const TTQString &name ); }; diff --git a/qtruby/rubylib/designer/rbuic/widgetinterface.h b/qtruby/rubylib/designer/rbuic/widgetinterface.h index bf6bcd55..1296f162 100644 --- a/qtruby/rubylib/designer/rbuic/widgetinterface.h +++ b/qtruby/rubylib/designer/rbuic/widgetinterface.h @@ -23,7 +23,7 @@ #include <private/qwidgetinterface_p.h> -#define WidgetInterface QWidgetFactoryInterface +#define WidgetInterface TQWidgetFactoryInterface #define IID_Widget IID_QWidgetFactory #endif diff --git a/qtruby/rubylib/designer/uilib/Makefile.am b/qtruby/rubylib/designer/uilib/Makefile.am index af91f64c..04ce1c85 100644 --- a/qtruby/rubylib/designer/uilib/Makefile.am +++ b/qtruby/rubylib/designer/uilib/Makefile.am @@ -1,7 +1,7 @@ INCLUDES = -I$(top_srcdir)/smoke -I$(top_srcdir)/qtruby/rubylib/qtruby $(all_includes) -I$(RUBY_ARCHDIR) rubylibdir = $(RUBY_ARCHDIR) -rubylib_LTLIBRARIES = qui.la -qui_la_SOURCES = qui.cpp -qui_la_LDFLAGS = -module -export-dynamic $(all_libraries) -version-info 0:0:0 -qui_la_LIBADD = -lqui
\ No newline at end of file +rubylib_LTLIBRARIES = tqui.la +tqui_la_SOURCES = tqui.cpp +tqui_la_LDFLAGS = -module -export-dynamic $(all_libraries) -version-info 0:0:0 +tqui_la_LIBADD = -ltqui
\ No newline at end of file diff --git a/qtruby/rubylib/designer/uilib/extconf.rb b/qtruby/rubylib/designer/uilib/extconf.rb index fa742b9a..f1f46c00 100644 --- a/qtruby/rubylib/designer/uilib/extconf.rb +++ b/qtruby/rubylib/designer/uilib/extconf.rb @@ -1,6 +1,6 @@ -require 'mkmf' +retquire 'mkmf' dir_config('smoke') dir_config('qt') $CPPFLAGS += " -I../../../../smoke -I../../qtruby " -$LOCAL_LIBS += '-bundle_loader ../../qtruby/qtruby.bundle -lsmokeqt -lqui -lqt-mt -lstdc++' -create_makefile("qui") +$LOCAL_LIBS += '-bundle_loader ../../qtruby/qtruby.bundle -lsmokeqt -ltqui -ltqt-mt -lstdc++' +create_makefile("tqui") diff --git a/qtruby/rubylib/designer/uilib/qui.cpp b/qtruby/rubylib/designer/uilib/qui.cpp index c52a40f2..912918f6 100644 --- a/qtruby/rubylib/designer/uilib/qui.cpp +++ b/qtruby/rubylib/designer/uilib/qui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qui.cpp - A ruby wrapper for the TQWidgetFactory class + tqui.cpp - A ruby wrapper for the TTQWidgetFactory class ------------------- begin : Wed Mar 14 2004 copyright : (C) 2004 by Richard Dale @@ -41,37 +41,37 @@ extern bool isDerivedFrom(Smoke *smoke, Smoke::Index classId, Smoke::Index baseI extern "C" { extern VALUE set_obj_info(const char * className, smokeruby_object * o); -static VALUE qui_module; +static VALUE tqui_module; static VALUE qwidget_factory_class; static VALUE create(int argc, VALUE * argv, VALUE /*klass*/) { - TQWidget * topLevelWidget = 0; + TTQWidget * topLevelWidget = 0; VALUE result = Qnil; if (argc == 0 || argc > 4) { rb_raise(rb_eArgError, "wrong number of arguments (%d)\n", argc); } - TQObject * connector = 0; + TTQObject * connector = 0; if (argc >= 2) { if (TYPE(argv[1]) == T_DATA) { smokeruby_object *o = value_obj_info(argv[1]); if (o != 0) { - connector = (TQObject *) o->ptr; + connector = (TTQObject *) o->ptr; } } else { rb_raise(rb_eArgError, "invalid argument type\n"); } } - TQWidget * parent = 0; + TTQWidget * parent = 0; if (argc >= 3) { if (TYPE(argv[2]) == T_DATA) { smokeruby_object *o = value_obj_info(argv[2]); if (o != 0) { - parent = (TQWidget *) o->ptr; + parent = (TTQWidget *) o->ptr; } } else { rb_raise(rb_eArgError, "invalid argument type\n"); @@ -88,18 +88,18 @@ create(int argc, VALUE * argv, VALUE /*klass*/) } if (TYPE(argv[0]) == T_STRING) { - topLevelWidget = TQWidgetFactory::create(TQString(StringValuePtr(argv[0])), connector, parent, name); + topLevelWidget = TTQWidgetFactory::create(TTQString(StringValuePtr(argv[0])), connector, parent, name); } else if (TYPE(argv[0]) == T_DATA) { - TQIODevice * dev = 0; + TTQIODevice * dev = 0; smokeruby_object *o = value_obj_info(argv[0]); - if (o != 0 && o->ptr != 0 && o->classId == qt_Smoke->idClass("QIODevice")) { - dev = (TQIODevice *) o->ptr; + if (o != 0 && o->ptr != 0 && o->classId == qt_Smoke->idClass("TQIODevice")) { + dev = (TTQIODevice *) o->ptr; } else { rb_raise(rb_eArgError, "invalid argument type\n"); } - topLevelWidget = TQWidgetFactory::create(dev, connector, parent, name); + topLevelWidget = TTQWidgetFactory::create(dev, connector, parent, name); } else { rb_raise(rb_eArgError, "invalid argument type\n"); } @@ -121,7 +121,7 @@ create(int argc, VALUE * argv, VALUE /*klass*/) static VALUE load_images(VALUE klass, VALUE dir) { - TQWidgetFactory::loadImages(TQString(StringValuePtr(dir))); + TTQWidgetFactory::loadImages(TTQString(StringValuePtr(dir))); return klass; } @@ -129,14 +129,14 @@ static VALUE widgets(VALUE /*self*/) { VALUE result = rb_ary_new(); - TQStringList widgetList = TQWidgetFactory::widgets(); + TTQStringList widgetList = TTQWidgetFactory::widgets(); - for (TQStringList::Iterator it = widgetList.begin(); it != widgetList.end(); ++it) { - TQString widgetName = *it; + for (TTQStringList::Iterator it = widgetList.begin(); it != widgetList.end(); ++it) { + TTQString widgetName = *it; if (widgetName.startsWith("Q")) { - widgetName.replace(0, 1, TQString("Qt::")); + widgetName.replace(0, 1, TTQString("TQt::")); } else if (widgetName.startsWith("K")) { - widgetName.replace(0, 1, TQString("KDE::")); + widgetName.replace(0, 1, TTQString("KDE::")); } rb_ary_push(result, rb_str_new2(widgetName.latin1())); } @@ -147,22 +147,22 @@ widgets(VALUE /*self*/) static VALUE supports_widget(VALUE /*self*/, VALUE widget) { - TQString widgetName(StringValuePtr(widget)); + TTQString widgetName(StringValuePtr(widget)); - if (widgetName.startsWith("Qt::")) { - widgetName.replace(0, 4, TQString("Q")); + if (widgetName.startsWith("TQt::")) { + widgetName.replace(0, 4, TTQString("Q")); } else if (widgetName.startsWith("KDE::")) { - widgetName.replace(0, 5, TQString("K")); + widgetName.replace(0, 5, TTQString("K")); } - return TQWidgetFactory::supportsWidget(widgetName) ? Qtrue : Qfalse; + return TTQWidgetFactory::supportsWidget(widgetName) ? Qtrue : Qfalse; } void -Init_qui() +Init_tqui() { - qui_module = rb_define_module("QUI"); - qwidget_factory_class = rb_define_class_under(qui_module, "WidgetFactory", rb_cObject); + tqui_module = rb_define_module("TQUI"); + qwidget_factory_class = rb_define_class_under(tqui_module, "WidgetFactory", rb_cObject); rb_define_singleton_method(qwidget_factory_class, "create", (VALUE (*) (...)) create, -1); rb_define_singleton_method(qwidget_factory_class, "loadImages", (VALUE (*) (...)) load_images, 1); diff --git a/qtruby/rubylib/designer/uilib/test/test.rb b/qtruby/rubylib/designer/uilib/test/test.rb index 628f1270..06040e16 100644 --- a/qtruby/rubylib/designer/uilib/test/test.rb +++ b/qtruby/rubylib/designer/uilib/test/test.rb @@ -1,15 +1,15 @@ -require 'Qt'
-require 'qui'
+retquire 'Qt'
+retquire 'tqui'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
if ARGV.length == 0
puts "Usage: test.rb <image dir> <ui file>"
exit
end
if ARGV.length == 2
- QUI::WidgetFactory.loadImages( ARGV[ 0 ] )
- w = QUI::WidgetFactory.create( ARGV[ 1 ] )
+ TQUI::WidgetFactory.loadImages( ARGV[ 0 ] )
+ w = TQUI::WidgetFactory.create( ARGV[ 1 ] )
if w.nil?
puts "Failed to create top level widget"
exit
diff --git a/qtruby/rubylib/examples/base/kicons.rb b/qtruby/rubylib/examples/base/kicons.rb index 0d0a2c01..1922d70e 100644 --- a/qtruby/rubylib/examples/base/kicons.rb +++ b/qtruby/rubylib/examples/base/kicons.rb @@ -23,13 +23,13 @@ class KIconCollection end def get_icon_set(icon_type) path = get_icon_path(icon_type) - pixmap = Qt::Pixmap.new(path) - icon_set = Qt::IconSet.new - icon_set.setPixmap(pixmap, Qt::IconSet.Small) + pixmap = TQt::Pixmap.new(path) + icon_set = TQt::IconSet.new + icon_set.setPixmap(pixmap, TQt::IconSet.Small) icon_set end def make_qt_action(parent, text_with_accel, icon_type) - act = Qt::Action.new(parent) + act = TQt::Action.new(parent) act.setIconSet(get_icon_set(icon_type)) act.setMenuText(text_with_accel) act diff --git a/qtruby/rubylib/examples/base/rui.rb b/qtruby/rubylib/examples/base/rui.rb index ad14bc11..046bb637 100644 --- a/qtruby/rubylib/examples/base/rui.rb +++ b/qtruby/rubylib/examples/base/rui.rb @@ -1,4 +1,4 @@ -require '../base/kicons.rb' +retquire '../base/kicons.rb' RAction = Struct.new(:text_with_accel, :icon_type, :rec, :slot, :included_in, :action) RSeperator = Struct.new(:included_in, :id) diff --git a/qtruby/rubylib/examples/canvastest/canvastest.rb b/qtruby/rubylib/examples/canvastest/canvastest.rb index 4187d91d..6db6b6cf 100644 --- a/qtruby/rubylib/examples/canvastest/canvastest.rb +++ b/qtruby/rubylib/examples/canvastest/canvastest.rb @@ -1,12 +1,12 @@ #!/usr/bin/env ruby -w -require 'Qt' -require 'rexml/document' +retquire 'Qt' +retquire 'rexml/document' -require '../base/kicons.rb' -require '../base/rui.rb' +retquire '../base/kicons.rb' +retquire '../base/rui.rb' -class MyCanvasView < Qt::CanvasView +class MyCanvasView < TQt::CanvasView def initialize(canvas, parent) @canvas = canvas super(canvas, parent) @@ -16,22 +16,22 @@ class MyCanvasView < Qt::CanvasView list = canvas.collisions(e.pos) return if list.empty? c = list.first - return if c.rtti != Qt::CanvasItem::Rtti_Rectangle + return if c.rtti != TQt::CanvasItem::Rtti_Rectangle c.hide @canvas.update end end -class MyWidget < Qt::MainWindow +class MyWidget < TQt::MainWindow slots 'new()', 'open()', 'save_as()' def make_rect - rect = Qt::CanvasRectangle.new(rand(@canvas.width()), rand(@canvas.height()), + rect = TQt::CanvasRectangle.new(rand(@canvas.width()), rand(@canvas.height()), @canvas.width / 5, @canvas.width / 5, @canvas) z = rand(256) - color = Qt::Color.new(z,z,z) - rect.setBrush(Qt::Brush.new(color)) - color = Qt::Color.new(rand(32)*8, rand(32)*8, rand(32)*8) - rect.setPen(Qt::Pen.new(color, 6)) + color = TQt::Color.new(z,z,z) + rect.setBrush(TQt::Brush.new(color)) + color = TQt::Color.new(rand(32)*8, rand(32)*8, rand(32)*8) + rect.setPen(TQt::Pen.new(color, 6)) rect.setZ(z) rect.show @rects << rect @@ -39,8 +39,8 @@ class MyWidget < Qt::MainWindow def initialize() super - fileTools = Qt::ToolBar.new(self, "file operations") - fileMenu = Qt::PopupMenu.new(self) + fileTools = TQt::ToolBar.new(self, "file operations") + fileMenu = TQt::PopupMenu.new(self) actions = [ RAction.new("&New", Icons::FILE_NEW, self, SLOT('new()'), [fileTools, fileMenu]), @@ -51,10 +51,10 @@ class MyWidget < Qt::MainWindow ] build_actions(actions) - menubar = Qt::MenuBar.new(self) + menubar = TQt::MenuBar.new(self) menubar.insertItem("&File", fileMenu) - @canvas = Qt::Canvas.new(640, 480) + @canvas = TQt::Canvas.new(640, 480) @rects = [] 5.times { make_rect } @@ -65,7 +65,7 @@ class MyWidget < Qt::MainWindow end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new w.show diff --git a/qtruby/rubylib/examples/killerfilter/killerfilter.rb b/qtruby/rubylib/examples/killerfilter/killerfilter.rb index 647dc079..51f62d08 100644 --- a/qtruby/rubylib/examples/killerfilter/killerfilter.rb +++ b/qtruby/rubylib/examples/killerfilter/killerfilter.rb @@ -2,12 +2,12 @@ # This is the EventFilter example from Chapter 16 of 'Programming with Qt' -require 'Qt' +retquire 'Qt' -class KillerFilter < Qt::Object +class KillerFilter < TQt::Object def eventFilter( object, event ) - if event.type() == Qt::Event::MouseButtonPress + if event.type() == TQt::Event::MouseButtonPress if event.button() == RightButton object.close(false) return true @@ -21,29 +21,29 @@ class KillerFilter < Qt::Object end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) -toplevel = Qt::Widget.new +toplevel = TQt::Widget.new toplevel.resize(230, 130) killerfilter = KillerFilter.new -pb = Qt::PushButton.new(toplevel) +pb = TQt::PushButton.new(toplevel) pb.setGeometry( 10, 10, 100, 50 ) pb.text = "pushbutton" pb.installEventFilter(killerfilter) -le = Qt::LineEdit.new(toplevel) +le = TQt::LineEdit.new(toplevel) le.setGeometry( 10, 70, 100, 50 ) le.text = "Line edit" le.installEventFilter(killerfilter) -cb = Qt::CheckBox.new(toplevel) +cb = TQt::CheckBox.new(toplevel) cb.setGeometry( 120, 10, 100, 50 ) cb.text = "Check-box" cb.installEventFilter(killerfilter) -rb = Qt::RadioButton.new(toplevel) +rb = TQt::RadioButton.new(toplevel) rb.setGeometry( 120, 70, 100, 50 ) rb.text = "Radio button" rb.installEventFilter(killerfilter) diff --git a/qtruby/rubylib/examples/network/clientserver/client/client.rb b/qtruby/rubylib/examples/network/clientserver/client/client.rb index 1f16b0ca..04c061e7 100644 --- a/qtruby/rubylib/examples/network/clientserver/client/client.rb +++ b/qtruby/rubylib/examples/network/clientserver/client/client.rb @@ -1,23 +1,23 @@ -require 'Qt' +retquire 'Qt' -class Client < Qt::VBox +class Client < TQt::VBox def initialize( host, port ) super() # GUI layout - @infoText = Qt::TextView.new( self ) - hb = Qt::HBox.new( self ) - @inputText = Qt::LineEdit.new( hb ) - send = Qt::PushButton.new( tr("Send") , hb ) - close = Qt::PushButton.new( tr("Close connection") , self ) - quit = Qt::PushButton.new( tr("Quit") , self ) + @infoText = TQt::TextView.new( self ) + hb = TQt::HBox.new( self ) + @inputText = TQt::LineEdit.new( hb ) + send = TQt::PushButton.new( tr("Send") , hb ) + close = TQt::PushButton.new( tr("Close connection") , self ) + quit = TQt::PushButton.new( tr("Quit") , self ) connect( send, SIGNAL('clicked()'), SLOT('sendToServer()') ) connect( close, SIGNAL('clicked()'), SLOT('closeConnection()') ) connect( quit, SIGNAL('clicked()'), $qApp, SLOT('quit()') ) # create the socket and connect various of its signals - @socket = Qt::Socket.new( self ) + @socket = TQt::Socket.new( self ) connect( @socket, SIGNAL('connected()'), SLOT('socketConnected()') ) connect( @socket, SIGNAL('connectionClosed()'), @@ -39,7 +39,7 @@ class Client < Qt::VBox def closeConnection() @socket.close() - if @socket.state() == Qt::Socket::Closing + if @socket.state() == TQt::Socket::Closing # We have a delayed close. connect( @socket, SIGNAL('delayedCloseFinished()'), SLOT('socketClosed()') ) @@ -51,7 +51,7 @@ class Client < Qt::VBox def sendToServer() # write to the server - os = Qt::TextStream.new(@socket) + os = TQt::TextStream.new(@socket) os << @inputText.text() << "\n" @inputText.setText( "" ) os.dispose() @@ -81,7 +81,7 @@ class Client < Qt::VBox end end -app = Qt::Application.new( ARGV ) +app = TQt::Application.new( ARGV ) client = Client.new( ARGV.length < 1 ? "localhost" : ARGV[0], 4242 ) app.mainWidget = client client.show diff --git a/qtruby/rubylib/examples/network/clientserver/server/server.rb b/qtruby/rubylib/examples/network/clientserver/server/server.rb index d8a937f4..a8248d63 100644 --- a/qtruby/rubylib/examples/network/clientserver/server/server.rb +++ b/qtruby/rubylib/examples/network/clientserver/server/server.rb @@ -1,11 +1,11 @@ -require 'Qt' +retquire 'Qt' =begin The ClientSocket class provides a socket that is connected with a client. For every client that connects to the server, the server creates a new instance of this class. =end -class ClientSocket < Qt::Socket +class ClientSocket < TQt::Socket def initialize(sock, parent=nil, name=nil) super( parent, name ) @line = 0 @@ -16,12 +16,12 @@ class ClientSocket < Qt::Socket setSocket( sock ) end - signals 'logText(const QString&)' + signals 'logText(const TQString&)' slots 'readClient()' def readClient() - ts = Qt::TextStream.new( self ) + ts = TQt::TextStream.new( self ) while canReadLine() do str = ts.readLine() emit logText( tr("Read: '%s'\n" % str) ) @@ -43,7 +43,7 @@ end client that connects, it creates a new ClientSocket -- that instance is now responsible for the communication with that client. =end -class SimpleServer < Qt::ServerSocket +class SimpleServer < TQt::ServerSocket def initialize( parent=nil ) super( 4242, 1, parent ) if !ok() @@ -57,10 +57,10 @@ class SimpleServer < Qt::ServerSocket emit newConnect( s ) end - # The type of the argument is 'QSocket*', not + # The type of the argument is 'TQSocket*', not # 'ClientSocket*' as only types in the Smoke # library can be used for types in Signals - signals 'newConnect(QSocket*)' + signals 'newConnect(TQSocket*)' end @@ -68,7 +68,7 @@ end The ServerInfo class provides a small GUI for the server. It also creates the SimpleServer and as a result the server. =end -class ServerInfo < Qt::VBox +class ServerInfo < TQt::VBox def initialize() super @server = SimpleServer.new( self ) @@ -77,25 +77,25 @@ class ServerInfo < Qt::VBox "This is a small server example.\n" + "Connect with the client now." ) - lb = Qt::Label.new( itext, self ) + lb = TQt::Label.new( itext, self ) lb.setAlignment( AlignHCenter ) - @infoText = Qt::TextView.new( self ) - quit = Qt::PushButton.new( tr("Quit") , self ) + @infoText = TQt::TextView.new( self ) + quit = TQt::PushButton.new( tr("Quit") , self ) # See the comment above about why the 'ClientSocket*' # type cannot be used - connect( @server, SIGNAL('newConnect(QSocket*)'), - SLOT('newConnect(QSocket*)') ) + connect( @server, SIGNAL('newConnect(TQSocket*)'), + SLOT('newConnect(TQSocket*)') ) connect( quit, SIGNAL('clicked()'), $qApp, SLOT('quit()') ) end - slots 'newConnect(QSocket*)', 'connectionClosed()' + slots 'newConnect(TQSocket*)', 'connectionClosed()' def newConnect( s ) @infoText.append( tr("New connection\n") ) - connect( s, SIGNAL('logText(const QString&)'), - @infoText, SLOT('append(const QString&)') ) + connect( s, SIGNAL('logText(const TQString&)'), + @infoText, SLOT('append(const TQString&)') ) connect( s, SIGNAL('connectionClosed()'), SLOT('connectionClosed()') ) end @@ -106,7 +106,7 @@ class ServerInfo < Qt::VBox end -app = Qt::Application.new( ARGV ) +app = TQt::Application.new( ARGV ) info = ServerInfo.new app.mainWidget = info info.show diff --git a/qtruby/rubylib/examples/passivepopup/passivepopup.rb b/qtruby/rubylib/examples/passivepopup/passivepopup.rb index 37f60c1f..6041d277 100644 --- a/qtruby/rubylib/examples/passivepopup/passivepopup.rb +++ b/qtruby/rubylib/examples/passivepopup/passivepopup.rb @@ -1,38 +1,38 @@ #!/usr/bin/env ruby -require 'Qt' +retquire 'Qt' -class PassiveWindow < Qt::Frame +class PassiveWindow < TQt::Frame MARGIN = 20 def initialize(message) super(nil, "passivedlg", - Qt::WStyle_Customize | Qt::WX11BypassWM | Qt::WStyle_StaysOnTop | - Qt::WStyle_Tool | Qt::WStyle_NoBorder) + TQt::WStyle_Customize | TQt::WX11BypassWM | TQt::WStyle_StaysOnTop | + TQt::WStyle_Tool | TQt::WStyle_NoBorder) - setFrameStyle(Qt::Frame::Box| Qt::Frame::Plain) + setFrameStyle(TQt::Frame::Box| TQt::Frame::Plain) setLineWidth(2) setMinimumWidth(100) - layout=Qt::VBoxLayout.new(self, 6, 11) + layout=TQt::VBoxLayout.new(self, 6, 11) layout.setAutoAdd(true) - Qt::Label.new(message, self) + TQt::Label.new(message, self) - quit=Qt::PushButton.new(tr("Close"), self) + quit=TQt::PushButton.new(tr("Close"), self) connect(quit, SIGNAL("clicked()"), SLOT("close()")) end def show super - move(Qt::Application.desktop().width() - width() - MARGIN, - Qt::Application.desktop().height() - height() - MARGIN) + move(TQt::Application.desktop().width() - width() - MARGIN, + TQt::Application.desktop().height() - height() - MARGIN) end end if (Process.fork != nil) exit end -app = Qt::Application.new(ARGV) +app = TQt::Application.new(ARGV) win = PassiveWindow.new(ARGV[0]) app.mainWidget = win win.show diff --git a/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb b/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb index a2cdc378..721bf7b0 100644 --- a/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb +++ b/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb @@ -1,16 +1,16 @@ #!/usr/bin/env ruby -w -require 'Qt' +retquire 'Qt' -# an analog clock widget using an internal QTimer -class AnalogClock < Qt::Widget - slots 'setTime(const QTime&)', 'drawClock(QPainter*)', 'timeout()' +# an analog clock widget using an internal TQTimer +class AnalogClock < TQt::Widget + slots 'setTime(const TQTime&)', 'drawClock(TQPainter*)', 'timeout()' def initialize(*k) super(*k) - @time = Qt::Time::currentTime - @internalTimer = Qt::Timer.new(self) + @time = TQt::Time::currentTime + @internalTimer = TQt::Timer.new(self) connect(@internalTimer, SIGNAL('timeout()'), self, SLOT('timeout()')) @internalTimer.start(5000) end @@ -33,9 +33,9 @@ class AnalogClock < Qt::Widget timeout() end - # The QTimer::timeout() signal is received by this slot. + # The TQTimer::timeout() signal is received by this slot. def timeout - new_time = Qt::Time::currentTime + new_time = TQt::Time::currentTime @time = @time.addSecs 5 unless new_time.minute == @time.minute if autoMask @@ -48,7 +48,7 @@ class AnalogClock < Qt::Widget def paintEvent(blah) unless autoMask - paint = Qt::Painter.new(self) + paint = TQt::Painter.new(self) paint.setBrush(colorGroup.foreground) drawClock(paint) paint.end @@ -57,10 +57,10 @@ class AnalogClock < Qt::Widget # If clock is transparent, we use updateMask() instead of paintEvent() def updateMask - bm = Qt::Bitmap.new(size) + bm = TQt::Bitmap.new(size) bm.fill(color0) # transparent - paint = Qt::Painter.new + paint = TQt::Painter.new paint.begin(bm, self) paint.setBrush(color1) # use non-transparent color paint.setPen(color1) @@ -87,13 +87,13 @@ class AnalogClock < Qt::Widget paint.save paint.rotate(30*(@time.hour%12-3) + @time.minute/2) - pts = Qt::PointArray.new(4, [-20,0, 0,-20, 300,0, 0,20]) + pts = TQt::PointArray.new(4, [-20,0, 0,-20, 300,0, 0,20]) paint.drawConvexPolygon(pts) paint.restore paint.save paint.rotate((@time.minute-15)*6) - pts = Qt::PointArray.new(4, [-10,0, 0,-10, 400,0, 0,10]) + pts = TQt::PointArray.new(4, [-10,0, 0,-10, 400,0, 0,10]) paint.drawConvexPolygon(pts) paint.restore; @@ -107,7 +107,7 @@ class AnalogClock < Qt::Widget def setAutoMask(background) setBackgroundMode(background ? PaletteForeground : PaletteBackground) - Qt::Widget::setAutoMask(background) + TQt::Widget::setAutoMask(background) end end diff --git a/qtruby/rubylib/examples/qt-examples/aclock/main.rb b/qtruby/rubylib/examples/qt-examples/aclock/main.rb index dadbee15..1b07a91c 100755 --- a/qtruby/rubylib/examples/qt-examples/aclock/main.rb +++ b/qtruby/rubylib/examples/qt-examples/aclock/main.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby -require 'Qt' -require 'aclock' +retquire 'Qt' +retquire 'aclock' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) clock = AnalogClock.new ARGV.each {|arg| clock.setAutoMask(true) if arg == '-transparent' diff --git a/qtruby/rubylib/examples/qt-examples/chart/README b/qtruby/rubylib/examples/qt-examples/chart/README index 921437c5..b1cf673c 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/README +++ b/qtruby/rubylib/examples/qt-examples/chart/README @@ -2,7 +2,7 @@ A Complete Canvas Application This is a complete example program with a main window, menus and -toolbars. The main widget is a Qt::Canvas, and this example +toolbars. The main widget is a TQt::Canvas, and this example demonstrates basic canvas usage. This example is the subject of Qt Tutorial #2 diff --git a/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb b/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb index 8a298faa..aecb171e 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb @@ -1,5 +1,5 @@ -class CanvasText < Qt::CanvasText +class CanvasText < TQt::CanvasText CANVAS_TEXT = 1100 attr :index diff --git a/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb b/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb index 416b0de7..296d6913 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb @@ -1,4 +1,4 @@ -class CanvasView < Qt::CanvasView +class CanvasView < TQt::CanvasView def initialize(canvas, elements, parent = nil, name = "canvas view", f = 0) super(canvas, parent, name, f) @@ -7,7 +7,7 @@ class CanvasView < Qt::CanvasView end def contentsContextMenuEvent( e ) - parent().optionsMenu.exec( Qt::Cursor.pos() ) + parent().optionsMenu.exec( TQt::Cursor.pos() ) end diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform.rb index a649ce12..45d8d1ed 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/chartform.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/chartform.rb @@ -1,4 +1,4 @@ -class ChartForm < Qt::MainWindow +class ChartForm < TQt::MainWindow slots 'fileNew()', 'fileOpen()', @@ -9,7 +9,7 @@ class ChartForm < Qt::MainWindow 'filePrint()', 'fileQuit()', 'optionsSetData()', - 'updateChartType( QAction * )', + 'updateChartType( TQAction * )', 'optionsSetFont()', 'optionsSetOptions()', 'helpHelp()', @@ -37,85 +37,85 @@ class ChartForm < Qt::MainWindow def initialize( filename ) super( nil, nil, WDestructiveClose ) @filename = filename - setIcon( Qt::Pixmap.new( "images/options_piechart.xpm" ) ) + setIcon( TQt::Pixmap.new( "images/options_piechart.xpm" ) ) - fileNewAction = Qt::Action.new( - "New Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_new.xpm" )), - "&New", Qt::KeySequence.new(CTRL+Key_N), self, "new" ) + fileNewAction = TQt::Action.new( + "New Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_new.xpm" )), + "&New", TQt::KeySequence.new(CTRL+Key_N), self, "new" ) connect( fileNewAction, SIGNAL( 'activated()' ), self, SLOT( 'fileNew()' ) ) - fileOpenAction = Qt::Action.new( - "Open Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_open.xpm" )), - "&Open...", Qt::KeySequence.new(CTRL+Key_O), self, "open" ) + fileOpenAction = TQt::Action.new( + "Open Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_open.xpm" )), + "&Open...", TQt::KeySequence.new(CTRL+Key_O), self, "open" ) connect( fileOpenAction, SIGNAL( 'activated()' ), self, SLOT( 'fileOpen()' ) ) - fileSaveAction = Qt::Action.new( - "Save Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )), - "&Save", Qt::KeySequence.new(CTRL+Key_S), self, "save" ) + fileSaveAction = TQt::Action.new( + "Save Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )), + "&Save", TQt::KeySequence.new(CTRL+Key_S), self, "save" ) connect( fileSaveAction, SIGNAL( 'activated()' ), self, SLOT( 'fileSave()' ) ) - fileSaveAsAction = Qt::Action.new( - "Save Chart As", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )), - "Save &As...", Qt::KeySequence.new(0), self, "save as" ) + fileSaveAsAction = TQt::Action.new( + "Save Chart As", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )), + "Save &As...", TQt::KeySequence.new(0), self, "save as" ) connect( fileSaveAsAction, SIGNAL( 'activated()' ), self, SLOT( 'fileSaveAs()' ) ) - fileSaveAsPixmapAction = Qt::Action.new( - "Save Chart As Bitmap", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )), - "Save As &Bitmap...", Qt::KeySequence.new(CTRL+Key_B), self, "save as bitmap" ) + fileSaveAsPixmapAction = TQt::Action.new( + "Save Chart As Bitmap", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )), + "Save As &Bitmap...", TQt::KeySequence.new(CTRL+Key_B), self, "save as bitmap" ) connect( fileSaveAsPixmapAction, SIGNAL( 'activated()' ), self, SLOT( 'fileSaveAsPixmap()' ) ) - filePrintAction = Qt::Action.new( - "Print Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_print.xpm" )), - "&Print Chart...", Qt::KeySequence.new(CTRL+Key_P), self, "print chart" ) + filePrintAction = TQt::Action.new( + "Print Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_print.xpm" )), + "&Print Chart...", TQt::KeySequence.new(CTRL+Key_P), self, "print chart" ) connect( filePrintAction, SIGNAL( 'activated()' ), self, SLOT( 'filePrint()' ) ) - optionsSetDataAction = Qt::Action.new( - "Set Data", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setdata.xpm" )), - "Set &Data...", Qt::KeySequence.new(CTRL+Key_D), self, "set data" ) + optionsSetDataAction = TQt::Action.new( + "Set Data", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setdata.xpm" )), + "Set &Data...", TQt::KeySequence.new(CTRL+Key_D), self, "set data" ) connect( optionsSetDataAction, SIGNAL( 'activated()' ), self, SLOT( 'optionsSetData()' ) ) - chartGroup = Qt::ActionGroup.new( self ) # Connected later + chartGroup = TQt::ActionGroup.new( self ) # Connected later chartGroup.setExclusive( true ) - @optionsPieChartAction = Qt::Action.new( - "Pie Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_piechart.xpm" )), - "&Pie Chart", Qt::KeySequence.new(CTRL+Key_I), chartGroup, "pie chart" ) + @optionsPieChartAction = TQt::Action.new( + "Pie Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_piechart.xpm" )), + "&Pie Chart", TQt::KeySequence.new(CTRL+Key_I), chartGroup, "pie chart" ) @optionsPieChartAction.setToggleAction( true ) - @optionsHorizontalBarChartAction = Qt::Action.new( - "Horizontal Bar Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_horizontalbarchart.xpm" )), - "&Horizontal Bar Chart", Qt::KeySequence.new(CTRL+Key_H), chartGroup, + @optionsHorizontalBarChartAction = TQt::Action.new( + "Horizontal Bar Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_horizontalbarchart.xpm" )), + "&Horizontal Bar Chart", TQt::KeySequence.new(CTRL+Key_H), chartGroup, "horizontal bar chart" ) @optionsHorizontalBarChartAction.setToggleAction( true ) - @optionsVerticalBarChartAction = Qt::Action.new( - "Vertical Bar Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_verticalbarchart.xpm" )), - "&Vertical Bar Chart", Qt::KeySequence.new(CTRL+Key_V), chartGroup, "Vertical bar chart" ) + @optionsVerticalBarChartAction = TQt::Action.new( + "Vertical Bar Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_verticalbarchart.xpm" )), + "&Vertical Bar Chart", TQt::KeySequence.new(CTRL+Key_V), chartGroup, "Vertical bar chart" ) @optionsVerticalBarChartAction.setToggleAction( true ) - optionsSetFontAction = Qt::Action.new( - "Set Font", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setfont.xpm" )), - "Set &Font...", Qt::KeySequence.new(CTRL+Key_F), self, "set font" ) + optionsSetFontAction = TQt::Action.new( + "Set Font", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setfont.xpm" )), + "Set &Font...", TQt::KeySequence.new(CTRL+Key_F), self, "set font" ) connect( optionsSetFontAction, SIGNAL( 'activated()' ), self, SLOT( 'optionsSetFont()' ) ) - optionsSetOptionsAction = Qt::Action.new( - "Set Options", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setoptions.xpm" )), - "Set &Options...", Qt::KeySequence.new(0), self, "set options" ) + optionsSetOptionsAction = TQt::Action.new( + "Set Options", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setoptions.xpm" )), + "Set &Options...", TQt::KeySequence.new(0), self, "set options" ) connect( optionsSetOptionsAction, SIGNAL( 'activated()' ), self, SLOT( 'optionsSetOptions()' ) ) - fileQuitAction = Qt::Action.new( "Quit", "&Quit", Qt::KeySequence.new(CTRL+Key_Q), self, "quit" ) + fileQuitAction = TQt::Action.new( "Quit", "&Quit", TQt::KeySequence.new(CTRL+Key_Q), self, "quit" ) connect( fileQuitAction, SIGNAL( 'activated()' ), self, SLOT( 'fileQuit()' ) ) - fileTools = Qt::ToolBar.new( self, "file operations" ) + fileTools = TQt::ToolBar.new( self, "file operations" ) fileTools.setLabel( "File Operations" ) fileNewAction.addTo( fileTools ) fileOpenAction.addTo( fileTools ) @@ -123,7 +123,7 @@ class ChartForm < Qt::MainWindow fileTools.addSeparator() filePrintAction.addTo( fileTools ) - optionsTools = Qt::ToolBar.new( self, "options operations" ) + optionsTools = TQt::ToolBar.new( self, "options operations" ) optionsTools.setLabel( "Options Operations" ) optionsSetDataAction.addTo( optionsTools ) optionsTools.addSeparator() @@ -135,7 +135,7 @@ class ChartForm < Qt::MainWindow optionsTools.addSeparator() optionsSetOptionsAction.addTo( optionsTools ) - @fileMenu = Qt::PopupMenu.new( self ) + @fileMenu = TQt::PopupMenu.new( self ) menuBar().insertItem( "&File", @fileMenu ) fileNewAction.addTo( @fileMenu ) fileOpenAction.addTo( @fileMenu ) @@ -148,7 +148,7 @@ class ChartForm < Qt::MainWindow @fileMenu.insertSeparator() fileQuitAction.addTo( @fileMenu ) - @optionsMenu = Qt::PopupMenu.new( self ) + @optionsMenu = TQt::PopupMenu.new( self ) menuBar().insertItem( "&Options", @optionsMenu ) optionsSetDataAction.addTo( @optionsMenu ) @optionsMenu.insertSeparator() @@ -162,9 +162,9 @@ class ChartForm < Qt::MainWindow menuBar().insertSeparator() - helpMenu = Qt::PopupMenu.new( self ) + helpMenu = TQt::PopupMenu.new( self ) menuBar().insertItem( "&Help", helpMenu ) - helpMenu.insertItem( "&Help", self, SLOT('helpHelp()'), Qt::KeySequence.new(Key_F1) ) + helpMenu.insertItem( "&Help", self, SLOT('helpHelp()'), TQt::KeySequence.new(Key_F1) ) helpMenu.insertItem( "&About", self, SLOT('helpAbout()') ) helpMenu.insertItem( "About &Qt", self, SLOT('helpAboutQt()') ) @@ -172,8 +172,8 @@ class ChartForm < Qt::MainWindow @printer = nil @elements = Array.new(MAX_ELEMENTS) - settings = Qt::Settings.new - settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY ) + settings = TQt::Settings.new + settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY ) windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 460 ) windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 530 ) windowX = settings.readNumEntry( APP_KEY + "WindowX", -1 ) @@ -181,7 +181,7 @@ class ChartForm < Qt::MainWindow setChartType( settings.readNumEntry( APP_KEY + "ChartType", PIE ) ) @addValues = settings.readNumEntry( APP_KEY + "AddValues", NO ) @decimalPlaces = settings.readNumEntry( APP_KEY + "Decimals", 2 ) - @font = Qt::Font.new( "Helvetica", 18, Qt::Font::Bold ) + @font = TQt::Font.new( "Helvetica", 18, TQt::Font::Bold ) @font.fromString( settings.readEntry( APP_KEY + "Font", @font.toString() ) ) @recentFiles = [] @@ -198,15 +198,15 @@ class ChartForm < Qt::MainWindow # Connect *after* we've set the chart type on so we don't call # drawElements() prematurely. - connect( chartGroup, SIGNAL( 'selected(QAction*)' ), - self, SLOT( 'updateChartType(QAction*)' ) ) + connect( chartGroup, SIGNAL( 'selected(TQAction*)' ), + self, SLOT( 'updateChartType(TQAction*)' ) ) resize( windowWidth, windowHeight ) if windowX != -1 || windowY != -1 move( windowX, windowY ) end - @canvas = Qt::Canvas.new( self ) + @canvas = TQt::Canvas.new( self ) @canvas.resize( width(), height() ) @canvasView = CanvasView.new( @canvas, @elements, self ) setCentralWidget( @canvasView ) @@ -250,7 +250,7 @@ class ChartForm < Qt::MainWindow x = (i.to_f / MAX_ELEMENTS) * 360 y = ((x * 256) % 105) + 151 z = ((i * 17) % 105) + 151; - @elements[i] = Element.new( Element::INVALID, Qt::Color.new( x, y, z, Qt::Color::Hsv ) ) + @elements[i] = Element.new( Element::INVALID, TQt::Color.new( x, y, z, TQt::Color::Hsv ) ) end end @@ -272,7 +272,7 @@ class ChartForm < Qt::MainWindow return end - filename = Qt::FileDialog.getOpenFileName( + filename = TQt::FileDialog.getOpenFileName( nil, "Charts (*.cht)", self, "file open", "Chart -- File Open" ) if !filename.nil? @@ -284,13 +284,13 @@ class ChartForm < Qt::MainWindow def fileSaveAs() - filename = Qt::FileDialog.getSaveFileName( + filename = TQt::FileDialog.getSaveFileName( nil, "Charts (*.cht)", self, "file save as", "Chart -- File Save As" ) if !filename.nil? answer = 0 - if Qt::File.exists( filename ) - answer = Qt::MessageBox.warning( + if TQt::File.exists( filename ) + answer = TQt::MessageBox.warning( self, "Chart -- Overwrite File", "Overwrite\n\'#{filename}\'?", "&Yes", "&No", nil, 1, 1 ) @@ -337,7 +337,7 @@ class ChartForm < Qt::MainWindow if i < @recentFiles.length() @fileMenu.insertItem( "&%d %s" % [i + 1, @recentFiles[i]], self, SLOT( 'fileOpenRecent(int)' ), - Qt::KeySequence.new(0), i ) + TQt::KeySequence.new(0), i ) end end end @@ -360,7 +360,7 @@ class ChartForm < Qt::MainWindow end msg += "has been changed." - x = Qt::MessageBox.information( self, "Chart -- Unsaved Changes", + x = TQt::MessageBox.information( self, "Chart -- Unsaved Changes", msg, "&Save", "Cancel", "&Abandon", 0, 1 ) case x @@ -377,8 +377,8 @@ class ChartForm < Qt::MainWindow def saveOptions() - settings = Qt::Settings.new - settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY ) + settings = TQt::Settings.new + settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY ) settings.writeEntry( APP_KEY + "WindowWidth", width() ) settings.writeEntry( APP_KEY + "WindowHeight", height() ) settings.writeEntry( APP_KEY + "WindowX", x() ) @@ -430,8 +430,8 @@ class ChartForm < Qt::MainWindow def optionsSetFont() - ok = Qt::Boolean.new - font = Qt::FontDialog.getFont( ok, @font, self ) + ok = TQt::Boolean.new + font = TQt::FontDialog.getFont( ok, @font, self ) if !ok.nil? @font = font drawElements() @@ -474,14 +474,14 @@ class ChartForm < Qt::MainWindow def helpAbout() - Qt::MessageBox.about( self, "Chart -- About", + TQt::MessageBox.about( self, "Chart -- About", "<center><h1><font color=blue>Chart<font></h1></center>" + "<p>Chart your data with <i>chart</i>.</p>" ) end def helpAboutQt() - Qt::MessageBox.aboutQt( self, "Chart -- About Qt" ) + TQt::MessageBox.aboutQt( self, "Chart -- About Qt" ) end end diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb index 86c66f76..e97d542f 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb @@ -64,11 +64,11 @@ class ChartForm for i in 0...MAX_ELEMENTS if @elements[i].isValid() extent = scales[i] - arc = Qt::CanvasEllipse.new( size, size, angle, extent, @canvas ) + arc = TQt::CanvasEllipse.new( size, size, angle, extent, @canvas ) arc.setX( x ) arc.setY( y ) arc.setZ( 0 ) - arc.setBrush( Qt::Brush.new( @elements[i].valueColor(), + arc.setBrush( TQt::Brush.new( @elements[i].valueColor(), @elements[i].valuePattern() ) ) arc.show() angle += extent @@ -109,15 +109,15 @@ class ChartForm height = @canvas.height().to_f prowidth = width / count x = 0 - pen = Qt::Pen.new + pen = TQt::Pen.new pen.style = NoPen for i in 0...MAX_ELEMENTS if @elements[i].isValid() extent = scales[i] y = height - extent - rect = Qt::CanvasRectangle.new(x, y, prowidth, extent, @canvas ) - rect.setBrush( Qt::Brush.new( @elements[i].valueColor(), + rect = TQt::CanvasRectangle.new(x, y, prowidth, extent, @canvas ) + rect.setBrush( TQt::Brush.new( @elements[i].valueColor(), @elements[i].valuePattern() ) ) rect.setPen( pen ) rect.setZ( 0 ) @@ -151,14 +151,14 @@ class ChartForm height = @canvas.height().to_f proheight = height / count y = 0 - pen = Qt::Pen.new + pen = TQt::Pen.new pen.style = NoPen for i in 0...MAX_ELEMENTS if @elements[i].isValid() extent = scales[i] - rect = Qt::CanvasRectangle.new(0, y, extent, proheight, @canvas ) - rect.setBrush( Qt::Brush.new( @elements[i].valueColor(), + rect = TQt::CanvasRectangle.new(0, y, extent, proheight, @canvas ) + rect.setBrush( TQt::Brush.new( @elements[i].valueColor(), @elements[i].valuePattern() ) ) rect.setPen( pen ) rect.setZ( 0 ) diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb index 648aba62..3063bb07 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb @@ -1,15 +1,15 @@ class ChartForm def load( filename ) - file = Qt::File.new( filename ) - if !file.open( Qt::IO_ReadOnly ) + file = TQt::File.new( filename ) + if !file.open( TQt::IO_ReadOnly ) statusBar().message( "Failed to load \'%s\'" % filename, 2000 ) return end init() # Make sure we have colours @filename = filename - ts = Qt::TextStream.new( file ) + ts = TQt::TextStream.new( file ) errors = 0 i = 0 while !ts.eof() @@ -52,12 +52,12 @@ class ChartForm return end - file = Qt::File.new( @filename ) - if !file.open( Qt::IO_WriteOnly ) + file = TQt::File.new( @filename ) + if !file.open( TQt::IO_WriteOnly ) statusBar().message( "Failed to save \'%s\'" % @filename, 2000 ) return end - ts = Qt::TextStream.new( file ) + ts = TQt::TextStream.new( file ) for i in 0...MAX_ELEMENTS if @elements[i].isValid() ts << @elements[i] @@ -73,10 +73,10 @@ class ChartForm def fileSaveAsPixmap() - filename = Qt::FileDialog.getSaveFileName(nil, "Images (*.png *.xpm *.jpg)", + filename = TQt::FileDialog.getSaveFileName(nil, "Images (*.png *.xpm *.jpg)", self, "file save as bitmap", "Chart -- File Save As Bitmap" ) - if Qt::Pixmap.grabWidget( @canvasView ).save( filename, + if TQt::Pixmap.grabWidget( @canvasView ).save( filename, filename.sub(/.*\.([^.]*)$/, '\1').upcase() ) statusBar().message( "Wrote \'%s\'" % filename, 2000 ) else @@ -86,11 +86,11 @@ class ChartForm def filePrint() if !@printer - @printer = Qt::Printer.new + @printer = TQt::Printer.new end if @printer.setup() - painter = Qt::Painter.new( @printer ) - @canvas.drawArea( Qt::Rect.new( 0, 0, @canvas.width(), @canvas.height() ), + painter = TQt::Painter.new( @printer ) + @canvas.drawArea( TQt::Rect.new( 0, 0, @canvas.width(), @canvas.height() ), painter, false ) if !@printer.outputFileName().empty? statusBar().message( "Printed \'%s\'" % @printer.outputFileName(), 2000 ) diff --git a/qtruby/rubylib/examples/qt-examples/chart/element.rb b/qtruby/rubylib/examples/qt-examples/chart/element.rb index ba135632..bc6c0d51 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/element.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/element.rb @@ -12,10 +12,10 @@ class Element attr_accessor :value, :valueColor, :valuePattern, :label, :labelColor - def initialize( value = INVALID, valueColor = Qt::gray, - valuePattern = Qt::SolidPattern, + def initialize( value = INVALID, valueColor = TQt::gray, + valuePattern = TQt::SolidPattern, label = nil, - labelColor = Qt::black ) + labelColor = TQt::black ) init( value, valueColor, valuePattern, label, labelColor ) @propoints = [] for i in 0...MAX_PROPOINTS * 2 @@ -30,24 +30,24 @@ class Element label, labelColor ) @value = value @valueColor = valueColor - if Qt::SolidPattern >= valuePattern || Qt::DiagCrossPattern <= valuePattern - valuePattern = Qt::SolidPattern + if TQt::SolidPattern >= valuePattern || TQt::DiagCrossPattern <= valuePattern + valuePattern = TQt::SolidPattern end @valuePattern = valuePattern @label = label @labelColor = labelColor end - def set( value = INVALID, valueColor = Qt::gray, - valuePattern = Qt::SolidPattern, + def set( value = INVALID, valueColor = TQt::gray, + valuePattern = TQt::SolidPattern, label = nil, - labelColor = Qt::black ) + labelColor = TQt::black ) init( value, valueColor, valuePattern, label, labelColor ) end def setValuePattern( valuePattern ) - if valuePattern < Qt::SolidPattern.to_i || valuePattern > Qt::DiagCrossPattern.to_i - valuePattern = Qt::SolidPattern + if valuePattern < TQt::SolidPattern.to_i || valuePattern > TQt::DiagCrossPattern.to_i + valuePattern = TQt::SolidPattern end @valuePattern = valuePattern end @@ -74,7 +74,7 @@ class Element end -class Qt::TextStream +class TQt::TextStream alias op_write << @@ -117,7 +117,7 @@ class Qt::TextStream if value.nil? errors += 1 end - valueColor = Qt::Color.new( fields[1] ) + valueColor = TQt::Color.new( fields[1] ) if !valueColor.isValid() errors += 1 end @@ -125,7 +125,7 @@ class Qt::TextStream if valuePattern.nil? errors += 1 end - labelColor = Qt::Color.new( fields[3] ) + labelColor = TQt::Color.new( fields[3] ) if !labelColor.isValid() errors += 1 end diff --git a/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk b/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk index d9087b48..89d6ff9f 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk +++ b/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk @@ -84,7 +84,7 @@ le() lw(1) Fn('Helvetica-Narrow-Bold') Fs(18) -txt('QCanvas',(580.906,-614.774)) +txt('TQCanvas',(580.906,-614.774)) G_() lw(1.41732) la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) diff --git a/qtruby/rubylib/examples/qt-examples/chart/main.rb b/qtruby/rubylib/examples/qt-examples/chart/main.rb index db395a3e..4c5c9a91 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/main.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/main.rb @@ -1,15 +1,15 @@ -require 'Qt' +retquire 'Qt' -require 'canvasview.rb' -require 'canvastext.rb' -require 'element.rb' -require 'chartform.rb' -require 'chartform_canvas.rb' -require 'chartform_files.rb' -require 'optionsform.rb' -require 'setdataform.rb' +retquire 'canvasview.rb' +retquire 'canvastext.rb' +retquire 'element.rb' +retquire 'chartform.rb' +retquire 'chartform_canvas.rb' +retquire 'chartform_files.rb' +retquire 'optionsform.rb' +retquire 'setdataform.rb' -app = Qt::Application.new( ARGV ) +app = TQt::Application.new( ARGV ) if app.ARGV.length > 0 filename = app.ARGV[0] diff --git a/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb b/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb index 6b2eeac4..35c2aea8 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb @@ -1,4 +1,4 @@ -class OptionsForm < Qt::Dialog +class OptionsForm < TQt::Dialog slots 'chooseFont()' attr_reader :chartTypeComboBox, @@ -14,65 +14,65 @@ class OptionsForm < Qt::Dialog setCaption( "Chart -- Options" ) resize( 320, 290 ) - @optionsFormLayout = Qt::VBoxLayout.new( self, 11, 6 ) + @optionsFormLayout = TQt::VBoxLayout.new( self, 11, 6 ) - @chartTypeLayout = Qt::HBoxLayout.new( nil, 0, 6 ) + @chartTypeLayout = TQt::HBoxLayout.new( nil, 0, 6 ) - @chartTypeTextLabel = Qt::Label.new( "&Chart Type", self ) + @chartTypeTextLabel = TQt::Label.new( "&Chart Type", self ) @chartTypeLayout.addWidget( @chartTypeTextLabel ) - @chartTypeComboBox = Qt::ComboBox.new( false, self ) - @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_piechart.xpm" ), "Pie Chart" ) - @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_verticalbarchart.xpm" ), + @chartTypeComboBox = TQt::ComboBox.new( false, self ) + @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_piechart.xpm" ), "Pie Chart" ) + @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_verticalbarchart.xpm" ), "Vertical Bar Chart" ) - @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_horizontalbarchart.xpm" ), + @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_horizontalbarchart.xpm" ), "Horizontal Bar Chart" ) @chartTypeLayout.addWidget( @chartTypeComboBox ) @optionsFormLayout.addLayout( @chartTypeLayout ) - @fontLayout = Qt::HBoxLayout.new( nil, 0, 6 ) + @fontLayout = TQt::HBoxLayout.new( nil, 0, 6 ) - @fontPushButton = Qt::PushButton.new( "&Font...", self ) + @fontPushButton = TQt::PushButton.new( "&Font...", self ) @fontLayout.addWidget( @fontPushButton ) - @spacer = Qt::SpacerItem.new( 0, 0, Qt::SizePolicy::Expanding, - Qt::SizePolicy::Minimum ) + @spacer = TQt::SpacerItem.new( 0, 0, TQt::SizePolicy::Expanding, + TQt::SizePolicy::Minimum ) @fontLayout.addItem( @spacer ) - @fontTextLabel = Qt::Label.new( self ) # Must be set by caller via setFont() + @fontTextLabel = TQt::Label.new( self ) # Must be set by caller via setFont() @fontLayout.addWidget( @fontTextLabel ) @optionsFormLayout.addLayout( @fontLayout ) - @addValuesFrame = Qt::Frame.new( self ) - @addValuesFrame.setFrameShape( Qt::Frame::StyledPanel ) - @addValuesFrame.setFrameShadow( Qt::Frame::Sunken ) - @addValuesFrameLayout = Qt::VBoxLayout.new( @addValuesFrame, 11, 6 ) + @addValuesFrame = TQt::Frame.new( self ) + @addValuesFrame.setFrameShape( TQt::Frame::StyledPanel ) + @addValuesFrame.setFrameShadow( TQt::Frame::Sunken ) + @addValuesFrameLayout = TQt::VBoxLayout.new( @addValuesFrame, 11, 6 ) - @addValuesButtonGroup = Qt::ButtonGroup.new( "Show Values", @addValuesFrame ) - @addValuesButtonGroup.setColumnLayout(0, Qt::Vertical ) + @addValuesButtonGroup = TQt::ButtonGroup.new( "Show Values", @addValuesFrame ) + @addValuesButtonGroup.setColumnLayout(0, TQt::Vertical ) @addValuesButtonGroup.layout().setSpacing( 6 ) @addValuesButtonGroup.layout().setMargin( 11 ) - @addValuesButtonGroupLayout = Qt::VBoxLayout.new( + @addValuesButtonGroupLayout = TQt::VBoxLayout.new( @addValuesButtonGroup.layout() ) - @addValuesButtonGroupLayout.setAlignment( Qt::AlignTop ) + @addValuesButtonGroupLayout.setAlignment( TQt::AlignTop ) - @noRadioButton = Qt::RadioButton.new( "&No", @addValuesButtonGroup ) + @noRadioButton = TQt::RadioButton.new( "&No", @addValuesButtonGroup ) @noRadioButton.setChecked( true ) @addValuesButtonGroupLayout.addWidget( @noRadioButton ) - @yesRadioButton = Qt::RadioButton.new( "&Yes", @addValuesButtonGroup ) + @yesRadioButton = TQt::RadioButton.new( "&Yes", @addValuesButtonGroup ) @addValuesButtonGroupLayout.addWidget( @yesRadioButton ) - @asPercentageRadioButton = Qt::RadioButton.new( "As &Percentage", + @asPercentageRadioButton = TQt::RadioButton.new( "As &Percentage", @addValuesButtonGroup ) @addValuesButtonGroupLayout.addWidget( @asPercentageRadioButton ) @addValuesFrameLayout.addWidget( @addValuesButtonGroup ) - @decimalPlacesLayout = Qt::HBoxLayout.new( nil, 0, 6 ) + @decimalPlacesLayout = TQt::HBoxLayout.new( nil, 0, 6 ) - @decimalPlacesTextLabel = Qt::Label.new( "&Decimal Places", @addValuesFrame ) + @decimalPlacesTextLabel = TQt::Label.new( "&Decimal Places", @addValuesFrame ) @decimalPlacesLayout.addWidget( @decimalPlacesTextLabel ) - @decimalPlacesSpinBox = Qt::SpinBox.new( @addValuesFrame ) + @decimalPlacesSpinBox = TQt::SpinBox.new( @addValuesFrame ) @decimalPlacesSpinBox.setMinValue( 0 ) @decimalPlacesSpinBox.setMaxValue( 9 ) @decimalPlacesLayout.addWidget( @decimalPlacesSpinBox ) @@ -81,16 +81,16 @@ class OptionsForm < Qt::Dialog @optionsFormLayout.addWidget( @addValuesFrame ) - @buttonsLayout = Qt::HBoxLayout.new( nil, 0, 6 ) - @spacer = Qt::SpacerItem.new( 0, 0, - Qt::SizePolicy::Expanding, Qt::SizePolicy::Minimum ) + @buttonsLayout = TQt::HBoxLayout.new( nil, 0, 6 ) + @spacer = TQt::SpacerItem.new( 0, 0, + TQt::SizePolicy::Expanding, TQt::SizePolicy::Minimum ) @buttonsLayout.addItem( @spacer ) - @okPushButton = Qt::PushButton.new( "OK", self ) + @okPushButton = TQt::PushButton.new( "OK", self ) @okPushButton.setDefault( true ) @buttonsLayout.addWidget( @okPushButton ) - @cancelPushButton = Qt::PushButton.new( "Cancel", self ) + @cancelPushButton = TQt::PushButton.new( "Cancel", self ) @buttonsLayout.addWidget( @cancelPushButton ) @optionsFormLayout.addLayout( @buttonsLayout ) @@ -104,8 +104,8 @@ class OptionsForm < Qt::Dialog def chooseFont() - ok = Qt::Boolean.new - font = Qt::FontDialog.getFont( ok, @font, self ) + ok = TQt::Boolean.new + font = TQt::FontDialog.getFont( ok, @font, self ) if !ok.nil? setFont( font ) end diff --git a/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb b/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb index 81a9403b..3f361061 100644 --- a/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb +++ b/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb @@ -1,4 +1,4 @@ -class SetDataForm < Qt::Dialog +class SetDataForm < TQt::Dialog slots 'setColor()', 'setChosenColor( int, int )', @@ -20,9 +20,9 @@ class SetDataForm < Qt::Dialog setCaption( "Chart -- Set Data" ) resize( 540, 440 ) - @tableButtonBox = Qt::VBoxLayout.new( self, 11, 6, "@table button box layout" ) + @tableButtonBox = TQt::VBoxLayout.new( self, 11, 6, "@table button box layout" ) - @table = Qt::Table.new( self, "data @table" ) + @table = TQt::Table.new( self, "data @table" ) @table.setNumCols( 5 ) @table.setNumRows( ChartForm::MAX_ELEMENTS ) @table.setColumnReadOnly( 1, true ) @@ -41,30 +41,30 @@ class SetDataForm < Qt::Dialog th.setLabel( 4, "Color" ) @tableButtonBox.addWidget( @table ) - @buttonBox = Qt::HBoxLayout.new( nil, 0, 6, "button box layout" ) + @buttonBox = TQt::HBoxLayout.new( nil, 0, 6, "button box layout" ) - @colorPushButton = Qt::PushButton.new( self, "color button" ) + @colorPushButton = TQt::PushButton.new( self, "color button" ) @colorPushButton.setText( "&Color..." ) @colorPushButton .setEnabled( false ) @buttonBox.addWidget( @colorPushButton ) - spacer = Qt::SpacerItem.new( 0, 0, Qt::SizePolicy::Expanding, - Qt::SizePolicy::Minimum ) + spacer = TQt::SpacerItem.new( 0, 0, TQt::SizePolicy::Expanding, + TQt::SizePolicy::Minimum ) @buttonBox.addItem( spacer ) - okPushButton = Qt::PushButton.new( self, "ok button" ) + okPushButton = TQt::PushButton.new( self, "ok button" ) okPushButton.setText( "OK" ) okPushButton.setDefault( true ) @buttonBox.addWidget( okPushButton ) - cancelPushButton = Qt::PushButton.new( self, "cancel button" ) + cancelPushButton = TQt::PushButton.new( self, "cancel button" ) cancelPushButton.setText( "Cancel" ) - cancelPushButton.setAccel( Qt::KeySequence.new(Key_Escape) ) + cancelPushButton.setAccel( TQt::KeySequence.new(Key_Escape) ) @buttonBox.addWidget( cancelPushButton ) @tableButtonBox.addLayout( @buttonBox ) - connect( @table, SIGNAL( 'clicked(int,int,int,const QPoint&)' ), + connect( @table, SIGNAL( 'clicked(int,int,int,const TQPoint&)' ), self, SLOT( 'setChosenColor(int,int)' ) ) connect( @table, SIGNAL( 'currentChanged(int,int)' ), self, SLOT( 'currentChanged(int,int)' ) ) @@ -75,23 +75,23 @@ class SetDataForm < Qt::Dialog connect( cancelPushButton, SIGNAL( 'clicked()' ), self, SLOT( 'reject()' ) ) patterns = Array.new(MAX_PATTERNS) - patterns[0] = Qt::Pixmap.new( "images/pattern01.xpm" ) - patterns[1] = Qt::Pixmap.new( "images/pattern02.xpm" ) - patterns[2] = Qt::Pixmap.new( "images/pattern03.xpm" ) - patterns[3] = Qt::Pixmap.new( "images/pattern04.xpm" ) - patterns[4] = Qt::Pixmap.new( "images/pattern05.xpm" ) - patterns[5] = Qt::Pixmap.new( "images/pattern06.xpm" ) - patterns[6] = Qt::Pixmap.new( "images/pattern07.xpm" ) - patterns[7] = Qt::Pixmap.new( "images/pattern08.xpm" ) - patterns[8] = Qt::Pixmap.new( "images/pattern09.xpm" ) - patterns[9] = Qt::Pixmap.new( "images/pattern10.xpm" ) - patterns[10] = Qt::Pixmap.new( "images/pattern11.xpm" ) - patterns[11] = Qt::Pixmap.new( "images/pattern12.xpm" ) - patterns[12] = Qt::Pixmap.new( "images/pattern13.xpm" ) - patterns[13] = Qt::Pixmap.new( "images/pattern14.xpm" ) + patterns[0] = TQt::Pixmap.new( "images/pattern01.xpm" ) + patterns[1] = TQt::Pixmap.new( "images/pattern02.xpm" ) + patterns[2] = TQt::Pixmap.new( "images/pattern03.xpm" ) + patterns[3] = TQt::Pixmap.new( "images/pattern04.xpm" ) + patterns[4] = TQt::Pixmap.new( "images/pattern05.xpm" ) + patterns[5] = TQt::Pixmap.new( "images/pattern06.xpm" ) + patterns[6] = TQt::Pixmap.new( "images/pattern07.xpm" ) + patterns[7] = TQt::Pixmap.new( "images/pattern08.xpm" ) + patterns[8] = TQt::Pixmap.new( "images/pattern09.xpm" ) + patterns[9] = TQt::Pixmap.new( "images/pattern10.xpm" ) + patterns[10] = TQt::Pixmap.new( "images/pattern11.xpm" ) + patterns[11] = TQt::Pixmap.new( "images/pattern12.xpm" ) + patterns[12] = TQt::Pixmap.new( "images/pattern13.xpm" ) + patterns[13] = TQt::Pixmap.new( "images/pattern14.xpm" ) rect = @table.cellRect( 0, 1 ) - pix = Qt::Pixmap.new( rect.width(), rect.height() ) + pix = TQt::Pixmap.new( rect.width(), rect.height() ) for i in 0...ChartForm::MAX_ELEMENTS element = @elements[i] @@ -105,7 +105,7 @@ class SetDataForm < Qt::Dialog @table.setPixmap( i, 1, pix ) @table.setText( i, 1, color.name() ) - combobox = Qt::ComboBox.new + combobox = TQt::ComboBox.new for j in 0...MAX_PATTERNS combobox.insertItem( patterns[j] ) end @@ -151,8 +151,8 @@ class SetDataForm < Qt::Dialog return end - color = Qt::ColorDialog.getColor( - Qt::Color.new( @table.text( row, col ) ), + color = TQt::ColorDialog.getColor( + TQt::Color.new( @table.text( row, col ) ), self, "color dialog" ) if color.isValid() pix = @table.pixmap( row, col ) @@ -172,10 +172,10 @@ class SetDataForm < Qt::Dialog else element.value = Element::INVALID end - element.valueColor = Qt::Color.new( @table.text( i, 1 ) ) + element.valueColor = TQt::Color.new( @table.text( i, 1 ) ) element.valuePattern = (@table.cellWidget( i, 2 )).currentItem() + 1 element.label = @table.text( i, 3 ) - element.labelColor = Qt::Color.new( @table.text( i, 4 ) ) + element.labelColor = TQt::Color.new( @table.text( i, 4 ) ) end super diff --git a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb index 8f67d9aa..3912c61b 100644 --- a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb +++ b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class CheckLists < Qt::Widget +class CheckLists < TQt::Widget slots 'copy1to2()', 'copy2to3()' # Constructor @@ -9,18 +9,18 @@ class CheckLists < Qt::Widget def initialize super() - lay = Qt::HBoxLayout.new(self) + lay = TQt::HBoxLayout.new(self) lay.setMargin(5) # create a widget which layouts its childs in a column - vbox1 = Qt::VBoxLayout.new(lay) + vbox1 = TQt::VBoxLayout.new(lay) vbox1.setMargin(5) # First child: a Label - vbox1.addWidget(Qt::Label.new('Check some items!', self)) + vbox1.addWidget(TQt::Label.new('Check some items!', self)) # Second child: the ListView - @lv1 = Qt::ListView.new(self) + @lv1 = TQt::ListView.new(self) vbox1.addWidget(@lv1) @lv1.addColumn('Items') @lv1.setRootIsDecorated(true) @@ -29,10 +29,10 @@ class CheckLists < Qt::Widget parentList = Array.new - parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 1')) - parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 2')) - parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 3')) - parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 4')) + parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 1')) + parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 2')) + parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 3')) + parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 4')) item = 0 num = 1 @@ -42,51 +42,51 @@ class CheckLists < Qt::Widget # ...and create 5 checkable child ListViewItems for each parent item for i in 1..5 str = sprintf('%s. Child of Parent %s', i, num) - Qt::CheckListItem.new(item, str, Qt::CheckListItem.CheckBox) + TQt::CheckListItem.new(item, str, TQt::CheckListItem.CheckBox) end num = num + 1 } # Create another widget for layouting - tmp = Qt::VBoxLayout.new(lay) + tmp = TQt::VBoxLayout.new(lay) tmp.setMargin(5) # create a pushbutton - copy1 = Qt::PushButton.new(' -> ', self) + copy1 = TQt::PushButton.new(' -> ', self) tmp.addWidget(copy1) copy1.setMaximumWidth(copy1.sizeHint.width) # connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2() connect(copy1, SIGNAL('clicked()'), self, SLOT('copy1to2()')) # another widget for layouting - vbox2 = Qt::VBoxLayout.new(lay) + vbox2 = TQt::VBoxLayout.new(lay) vbox2.setMargin(5) # and another label - vbox2.addWidget(Qt::Label.new('Check one item!', self)) + vbox2.addWidget(TQt::Label.new('Check one item!', self)) # create the second listview - @lv2 = Qt::ListView.new(self) + @lv2 = TQt::ListView.new(self) vbox2.addWidget(@lv2) @lv2.addColumn('Items') @lv2.setRootIsDecorated(true) # another widget needed for layouting only - tmp = Qt::VBoxLayout.new(lay) + tmp = TQt::VBoxLayout.new(lay) tmp.setMargin(5) # create another pushbutton... - copy2 = Qt::PushButton.new(' -> ', self) + copy2 = TQt::PushButton.new(' -> ', self) lay.addWidget( copy2 ) copy2.setMaximumWidth(copy2.sizeHint.width) # ...and connect its clicked() SIGNAL to the copy2to3() SLOT connect(copy2, SIGNAL('clicked()'), self, SLOT('copy2to3()')) - tmp = Qt::VBoxLayout.new(lay) + tmp = TQt::VBoxLayout.new(lay) tmp.setMargin(5) # and create a label which will be at the right of the window - @label = Qt::Label.new('No Item yet...', self) + @label = TQt::Label.new('No Item yet...', self) tmp.addWidget(@label) end @@ -96,10 +96,10 @@ class CheckLists < Qt::Widget # the second one, and inserts them as Radio-ListViewItem. def copy1to2 @lv2.clear - it = Qt::ListViewItemIterator.new(@lv1) + it = TQt::ListViewItemIterator.new(@lv1) # Insert first a controller Item into the second ListView. Always if Radio-ListViewItems # are inserted into a Listview, the parent item of these MUST be a controller Item! - item = Qt::CheckListItem.new(@lv2, 'Controller', Qt::CheckListItem::Controller ); + item = TQt::CheckListItem.new(@lv2, 'Controller', TQt::CheckListItem::Controller ); item.setOpen(true); # iterate through the first ListView... @@ -109,7 +109,7 @@ class CheckLists < Qt::Widget # ...if the item is checked... if (it.current.isOn) # ...insert a Radio-ListViewItem with the same text into the second ListView - Qt::CheckListItem.new(item, it.current.text(0), Qt::CheckListItem::RadioButton) + TQt::CheckListItem.new(item, it.current.text(0), TQt::CheckListItem::RadioButton) end end it += 1 @@ -127,7 +127,7 @@ class CheckLists < Qt::Widget # Label at the right. def copy2to3 # create an iterator which operates on the second ListView - it = Qt::ListViewItemIterator.new(@lv2) + it = TQt::ListViewItemIterator.new(@lv2) @label.setText('No Item checked') diff --git a/qtruby/rubylib/examples/qt-examples/checklists/main.rb b/qtruby/rubylib/examples/qt-examples/checklists/main.rb index 0c0e755c..14166acd 100755 --- a/qtruby/rubylib/examples/qt-examples/checklists/main.rb +++ b/qtruby/rubylib/examples/qt-examples/checklists/main.rb @@ -1,10 +1,10 @@ #!/usr/bin/env ruby -require 'Qt' +retquire 'Qt' -require 'checklists' +retquire 'checklists' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) checklists = CheckLists.new checklists.resize(650, 350) diff --git a/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb b/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb index 6ac52c4c..8d5fcc2e 100644 --- a/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb +++ b/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class DigitalClock < Qt::LCDNumber +class DigitalClock < TQt::LCDNumber slots 'stopDate()', 'showTime()' @@ -9,7 +9,7 @@ class DigitalClock < Qt::LCDNumber super @showingColon = false - setFrameStyle(Qt::Frame.Panel | Qt::Frame.Raised) + setFrameStyle(TQt::Frame.Panel | TQt::Frame.Raised) setLineWidth(2) # set frame line width showTime # display the current time @normalTimer = startTimer(500) # 1/2 second timer events @@ -31,7 +31,7 @@ class DigitalClock < Qt::LCDNumber # Enters date mode when the left mouse button is pressed. def mousePressEvent (e) - if (e.button == Qt::MouseEvent.LeftButton) # left button pressed + if (e.button == TQt::MouseEvent.LeftButton) # left button pressed showDate end end @@ -44,7 +44,7 @@ class DigitalClock < Qt::LCDNumber def showTime @showingColon = !@showingColon # toggle/blink colon - s = Qt::Time.currentTime.toString[0..4] + s = TQt::Time.currentTime.toString[0..4] if (!@showingColon) s[2] = ' ' end @@ -58,7 +58,7 @@ class DigitalClock < Qt::LCDNumber if (@showDateTimer != -1) # already showing date return end - date = Qt::Date.currentDate + date = TQt::Date.currentDate s = sprintf('%2d %2d', date.month, date.day) display(s) # sets the LCD number/text @showDateTimer = startTimer(2000) # keep this state for 2 secs diff --git a/qtruby/rubylib/examples/qt-examples/dclock/main.rb b/qtruby/rubylib/examples/qt-examples/dclock/main.rb index c76ae55d..4d73dfea 100755 --- a/qtruby/rubylib/examples/qt-examples/dclock/main.rb +++ b/qtruby/rubylib/examples/qt-examples/dclock/main.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby -require 'Qt' -require 'dclock' +retquire 'Qt' +retquire 'dclock' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) clock = DigitalClock.new clock.resize(170,80) a.setMainWidget(clock) diff --git a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb index 9559a921..ec72b01c 100755 --- a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb +++ b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb @@ -1,14 +1,14 @@ #!/usr/bin/env ruby -require 'Qt' -require 'viewer' +retquire 'Qt' +retquire 'viewer' $KCODE='u' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) textViewer = Viewer.new -textViewer.setCaption('QtRuby Example - Simple QFont Demo') +textViewer.setCaption('QtRuby Example - Simple TQFont Demo') a.setMainWidget(textViewer) textViewer.show a.exec() diff --git a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb index d9c16a62..feed96f0 100644 --- a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb +++ b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb @@ -1,4 +1,4 @@ -class Viewer < Qt::Widget +class Viewer < TQt::Widget slots 'setDefault()', 'setSansSerif()', 'setItalics()' def initialize @@ -6,7 +6,7 @@ class Viewer < Qt::Widget setFontSubstitutions - codec = Qt::TextCodec::codecForName("utf8") + codec = TQt::TextCodec::codecForName("utf8") # Shouldn't 'pack("U*")' for UTF-8 work here? - Richard # The 'U' option packs each element into two bytes and doesn't work @@ -15,36 +15,36 @@ class Viewer < Qt::Widget greeting_ru = codec.toUnicode([0320, 0227, 0320, 0264, 0321, 0200, 0320, 0260, 0320, 0262, 0321, 0201, 0321, 0202, 0320, 0262, 0321, 0203, 0320, 0271, 0321, 0202, 0320, 0265].pack("C*")) greeting_en = 'Hello' - @greetings = Qt::TextView.new(self, 'textview') + @greetings = TQt::TextView.new(self, 'textview') @greetings.setText( greeting_en + "\n" + greeting_ru + "\n" + greeting_heb) - @fontInfo = Qt::TextView.new(self, 'fontinfo') + @fontInfo = TQt::TextView.new(self, 'fontinfo') setDefault - @defaultButton = Qt::PushButton.new('Default', self, 'pushbutton1') - @defaultButton.setFont(Qt::Font.new('times')) + @defaultButton = TQt::PushButton.new('Default', self, 'pushbutton1') + @defaultButton.setFont(TQt::Font.new('times')) connect(@defaultButton, SIGNAL('clicked()'), self, SLOT('setDefault()')) - @sansSerifButton = Qt::PushButton.new('Sans Serif', self, 'pushbutton2') - @sansSerifButton.setFont(Qt::Font.new('Helvetica', 12)) + @sansSerifButton = TQt::PushButton.new('Sans Serif', self, 'pushbutton2') + @sansSerifButton.setFont(TQt::Font.new('Helvetica', 12)) connect(@sansSerifButton, SIGNAL('clicked()'), self, SLOT('setSansSerif()')) - @italicsButton = Qt::PushButton.new('Italics', self, 'pushbutton1') - @italicsButton.setFont(Qt::Font.new('lucida', 12, Qt::Font.Bold, true)) + @italicsButton = TQt::PushButton.new('Italics', self, 'pushbutton1') + @italicsButton.setFont(TQt::Font.new('lucida', 12, TQt::Font.Bold, true)) connect(@italicsButton, SIGNAL('clicked()'), self, SLOT('setItalics()')) layout end def setDefault - font = Qt::Font.new('Bavaria') + font = TQt::Font.new('Bavaria') font.setPointSize(24) - font.setWeight(Qt::Font.Bold) + font.setWeight(TQt::Font.Bold) font.setUnderline(true) @greetings.setFont(font) @@ -52,17 +52,17 @@ class Viewer < Qt::Widget end def setSansSerif - font = Qt::Font.new('Newyork', 18) - font.setStyleHint(Qt::Font.SansSerif) + font = TQt::Font.new('Newyork', 18) + font.setStyleHint(TQt::Font.SansSerif) @greetings.setFont(font) showFontInfo(font) end def setItalics - font = Qt::Font.new('Tokyo') + font = TQt::Font.new('Tokyo') font.setPointSize(32) - font.setWeight(Qt::Font.Bold) + font.setWeight(TQt::Font.Bold) font.setItalic(true) @greetings.setFont(font) @@ -77,16 +77,16 @@ class Viewer < Qt::Widget substitutes.push('Arabic Newspaper') substitutes.push('crox') - Qt::Font.insertSubstitutions('Bavaria', substitutes) - Qt::Font.insertSubstitution('Tokyo', 'Lucida') + TQt::Font.insertSubstitutions('Bavaria', substitutes) + TQt::Font.insertSubstitution('Tokyo', 'Lucida') end def layout - textViewContainer = Qt::HBoxLayout.new + textViewContainer = TQt::HBoxLayout.new textViewContainer.addWidget(@greetings) textViewContainer.addWidget(@fontInfo) - buttonContainer = Qt::HBoxLayout.new + buttonContainer = TQt::HBoxLayout.new buttonContainer.addWidget(@defaultButton) buttonContainer.addWidget(@sansSerifButton) buttonContainer.addWidget(@italicsButton) @@ -105,7 +105,7 @@ class Viewer < Qt::Widget @sansSerifButton.setFixedHeight(maxButtonHeight) @italicsButton.setFixedHeight(maxButtonHeight) - container = Qt::VBoxLayout.new(self) + container = TQt::VBoxLayout.new(self) container.addLayout(textViewContainer) container.addLayout(buttonContainer) @@ -113,7 +113,7 @@ class Viewer < Qt::Widget end def showFontInfo (font) - info = Qt::FontInfo.new(font) + info = TQt::FontInfo.new(font) messageText = 'Font requested: "' + font.family + '" ' + @@ -122,7 +122,7 @@ class Viewer < Qt::Widget info.family.to_s + '" ' + info.pointSize.to_s + 'pt<P>' - substitutions = Qt::Font.substitutes(font.family) + substitutions = TQt::Font.substitutes(font.family) unless substitutions.size == 0 messageText = messageText + 'The following substitutions exist for ' + diff --git a/qtruby/rubylib/examples/qt-examples/forever/forever.rb b/qtruby/rubylib/examples/qt-examples/forever/forever.rb index 46849784..cde20f75 100755 --- a/qtruby/rubylib/examples/qt-examples/forever/forever.rb +++ b/qtruby/rubylib/examples/qt-examples/forever/forever.rb @@ -1,12 +1,12 @@ #!/usr/bin/env ruby -w -require 'Qt' +retquire 'Qt' # # Forever - a widget that draws rectangles forever. # -class Forever < Qt::Widget +class Forever < TQt::Widget NUM_COLORS = 120 # @@ -19,13 +19,13 @@ class Forever < Qt::Widget super(nil) @colors = [] 0.upto(NUM_COLORS-1) do |a| - @colors[a] = Qt::Color.new( rand(255), + @colors[a] = TQt::Color.new( rand(255), rand(255), rand(255) ) end @rectangles = 0 startTimer( 0 ) # run continuous timer - counter = Qt::Timer.new( self ) + counter = TQt::Timer.new( self ) connect( counter, SIGNAL("timeout()"), self, SLOT("updateCaption()") ) counter.start( 1000 ) @@ -44,7 +44,7 @@ class Forever < Qt::Widget # def paintEvent( e ) - paint = Qt::Painter.new( self ) # painter object + paint = TQt::Painter.new( self ) # painter object w = width() h = height() if w <= 0 || h <= 0 then @@ -53,10 +53,10 @@ class Forever < Qt::Widget paint.setPen( NoPen ) # do not draw outline paint.setBrush( @colors[rand(NUM_COLORS)]) # set random brush color - p1 = Qt::Point.new( rand(w), rand(h)) # p1 = top left - p2 = Qt::Point.new( rand(w), rand(h)) # p2 = bottom right + p1 = TQt::Point.new( rand(w), rand(h)) # p1 = top left + p2 = TQt::Point.new( rand(w), rand(h)) # p2 = bottom right - r = Qt::Rect.new( p1, p2 ) + r = TQt::Rect.new( p1, p2 ) paint.drawRect( r ) # draw filled rectangle paint.end() end @@ -75,7 +75,7 @@ class Forever < Qt::Widget end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) always = Forever.new always.resize( 400, 250 ) # start up with size 400x250 a.mainWidget = always # set as main widget diff --git a/qtruby/rubylib/examples/qt-examples/hello/hello.rb b/qtruby/rubylib/examples/qt-examples/hello/hello.rb index ce957c75..80bf3e32 100644 --- a/qtruby/rubylib/examples/qt-examples/hello/hello.rb +++ b/qtruby/rubylib/examples/qt-examples/hello/hello.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class Hello < Qt::Widget +class Hello < TQt::Widget signals 'clicked()' slots 'animate()' @@ -12,7 +12,7 @@ class Hello < Qt::Widget @b = 0 @text = text @sin_tbl = [0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38] - timer = Qt::Timer.new(self); + timer = TQt::Timer.new(self); connect(timer, SIGNAL('timeout()'), SLOT('animate()')) timer.start(40); @@ -53,11 +53,11 @@ class Hello < Qt::Widget pmy = height/2 - h/2 # 2: Create the pixmap and fill it with the widget's background - pm = Qt::Pixmap.new(w, h) + pm = TQt::Pixmap.new(w, h) pm.fill(self, pmx, pmy) # 3: Paint the pixmap. Cool wave effect - p = Qt::Painter.new; + p = TQt::Painter.new; x = 10 y = h/2 + fm.descent i = 0 @@ -66,7 +66,7 @@ class Hello < Qt::Widget for i in 0..@text.size-1 j = (@b+i) & 15 - p.setPen(Qt::Color.new((15-j)*16,255,255,Qt::Color.Hsv) ) + p.setPen(TQt::Color.new((15-j)*16,255,255,TQt::Color.Hsv) ) p.drawText( x, y-@sin_tbl[j]*h/800, @text[i,1], 1 ) x += fm.width(@text[i,1]) end diff --git a/qtruby/rubylib/examples/qt-examples/hello/main.rb b/qtruby/rubylib/examples/qt-examples/hello/main.rb index a6d3447f..9a7a7822 100755 --- a/qtruby/rubylib/examples/qt-examples/hello/main.rb +++ b/qtruby/rubylib/examples/qt-examples/hello/main.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby -require 'Qt' -require 'hello' +retquire 'Qt' +retquire 'hello' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) s = '' s = ARGV[0..ARGV.size-1].join(' ') if ARGV.length @@ -15,8 +15,8 @@ end h = Hello.new(s) h.setCaption('QtRuby says hello') h.connect(h, SIGNAL('clicked()'), a, SLOT('quit()')) -h.setFont(Qt::Font.new('times', 32, Qt::Font.Bold)) # default font -h.setBackgroundColor(Qt::white) # default bg color +h.setFont(TQt::Font.new('times', 32, TQt::Font.Bold)) # default font +h.setBackgroundColor(TQt::white) # default bg color a.setMainWidget(h) h.show diff --git a/qtruby/rubylib/examples/qt-examples/progress/progress.rb b/qtruby/rubylib/examples/qt-examples/progress/progress.rb index 02116958..1469934e 100644 --- a/qtruby/rubylib/examples/qt-examples/progress/progress.rb +++ b/qtruby/rubylib/examples/qt-examples/progress/progress.rb @@ -1,13 +1,13 @@ #!/usr/bin/env ruby -w -require 'Qt' +retquire 'Qt' -class AnimatedThingy < Qt::Label +class AnimatedThingy < TQt::Label attr_accessor :label, :step attr_accessor :ox0, :oy0, :ox1, :oy1 attr_accessor :x0, :y0, :x1, :y1 attr_accessor :dx0, :dx1, :dy0, :dy1 - NQIX = 10 + NTQIX = 10 def initialize(*k) super(*k) @@ -32,7 +32,7 @@ class AnimatedThingy < Qt::Label end def sizeHint - Qt::Size.new(120,100) + TQt::Size.new(120,100) end def inc(x, dx, b) @@ -48,13 +48,13 @@ class AnimatedThingy < Qt::Label end def timerEvent(e) - p = Qt::Painter.new(self) + p = TQt::Painter.new(self) pn = p.pen pn.setWidth(2) pn.setColor(backgroundColor) p.setPen(pn) - @step = (@step + 1) % NQIX + @step = (@step + 1) % NTQIX p.drawLine(@ox0[@step], @oy0[@step], @ox1[@step], @oy1[@step]) @@ -67,8 +67,8 @@ class AnimatedThingy < Qt::Label @ox1[@step] = @x1 @oy1[@step] = @y1 - c = Qt::Color.new - c.setHsv( (@step*255)/NQIX, 255, 255 ) # rainbow effect + c = TQt::Color.new + c.setHsv( (@step*255)/NTQIX, 255, 255 ) # rainbow effect pn.setColor(c) pn.setWidth(2) p.setPen(pn) @@ -79,14 +79,14 @@ class AnimatedThingy < Qt::Label end def paintEvent(event) - p = Qt::Painter.new(self) + p = TQt::Painter.new(self) pn = p.pen() pn.setWidth(2) p.setPen(pn) p.setClipRect(event.rect()) - 0.upto(NQIX-1) do |i| - c = Qt::Color.new() - c.setHsv( (i*255)/NQIX, 255, 255 ) # rainbow effect + 0.upto(NTQIX-1) do |i| + c = TQt::Color.new() + c.setHsv( (i*255)/NTQIX, 255, 255 ) # rainbow effect pn.setColor(c) p.setPen(pn) p.drawLine(@ox0[i], @oy0[i], @ox1[i], @oy1[i]) @@ -97,7 +97,7 @@ class AnimatedThingy < Qt::Label end end -class CPUWaster < Qt::Widget +class CPUWaster < TQt::Widget attr_accessor :menubar, :file, :options, :rects, :pb attr_accessor :td_id , :ld_id, :dl_id, :cl_id, :md_id attr_accessor :got_stop, :timer_driven, :default_label @@ -110,10 +110,10 @@ class CPUWaster < Qt::Widget def initialize(*k) super(*k) - @menubar = Qt::MenuBar.new(self, "menu") + @menubar = TQt::MenuBar.new(self, "menu") @pb = nil - @file = Qt::PopupMenu.new + @file = TQt::PopupMenu.new @menubar.insertItem( "&File", file ) FIRST_DRAW_ITEM.upto(LAST_DRAW_ITEM) { |i| file.insertItem( "#{drawItemRects(i)} Rectangles", i) @@ -121,7 +121,7 @@ class CPUWaster < Qt::Widget connect( menubar, SIGNAL('activated(int)'), self, SLOT('doMenuItem(int)') ) @file.insertSeparator @file.insertItem("Quit", $qApp, SLOT('quit()')) - @options = Qt::PopupMenu.new + @options = TQt::PopupMenu.new @menubar.insertItem("&Options", options) @td_id = options.insertItem("Timer driven", self, SLOT('timerDriven()')) @ld_id = options.insertItem("Loop driven", self, SLOT('loopDriven()')) @@ -189,26 +189,26 @@ class CPUWaster < Qt::Widget @pb.setProgress( @pb.totalSteps - @rects ) if @rects % 100 == 0 @rects -= 1 - painter = Qt::Painter.new(self) + painter = TQt::Painter.new(self) ww = width wh = height if ww > 8 and wh > 8 - c = Qt::Color.new(rand(255), rand(255), rand(255)) + c = TQt::Color.new(rand(255), rand(255), rand(255)) x = rand(ww - 8) y = rand(wh - 8) w = rand(ww - x) h = rand(wh - y) - painter.fillRect(x, y, w, h, Qt::Brush.new(c)) + painter.fillRect(x, y, w, h, TQt::Brush.new(c)) end painter.end() if @rects == 0 || @got_stop @pb.setProgress(@pb.totalSteps) - painter = Qt::Painter.new(self) - painter.fillRect(0, 0, width(), height(), Qt::Brush.new(backgroundColor)) + painter = TQt::Painter.new(self) + painter.fillRect(0, 0, width(), height(), TQt::Brush.new(backgroundColor)) painter.end() enableDrawingItems(true) killTimers() @@ -217,7 +217,7 @@ class CPUWaster < Qt::Widget end def newProgressDialog(label, steps, modal) - d = Qt::ProgressDialog.new(label, "Cancel", steps, self, "progress", modal) + d = TQt::ProgressDialog.new(label, "Cancel", steps, self, "progress", modal) d.setMinimumDuration(0) if @options.isItemChecked(@md_id) d.setLabel( AnimatedThingy.new(d, label) ) unless @default_label d.show @@ -247,28 +247,28 @@ class CPUWaster < Qt::Widget lpb = newProgressDialog("Drawing rectangles.\nUsing loop.", n, true) lpb.setCaption("Please Wait") - painter = Qt::Painter.new(self) + painter = TQt::Painter.new(self) 0.upto(n) { |i| if (i % 100) == 0 lpb.setProgress(i) break if lpb.wasCancelled end cw, ch = width, height - c = Qt::Color.new(rand(255), rand(255), rand(255)) + c = TQt::Color.new(rand(255), rand(255), rand(255)) x = rand(cw - 8) y = rand(cw - 8) w = rand(cw - x) h = rand(cw - y) - painter.fillRect(x, y, w, h, Qt::Brush.new(c)) + painter.fillRect(x, y, w, h, TQt::Brush.new(c)) } lpb.cancel - painter.fillRect(0, 0, width, height, Qt::Brush.new(backgroundColor)) + painter.fillRect(0, 0, width, height, TQt::Brush.new(backgroundColor)) painter.end() end end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = CPUWaster.new w.show a.setMainWidget(w) diff --git a/qtruby/rubylib/examples/qt-examples/tictac/main.rb b/qtruby/rubylib/examples/qt-examples/tictac/main.rb index 024ae70c..98f57393 100755 --- a/qtruby/rubylib/examples/qt-examples/tictac/main.rb +++ b/qtruby/rubylib/examples/qt-examples/tictac/main.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby -w -require 'Qt' -require 'tictac' +retquire 'Qt' +retquire 'tictac' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) n = 3 # get board size n ttt = TicTacToe.new(n) diff --git a/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb b/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb index 04ab8b9d..354e22ef 100644 --- a/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb +++ b/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class TicTacButton < Qt::PushButton +class TicTacButton < TQt::PushButton attr_accessor :btype @@ -13,18 +13,18 @@ class TicTacButton < Qt::PushButton def drawButtonLabel(p) r = rect() - p.setPen( Qt::Pen.new( Qt::white,2 ) ) # set fat pen + p.setPen( TQt::Pen.new( TQt::white,2 ) ) # set fat pen if (@btype == Circle) p.drawEllipse( r.left()+4, r.top()+4, r.width()-8, r.height()-8 ) elsif (@btype == Cross) # draw cross - p.drawLine( r.topLeft() +Qt::Point.new(4,4), r.bottomRight()-Qt::Point.new(4,4)) - p.drawLine( r.bottomLeft()+Qt::Point.new(4,-4),r.topRight() -Qt::Point.new(4,-4)) + p.drawLine( r.topLeft() +TQt::Point.new(4,4), r.bottomRight()-TQt::Point.new(4,4)) + p.drawLine( r.bottomLeft()+TQt::Point.new(4,-4),r.topRight() -TQt::Point.new(4,-4)) end super(p) end end -class TicTacGameBoard < Qt::Widget +class TicTacGameBoard < TQt::Widget signals 'finished()' slots 'buttonClicked()' @@ -41,8 +41,8 @@ class TicTacGameBoard < Qt::Widget @buttons = Array.new(n) @btArray = Array.new(n) - grid = Qt::GridLayout.new(self, n, n, 4) - p = Qt::Palette.new(Qt::blue) + grid = TQt::GridLayout.new(self, n, n, 4) + p = TQt::Palette.new(TQt::blue) for i in (0..n-1) ttb = TicTacButton.new(self) @@ -238,13 +238,13 @@ class TicTacGameBoard < Qt::Widget end -class TicTacToe < Qt::Widget +class TicTacToe < TQt::Widget slots 'newGameClicked()', 'gameOver()' def initialize (boardSize) super() - l = Qt::VBoxLayout.new(self, 6) + l = TQt::VBoxLayout.new(self, 6) @state_msg = [ 'Click Play to start', @@ -254,9 +254,9 @@ class TicTacToe < Qt::Widget 'It\'s a draw'] # Create a message label - @message = Qt::Label.new(self) - @message.setFrameStyle((Qt::Frame.WinPanel|Qt::Frame.Sunken)) - @message.setAlignment(Qt::AlignCenter) + @message = TQt::Label.new(self) + @message.setFrameStyle((TQt::Frame.WinPanel|TQt::Frame.Sunken)) + @message.setAlignment(TQt::AlignCenter) l.addWidget(@message) # Create the game board and connect the signal finished() @@ -266,23 +266,23 @@ class TicTacToe < Qt::Widget l.addWidget(@board) # Create a horizontal frame line - line = Qt::Frame.new(self) - line.setFrameStyle(Qt::Frame.HLine|Qt::Frame.Sunken) + line = TQt::Frame.new(self) + line.setFrameStyle(TQt::Frame.HLine|TQt::Frame.Sunken) l.addWidget(line) # Create the combo box for deciding who should start # and connect its clicked() signals to the buttonClicked() slot - @whoStarts = Qt::ComboBox.new(self) + @whoStarts = TQt::ComboBox.new(self) @whoStarts.insertItem('Computer starts') @whoStarts.insertItem('Human starts') l.addWidget(@whoStarts); # Create the push buttons and connect their signals to the right slots - @newGame = Qt::PushButton.new('Play!', self) + @newGame = TQt::PushButton.new('Play!', self) connect(@newGame, SIGNAL('clicked()'), self, SLOT('newGameClicked()')) - @quit = Qt::PushButton.new('Quit', self) + @quit = TQt::PushButton.new('Quit', self) connect(@quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) - b = Qt::HBoxLayout.new + b = TQt::HBoxLayout.new l.addLayout(b) b.addWidget(@newGame) b.addWidget(@quit) diff --git a/qtruby/rubylib/examples/qt-examples/tooltip/main.rb b/qtruby/rubylib/examples/qt-examples/tooltip/main.rb index f1f9ccda..c3774a42 100755 --- a/qtruby/rubylib/examples/qt-examples/tooltip/main.rb +++ b/qtruby/rubylib/examples/qt-examples/tooltip/main.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby -require 'Qt' -require 'tooltip' +retquire 'Qt' +retquire 'tooltip' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) mw = TellMe.new mw.setCaption('QtRuby Example - Dynamic Tool Tips') diff --git a/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb b/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb index 181816da..4b805102 100644 --- a/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb +++ b/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class DynamicTip < Qt::ToolTip +class DynamicTip < TQt::ToolTip def initialize(p) super(p) end @@ -20,7 +20,7 @@ class DynamicTip < Qt::ToolTip end end -class TellMe < Qt::Widget +class TellMe < TQt::Widget def initialize super @@ -33,7 +33,7 @@ class TellMe < Qt::Widget @t = DynamicTip.new(self) - Qt::ToolTip.add(self, @r3, 'this color is called red') #TT says this is helpful, I'm not so sure + TQt::ToolTip.add(self, @r3, 'this color is called red') #TT says this is helpful, I'm not so sure end def tip(point) @@ -42,25 +42,25 @@ class TellMe < Qt::Widget elsif (@r2.contains(point)) @r2 else - Qt::Rect.new(0,0, -1, -1) + TQt::Rect.new(0,0, -1, -1) end end def paintEvent(e) - p = Qt::Painter.new(self) + p = TQt::Painter.new(self) if (e.rect.intersects(@r1)) - p.setBrush(Qt::blue) + p.setBrush(TQt::blue) p.drawRect(@r1) end if (e.rect.intersects(@r2)) - p.setBrush(Qt::blue) + p.setBrush(TQt::blue) p.drawRect(@r2) end if (e.rect.intersects(@r3)) - p.setBrush(Qt::red) + p.setBrush(TQt::red) p.drawRect(@r3) end @@ -90,6 +90,6 @@ class TellMe < Qt::Widget end def randomRect - Qt::Rect.new(rand(width - 20), rand(height - 20), 20, 20) + TQt::Rect.new(rand(width - 20), rand(height - 20), 20, 20) end end diff --git a/qtruby/rubylib/examples/qtscribble/scribble.rb b/qtruby/rubylib/examples/qtscribble/scribble.rb index 7c6e1ca5..2d931088 100644 --- a/qtruby/rubylib/examples/qtscribble/scribble.rb +++ b/qtruby/rubylib/examples/qtscribble/scribble.rb @@ -5,11 +5,11 @@ # window knows how to redraw itself. # -require 'Qt' +retquire 'Qt' - class ScribbleArea < Qt::Widget + class ScribbleArea < TQt::Widget - slots "setColor(QColor)", "slotLoad(const QString&)", "slotSave(const QString&)", "slotClearArea()" + slots "setColor(TQColor)", "slotLoad(const TQString&)", "slotSave(const TQString&)", "slotClearArea()" # # The constructor. Initializes the member variables. @@ -17,21 +17,21 @@ require 'Qt' def initialize() super # initialize member variables - @_buffer = Qt::Pixmap.new() - @_last = Qt::Point.new() + @_buffer = TQt::Pixmap.new() + @_last = TQt::Point.new() @_currentcolor = black # don't blank the window before repainting setBackgroundMode( NoBackground ) # create a pop-up menu - @_popupmenu = Qt::PopupMenu.new() + @_popupmenu = TQt::PopupMenu.new() @_popupmenu.insertItem( "&Clear", self, SLOT( "slotClearArea()" ) ) end # # This slot sets the curren color for the scribble area. It will be - # connected with the colorChanged( Qt::Color ) signal from the + # connected with the colorChanged( TQt::Color ) signal from the # ScribbleWindow. # def setColor( new_color ) @@ -52,12 +52,12 @@ require 'Qt' # - # This method does the actual loading. It relies on Qt::Pixmap (and the + # This method does the actual loading. It relies on TQt::Pixmap (and the # underlying I/O machinery) to determine the filetype. # def slotLoad( filename ) if !@_buffer.load( filename ) - Qt::MessageBox.warning( nil, "Load error", "Could not load file" ) + TQt::MessageBox.warning( nil, "Load error", "Could not load file" ) end repaint() # refresh the window @@ -70,7 +70,7 @@ require 'Qt' # def slotSave( filename ) if !@_buffer.save( filename, "BMP" ) - Qt::MessageBox.warning( nil, "Save error", "Could not save file" ) + TQt::MessageBox.warning( nil, "Save error", "Could not save file" ) end end @@ -82,7 +82,7 @@ require 'Qt' # def mousePressEvent(event) if event.button() == RightButton - @_popupmenu.exec( Qt::Cursor.pos() ) + @_popupmenu.exec( TQt::Cursor.pos() ) else @_last = event.pos() # retrieve the coordinates from the event end @@ -98,10 +98,10 @@ require 'Qt' # pressed. # def mouseMoveEvent(event) - # create a Qt::Painter object for drawing onto the window - windowpainter = Qt::Painter.new() - # and another Qt::Painter object for drawing int an off-screen pixmap - bufferpainter = Qt::Painter.new() + # create a TQt::Painter object for drawing onto the window + windowpainter = TQt::Painter.new() + # and another TQt::Painter object for drawing int an off-screen pixmap + bufferpainter = TQt::Painter.new() # start painting windowpainter.begin( self ) # This painter paints onto the window @@ -136,17 +136,17 @@ require 'Qt' # painting, for example, when it has been obscured and then revealed again. # def resizeEvent(event) - save = Qt::Pixmap.new( @_buffer ) + save = TQt::Pixmap.new( @_buffer ) @_buffer.resize( event.size() ) @_buffer.fill( white ) bitBlt( @_buffer, 0, 0, save ) end end -class ScribbleWindow < Qt::Widget +class ScribbleWindow < TQt::Widget slots "slotAbout()", "slotAboutQt()", "slotColorMenu(int)", "slotLoad()", "slotSave()" - signals "colorChanged(QColor)", "load(const QString&)", "save(const QString&)" + signals "colorChanged(TQColor)", "load(const TQString&)", "save(const TQString&)" COLOR_MENU_ID_BLACK = 0 COLOR_MENU_ID_RED = 1 @@ -158,44 +158,44 @@ class ScribbleWindow < Qt::Widget super # The next lines build the menu bar. We first create the menus # one by one, then add them to the menu bar. # - @_filemenu = Qt::PopupMenu.new() # create a file menu + @_filemenu = TQt::PopupMenu.new() # create a file menu @_filemenu.insertItem( "&Load", self, SLOT( "slotLoad()" ) ) @_filemenu.insertItem( "&Save", self, SLOT( "slotSave()" ) ) @_filemenu.insertSeparator() @_filemenu.insertItem( "&Quit", $qApp, SLOT( "quit()" ) ) - @_colormenu = Qt::PopupMenu.new() # create a color menu + @_colormenu = TQt::PopupMenu.new() # create a color menu @_colormenu.insertItem( "B&lack", COLOR_MENU_ID_BLACK) @_colormenu.insertItem( "&Red", COLOR_MENU_ID_RED) @_colormenu.insertItem( "&Blue", COLOR_MENU_ID_BLUE) @_colormenu.insertItem( "&Green", COLOR_MENU_ID_GREEN) @_colormenu.insertItem( "&Yellow", COLOR_MENU_ID_YELLOW) - Qt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ), + TQt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ), self, SLOT( "slotColorMenu( int )" ) ) - @_helpmenu = Qt::PopupMenu.new() # create a help menu + @_helpmenu = TQt::PopupMenu.new() # create a help menu @_helpmenu.insertItem( "&About QtScribble", self, SLOT( "slotAbout()" ) ) @_helpmenu.insertItem( "&About Qt", self, SLOT( "slotAboutQt()" ) ) - @_menubar = Qt::MenuBar.new( self, "" ) # create a menu bar + @_menubar = TQt::MenuBar.new( self, "" ) # create a menu bar @_menubar.insertItem( "&File", @_filemenu ) @_menubar.insertItem( "&Color", @_colormenu ) @_menubar.insertItem( "&Help", @_helpmenu ) - # We create a Qt::ScrollView and a ScribbleArea. The ScribbleArea will + # We create a TQt::ScrollView and a ScribbleArea. The ScribbleArea will # be managed by the scroll view.# - @_scrollview = Qt::ScrollView.new( self ) + @_scrollview = TQt::ScrollView.new( self ) @_scrollview.setGeometry( 0, @_menubar.height(), width(), height() - @_menubar.height() ) @_scribblearea = ScribbleArea.new() @_scribblearea.setGeometry( 0, 0, 1000, 1000 ) @_scrollview.addChild( @_scribblearea ) - Qt::Object.connect( self, SIGNAL( "colorChanged(QColor)" ), - @_scribblearea, SLOT( "setColor(QColor)" ) ) - Qt::Object.connect( self, SIGNAL( "save(const QString&)" ), - @_scribblearea, SLOT( "slotSave(const QString&)" ) ) - Qt::Object.connect( self, SIGNAL( "load(const QString&)" ), - @_scribblearea, SLOT( "slotLoad(const QString&)" ) ) + TQt::Object.connect( self, SIGNAL( "colorChanged(TQColor)" ), + @_scribblearea, SLOT( "setColor(TQColor)" ) ) + TQt::Object.connect( self, SIGNAL( "save(const TQString&)" ), + @_scribblearea, SLOT( "slotSave(const TQString&)" ) ) + TQt::Object.connect( self, SIGNAL( "load(const TQString&)" ), + @_scribblearea, SLOT( "slotLoad(const TQString&)" ) ) end def resizeEvent( event ) @@ -209,13 +209,13 @@ class ScribbleWindow < Qt::Widget def slotAbout() - Qt::MessageBox.information( self, "About QtScribble 5", + TQt::MessageBox.information( self, "About QtScribble 5", "This is the Scribble 5 application\n" + "Copyright 1998 by Mathias Kalle Dalheimer\n") end def slotAboutQt() - Qt::MessageBox.aboutQt( self, "About Qt" ) + TQt::MessageBox.aboutQt( self, "About Qt" ) end def slotColorMenu( item ) @@ -236,14 +236,14 @@ class ScribbleWindow < Qt::Widget # # This is the slot for the menu item File/Load. It opens a - # Qt::FileDialog to ask the user for a filename, then emits a save() + # TQt::FileDialog to ask the user for a filename, then emits a save() # signal with the filename as parameter. # def slotLoad() # Open a file dialog for loading. The default directory is the # current directory, the filter *.bmp. # - filename = Qt::FileDialog.getOpenFileName( ".", "*.bmp", self ) + filename = TQt::FileDialog.getOpenFileName( ".", "*.bmp", self ) if !filename.nil? emit load( filename ) end @@ -251,21 +251,21 @@ class ScribbleWindow < Qt::Widget # # This is the slot for the menu item File/Load. It opens a - # Qt::FileDialog to ask the user for a filename, then emits a save() + # TQt::FileDialog to ask the user for a filename, then emits a save() # signal with the filename as parameter. # def slotSave() # Open a file dialog for saving. The default directory is the # current directory, the filter *.bmp. # - filename = Qt::FileDialog.getSaveFileName( ".", "*.bmp", self ) + filename = TQt::FileDialog.getSaveFileName( ".", "*.bmp", self ) if !filename.nil? emit save( filename ) end end end -myapp = Qt::Application.new(ARGV) +myapp = TQt::Application.new(ARGV) mywidget = ScribbleWindow.new() mywidget.setGeometry(50, 500, 400, 400) diff --git a/qtruby/rubylib/examples/ruboids/README b/qtruby/rubylib/examples/ruboids/README index 5417037a..fa99399d 100644 --- a/qtruby/rubylib/examples/ruboids/README +++ b/qtruby/rubylib/examples/ruboids/README @@ -30,7 +30,7 @@ directory: DEPENDENCIES ============ -RuBoids requires the OpenGL and Qt packages, which can be found on the Ruby +RuBoids retquires the OpenGL and Qt packages, which can be found on the Ruby Application Archive. COPYING diff --git a/qtruby/rubylib/examples/ruboids/index.html b/qtruby/rubylib/examples/ruboids/index.html index 9b320f8e..778fefb0 100644 --- a/qtruby/rubylib/examples/ruboids/index.html +++ b/qtruby/rubylib/examples/ruboids/index.html @@ -21,7 +21,7 @@ PREFIX = "../../"; // --> <IMG src="../../images/KeyMaster.gif" width="32" height="32" alt="Home" border="0"></A><BR> <A href="../../index.html">Home</A><BR> -<A href="../nqxml/index.html">NQXML</A><BR> +<A href="../nqxml/index.html">NTQXML</A><BR> RuBoids<BR> <A href="../../computers.html">Computers</A><BR> <A href="../../java.html">Java</A><BR> @@ -82,7 +82,7 @@ where the latest release may be found. <h1>Dependencies</h1> <p> -RuBoids requires the OpenGL and Qt packages, which can be found on the <a +RuBoids retquires the OpenGL and Qt packages, which can be found on the <a href="html://www.ruby-lang.org/en/raa.html">Ruby Application Archive</a>. </p> diff --git a/qtruby/rubylib/examples/ruboids/release.rb b/qtruby/rubylib/examples/ruboids/release.rb index d82ba154..10e10c18 100755 --- a/qtruby/rubylib/examples/ruboids/release.rb +++ b/qtruby/rubylib/examples/ruboids/release.rb @@ -16,16 +16,16 @@ # to the Web site. # -require 'net/ftp' -require 'ftools' # For makedirs and install -require 'generateManifest' # For--you guessed it--generating the Manifest +retquire 'net/ftp' +retquire 'ftools' # For makedirs and install +retquire 'generateManifest' # For--you guessed it--generating the Manifest # Start looking for RUBOIDS classes in this directory. # This forces us to use the local copy of RUBOIDS, even if there is # a previously installed version out there somewhere. $LOAD_PATH[0, 0] = '.' -require 'ruboids/info' # For Version string +retquire 'ruboids/info' # For Version string FILE_PERMISSION = 0644 DIR_PERMISSION = 0755 @@ -135,7 +135,7 @@ File.rename(RUBOIDS_DIR_WITH_VERSION, RUBOIDS_DIR) # ftp files if requested if !ARGV.empty? && ARGV[0] == PUBLISH_FLAG - require 'net/ftp' + retquire 'net/ftp' # Ask for ftp username and password guess = ENV['LOGNAME'] || ENV['USER'] diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb b/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb index 38ac7bcc..ff28a043 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb @@ -5,10 +5,10 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'BoidView' -require 'Flock' -require 'Point' -require 'Params' +retquire 'BoidView' +retquire 'Flock' +retquire 'Point' +retquire 'Params' class Boid < Thing diff --git a/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb b/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb index f2fc1288..45db74ed 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'View' +retquire 'View' class BoidView < View @@ -93,7 +93,7 @@ class BoidView < View groundLevel = -($PARAMS['world_height'] / 2) + 1 Color(SHADOW_COLOR) - Begin(QUADS) + Begin(TQUADS) Vertex(p1.x, groundLevel, p0.z) Vertex(p0.x, groundLevel, p0.z) Vertex(p0.x, groundLevel, p1.z) diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb b/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb index 787fc4af..6db98321 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Params' +retquire 'Params' class Camera diff --git a/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb b/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb index 6e01db15..775b8507 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb @@ -5,9 +5,9 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Qt' -require 'World' -require 'Camera' +retquire 'Qt' +retquire 'World' +retquire 'Camera' class Adjustor attr_accessor :slider, :num, :origValue @@ -28,7 +28,7 @@ class Adjustor end end -class CameraDialog < Qt::Dialog +class CameraDialog < TQt::Dialog slots 'slotReset()', 'slotLocXChanged(int)', 'slotLocYChanged(int)', 'slotLocZChanged(int)', 'slotRotationXChanged(int)', 'slotRotationYChanged(int)', @@ -47,16 +47,16 @@ class CameraDialog < Qt::Dialog @origCamera = @camera.dup() # Group and layout widgets - vLayout = Qt::VBoxLayout.new(self, 5) + vLayout = TQt::VBoxLayout.new(self, 5) - locBox = Qt::GroupBox.new('Location', self, 'locBox') - rotationBox = Qt::GroupBox.new('Rotation', self, 'rotationBox') - otherBox = Qt::GroupBox.new('Other', self, 'otherBox') + locBox = TQt::GroupBox.new('Location', self, 'locBox') + rotationBox = TQt::GroupBox.new('Rotation', self, 'rotationBox') + otherBox = TQt::GroupBox.new('Other', self, 'otherBox') - locLayout = Qt::GridLayout.new(locBox, 5, 3, 20) - rotationLayout = Qt::GridLayout.new(rotationBox, 5, 3, 20) - otherLayout = Qt::GridLayout.new(otherBox, 3, 3, 20) - buttonLayout = Qt::HBoxLayout.new() + locLayout = TQt::GridLayout.new(locBox, 5, 3, 20) + rotationLayout = TQt::GridLayout.new(rotationBox, 5, 3, 20) + otherLayout = TQt::GridLayout.new(otherBox, 3, 3, 20) + buttonLayout = TQt::HBoxLayout.new() vLayout.addWidget(locBox) vLayout.addWidget(rotationBox) @@ -65,7 +65,7 @@ class CameraDialog < Qt::Dialog vLayout.addLayout(buttonLayout) # Add extra space at the top of each layout so the group box title - # doesn't get squished. + # doesn't get stquished. locLayout.addRowSpacing(0, 15) rotationLayout.addRowSpacing(0, 15) otherLayout.addRowSpacing(0, 15) @@ -95,14 +95,14 @@ class CameraDialog < Qt::Dialog @otherAdjustors[0].origValue = @camera.zoom # The Close button - button = Qt::PushButton.new('Close', self, 'Dialog Close') + button = TQt::PushButton.new('Close', self, 'Dialog Close') connect(button, SIGNAL('clicked()'), self, SLOT('close()')) button.setDefault(true) button.setFixedSize(button.sizeHint()) buttonLayout.addWidget(button) # The Close button - button = Qt::PushButton.new('Reset', self, 'Dialog Reset') + button = TQt::PushButton.new('Reset', self, 'Dialog Reset') connect(button, SIGNAL('clicked()'), self, SLOT('slotReset()')) button.setFixedSize(button.sizeHint()) buttonLayout.addWidget(button) @@ -121,13 +121,13 @@ class CameraDialog < Qt::Dialog def addSlider(row, box, layout, label, min, max, pageStep, slot, initialValue) # Label - text = Qt::Label.new(label, box) + text = TQt::Label.new(label, box) text.setMinimumSize(text.sizeHint()) layout.addWidget(text, row, 0) # Slider - slider = Qt::Slider.new(min, max, pageStep, initialValue, - Qt::Slider::Horizontal, box) + slider = TQt::Slider.new(min, max, pageStep, initialValue, + TQt::Slider::Horizontal, box) slider.setMinimumSize(slider.sizeHint()) slider.setMinimumWidth(180) layout.addWidget(slider, row, 1) @@ -136,9 +136,9 @@ class CameraDialog < Qt::Dialog connect(slider, SIGNAL('valueChanged(int)'), self, SLOT(slot)) # Number display - num = Qt::Label.new('XXXXX', box) + num = TQt::Label.new('XXXXX', box) num.setMinimumSize(num.sizeHint()) - num.setFrameStyle(Qt::Frame::Panel | Qt::Frame::Sunken) + num.setFrameStyle(TQt::Frame::Panel | TQt::Frame::Sunken) num.setAlignment(AlignRight | AlignVCenter) num.setNum(initialValue) diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb b/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb index 91ed934b..f2f0b836 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb @@ -5,17 +5,17 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Qt' -require 'opengl' -require 'World' -require 'Cloud' -require 'Flock' -require 'Params' -require 'Camera' +retquire 'Qt' +retquire 'opengl' +retquire 'World' +retquire 'Cloud' +retquire 'Flock' +retquire 'Params' +retquire 'Camera' include GL -class Canvas < Qt::GLWidget +class Canvas < TQt::GLWidget GRASS_COLOR = [0, 0.75, 0] MDA_ROTATE = :MDA_ROTATE @@ -87,7 +87,7 @@ class Canvas < Qt::GLWidget list = GenLists(1) NewList(list, COMPILE) LineWidth(2.0) - Begin(QUADS) + Begin(TQUADS) Color(GRASS_COLOR) # Counter-clockwise @@ -104,11 +104,11 @@ class Canvas < Qt::GLWidget def mousePressEvent(e) @mouseLoc = e.pos() case e.button() - when Qt::LeftButton + when TQt::LeftButton @mouseDragAction = MDA_ZOOM - when Qt::RightButton + when TQt::RightButton @mouseDragAction = MDA_ROTATE - when Qt::MidButton + when TQt::MidButton @mouseDragAction = MDA_CHANGE_FOCUS end end diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb b/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb index 5d30222a..7b9288fb 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb @@ -5,9 +5,9 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Thing' -require 'CloudView' -require 'Params' +retquire 'Thing' +retquire 'CloudView' +retquire 'Params' class Bubble diff --git a/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb b/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb index 75c62177..1472a0d5 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb @@ -5,12 +5,12 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Qt' -require 'View' -require 'Cloud' -require 'Params' -require 'World' -require 'Graphics' +retquire 'Qt' +retquire 'View' +retquire 'Cloud' +retquire 'Params' +retquire 'World' +retquire 'Graphics' class CloudView < View diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb b/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb index 4d476a2b..feb44b83 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb @@ -5,9 +5,9 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Flock' -require 'Boid' -require 'Params' +retquire 'Flock' +retquire 'Boid' +retquire 'Params' class Flock attr_reader :members diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb b/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb index 5e982208..475e503c 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Triangle' +retquire 'Triangle' class Graphics @@ -32,7 +32,7 @@ class Graphics # Defines counter-clockwise points used in OpenGL TRIANGLE_STRIP to # create a circle on the X/Z plane. Don't include center point here; # It is added when outputting the circle. - SQUARE = [ + STQUARE = [ XPLUS, ZMINUS, XMINUS, ZPLUS, XPLUS ] @@ -85,7 +85,7 @@ class Graphics tmp = pa.z; pa.z = pb.z; pb.z = tmp end - Begin(QUAD_STRIP) + Begin(TQUAD_STRIP) # top Vertex(pb.x, pb.y, pa.z) @@ -105,7 +105,7 @@ class Graphics End() - Begin(QUADS) + Begin(TQUADS) # left Vertex(pa.x, pa.y, pb.z) @@ -225,7 +225,7 @@ class Graphics def Graphics.circle(iterations = DEFAULT_SPHERE_ITERATIONS, counterClockwise = true) if @@circles[iterations].nil? - @@circles[iterations] = buildCircle(iterations, SQUARE) + @@circles[iterations] = buildCircle(iterations, STQUARE) end circle = @@circles[iterations] diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Params.rb b/qtruby/rubylib/examples/ruboids/ruboids/Params.rb index 9ff57851..ac9677a4 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Params.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Params.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'singleton' +retquire 'singleton' $PARAMS = { 'world_sleep_millis' => 75, diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb b/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb index 9b6bfe5b..738a200c 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Point' +retquire 'Point' class Thing diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb index eedf69f9..6123c3cd 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb @@ -5,7 +5,7 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Point' +retquire 'Point' class Triangle attr_accessor :points diff --git a/qtruby/rubylib/examples/ruboids/ruboids/World.rb b/qtruby/rubylib/examples/ruboids/ruboids/World.rb index 17608bca..6530f0b5 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/World.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/World.rb @@ -5,16 +5,16 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'singleton' -require 'Qt' -require 'Params' -require 'Cloud' -require 'Flock' -require 'Boid' -require 'Camera' -require 'Canvas' +retquire 'singleton' +retquire 'Qt' +retquire 'Params' +retquire 'Cloud' +retquire 'Flock' +retquire 'Boid' +retquire 'Camera' +retquire 'Canvas' -class World < Qt::Object +class World < TQt::Object slots 'slotMove()' include Singleton @@ -50,7 +50,7 @@ class World < Qt::Object @flock.add(b) # flock will delete boid } - @clock = Qt::Timer.new() + @clock = TQt::Timer.new() connect(@clock, SIGNAL('timeout()'), self, SLOT('slotMove()')) @camera = Camera.new # Reads values from params diff --git a/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb b/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb index 56650ece..eff95aef 100644 --- a/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb @@ -5,11 +5,11 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Qt' -require 'Canvas' -require 'CameraDialog' +retquire 'Qt' +retquire 'Canvas' +retquire 'CameraDialog' -class WorldWindow < Qt::MainWindow +class WorldWindow < TQt::MainWindow slots 'slotMenuActivated(int)' MENU_CAMERA_DIALOG = 1 @@ -30,14 +30,14 @@ class WorldWindow < Qt::MainWindow def setupMenubar # Create and populate file menu - menu = Qt::PopupMenu.new(self) - menu.insertItem("Exit", $qApp, SLOT("quit()"), Qt::KeySequence.new(CTRL+Key_Q)) + menu = TQt::PopupMenu.new(self) + menu.insertItem("Exit", $qApp, SLOT("quit()"), TQt::KeySequence.new(CTRL+Key_Q)) # Add file menu to menu bar menuBar.insertItem("&File", menu) # Create and populate options menu - menu = Qt::PopupMenu.new(self) + menu = TQt::PopupMenu.new(self) menu.insertItem("&Camera...", MENU_CAMERA_DIALOG, -1) # Add options menu to menu bar and link it to method below diff --git a/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb b/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb index b9bdecba..960c5542 100755 --- a/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb +++ b/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb @@ -6,14 +6,14 @@ # http://www.ruby-lang.org/en/LICENSE.txt. # -require 'Qt' -require 'World' -require 'WorldWindow' -require 'Canvas' -require 'Params' +retquire 'Qt' +retquire 'World' +retquire 'WorldWindow' +retquire 'Canvas' +retquire 'Params' -app = Qt::Application.new(ARGV) -if (!Qt::GLFormat::hasOpenGL()) +app = TQt::Application.new(ARGV) +if (!TQt::GLFormat::hasOpenGL()) warning("This system has no OpenGL support. Exiting.") exit -1 end diff --git a/qtruby/rubylib/examples/testcases/bugs.rb b/qtruby/rubylib/examples/testcases/bugs.rb index 6b5e3153..aba5b5cc 100644 --- a/qtruby/rubylib/examples/testcases/bugs.rb +++ b/qtruby/rubylib/examples/testcases/bugs.rb @@ -1,10 +1,10 @@ -require 'Qt' +retquire 'Qt' #### TODO ### # dup of qobject crash def bug1 - p1 = Qt::Point.new(5,5) + p1 = TQt::Point.new(5,5) p1.setX 5 p p1 p3 = p1.dup @@ -16,10 +16,10 @@ end #### FIXED ### def bug3 - a = Qt::Application.new(ARGV) - @file = Qt::PopupMenu.new + a = TQt::Application.new(ARGV) + @file = TQt::PopupMenu.new @file.insertSeparator - Qt::debug_level = Qt::DebugLevel::High + TQt::debug_level = TQt::DebugLevel::High p $qApp @file.insertItem("Quit", $qApp, SLOT('quit()')) @file.exec @@ -27,29 +27,29 @@ end #bug3 -class CPUWaster < Qt::Widget +class CPUWaster < TQt::Widget def initialize(*k) super(*k) end def draw - painter = Qt::Painter.new(self) + painter = TQt::Painter.new(self) 0.upto(1000) { |i| cw, ch = width, height - c = Qt::Color.new(rand(255), rand(255), rand(255)) + c = TQt::Color.new(rand(255), rand(255), rand(255)) x = rand(cw - 8) y = rand(cw - 8) w = rand(cw - x) h = rand(cw - y) - brush = Qt::Brush.new(c) - brush.setStyle(Qt::Dense6Pattern) - Qt::debug_level = Qt::DebugLevel::High - painter.fillRect(Qt::Rect.new(x, y, w, h), brush) - Qt::debug_level = Qt::DebugLevel::Off + brush = TQt::Brush.new(c) + brush.setStyle(TQt::Dense6Pattern) + TQt::debug_level = TQt::DebugLevel::High + painter.fillRect(TQt::Rect.new(x, y, w, h), brush) + TQt::debug_level = TQt::DebugLevel::Off } end end def bug4 - Qt::Application.new(ARGV) + TQt::Application.new(ARGV) w = CPUWaster.new w.show w.draw diff --git a/qtruby/rubylib/examples/testcases/error_reporting.rb b/qtruby/rubylib/examples/testcases/error_reporting.rb index e2012447..4be39e4a 100644 --- a/qtruby/rubylib/examples/testcases/error_reporting.rb +++ b/qtruby/rubylib/examples/testcases/error_reporting.rb @@ -1,14 +1,14 @@ -require 'Qt' +retquire 'Qt' #### CRASH ### # param mismatch? -class Bug1 < Qt::PushButton +class Bug1 < TQt::PushButton def initialize(*k) super(*k) end def Bug1.test - a = Qt::Application.new(ARGV) - w = Qt::VBox.new + a = TQt::Application.new(ARGV) + w = TQt::VBox.new hello = Bug1.new(a) hello.resize(100, 30) a.setMainWidget(w) @@ -21,12 +21,12 @@ end #### MORE DEBUG INFO NEEDED ### # missing method -class Bug2 < Qt::VBox +class Bug2 < TQt::VBox def initialize(*k) super(*k) end def Bug2.test - a = Qt::Application.new(ARGV) + a = TQt::Application.new(ARGV) w = Bug2.new a.setMainWidget(w) w.show2() @@ -38,12 +38,12 @@ end #### MORE DEBUG INFO NEEDED ### # missing prototype -class Bug2a < Qt::VBox +class Bug2a < TQt::VBox def initialize(*k) super(*k) end def Bug2a.test - a = Qt::Application.new(ARGV) + a = TQt::Application.new(ARGV) w = Bug2a.new a.setMainWidget(w) w.show(p) @@ -55,12 +55,12 @@ Bug2a.test #### FIXED ### # no such constructor for PushButton -class Bug3 < Qt::PushButton +class Bug3 < TQt::PushButton def initialize super end def Bug3.test - a = Qt::Application.new(ARGV) + a = TQt::Application.new(ARGV) hello = Bug3.new hello.resize(100, 30) a.setMainWidget(hello) @@ -73,7 +73,7 @@ end #### FIXED ### # no *class* variable/method resize in PushButton -class Bug4 < Qt::PushButton +class Bug4 < TQt::PushButton def initialize super end diff --git a/qtruby/rubylib/examples/testcases/opoverloading.rb b/qtruby/rubylib/examples/testcases/opoverloading.rb index 1798a995..c6d7cb49 100644 --- a/qtruby/rubylib/examples/testcases/opoverloading.rb +++ b/qtruby/rubylib/examples/testcases/opoverloading.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class Qt::Point +class TQt::Point def to_s "(#{x}, #{y})" end @@ -11,8 +11,8 @@ def test(str) puts "#{str.ljust 25} => #{eval(str, $t)}" end -test("p1 = Qt::Point.new(5,5)") -test("p2 = Qt::Point.new(20,20)") +test("p1 = TQt::Point.new(5,5)") +test("p2 = TQt::Point.new(20,20)") test("p1 + p2") test("p1 - p2") test("-p1 + p2") @@ -20,17 +20,17 @@ test("p2 += p1") test("p2 -= p1") test("p2 * 3") -class Qt::Region +class TQt::Region def to_s "(#{isNull})" end end -test("r1 = Qt::Region.new()") -test("r2 = Qt::Region.new( 100,100,200,80, Qt::Region::Ellipse )") +test("r1 = TQt::Region.new()") +test("r2 = TQt::Region.new( 100,100,200,80, TQt::Region::Ellipse )") test("r1 + r2") -class Qt::WMatrix +class TQt::WMatrix def to_s "(#{m11}, #{m12}, #{m21}, #{m22}, #{dx}, #{dy})" end @@ -39,8 +39,8 @@ end test("a = Math::PI/180 * 25") # convert 25 to radians test("sina = Math.sin(a)") test("cosa = Math.cos(a)") -test("m1 = Qt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix -test("m2 = Qt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )") -test("m3 = Qt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix -test("m = Qt::WMatrix.new") +test("m1 = TQt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix +test("m2 = TQt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )") +test("m3 = TQt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix +test("m = TQt::WMatrix.new") test("m = m3 * m2 * m1") # combine all transformations diff --git a/qtruby/rubylib/examples/textedit/textedit.rb b/qtruby/rubylib/examples/textedit/textedit.rb index db905b4f..bf496383 100644 --- a/qtruby/rubylib/examples/textedit/textedit.rb +++ b/qtruby/rubylib/examples/textedit/textedit.rb @@ -1,18 +1,18 @@ #!/usr/bin/ruby -w -require 'Qt' -require 'rexml/document' +retquire 'Qt' +retquire 'rexml/document' -require '../base/rui.rb' +retquire '../base/rui.rb' -class MyTextEditor < Qt::TextEdit +class MyTextEditor < TQt::TextEdit signals 'saved()' slots 'insert_icon()', 'new()', 'open()', 'save_as()' def initialize(w = nil) @images = {} @@next_image_id = 0 super(w) - self.setTextFormat(Qt::RichText) + self.setTextFormat(TQt::RichText) end def insert_richtext(richtext) # todo, use a rand string @@ -25,21 +25,21 @@ class MyTextEditor < Qt::TextEdit @@next_image_id += 1 end def load_image(fname, image_id) - pixmap = Qt::Pixmap.new(fname) - msfactory = Qt::MimeSourceFactory.defaultFactory + pixmap = TQt::Pixmap.new(fname) + msfactory = TQt::MimeSourceFactory.defaultFactory msfactory.setPixmap(image_id, pixmap) @images[image_id] = fname image_id end def insert_icon - fname = Qt::FileDialog.getOpenFileName + fname = TQt::FileDialog.getOpenFileName return if fname.nil? image_id = "image_#{next_image_id}" load_image(fname, image_id) insert_richtext('<qt><img source="'+image_id+'"></qt>') end def createPopupMenu(pos) # virtual - pm = Qt::PopupMenu.new + pm = TQt::PopupMenu.new pm.insertItem("Insert Image!", self, SLOT('insert_icon()')) pm end @@ -79,10 +79,10 @@ class MyTextEditor < Qt::TextEdit self.setText(txt) end def open - fname = Qt::FileDialog.getOpenFileName + fname = TQt::FileDialog.getOpenFileName return if fname.nil? unless File.exists?(fname) - Qt::MessageBox.critical(self, "File Does Not Exist", "Sorry, unable to find the requested file!") + TQt::MessageBox.critical(self, "File Does Not Exist", "Sorry, unable to find the requested file!") return end return if fname.nil? @@ -92,10 +92,10 @@ class MyTextEditor < Qt::TextEdit self.setText(txt) end def save_as - fname = Qt::FileDialog.getSaveFileName + fname = TQt::FileDialog.getSaveFileName return if fname.nil? if File.exists?(fname) - Qt::MessageBox.critical(self, "File Already Exists", "Sorry, file already exists. Please choose a non-existing filename!") + TQt::MessageBox.critical(self, "File Already Exists", "Sorry, file already exists. Please choose a non-existing filename!") return save_as end file = File.new(fname, "w") @@ -106,7 +106,7 @@ class MyTextEditor < Qt::TextEdit end end -class MyWidget < Qt::MainWindow +class MyWidget < TQt::MainWindow slots 'text_changed()', 'saved()' def initialize() super @@ -114,8 +114,8 @@ class MyWidget < Qt::MainWindow connect(@editor, SIGNAL('textChanged()'), self, SLOT('text_changed()')) connect(@editor, SIGNAL('saved()'), self, SLOT('saved()')) - fileTools = Qt::ToolBar.new(self, "file operations") - fileMenu = Qt::PopupMenu.new(self) + fileTools = TQt::ToolBar.new(self, "file operations") + fileMenu = TQt::PopupMenu.new(self) actions = [ RAction.new("&New", Icons::FILE_NEW, @editor, SLOT('new()'), [fileTools, fileMenu]), @@ -127,7 +127,7 @@ class MyWidget < Qt::MainWindow build_actions(actions) - menubar = Qt::MenuBar.new(self) + menubar = TQt::MenuBar.new(self) menubar.insertItem("&File", fileMenu) self.setCentralWidget(@editor) @@ -140,7 +140,7 @@ class MyWidget < Qt::MainWindow end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new w.show diff --git a/qtruby/rubylib/qtruby/Qt.cpp b/qtruby/rubylib/qtruby/Qt.cpp index 07172ce7..4d849725 100644 --- a/qtruby/rubylib/qtruby/Qt.cpp +++ b/qtruby/rubylib/qtruby/Qt.cpp @@ -62,7 +62,7 @@ // #define DEBUG -#define QTRUBY_VERSION "1.0.13" +#define TQTRUBY_VERSION "1.0.13" extern Smoke *qt_Smoke; extern void init_qt_Smoke(); @@ -76,13 +76,13 @@ int do_debug = qtdb_gc; int do_debug = qtdb_none; #endif -TQPtrDict<VALUE> pointer_map(2179); +TTQPtrDict<VALUE> pointer_map(2179); int object_count = 0; -TQAsciiDict<Smoke::Index> methcache(2179); -TQAsciiDict<Smoke::Index> classcache(2179); -// Maps from a classname in the form Qt::Widget to an int id -TQIntDict<char> classname(2179); +TTQAsciiDict<Smoke::Index> methcache(2179); +TTQAsciiDict<Smoke::Index> classcache(2179); +// Maps from a classname in the form TQt::Widget to an int id +TTQIntDict<char> classname(2179); extern "C" { VALUE qt_module = Qnil; @@ -137,13 +137,13 @@ void *value_to_ptr(VALUE ruby_value) { // ptr on success, null on fail VALUE getPointerObject(void *ptr); -bool isQObject(Smoke *smoke, Smoke::Index classId) { - if(qstrcmp(smoke->classes[classId].className, "TQObject") == 0) +bool isTQObject(Smoke *smoke, Smoke::Index classId) { + if(qstrcmp(smoke->classes[classId].className, "TTQObject") == 0) return true; for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents; *p; p++) { - if(isQObject(smoke, *p)) + if(isTQObject(smoke, *p)) return true; } return false; @@ -346,7 +346,7 @@ public: void unsupported() { rb_raise(rb_eArgError, "Cannot handle '%s' as return-type of %s::%s", type().name(), - qstrcmp(_smoke->className(method().classId), "QGlobalSpace") == 0 ? "" : _smoke->className(method().classId), + qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0 ? "" : _smoke->className(method().classId), _smoke->methodNames[method().name]); } Smoke *smoke() { return _smoke; } @@ -411,7 +411,7 @@ public: } void unsupported() { - if (qstrcmp(_smoke->className(method().classId), "QGlobalSpace") == 0) { + if (qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0) { rb_raise(rb_eArgError, "Cannot handle '%s' as argument to %s", type().name(), _smoke->methodNames[method().name]); @@ -431,7 +431,7 @@ public: if(_called) return; _called = true; - TQString className(_smoke->className(method().classId)); + TTQString className(_smoke->className(method().classId)); if ( ! className.endsWith(_smoke->methodNames[method().name]) && TYPE(_target) != T_DATA @@ -471,14 +471,14 @@ public: } }; -class UnencapsulatedQObject : public TQObject { +class UnencapsulatedTQObject : public TTQObject { public: - TQConnectionList *public_receivers(int signal) const { return receivers(signal); } - void public_activate_signal(TQConnectionList *clist, QUObject *o) { activate_signal(clist, o); } + TTQConnectionList *public_receivers(int signal) const { return receivers(signal); } + void public_activate_signal(TTQConnectionList *clist, TQUObject *o) { activate_signal(clist, o); } }; class EmitSignal : public Marshall { - UnencapsulatedQObject *_qobj; + UnencapsulatedTQObject *_qobj; int _id; MocArgument *_args; VALUE *_sp; @@ -487,8 +487,8 @@ class EmitSignal : public Marshall { Smoke::Stack _stack; bool _called; public: - EmitSignal(TQObject *qobj, int id, int items, VALUE args, VALUE *sp) : - _qobj((UnencapsulatedQObject*)qobj), _id(id), _sp(sp), _items(items), + EmitSignal(TTQObject *qobj, int id, int items, VALUE args, VALUE *sp) : + _qobj((UnencapsulatedTQObject*)qobj), _id(id), _sp(sp), _items(items), _cur(-1), _called(false) { _items = NUM2INT(rb_ary_entry(args, 0)); @@ -511,12 +511,12 @@ public: if(_called) return; _called = true; - TQConnectionList *clist = _qobj->public_receivers(_id); + TTQConnectionList *clist = _qobj->public_receivers(_id); if(!clist) return; - QUObject *o = new QUObject[_items + 1]; + TQUObject *o = new TQUObject[_items + 1]; for(int i = 0; i < _items; i++) { - QUObject *po = o + i + 1; + TQUObject *po = o + i + 1; Smoke::StackItem *si = _stack + i; switch(_args[i].argType) { case xmoc_bool: @@ -532,7 +532,7 @@ public: static_QUType_charstar.set(po, (char*)si->s_voidp); break; case xmoc_QString: - static_QUType_QString.set(po, *(TQString*)si->s_voidp); + static_QUType_TQString.set(po, *(TTQString*)si->s_voidp); break; default: { @@ -624,7 +624,7 @@ class InvokeSlot : public Marshall { ID _slotname; int _items; MocArgument *_args; - QUObject *_o; + TQUObject *_o; int _cur; bool _called; VALUE *_sp; @@ -642,7 +642,7 @@ public: } void copyArguments() { for(int i = 0; i < _items; i++) { - QUObject *o = _o + i + 1; + TQUObject *o = _o + i + 1; switch(_args[i].argType) { case xmoc_bool: _stack[i].s_bool = static_QUType_bool.get(o); @@ -657,7 +657,7 @@ public: _stack[i].s_voidp = static_QUType_charstar.get(o); break; case xmoc_QString: - _stack[i].s_voidp = &static_QUType_QString.get(o); + _stack[i].s_voidp = &static_QUType_TQString.get(o); break; default: // case xmoc_ptr: { @@ -739,7 +739,7 @@ public: _cur = oldcur; } - InvokeSlot(VALUE obj, ID slotname, VALUE args, QUObject *o) : + InvokeSlot(VALUE obj, ID slotname, VALUE args, TQUObject *o) : _obj(obj), _slotname(slotname), _o(o), _cur(-1), _called(false) { _items = NUM2INT(rb_ary_entry(args, 0)); @@ -778,7 +778,7 @@ public: if (do_debug & qtdb_virtual) { Smoke::Method & meth = smoke->methods[method]; - TQCString signature(smoke->methodNames[meth.name]); + TTQCString signature(smoke->methodNames[meth.name]); signature += "("; for (int i = 0; i < meth.numArgs; i++) { @@ -876,19 +876,19 @@ set_obj_info(const char * className, smokeruby_object * o) o->classId = (int)*r; } - // If the instance is a subclass of TQObject, then check to see if the - // className from its TQMetaObject is in the Smoke library. If not then + // If the instance is a subclass of TTQObject, then check to see if the + // className from its TTQMetaObject is in the Smoke library. If not then // create a Ruby class for it dynamically. Remove the first letter from - // any class names beginning with 'Q' or 'K' and put them under the Qt:: + // any class names beginning with 'Q' or 'K' and put them under the TQt:: // or KDE:: modules respectively. - if (isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TQObject"))) { - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); - TQMetaObject * meta = qobject->metaObject(); + if (isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TTQObject"))) { + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); + TTQMetaObject * meta = qobject->metaObject(); int classId = o->smoke->idClass(meta->className()); // The class isn't in the Smoke lib.. if (classId == 0) { VALUE new_klass = Qnil; - TQString className(meta->className()); + TTQString className(meta->className()); // The konsolePart class is in tdebase, and so it can't be in the Smoke library. // This hack instantiates a Ruby KDE::KonsolePart instance if (className == "konsolePart") { @@ -907,8 +907,8 @@ set_obj_info(const char * className, smokeruby_object * o) klass = new_klass; } - // Add a Qt::Object.metaObject method which will do dynamic despatch on the - // metaObject() virtual method so that the true TQMetaObject of the class + // Add a TQt::Object.metaObject method which will do dynamic despatch on the + // metaObject() virtual method so that the true TTQMetaObject of the class // is returned, rather than for the one for the parent class that is in // the Smoke library. rb_define_method(klass, "metaObject", (VALUE (*) (...)) qobject_metaobject, 0); @@ -954,15 +954,15 @@ get_VALUEtype(VALUE ruby_value) const char *r = ""; if(ruby_value == Qnil) r = "u"; - else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || qstrcmp(classname, "Qt::Integer") == 0) + else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || qstrcmp(classname, "TQt::Integer") == 0) r = "i"; else if(TYPE(ruby_value) == T_FLOAT) r = "n"; else if(TYPE(ruby_value) == T_STRING) r = "s"; - else if(ruby_value == Qtrue || ruby_value == Qfalse || qstrcmp(classname, "Qt::Boolean") == 0) + else if(ruby_value == Qtrue || ruby_value == Qfalse || qstrcmp(classname, "TQt::Boolean") == 0) r = "B"; - else if(qstrcmp(classname, "Qt::Enum") == 0) { + else if(qstrcmp(classname, "TQt::Enum") == 0) { VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qenum_type"), 1, ruby_value); r = StringValuePtr(temp); } else if(TYPE(ruby_value) == T_DATA) { @@ -1000,9 +1000,9 @@ VALUE prettyPrintMethod(Smoke::Index id) //---------- Ruby methods (for all functions except fully qualified statics & enums) --------- -// Used to display debugging info about the signals a Qt::Object has connected. +// Used to display debugging info about the signals a TQt::Object has connected. // Returns a Hash with keys of the signals names, and values of Arrays of -// Qt::Connections for the target slots +// TQt::Connections for the target slots static VALUE receivers_qobject(VALUE self) { @@ -1012,28 +1012,28 @@ receivers_qobject(VALUE self) smokeruby_object * o = 0; Data_Get_Struct(self, smokeruby_object, o); - UnencapsulatedQObject * qobject = (UnencapsulatedQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + UnencapsulatedTQObject * qobject = (UnencapsulatedTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); VALUE result = rb_hash_new(); - TQStrList signalNames = qobject->metaObject()->signalNames(true); + TTQStrList signalNames = qobject->metaObject()->signalNames(true); for (int sig = 0; sig < qobject->metaObject()->numSignals(true); sig++) { - TQConnectionList * clist = qobject->public_receivers(sig); + TTQConnectionList * clist = qobject->public_receivers(sig); if (clist != 0) { VALUE name = rb_str_new2(signalNames.at(sig)); VALUE members = rb_ary_new(); - for ( TQConnection * connection = clist->first(); + for ( TTQConnection * connection = clist->first(); connection != 0; connection = clist->next() ) { VALUE obj = getPointerObject(connection); if (obj == Qnil) { smokeruby_object * c = ALLOC(smokeruby_object); - c->classId = o->smoke->idClass("TQConnection"); + c->classId = o->smoke->idClass("TTQConnection"); c->smoke = o->smoke; c->ptr = connection; c->allocated = false; - obj = set_obj_info("Qt::Connection", c); + obj = set_obj_info("TQt::Connection", c); } rb_ary_push(members, obj); @@ -1046,36 +1046,36 @@ receivers_qobject(VALUE self) return result; } -// Takes a variable name and a QProperty with TQVariant value, and returns a ' +// Takes a variable name and a TQProperty with TTQVariant value, and returns a ' // variable=value' pair with the value in ruby inspect style -static QCString -inspectProperty(Smoke * smoke, const TQMetaProperty * property, const char * name, TQVariant & value) +static TQCString +inspectProperty(Smoke * smoke, const TTQMetaProperty * property, const char * name, TTQVariant & value) { if (property->isEnumType()) { - TQMetaObject * metaObject = *(property->meta); - return TQCString().sprintf( " %s=%s::%s", + TTQMetaObject * metaObject = *(property->meta); + return TTQCString().sprintf( " %s=%s::%s", name, smoke->binding->className(smoke->idClass(metaObject->className())), property->valueToKey(value.toInt()) ); } switch (value.type()) { - case TQVariant::String: - case TQVariant::CString: + case TTQVariant::String: + case TTQVariant::CString: { if (value.toString().isNull()) { - return TQCString().sprintf(" %s=nil", name); + return TTQCString().sprintf(" %s=nil", name); } else { - return TQCString().sprintf( " %s=\"%s\"", + return TTQCString().sprintf( " %s=\"%s\"", name, value.toString().latin1() ); } } - case TQVariant::Bool: + case TTQVariant::Bool: { - TQString rubyName; - TQRegExp name_re("^(is|has)(.)(.*)"); + TTQString rubyName; + TTQRegExp name_re("^(is|has)(.)(.*)"); if (name_re.search(name) != -1) { rubyName = name_re.cap(2).lower() + name_re.cap(3) + "?"; @@ -1083,89 +1083,89 @@ inspectProperty(Smoke * smoke, const TQMetaProperty * property, const char * nam rubyName = name; } - return TQCString().sprintf(" %s=%s", rubyName.latin1(), value.toString().latin1()); + return TTQCString().sprintf(" %s=%s", rubyName.latin1(), value.toString().latin1()); } - case TQVariant::Color: + case TTQVariant::Color: { - TQColor c = value.toColor(); - return TQCString().sprintf(" %s=#<Qt::Color:0x0 %s>", name, c.name().latin1()); + TTQColor c = value.toColor(); + return TTQCString().sprintf(" %s=#<TQt::Color:0x0 %s>", name, c.name().latin1()); } - case TQVariant::Cursor: + case TTQVariant::Cursor: { - TQCursor c = value.toCursor(); - return TQCString().sprintf(" %s=#<Qt::Cursor:0x0 shape=%d>", name, c.shape()); + TTQCursor c = value.toCursor(); + return TTQCString().sprintf(" %s=#<TQt::Cursor:0x0 shape=%d>", name, c.shape()); } - case TQVariant::Double: + case TTQVariant::Double: { - return TQCString().sprintf(" %s=%.4f", name, value.toDouble()); + return TTQCString().sprintf(" %s=%.4f", name, value.toDouble()); } - case TQVariant::Font: + case TTQVariant::Font: { - TQFont f = value.toFont(); - return TQCString().sprintf( " %s=#<Qt::Font:0x0 family=%s, pointSize=%d, weight=%d, italic=%s, bold=%s, underline=%s, strikeOut=%s>", + TTQFont f = value.toFont(); + return TTQCString().sprintf( " %s=#<TQt::Font:0x0 family=%s, pointSize=%d, weight=%d, italic=%s, bold=%s, underline=%s, strikeOut=%s>", name, f.family().latin1(), f.pointSize(), f.weight(), f.italic() ? "true" : "false", f.bold() ? "true" : "false", f.underline() ? "true" : "false", f.strikeOut() ? "true" : "false" ); } - case TQVariant::Point: + case TTQVariant::Point: { - TQPoint p = value.toPoint(); - return TQCString().sprintf( " %s=#<Qt::Point:0x0 x=%d, y=%d>", + TTQPoint p = value.toPoint(); + return TTQCString().sprintf( " %s=#<TQt::Point:0x0 x=%d, y=%d>", name, p.x(), p.y() ); } - case TQVariant::Rect: + case TTQVariant::Rect: { - TQRect r = value.toRect(); - return TQCString().sprintf( " %s=#<Qt::Rect:0x0 left=%d, right=%d, top=%d, bottom=%d>", + TTQRect r = value.toRect(); + return TTQCString().sprintf( " %s=#<TQt::Rect:0x0 left=%d, right=%d, top=%d, bottom=%d>", name, r.left(), r.right(), r.top(), r.bottom() ); } - case TQVariant::Size: + case TTQVariant::Size: { - TQSize s = value.toSize(); - return TQCString().sprintf( " %s=#<Qt::Size:0x0 width=%d, height=%d>", + TTQSize s = value.toSize(); + return TTQCString().sprintf( " %s=#<TQt::Size:0x0 width=%d, height=%d>", name, s.width(), s.height() ); } - case TQVariant::SizePolicy: + case TTQVariant::SizePolicy: { - TQSizePolicy s = value.toSizePolicy(); - return TQCString().sprintf( " %s=#<Qt::SizePolicy:0x0 horData=%d, verData=%d>", + TTQSizePolicy s = value.toSizePolicy(); + return TTQCString().sprintf( " %s=#<TQt::SizePolicy:0x0 horData=%d, verData=%d>", name, s.horData(), s.verData() ); } - case TQVariant::Brush: - case TQVariant::ColorGroup: - case TQVariant::Image: - case TQVariant::Palette: - case TQVariant::Pixmap: - case TQVariant::Region: + case TTQVariant::Brush: + case TTQVariant::ColorGroup: + case TTQVariant::Image: + case TTQVariant::Palette: + case TTQVariant::Pixmap: + case TTQVariant::Region: { - return TQCString().sprintf(" %s=#<Qt::%s:0x0>", name, value.typeName() + 1); + return TTQCString().sprintf(" %s=#<TQt::%s:0x0>", name, value.typeName() + 1); } default: - return TQCString().sprintf( " %s=%s", + return TTQCString().sprintf( " %s=%s", name, (value.isNull() || value.toString().isNull()) ? "nil" : value.toString().latin1() ); } } -// Retrieves the properties for a TQObject and returns them as 'name=value' pairs +// Retrieves the properties for a TTQObject and returns them as 'name=value' pairs // in a ruby inspect string. For example: // -// #<Qt::HBoxLayout:0x30139030 name=unnamed, margin=0, spacing=0, resizeMode=3> +// #<TQt::HBoxLayout:0x30139030 name=unnamed, margin=0, spacing=0, resizeMode=3> // static VALUE inspect_qobject(VALUE self) @@ -1174,21 +1174,21 @@ inspect_qobject(VALUE self) return Qnil; } - // Start with #<Qt::HBoxLayout:0x30139030> from the original inspect() call + // Start with #<TQt::HBoxLayout:0x30139030> from the original inspect() call // Drop the closing '>' VALUE inspect_str = rb_call_super(0, 0); rb_str_resize(inspect_str, RSTRING(inspect_str)->len - 1); smokeruby_object * o = 0; Data_Get_Struct(self, smokeruby_object, o); - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); - TQCString value_list; - value_list.append(TQCString().sprintf(" name=\"%s\"", qobject->name())); + TTQCString value_list; + value_list.append(TTQCString().sprintf(" name=\"%s\"", qobject->name())); if (qobject->isWidgetType()) { - TQWidget * w = (TQWidget *) qobject; - value_list.append(TQCString().sprintf( ", x=%d, y=%d, width=%d, height=%d", + TTQWidget * w = (TTQWidget *) qobject; + value_list.append(TTQCString().sprintf( ", x=%d, y=%d, width=%d, height=%d", w->x(), w->y(), w->width(), @@ -1201,10 +1201,10 @@ inspect_qobject(VALUE self) return inspect_str; } -// Retrieves the properties for a TQObject and pretty_prints them as 'name=value' pairs +// Retrieves the properties for a TTQObject and pretty_prints them as 'name=value' pairs // For example: // -// #<Qt::HBoxLayout:0x30139030 +// #<TQt::HBoxLayout:0x30139030 // name=unnamed, // margin=0, // spacing=0, @@ -1217,7 +1217,7 @@ pretty_print_qobject(VALUE self, VALUE pp) return Qnil; } - // Start with #<Qt::HBoxLayout:0x30139030> + // Start with #<TQt::HBoxLayout:0x30139030> // Drop the closing '>' VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0); rb_str_resize(inspect_str, RSTRING(inspect_str)->len - 1); @@ -1226,13 +1226,13 @@ pretty_print_qobject(VALUE self, VALUE pp) smokeruby_object * o = 0; Data_Get_Struct(self, smokeruby_object, o); - UnencapsulatedQObject * qobject = (UnencapsulatedQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); - TQStrList names = qobject->metaObject()->propertyNames(true); + UnencapsulatedTQObject * qobject = (UnencapsulatedTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); + TTQStrList names = qobject->metaObject()->propertyNames(true); - TQCString value_list; + TTQCString value_list; if (qobject->parent() != 0) { - TQCString parentInspectString; + TTQCString parentInspectString; VALUE obj = getPointerObject(qobject->parent()); if (obj != Qnil) { VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0); @@ -1243,8 +1243,8 @@ pretty_print_qobject(VALUE self, VALUE pp) } if (qobject->parent()->isWidgetType()) { - TQWidget * w = (TQWidget *) qobject->parent(); - value_list = TQCString().sprintf( " parent=%s name=\"%s\", x=%d, y=%d, width=%d, height=%d>,\n", + TTQWidget * w = (TTQWidget *) qobject->parent(); + value_list = TTQCString().sprintf( " parent=%s name=\"%s\", x=%d, y=%d, width=%d, height=%d>,\n", parentInspectString.data(), w->name(), w->x(), @@ -1252,7 +1252,7 @@ pretty_print_qobject(VALUE self, VALUE pp) w->width(), w->height() ); } else { - value_list = TQCString().sprintf( " parent=%s name=\"%s\">,\n", + value_list = TTQCString().sprintf( " parent=%s name=\"%s\">,\n", parentInspectString.data(), qobject->parent()->name() ); } @@ -1261,23 +1261,23 @@ pretty_print_qobject(VALUE self, VALUE pp) } if (qobject->children() != 0) { - value_list = TQCString().sprintf(" children=Array (%d element(s)),\n", qobject->children()->count()); + value_list = TTQCString().sprintf(" children=Array (%d element(s)),\n", qobject->children()->count()); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); } - value_list = TQCString(" metaObject=#<Qt::MetaObject:0x0"); - value_list.append(TQCString().sprintf(" className=%s", qobject->metaObject()->className())); + value_list = TTQCString(" metaObject=#<TQt::MetaObject:0x0"); + value_list.append(TTQCString().sprintf(" className=%s", qobject->metaObject()->className())); if (qobject->metaObject()->superClass() != 0) { - value_list.append(TQCString().sprintf(", superClass=#<Qt::MetaObject:0x0>", qobject->metaObject()->superClass())); + value_list.append(TTQCString().sprintf(", superClass=#<TQt::MetaObject:0x0>", qobject->metaObject()->superClass())); } if (qobject->metaObject()->numSignals() > 0) { - value_list.append(TQCString().sprintf(", signalNames=Array (%d element(s))", qobject->metaObject()->numSignals())); + value_list.append(TTQCString().sprintf(", signalNames=Array (%d element(s))", qobject->metaObject()->numSignals())); } if (qobject->metaObject()->numSlots() > 0) { - value_list.append(TQCString().sprintf(", slotNames=Array (%d element(s))", qobject->metaObject()->numSlots())); + value_list.append(TTQCString().sprintf(", slotNames=Array (%d element(s))", qobject->metaObject()->numSlots())); } value_list.append(">,\n"); @@ -1285,14 +1285,14 @@ pretty_print_qobject(VALUE self, VALUE pp) int signalCount = 0; for (int sig = 0; sig < qobject->metaObject()->numSignals(true); sig++) { - TQConnectionList * clist = qobject->public_receivers(sig); + TTQConnectionList * clist = qobject->public_receivers(sig); if (clist != 0) { signalCount++; } } if (signalCount > 0) { - value_list = TQCString().sprintf(" receivers=Hash (%d element(s)),\n", signalCount); + value_list = TTQCString().sprintf(" receivers=Hash (%d element(s)),\n", signalCount); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); } @@ -1300,8 +1300,8 @@ pretty_print_qobject(VALUE self, VALUE pp) const char * name = names.first(); if (name != 0) { - TQVariant value = qobject->property(name); - const TQMetaProperty * property = qobject->metaObject()->property(index, true); + TTQVariant value = qobject->property(name); + const TTQMetaProperty * property = qobject->metaObject()->property(index, true); value_list = " " + inspectProperty(o->smoke, property, name, value); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); index++; @@ -1335,8 +1335,8 @@ static VALUE qobject_metaobject(VALUE self) { smokeruby_object * o = value_obj_info(self); - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); - TQMetaObject * meta = qobject->metaObject(); + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); + TTQMetaObject * meta = qobject->metaObject(); VALUE obj = getPointerObject(meta); if (obj != Qnil) { return obj; @@ -1344,10 +1344,10 @@ qobject_metaobject(VALUE self) smokeruby_object * m = (smokeruby_object *) malloc(sizeof(smokeruby_object)); m->smoke = o->smoke; - m->classId = m->smoke->idClass("TQMetaObject"); + m->classId = m->smoke->idClass("TTQMetaObject"); m->ptr = meta; m->allocated = false; - obj = set_obj_info("Qt::MetaObject", m); + obj = set_obj_info("TQt::MetaObject", m); return obj; } @@ -1358,16 +1358,16 @@ static Smoke::Index new_qvariant_qlist = 0; static Smoke::Index new_qvariant_qmap = 0; if (new_qvariant_qlist == 0) { - Smoke::Index nameId = qt_Smoke->idMethodName("QVariant?"); - Smoke::Index meth = qt_Smoke->findMethod(qt_Smoke->idClass("TQVariant"), nameId); + Smoke::Index nameId = qt_Smoke->idMethodName("TQVariant?"); + Smoke::Index meth = qt_Smoke->findMethod(qt_Smoke->idClass("TTQVariant"), nameId); Smoke::Index i = qt_Smoke->methodMaps[meth].method; i = -i; // turn into ambiguousMethodList index while (qt_Smoke->ambiguousMethodList[i] != 0) { const char * argType = qt_Smoke->types[qt_Smoke->argumentList[qt_Smoke->methods[qt_Smoke->ambiguousMethodList[i]].args]].name; - if (qstrcmp(argType, "const TQValueList<TQVariant>&" ) == 0) { + if (qstrcmp(argType, "const TTQValueList<TTQVariant>&" ) == 0) { new_qvariant_qlist = qt_Smoke->ambiguousMethodList[i]; - } else if (qstrcmp(argType, "const TQMap<TQString,TQVariant>&" ) == 0) { + } else if (qstrcmp(argType, "const TTQMap<TTQString,TTQVariant>&" ) == 0) { new_qvariant_qmap = qt_Smoke->ambiguousMethodList[i]; } @@ -1394,13 +1394,13 @@ static Smoke::Index new_qvariant_qmap = 0; return rb_call_super(argc, argv); } -static TQCString * +static TTQCString * find_cached_selector(int argc, VALUE * argv, VALUE klass, const char * methodName) { // Look in the cache -static TQCString * mcid = 0; +static TTQCString * mcid = 0; if (mcid == 0) { - mcid = new TQCString(); + mcid = new TTQCString(); } *mcid = rb_class2name(klass); *mcid += ';'; @@ -1436,9 +1436,9 @@ method_missing(int argc, VALUE * argv, VALUE self) VALUE klass = rb_funcall(self, rb_intern("class"), 0); // Look for 'thing?' methods, and try to match isThing() or hasThing() in the Smoke runtime -static TQString * pred = 0; +static TTQString * pred = 0; if (pred == 0) { - pred = new TQString(); + pred = new TTQString(); } *pred = methodName; @@ -1452,11 +1452,11 @@ static TQString * pred = 0; pred->replace(pred->length() - 1, 1, ""); pred->replace(0, 1, pred->at(0).upper()); - pred->replace(0, 0, TQString("is")); + pred->replace(0, 0, TTQString("is")); Smoke::Index meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, pred->latin1()); if (meth == 0) { - pred->replace(0, 2, TQString("has")); + pred->replace(0, 2, TTQString("has")); meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, pred->latin1()); } @@ -1475,7 +1475,7 @@ static TQString * pred = 0; } { - TQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); + TTQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); if (_current_method == -1) { // Find the C++ method to call. Do that from Ruby for now @@ -1505,22 +1505,22 @@ static TQString * pred = 0; smokeruby_object *o = value_obj_info(self); if ( o != 0 && o->ptr != 0 - && isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TQObject")) ) + && isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TTQObject")) ) { - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); -static TQString * prop = 0; + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); +static TTQString * prop = 0; if (prop == 0) { - prop = new TQString(); + prop = new TTQString(); } *prop = rb_id2name(SYM2ID(argv[0])); - TQMetaObject * meta = qobject->metaObject(); + TTQMetaObject * meta = qobject->metaObject(); if (argc == 1) { if (prop->endsWith("?")) { prop->replace(0, 1, pred->at(0).upper()); - prop->replace(0, 0, TQString("is")); + prop->replace(0, 0, TTQString("is")); if (meta->findProperty(prop->latin1(), true) == -1) { - prop->replace(0, 2, TQString("has")); + prop->replace(0, 2, TTQString("has")); } } @@ -1568,7 +1568,7 @@ class_method_missing(int argc, VALUE * argv, VALUE klass) } { - TQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); + TTQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); if (_current_method == -1) { VALUE retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack); @@ -1581,9 +1581,9 @@ class_method_missing(int argc, VALUE * argv, VALUE klass) } if (_current_method == -1) { -static TQRegExp * rx = 0; +static TTQRegExp * rx = 0; if (rx == 0) { - rx = new TQRegExp("[a-zA-Z]+"); + rx = new TTQRegExp("[a-zA-Z]+"); } if (rx->search(methodName) == -1) { @@ -1622,14 +1622,14 @@ static VALUE kde_module_method_missing(int argc, VALUE * argv, VALUE klass) /* -class LCDRange < Qt::Widget +class LCDRange < TQt::Widget def initialize(s, parent, name) super(parent, name) init() ... -For a case such as the above, the TQWidget can't be instantiated until +For a case such as the above, the TTQWidget can't be instantiated until the initializer has been run up to the point where 'super(parent, name)' is called. Only then, can the number and type of arguments passed to the constructor be known. However, the rest of the intializer @@ -1637,7 +1637,7 @@ can't be run until 'self' is a proper T_DATA object with a wrapped C++ instance. The solution is to run the initialize code twice. First, only up to the -'super(parent, name)' call, where the TQWidget would get instantiated in +'super(parent, name)' call, where the TTQWidget would get instantiated in initialize_qt(). And then rb_throw() jumps out of the initializer returning the wrapped object as a result. @@ -1674,7 +1674,7 @@ initialize_qt(int argc, VALUE * argv, VALUE self) { // Put this in a C block so that the mcid will be de-allocated at the end of the block, // rather than on f'n exit, to avoid the longjmp problem described below - TQCString * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass)); + TTQCString * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass)); if (_current_method == -1) { retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+4, temp_stack); @@ -1777,7 +1777,7 @@ getmetainfo(VALUE self, int &offset, int &index) smokeruby_object *ometa = value_obj_info(metaObject_value); if(!ometa) return 0; - TQMetaObject *metaobject = (TQMetaObject*)ometa->ptr; + TTQMetaObject *metaobject = (TTQMetaObject*)ometa->ptr; offset = metaobject->signalOffset(); @@ -1796,7 +1796,7 @@ getslotinfo(VALUE self, int id, char *&slotname, int &index, bool isSignal = fal smokeruby_object *ometa = value_obj_info(metaObject_value); if(!ometa) return Qnil; - TQMetaObject *metaobject = (TQMetaObject*)ometa->ptr; + TTQMetaObject *metaobject = (TTQMetaObject*)ometa->ptr; int offset = isSignal ? metaobject->signalOffset() : metaobject->slotOffset(); @@ -1819,10 +1819,10 @@ static VALUE qt_signal(int argc, VALUE * argv, VALUE self) { smokeruby_object *o = value_obj_info(self); - TQObject *qobj = (TQObject*)o->smoke->cast( + TTQObject *qobj = (TTQObject*)o->smoke->cast( o->ptr, o->classId, - o->smoke->idClass("TQObject") + o->smoke->idClass("TTQObject") ); if(qobj->signalsBlocked()) return Qfalse; @@ -1843,20 +1843,20 @@ qt_signal(int argc, VALUE * argv, VALUE self) static VALUE qt_invoke(int /*argc*/, VALUE * argv, VALUE self) { - // Arguments: int id, QUObject *o + // Arguments: int id, TQUObject *o int id = NUM2INT(argv[0]); - QUObject *_o = 0; + TQUObject *_o = 0; - Data_Get_Struct(rb_ary_entry(argv[1], 0), QUObject, _o); + Data_Get_Struct(rb_ary_entry(argv[1], 0), TQUObject, _o); if(_o == 0) { - rb_raise(rb_eRuntimeError, "Cannot create QUObject\n"); + rb_raise(rb_eRuntimeError, "Cannot create TQUObject\n"); } smokeruby_object *o = value_obj_info(self); - (void) (TQObject*)o->smoke->cast( + (void) (TTQObject*)o->smoke->cast( o->ptr, o->classId, - o->smoke->idClass("TQObject") + o->smoke->idClass("TTQObject") ); // Now, I need to find out if this means me @@ -1883,10 +1883,10 @@ qt_invoke(int /*argc*/, VALUE * argv, VALUE self) o->smoke->classes[o->classId].className ); } - TQString name(slotname); -static TQRegExp * rx = 0; + TTQString name(slotname); +static TTQRegExp * rx = 0; if (rx == 0) { - rx = new TQRegExp("\\(.*"); + rx = new TTQRegExp("\\(.*"); } name.replace(*rx, ""); @@ -1914,7 +1914,7 @@ qobject_connect(int argc, VALUE * argv, VALUE self) } } -// --------------- Ruby C functions for Qt::_internal.* helpers ---------------- +// --------------- Ruby C functions for TQt::_internal.* helpers ---------------- static VALUE @@ -1951,8 +1951,8 @@ getIsa(VALUE /*self*/, VALUE classId) return parents_list; } -// Return the class name of a TQObject. Note that the name will be in the -// form of Qt::Widget rather than TQWidget. Is this a bug or a feature? +// Return the class name of a TTQObject. Note that the name will be in the +// form of TQt::Widget rather than TTQWidget. Is this a bug or a feature? static VALUE class_name(VALUE self) { @@ -1960,8 +1960,8 @@ class_name(VALUE self) return rb_funcall(klass, rb_intern("name"), 0); } -// Allow classnames in both 'Qt::Widget' and 'QWidget' formats to be -// used as an argument to Qt::Object.inherits() +// Allow classnames in both 'TQt::Widget' and 'TQWidget' formats to be +// used as an argument to TQt::Object.inherits() static VALUE inherits_qobject(int argc, VALUE * argv, VALUE /*self*/) { @@ -1986,7 +1986,7 @@ qbytearray_data(VALUE self) if (o == 0 || o->ptr == 0) { return Qnil; } - TQByteArray * dataArray = (TQByteArray*) o->ptr; + TTQByteArray * dataArray = (TTQByteArray*) o->ptr; return rb_str_new(dataArray->data(), (long) dataArray->size()); } @@ -1997,7 +1997,7 @@ qbytearray_size(VALUE self) if (o == 0 || o->ptr == 0) { return Qnil; } - TQByteArray * dataArray = (TQByteArray*) o->ptr; + TTQByteArray * dataArray = (TTQByteArray*) o->ptr; return UINT2NUM(dataArray->size()); } @@ -2008,7 +2008,7 @@ qbytearray_setRawData(VALUE self, VALUE data) if (o == 0 || o->ptr == 0) { return Qnil; } - TQByteArray * dataArray = (TQByteArray*) o->ptr; + TTQByteArray * dataArray = (TTQByteArray*) o->ptr; dataArray->setRawData(StringValuePtr(data), RSTRING(data)->len); return self; } @@ -2050,7 +2050,7 @@ setMocType(VALUE /*self*/, VALUE ptr, VALUE idx_value, VALUE name_value, VALUE s arg[idx].argType = xmoc_double; else if(qstrcmp(static_type, "char*") == 0) arg[idx].argType = xmoc_charstar; - else if(qstrcmp(static_type, "TQString") == 0) + else if(qstrcmp(static_type, "TTQString") == 0) arg[idx].argType = xmoc_QString; return Qtrue; } @@ -2153,7 +2153,7 @@ make_QUParameter(VALUE /*self*/, VALUE name_value, VALUE type_value, VALUE /*ext char *name = StringValuePtr(name_value); char *type = StringValuePtr(type_value); int inout = NUM2INT(inout_value); - QUParameter *p = new QUParameter; + TQUParameter *p = new TQUParameter; p->name = new char[strlen(name) + 1]; strcpy((char*)p->name, name); if(qstrcmp(type, "bool") == 0) @@ -2164,9 +2164,9 @@ make_QUParameter(VALUE /*self*/, VALUE name_value, VALUE type_value, VALUE /*ext p->type = &static_QUType_double; else if(qstrcmp(type, "char*") == 0 || qstrcmp(type, "const char*") == 0) p->type = &static_QUType_charstar; - else if(qstrcmp(type, "TQString") == 0 || qstrcmp(type, "TQString&") == 0 || - qstrcmp(type, "const TQString") == 0 || qstrcmp(type, "const TQString&") == 0) - p->type = &static_QUType_QString; + else if(qstrcmp(type, "TTQString") == 0 || qstrcmp(type, "TTQString&") == 0 || + qstrcmp(type, "const TTQString") == 0 || qstrcmp(type, "const TTQString&") == 0) + p->type = &static_QUType_TQString; else p->type = &static_QUType_ptr; // Lacking support for several types. Evil. @@ -2179,11 +2179,11 @@ static VALUE make_QMetaData(VALUE /*self*/, VALUE name_value, VALUE method) { char *name = StringValuePtr(name_value); - QMetaData *m = new QMetaData; // will be deleted + TQMetaData *m = new TQMetaData; // will be deleted m->name = new char[strlen(name) + 1]; strcpy((char*)m->name, name); - Data_Get_Struct(method, QUMethod, m->method); - m->access = QMetaData::Public; + Data_Get_Struct(method, TQUMethod, m->method); + m->access = TQMetaData::Public; return Data_Wrap_Struct(rb_cObject, 0, 0, m); } @@ -2191,19 +2191,19 @@ static VALUE make_QUMethod(VALUE /*self*/, VALUE name_value, VALUE params) { char *name = StringValuePtr(name_value); - QUMethod *m = new QUMethod; // permanent memory allocation + TQUMethod *m = new TQUMethod; // permanent memory allocation m->name = new char[strlen(name) + 1]; // this too strcpy((char*)m->name, name); m->parameters = 0; m->count = RARRAY(params)->len; if (m->count > 0) { - m->parameters = new QUParameter[m->count]; + m->parameters = new TQUParameter[m->count]; for (long i = 0; i < m->count; i++) { VALUE param = rb_ary_entry(params, i); - QUParameter *p = 0; - Data_Get_Struct(param, QUParameter, p); - ((QUParameter *) m->parameters)[i] = *p; + TQUParameter *p = 0; + Data_Get_Struct(param, TQUParameter, p); + ((TQUParameter *) m->parameters)[i] = *p; delete p; } } @@ -2214,13 +2214,13 @@ static VALUE make_QMetaData_tbl(VALUE /*self*/, VALUE list) { long count = RARRAY(list)->len; - QMetaData *m = new QMetaData[count]; + TQMetaData *m = new TQMetaData[count]; for (long i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); - QMetaData *old = 0; - Data_Get_Struct(item, QMetaData, old); + TQMetaData *old = 0; + Data_Get_Struct(item, TQMetaData, old); m[i] = *old; delete old; } @@ -2233,17 +2233,17 @@ make_metaObject(VALUE /*self*/, VALUE className_value, VALUE parent, VALUE slot_ { char *className = strdup(StringValuePtr(className_value)); - QMetaData * slot_tbl = 0; + TQMetaData * slot_tbl = 0; int slot_count = 0; if (slot_tbl_value != Qnil) { - Data_Get_Struct(slot_tbl_value, QMetaData, slot_tbl); + Data_Get_Struct(slot_tbl_value, TQMetaData, slot_tbl); slot_count = NUM2INT(slot_count_value); } - QMetaData * signal_tbl = 0; + TQMetaData * signal_tbl = 0; int signal_count = 0; if (signal_tbl_value != Qnil) { - Data_Get_Struct(signal_tbl_value, QMetaData, signal_tbl); + Data_Get_Struct(signal_tbl_value, TQMetaData, signal_tbl); signal_count = NUM2INT(signal_count_value); } @@ -2252,17 +2252,17 @@ make_metaObject(VALUE /*self*/, VALUE className_value, VALUE parent, VALUE slot_ rb_raise(rb_eRuntimeError, "Cannot create metaObject\n"); } - TQMetaObject *meta = TQMetaObject::new_metaobject( - className, (TQMetaObject*)po->ptr, - (const QMetaData*)slot_tbl, slot_count, // slots - (const QMetaData*)signal_tbl, signal_count, // signals + TTQMetaObject *meta = TTQMetaObject::new_metaobject( + className, (TTQMetaObject*)po->ptr, + (const TQMetaData*)slot_tbl, slot_count, // slots + (const TQMetaData*)signal_tbl, signal_count, // signals 0, 0, // properties 0, 0, // enums 0, 0); smokeruby_object * o = (smokeruby_object *) malloc(sizeof(smokeruby_object)); o->smoke = qt_Smoke; - o->classId = qt_Smoke->idClass("TQMetaObject"); + o->classId = qt_Smoke->idClass("TTQMetaObject"); o->ptr = meta; o->allocated = true; @@ -2337,10 +2337,10 @@ mapObject(VALUE self, VALUE obj) } static VALUE -isaQObject(VALUE /*self*/, VALUE classid) +isaTQObject(VALUE /*self*/, VALUE classid) { int classid_value = NUM2INT(classid); - return isQObject(qt_Smoke, classid_value) ? Qtrue : Qfalse; + return isTQObject(qt_Smoke, classid_value) ? Qtrue : Qfalse; } // Returns the Smoke classId of a ruby instance @@ -2387,9 +2387,9 @@ findMethod(VALUE /*self*/, VALUE c_value, VALUE name_value) if (do_debug & qtdb_calls) qWarning("DAMNIT on %s::%s => %d", c, name, meth); #endif if(!meth) { - meth = qt_Smoke->findMethod("QGlobalSpace", name); + meth = qt_Smoke->findMethod("TQGlobalSpace", name); #ifdef DEBUG - if (do_debug & qtdb_calls) qWarning("DAMNIT on QGlobalSpace::%s => %d", name, meth); + if (do_debug & qtdb_calls) qWarning("DAMNIT on TQGlobalSpace::%s => %d", name, meth); #endif } @@ -2534,9 +2534,9 @@ findAllMethods(int argc, VALUE * argv, VALUE /*self*/) static VALUE findAllMethodNames(VALUE /*self*/, VALUE result, VALUE classid, VALUE flags_value) { - TQRegExp predicate_re("^(is|has)(.)(.*)"); - TQRegExp set_re("^(set)([A-Z])(.*)"); - TQRegExp op_re("operator(.*)(([-%~/+|&*])|(>>)|(<<)|(&&)|(\\|\\|)|(\\*\\*))=$"); + TTQRegExp predicate_re("^(is|has)(.)(.*)"); + TTQRegExp set_re("^(set)([A-Z])(.*)"); + TTQRegExp op_re("operator(.*)(([-%~/+|&*])|(>>)|(<<)|(&&)|(\\|\\|)|(\\*\\*))=$"); unsigned short flags = (unsigned short) NUM2UINT(flags_value); if (classid != Qnil) { @@ -2658,10 +2658,10 @@ static VALUE kde_package_to_class(const char * package, VALUE base_class) { VALUE klass = Qnil; - TQString packageName(package); -static TQRegExp * scope_op = 0; + TTQString packageName(package); +static TTQRegExp * scope_op = 0; if (scope_op == 0) { - scope_op = new TQRegExp("^([^:]+)::([^:]+)$"); + scope_op = new TTQRegExp("^([^:]+)::([^:]+)$"); } if (packageName.startsWith("KDE::ConfigSkeleton::ItemEnum::")) { @@ -2718,7 +2718,7 @@ static TQRegExp * scope_op = 0; VALUE module = rb_define_module(scope_op->cap(1).latin1()); klass = rb_define_class_under(module, scope_op->cap(2).latin1(), base_class); } else if ( packageName.startsWith("K") - && packageName.mid(1, 1).contains(TQRegExp("[A-Z]")) == 1 ) + && packageName.mid(1, 1).contains(TTQRegExp("[A-Z]")) == 1 ) { klass = rb_define_class_under(kde_module, package+strlen("K"), base_class); } else { @@ -2735,13 +2735,13 @@ create_qobject_class(VALUE /*self*/, VALUE package_value) const char *package = StringValuePtr(package_value); VALUE klass; - if (TQString(package).startsWith("Qt::")) { - klass = rb_define_class_under(qt_module, package+strlen("Qt::"), qt_base_class); - if (qstrcmp(package, "Qt::Application") == 0) { + if (TTQString(package).startsWith("TQt::")) { + klass = rb_define_class_under(qt_module, package+strlen("TQt::"), qt_base_class); + if (qstrcmp(package, "TQt::Application") == 0) { rb_define_singleton_method(klass, "new", (VALUE (*) (...)) new_qapplication, -1); rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0); } - } else if (TQString(package).startsWith("Qext::")) { + } else if (TTQString(package).startsWith("Qext::")) { if (qext_scintilla_module == Qnil) { qext_scintilla_module = rb_define_module("Qext"); } @@ -2767,9 +2767,9 @@ create_qt_class(VALUE /*self*/, VALUE package_value) const char *package = StringValuePtr(package_value); VALUE klass; - if (TQString(package).startsWith("Qt::")) { - klass = rb_define_class_under(qt_module, package+strlen("Qt::"), qt_base_class); - } else if (TQString(package).startsWith("Qext::")) { + if (TTQString(package).startsWith("TQt::")) { + klass = rb_define_class_under(qt_module, package+strlen("TQt::"), qt_base_class); + } else if (TTQString(package).startsWith("Qext::")) { if (qext_scintilla_module == Qnil) { qext_scintilla_module = rb_define_module("Qext"); } @@ -2778,16 +2778,16 @@ create_qt_class(VALUE /*self*/, VALUE package_value) klass = kde_package_to_class(package, qt_base_class); } - if (qstrcmp(package, "Qt::MetaObject") == 0) { + if (qstrcmp(package, "TQt::MetaObject") == 0) { qmetaobject_class = klass; - } else if (qstrcmp(package, "Qt::Variant") == 0) { + } else if (qstrcmp(package, "TQt::Variant") == 0) { qvariant_class = klass; rb_define_singleton_method(qvariant_class, "new", (VALUE (*) (...)) new_qvariant, -1); - } else if (qstrcmp(package, "Qt::ByteArray") == 0) { + } else if (qstrcmp(package, "TQt::ByteArray") == 0) { rb_define_method(klass, "data", (VALUE (*) (...)) qbytearray_data, 0); rb_define_method(klass, "size", (VALUE (*) (...)) qbytearray_size, 0); rb_define_method(klass, "setRawData", (VALUE (*) (...)) qbytearray_setRawData, 1); - } else if (qstrcmp(package, "Qt::Char") == 0) { + } else if (qstrcmp(package, "TQt::Char") == 0) { rb_define_method(klass, "to_s", (VALUE (*) (...)) qchar_to_s, 0); } @@ -2803,7 +2803,7 @@ version(VALUE /*self*/) static VALUE qtruby_version(VALUE /*self*/) { - return rb_str_new2(QTRUBY_VERSION); + return rb_str_new2(TQTRUBY_VERSION); } void @@ -2877,9 +2877,9 @@ Init_qtruby() { if (qt_Smoke != 0L) { // This function must have been called twice because both - // 'require Qt' and 'require Korundum' statements have + // 'retquire Qt' and 'retquire Korundum' statements have // been included in a ruby program - rb_fatal("require 'Qt' must not follow require 'Korundum'\n"); + rb_fatal("retquire 'Qt' must not follow retquire 'Korundum'\n"); return; } @@ -2937,8 +2937,8 @@ Init_qtruby() rb_define_module_function(qt_internal_module, "addMetaObjectMethods", (VALUE (*) (...)) add_metaobject_methods, 1); rb_define_module_function(qt_internal_module, "addSignalMethods", (VALUE (*) (...)) add_signal_methods, 2); rb_define_module_function(qt_internal_module, "mapObject", (VALUE (*) (...)) mapObject, 1); - // isQOjbect => isaQObject - rb_define_module_function(qt_internal_module, "isQObject", (VALUE (*) (...)) isaQObject, 1); + // isTQOjbect => isaTQObject + rb_define_module_function(qt_internal_module, "isTQObject", (VALUE (*) (...)) isaTQObject, 1); rb_define_module_function(qt_internal_module, "idInstance", (VALUE (*) (...)) idInstance, 1); rb_define_module_function(qt_internal_module, "idClass", (VALUE (*) (...)) idClass, 1); rb_define_module_function(qt_internal_module, "idMethodName", (VALUE (*) (...)) idMethodName, 1); @@ -2958,7 +2958,7 @@ Init_qtruby() rb_define_module_function(qt_module, "version", (VALUE (*) (...)) version, 0); rb_define_module_function(qt_module, "qtruby_version", (VALUE (*) (...)) qtruby_version, 0); - rb_require("Qt/qtruby.rb"); + rb_retquire("Qt/qtruby.rb"); // Do package initialization rb_funcall(qt_internal_module, rb_intern("init_all_classes"), 0); diff --git a/qtruby/rubylib/qtruby/extconf.rb b/qtruby/rubylib/qtruby/extconf.rb index 0ffd2382..767affc5 100644 --- a/qtruby/rubylib/qtruby/extconf.rb +++ b/qtruby/rubylib/qtruby/extconf.rb @@ -1,5 +1,5 @@ -require 'mkmf' +retquire 'mkmf' dir_config('smoke') dir_config('qt') -$LOCAL_LIBS += '-lsmokeqt -lqt-mt -lstdc++' +$LOCAL_LIBS += '-lsmokeqt -ltqt-mt -lstdc++' create_makefile("qtruby") diff --git a/qtruby/rubylib/qtruby/handlers.cpp b/qtruby/rubylib/qtruby/handlers.cpp index e6cf263c..3cb04df8 100644 --- a/qtruby/rubylib/qtruby/handlers.cpp +++ b/qtruby/rubylib/qtruby/handlers.cpp @@ -70,16 +70,16 @@ set_kde_resolve_classname(const char * (*kde_resolve_classname) (Smoke*, int, vo }; void -mark_qobject_children(TQObject * qobject) +mark_qobject_children(TTQObject * qobject) { VALUE obj; - const TQObjectList *l = qobject->children(); + const TTQObjectList *l = qobject->children(); if (l == 0) { return; } - TQObjectListIt it( *l ); // iterate over the children - TQObject *child; + TTQObjectListIt it( *l ); // iterate over the children + TTQObject *child; while ( (child = it.current()) != 0 ) { ++it; @@ -103,10 +103,10 @@ smokeruby_mark(void * p) if(do_debug & qtdb_gc) qWarning("Checking for mark (%s*)%p\n", className, o->ptr); if(o->ptr && o->allocated) { - if (isDerivedFromByName(o->smoke, className, "TQListView")) { - TQListView * listview = (TQListView *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQListView")); - TQListViewItemIterator it(listview); - TQListViewItem *item; + if (isDerivedFromByName(o->smoke, className, "TTQListView")) { + TTQListView * listview = (TTQListView *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQListView")); + TTQListViewItemIterator it(listview); + TTQListViewItem *item; while ( (item = it.current()) != 0 ) { ++it; @@ -119,9 +119,9 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "TQTable")) { - TQTable * table = (TQTable *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQTable")); - TQTableItem *item; + if (isDerivedFromByName(o->smoke, className, "TTQTable")) { + TTQTable * table = (TTQTable *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQTable")); + TTQTableItem *item; for ( int row = 0; row < table->numRows(); row++ ) { for ( int col = 0; col < table->numCols(); col++ ) { @@ -136,10 +136,10 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "TQCanvas")) { - TQCanvas * canvas = (TQCanvas *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQCanvas")); - TQCanvasItemList list = canvas->allItems(); - for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it ) { + if (isDerivedFromByName(o->smoke, className, "TTQCanvas")) { + TTQCanvas * canvas = (TTQCanvas *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQCanvas")); + TTQCanvasItemList list = canvas->allItems(); + for ( TTQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it ) { obj = getPointerObject(*it); if (obj != Qnil) { if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", className, *it, (void*)obj); @@ -149,19 +149,19 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "TQCanvasItem")) { - TQCanvasItem * item = (TQCanvasItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQCanvasItem")); - TQCanvas * canvas = item->canvas(); + if (isDerivedFromByName(o->smoke, className, "TTQCanvasItem")) { + TTQCanvasItem * item = (TTQCanvasItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQCanvasItem")); + TTQCanvas * canvas = item->canvas(); obj = getPointerObject(canvas); if (obj != Qnil) { - if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", "TQCanvas", canvas, (void*)obj); + if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", "TTQCanvas", canvas, (void*)obj); rb_gc_mark(obj); } return; } - if (isDerivedFromByName(o->smoke, className, "TQObject")) { - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + if (isDerivedFromByName(o->smoke, className, "TTQObject")) { + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); mark_qobject_children(qobject); return; } @@ -184,63 +184,63 @@ smokeruby_free(void * p) unmapPointer(o, o->classId, 0); object_count --; - if ( qstrcmp(className, "TQObject") == 0 - || qstrcmp(className, "TQListBoxItem") == 0 - || qstrcmp(className, "TQStyleSheetItem") == 0 + if ( qstrcmp(className, "TTQObject") == 0 + || qstrcmp(className, "TTQListBoxItem") == 0 + || qstrcmp(className, "TTQStyleSheetItem") == 0 || qstrcmp(className, "KCommand") == 0 || qstrcmp(className, "KNamedCommand") == 0 || qstrcmp(className, "KMacroCommand") == 0 || qstrcmp(className, "KAboutData") == 0 || qstrcmp(className, "KCmdLineArgs") == 0 - || qstrcmp(className, "TQSqlCursor") == 0 ) + || qstrcmp(className, "TTQSqlCursor") == 0 ) { // Don't delete instances of these classes for now free(o); return; - } else if (isDerivedFromByName(o->smoke, className, "TQLayoutItem")) { - TQLayoutItem * item = (TQLayoutItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQLayoutItem")); + } else if (isDerivedFromByName(o->smoke, className, "TTQLayoutItem")) { + TTQLayoutItem * item = (TTQLayoutItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQLayoutItem")); if (item->layout() != 0 || item->widget() != 0 || item->spacerItem() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQIconViewItem") == 0) { - TQIconViewItem * item = (TQIconViewItem *) o->ptr; + } else if (qstrcmp(className, "TTQIconViewItem") == 0) { + TTQIconViewItem * item = (TTQIconViewItem *) o->ptr; if (item->iconView() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQCheckListItem") == 0) { - TQCheckListItem * item = (TQCheckListItem *) o->ptr; + } else if (qstrcmp(className, "TTQCheckListItem") == 0) { + TTQCheckListItem * item = (TTQCheckListItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQListViewItem") == 0) { - TQListViewItem * item = (TQListViewItem *) o->ptr; + } else if (qstrcmp(className, "TTQListViewItem") == 0) { + TTQListViewItem * item = (TTQListViewItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "TQTableItem")) { - TQTableItem * item = (TQTableItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQTableItem")); + } else if (isDerivedFromByName(o->smoke, className, "TTQTableItem")) { + TTQTableItem * item = (TTQTableItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQTableItem")); if (item->table() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQPopupMenu") == 0) { - TQPopupMenu * item = (TQPopupMenu *) o->ptr; + } else if (qstrcmp(className, "TTQPopupMenu") == 0) { + TTQPopupMenu * item = (TTQPopupMenu *) o->ptr; if (item->parentWidget(false) != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "TQWidget")) { - TQWidget * qwidget = (TQWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQWidget")); + } else if (isDerivedFromByName(o->smoke, className, "TTQWidget")) { + TTQWidget * qwidget = (TTQWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQWidget")); if (qwidget->parentWidget(true) != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "TQObject")) { - TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + } else if (isDerivedFromByName(o->smoke, className, "TTQObject")) { + TTQObject * qobject = (TTQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TTQObject")); if (qobject->parent() != 0) { free(o); return; @@ -268,70 +268,70 @@ smokeruby_free(void * p) /* * Given an approximate classname and a qt instance, try to improve the resolution of the name - * by using the various Qt rtti mechanisms for QObjects, QEvents and QCanvasItems + * by using the various Qt rtti mechanisms for TQObjects, TQEvents and TQCanvasItems */ static const char * resolve_classname(Smoke* smoke, int classId, void * ptr) { - if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQEvent")) { - TQEvent * qevent = (TQEvent *) smoke->cast(ptr, classId, smoke->idClass("TQEvent")); + if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TTQEvent")) { + TTQEvent * qevent = (TTQEvent *) smoke->cast(ptr, classId, smoke->idClass("TTQEvent")); switch (qevent->type()) { - case TQEvent::ChildInserted: - case TQEvent::ChildRemoved: - return "Qt::ChildEvent"; - case TQEvent::Close: - return "Qt::CloseEvent"; - case TQEvent::ContextMenu: - return "Qt::ContextMenuEvent"; -// case TQEvent::User: -// return "Qt::CustomEvent"; - case TQEvent::DragEnter: - return "Qt::DragEnterEvent"; - case TQEvent::DragLeave: - return "Qt::DragLeaveEvent"; - case TQEvent::DragMove: - return "Qt::DragMoveEvent"; - case TQEvent::DragResponse: - return "Qt::DragResponseEvent"; - case TQEvent::Drop: - return "Qt::DropEvent"; - case TQEvent::FocusIn: - case TQEvent::FocusOut: - return "Qt::FocusEvent"; - case TQEvent::Hide: - return "Qt::HideEvent"; - case TQEvent::KeyPress: - case TQEvent::KeyRelease: - return "Qt::KeyEvent"; - case TQEvent::IMStart: - case TQEvent::IMCompose: - case TQEvent::IMEnd: - return "Qt::IMEvent"; - case TQEvent::MouseButtonPress: - case TQEvent::MouseButtonRelease: - case TQEvent::MouseButtonDblClick: - case TQEvent::MouseMove: - return "Qt::MouseEvent"; - case TQEvent::Move: - return "Qt::MoveEvent"; - case TQEvent::Paint: - return "Qt::PaintEvent"; - case TQEvent::Resize: - return "Qt::ResizeEvent"; - case TQEvent::Show: - return "Qt::ShowEvent"; - // case TQEvent::Tablet: - // return "Qt::TabletEvent"; - case TQEvent::Timer: - return "Qt::TimerEvent"; - case TQEvent::Wheel: - return "Qt::WheelEvent"; + case TTQEvent::ChildInserted: + case TTQEvent::ChildRemoved: + return "TQt::ChildEvent"; + case TTQEvent::Close: + return "TQt::CloseEvent"; + case TTQEvent::ContextMenu: + return "TQt::ContextMenuEvent"; +// case TTQEvent::User: +// return "TQt::CustomEvent"; + case TTQEvent::DragEnter: + return "TQt::DragEnterEvent"; + case TTQEvent::DragLeave: + return "TQt::DragLeaveEvent"; + case TTQEvent::DragMove: + return "TQt::DragMoveEvent"; + case TTQEvent::DragResponse: + return "TQt::DragResponseEvent"; + case TTQEvent::Drop: + return "TQt::DropEvent"; + case TTQEvent::FocusIn: + case TTQEvent::FocusOut: + return "TQt::FocusEvent"; + case TTQEvent::Hide: + return "TQt::HideEvent"; + case TTQEvent::KeyPress: + case TTQEvent::KeyRelease: + return "TQt::KeyEvent"; + case TTQEvent::IMStart: + case TTQEvent::IMCompose: + case TTQEvent::IMEnd: + return "TQt::IMEvent"; + case TTQEvent::MouseButtonPress: + case TTQEvent::MouseButtonRelease: + case TTQEvent::MouseButtonDblClick: + case TTQEvent::MouseMove: + return "TQt::MouseEvent"; + case TTQEvent::Move: + return "TQt::MoveEvent"; + case TTQEvent::Paint: + return "TQt::PaintEvent"; + case TTQEvent::Resize: + return "TQt::ResizeEvent"; + case TTQEvent::Show: + return "TQt::ShowEvent"; + // case TTQEvent::Tablet: + // return "TQt::TabletEvent"; + case TTQEvent::Timer: + return "TQt::TimerEvent"; + case TTQEvent::Wheel: + return "TQt::WheelEvent"; default: break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQObject")) { - TQObject * qobject = (TQObject *) smoke->cast(ptr, classId, smoke->idClass("TQObject")); - TQMetaObject * meta = qobject->metaObject(); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TTQObject")) { + TTQObject * qobject = (TTQObject *) smoke->cast(ptr, classId, smoke->idClass("TTQObject")); + TTQMetaObject * meta = qobject->metaObject(); while (meta != 0) { Smoke::Index classId = smoke->idClass(meta->className()); @@ -341,50 +341,50 @@ resolve_classname(Smoke* smoke, int classId, void * ptr) meta = meta->superClass(); } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQCanvasItem")) { - TQCanvasItem * qcanvasitem = (TQCanvasItem *) smoke->cast(ptr, classId, smoke->idClass("TQCanvasItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TTQCanvasItem")) { + TTQCanvasItem * qcanvasitem = (TTQCanvasItem *) smoke->cast(ptr, classId, smoke->idClass("TTQCanvasItem")); switch (qcanvasitem->rtti()) { - case TQCanvasItem::Rtti_Sprite: - return "Qt::CanvasSprite"; - case TQCanvasItem::Rtti_PolygonalItem: - return "Qt::CanvasPolygonalItem"; - case TQCanvasItem::Rtti_Text: - return "Qt::CanvasText"; - case TQCanvasItem::Rtti_Polygon: - return "Qt::CanvasPolygon"; - case TQCanvasItem::Rtti_Rectangle: - return "Qt::CanvasRectangle"; - case TQCanvasItem::Rtti_Ellipse: - return "Qt::CanvasEllipse"; - case TQCanvasItem::Rtti_Line: - return "Qt::CanvasLine"; - case TQCanvasItem::Rtti_Spline: - return "Qt::CanvasSpline"; + case TTQCanvasItem::Rtti_Sprite: + return "TQt::CanvasSprite"; + case TTQCanvasItem::Rtti_PolygonalItem: + return "TQt::CanvasPolygonalItem"; + case TTQCanvasItem::Rtti_Text: + return "TQt::CanvasText"; + case TTQCanvasItem::Rtti_Polygon: + return "TQt::CanvasPolygon"; + case TTQCanvasItem::Rtti_Rectangle: + return "TQt::CanvasRectangle"; + case TTQCanvasItem::Rtti_Ellipse: + return "TQt::CanvasEllipse"; + case TTQCanvasItem::Rtti_Line: + return "TQt::CanvasLine"; + case TTQCanvasItem::Rtti_Spline: + return "TQt::CanvasSpline"; default: break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQListViewItem")) { - TQListViewItem * item = (TQListViewItem *) smoke->cast(ptr, classId, smoke->idClass("TQListViewItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TTQListViewItem")) { + TTQListViewItem * item = (TTQListViewItem *) smoke->cast(ptr, classId, smoke->idClass("TTQListViewItem")); switch (item->rtti()) { case 0: - return "Qt::ListViewItem"; + return "TQt::ListViewItem"; case 1: - return "Qt::CheckListItem"; + return "TQt::CheckListItem"; default: - return "Qt::ListViewItem"; + return "TQt::ListViewItem"; break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQTableItem")) { - TQTableItem * item = (TQTableItem *) smoke->cast(ptr, classId, smoke->idClass("TQTableItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TTQTableItem")) { + TTQTableItem * item = (TTQTableItem *) smoke->cast(ptr, classId, smoke->idClass("TTQTableItem")); switch (item->rtti()) { case 0: - return "Qt::TableItem"; + return "TQt::TableItem"; case 1: - return "Qt::ComboTableItem"; + return "TQt::ComboTableItem"; case 2: - return "Qt::CheckTableItem"; + return "TQt::CheckTableItem"; default: - return "Qt::TableItem"; + return "TQt::TableItem"; break; } } @@ -464,7 +464,7 @@ marshall_basetype(Marshall *m) switch(m->action()) { case Marshall::FromVALUE: if (TYPE(*(m->var())) == T_OBJECT) { - // A Qt::Boolean has been passed as a value + // A TQt::Boolean has been passed as a value VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qboolean"), 1, *(m->var())); m->item().s_bool = (temp == Qtrue ? true : false); } else { @@ -630,7 +630,7 @@ marshall_basetype(Marshall *m) case Marshall::FromVALUE: { if (TYPE(*(m->var())) == T_OBJECT) { - // A Qt::Enum is a subclass of Qt::Integer, so 'get_qinteger()' can be called ok + // A TQt::Enum is a subclass of TQt::Integer, so 'get_qinteger()' can be called ok VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, *(m->var())); m->item().s_enum = (long) NUM2LONG(temp); } else { @@ -803,41 +803,41 @@ void marshall_ucharP(Marshall *m) { } static const char * KCODE = 0; -static TQTextCodec *codec = 0; +static TTQTextCodec *codec = 0; static void init_codec() { VALUE temp = rb_gv_get("$KCODE"); KCODE = StringValuePtr(temp); if (qstrcmp(KCODE, "EUC") == 0) { - codec = TQTextCodec::codecForName("eucJP"); + codec = TTQTextCodec::codecForName("eucJP"); } else if (qstrcmp(KCODE, "SJIS") == 0) { - codec = TQTextCodec::codecForName("Shift-JIS"); + codec = TTQTextCodec::codecForName("Shift-JIS"); } } -TQString* +TTQString* qstringFromRString(VALUE rstring) { if (KCODE == 0) { init_codec(); } - TQString * s; + TTQString * s; if (qstrcmp(KCODE, "UTF8") == 0) - s = new TQString(TQString::fromUtf8(StringValuePtr(rstring), RSTRING(rstring)->len)); + s = new TTQString(TTQString::fromUtf8(StringValuePtr(rstring), RSTRING(rstring)->len)); else if (qstrcmp(KCODE, "EUC") == 0) - s = new TQString(codec->toUnicode(StringValuePtr(rstring))); + s = new TTQString(codec->toUnicode(StringValuePtr(rstring))); else if (qstrcmp(KCODE, "SJIS") == 0) - s = new TQString(codec->toUnicode(StringValuePtr(rstring))); + s = new TTQString(codec->toUnicode(StringValuePtr(rstring))); else if(qstrcmp(KCODE, "NONE") == 0) - s = new TQString(TQString::fromLatin1(StringValuePtr(rstring))); + s = new TTQString(TTQString::fromLatin1(StringValuePtr(rstring))); else - s = new TQString(TQString::fromLocal8Bit(StringValuePtr(rstring), RSTRING(rstring)->len)); + s = new TTQString(TTQString::fromLocal8Bit(StringValuePtr(rstring), RSTRING(rstring)->len)); return s; } VALUE -rstringFromQString(TQString * s) { +rstringFromTQString(TTQString * s) { if (KCODE == 0) { init_codec(); } @@ -858,11 +858,11 @@ static void marshall_QString(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { - TQString* s = 0; + TTQString* s = 0; if ( *(m->var()) != Qnil) { s = qstringFromRString(*(m->var())); } else { - s = new TQString(TQString::null); + s = new TTQString(TTQString::null); } m->item().s_voidp = s; @@ -870,7 +870,7 @@ static void marshall_QString(Marshall *m) { if (!m->type().isConst() && *(m->var()) != Qnil && s != 0 && !s->isNull()) { rb_str_resize(*(m->var()), 0); - VALUE temp = rstringFromQString(s); + VALUE temp = rstringFromTQString(s); rb_str_cat2(*(m->var()), StringValuePtr(temp)); } @@ -881,12 +881,12 @@ static void marshall_QString(Marshall *m) { break; case Marshall::ToVALUE: { - TQString *s = (TQString*)m->item().s_voidp; + TTQString *s = (TTQString*)m->item().s_voidp; if (s != 0) { if (s->isNull()) { *(m->var()) = Qnil; } else { - *(m->var()) = rstringFromQString(s); + *(m->var()) = rstringFromTQString(s); } if (m->cleanup() || m->type().isStack()) { delete s; @@ -902,11 +902,11 @@ static void marshall_QString(Marshall *m) { } } -// The only way to convert a TQChar to a TQString is to -// pass a TQChar to a TQString constructor. However, -// QStrings aren't in the QtRuby api, so add this -// convenience method 'Qt::Char.to_s' to get a ruby -// string from a Qt::Char. +// The only way to convert a TTQChar to a TTQString is to +// pass a TTQChar to a TTQString constructor. However, +// TQStrings aren't in the QtRuby api, so add this +// convenience method 'TQt::Char.to_s' to get a ruby +// string from a TQt::Char. VALUE qchar_to_s(VALUE self) { @@ -915,9 +915,9 @@ qchar_to_s(VALUE self) return Qnil; } - TQChar * qchar = (TQChar*) o->ptr; - TQString s(*qchar); - return rstringFromQString(&s); + TTQChar * qchar = (TTQChar*) o->ptr; + TTQString s(*qchar); + return rstringFromTQString(&s); } #if 0 @@ -938,13 +938,13 @@ static void marshall_QCString(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { - TQCString *s = 0; + TTQCString *s = 0; VALUE rv = *(m->var()); if (rv == Qnil) { - s = new TQCString(); + s = new TTQCString(); } else { - // Add 1 to the ruby string length to allow for a TQCString '\0' terminator - s = new TQCString(StringValuePtr(*(m->var())), RSTRING(*(m->var()))->len + 1); + // Add 1 to the ruby string length to allow for a TTQCString '\0' terminator + s = new TTQCString(StringValuePtr(*(m->var())), RSTRING(*(m->var()))->len + 1); } m->item().s_voidp = s; @@ -960,7 +960,7 @@ static void marshall_QCString(Marshall *m) { break; case Marshall::ToVALUE: { - TQCString *s = (TQCString*)m->item().s_voidp; + TTQCString *s = (TTQCString*)m->item().s_voidp; if(s && (const char *) *s != 0) { *(m->var()) = rb_str_new2((const char *)*s); // const char * p = (const char *)*s; @@ -968,7 +968,7 @@ static void marshall_QCString(Marshall *m) { // if(not_ascii(p,len)) // { // #if PERL_VERSION == 6 && PERL_SUBVERSION == 0 -// TQTextCodec* c = TQTextCodec::codecForMib(106); // utf8 +// TTQTextCodec* c = TTQTextCodec::codecForMib(106); // utf8 // if(c->heuristicContentMatch(p,len) >= 0) // #else // if(is_utf8_string((U8 *)p,len)) @@ -1008,7 +1008,7 @@ static void marshall_QCOORD_array(Marshall *m) { break; } int count = RARRAY(av)->len; - QCOORD *coord = new QCOORD[count + 2]; + TQCOORD *coord = new TQCOORD[count + 2]; for(long i = 0; i < count; i++) { VALUE svp = rb_ary_entry(av, i); coord[i] = NUM2INT(svp); @@ -1079,7 +1079,7 @@ static void marshall_intR(Marshall *m) { VALUE rv = *(m->var()); int * i = new int; if (TYPE(rv) == T_OBJECT) { - // A Qt::Integer has been passed as an integer value + // A TQt::Integer has been passed as an integer value VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, rv); *i = NUM2INT(temp); m->item().s_voidp = i; @@ -1125,7 +1125,7 @@ static void marshall_boolR(Marshall *m) { VALUE rv = *(m->var()); bool * b = new bool; if (TYPE(rv) == T_OBJECT) { - // A Qt::Boolean has been passed as a value + // A TQt::Boolean has been passed as a value VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qboolean"), 1, rv); *b = (temp == Qtrue ? true : false); m->item().s_voidp = b; @@ -1208,12 +1208,12 @@ void marshall_QStringList(Marshall *m) { } int count = RARRAY(list)->len; - TQStringList *stringlist = new QStringList; + TTQStringList *stringlist = new TQStringList; for(long i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); if(TYPE(item) != T_STRING) { - stringlist->append(TQString()); + stringlist->append(TTQString()); continue; } stringlist->append(*(qstringFromRString(item))); @@ -1225,8 +1225,8 @@ void marshall_QStringList(Marshall *m) { if (stringlist != 0 && !m->type().isConst()) { rb_ary_clear(list); - for(TQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) - rb_ary_push(list, rstringFromQString(&(*it))); + for(TTQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) + rb_ary_push(list, rstringFromTQString(&(*it))); } if (m->cleanup()) @@ -1235,15 +1235,15 @@ void marshall_QStringList(Marshall *m) { } case Marshall::ToVALUE: { - TQStringList *stringlist = static_cast<TQStringList *>(m->item().s_voidp); + TTQStringList *stringlist = static_cast<TTQStringList *>(m->item().s_voidp); if(!stringlist) { *(m->var()) = Qnil; break; } VALUE av = rb_ary_new(); - for(TQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) { - VALUE rv = rstringFromQString(&(*it)); + for(TTQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) { + VALUE rv = rstringFromTQString(&(*it)); rb_ary_push(av, rv); } @@ -1270,15 +1270,15 @@ void marshall_QStrList(Marshall *m) { } int count = RARRAY(list)->len; - TQStrList *stringlist = new QStrList; + TTQStrList *stringlist = new TQStrList; for(long i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); if(TYPE(item) != T_STRING) { - stringlist->append(TQString()); + stringlist->append(TTQString()); continue; } - stringlist->append(TQString::fromUtf8(StringValuePtr(item), RSTRING(item)->len)); + stringlist->append(TTQString::fromUtf8(StringValuePtr(item), RSTRING(item)->len)); } m->item().s_voidp = stringlist; @@ -1297,7 +1297,7 @@ void marshall_QStrList(Marshall *m) { } case Marshall::ToVALUE: { - TQStrList *stringlist = static_cast<TQStrList *>(m->item().s_voidp); + TTQStrList *stringlist = static_cast<TTQStrList *>(m->item().s_voidp); if(!stringlist) { *(m->var()) = Qnil; break; @@ -1422,7 +1422,7 @@ void marshall_QValueListInt(Marshall *m) { break; } int count = RARRAY(list)->len; - TQValueList<int> *valuelist = new TQValueList<int>; + TTQValueList<int> *valuelist = new TTQValueList<int>; long i; for(i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); @@ -1438,7 +1438,7 @@ void marshall_QValueListInt(Marshall *m) { if (!m->type().isConst()) { rb_ary_clear(list); - for(TQValueListIterator<int> it = valuelist->begin(); + for(TTQValueListIterator<int> it = valuelist->begin(); it != valuelist->end(); ++it) rb_ary_push(list, INT2NUM((int)*it)); @@ -1451,7 +1451,7 @@ void marshall_QValueListInt(Marshall *m) { break; case Marshall::ToVALUE: { - TQValueList<int> *valuelist = (TQValueList<int>*)m->item().s_voidp; + TTQValueList<int> *valuelist = (TTQValueList<int>*)m->item().s_voidp; if(!valuelist) { *(m->var()) = Qnil; break; @@ -1459,7 +1459,7 @@ void marshall_QValueListInt(Marshall *m) { VALUE av = rb_ary_new(); - for(TQValueListIterator<int> it = valuelist->begin(); + for(TTQValueListIterator<int> it = valuelist->begin(); it != valuelist->end(); ++it) rb_ary_push(av, INT2NUM(*it)); @@ -1498,7 +1498,7 @@ void marshall_voidP(Marshall *m) { } } -void marshall_QMapQStringQString(Marshall *m) { +void marshall_QMapTQStringTQString(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { @@ -1508,7 +1508,7 @@ void marshall_QMapQStringQString(Marshall *m) { break; } - TQMap<TQString,TQString> * map = new TQMap<TQString,TQString>; + TTQMap<TTQString,TTQString> * map = new TTQMap<TTQString,TTQString>; // Convert the ruby hash to an array of key/value arrays VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0); @@ -1516,7 +1516,7 @@ void marshall_QMapQStringQString(Marshall *m) { for (long i = 0; i < RARRAY(temp)->len; i++) { VALUE key = rb_ary_entry(rb_ary_entry(temp, i), 0); VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1); - (*map)[TQString(StringValuePtr(key))] = TQString(StringValuePtr(value)); + (*map)[TTQString(StringValuePtr(key))] = TTQString(StringValuePtr(value)); } m->item().s_voidp = map; @@ -1528,7 +1528,7 @@ void marshall_QMapQStringQString(Marshall *m) { break; case Marshall::ToVALUE: { - TQMap<TQString,TQString> *map = (TQMap<TQString,TQString>*)m->item().s_voidp; + TTQMap<TTQString,TTQString> *map = (TTQMap<TTQString,TTQString>*)m->item().s_voidp; if(!map) { *(m->var()) = Qnil; break; @@ -1536,9 +1536,9 @@ void marshall_QMapQStringQString(Marshall *m) { VALUE hv = rb_hash_new(); - TQMap<TQString,TQString>::Iterator it; + TTQMap<TTQString,TTQString>::Iterator it; for (it = map->begin(); it != map->end(); ++it) { - rb_hash_aset(hv, rstringFromQString((TQString*)&(it.key())), rstringFromQString((TQString*) &(it.data()))); + rb_hash_aset(hv, rstringFromTQString((TTQString*)&(it.key())), rstringFromTQString((TTQString*) &(it.data()))); } *(m->var()) = hv; @@ -1554,7 +1554,7 @@ void marshall_QMapQStringQString(Marshall *m) { } } -void marshall_QMapQStringQVariant(Marshall *m) { +void marshall_QMapTQStringTQVariant(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { @@ -1564,7 +1564,7 @@ void marshall_QMapQStringQVariant(Marshall *m) { break; } - TQMap<TQString,TQVariant> * map = new TQMap<TQString,TQVariant>; + TTQMap<TTQString,TTQVariant> * map = new TTQMap<TTQString,TTQVariant>; // Convert the ruby hash to an array of key/value arrays VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0); @@ -1574,9 +1574,9 @@ void marshall_QMapQStringQVariant(Marshall *m) { VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1); smokeruby_object *o = value_obj_info(value); - if (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) { - // If the value isn't a Qt::Variant, then try and construct - // a Qt::Variant from it + if (!o || !o->ptr || o->classId != o->smoke->idClass("TTQVariant")) { + // If the value isn't a TQt::Variant, then try and construct + // a TQt::Variant from it value = rb_funcall(qvariant_class, rb_intern("new"), 1, value); if (value == Qnil) { continue; @@ -1585,9 +1585,9 @@ void marshall_QMapQStringQVariant(Marshall *m) { } void * ptr = o->ptr; - ptr = o->smoke->cast(ptr, o->classId, o->smoke->idClass("TQVariant")); + ptr = o->smoke->cast(ptr, o->classId, o->smoke->idClass("TTQVariant")); - (*map)[TQString(StringValuePtr(key))] = (TQVariant)*(TQVariant*)ptr; + (*map)[TTQString(StringValuePtr(key))] = (TTQVariant)*(TTQVariant*)ptr; } m->item().s_voidp = map; @@ -1599,7 +1599,7 @@ void marshall_QMapQStringQVariant(Marshall *m) { break; case Marshall::ToVALUE: { - TQMap<TQString,TQVariant> *map = (TQMap<TQString,TQVariant>*)m->item().s_voidp; + TTQMap<TTQString,TTQVariant> *map = (TTQMap<TTQString,TTQVariant>*)m->item().s_voidp; if(!map) { *(m->var()) = Qnil; break; @@ -1607,21 +1607,21 @@ void marshall_QMapQStringQVariant(Marshall *m) { VALUE hv = rb_hash_new(); - TQMap<TQString,TQVariant>::Iterator it; + TTQMap<TTQString,TTQVariant>::Iterator it; for (it = map->begin(); it != map->end(); ++it) { - void *p = new TQVariant(it.data()); + void *p = new TTQVariant(it.data()); VALUE obj = getPointerObject(p); if (obj == Qnil) { smokeruby_object * o = ALLOC(smokeruby_object); - o->classId = m->smoke()->idClass("TQVariant"); + o->classId = m->smoke()->idClass("TTQVariant"); o->smoke = m->smoke(); o->ptr = p; o->allocated = true; - obj = set_obj_info("Qt::Variant", o); + obj = set_obj_info("TQt::Variant", o); } - rb_hash_aset(hv, rstringFromQString((TQString*)&(it.key())), obj); + rb_hash_aset(hv, rstringFromTQString((TTQString*)&(it.key())), obj); } *(m->var()) = hv; @@ -1644,7 +1644,7 @@ void marshall_QUObject(Marshall *m) { VALUE array = *(m->var()); if (array != Qnil && TYPE(array) == T_ARRAY) { VALUE rv = rb_ary_entry(array, 0); - Data_Get_Struct(rv, QUObject, m->item().s_voidp); + Data_Get_Struct(rv, TQUObject, m->item().s_voidp); } else { m->item().s_voidp = 0; } @@ -1674,7 +1674,7 @@ void marshall_QRgb_array(Marshall *m) { break; } int count = RARRAY(list)->len; - QRgb *rgb = new QRgb[count + 2]; + TQRgb *rgb = new TQRgb[count + 2]; long i; for(i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); @@ -1722,7 +1722,7 @@ void marshall_QPairintint(Marshall *m) { int1 = NUM2INT(item); } - QPair<int,int> * qpair = new QPair<int,int>(int0,int1); + TQPair<int,int> * qpair = new TQPair<int,int>(int0,int1); m->item().s_voidp = qpair; m->next(); if(m->cleanup()) @@ -1749,16 +1749,16 @@ void marshall_QPairintint(Marshall *m) { #include <tqtabbar.h> #if QT_VERSION >= 0x030200 -DEF_LIST_MARSHALLER( QPtrListQNetworkOperation, TQPtrList<TQNetworkOperation>, TQNetworkOperation, TQPtrListStdIterator<TQNetworkOperation> ) -DEF_LIST_MARSHALLER( QPtrListQToolBar, TQPtrList<TQToolBar>, TQToolBar, TQPtrListStdIterator<TQToolBar> ) -DEF_LIST_MARSHALLER( QPtrListQTab, TQPtrList<TQTab>, TQTab, TQPtrListStdIterator<TQTab> ) -DEF_LIST_MARSHALLER( QPtrListQDockWindow, TQPtrList<TQDockWindow>, TQDockWindow, TQPtrListStdIterator<TQDockWindow> ) -DEF_LIST_MARSHALLER( QFileInfoList, QFileInfoList, TQFileInfo, QFileInfoList::Iterator ) -DEF_LIST_MARSHALLER( TQObjectList, TQObjectList, TQObject, TQPtrListStdIterator<TQObject> ) -DEF_LIST_MARSHALLER( TQWidgetList, TQWidgetList, TQWidget, TQPtrListStdIterator<TQWidget> ) +DEF_LIST_MARSHALLER( TQPtrListTQNetworkOperation, TTQPtrList<TTQNetworkOperation>, TTQNetworkOperation, TTQPtrListStdIterator<TTQNetworkOperation> ) +DEF_LIST_MARSHALLER( TQPtrListTQToolBar, TTQPtrList<TTQToolBar>, TTQToolBar, TTQPtrListStdIterator<TTQToolBar> ) +DEF_LIST_MARSHALLER( TQPtrListTQTab, TTQPtrList<TTQTab>, TTQTab, TTQPtrListStdIterator<TTQTab> ) +DEF_LIST_MARSHALLER( TQPtrListTQDockWindow, TTQPtrList<TTQDockWindow>, TTQDockWindow, TTQPtrListStdIterator<TTQDockWindow> ) +DEF_LIST_MARSHALLER( TQFileInfoList, TQFileInfoList, TTQFileInfo, TQFileInfoList::Iterator ) +DEF_LIST_MARSHALLER( TTQObjectList, TTQObjectList, TTQObject, TTQPtrListStdIterator<TTQObject> ) +DEF_LIST_MARSHALLER( TTQWidgetList, TTQWidgetList, TTQWidget, TTQPtrListStdIterator<TTQWidget> ) #endif -DEF_LIST_MARSHALLER( TQCanvasItemList, TQCanvasItemList, TQCanvasItem, TQValueListIterator<TQCanvasItem*> ) +DEF_LIST_MARSHALLER( TTQCanvasItemList, TTQCanvasItemList, TTQCanvasItem, TTQValueListIterator<TTQCanvasItem*> ) template <class Item, class ItemList, class ItemListIterator, const char *ItemSTR > void marshall_ValueItemList(Marshall *m) { @@ -1778,12 +1778,12 @@ void marshall_ValueItemList(Marshall *m) { // TODO do type checking! smokeruby_object *o = value_obj_info(item); - // Special case for the TQValueList<TQVariant> type - if ( qstrcmp(ItemSTR, "TQVariant") == 0 - && (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) ) + // Special case for the TTQValueList<TTQVariant> type + if ( qstrcmp(ItemSTR, "TTQVariant") == 0 + && (!o || !o->ptr || o->classId != o->smoke->idClass("TTQVariant")) ) { - // If the value isn't a Qt::Variant, then try and construct - // a Qt::Variant from it + // If the value isn't a TQt::Variant, then try and construct + // a TQt::Variant from it item = rb_funcall(qvariant_class, rb_intern("new"), 1, item); if (item == Qnil) { continue; @@ -1871,27 +1871,27 @@ void marshall_ValueItemList(Marshall *m) { #define DEF_VALUELIST_MARSHALLER(ListIdent,ItemList,Item,Itr) namespace dummy { char ListIdent##STR[] = #Item; }; \ Marshall::HandlerFn marshall_##ListIdent = marshall_ValueItemList<Item,ItemList,Itr,dummy::ListIdent##STR>; -DEF_VALUELIST_MARSHALLER( QVariantList, TQValueList<TQVariant>, TQVariant, TQValueList<TQVariant>::Iterator ) -DEF_VALUELIST_MARSHALLER( QPixmapList, TQValueList<TQPixmap>, TQPixmap, TQValueList<TQPixmap>::Iterator ) -DEF_VALUELIST_MARSHALLER( QIconDragItemList, TQValueList<TQIconDragItem>, TQIconDragItem, TQValueList<TQIconDragItem>::Iterator ) -DEF_VALUELIST_MARSHALLER( QImageTextKeyLangList, TQValueList<TQImageTextKeyLang>, TQImageTextKeyLang, TQValueList<TQImageTextKeyLang>::Iterator ) -DEF_VALUELIST_MARSHALLER( QUrlInfoList, TQValueList<TQUrlInfo>, TQUrlInfo, TQValueList<TQUrlInfo>::Iterator ) -DEF_VALUELIST_MARSHALLER( QTranslatorMessageList, TQValueList<QTranslatorMessage>, QTranslatorMessage, TQValueList<QTranslatorMessage>::Iterator ) -DEF_VALUELIST_MARSHALLER( QHostAddressList, TQValueList<TQHostAddress>, TQHostAddress, TQValueList<TQHostAddress>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQVariantList, TTQValueList<TTQVariant>, TTQVariant, TTQValueList<TTQVariant>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQPixmapList, TTQValueList<TTQPixmap>, TTQPixmap, TTQValueList<TTQPixmap>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQIconDragItemList, TTQValueList<TTQIconDragItem>, TTQIconDragItem, TTQValueList<TTQIconDragItem>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQImageTextKeyLangList, TTQValueList<TTQImageTextKeyLang>, TTQImageTextKeyLang, TTQValueList<TTQImageTextKeyLang>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQUrlInfoList, TTQValueList<TTQUrlInfo>, TTQUrlInfo, TTQValueList<TTQUrlInfo>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQTranslatorMessageList, TTQValueList<TQTranslatorMessage>, TQTranslatorMessage, TTQValueList<TQTranslatorMessage>::Iterator ) +DEF_VALUELIST_MARSHALLER( TQHostAddressList, TTQValueList<TTQHostAddress>, TTQHostAddress, TTQValueList<TTQHostAddress>::Iterator ) TypeHandler Qt_handlers[] = { - { "TQString", marshall_QString }, - { "TQString&", marshall_QString }, - { "TQString*", marshall_QString }, - { "TQCString", marshall_QCString }, - { "TQCString&", marshall_QCString }, - { "TQCString*", marshall_QCString }, - { "TQStringList", marshall_QStringList }, - { "TQStringList&", marshall_QStringList }, - { "TQStringList*", marshall_QStringList }, - { "TQStrList", marshall_QStrList }, - { "TQStrList&", marshall_QStrList }, - { "TQStrList*", marshall_QStrList }, + { "TTQString", marshall_QString }, + { "TTQString&", marshall_QString }, + { "TTQString*", marshall_QString }, + { "TTQCString", marshall_QCString }, + { "TTQCString&", marshall_QCString }, + { "TTQCString*", marshall_QCString }, + { "TTQStringList", marshall_QStringList }, + { "TTQStringList&", marshall_QStringList }, + { "TTQStringList*", marshall_QStringList }, + { "TTQStrList", marshall_QStrList }, + { "TTQStrList&", marshall_QStrList }, + { "TTQStrList*", marshall_QStrList }, { "long long int", marshall_longlong }, { "long long int&", marshall_longlong }, { "Q_INT64", marshall_longlong }, @@ -1914,44 +1914,44 @@ TypeHandler Qt_handlers[] = { { "char*", marshall_charP }, { "char**", marshall_charP_array }, { "uchar*", marshall_ucharP }, - { "QRgb*", marshall_QRgb_array }, - { "QPair<int,int>&", marshall_QPairintint }, - { "QUObject*", marshall_QUObject }, - { "const QCOORD*", marshall_QCOORD_array }, + { "TQRgb*", marshall_QRgb_array }, + { "TQPair<int,int>&", marshall_QPairintint }, + { "TQUObject*", marshall_QUObject }, + { "const TQCOORD*", marshall_QCOORD_array }, { "void", marshall_void }, - { "TQValueList<int>", marshall_QValueListInt }, - { "TQValueList<int>&", marshall_QValueListInt }, - { "TQValueList<TQVariant>", marshall_QVariantList }, - { "TQValueList<TQVariant>&", marshall_QVariantList }, - { "TQValueList<TQPixmap>", marshall_QPixmapList }, - { "TQValueList<TQIconDragItem>&", marshall_QIconDragItemList }, - { "TQValueList<TQImageTextKeyLang>", marshall_QImageTextKeyLangList }, - { "TQValueList<TQUrlInfo>&", marshall_QUrlInfoList }, - { "TQValueList<QTranslatorMessage>", marshall_QTranslatorMessageList }, - { "TQValueList<TQHostAddress>", marshall_QHostAddressList }, - { "TQCanvasItemList", marshall_TQCanvasItemList }, - { "TQMap<TQString,TQString>", marshall_QMapQStringQString }, - { "TQMap<TQString,TQString>&", marshall_QMapQStringQString }, - { "TQMap<TQString,TQVariant>", marshall_QMapQStringQVariant }, - { "TQMap<TQString,TQVariant>&", marshall_QMapQStringQVariant }, + { "TTQValueList<int>", marshall_QValueListInt }, + { "TTQValueList<int>&", marshall_QValueListInt }, + { "TTQValueList<TTQVariant>", marshall_QVariantList }, + { "TTQValueList<TTQVariant>&", marshall_QVariantList }, + { "TTQValueList<TTQPixmap>", marshall_QPixmapList }, + { "TTQValueList<TTQIconDragItem>&", marshall_QIconDragItemList }, + { "TTQValueList<TTQImageTextKeyLang>", marshall_QImageTextKeyLangList }, + { "TTQValueList<TTQUrlInfo>&", marshall_QUrlInfoList }, + { "TTQValueList<TQTranslatorMessage>", marshall_QTranslatorMessageList }, + { "TTQValueList<TTQHostAddress>", marshall_QHostAddressList }, + { "TTQCanvasItemList", marshall_TTQCanvasItemList }, + { "TTQMap<TTQString,TTQString>", marshall_QMapTQStringTQString }, + { "TTQMap<TTQString,TTQString>&", marshall_QMapTQStringTQString }, + { "TTQMap<TTQString,TTQVariant>", marshall_QMapTQStringTQVariant }, + { "TTQMap<TTQString,TTQVariant>&", marshall_QMapTQStringTQVariant }, #if QT_VERSION >= 0x030200 - { "TQWidgetList", marshall_TQWidgetList }, - { "TQWidgetList*", marshall_TQWidgetList }, - { "TQWidgetList&", marshall_TQWidgetList }, - { "TQObjectList*", marshall_TQObjectList }, - { "TQObjectList&", marshall_TQObjectList }, - { "QFileInfoList*", marshall_QFileInfoList }, - { "TQPtrList<TQToolBar>", marshall_QPtrListQToolBar }, - { "TQPtrList<TQTab>*", marshall_QPtrListQTab }, - { "TQPtrList<TQDockWindow>", marshall_QPtrListQDockWindow }, - { "TQPtrList<TQDockWindow>*", marshall_QPtrListQDockWindow }, - { "TQPtrList<TQNetworkOperation>", marshall_QPtrListQNetworkOperation }, - { "TQPtrList<TQNetworkOperation>&", marshall_QPtrListQNetworkOperation }, + { "TTQWidgetList", marshall_TTQWidgetList }, + { "TTQWidgetList*", marshall_TTQWidgetList }, + { "TTQWidgetList&", marshall_TTQWidgetList }, + { "TTQObjectList*", marshall_TTQObjectList }, + { "TTQObjectList&", marshall_TTQObjectList }, + { "TQFileInfoList*", marshall_QFileInfoList }, + { "TTQPtrList<TTQToolBar>", marshall_QPtrListTQToolBar }, + { "TTQPtrList<TTQTab>*", marshall_QPtrListTQTab }, + { "TTQPtrList<TTQDockWindow>", marshall_QPtrListTQDockWindow }, + { "TTQPtrList<TTQDockWindow>*", marshall_QPtrListTQDockWindow }, + { "TTQPtrList<TTQNetworkOperation>", marshall_QPtrListTQNetworkOperation }, + { "TTQPtrList<TTQNetworkOperation>&", marshall_QPtrListTQNetworkOperation }, #endif { 0, 0 } }; -TQAsciiDict<TypeHandler> type_handlers(199); +TTQAsciiDict<TypeHandler> type_handlers(199); void install_handlers(TypeHandler *h) { while(h->name) { diff --git a/qtruby/rubylib/qtruby/lib/Qt.rb b/qtruby/rubylib/qtruby/lib/Qt.rb index 70e9c776..ce97965b 100644 --- a/qtruby/rubylib/qtruby/lib/Qt.rb +++ b/qtruby/rubylib/qtruby/lib/Qt.rb @@ -1 +1 @@ -require 'qtruby' +retquire 'qtruby' diff --git a/qtruby/rubylib/qtruby/lib/Qt/qtruby.rb b/qtruby/rubylib/qtruby/lib/Qt/qtruby.rb index 50f2eaef..d673facc 100644 --- a/qtruby/rubylib/qtruby/lib/Qt/qtruby.rb +++ b/qtruby/rubylib/qtruby/lib/Qt/qtruby.rb @@ -23,20 +23,20 @@ module Qt end module QtDebugChannel - QTDB_NONE = 0x00 - QTDB_AMBIGUOUS = 0x01 - QTDB_METHOD_MISSING = 0x02 - QTDB_CALLS = 0x04 - QTDB_GC = 0x08 - QTDB_VIRTUAL = 0x10 - QTDB_VERBOSE = 0x20 - QTDB_ALL = QTDB_VERBOSE | QTDB_VIRTUAL | QTDB_GC | QTDB_CALLS | QTDB_METHOD_MISSING | QTDB_AMBIGUOUS + TQTDB_NONE = 0x00 + TQTDB_AMBIGUOUS = 0x01 + TQTDB_METHOD_MISSING = 0x02 + TQTDB_CALLS = 0x04 + TQTDB_GC = 0x08 + TQTDB_VIRTUAL = 0x10 + TQTDB_VERBOSE = 0x20 + TQTDB_ALL = TQTDB_VERBOSE | TQTDB_VIRTUAL | TQTDB_GC | TQTDB_CALLS | TQTDB_METHOD_MISSING | TQTDB_AMBIGUOUS end @@debug_level = DebugLevel::Off def Qt.debug_level=(level) @@debug_level = level - Internal::setDebug Qt::QtDebugChannel::QTDB_ALL if level >= DebugLevel::Extensive + Internal::setDebug TQt::QtDebugChannel::TQTDB_ALL if level >= DebugLevel::Extensive end def Qt.debug_level @@ -45,62 +45,62 @@ module Qt class Base def self.signals(*signal_list) - meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self) + meta = TQt::Meta[self.name] || TQt::MetaInfo.new(self) meta.add_signals(signal_list) meta.changed = true end def self.slots(*slot_list) - meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self) + meta = TQt::Meta[self.name] || TQt::MetaInfo.new(self) meta.add_slots(slot_list) meta.changed = true end def **(a) - return Qt::**(self, a) + return TQt::**(self, a) end def +(a) - return Qt::+(self, a) + return TQt::+(self, a) end def ~(a) - return Qt::~(self, a) + return TQt::~(self, a) end def -@() - return Qt::-(self) + return TQt::-(self) end def -(a) - return Qt::-(self, a) + return TQt::-(self, a) end def *(a) - return Qt::*(self, a) + return TQt::*(self, a) end def /(a) - return Qt::/(self, a) + return TQt::/(self, a) end def %(a) - return Qt::%(self, a) + return TQt::%(self, a) end def >>(a) - return Qt::>>(self, a) + return TQt::>>(self, a) end def <<(a) - return Qt::<<(self, a) + return TQt::<<(self, a) end def &(a) - return Qt::&(self, a) + return TQt::&(self, a) end def ^(a) - return Qt::^(self, a) + return TQt::^(self, a) end def |(a) - return Qt::|(self, a) + return TQt::|(self, a) end # Module has '<', '<=', '>' and '>=' operator instance methods, so pretend they # don't exist by calling method_missing() explicitely def <(a) begin - Qt::method_missing(:<, self, a) + TQt::method_missing(:<, self, a) rescue super(a) end @@ -108,7 +108,7 @@ module Qt def <=(a) begin - Qt::method_missing(:<=, self, a) + TQt::method_missing(:<=, self, a) rescue super(a) end @@ -116,7 +116,7 @@ module Qt def >(a) begin - Qt::method_missing(:>, self, a) + TQt::method_missing(:>, self, a) rescue super(a) end @@ -124,7 +124,7 @@ module Qt def >=(a) begin - Qt::method_missing(:>=, self, a) + TQt::method_missing(:>=, self, a) rescue super(a) end @@ -134,7 +134,7 @@ module Qt # don't exist by calling method_missing() explicitely def ==(a) begin - Qt::method_missing(:==, self, a) + TQt::method_missing(:==, self, a) rescue super(a) end @@ -165,25 +165,25 @@ module Qt private def qt_methods(meths, flags) ids = [] - # These methods are all defined in Qt::Base, even if they aren't supported by a particular + # These methods are all defined in TQt::Base, even if they aren't supported by a particular # subclass, so remove them to avoid confusion meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"] - classid = Qt::Internal::idInstance(self) - Qt::Internal::getAllParents(classid, ids) + classid = TQt::Internal::idInstance(self) + TQt::Internal::getAllParents(classid, ids) ids << classid - ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) } + ids.each { |c| TQt::Internal::findAllMethodNames(meths, c, flags) } return meths.uniq end - end # Qt::Base + end # TQt::Base # Delete the underlying C++ instance after exec returns # Otherwise, rb_gc_call_finalizer_at_exit() can delete - # stuff that Qt::Application still needs for its cleanup. - class Application < Qt::Base + # stuff that TQt::Application still needs for its cleanup. + class Application < TQt::Base def exec method_missing(:exec) self.dispose - Qt::Internal.application_terminated = true + TQt::Internal.application_terminated = true end def exit(*args) @@ -195,7 +195,7 @@ module Qt end end - class BoxLayout < Qt::Base + class BoxLayout < TQt::Base include Enumerable def each @@ -207,19 +207,19 @@ module Qt end end - class Buffer < Qt::Base + class Buffer < TQt::Base def open(*args) method_missing(:open, *args) end end - class ButtonGroup < Qt::Base + class ButtonGroup < TQt::Base def id(*args) method_missing(:id, *args) end end - class ByteArray < Qt::Base + class ByteArray < TQt::Base def to_s return data() end @@ -233,31 +233,31 @@ module Qt end end - class CheckListItem < Qt::Base + class CheckListItem < TQt::Base def type(*args) method_missing(:type, *args) end end - class ChildEvent < Qt::Base + class ChildEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class ClassInfo < Qt::Base + class ClassInfo < TQt::Base def name(*args) method_missing(:name, *args) end end - class CloseEvent < Qt::Base + class CloseEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Color < Qt::Base + class Color < TQt::Base def inspect str = super str.sub(/>$/, " %s>" % name) @@ -273,7 +273,7 @@ module Qt end end - class Connection < Qt::Base + class Connection < TQt::Base def inspect str = super str.sub(/>$/, " memberName=%s, memberType=%s, object=%s>" % @@ -287,13 +287,13 @@ module Qt end end - class ContextMenuEvent < Qt::Base + class ContextMenuEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Cursor < Qt::Base + class Cursor < TQt::Base def inspect str = super str.sub(/>$/, " shape=%d>" % shape) @@ -305,13 +305,13 @@ module Qt end end - class CustomEvent < Qt::Base + class CustomEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Date < Qt::Base + class Date < TQt::Base def inspect str = super str.sub(/>$/, " %s>" % toString) @@ -323,7 +323,7 @@ module Qt end end - class DateTime < Qt::Base + class DateTime < TQt::Base def inspect str = super str.sub(/>$/, " %s>" % toString) @@ -335,31 +335,31 @@ module Qt end end - class Dialog < Qt::Base + class Dialog < TQt::Base def exec(*args) method_missing(:exec, *args) end end - class DomAttr < Qt::Base + class DomAttr < TQt::Base def name(*args) method_missing(:name, *args) end end - class DomDocumentType < Qt::Base + class DomDocumentType < TQt::Base def name(*args) method_missing(:name, *args) end end - class DragLeaveEvent < Qt::Base + class DragLeaveEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class DropEvent < Qt::Base + class DropEvent < TQt::Base def format(*args) method_missing(:format, *args) end @@ -369,25 +369,25 @@ module Qt end end - class EucJpCodec < Qt::Base + class EucJpCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class EucKrCodec < Qt::Base + class EucKrCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class Event < Qt::Base + class Event < TQt::Base def type(*args) method_missing(:type, *args) end end - class EventLoop < Qt::Base + class EventLoop < TQt::Base def exec(*args) method_missing(:exec, *args) end @@ -397,7 +397,7 @@ module Qt end end - class File < Qt::Base + class File < TQt::Base def name(*args) method_missing(:name, *args) end @@ -407,13 +407,13 @@ module Qt end end - class FocusEvent < Qt::Base + class FocusEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Font < Qt::Base + class Font < TQt::Base def inspect str = super str.sub(/>$/, " family=%s, pointSize=%d, weight=%d, italic=%s, bold=%s, underline=%s, strikeOut=%s>" % @@ -427,43 +427,43 @@ module Qt end end - class Ftp < Qt::Base + class Ftp < TQt::Base def abort(*args) method_missing(:abort, *args) end end - class GLContext < Qt::Base + class GLContext < TQt::Base def format(*args) method_missing(:format, *args) end end - class GLWidget < Qt::Base + class GLWidget < TQt::Base def format(*args) method_missing(:format, *args) end end - class Gb18030Codec < Qt::Base + class Gb18030Codec < TQt::Base def name(*args) method_missing(:name, *args) end end - class Gb2312Codec < Qt::Base + class Gb2312Codec < TQt::Base def name(*args) method_missing(:name, *args) end end - class GbkCodec < Qt::Base + class GbkCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class GridLayout < Qt::Base + class GridLayout < TQt::Base include Enumerable def each @@ -475,7 +475,7 @@ module Qt end end - class HBoxLayout < Qt::Base + class HBoxLayout < TQt::Base include Enumerable def each @@ -487,31 +487,31 @@ module Qt end end - class HebrewCodec < Qt::Base + class HebrewCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class HideEvent < Qt::Base + class HideEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Http < Qt::Base + class Http < TQt::Base def abort(*args) method_missing(:abort, *args) end end - class HttpRequestHeader < Qt::Base + class HttpRequestHeader < TQt::Base def method(*args) method_missing(:method, *args) end end - class IconDrag < Qt::Base + class IconDrag < TQt::Base def format(*args) method_missing(:format, *args) end @@ -521,61 +521,61 @@ module Qt end end - class Image < Qt::Base + class Image < TQt::Base def load(*args) method_missing(:load, *args) end end - class ImageDecoder < Qt::Base + class ImageDecoder < TQt::Base def format(*args) method_missing(:format, *args) end end - class ImageDrag < Qt::Base + class ImageDrag < TQt::Base def format(*args) method_missing(:format, *args) end end - class ImageIO < Qt::Base + class ImageIO < TQt::Base def format(*args) method_missing(:format, *args) end end - class IMEvent < Qt::Base + class IMEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class JisCodec < Qt::Base + class JisCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class KeyEvent < Qt::Base + class KeyEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class LCDNumber < Qt::Base + class LCDNumber < TQt::Base def display(item) method_missing(:display, item) end end - class Layout < Qt::Base + class Layout < TQt::Base def freeze(*args) method_missing(:freeze, *args) end end - class LayoutIterator < Qt::Base + class LayoutIterator < TQt::Base def +(a) for i in 1..a send("operator++".to_sym) @@ -584,17 +584,17 @@ module Qt end end - class Library < Qt::Base + class Library < TQt::Base def load(*args) method_missing(:load, *args) end end - class ListView < Qt::Base + class ListView < TQt::Base include Enumerable def each - it = Qt::ListViewItemIterator.new(self) + it = TQt::ListViewItemIterator.new(self) while it.current yield it.current it += 1 @@ -606,11 +606,11 @@ module Qt end end - class ListViewItem < Qt::Base + class ListViewItem < TQt::Base include Enumerable def each - it = Qt::ListViewItemIterator.new(self) + it = TQt::ListViewItemIterator.new(self) while it.current yield it.current it += 1 @@ -641,7 +641,7 @@ module Qt end end - class Locale < Qt::Base + class Locale < TQt::Base def name(*args) method_missing(:name, *args) end @@ -650,13 +650,13 @@ module Qt end end - class MenuItem < Qt::Base + class MenuItem < TQt::Base def id(*args) method_missing(:id, *args) end end - class MetaData < Qt::Base + class MetaData < TQt::Base def method(*args) method_missing(:method, *args) end @@ -666,13 +666,13 @@ module Qt end end - class MetaEnum < Qt::Base + class MetaEnum < TQt::Base def name(*args) method_missing(:name, *args) end end - class MetaProperty < Qt::Base + class MetaProperty < TQt::Base def id(*args) method_missing(:id, *args) end @@ -686,43 +686,43 @@ module Qt end end - class MouseEvent < Qt::Base + class MouseEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class MoveEvent < Qt::Base + class MoveEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Object < Qt::Base + class Object < TQt::Base def name(*args) method_missing(:name, *args) end end - class PaintEvent < Qt::Base + class PaintEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Picture < Qt::Base + class Picture < TQt::Base def load(*args) method_missing(:load, *args) end end - class Pixmap < Qt::Base + class Pixmap < TQt::Base def load(*args) method_missing(:load, *args) end end - class Point < Qt::Base + class Point < TQt::Base def inspect str = super str.sub(/>$/, " x=%d, y=%d>" % [x, y]) @@ -734,25 +734,25 @@ module Qt end end - class PolygonScanner < Qt::Base + class PolygonScanner < TQt::Base def scan(*args) method_missing(:scan, *args) end end - class PopupMenu < Qt::Base + class PopupMenu < TQt::Base def exec(*args) method_missing(:exec, *args) end end - class Printer < Qt::Base + class Printer < TQt::Base def abort(*args) method_missing(:abort, *args) end end - class MetaObject < Qt::Base + class MetaObject < TQt::Base def inspect str = super str.sub!(/>$/, "") @@ -779,7 +779,7 @@ module Qt end end - class Rect < Qt::Base + class Rect < TQt::Base def inspect str = super str.sub(/>$/, " left=%d, right=%d, top=%d, bottom=%d>" % [left, right, top, bottom]) @@ -791,19 +791,19 @@ module Qt end end - class ResizeEvent < Qt::Base + class ResizeEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class ShowEvent < Qt::Base + class ShowEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Size < Qt::Base + class Size < TQt::Base def inspect str = super str.sub(/>$/, " width=%d, height=%d>" % [width, height]) @@ -815,7 +815,7 @@ module Qt end end - class SizePolicy < Qt::Base + class SizePolicy < TQt::Base def inspect str = super str.sub(/>$/, " horData=%d, verData=%d>" % [horData, verData]) @@ -827,19 +827,19 @@ module Qt end end - class SjisCodec < Qt::Base + class SjisCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class Socket < Qt::Base + class Socket < TQt::Base def open(*args) method_missing(:open, *args) end end - class SocketDevice < Qt::Base + class SocketDevice < TQt::Base def open(*args) method_missing(:open, *args) end @@ -849,13 +849,13 @@ module Qt end end - class SocketNotifier < Qt::Base + class SocketNotifier < TQt::Base def type(*args) method_missing(:type, *args) end end - class SqlCursor < Qt::Base + class SqlCursor < TQt::Base def exec(*args) method_missing(:exec, *args) end @@ -869,7 +869,7 @@ module Qt end end - class SqlDatabase < Qt::Base + class SqlDatabase < TQt::Base def exec(*args) method_missing(:exec, *args) end @@ -878,19 +878,19 @@ module Qt end end - class SqlDriver < Qt::Base + class SqlDriver < TQt::Base def open(*args) method_missing(:open, *args) end end - class SqlError < Qt::Base + class SqlError < TQt::Base def type(*args) method_missing(:type, *args) end end - class SqlField < Qt::Base + class SqlField < TQt::Base def name(*args) method_missing(:name, *args) end @@ -900,7 +900,7 @@ module Qt end end - class SqlFieldInfo < Qt::Base + class SqlFieldInfo < TQt::Base def name(*args) method_missing(:name, *args) end @@ -910,19 +910,19 @@ module Qt end end - class SqlIndex < Qt::Base + class SqlIndex < TQt::Base def name(*args) method_missing(:name, *args) end end - class SqlQuery < Qt::Base + class SqlQuery < TQt::Base def exec(*args) method_missing(:exec, *args) end end - class SqlSelectCursor < Qt::Base + class SqlSelectCursor < TQt::Base def exec(*args) method_missing(:exec, *args) end @@ -936,31 +936,31 @@ module Qt end end - class StoredDrag < Qt::Base + class StoredDrag < TQt::Base def format(*args) method_missing(:format, *args) end end - class StyleSheetItem < Qt::Base + class StyleSheetItem < TQt::Base def name(*args) method_missing(:name, *args) end end - class TextDrag < Qt::Base + class TextDrag < TQt::Base def format(*args) method_missing(:format, *args) end end - class TabletEvent < Qt::Base + class TabletEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Time < Qt::Base + class Time < TQt::Base def inspect str = super str.sub(/>$/, " %s>" % toString) @@ -972,55 +972,55 @@ module Qt end end - class TimeEdit < Qt::Base + class TimeEdit < TQt::Base def display method_missing(:display) end end - class TimerEvent < Qt::Base + class TimerEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Translator < Qt::Base + class Translator < TQt::Base def load(*args) method_missing(:load, *args) end end - class TranslatorMessage < Qt::Base + class TranslatorMessage < TQt::Base def hash(*args) method_missing(:hash, *args) end end - class TsciiCodec < Qt::Base + class TsciiCodec < TQt::Base def name(*args) method_missing(:name, *args) end end - class UrlInfo < Qt::Base + class UrlInfo < TQt::Base def name(*args) method_missing(:name, *args) end end - class Utf16Codec < Qt::Base + class Utf16Codec < TQt::Base def name(*args) method_missing(:name, *args) end end - class Utf8Codec < Qt::Base + class Utf8Codec < TQt::Base def name(*args) method_missing(:name, *args) end end - class Variant < Qt::Base + class Variant < TQt::Base String = 3 Date = 26 Time = 27 @@ -1054,71 +1054,71 @@ module Qt def to_ruby case type() - when Qt::Variant::Bitmap + when TQt::Variant::Bitmap return toBitmap - when Qt::Variant::Bool + when TQt::Variant::Bool return toBool - when Qt::Variant::Brush + when TQt::Variant::Brush return toBrush - when Qt::Variant::ByteArray + when TQt::Variant::ByteArray return toByteArray - when Qt::Variant::Color + when TQt::Variant::Color return toColor - when Qt::Variant::ColorGroup + when TQt::Variant::ColorGroup return toColorGroup - when Qt::Variant::CString + when TQt::Variant::CString return toCString - when Qt::Variant::Cursor + when TQt::Variant::Cursor return toCursor - when Qt::Variant::Date + when TQt::Variant::Date return toDate - when Qt::Variant::DateTime + when TQt::Variant::DateTime return toDateTime - when Qt::Variant::Double + when TQt::Variant::Double return toDouble - when Qt::Variant::Font + when TQt::Variant::Font return toFont - when Qt::Variant::IconSet + when TQt::Variant::IconSet return toIconSet - when Qt::Variant::Image + when TQt::Variant::Image return toImage - when Qt::Variant::Int + when TQt::Variant::Int return toInt - when Qt::Variant::KeySequence + when TQt::Variant::KeySequence return toKeySequence - when Qt::Variant::List + when TQt::Variant::List return toList - when Qt::Variant::LongLong + when TQt::Variant::LongLong return toLongLong - when Qt::Variant::Map + when TQt::Variant::Map return toMap - when Qt::Variant::Palette + when TQt::Variant::Palette return toPalette - when Qt::Variant::Pen + when TQt::Variant::Pen return toPen - when Qt::Variant::Pixmap + when TQt::Variant::Pixmap return toPixmap - when Qt::Variant::Point + when TQt::Variant::Point return toPoint - when Qt::Variant::PointArray + when TQt::Variant::PointArray return toPointArray - when Qt::Variant::Rect + when TQt::Variant::Rect return toRect - when Qt::Variant::Region + when TQt::Variant::Region return toRegion - when Qt::Variant::Size + when TQt::Variant::Size return toSize - when Qt::Variant::SizePolicy + when TQt::Variant::SizePolicy return toSizePolicy - when Qt::Variant::String + when TQt::Variant::String return toString - when Qt::Variant::StringList + when TQt::Variant::StringList return toStringList - when Qt::Variant::Time + when TQt::Variant::Time return toTime - when Qt::Variant::UInt + when TQt::Variant::UInt return toUint - when Qt::Variant::ULongLong + when TQt::Variant::ULongLong return toULongLong end end @@ -1142,7 +1142,7 @@ module Qt end end - class VBoxLayout < Qt::Base + class VBoxLayout < TQt::Base include Enumerable def each @@ -1154,31 +1154,31 @@ module Qt end end - class WhatsThis < Qt::Base + class WhatsThis < TQt::Base def WhatsThis.display(*k) method_missing(:display, *k) end end - class WheelEvent < Qt::Base + class WheelEvent < TQt::Base def type(*args) method_missing(:type, *args) end end - class Widget < Qt::Base + class Widget < TQt::Base def raise(*args) method_missing(:raise, *args) end end - class WidgetStack < Qt::Base + class WidgetStack < TQt::Base def id(*args) method_missing(:id, *args) end end - class XmlAttributes < Qt::Base + class XmlAttributes < TQt::Base def type(*args) method_missing(:type, *args) end @@ -1260,7 +1260,7 @@ module Qt # If a C++ enum was converted to an ordinary ruby Integer, the # name of the type is lost. The enum type name is needed for overloaded # method resolution when two methods differ only by an enum type. - class Enum < Qt::Integer + class Enum < TQt::Integer attr_accessor :type def initialize(n, type) super(n) @@ -1318,7 +1318,7 @@ module Qt end end - class SignalBlockInvocation < Qt::Object + class SignalBlockInvocation < TQt::Object def initialize(parent, block, args) super(parent) self.class.slots "invoke(#{args})" @@ -1330,7 +1330,7 @@ module Qt end end - class BlockInvocation < Qt::Object + class BlockInvocation < TQt::Object def initialize(target, block, args) super(target) self.class.slots "invoke(#{args})" @@ -1352,7 +1352,7 @@ module Qt if classname =~ /^Qext/ now = classname.sub(/^Qext(?=[A-Z])/,'Qext::') elsif classname =~ /^Q/ - now = classname.sub(/^Q(?=[A-Z])/,'Qt::') + now = classname.sub(/^Q(?=[A-Z])/,'TQt::') elsif classname =~ /^(KConfigSkeleton|KWin)::/ now = classname.sub(/^K?(?=[A-Z])/,'KDE::') elsif classname !~ /::/ @@ -1365,12 +1365,12 @@ module Qt end def Internal.init_class(c) - classname = Qt::Internal::normalize_classname(c) - classId = Qt::Internal.idClass(c) + classname = TQt::Internal::normalize_classname(c) + classId = TQt::Internal.idClass(c) insert_pclassid(classname, classId) @@idclass[classId] = classname @@cpp_names[classname] = c - klass = isQObject(classId) ? create_qobject_class(classname) \ + klass = isTQObject(classId) ? create_qobject_class(classname) \ : create_qt_class(classname) @@classes[classname] = klass unless klass.nil? end @@ -1414,7 +1414,7 @@ module Qt return 0 end elsif argtype == 's' - if typename =~ /^(const )?((QChar)[*&]?)$/ + if typename =~ /^(const )?((TQChar)[*&]?)$/ return 1 elsif typename =~ /^(?:u?char\*|const u?char\*|(?:const )?(Q(C?)String)[*&]?)$/ qstring = !$1.nil? @@ -1424,12 +1424,12 @@ module Qt elsif argtype == 'a' # FIXME: shouldn't be hardcoded. Installed handlers should tell what ruby type they expect. if typename =~ /^(?: - const\ QCOORD\*| + const\ TQCOORD\*| (?:const\ )? (?: - QStringList[\*&]?| - QValueList<int>[\*&]?| - QRgb\*| + TQStringList[\*&]?| + TQValueList<int>[\*&]?| + TQRgb\*| char\*\* ) )$/x @@ -1446,7 +1446,7 @@ module Qt return 0 end elsif argtype == 'U' - if typename =~ /QStringList/ + if typename =~ /TQStringList/ return 1 else return 0 @@ -1610,18 +1610,18 @@ module Qt end def Internal.init_all_classes() - Qt::Internal::getClassList().each do |c| + TQt::Internal::getClassList().each do |c| if c == "Qt" - # Don't change Qt to Qt::t, just leave as is + # Don't change Qt to TQt::t, just leave as is @@cpp_names["Qt"] = c - elsif c != "QInternal" - Qt::Internal::init_class(c) + elsif c != "TQInternal" + TQt::Internal::init_class(c) end end - @@classes['Qt::Integer'] = Qt::Integer - @@classes['Qt::Boolean'] = Qt::Boolean - @@classes['Qt::Enum'] = Qt::Enum + @@classes['TQt::Integer'] = TQt::Integer + @@classes['TQt::Boolean'] = TQt::Boolean + @@classes['TQt::Enum'] = TQt::Enum end def Internal.get_qinteger(num) @@ -1633,7 +1633,7 @@ module Qt end def Internal.create_qenum(num, type) - return Qt::Enum.new(num, type) + return TQt::Enum.new(num, type) end def Internal.get_qenum_type(e) @@ -1699,7 +1699,7 @@ module Qt args.each_with_index do |arg, i| arg = arg.to_s a = arg.sub(/^const\s+/, '') - a = (a =~ /^(bool|int|double|char\*|QString)&?$/) ? $1 : 'ptr' + a = (a =~ /^(bool|int|double|char\*|TQString)&?$/) ? $1 : 'ptr' valid = setMocType(mocargs, i, arg, a) end result = [] @@ -1755,30 +1755,30 @@ module Qt def Internal.connect(src, signal, target, block) signature = (signal =~ /\((.*)\)/) ? $1 : "" - return Qt::Object.connect( src, + return TQt::Object.connect( src, signal, - Qt::BlockInvocation.new(target, block, signature), + TQt::BlockInvocation.new(target, block, signature), SLOT("invoke(#{signature})") ) end def Internal.signal_connect(src, signal, block) signature = (signal =~ /\((.*)\)/) ? $1 : "" - return Qt::Object.connect( src, + return TQt::Object.connect( src, signal, - Qt::SignalBlockInvocation.new(src, block, signature), + TQt::SignalBlockInvocation.new(src, block, signature), SLOT("invoke(#{signature})") ) end - end # Qt::Internal + end # TQt::Internal Meta = {} # An entry for each signal or slot # Example - # foobar(QString,bool) + # foobar(TQString,bool) # :name is 'foobar' - # :full_name is 'foobar(QString,bool)' - # :arg_types is 'QString,bool' - QObjectMember = Struct.new :name, :full_name, :arg_types + # :full_name is 'foobar(TQString,bool)' + # :arg_types is 'TQString,bool' + TQObjectMember = Struct.new :name, :full_name, :arg_types class MetaInfo attr_accessor :signals, :slots, :metaobject, :mocargs, :changed @@ -1797,9 +1797,9 @@ module Qt if signal.kind_of? Symbol signal = signal.to_s + "()" end - signal = Qt::Object.normalizeSignalSlot(signal) + signal = TQt::Object.normalizeSignalSlot(signal) if signal =~ /([^\s]*)\((.*)\)/ - @signals.push QObjectMember.new($1, signal, $2) + @signals.push TQObjectMember.new($1, signal, $2) else qWarning( "#{@klass.name}: Invalid signal format: '#{signal}'" ) end @@ -1810,7 +1810,7 @@ module Qt def get_signals all_signals = [] current = @klass - while current != Qt::Base + while current != TQt::Base meta = Meta[current.name] if !meta.nil? all_signals.concat meta.signals @@ -1825,9 +1825,9 @@ module Qt if slot.kind_of? Symbol slot = slot.to_s + "()" end - slot = Qt::Object.normalizeSignalSlot(slot) + slot = TQt::Object.normalizeSignalSlot(slot) if slot =~ /([^\s]*)\((.*)\)/ - @slots.push QObjectMember.new($1, slot, $2) + @slots.push TQObjectMember.new($1, slot, $2) else qWarning( "#{@klass.name}: Invalid slot format: '#{slot}'" ) end @@ -1838,7 +1838,7 @@ module Qt def get_slots all_slots = [] current = @klass - while current != Qt::Base + while current != TQt::Base meta = Meta[current.name] if !meta.nil? all_slots.concat meta.slots @@ -1847,7 +1847,7 @@ module Qt end return all_slots end - end # Qt::MetaInfo + end # TQt::MetaInfo IO_Direct = 0x0100 IO_Sequential = 0x0200 @@ -1955,7 +1955,7 @@ class Module klass = self classid = 0 loop do - classid = Qt::Internal::find_pclassid(klass.name) + classid = TQt::Internal::find_pclassid(klass.name) break if classid > 0 klass = klass.superclass @@ -1964,15 +1964,15 @@ class Module end end - # These methods are all defined in Qt::Base, even if they aren't supported by a particular + # These methods are all defined in TQt::Base, even if they aren't supported by a particular # subclass, so remove them to avoid confusion meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"] ids = [] if inc_super - Qt::Internal::getAllParents(classid, ids) + TQt::Internal::getAllParents(classid, ids) end ids << classid - ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) } + ids.each { |c| TQt::Internal::findAllMethodNames(meths, c, flags) } return meths.uniq end end diff --git a/qtruby/rubylib/qtruby/marshall.h b/qtruby/rubylib/qtruby/marshall.h index cf20b86d..30b995fe 100644 --- a/qtruby/rubylib/qtruby/marshall.h +++ b/qtruby/rubylib/qtruby/marshall.h @@ -28,7 +28,7 @@ public: * For FromRV, next() calls the method and returns. * For ToRV, next() calls the virtual function and returns. * - * Required to reset Marshall object to the state it was + * Retquired to reset Marshall object to the state it was * before being called when it returns. */ virtual void next() = 0; diff --git a/qtruby/rubylib/qtruby/qtruby.h b/qtruby/rubylib/qtruby/qtruby.h index 66f9fedc..e3bab45c 100644 --- a/qtruby/rubylib/qtruby/qtruby.h +++ b/qtruby/rubylib/qtruby/qtruby.h @@ -15,8 +15,8 @@ * * ***************************************************************************/ -#ifndef QTRUBY_H -#define QTRUBY_H +#ifndef TQTRUBY_H +#define TQTRUBY_H #include "marshall.h" diff --git a/qtruby/rubylib/qtruby/smokeruby.h b/qtruby/rubylib/qtruby/smokeruby.h index dd3b81bb..dcbddf6a 100644 --- a/qtruby/rubylib/qtruby/smokeruby.h +++ b/qtruby/rubylib/qtruby/smokeruby.h @@ -288,7 +288,7 @@ public: * Type handling by moc is simple. * * If the type name matches /^(?:const\s+)?\Q$types\E&?$/, use the - * static_QUType, where $types is join('|', qw(bool int double char* TQString); + * static_QUType, where $types is join('|', qw(bool int double char* TTQString); * * Everything else is passed as a pointer! There are types which aren't * Smoke::tf_ptr but will have to be passed as a pointer. Make sure to keep diff --git a/qtruby/rubylib/tutorial/t1/t1.rb b/qtruby/rubylib/tutorial/t1/t1.rb index 19d8a029..1f2da715 100755 --- a/qtruby/rubylib/tutorial/t1/t1.rb +++ b/qtruby/rubylib/tutorial/t1/t1.rb @@ -1,10 +1,10 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' +retquire 'Qt' -a = Qt::Application.new(ARGV) -hello = Qt::PushButton.new('Hello World!', nil) +a = TQt::Application.new(ARGV) +hello = TQt::PushButton.new('Hello World!', nil) hello.resize(100, 30) a.setMainWidget(hello) hello.show() diff --git a/qtruby/rubylib/tutorial/t10/cannon.rb b/qtruby/rubylib/tutorial/t10/cannon.rb index 3c02f8ff..708eb728 100644 --- a/qtruby/rubylib/tutorial/t10/cannon.rb +++ b/qtruby/rubylib/tutorial/t10/cannon.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'angleChanged(int)', 'forceChanged(int)' slots 'setAngle(int)', 'setForce(int)' @@ -8,7 +8,7 @@ class CannonField < Qt::Widget super @ang = 45 @f = 0 - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) end def setAngle( degrees ) @@ -42,16 +42,16 @@ class CannonField < Qt::Widget end cr = cannonRect() - pix = Qt::Pixmap.new( cr.size() ) + pix = TQt::Pixmap.new( cr.size() ) pix.fill( self, cr.topLeft() ) - p = Qt::Painter.new( pix ) + p = TQt::Painter.new( pix ) p.setBrush( blue ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.translate( 0, pix.height() - 1 ) - p.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + p.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) p.rotate( - @ang ) - p.drawRect( Qt::Rect.new(33, -4, 15, 8) ) + p.drawRect( TQt::Rect.new(33, -4, 15, 8) ) p.end() p.begin(self) @@ -60,12 +60,12 @@ class CannonField < Qt::Widget end def cannonRect() - r = Qt::Rect.new( 0, 0, 50, 50) + r = TQt::Rect.new( 0, 0, 50, 50) r.moveBottomLeft( rect().bottomLeft() ) return r end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t10/lcdrange.rb b/qtruby/rubylib/tutorial/t10/lcdrange.rb index a0adc842..2e274174 100644 --- a/qtruby/rubylib/tutorial/t10/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t10/lcdrange.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)' def initialize(parent, name) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) diff --git a/qtruby/rubylib/tutorial/t10/t10.rb b/qtruby/rubylib/tutorial/t10/t10.rb index 4168d507..cd45261a 100755 --- a/qtruby/rubylib/tutorial/t10/t10.rb +++ b/qtruby/rubylib/tutorial/t10/t10.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -31,12 +31,12 @@ class MyWidget < Qt::Widget connect( cannonField, SIGNAL('forceChanged(int)'), force, SLOT('setValue(int)') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( cannonField, 1, 1 ) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) @@ -47,8 +47,8 @@ class MyWidget < Qt::Widget end end -Qt::Application.setColorSpec( Qt::Application::CustomColor ) -a = Qt::Application.new(ARGV) +TQt::Application.setColorSpec( TQt::Application::CustomColor ) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t11/cannon.rb b/qtruby/rubylib/tutorial/t11/cannon.rb index e9446b02..b8fa2826 100644 --- a/qtruby/rubylib/tutorial/t11/cannon.rb +++ b/qtruby/rubylib/tutorial/t11/cannon.rb @@ -1,7 +1,7 @@ include Math -require 'Qt' +retquire 'Qt' -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'angleChanged(int)', 'forceChanged(int)' slots 'setAngle(int)', 'setForce(int)', 'shoot()', 'moveShot()' @@ -11,13 +11,13 @@ class CannonField < Qt::Widget @ang = 45 @f = 0 @timerCount = 0; - @autoShootTimer = Qt::Timer.new( self, 'movement handler' ) + @autoShootTimer = TQt::Timer.new( self, 'movement handler' ) connect( @autoShootTimer, SIGNAL('timeout()'), self, SLOT('moveShot()') ); @shoot_ang = 0 @shoot_f = 0 - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) - @barrelRect = Qt::Rect.new(33, -4, 15, 8) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) + @barrelRect = TQt::Rect.new(33, -4, 15, 8) end def setAngle( degrees ) @@ -56,7 +56,7 @@ class CannonField < Qt::Widget end def moveShot() - r = Qt::Region.new( shotRect() ) + r = TQt::Region.new( shotRect() ) @timerCount += 1 shotR = shotRect() @@ -64,14 +64,14 @@ class CannonField < Qt::Widget if shotR.x() > width() || shotR.y() > height() @autoShootTimer.stop() else - r = r.unite( Qt::Region.new( shotR ) ) + r = r.unite( TQt::Region.new( shotR ) ) end repaint( r ) end def paintEvent( e ) updateR = e.rect() - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) if updateR.intersects( cannonRect() ) paintCannon( p ) @@ -85,20 +85,20 @@ class CannonField < Qt::Widget def paintShot( p ) p.setBrush( black ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.drawRect( shotRect() ) end def paintCannon(p) cr = cannonRect() - pix = Qt::Pixmap.new( cr.size() ) + pix = TQt::Pixmap.new( cr.size() ) pix.fill( self, cr.topLeft() ) - tmp = Qt::Painter.new( pix ) + tmp = TQt::Painter.new( pix ) tmp.setBrush( blue ) - tmp.setPen( Qt::NoPen ) + tmp.setPen( TQt::NoPen ) tmp.translate( 0, pix.height() - 1 ) - tmp.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + tmp.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) tmp.rotate( - @ang ) tmp.drawRect( @barrelRect ) tmp.end() @@ -107,7 +107,7 @@ class CannonField < Qt::Widget end def cannonRect() - r = Qt::Rect.new( 0, 0, 50, 50) + r = TQt::Rect.new( 0, 0, 50, 50) r.moveBottomLeft( rect().bottomLeft() ) return r end @@ -126,12 +126,12 @@ class CannonField < Qt::Widget x = x0 + velx*time y = y0 + vely*time - 0.5*gravity*time*time - r = Qt::Rect.new( 0, 0, 6, 6 ); - r.moveCenter( Qt::Point.new( x.round, height() - 1 - y.round ) ) + r = TQt::Rect.new( 0, 0, 6, 6 ); + r.moveCenter( TQt::Point.new( x.round, height() - 1 - y.round ) ) return r end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t11/lcdrange.rb b/qtruby/rubylib/tutorial/t11/lcdrange.rb index a0adc842..2e274174 100644 --- a/qtruby/rubylib/tutorial/t11/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t11/lcdrange.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)' def initialize(parent, name) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) diff --git a/qtruby/rubylib/tutorial/t11/t11.rb b/qtruby/rubylib/tutorial/t11/t11.rb index 8656f6f5..f0d3b895 100755 --- a/qtruby/rubylib/tutorial/t11/t11.rb +++ b/qtruby/rubylib/tutorial/t11/t11.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -31,22 +31,22 @@ class MyWidget < Qt::Widget connect( cannonField, SIGNAL('forceChanged(int)'), force, SLOT('setValue(int)') ) - shoot = Qt::PushButton.new( '&Shoot', self, 'shoot' ) - shoot.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + shoot = TQt::PushButton.new( '&Shoot', self, 'shoot' ) + shoot.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( shoot, SIGNAL('clicked()'), cannonField, SLOT('shoot()') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( cannonField, 1, 1 ) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) - topBox = Qt::HBoxLayout.new() + topBox = TQt::HBoxLayout.new() grid.addLayout( topBox, 0, 1 ) topBox.addWidget( shoot ) topBox.addStretch( 1 ) @@ -57,8 +57,8 @@ class MyWidget < Qt::Widget end end -Qt::Application.setColorSpec( Qt::Application::CustomColor ) -a = Qt::Application.new(ARGV) +TQt::Application.setColorSpec( TQt::Application::CustomColor ) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t12/cannon.rb b/qtruby/rubylib/tutorial/t12/cannon.rb index 1b72cbc0..28afb5c6 100644 --- a/qtruby/rubylib/tutorial/t12/cannon.rb +++ b/qtruby/rubylib/tutorial/t12/cannon.rb @@ -1,7 +1,7 @@ include Math -require 'Qt' +retquire 'Qt' -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'hit()', 'missed()', 'angleChanged(int)', 'forceChanged(int)' slots 'setAngle(int)', 'setForce(int)', 'shoot()', 'moveShot()', 'newTarget()' @@ -11,15 +11,15 @@ class CannonField < Qt::Widget @ang = 45 @f = 0 @timerCount = 0; - @autoShootTimer = Qt::Timer.new( self, 'movement handler' ) + @autoShootTimer = TQt::Timer.new( self, 'movement handler' ) connect( @autoShootTimer, SIGNAL('timeout()'), self, SLOT('moveShot()') ); @shoot_ang = 0 @shoot_f = 0 - @target = Qt::Point.new(0, 0) - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + @target = TQt::Point.new(0, 0) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) newTarget() - @barrelRect = Qt::Rect.new(33, -4, 15, 8) + @barrelRect = TQt::Rect.new(33, -4, 15, 8) end def setAngle( degrees ) @@ -62,17 +62,17 @@ class CannonField < Qt::Widget def newTarget() if @@first_time @@first_time = false - midnight = Qt::Time.new( 0, 0, 0 ) - srand( midnight.secsTo(Qt::Time.currentTime()) ) + midnight = TQt::Time.new( 0, 0, 0 ) + srand( midnight.secsTo(TQt::Time.currentTime()) ) end - r = Qt::Region.new( targetRect() ) - @target = Qt::Point.new( 200 + rand(190), + r = TQt::Region.new( targetRect() ) + @target = TQt::Point.new( 200 + rand(190), 10 + rand(255) ) - repaint( r.unite( Qt::Region.new(targetRect()) ) ) + repaint( r.unite( TQt::Region.new(targetRect()) ) ) end def moveShot() - r = Qt::Region.new( shotRect() ) + r = TQt::Region.new( shotRect() ) @timerCount += 1 shotR = shotRect() @@ -84,7 +84,7 @@ class CannonField < Qt::Widget @autoShootTimer.stop() emit missed() else - r = r.unite( Qt::Region.new( shotR ) ) + r = r.unite( TQt::Region.new( shotR ) ) end repaint( r ) @@ -92,7 +92,7 @@ class CannonField < Qt::Widget def paintEvent( e ) updateR = e.rect() - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) if updateR.intersects( cannonRect() ) paintCannon( p ) @@ -109,7 +109,7 @@ class CannonField < Qt::Widget def paintShot( p ) p.setBrush( black ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.drawRect( shotRect() ) end @@ -121,14 +121,14 @@ class CannonField < Qt::Widget def paintCannon(p) cr = cannonRect() - pix = Qt::Pixmap.new( cr.size() ) + pix = TQt::Pixmap.new( cr.size() ) pix.fill( self, cr.topLeft() ) - tmp = Qt::Painter.new( pix ) + tmp = TQt::Painter.new( pix ) tmp.setBrush( blue ) - tmp.setPen( Qt::NoPen ) + tmp.setPen( TQt::NoPen ) tmp.translate( 0, pix.height() - 1 ) - tmp.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + tmp.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) tmp.rotate( - @ang ) tmp.drawRect( @barrelRect ) tmp.end() @@ -137,7 +137,7 @@ class CannonField < Qt::Widget end def cannonRect() - r = Qt::Rect.new( 0, 0, 50, 50) + r = TQt::Rect.new( 0, 0, 50, 50) r.moveBottomLeft( rect().bottomLeft() ) return r end @@ -156,18 +156,18 @@ class CannonField < Qt::Widget x = x0 + velx*time y = y0 + vely*time - 0.5*gravity*time*time - r = Qt::Rect.new( 0, 0, 6, 6 ); - r.moveCenter( Qt::Point.new( x.round, height() - 1 - y.round ) ) + r = TQt::Rect.new( 0, 0, 6, 6 ); + r.moveCenter( TQt::Point.new( x.round, height() - 1 - y.round ) ) return r end def targetRect() - r = Qt::Rect.new( 0, 0, 20, 10 ) - r.moveCenter( Qt::Point.new(@target.x(),height() - 1 - @target.y()) ); + r = TQt::Rect.new( 0, 0, 20, 10 ) + r.moveCenter( TQt::Point.new(@target.x(),height() - 1 - @target.y()) ); return r end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t12/lcdrange.rb b/qtruby/rubylib/tutorial/t12/lcdrange.rb index ef5c849d..5e1c96ca 100644 --- a/qtruby/rubylib/tutorial/t12/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t12/lcdrange.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)', 'setText(const char *)' @@ -11,12 +11,12 @@ class LCDRange < Qt::VBox end def init() - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) - @label = Qt::Label.new( ' ', self, 'label' ) - @label.setAlignment( Qt::AlignCenter ) + @label = TQt::Label.new( ' ', self, 'label' ) + @label.setAlignment( TQt::AlignCenter ) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')) setFocusProxy(@slider) diff --git a/qtruby/rubylib/tutorial/t12/t12.rb b/qtruby/rubylib/tutorial/t12/t12.rb index a02c3a8e..b1427cb2 100755 --- a/qtruby/rubylib/tutorial/t12/t12.rb +++ b/qtruby/rubylib/tutorial/t12/t12.rb @@ -1,16 +1,16 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize() super - quit = Qt::PushButton.new('&Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('&Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -32,22 +32,22 @@ class MyWidget < Qt::Widget connect( cannonField, SIGNAL('forceChanged(int)'), force, SLOT('setValue(int)') ) - shoot = Qt::PushButton.new( '&Shoot', self, 'shoot' ) - shoot.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + shoot = TQt::PushButton.new( '&Shoot', self, 'shoot' ) + shoot.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( shoot, SIGNAL('clicked()'), cannonField, SLOT('shoot()') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( cannonField, 1, 1 ) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) - topBox = Qt::HBoxLayout.new() + topBox = TQt::HBoxLayout.new() grid.addLayout( topBox, 0, 1 ) topBox.addWidget( shoot ) topBox.addStretch( 1 ) @@ -58,8 +58,8 @@ class MyWidget < Qt::Widget end end -Qt::Application.setColorSpec( Qt::Application::CustomColor ) -a = Qt::Application.new(ARGV) +TQt::Application.setColorSpec( TQt::Application::CustomColor ) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t13/cannon.rb b/qtruby/rubylib/tutorial/t13/cannon.rb index d99f9a09..556347bc 100644 --- a/qtruby/rubylib/tutorial/t13/cannon.rb +++ b/qtruby/rubylib/tutorial/t13/cannon.rb @@ -1,7 +1,7 @@ -require 'Qt' +retquire 'Qt' include Math -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'hit()', 'missed()', 'angleChanged(int)', 'forceChanged(int)', 'canShoot(bool)' @@ -15,16 +15,16 @@ class CannonField < Qt::Widget @ang = 45 @f = 0 @timerCount = 0; - @autoShootTimer = Qt::Timer.new( self, "movement handler" ) + @autoShootTimer = TQt::Timer.new( self, "movement handler" ) connect( @autoShootTimer, SIGNAL('timeout()'), self, SLOT('moveShot()') ); @shoot_ang = 0 @shoot_f = 0 - @target = Qt::Point.new(0, 0) + @target = TQt::Point.new(0, 0) @gameEnded = false - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) newTarget() - @barrelRect = Qt::Rect.new(33, -4, 15, 8) + @barrelRect = TQt::Rect.new(33, -4, 15, 8) end def angle() @@ -78,13 +78,13 @@ class CannonField < Qt::Widget def newTarget() if @@first_time @@first_time = false - midnight = Qt::Time.new( 0, 0, 0 ) - srand( midnight.secsTo(Qt::Time.currentTime()) ) + midnight = TQt::Time.new( 0, 0, 0 ) + srand( midnight.secsTo(TQt::Time.currentTime()) ) end - r = Qt::Region.new( targetRect() ) - @target = Qt::Point.new( 200 + rand(190), + r = TQt::Region.new( targetRect() ) + @target = TQt::Point.new( 200 + rand(190), 10 + rand(255) ) - repaint( r.unite( Qt::Region.new(targetRect()) ) ) + repaint( r.unite( TQt::Region.new(targetRect()) ) ) end def setGameOver() @@ -108,7 +108,7 @@ class CannonField < Qt::Widget end def moveShot() - r = Qt::Region.new( shotRect() ) + r = TQt::Region.new( shotRect() ) @timerCount += 1 shotR = shotRect() @@ -122,7 +122,7 @@ class CannonField < Qt::Widget emit missed() emit canShoot(true) else - r = r.unite( Qt::Region.new( shotR ) ) + r = r.unite( TQt::Region.new( shotR ) ) end repaint( r ) @@ -130,11 +130,11 @@ class CannonField < Qt::Widget def paintEvent( e ) updateR = e.rect() - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) if @gameEnded p.setPen( black ) - p.setFont( Qt::Font.new( "Courier", 48, QFont::Bold ) ) + p.setFont( TQt::Font.new( "Courier", 48, TQFont::Bold ) ) p.drawText( rect(), AlignCenter, "Game Over" ) end if updateR.intersects( cannonRect() ) @@ -151,7 +151,7 @@ class CannonField < Qt::Widget def paintShot( p ) p.setBrush( black ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.drawRect( shotRect() ) end @@ -163,14 +163,14 @@ class CannonField < Qt::Widget def paintCannon(p) cr = cannonRect() - pix = Qt::Pixmap.new( cr.size() ) + pix = TQt::Pixmap.new( cr.size() ) pix.fill( self, cr.topLeft() ) - tmp = Qt::Painter.new( pix ) + tmp = TQt::Painter.new( pix ) tmp.setBrush( blue ) - tmp.setPen( Qt::NoPen ) + tmp.setPen( TQt::NoPen ) tmp.translate( 0, pix.height() - 1 ) - tmp.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + tmp.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) tmp.rotate( - @ang ) tmp.drawRect( @barrelRect ) tmp.end() @@ -179,7 +179,7 @@ class CannonField < Qt::Widget end def cannonRect() - r = Qt::Rect.new( 0, 0, 50, 50) + r = TQt::Rect.new( 0, 0, 50, 50) r.moveBottomLeft( rect().bottomLeft() ) return r end @@ -198,14 +198,14 @@ class CannonField < Qt::Widget x = x0 + velx*time y = y0 + vely*time - 0.5*gravity*time*time - r = Qt::Rect.new( 0, 0, 6, 6 ); - r.moveCenter( Qt::Point.new( x.round, height() - 1 - y.round ) ) + r = TQt::Rect.new( 0, 0, 6, 6 ); + r.moveCenter( TQt::Point.new( x.round, height() - 1 - y.round ) ) return r end def targetRect() - r = Qt::Rect.new( 0, 0, 20, 10 ) - r.moveCenter( Qt::Point.new(@target.x(),height() - 1 - @target.y()) ); + r = TQt::Rect.new( 0, 0, 20, 10 ) + r.moveCenter( TQt::Point.new(@target.x(),height() - 1 - @target.y()) ); return r end @@ -214,6 +214,6 @@ class CannonField < Qt::Widget end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t13/gamebrd.rb b/qtruby/rubylib/tutorial/t13/gamebrd.rb index dc993927..46cc10c5 100644 --- a/qtruby/rubylib/tutorial/t13/gamebrd.rb +++ b/qtruby/rubylib/tutorial/t13/gamebrd.rb @@ -1,15 +1,15 @@ -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class GameBoard < Qt::Widget +class GameBoard < TQt::Widget slots 'fire()', 'hit()', 'missed()', 'newGame()' def initialize() super - quit = Qt::PushButton.new('&Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('&Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -36,34 +36,34 @@ class GameBoard < Qt::Widget connect( @cannonField, SIGNAL('missed()'), self, SLOT('missed()') ) - shoot = Qt::PushButton.new( '&Shoot', self, 'shoot' ) - shoot.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + shoot = TQt::PushButton.new( '&Shoot', self, 'shoot' ) + shoot.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( shoot, SIGNAL('clicked()'), SLOT('fire()') ) connect( @cannonField, SIGNAL('canShoot(bool)'), shoot, SLOT('setEnabled(bool)') ) - restart = Qt::PushButton.new( '&New Game', self, 'newgame' ) - restart.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + restart = TQt::PushButton.new( '&New Game', self, 'newgame' ) + restart.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( restart, SIGNAL('clicked()'), self, SLOT('newGame()') ) - @hits = Qt::LCDNumber.new( 2, self, 'hits' ) - @shotsLeft = Qt::LCDNumber.new( 2, self, 'shotsleft' ) - hitsL = Qt::Label.new( 'HITS', self, 'hitsLabel' ) - shotsLeftL = Qt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) + @hits = TQt::LCDNumber.new( 2, self, 'hits' ) + @shotsLeft = TQt::LCDNumber.new( 2, self, 'shotsleft' ) + hitsL = TQt::Label.new( 'HITS', self, 'hitsLabel' ) + shotsLeftL = TQt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( @cannonField, 1, 1 ) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) - topBox = Qt::HBoxLayout.new() + topBox = TQt::HBoxLayout.new() grid.addLayout( topBox, 0, 1 ) topBox.addWidget( shoot ) topBox.addWidget( @hits ) diff --git a/qtruby/rubylib/tutorial/t13/lcdrange.rb b/qtruby/rubylib/tutorial/t13/lcdrange.rb index 03edb89c..a91cc384 100644 --- a/qtruby/rubylib/tutorial/t13/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t13/lcdrange.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::Widget +class LCDRange < TQt::Widget signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)', 'setText(const char*)' @@ -11,20 +11,20 @@ class LCDRange < Qt::Widget end def init() - @lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + @lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) - @label = Qt::Label.new( ' ', self, 'label' ) - @label.setAlignment( Qt::AlignCenter ) + @label = TQt::Label.new( ' ', self, 'label' ) + @label.setAlignment( TQt::AlignCenter ) connect(@slider, SIGNAL('valueChanged(int)'), @lcd, SLOT('display(int)')) connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')) setFocusProxy(@slider) - l = Qt::VBoxLayout.new( self ) + l = TQt::VBoxLayout.new( self ) l.addWidget( @lcd, 1 ) l.addWidget( @slider ) l.addWidget( @label ) diff --git a/qtruby/rubylib/tutorial/t13/t13.rb b/qtruby/rubylib/tutorial/t13/t13.rb index 817dfe70..8e63bcd6 100755 --- a/qtruby/rubylib/tutorial/t13/t13.rb +++ b/qtruby/rubylib/tutorial/t13/t13.rb @@ -1,11 +1,11 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'gamebrd.rb' +retquire 'Qt' +retquire 'gamebrd.rb' -Qt::Application.setColorSpec( Qt::Application::CustomColor ) -a = Qt::Application.new(ARGV) +TQt::Application.setColorSpec( TQt::Application::CustomColor ) +a = TQt::Application.new(ARGV) gb = GameBoard.new gb.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t14/cannon.rb b/qtruby/rubylib/tutorial/t14/cannon.rb index b0f77d37..3c1d7663 100644 --- a/qtruby/rubylib/tutorial/t14/cannon.rb +++ b/qtruby/rubylib/tutorial/t14/cannon.rb @@ -1,7 +1,7 @@ -require 'Qt' +retquire 'Qt' include Math -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'hit()', 'missed()', 'angleChanged(int)', 'forceChanged(int)', 'canShoot(bool)' @@ -14,17 +14,17 @@ class CannonField < Qt::Widget @ang = 45 @f = 0 @timerCount = 0; - @autoShootTimer = Qt::Timer.new( self, 'movement handler' ) + @autoShootTimer = TQt::Timer.new( self, 'movement handler' ) connect( @autoShootTimer, SIGNAL('timeout()'), self, SLOT('moveShot()') ) @shoot_ang = 0 @shoot_f = 0 - @target = Qt::Point.new(0, 0) + @target = TQt::Point.new(0, 0) @gameEnded = false @barrelPressed = false - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) newTarget() - @barrelRect = Qt::Rect.new(33, -4, 15, 8) + @barrelRect = TQt::Rect.new(33, -4, 15, 8) end def angle() @@ -80,13 +80,13 @@ class CannonField < Qt::Widget def newTarget() if @@first_time @@first_time = false - midnight = Qt::Time.new( 0, 0, 0 ) - srand( midnight.secsTo(Qt::Time.currentTime()) ) + midnight = TQt::Time.new( 0, 0, 0 ) + srand( midnight.secsTo(TQt::Time.currentTime()) ) end - r = Qt::Region.new( targetRect() ) - @target = Qt::Point.new( 200 + rand(190), + r = TQt::Region.new( targetRect() ) + @target = TQt::Point.new( 200 + rand(190), 10 + rand(255) ) - repaint( r.unite( Qt::Region.new(targetRect()) ) ) + repaint( r.unite( TQt::Region.new(targetRect()) ) ) end def setGameOver() @@ -110,7 +110,7 @@ class CannonField < Qt::Widget end def moveShot() - r = Qt::Region.new( shotRect() ) + r = TQt::Region.new( shotRect() ) @timerCount += 1 shotR = shotRect() @@ -125,7 +125,7 @@ class CannonField < Qt::Widget emit missed() emit canShoot(true) else - r = r.unite( Qt::Region.new( shotR ) ) + r = r.unite( TQt::Region.new( shotR ) ) end repaint( r ) @@ -133,7 +133,7 @@ class CannonField < Qt::Widget private :moveShot def mousePressEvent( e ) - if e.button() != Qt::LeftButton + if e.button() != TQt::LeftButton return end if barrelHit( e.pos() ) @@ -157,19 +157,19 @@ class CannonField < Qt::Widget end def mouseReleaseEvent( e ) - if e.button() == Qt::LeftButton + if e.button() == TQt::LeftButton @barrelPressed = false end end def paintEvent( e ) updateR = e.rect() - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) if @gameEnded p.setPen( black ) - p.setFont( Qt::Font.new( 'Courier', 48, Qt::Font::Bold ) ) - p.drawText( rect(), Qt::AlignCenter, 'Game Over' ) + p.setFont( TQt::Font.new( 'Courier', 48, TQt::Font::Bold ) ) + p.drawText( rect(), TQt::AlignCenter, 'Game Over' ) end if updateR.intersects( cannonRect() ) paintCannon( p ) @@ -189,7 +189,7 @@ class CannonField < Qt::Widget def paintShot( p ) p.setBrush( black ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.drawRect( shotRect() ) end @@ -207,15 +207,15 @@ class CannonField < Qt::Widget def paintCannon(p) cr = cannonRect() - pix = Qt::Pixmap.new( cr.size() ) + pix = TQt::Pixmap.new( cr.size() ) pix.fill( self, cr.topLeft() ) - tmp = Qt::Painter.new( pix ) + tmp = TQt::Painter.new( pix ) tmp.setBrush( blue ) - tmp.setPen( Qt::NoPen ) + tmp.setPen( TQt::NoPen ) tmp.translate( 0, pix.height() - 1 ) - tmp.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + tmp.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) tmp.rotate( - @ang ) tmp.drawRect( @barrelRect ) tmp.end() @@ -225,7 +225,7 @@ class CannonField < Qt::Widget private :paintShot, :paintTarget, :paintBarrier, :paintCannon def cannonRect() - r = Qt::Rect.new( 0, 0, 50, 50) + r = TQt::Rect.new( 0, 0, 50, 50) r.moveBottomLeft( rect().bottomLeft() ) return r end @@ -244,23 +244,23 @@ class CannonField < Qt::Widget x = x0 + velx*time y = y0 + vely*time - 0.5*gravity*time*time - r = Qt::Rect.new( 0, 0, 6, 6 ); - r.moveCenter( Qt::Point.new( x.round, height() - 1 - y.round ) ) + r = TQt::Rect.new( 0, 0, 6, 6 ); + r.moveCenter( TQt::Point.new( x.round, height() - 1 - y.round ) ) return r end def targetRect() - r = Qt::Rect.new( 0, 0, 20, 10 ) - r.moveCenter( Qt::Point.new(@target.x(),height() - 1 - @target.y()) ) + r = TQt::Rect.new( 0, 0, 20, 10 ) + r.moveCenter( TQt::Point.new(@target.x(),height() - 1 - @target.y()) ) return r end def barrierRect() - return Qt::Rect.new( 145, height() - 100, 15, 100 ) + return TQt::Rect.new( 145, height() - 100, 15, 100 ) end def barrelHit( p ) - mtx = Qt::WMatrix.new + mtx = TQt::WMatrix.new mtx.translate( 0, height() - 1 ) mtx.rotate( - @ang ) mtx = mtx.invert() @@ -274,6 +274,6 @@ class CannonField < Qt::Widget end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t14/gamebrd.rb b/qtruby/rubylib/tutorial/t14/gamebrd.rb index b72d58c1..4ae474c2 100644 --- a/qtruby/rubylib/tutorial/t14/gamebrd.rb +++ b/qtruby/rubylib/tutorial/t14/gamebrd.rb @@ -1,14 +1,14 @@ -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class GameBoard < Qt::Widget +class GameBoard < TQt::Widget slots 'fire()', 'hit()', 'missed()', 'newGame()' def initialize() super - quit = Qt::PushButton.new('&Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('&Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -18,8 +18,8 @@ class GameBoard < Qt::Widget force = LCDRange.new( 'FORCE', self, 'force' ) force.setRange( 10, 50 ) - box = Qt::VBox.new( self, 'cannonFrame' ) - box.setFrameStyle( Qt::Frame::WinPanel | Qt::Frame::Sunken ) + box = TQt::VBox.new( self, 'cannonFrame' ) + box.setFrameStyle( TQt::Frame::WinPanel | TQt::Frame::Sunken ) @cannonField = CannonField.new( box, 'cannonField' ) connect( angle, SIGNAL('valueChanged(int)'), @@ -37,42 +37,42 @@ class GameBoard < Qt::Widget connect( @cannonField, SIGNAL('missed()'), self, SLOT('missed()') ) - shoot = Qt::PushButton.new( '&Shoot', self, 'shoot' ) - shoot.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + shoot = TQt::PushButton.new( '&Shoot', self, 'shoot' ) + shoot.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( shoot, SIGNAL('clicked()'), SLOT('fire()') ) connect( @cannonField, SIGNAL('canShoot(bool)'), shoot, SLOT('setEnabled(bool)') ) - restart = Qt::PushButton.new( '&New Game', self, 'newgame' ) - restart.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + restart = TQt::PushButton.new( '&New Game', self, 'newgame' ) + restart.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( restart, SIGNAL('clicked()'), self, SLOT('newGame()') ) - @hits = Qt::LCDNumber.new( 2, self, 'hits' ) - @shotsLeft = Qt::LCDNumber.new( 2, self, 'shotsleft' ) - hitsL = Qt::Label.new( 'HITS', self, 'hitsLabel' ) - shotsLeftL = Qt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) + @hits = TQt::LCDNumber.new( 2, self, 'hits' ) + @shotsLeft = TQt::LCDNumber.new( 2, self, 'shotsleft' ) + hitsL = TQt::Label.new( 'HITS', self, 'hitsLabel' ) + shotsLeftL = TQt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) - accel = Qt::Accel.new( self ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(Key_Enter) ), + accel = TQt::Accel.new( self ) + accel.connectItem( accel.insertItem( TQt::KeySequence.new(Key_Enter) ), self, SLOT('fire()') ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(Key_Return) ), + accel.connectItem( accel.insertItem( TQt::KeySequence.new(Key_Return) ), self, SLOT('fire()') ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(CTRL+Key_Q) ), + accel.connectItem( accel.insertItem( TQt::KeySequence.new(CTRL+Key_Q) ), $qApp, SLOT('quit()') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( box, 1, 1) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) - topBox = Qt::HBoxLayout.new() + topBox = TQt::HBoxLayout.new() grid.addLayout( topBox, 0, 1 ) topBox.addWidget( shoot ) topBox.addWidget( @hits ) diff --git a/qtruby/rubylib/tutorial/t14/lcdrange.rb b/qtruby/rubylib/tutorial/t14/lcdrange.rb index 492d93b1..872e3723 100644 --- a/qtruby/rubylib/tutorial/t14/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t14/lcdrange.rb @@ -1,6 +1,6 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::Widget +class LCDRange < TQt::Widget signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)', 'setText(const char*)' @@ -11,20 +11,20 @@ class LCDRange < Qt::Widget end def init() - @lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + @lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) - @label = Qt::Label.new( ' ', self, 'label' ) - @label.setAlignment( Qt::AlignCenter ) + @label = TQt::Label.new( ' ', self, 'label' ) + @label.setAlignment( TQt::AlignCenter ) connect(@slider, SIGNAL('valueChanged(int)'), @lcd, SLOT('display(int)')) connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)')) setFocusProxy(@slider) - @l = Qt::VBoxLayout.new( self ) + @l = TQt::VBoxLayout.new( self ) @l.addWidget( @lcd, 1 ) @l.addWidget( @slider ) @l.addWidget( @label ) diff --git a/qtruby/rubylib/tutorial/t14/t14.rb b/qtruby/rubylib/tutorial/t14/t14.rb index 817dfe70..8e63bcd6 100755 --- a/qtruby/rubylib/tutorial/t14/t14.rb +++ b/qtruby/rubylib/tutorial/t14/t14.rb @@ -1,11 +1,11 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'gamebrd.rb' +retquire 'Qt' +retquire 'gamebrd.rb' -Qt::Application.setColorSpec( Qt::Application::CustomColor ) -a = Qt::Application.new(ARGV) +TQt::Application.setColorSpec( TQt::Application::CustomColor ) +a = TQt::Application.new(ARGV) gb = GameBoard.new gb.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t2/t2.rb b/qtruby/rubylib/tutorial/t2/t2.rb index 8139e98c..a1764f1e 100755 --- a/qtruby/rubylib/tutorial/t2/t2.rb +++ b/qtruby/rubylib/tutorial/t2/t2.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt'; +retquire 'Qt'; -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) -quit = Qt::PushButton.new('Quit', nil) +quit = TQt::PushButton.new('Quit', nil) quit.resize(75, 30) -quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) +quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) -Qt::Object.connect(quit, SIGNAL('clicked()'), a, SLOT('quit()')) +TQt::Object.connect(quit, SIGNAL('clicked()'), a, SLOT('quit()')) a.setMainWidget(quit) quit.show diff --git a/qtruby/rubylib/tutorial/t3/t3.rb b/qtruby/rubylib/tutorial/t3/t3.rb index 305afbc4..6b3b29a1 100755 --- a/qtruby/rubylib/tutorial/t3/t3.rb +++ b/qtruby/rubylib/tutorial/t3/t3.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' +retquire 'Qt' -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) -box = Qt::VBox.new() +box = TQt::VBox.new() box.resize(200, 120) -quit = Qt::PushButton.new('Quit', box) -quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) +quit = TQt::PushButton.new('Quit', box) +quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) a.connect(quit, SIGNAL('clicked()'), SLOT('quit()')) diff --git a/qtruby/rubylib/tutorial/t4/t4.rb b/qtruby/rubylib/tutorial/t4/t4.rb index ae48b7ac..df91d90d 100755 --- a/qtruby/rubylib/tutorial/t4/t4.rb +++ b/qtruby/rubylib/tutorial/t4/t4.rb @@ -1,24 +1,24 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' +retquire 'Qt' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize(parent = nil, name = nil) super setMinimumSize(200, 120) setMaximumSize(200, 120) - quit = Qt::PushButton.new('Quit', self, 'quit') + quit = TQt::PushButton.new('Quit', self, 'quit') quit.setGeometry(62, 40, 75, 30) - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry(100, 100, 200, 120) diff --git a/qtruby/rubylib/tutorial/t5/t5.rb b/qtruby/rubylib/tutorial/t5/t5.rb index 6eb7f808..debe5dff 100755 --- a/qtruby/rubylib/tutorial/t5/t5.rb +++ b/qtruby/rubylib/tutorial/t5/t5.rb @@ -1,20 +1,20 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' +retquire 'Qt' -class MyWidget < Qt::VBox +class MyWidget < TQt::VBox def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) - lcd = Qt::LCDNumber.new(2, self, 'lcd') + lcd = TQt::LCDNumber.new(2, self, 'lcd') - slider = Qt::Slider.new(Horizontal, self, 'slider') + slider = TQt::Slider.new(Horizontal, self, 'slider') slider.setRange(0, 99) slider.setValue(0) @@ -23,7 +23,7 @@ end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new a.setMainWidget(w) diff --git a/qtruby/rubylib/tutorial/t6/t6.rb b/qtruby/rubylib/tutorial/t6/t6.rb index d89203d0..11389ae8 100755 --- a/qtruby/rubylib/tutorial/t6/t6.rb +++ b/qtruby/rubylib/tutorial/t6/t6.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox def initialize(grid) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') + lcd = TQt::LCDNumber.new(2, self, 'lcd') - slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') slider.setRange(0, 99) slider.setValue(0) @@ -18,15 +18,15 @@ end end -class MyWidget < Qt::VBox +class MyWidget < TQt::VBox def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) - grid = Qt::Grid.new( 4, self ) + grid = TQt::Grid.new( 4, self ) for c in 0..3 for r in 0..3 @@ -37,7 +37,7 @@ end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new a.setMainWidget(w) diff --git a/qtruby/rubylib/tutorial/t7/lcdrange.rb b/qtruby/rubylib/tutorial/t7/lcdrange.rb index 3df3c961..1bea2ebc 100644 --- a/qtruby/rubylib/tutorial/t7/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t7/lcdrange.rb @@ -1,14 +1,14 @@ #!/usr/bin/ruby -w -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)' def initialize(grid) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) diff --git a/qtruby/rubylib/tutorial/t7/t7.rb b/qtruby/rubylib/tutorial/t7/t7.rb index 396953de..0d757fd0 100755 --- a/qtruby/rubylib/tutorial/t7/t7.rb +++ b/qtruby/rubylib/tutorial/t7/t7.rb @@ -1,18 +1,18 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' +retquire 'Qt' +retquire 'lcdrange.rb' -class MyWidget < Qt::VBox +class MyWidget < TQt::VBox def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) - grid = Qt::Grid.new( 4, self ) + grid = TQt::Grid.new( 4, self ) previous = nil for c in 0..3 @@ -29,7 +29,7 @@ end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new a.setMainWidget(w) diff --git a/qtruby/rubylib/tutorial/t8/cannon.rb b/qtruby/rubylib/tutorial/t8/cannon.rb index b3202a93..7eb8fbff 100644 --- a/qtruby/rubylib/tutorial/t8/cannon.rb +++ b/qtruby/rubylib/tutorial/t8/cannon.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'angleChanged(int)' slots 'setAngle(int)' def initialize(parent, name) super @ang = 45 - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) end def setAngle( degrees ) @@ -26,13 +26,13 @@ class CannonField < Qt::Widget def paintEvent( event ) s = "Angle = #{@ang}" - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) p.drawText( 200, 200, s ) p.end() end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t8/lcdrange.rb b/qtruby/rubylib/tutorial/t8/lcdrange.rb index 011196fd..6d9fdb9f 100644 --- a/qtruby/rubylib/tutorial/t8/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t8/lcdrange.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)' def initialize(parent, name) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) diff --git a/qtruby/rubylib/tutorial/t8/t8.rb b/qtruby/rubylib/tutorial/t8/t8.rb index 881d15e7..05c972db 100755 --- a/qtruby/rubylib/tutorial/t8/t8.rb +++ b/qtruby/rubylib/tutorial/t8/t8.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -22,7 +22,7 @@ class MyWidget < Qt::Widget cannonField, SLOT('setAngle(int)') ) connect( cannonField, SIGNAL('angleChanged(int)'), angle, SLOT('setValue(int)') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) # 2x2, 10 pixel border grid.addWidget( quit, 0, 0 ) @@ -35,7 +35,7 @@ class MyWidget < Qt::Widget end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry( 100, 100, 500, 355 ) diff --git a/qtruby/rubylib/tutorial/t9/cannon.rb b/qtruby/rubylib/tutorial/t9/cannon.rb index 14bcc70f..7cb31756 100644 --- a/qtruby/rubylib/tutorial/t9/cannon.rb +++ b/qtruby/rubylib/tutorial/t9/cannon.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class CannonField < Qt::Widget +class CannonField < TQt::Widget signals 'angleChanged(int)' slots 'setAngle(int)' def initialize(parent, name) super @ang = 45 - setPalette( Qt::Palette.new( Qt::Color.new( 250, 250, 200) ) ) + setPalette( TQt::Palette.new( TQt::Color.new( 250, 250, 200) ) ) end def setAngle( degrees ) @@ -25,19 +25,19 @@ class CannonField < Qt::Widget end def paintEvent( event ) - p = Qt::Painter.new( self ) + p = TQt::Painter.new( self ) p.setBrush( blue ) - p.setPen( Qt::NoPen ) + p.setPen( TQt::NoPen ) p.translate( 0, rect().bottom() ) - p.drawPie( Qt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) + p.drawPie( TQt::Rect.new(-35, -35, 70, 70), 0, 90*16 ) p.rotate( - @ang ) - p.drawRect( Qt::Rect.new(33, -4, 15, 8) ) + p.drawRect( TQt::Rect.new(33, -4, 15, 8) ) p.end() end def sizePolicy() - return Qt::SizePolicy.new( Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding ) + return TQt::SizePolicy.new( TQt::SizePolicy::Expanding, TQt::SizePolicy::Expanding ) end end diff --git a/qtruby/rubylib/tutorial/t9/lcdrange.rb b/qtruby/rubylib/tutorial/t9/lcdrange.rb index 6eb2f732..2afabe75 100644 --- a/qtruby/rubylib/tutorial/t9/lcdrange.rb +++ b/qtruby/rubylib/tutorial/t9/lcdrange.rb @@ -1,13 +1,13 @@ -require 'Qt' +retquire 'Qt' -class LCDRange < Qt::VBox +class LCDRange < TQt::VBox signals 'valueChanged(int)' slots 'setValue(int)', 'setRange(int, int)' def initialize(parent, name) super - lcd = Qt::LCDNumber.new(2, self, 'lcd') - @slider = Qt::Slider.new(Qt::VBox::Horizontal, self, 'slider') + lcd = TQt::LCDNumber.new(2, self, 'lcd') + @slider = TQt::Slider.new(TQt::VBox::Horizontal, self, 'slider') @slider.setRange(0, 99) @slider.setValue(0) connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) diff --git a/qtruby/rubylib/tutorial/t9/t9.rb b/qtruby/rubylib/tutorial/t9/t9.rb index 4185b972..2ab7c1b3 100755 --- a/qtruby/rubylib/tutorial/t9/t9.rb +++ b/qtruby/rubylib/tutorial/t9/t9.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby $VERBOSE = true; $:.unshift File.dirname($0) -require 'Qt' -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'Qt' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class MyWidget < Qt::Widget +class MyWidget < TQt::Widget def initialize() super - quit = Qt::PushButton.new('Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -22,11 +22,11 @@ class MyWidget < Qt::Widget cannonField, SLOT('setAngle(int)') ) connect( cannonField, SIGNAL('angleChanged(int)'), angle, SLOT('setValue(int)') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) # 2x2, 10 pixel border grid.addWidget( quit, 0, 0 ) - grid.addWidget( angle, 1, 0, Qt::AlignTop ) + grid.addWidget( angle, 1, 0, TQt::AlignTop ) grid.addWidget( cannonField, 1, 1 ) grid.setColStretch( 1, 10 ) @@ -35,7 +35,7 @@ class MyWidget < Qt::Widget end end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) w = MyWidget.new w.setGeometry( 100, 100, 500, 355 ) |