From 9ba04742771370f59740e32e11c5f3a1e6a1b70a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 15:55:57 -0600 Subject: Initial TQt conversion --- qtruby/rubylib/designer/uilib/Makefile.am | 8 ++--- qtruby/rubylib/designer/uilib/extconf.rb | 6 ++-- qtruby/rubylib/designer/uilib/qui.cpp | 52 +++++++++++++++--------------- qtruby/rubylib/designer/uilib/test/test.rb | 10 +++--- 4 files changed, 38 insertions(+), 38 deletions(-) (limited to 'qtruby/rubylib/designer/uilib') 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 " 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 -- cgit v1.2.1