summaryrefslogtreecommitdiffstats
path: root/nsplugins/test
diff options
context:
space:
mode:
Diffstat (limited to 'nsplugins/test')
-rw-r--r--nsplugins/test/Makefile.am11
-rw-r--r--nsplugins/test/testnsplugin.cpp143
-rw-r--r--nsplugins/test/testnsplugin.h56
-rw-r--r--nsplugins/test/testnsplugin.rc15
4 files changed, 225 insertions, 0 deletions
diff --git a/nsplugins/test/Makefile.am b/nsplugins/test/Makefile.am
new file mode 100644
index 000000000..af17ade48
--- /dev/null
+++ b/nsplugins/test/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/libltdl -I.. $(all_includes)
+METASOURCES = AUTO
+noinst_HEADERS = testnsplugin.h
+
+check_PROGRAMS = testnsplugin
+testnsplugin_SOURCES = testnsplugin.cpp
+testnsplugin_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
+testnsplugin_LDADD = $(LIB_TDEUI) ../libnsplugin.la
+
+$(srcdir)/testnsplugin.cpp: ../NSPluginClassIface_stub.h
+
diff --git a/nsplugins/test/testnsplugin.cpp b/nsplugins/test/testnsplugin.cpp
new file mode 100644
index 000000000..daccd1bcf
--- /dev/null
+++ b/nsplugins/test/testnsplugin.cpp
@@ -0,0 +1,143 @@
+/*
+ This is an encapsulation of the Netscape plugin API.
+
+ Copyright (c) 2000 Stefan Schimanski <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+#include <stdio.h>
+
+#include <tqstring.h>
+#include <tdeapplication.h>
+#include <tdecmdlineargs.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kstdaction.h>
+#include <tdeaction.h>
+
+#include "testnsplugin.h"
+#include "../NSPluginClassIface_stub.h"
+#include "../nspluginloader.h"
+
+
+TestNSPlugin::TestNSPlugin()
+{
+ m_loader = NSPluginLoader::instance();
+
+ // client area
+ m_client = new TQWidget( this, "m_client" );
+ setCentralWidget( m_client );
+ m_client->show();
+ m_layout = new TQHBoxLayout( m_client );
+
+ // file menu
+ KStdAction::openNew( this, TQT_SLOT(newView()), actionCollection());
+ KStdAction::close( this, TQT_SLOT(closeView()), actionCollection());
+ KStdAction::quit( kapp, TQT_SLOT(quit()), actionCollection());
+
+ createGUI( "testnspluginui.rc" );
+}
+
+
+TestNSPlugin::~TestNSPlugin()
+{
+ kdDebug() << "-> TestNSPlugin::~TestNSPlugin" << endl;
+ m_loader->release();
+ kdDebug() << "<- TestNSPlugin::~TestNSPlugin" << endl;
+}
+
+
+void TestNSPlugin::newView()
+{
+ TQStringList _argn, _argv;
+
+ //TQString src = "file:/home/sschimanski/kimble_themovie.swf";
+ //TQString src = "file:/home/sschimanski/in_ani.swf";
+ //TQString src = "http://homepages.tig.com.au/~dkl/swf/promo.swf";
+ //TQString mime = "application/x-shockwave-flash";
+
+ _argn << "name" << "controls" << "console";
+ _argv << "audio" << "ControlPanel" << "Clip1";
+ TQString src = "http://welt.is-kunden.de:554/ramgen/welt/avmedia/realaudio/0701lw177135.rm";
+// TQString src = "nothing";
+ TQString mime = "audio/x-pn-realaudio-plugin";
+
+ _argn << "SRC" << "TYPE" << "WIDTH" << "HEIGHT";
+ _argv << src << mime << "400" << "100";
+ TQWidget *win = m_loader->newInstance( m_client, src, mime, 1, _argn, _argv, "appid", "callbackid" );
+
+/*
+ _argn << "TYPE" << "WIDTH" << "HEIGHT" << "java_docbase" << "CODE";
+ _argv << "application/x-java-applet" << "450" << "350" << "file:///none" << "sun/plugin/panel/ControlPanelApplet.class";
+ TQWidget *win = loader->NewInstance(0, "", "application/x-java-applet", 1, _argn, _argv);
+*/
+
+ if ( win )
+ {
+ m_plugins.append( win );
+ connect( win, TQT_SIGNAL(destroyed(NSPluginInstance *)),
+ this, TQT_SLOT(viewDestroyed(NSPluginInstance *)) );
+ m_layout->addWidget( win );
+ win->show();
+ } else
+ {
+ kdDebug() << "No widget created" << endl;
+ }
+}
+
+void TestNSPlugin::closeView()
+{
+ kdDebug() << "closeView" << endl;
+ TQWidget *win = m_plugins.last();
+ if ( win )
+ {
+ m_plugins.remove( win );
+ delete win;
+ } else
+ {
+ kdDebug() << "No widget available" << endl;
+ }
+}
+
+
+void TestNSPlugin::viewDestroyed( NSPluginInstance *inst )
+{
+ kdDebug() << "TestNSPlugin::viewDestroyed" << endl;
+ m_plugins.remove( inst );
+}
+
+
+int main(int argc, char *argv[])
+{
+ kdDebug() << "main" << endl;
+ setvbuf( stderr, NULL, _IONBF, 0 );
+ TDECmdLineArgs::init(argc, argv, "nsplugin", "A Netscape Plugin test program", "0.1");
+
+ TDEApplication app("nsplugin");
+
+ app.dcopClient()->attach();
+ app.dcopClient()->registerAs(app.name());
+ app.dcopClient()->setNotifications(true);
+
+ TestNSPlugin *win = new TestNSPlugin;
+ app.setMainWidget( win );
+ win->show();
+ app.exec();
+
+ delete win;
+}
+
+#include "testnsplugin.moc"
diff --git a/nsplugins/test/testnsplugin.h b/nsplugins/test/testnsplugin.h
new file mode 100644
index 000000000..252cea2c8
--- /dev/null
+++ b/nsplugins/test/testnsplugin.h
@@ -0,0 +1,56 @@
+/*
+ This is an encapsulation of the Netscape plugin API.
+
+ Copyright (c) 2000 Stefan Schimanski <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+
+#ifndef __TESTNSPLUGIN_H__
+#define __TESTNSPLUGIN_H__
+
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tdemainwindow.h>
+#include <tqlayout.h>
+#include <tqptrlist.h>
+
+class NSPluginLoader;
+class NSPluginInstance;
+
+class TestNSPlugin : public TDEMainWindow
+{
+ Q_OBJECT
+
+public:
+ TestNSPlugin();
+ virtual ~TestNSPlugin();
+
+public slots:
+ void newView();
+ void closeView();
+ void viewDestroyed( NSPluginInstance *inst );
+
+protected:
+ NSPluginLoader *m_loader;
+ TQPtrList<TQWidget> m_plugins;
+ TQWidget *m_client;
+ TQBoxLayout *m_layout;
+};
+
+
+#endif
diff --git a/nsplugins/test/testnsplugin.rc b/nsplugins/test/testnsplugin.rc
new file mode 100644
index 000000000..46bb5f86a
--- /dev/null
+++ b/nsplugins/test/testnsplugin.rc
@@ -0,0 +1,15 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="testnsplugin">
+
+<MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ </Menu>
+</MenuBar>
+
+<ToolBar noMerge="1" name="mainToolBar">
+ <Action name="file_new"/>
+ <Action name="file_close"/>
+ <Action name="file_quit"/>
+</ToolBar>
+
+</kpartgui>