File indexing completed on 2024-05-05 16:08:28

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Library General Public
0006     License as published by the Free Software Foundation; either
0007     version 2 of the License, or (at your option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     Library General Public License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to
0016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017     Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #include "kscan.h"
0021 
0022 #include <QFile>
0023 #include <QPushButton>
0024 
0025 #include <klocalizedstring.h>
0026 #include <kservicetypetrader.h>
0027 
0028 class Q_DECL_HIDDEN KScanDialog::KScanDialogPrivate
0029 {
0030 public:
0031     KScanDialogPrivate()
0032         : m_currentId(1)
0033     {}
0034     int m_currentId;
0035 };
0036 
0037 // static factory method
0038 KScanDialog *KScanDialog::getScanDialog(QWidget *parent)
0039 {
0040     return KServiceTypeTrader::createInstanceFromQuery<KScanDialog>("KScan/KScanDialog", QString(), parent);
0041 }
0042 
0043 KScanDialog::KScanDialog(int dialogFace, int buttonMask,
0044                          QWidget *parent)
0045     : KPageDialog(parent),
0046       d(new KScanDialogPrivate)
0047 {
0048     setFaceType((KPageDialog::FaceType)dialogFace);
0049     setWindowTitle(i18n("Acquire Image"));
0050     buttonBox()->setStandardButtons((QDialogButtonBox::StandardButtons)buttonMask);
0051     buttonBox()->button(QDialogButtonBox::Close)->setDefault(true);
0052 }
0053 
0054 KScanDialog::~KScanDialog()
0055 {
0056     delete d;
0057 }
0058 
0059 int KScanDialog::id() const
0060 {
0061     return d->m_currentId;
0062 }
0063 
0064 int KScanDialog::nextId()
0065 {
0066     return ++d->m_currentId;
0067 }
0068 
0069 bool KScanDialog::setup()
0070 {
0071     return true;
0072 }
0073 
0074 ///////////////////////////////////////////////////////////////////
0075 
0076 class Q_DECL_HIDDEN KOCRDialog::KOCRDialogPrivate
0077 {
0078 public:
0079     KOCRDialogPrivate()
0080         : m_currentId(1)
0081     {}
0082     int m_currentId;
0083 };
0084 
0085 // static factory method
0086 KOCRDialog *KOCRDialog::getOCRDialog(QWidget *parent)
0087 {
0088     return KServiceTypeTrader::createInstanceFromQuery<KOCRDialog>("KScan/KOCRDialog", QString(), parent);
0089 }
0090 
0091 KOCRDialog::KOCRDialog(int dialogFace, int buttonMask,
0092                        QWidget *parent, bool modal)
0093     : KPageDialog(parent),
0094       d(new KOCRDialogPrivate)
0095 {
0096     setFaceType((KPageDialog::FaceType)dialogFace);
0097     setWindowTitle(i18n("OCR Image"));
0098     buttonBox()->setStandardButtons((QDialogButtonBox::StandardButtons)buttonMask);
0099     buttonBox()->button(QDialogButtonBox::Close)->setDefault(true);
0100     setModal(modal);
0101 }
0102 
0103 KOCRDialog::~KOCRDialog()
0104 {
0105     delete d;
0106 }
0107 
0108 int KOCRDialog::id() const
0109 {
0110     return d->m_currentId;
0111 }
0112 
0113 int KOCRDialog::nextId()
0114 {
0115     return ++d->m_currentId;
0116 }
0117 
0118 #include "moc_kscan.cpp"