summaryrefslogtreecommitdiffstats
path: root/tdemid/tdemid_part.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:43 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:43 -0600
commitcb68a7857c80661d242ee5527ec6f99dc3f79fa7 (patch)
treea3b54203ca6bce0e8e1dc5107dc9653db246a281 /tdemid/tdemid_part.cpp
parent7534907d3759a8c520eeb9a701b316d891c63bdf (diff)
downloadtdemultimedia-cb68a7857c80661d242ee5527ec6f99dc3f79fa7.tar.gz
tdemultimedia-cb68a7857c80661d242ee5527ec6f99dc3f79fa7.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdemid/tdemid_part.cpp')
-rw-r--r--tdemid/tdemid_part.cpp144
1 files changed, 144 insertions, 0 deletions
diff --git a/tdemid/tdemid_part.cpp b/tdemid/tdemid_part.cpp
new file mode 100644
index 00000000..d6e22474
--- /dev/null
+++ b/tdemid/tdemid_part.cpp
@@ -0,0 +1,144 @@
+#include "tdemid_part.h"
+
+#include <kinstance.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <kaction.h>
+#include <tqiconset.h>
+
+#include <tdeparts/partmanager.h>
+
+#include "tdemidclient.h"
+#include <tqtimer.h>
+#include <tdelibs_export.h>
+
+K_EXPORT_COMPONENT_FACTORY( libtdemidpart, KMidFactory )
+
+/**
+ * We need one static instance of the factory for our C 'main'
+ * function
+ */
+TDEInstance *KMidFactory::s_instance = 0L;
+
+KMidFactory::KMidFactory()
+{
+ s_instance=0L;
+}
+
+KMidFactory::~KMidFactory()
+{
+ if (s_instance)
+ {
+ delete s_instance->aboutData();
+ delete s_instance;
+ }
+
+ s_instance = 0;
+}
+
+KParts::Part *KMidFactory::createPartObject(TQWidget *parentWidget, const char *widgetName,
+ TQObject *parent, const char *name, const char*,
+ const TQStringList& )
+{
+ KParts::Part *obj = new KMidPart(parentWidget, widgetName, parent, name);
+ return obj;
+}
+
+TDEAboutData *KMidFactory::aboutData()
+{
+ TDEAboutData *aboutdata = new TDEAboutData("tdemid", "KMid", "2.0",
+ I18N_NOOP("MIDI/Karaoke file player"), TDEAboutData::License_GPL,
+ I18N_NOOP("(c) 1997,98,99,2000, Antonio Larrosa Jimenez"),"",
+ "http://perso.wanadoo.es/antlarr/tdemid.html");
+ aboutdata->addAuthor("Antonio Larrosa Jimenez",
+ I18N_NOOP("Original Developer/Maintainer"),"larrosa@kde.org",
+ "http://perso.wanadoo.es/antlarr/index.html");
+ return aboutdata;
+}
+
+TDEInstance *KMidFactory::instance()
+{
+ if ( !s_instance )
+ s_instance = new TDEInstance( aboutData() );
+
+ return s_instance;
+}
+
+ KMidPart::KMidPart(TQWidget *parentWidget, const char *widgetName,
+ TQObject *parent, const char *name)
+: KParts::ReadOnlyPart(parent, name)
+{
+ setInstance(KMidFactory::instance());
+
+ widget = new tdemidClient(parentWidget, actionCollection());
+ widget->show();
+ widget->setFocusPolicy(TQ_ClickFocus);
+ setWidget(widget);
+
+ // create and connect our actions
+ (void)new KAction(i18n("Play"), "player_play", 0, this,
+ TQT_SLOT(slotPlay()), actionCollection(),
+ "play");
+
+ (void)new KAction(i18n("Stop"), "player_stop", 0, this,
+ TQT_SLOT(slotStop()), actionCollection(),
+ "stop");
+
+ (void)new KAction(i18n("Backward"),
+ "2leftarrow", 0, this,
+ TQT_SLOT(slotBackward()), actionCollection(),
+ "backward");
+
+ (void)new KAction(i18n("Forward"),
+ "2rightarrow", 0, this,
+ TQT_SLOT(slotForward()), actionCollection(),
+ "forward");
+
+ m_extension = new KMidBrowserExtension(this);
+
+ setXMLFile("tdemid_partui.rc");
+
+
+}
+
+KMidPart::~KMidPart()
+{
+}
+
+bool KMidPart::openFile()
+{
+ widget->openURL(m_file);
+ widget->stop();
+ widget->show();
+ TQTimer::singleShot(2000, this, TQT_SLOT(slotPlay()));
+
+ return true;
+}
+
+bool KMidPart::closeURL()
+{
+ slotStop();
+ return true;
+}
+
+void KMidPart::slotPlay()
+{
+ widget->stop();
+ widget->play();
+}
+
+
+void KMidPart::slotStop()
+{
+ widget->stop();
+}
+KMidBrowserExtension::KMidBrowserExtension(KMidPart *parent)
+ : KParts::BrowserExtension(parent, "KMidBrowserExtension")
+{
+}
+
+KMidBrowserExtension::~KMidBrowserExtension()
+{
+}
+#include "tdemid_part.moc"