diff options
Diffstat (limited to 'languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb')
-rw-r--r-- | languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb b/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb index 26b0b378..df98824d 100644 --- a/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb +++ b/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb @@ -1,4 +1,4 @@ -class %{APPNAMESC} < Qt::MainWindow +class %{APPNAMESC} < TQt::MainWindow Q_SLOTS 'newDoc()', 'choose()', @@ -11,61 +11,61 @@ class %{APPNAMESC} < Qt::MainWindow def initialize() super( nil, "%{APPNAMESC}", WDestructiveClose ) - @printer = Qt::Printer.new + @printer = TQt::Printer.new - fileTools = Qt::ToolBar.new( self, "file operations" ) + fileTools = TQt::ToolBar.new( self, "file operations" ) fileTools.setLabel( tr("File Operations") ) - openIcon = Qt::Pixmap.new( "fileopen.xpm" ) - fileOpen = Qt::ToolButton.new( Qt::IconSet.new(openIcon), tr("Open File"), nil, + openIcon = TQt::Pixmap.new( "fileopen.xpm" ) + fileOpen = TQt::ToolButton.new( TQt::IconSet.new(openIcon), tr("Open File"), nil, self, SLOT('choose()'), fileTools, "open file" ) - saveIcon = Qt::Pixmap.new( "filesave.xpm" ) - fileSave = Qt::ToolButton.new( Qt::IconSet.new(saveIcon), tr("Save File"), nil, + saveIcon = TQt::Pixmap.new( "filesave.xpm" ) + fileSave = TQt::ToolButton.new( TQt::IconSet.new(saveIcon), tr("Save File"), nil, self, SLOT('save()'), fileTools, "save file" ) - printIcon = Qt::Pixmap.new( "fileprint.xpm" ) - filePrint = Qt::ToolButton.new( Qt::IconSet.new(printIcon), tr("Print File"), nil, + printIcon = TQt::Pixmap.new( "fileprint.xpm" ) + filePrint = TQt::ToolButton.new( TQt::IconSet.new(printIcon), tr("Print File"), nil, self, SLOT('print()'), fileTools, "print file" ) - Qt::WhatsThis.whatsThisButton( fileTools ) + TQt::WhatsThis.whatsThisButton( fileTools ) fileOpenText = tr('<p><img source="fileopen"> ' + "Click this button to open a <em>new file</em>. <br>" + "You can also select the <b>Open</b> command " + "from the <b>File</b> menu.</p>") - Qt::WhatsThis.add( fileOpen, fileOpenText ) + TQt::WhatsThis.add( fileOpen, fileOpenText ) - Qt::MimeSourceFactory.defaultFactory().setPixmap( "fileopen", openIcon ) + TQt::MimeSourceFactory.defaultFactory().setPixmap( "fileopen", openIcon ) fileSaveText = tr("<p>Click this button to save the file you " + "are editing. You will be prompted for a file name.\n" + "You can also select the <b>Save</b> command " + "from the <b>File</b> menu.</p>") - Qt::WhatsThis.add( fileSave, fileSaveText ) + TQt::WhatsThis.add( fileSave, fileSaveText ) filePrintText = tr("Click this button to print the file you " + "are editing.\n You can also select the Print " + "command from the File menu.") - Qt::WhatsThis.add( filePrint, filePrintText ) + TQt::WhatsThis.add( filePrint, filePrintText ) - file = Qt::PopupMenu.new( self ) + file = TQt::PopupMenu.new( self ) menuBar().insertItem( tr("&File"), file ) - file.insertItem( tr("&New"), self, SLOT('newDoc()'), Qt::KeySequence.new(CTRL+Key_N) ) + file.insertItem( tr("&New"), self, SLOT('newDoc()'), TQt::KeySequence.new(CTRL+Key_N) ) - id = file.insertItem( Qt::IconSet.new(openIcon), tr("&Open..."), - self, SLOT('choose()'), Qt::KeySequence.new(CTRL+Key_O) ) + id = file.insertItem( TQt::IconSet.new(openIcon), tr("&Open..."), + self, SLOT('choose()'), TQt::KeySequence.new(CTRL+Key_O) ) file.setWhatsThis( id, fileOpenText ) - id = file.insertItem( Qt::IconSet.new(saveIcon), tr("&Save"), - self, SLOT('save()'), Qt::KeySequence.new(CTRL+Key_S) ) + id = file.insertItem( TQt::IconSet.new(saveIcon), tr("&Save"), + self, SLOT('save()'), TQt::KeySequence.new(CTRL+Key_S) ) file.setWhatsThis( id, fileSaveText ) id = file.insertItem( tr("Save &As..."), self, SLOT('saveAs()') ) @@ -73,27 +73,27 @@ class %{APPNAMESC} < Qt::MainWindow file.insertSeparator() - id = file.insertItem( Qt::IconSet.new(printIcon), tr("&Print..."), - self, SLOT('print()'), Qt::KeySequence.new(CTRL+Key_P) ) + id = file.insertItem( TQt::IconSet.new(printIcon), tr("&Print..."), + self, SLOT('print()'), TQt::KeySequence.new(CTRL+Key_P) ) file.setWhatsThis( id, filePrintText ) file.insertSeparator() - file.insertItem( tr("&Close"), self, SLOT('close()'), Qt::KeySequence.new(CTRL+Key_W) ) + file.insertItem( tr("&Close"), self, SLOT('close()'), TQt::KeySequence.new(CTRL+Key_W) ) - file.insertItem( tr("&Quit"), $tqApp, SLOT( 'closeAllWindows()' ), Qt::KeySequence.new(CTRL+Key_Q) ) + file.insertItem( tr("&Quit"), $tqApp, SLOT( 'closeAllWindows()' ), TQt::KeySequence.new(CTRL+Key_Q) ) menuBar().insertSeparator() - help = Qt::PopupMenu.new( self ) + help = TQt::PopupMenu.new( self ) menuBar().insertItem( tr("&Help"), help ) - help.insertItem( tr("&About"), self, SLOT('about()'), Qt::KeySequence.new(Key_F1) ) + help.insertItem( tr("&About"), self, SLOT('about()'), TQt::KeySequence.new(Key_F1) ) help.insertItem( tr("About &Qt"), self, SLOT('aboutQt()') ) help.insertSeparator() - help.insertItem( tr("What's &This"), self, SLOT('whatsThis()'), Qt::KeySequence.new(SHIFT+Key_F1) ) + help.insertItem( tr("What's &This"), self, SLOT('whatsThis()'), TQt::KeySequence.new(SHIFT+Key_F1) ) - @e = Qt::TextEdit.new( self, "editor" ) + @e = TQt::TextEdit.new( self, "editor" ) @e.setFocus() setCentralWidget( @e ) statusBar().message( tr("Ready"), 2000 ) @@ -110,7 +110,7 @@ class %{APPNAMESC} < Qt::MainWindow end def choose() - fn = Qt::FileDialog.getOpenFileName( nil, nil, + fn = TQt::FileDialog.getOpenFileName( nil, nil, self) if !fn.nil? load( fn ) @@ -121,12 +121,12 @@ class %{APPNAMESC} < Qt::MainWindow def load( filename ) - f = Qt::File.new( filename ) - if !f.open( Qt::IO_ReadOnly ) + f = TQt::File.new( filename ) + if !f.open( TQt::IO_ReadOnly ) return end - ts = Qt::TextStream.new( f ) + ts = TQt::TextStream.new( f ) @e.setText( ts.read() ) @e.setModified( false ) setCaption( filename ) @@ -141,14 +141,14 @@ class %{APPNAMESC} < Qt::MainWindow end text = @e.text() - f = Qt::File.new( @filename ) - if !f.open( Qt::IO_WriteOnly ) + f = TQt::File.new( @filename ) + if !f.open( TQt::IO_WriteOnly ) statusBar().message( tr("Could not write to %s" % @filename), 2000 ) return end - t = Qt::TextStream.new( f ) + t = TQt::TextStream.new( f ) t << text f.close() @@ -161,7 +161,7 @@ class %{APPNAMESC} < Qt::MainWindow def saveAs() - fn = Qt::FileDialog.getSaveFileName( nil, nil, + fn = TQt::FileDialog.getSaveFileName( nil, nil, self ) if !fn.nil? @filename = fn @@ -173,13 +173,13 @@ class %{APPNAMESC} < Qt::MainWindow def print() - # ###### Rewrite to use Qt::SimpleRichText to print here as well + # ###### Rewrite to use TQt::SimpleRichText to print here as well margin = 10 pageNo = 1 if @printer.setup(self) # @printer dialog statusBar().message( tr("Printing...") ) - p = Qt::Painter.new + p = TQt::Painter.new if !p.begin( @printer ) # paint on @printer return end @@ -187,7 +187,7 @@ class %{APPNAMESC} < Qt::MainWindow p.setFont( @e.font() ) yPos = 0 # y-position for each line fm = p.fontMetrics() - metrics = Qt::PaintDeviceMetrics.new( @printer ) # need width/height + metrics = TQt::PaintDeviceMetrics.new( @printer ) # need width/height # of @printer surface for i in 0...@e.lines() do if margin + yPos > metrics.height() - margin @@ -220,7 +220,7 @@ class %{APPNAMESC} < Qt::MainWindow return end - case Qt::MessageBox.information( self, tr("Qt Application Example"), + case TQt::MessageBox.information( self, tr("Qt Application Example"), tr("Do you want to save the changes" + " to the document?"), tr("Yes"), tr("No"), tr("Cancel"), @@ -240,14 +240,14 @@ class %{APPNAMESC} < Qt::MainWindow private def about() - Qt::MessageBox.about( self, tr("Qt Application Example"), + TQt::MessageBox.about( self, tr("Qt Application Example"), tr("This example demonstrates simple use of " + - "Qt::MainWindow,\nQt::MenuBar and Qt::ToolBar.")) + "TQt::MainWindow,\nTQt::MenuBar and TQt::ToolBar.")) end def aboutQt() - Qt::MessageBox.aboutQt( self, tr("Qt Application Example") ) + TQt::MessageBox.aboutQt( self, tr("Qt Application Example") ) end end |