• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
kscan.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include <tqfile.h>
21 
22 #include <tdelocale.h>
23 #include <ktrader.h>
24 
25 #include "kscan.h"
26 
27 // static factory method
28 KScanDialog * KScanDialog::getScanDialog( TQWidget *parent, const char *name,
29  bool modal )
30 {
31  TDETrader::OfferList offers = TDETrader::self()->query("KScan/KScanDialog");
32  if ( offers.isEmpty() )
33  return 0L;
34 
35  KService::Ptr ptr = *(offers.begin());
36  KLibFactory *factory = KLibLoader::self()->factory( TQFile::encodeName(ptr->library()) );
37 
38  if ( !factory )
39  return 0;
40 
41  TQStringList args;
42  args << TQString::number( (int)modal );
43 
44  TQObject *res = factory->create( parent, name, "KScanDialog", args );
45 
46  return dynamic_cast<KScanDialog *>( res );
47 }
48 
49 
50 KScanDialog::KScanDialog( int dialogFace, int buttonMask,
51  TQWidget *parent, const char *name, bool modal )
52  : KDialogBase( dialogFace, i18n("Acquire Image"), buttonMask, Close,
53  parent, name, modal, true ),
54  m_currentId( 1 )
55 {
56 }
57 
58 KScanDialog::~KScanDialog()
59 {
60 }
61 
62 bool KScanDialog::setup()
63 {
64  return true;
65 }
66 
68 
69 
70 // static factory method
71 KOCRDialog * KOCRDialog::getOCRDialog( TQWidget *parent, const char *name,
72  bool modal )
73 {
74  TDETrader::OfferList offers = TDETrader::self()->query("KScan/KOCRDialog");
75  if ( offers.isEmpty() )
76  return 0L;
77 
78  KService::Ptr ptr = *(offers.begin());
79  KLibFactory *factory = KLibLoader::self()->factory( TQFile::encodeName(ptr->library()) );
80 
81  if ( !factory )
82  return 0;
83 
84  TQStringList args;
85  args << TQString::number( (int)modal );
86 
87  TQObject *res = factory->create( parent, name, "KOCRDialog", args );
88 
89  return dynamic_cast<KOCRDialog *>( res );
90 }
91 
92 
93 KOCRDialog::KOCRDialog( int dialogFace, int buttonMask,
94  TQWidget *parent, const char *name, bool modal )
95  : KDialogBase( dialogFace, i18n("OCR Image"), buttonMask, Close,
96  parent, name, modal, true ),
97  m_currentId( 1 )
98 {
99 
100 }
101 
102 KOCRDialog::~KOCRDialog()
103 {
104 }
105 
106 
108 
109 
110 KScanDialogFactory::KScanDialogFactory( TQObject *parent, const char *name )
111  : KLibFactory( parent, name ),
112  m_instance( 0L )
113 {
114 }
115 
116 KScanDialogFactory::~KScanDialogFactory()
117 {
118  delete m_instance;
119 }
120 
121 TQObject *KScanDialogFactory::createObject( TQObject *parent, const char *name,
122  const char *classname,
123  const TQStringList &args )
124 {
125  if ( strcmp( classname, "KScanDialog" ) != 0 )
126  return 0;
127 
128  if ( parent && !parent->isWidgetType() )
129  return 0;
130 
131  bool modal = false;
132 
133  if ( args.count() == 1 )
134  modal = (bool)args[ 0 ].toInt();
135 
136  return createDialog( static_cast<TQWidget*>( parent ), name, modal );
137 }
138 
139 
141 
142 
143 KOCRDialogFactory::KOCRDialogFactory( TQObject *parent, const char *name )
144  : KLibFactory( parent, name ),
145  m_instance( 0L )
146 {
147 }
148 
149 KOCRDialogFactory::~KOCRDialogFactory()
150 {
151  delete m_instance;
152 }
153 
154 TQObject *KOCRDialogFactory::createObject( TQObject *parent, const char *name,
155  const char *classname,
156  const TQStringList &args )
157 {
158  if ( strcmp( classname, "KOCRDialog" ) != 0 )
159  return 0;
160 
161  if ( parent && !parent->isWidgetType() )
162  return 0;
163 
164  bool modal = false;
165 
166  if ( args.count() == 1 )
167  modal = (bool)args[ 0 ].toInt();
168 
169  return createDialog( static_cast<TQWidget*>( parent ), name, modal );
170 }
171 
172 void KScanDialog::virtual_hook( int id, void* data )
173 { KDialogBase::virtual_hook( id, data ); }
174 
175 void KScanDialogFactory::virtual_hook( int id, void* data )
176 { KLibFactory::virtual_hook( id, data ); }
177 
178 void KOCRDialog::virtual_hook( int id, void* data )
179 { KDialogBase::virtual_hook( id, data ); }
180 
181 void KOCRDialogFactory::virtual_hook( int id, void* data )
182 { KLibFactory::virtual_hook( id, data ); }
183 
184 
185 #include "kscan.moc"
KOCRDialogFactory::createDialog
virtual KOCRDialog * createDialog(TQWidget *parent=0, const char *name=0, bool modal=false)=0
Your library should reimplement this method to return your KOCRDialog derived dialog.
KOCRDialogFactory::KOCRDialogFactory
KOCRDialogFactory(TQObject *parent=0, const char *name=0)
Creates a new KScanDialogFactory.
Definition: kscan.cpp:143
KOCRDialog
Base class for OCR Dialogs.
Definition: kscan.h:237
KOCRDialog::KOCRDialog
KOCRDialog(int dialogFace=Tabbed, int buttonMask=Close|Help, TQWidget *parent=0L, const char *name=0, bool modal=false)
Constructs the OCR dialog.
Definition: kscan.cpp:93
KOCRDialog::getOCRDialog
static KOCRDialog * getOCRDialog(TQWidget *parent=0L, const char *name=0, bool modal=false)
Creates the user's preferred OCR dialog and returns it, or 0L if no OCR-support is available.
Definition: kscan.cpp:71
KScanDialogFactory::createDialog
virtual KScanDialog * createDialog(TQWidget *parent=0, const char *name=0, bool modal=false)=0
Your library should reimplement this method to return your KScanDialog derived dialog.
KScanDialogFactory::KScanDialogFactory
KScanDialogFactory(TQObject *parent=0, const char *name=0)
Creates a new KScanDialogFactory.
Definition: kscan.cpp:110
KScanDialog
This is a base class for scanning dialogs.
Definition: kscan.h:64
KScanDialog::KScanDialog
KScanDialog(int dialogFace=Tabbed, int buttonMask=Close|Help, TQWidget *parent=0L, const char *name=0, bool modal=false)
Constructs the scan dialog.
Definition: kscan.cpp:50
KScanDialog::getScanDialog
static KScanDialog * getScanDialog(TQWidget *parent=0L, const char *name=0, bool modal=false)
Creates the user's preferred scanning dialog and returns it, or 0L if no scan-support is available.
Definition: kscan.cpp:28
KScanDialog::~KScanDialog
~KScanDialog()
Destructs the scan dialog.
Definition: kscan.cpp:58
KScanDialog::setup
virtual bool setup()
Reimplement this if you need to set up some things, before showing the dialog, e.g.
Definition: kscan.cpp:62
TDETrader::query
virtual OfferList query(const TQString &servicetype, const TQString &constraint=TQString::null, const TQString &preferences=TQString::null) const
The main function in the TDETrader class.
Definition: ktrader.cpp:106
TDETrader::self
static TDETrader * self()
This is a static pointer to a TDETrader instance.
Definition: ktrader.cpp:90
TDETrader::OfferList
TQValueList< KService::Ptr > OfferList
A list of services.
Definition: ktrader.h:92

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.