summaryrefslogtreecommitdiffstats
path: root/kooka/main.cpp
blob: c6c5344969fae1df0070c6b940633ff0c2047a87 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Thu Dec  9 20:16:54 MET 1999

    copyright            : (C) 1999 by Klaas Freitag
    email                : freitag@suse.de
 ***************************************************************************/


/***************************************************************************
 *                                                                         *
 *  This file may be distributed and/or modified under the terms of the    *
 *  GNU General Public License version 2 as published by the Free Software *
 *  Foundation and appearing in the file COPYING included in the           *
 *  packaging of this file.                                                *
 *
 *  As a special exception, permission is given to link this program       *
 *  with any version of the KADMOS ocr/icr engine of reRecognition GmbH,   *
 *  Kreuzlingen and distribute the resulting executable without            *
 *  including the source code for KADMOS in the source distribution.       *
 *
 *  As a special exception, permission is given to link this program       *
 *  with any edition of TQt, and distribute the resulting executable,       *
 *  without including the source code for TQt in the source distribution.   *
 *                                                                         *
 ***************************************************************************/

#include <tqdict.h>
#include <tqpixmap.h>

#include <kapplication.h>
#include <dcopclient.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kglobal.h>
#include <kimageio.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <twin.h>

#include "kooka.h"
#include "version.h"

static const char description[] =
          "Kooka is a KDE application which provides access to scanner hardware\n"
	      "using the SANE library.\n"
	      "Kooka helps you scan, save your image in the correct image format\n"
	      "and perform Optical Character Recognition on it, using gocr, Joerg\n"
	      "Schulenburg's and friends' Open Source ocr program.";

static const char license[] =
"This program is distributed under the terms of the GPL v2 as publishec by\n"
"the Free Software Foundation\n\n"
"As a special exception, permission is given to link this program\n"
"with any version of the KADMOS ocr/icr engine of reRecognition GmbH,\n"
"Kreuzlingen and distribute the resulting executable without\n"
"including the source code for KADMOS in the source distribution.\n\n"
"As a special exception, permission is given to link this program\n"
"with any edition of TQt, and distribute the resulting executable,\n"
"without including the source code for TQt in the source distribution.\n";


static KCmdLineOptions options[] =
{
  { "d ", I18N_NOOP("The SANE compatible device specification (e.g. umax:/dev/sg0)"), "" },
  { "g", I18N_NOOP("Gallery mode - do not connect to scanner"), "" },
  KCmdLineLastOption
};



int main( int argc, char *argv[] )
{
   KAboutData about("kooka", I18N_NOOP("Kooka"), KOOKA_VERSION, I18N_NOOP(description),
		    KAboutData::License_GPL_V2, "(C) 2000 Klaas Freitag", 0,
		    I18N_NOOP("http://kooka.kde.org"));

   about.addAuthor( "Klaas Freitag", I18N_NOOP("developer"), "freitag@suse.de" );
   about.addAuthor( "Mat Colton", I18N_NOOP("graphics, web"), "mat@colton.de" );
   about.setLicenseText( license );

   KCmdLineArgs::init(argc, argv, &about);
   KCmdLineArgs::addCmdLineOptions( options ); // Add my own options.

   KApplication app;
   KGlobal::locale()->insertCatalogue("libkscan");
   KImageIO::registerFormats();
   KIconLoader *loader = KGlobal::iconLoader();

   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
   TQCString  devToUse = args->getOption( "d" );
   if( args->isSet("g") )
   {
      devToUse = "gallery";
   }
   kdDebug( 29000) << "DevToUse is " << devToUse << endl;

   if (args->count() == 1)
   {
      args->usage();
      // exit(-1);
   }


   Kooka  *kooka = new Kooka(devToUse);
   app.setMainWidget( kooka );

   KWin::setIcons(kooka->winId(), loader->loadIcon( "scanner", KIcon::Desktop ),
		  loader->loadIcon("scanner", KIcon::Small) );

   kooka->show();
   app.processEvents();
   kooka->startup();
   args->clear();
   int ret = app.exec();

   return ret;

}