summaryrefslogtreecommitdiffstats
path: root/khexedit/parts/kpart/khepartfactory.cpp
blob: f85d8a98eba321fd9b61cf09288d0b0b9abcc420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/***************************************************************************
                          khepartfactory.h  -  description
                             -------------------
    begin                : Don Jun 19 2003
    copyright            : (C) 2003 by Friedrich W. H. Kossebau
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU Library General Public           *
 *   License version 2 as published by the Free Software Foundation.       *
 *                                                                         *
 ***************************************************************************/


// kde specific
#include <kinstance.h>
#include <kaboutdata.h>
#include <klocale.h>
// app specific
#include "khepart.h"
#include "khepartfactory.h"

using namespace KHE;

// Part
static const char PartId[] =          "khexedit2part";
static const char PartName[] =        I18N_NOOP("KHexEdit2Part");
static const char PartDescription[] = I18N_NOOP("Embedded hex editor");
static const char PartVersion[] =     "0.2.0";
static const char PartCopyright[] =   "(C) 2003-2004 Friedrich W. H. Kossebau";
// Author
static const char FWHKName[] =         "Friedrich W. H. Kossebau";
static const char FWHKTask[] =         I18N_NOOP("Author");
static const char FWHKEmailAddress[] = "[email protected]";
// static const char FWHKWebAddress[] = "http://www.kossebau.de";


KInstance*  KHexEditPartFactory::s_instance = 0L;
KAboutData* KHexEditPartFactory::s_about = 0L;


KHexEditPartFactory::KHexEditPartFactory()
 : KParts::Factory()
{
}


KHexEditPartFactory::~KHexEditPartFactory()
{
  delete s_instance;
  delete s_about;

  s_instance = 0;
}


KParts::Part* KHexEditPartFactory::createPartObject( QWidget *ParentWidget, const char *WidgetName,
                                                     QObject *Parent, const char *Name,
                                                     const char *CN, const QStringList &/*args*/ )
{
  QCString Classname( CN );
  bool BrowserViewWanted = ( Classname == "Browser/View" );
  //bool ReadOnlyWanted = (BrowserViewWanted || ( Classname == "KParts::ReadOnlyPart" ));

  // Create an instance of our Part
  KHexEditPart* HexEditPart = new KHexEditPart( ParentWidget, WidgetName, Parent, Name, BrowserViewWanted );

  return HexEditPart;
}


KInstance* KHexEditPartFactory::instance()
{
  if( !s_instance )
  {
    s_about = new KAboutData( PartId, PartName, PartVersion, PartDescription,
                              KAboutData::License_GPL_V2, PartCopyright, 0, 0, FWHKEmailAddress );
    s_about->addAuthor( FWHKName, FWHKTask, FWHKEmailAddress );
    s_instance = new KInstance( s_about );
  }
  return s_instance;
}


K_EXPORT_COMPONENT_FACTORY( libkhexedit2part, KHexEditPartFactory )

#include "khepartfactory.moc"