4
#include <kiconloader.h>
6
#include <kaboutdata.h>
10
#include <kparts/partmanager.h>
12
#include "kmidclient.h"
18
* This function is the 'main' function of this part. It takes
19
* the form 'void *init_lib<library name>()'. It always returns a
22
void *init_libkmidpart()
24
return new KMidFactory;
29
* We need one static instance of the factory for our C 'main'
32
KInstance *KMidFactory::s_instance = 0L;
34
KMidFactory::KMidFactory()
39
KMidFactory::~KMidFactory()
43
delete s_instance->aboutData();
50
QObject *KMidFactory::create(QObject *parent, const char *name, const char*,
53
QObject *obj = new KMidPart((QWidget*)parent, name);
54
emit objectCreated(obj);
58
KAboutData *KMidFactory::aboutData()
60
KAboutData *aboutdata = new KAboutData("kmid", "KMid", "2.0",
61
I18N_NOOP("MIDI/Karaoke file player"), KAboutData::License_GPL,
62
I18N_NOOP("(C) 1997,98,99,2000, Antonio Larrosa Jimenez"),"",
63
"http://perso.wanadoo.es/antlarr/kmid.html");
64
aboutdata->addAuthor("Antonio Larrosa Jimenez",
65
I18N_NOOP("Original Developer/Mantainer"),"larrosa@kde.org",
66
"http://perso.wanadoo.es/antlarr/index.html");
70
KInstance *KMidFactory::instance()
73
s_instance = new KInstance( aboutData() );
78
KMidPart::KMidPart(QWidget *parent, const char *name)
79
: KParts::ReadOnlyPart(parent, name)
81
setInstance(KMidFactory::instance());
83
widget = new kmidClient(parent, actionCollection());
85
widget->setFocusPolicy(QWidget::ClickFocus);
88
// create and connect our actions
89
(void)new KAction(i18n("Play"), "1rightarrow", 0, this,
90
SLOT(slotPlay()), actionCollection(),
93
(void)new KAction(i18n("Stop"), "player_stop", 0, this,
94
SLOT(slotStop()), actionCollection(),
97
(void)new KAction(i18n("Backward"),
98
"2leftarrow", 0, this,
99
SLOT(slotBackward()), actionCollection(),
102
(void)new KAction(i18n("Forward"),
103
"2rightarrow", 0, this,
104
SLOT(slotForward()), actionCollection(),
107
m_extension = new KMidBrowserExtension(this);
109
setXMLFile("kmid_partui.rc");
114
KMidPart::~KMidPart()
118
bool KMidPart::openFile()
120
widget->openURL(m_file);
123
QTimer::singleShot(2000, this, SLOT(slotPlay()));
128
bool KMidPart::closeURL()
134
void KMidPart::slotPlay()
141
void KMidPart::slotStop()
145
KMidBrowserExtension::KMidBrowserExtension(KMidPart *parent)
146
: KParts::BrowserExtension(parent, "KMidBrowserExtension")
150
KMidBrowserExtension::~KMidBrowserExtension()
153
#include "kmid_part.moc"