summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/helpviewer
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/helpviewer')
-rw-r--r--qtjava/javalib/examples/helpviewer/HelpWindow.java114
-rw-r--r--qtjava/javalib/examples/helpviewer/Main.java12
2 files changed, 63 insertions, 63 deletions
diff --git a/qtjava/javalib/examples/helpviewer/HelpWindow.java b/qtjava/javalib/examples/helpviewer/HelpWindow.java
index abec33e1..1da9c337 100644
--- a/qtjava/javalib/examples/helpviewer/HelpWindow.java
+++ b/qtjava/javalib/examples/helpviewer/HelpWindow.java
@@ -11,17 +11,17 @@ import org.kde.qt.*;
import java.util.*;
-class HelpWindow extends QMainWindow
+class HelpWindow extends TQMainWindow
{
-private QTextBrowser browser;
-private QComboBox pathCombo;
+private TQTextBrowser browser;
+private TQComboBox pathCombo;
private int backwardId, forwardId;
private String selectedURL;
private ArrayList history = new ArrayList();
private ArrayList bookmarks = new ArrayList();
private HashMap mHistory = new HashMap();
private HashMap mBookmarks = new HashMap();
-private QPopupMenu hist, bookm;
+private TQPopupMenu hist, bookm;
@@ -32,16 +32,16 @@ HelpWindow( String home_, String _path )
}
HelpWindow( String home_, String _path,
- QWidget parent, String name )
+ TQWidget parent, String name )
{
super( parent, name, WDestructiveClose );
readHistory();
readBookmarks();
- browser = new QTextBrowser( this );
+ browser = new TQTextBrowser( this );
browser.mimeSourceFactory().setFilePath( new String[] { _path } );
- browser.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+ browser.setFrameStyle( TQFrame.Panel | TQFrame.Sunken );
connect( browser, SIGNAL(" textChanged()"),
this, SLOT(" textChanged()") );
@@ -55,33 +55,33 @@ HelpWindow( String home_, String _path,
resize( 640,700 );
- QPopupMenu file = new QPopupMenu( this );
- file.insertItem( tr("&New Window"), this, SLOT(" newWindow()"), new QKeySequence(CTRL+Key_N) );
- file.insertItem( tr("&Open File"), this, SLOT(" openFile()"), new QKeySequence(CTRL+Key_O) );
- file.insertItem( tr("&Print"), this, SLOT(" print()"), new QKeySequence(CTRL+Key_P) );
+ TQPopupMenu file = new TQPopupMenu( this );
+ file.insertItem( tr("&New Window"), this, SLOT(" newWindow()"), new TQKeySequence(CTRL+Key_N) );
+ file.insertItem( tr("&Open File"), this, SLOT(" openFile()"), new TQKeySequence(CTRL+Key_O) );
+ file.insertItem( tr("&Print"), this, SLOT(" print()"), new TQKeySequence(CTRL+Key_P) );
file.insertSeparator();
- file.insertItem( tr("&Close"), this, SLOT(" close()"), new QKeySequence(CTRL+Key_Q) );
- file.insertItem( tr("E&xit"), qApp(), SLOT(" closeAllWindows()"), new QKeySequence(CTRL+Key_X) );
+ file.insertItem( tr("&Close"), this, SLOT(" close()"), new TQKeySequence(CTRL+Key_Q) );
+ file.insertItem( tr("E&xit"), qApp(), SLOT(" closeAllWindows()"), new TQKeySequence(CTRL+Key_X) );
// The same three icons are used twice each.
- QIconSet icon_back = new QIconSet( new QPixmap("back.xpm") );
- QIconSet icon_forward = new QIconSet( new QPixmap("forward.xpm") );
- QIconSet icon_home = new QIconSet( new QPixmap("home.xpm") );
+ TQIconSet icon_back = new TQIconSet( new TQPixmap("back.xpm") );
+ TQIconSet icon_forward = new TQIconSet( new TQPixmap("forward.xpm") );
+ TQIconSet icon_home = new TQIconSet( new TQPixmap("home.xpm") );
- QPopupMenu go = new QPopupMenu( this );
+ TQPopupMenu go = new TQPopupMenu( this );
backwardId = go.insertItem( icon_back,
tr("&Backward"), browser, SLOT(" backward()"),
- new QKeySequence(CTRL+Key_Left) );
+ new TQKeySequence(CTRL+Key_Left) );
forwardId = go.insertItem( icon_forward,
tr("&Forward"), browser, SLOT(" forward()"),
- new QKeySequence(CTRL+Key_Right) );
+ new TQKeySequence(CTRL+Key_Right) );
go.insertItem( icon_home, tr("&Home"), browser, SLOT(" home()") );
- QPopupMenu help = new QPopupMenu( this );
+ TQPopupMenu help = new TQPopupMenu( this );
help.insertItem( tr("&About ..."), this, SLOT(" about()") );
help.insertItem( tr("About &Qt ..."), this, SLOT(" aboutQt()") );
- hist = new QPopupMenu( this );
+ hist = new TQPopupMenu( this );
Iterator it = history.iterator();
while (it.hasNext()) {
String item = (String) it.next();
@@ -90,7 +90,7 @@ HelpWindow( String home_, String _path,
connect( hist, SIGNAL(" activated( int )"),
this, SLOT(" histChosen( int )") );
- bookm = new QPopupMenu( this );
+ bookm = new TQPopupMenu( this );
bookm.insertItem( tr( "Add Bookmark" ), this, SLOT(" addBookmark()") );
bookm.insertSeparator();
@@ -117,21 +117,21 @@ HelpWindow( String home_, String _path,
this, SLOT(" setForwardAvailable( boolean )") );
- QToolBar toolbar = new QToolBar( this );
+ TQToolBar toolbar = new TQToolBar( this );
addToolBar( toolbar, "Toolbar");
- QToolButton button;
+ TQToolButton button;
- button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT("backward()"), toolbar );
+ button = new TQToolButton( icon_back, tr("Backward"), "", browser, SLOT("backward()"), toolbar );
connect( browser, SIGNAL(" backwardAvailable(boolean)"), button, SLOT(" setEnabled(boolean)") );
button.setEnabled( false );
- button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT("forward()"), toolbar );
+ button = new TQToolButton( icon_forward, tr("Forward"), "", browser, SLOT("forward()"), toolbar );
connect( browser, SIGNAL(" forwardAvailable(boolean)"), button, SLOT(" setEnabled(boolean)") );
button.setEnabled( false );
- button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT("home()"), toolbar );
+ button = new TQToolButton( icon_home, tr("Home"), "", browser, SLOT("home()"), toolbar );
toolbar.addSeparator();
- pathCombo = new QComboBox( true, toolbar );
+ pathCombo = new TQComboBox( true, toolbar );
connect( pathCombo, SIGNAL(" activated( String )"),
this, SLOT(" pathSelected( String )") );
toolbar.setStretchableWidget( pathCombo );
@@ -193,9 +193,9 @@ public void cleanUp()
while (it.hasNext())
history.add(it.next());
- QFile f = new QFile( QDir.currentDirPath() + "/.history" );
- f.open( QIODevice.IO_WriteOnly );
- QTextStream t = new QTextStream( f );
+ TQFile f = new TQFile( TQDir.currentDirPath() + "/.history" );
+ f.open( TQIODevice.IO_WriteOnly );
+ TQTextStream t = new TQTextStream( f );
Iterator it1 = history.iterator();
while (it1.hasNext()) {
String item = (String) it1.next();
@@ -209,9 +209,9 @@ public void cleanUp()
while (it3.hasNext())
bookmarks.add(it3.next());
- QFile f2 = new QFile( QDir.currentDirPath() + "/.bookmarks" );
- f2.open( QIODevice.IO_WriteOnly );
- QTextStream t2 = new QTextStream( f2 );
+ TQFile f2 = new TQFile( TQDir.currentDirPath() + "/.bookmarks" );
+ f2.open( TQIODevice.IO_WriteOnly );
+ TQTextStream t2 = new TQTextStream( f2 );
Iterator it2 = bookmarks.iterator();
while (it2.hasNext()) {
String item = (String) it2.next();
@@ -224,7 +224,7 @@ public void cleanUp()
void about()
{
- QMessageBox.about( this, "HelpViewer Example",
+ TQMessageBox.about( this, "HelpViewer Example",
"<p>This example implements a simple HTML help viewer "
+ "using Qt's rich text capabilities</p>"
+ "<p>It's just about 100 lines of Java code, so don't expect too much :-)</p>"
@@ -234,12 +234,12 @@ void about()
void aboutQt()
{
- QMessageBox.aboutQt( this, "QBrowser" );
+ TQMessageBox.aboutQt( this, "TQBrowser" );
}
void openFile()
{
- String fn = QFileDialog.getOpenFileName( "", "", this );
+ String fn = TQFileDialog.getOpenFileName( "", "", this );
if ( !fn.equals("") )
browser.setSource( fn );
}
@@ -251,38 +251,38 @@ void newWindow()
void print()
{
- QPrinter printer = new QPrinter();//(QPrinter.HighResolution );
+ TQPrinter printer = new TQPrinter();//(TQPrinter.HighResolution );
printer.setFullPage(true);
if ( printer.setup( this ) ) {
- QPainter p = new QPainter( printer );
- QPaintDeviceMetrics metrics = new QPaintDeviceMetrics(p.device());
+ TQPainter p = new TQPainter( printer );
+ TQPaintDeviceMetrics metrics = new TQPaintDeviceMetrics(p.device());
int dpix = metrics.logicalDpiX();
int dpiy = metrics.logicalDpiY();
int margin = 72; // pt
- QRect body = new QRect(margin*dpix/72, margin*dpiy/72,
+ TQRect body = new TQRect(margin*dpix/72, margin*dpiy/72,
metrics.width()-margin*dpix/72*2,
metrics.height()-margin*dpiy/72*2 );
- QFont font = new QFont("times", 10);
+ TQFont font = new TQFont("times", 10);
ArrayList filePaths = browser.mimeSourceFactory().filePath();
String file = "";
Iterator it = filePaths.iterator();
while (it.hasNext()) {
- file = new QUrl( new QUrl((String) it.next()), new QUrl( browser.source() ).path() ).path();
- if ( QFile.exists( file ) )
+ file = new TQUrl( new TQUrl((String) it.next()), new TQUrl( browser.source() ).path() ).path();
+ if ( TQFile.exists( file ) )
break;
else
file = "";
}
if ( file.equals("") )
return;
- QFile f = new QFile( file );
- if ( !f.open( QIODevice.IO_ReadOnly ) )
+ TQFile f = new TQFile( file );
+ if ( !f.open( TQIODevice.IO_ReadOnly ) )
return;
- QTextStream ts = new QTextStream( f );
- QSimpleRichText richText = new QSimpleRichText( ts.read(), font, browser.context(), browser.styleSheet(),
+ TQTextStream ts = new TQTextStream( f );
+ TQSimpleRichText richText = new TQSimpleRichText( ts.read(), font, browser.context(), browser.styleSheet(),
browser.mimeSourceFactory(), body.height() );
richText.setWidth( p, body.width() );
- QRect view = new QRect( body.topLeft(), body.bottomRight() );
+ TQRect view = new TQRect( body.topLeft(), body.bottomRight() );
int page = 1;
do {
richText.draw( p, body.left(), body.top(), view, colorGroup() );
@@ -316,10 +316,10 @@ void pathSelected( String _path )
void readHistory()
{
- if ( QFile.exists( QDir.currentDirPath() + "/.history" ) ) {
- QFile f = new QFile( QDir.currentDirPath() + "/.history" );
- f.open( QIODevice.IO_ReadOnly );
- QTextStream t = new QTextStream( f );
+ if ( TQFile.exists( TQDir.currentDirPath() + "/.history" ) ) {
+ TQFile f = new TQFile( TQDir.currentDirPath() + "/.history" );
+ f.open( TQIODevice.IO_ReadOnly );
+ TQTextStream t = new TQTextStream( f );
while ( !t.atEnd() ) {
String item = t.readLine();
history.add((Object) item);
@@ -332,10 +332,10 @@ void readHistory()
void readBookmarks()
{
- if ( QFile.exists( QDir.currentDirPath() + "/.bookmarks" ) ) {
- QFile f = new QFile( QDir.currentDirPath() + "/.bookmarks" );
- f.open( QIODevice.IO_ReadOnly );
- QTextStream t = new QTextStream( f );
+ if ( TQFile.exists( TQDir.currentDirPath() + "/.bookmarks" ) ) {
+ TQFile f = new TQFile( TQDir.currentDirPath() + "/.bookmarks" );
+ f.open( TQIODevice.IO_ReadOnly );
+ TQTextStream t = new TQTextStream( f );
while ( !t.atEnd() ) {
String item = t.readLine();
diff --git a/qtjava/javalib/examples/helpviewer/Main.java b/qtjava/javalib/examples/helpviewer/Main.java
index da01e3dc..7b6aa17c 100644
--- a/qtjava/javalib/examples/helpviewer/Main.java
+++ b/qtjava/javalib/examples/helpviewer/Main.java
@@ -14,8 +14,8 @@ public class Main {
public static void main( String[] args )
{
- QApplication.setColorSpec( QApplication.ManyColor );
- QApplication a = new QApplication(args);
+ TQApplication.setColorSpec( TQApplication.ManyColor );
+ TQApplication a = new TQApplication(args);
String home = null;
if (args.length > 0)
@@ -26,15 +26,15 @@ public static void main( String[] args )
HelpWindow help = new HelpWindow(home, ".", null, "help viewer");
help.setCaption("Qt Example - Helpviewer");
- if ( QApplication.desktop().width() > 400
- && QApplication.desktop().height() > 500 )
+ if ( TQApplication.desktop().width() > 400
+ && TQApplication.desktop().height() > 500 )
help.show();
else
help.showMaximized();
- QObject.connect( a, Qt.SIGNAL("aboutToQuit()"),
+ TQObject.connect( a, Qt.SIGNAL("aboutToQuit()"),
help, Qt.SLOT("cleanUp()") );
- QObject.connect( a, Qt.SIGNAL("lastWindowClosed()"),
+ TQObject.connect( a, Qt.SIGNAL("lastWindowClosed()"),
a, Qt.SLOT("quit()") );
a.exec();