diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
commit | 479f5f799523bffbcc83dff581a2299c047c6fff (patch) | |
tree | 186aae707ed02aac6c7cab2fb14e97f72aca5e36 /kjsembed/jsconsolewidget.cpp | |
parent | f1dbff6145c98324ff82e34448b7483727e8ace4 (diff) | |
download | tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.tar.gz tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1157645 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kjsembed/jsconsolewidget.cpp')
-rw-r--r-- | kjsembed/jsconsolewidget.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kjsembed/jsconsolewidget.cpp b/kjsembed/jsconsolewidget.cpp index 4816e335..b494f55d 100644 --- a/kjsembed/jsconsolewidget.cpp +++ b/kjsembed/jsconsolewidget.cpp @@ -17,11 +17,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qfile.h> -#include <qhbox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpushbutton.h> +#include <tqfile.h> +#include <tqhbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqpushbutton.h> #include <kdebug.h> #include <kdialog.h> @@ -50,11 +50,11 @@ class JSConsoleWidgetPrivate { }; -JSConsoleWidget::JSConsoleWidget( KJSEmbedPart *jspart, QWidget *parent, const char *name ) - : QFrame( parent, name ? name : "jsconsole_widget" ), +JSConsoleWidget::JSConsoleWidget( KJSEmbedPart *jspart, TQWidget *parent, const char *name ) + : TQFrame( parent, name ? name : "jsconsole_widget" ), js(jspart), proc(0), d(0) { - setFocusPolicy( QWidget::StrongFocus ); + setFocusPolicy( TQWidget::StrongFocus ); createView(); } @@ -64,8 +64,8 @@ JSConsoleWidget::~JSConsoleWidget() void JSConsoleWidget::createView() { - QPixmap px( KGlobal::iconLoader()->loadIcon("konsole", KIcon::NoGroup, KIcon::SizeSmall) ); - QPixmap pxl( KGlobal::iconLoader()->loadIcon("konsole", KIcon::NoGroup, KIcon::SizeLarge) ); + TQPixmap px( KGlobal::iconLoader()->loadIcon("konsole", KIcon::NoGroup, KIcon::SizeSmall) ); + TQPixmap pxl( KGlobal::iconLoader()->loadIcon("konsole", KIcon::NoGroup, KIcon::SizeLarge) ); setIcon( px ); KWin::setIcons( winId(), pxl, px ); @@ -77,32 +77,32 @@ void JSConsoleWidget::createView() log->setReadOnly( true ); log->setUndoRedoEnabled( false ); log->setTextFormat( Qt::RichText ); - log->setWrapPolicy( QTextEdit::Anywhere ); + log->setWrapPolicy( TQTextEdit::Anywhere ); log->setText( "<qt><pre>" ); - log->setFocusPolicy( QWidget::NoFocus ); + log->setFocusPolicy( TQWidget::NoFocus ); // Command entry section - cmdBox = new QHBox( this, "cmd_box" ); + cmdBox = new TQHBox( this, "cmd_box" ); cmdBox->setSpacing( KDialog::spacingHint() ); - QLabel *prompt = new QLabel( i18n("&KJS>"), cmdBox, "prompt" ); + TQLabel *prompt = new TQLabel( i18n("&KJS>"), cmdBox, "prompt" ); cmd = new KLineEdit( cmdBox, "cmd_edit" ); - cmd->setFocusPolicy( QWidget::StrongFocus ); + cmd->setFocusPolicy( TQWidget::StrongFocus ); cmd->setFocus(); prompt->setBuddy( cmd ); - go = new QPushButton( i18n("&Run"), cmdBox, "run_button" ); + go = new TQPushButton( i18n("&Run"), cmdBox, "run_button" ); go->setFixedSize( go->sizeHint() ); - connect( cmd, SIGNAL(returnPressed(const QString&)), go, SLOT( animateClick() ) ); - connect( go, SIGNAL( clicked() ), SLOT( invoke() ) ); + connect( cmd, TQT_SIGNAL(returnPressed(const TQString&)), go, TQT_SLOT( animateClick() ) ); + connect( go, TQT_SIGNAL( clicked() ), TQT_SLOT( invoke() ) ); // Setup completion KCompletion *comp = cmd->completionObject(); - connect( cmd, SIGNAL(returnPressed(const QString&)), comp, SLOT(addItem(const QString&)) ); + connect( cmd, TQT_SIGNAL(returnPressed(const TQString&)), comp, TQT_SLOT(addItem(const TQString&)) ); // Layout - QVBoxLayout *vert = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQVBoxLayout *vert = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); vert->addWidget( ttl ); vert->addWidget( log ); vert->addWidget( cmdBox ); @@ -110,17 +110,17 @@ void JSConsoleWidget::createView() void JSConsoleWidget::invoke() { - QString code( cmd->text() ); - println( QString( "<b><font color=\"#888888\">KJS></font> %1</b>" ).arg( code ) ); + TQString code( cmd->text() ); + println( TQString( "<b><font color=\"#888888\">KJS></font> %1</b>" ).arg( code ) ); execute( code ); } -bool JSConsoleWidget::execute( const QString &cmd ) +bool JSConsoleWidget::execute( const TQString &cmd ) { return execute( cmd, KJS::Null() ); } -bool JSConsoleWidget::execute( const QString &cmd, const KJS::Value &self ) +bool JSConsoleWidget::execute( const TQString &cmd, const KJS::Value &self ) { KJS::Completion jsres; bool ok = js->execute( jsres, cmd, self ); @@ -141,8 +141,8 @@ bool JSConsoleWidget::execute( const QString &cmd, const KJS::Value &self ) return ok; } - QString txt = s.qstring(); - txt = txt.replace( QChar('\n'), "<br>" ); + TQString txt = s.qstring(); + txt = txt.replace( TQChar('\n'), "<br>" ); println( txt ); return ok; @@ -166,15 +166,15 @@ bool JSConsoleWidget::execute( const QString &cmd, const KJS::Value &self ) return ok; } -void JSConsoleWidget::println( const QString &msg ) +void JSConsoleWidget::println( const TQString &msg ) { log->append( msg ); log->scrollToBottom(); } -void JSConsoleWidget::warn( const QString &msg ) +void JSConsoleWidget::warn( const TQString &msg ) { - QString err( "<font color=\"red\"><b>%1</b></font>" ); + TQString err( "<font color=\"red\"><b>%1</b></font>" ); println( err.arg(msg) ); } @@ -182,7 +182,7 @@ void JSConsoleWidget::warn( const QString &msg ) // Process Handling // -bool JSConsoleWidget::run( const QString &cmd ) +bool JSConsoleWidget::run( const TQString &cmd ) { kdDebug(80001) << "JSConsoleWidget::run(" << cmd << ")" << endl; @@ -192,11 +192,11 @@ bool JSConsoleWidget::run( const QString &cmd ) proc = new KShellProcess("/bin/sh"); *proc << cmd; - connect( proc, SIGNAL( processExited(KProcess *) ), SLOT( childExited() ) ); - connect( proc, SIGNAL( receivedStdout(KProcess *, char *, int) ), - this, SLOT( receivedStdOutput(KProcess *, char *, int) ) ); - connect( proc, SIGNAL( receivedStderr(KProcess *, char *, int) ), - this, SLOT( receivedStdError(KProcess *, char *, int) ) ); + connect( proc, TQT_SIGNAL( processExited(KProcess *) ), TQT_SLOT( childExited() ) ); + connect( proc, TQT_SIGNAL( receivedStdout(KProcess *, char *, int) ), + this, TQT_SLOT( receivedStdOutput(KProcess *, char *, int) ) ); + connect( proc, TQT_SIGNAL( receivedStderr(KProcess *, char *, int) ), + this, TQT_SLOT( receivedStdError(KProcess *, char *, int) ) ); return proc->start( KProcess::NotifyOnExit, KProcess::Communication( KProcess::Stdout|KProcess::Stderr )); @@ -205,7 +205,7 @@ bool JSConsoleWidget::run( const QString &cmd ) void JSConsoleWidget::childExited() { - QString s; + TQString s; if ( proc->normalExit() ) { if ( proc->exitStatus() ) s = i18n( "<b>[Exited with status %1]</b>\n" ).arg( proc->exitStatus() ); @@ -224,14 +224,14 @@ void JSConsoleWidget::childExited() void JSConsoleWidget::receivedStdOutput( KProcess *, char *buffer, int buflen ) { - QCString buf = QCString( buffer, buflen+1 ); - println( QString(buf) ); + TQCString buf = TQCString( buffer, buflen+1 ); + println( TQString(buf) ); } void JSConsoleWidget::receivedStdError( KProcess *, char *buffer, int buflen ) { - QCString buf = QCString( buffer, buflen+1 ); - warn( QString(buf) ); + TQCString buf = TQCString( buffer, buflen+1 ); + warn( TQString(buf) ); } |