File indexing completed on 2024-09-15 12:24:29
0001 /* 0002 * SPDX-FileCopyrightText: 2009 Kare Sars <kare dot sars at iki dot fi> 0003 * SPDX-FileCopyrightText: 2014 Gregor Mitsch : port to KDE5 frameworks 0004 * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KSANE_CORE_PRIVATE_H 0010 #define KSANE_CORE_PRIVATE_H 0011 0012 #include <QHash> 0013 #include <QList> 0014 #include <QSet> 0015 #include <QTime> 0016 #include <QTimer> 0017 #include <QVarLengthArray> 0018 #include <QVector> 0019 0020 #include "authentication.h" 0021 #include "baseoption.h" 0022 #include "finddevicesthread.h" 0023 #include "interface.h" 0024 #include "scanthread.h" 0025 0026 /** This namespace collects all methods and classes in LibKSane. */ 0027 namespace KSaneCore 0028 { 0029 0030 class InterfacePrivate : public QObject 0031 { 0032 Q_OBJECT 0033 0034 public: 0035 explicit InterfacePrivate(Interface *parent); 0036 Interface::OpenStatus loadDeviceOptions(); 0037 void clearDeviceOptions(); 0038 void setDefaultValues(); 0039 0040 void scanIsFinished(Interface::ScanStatus status, const QString &message); 0041 0042 public Q_SLOTS: 0043 void devicesListUpdated(); 0044 void signalDevicesListUpdate(); 0045 void imageScanFinished(); 0046 void scheduleValuesReload(); 0047 void reloadOptions(); 0048 void reloadValues(); 0049 0050 private Q_SLOTS: 0051 void determineMultiPageScanning(const QVariant &value); 0052 void setWaitForExternalButton(const QVariant &value); 0053 void pollPollOptions(); 0054 void batchModeTimerUpdate(); 0055 0056 public: 0057 // device info 0058 SANE_Handle m_saneHandle = nullptr; 0059 QString m_devName; 0060 QString m_vendor; 0061 QString m_model; 0062 0063 // Option variables 0064 QList<BaseOption *> m_optionsList; 0065 QList<Option *> m_externalOptionsList; 0066 QHash<Interface::OptionName, int> m_optionsLocation; 0067 QList<BaseOption *> m_optionsPollList; 0068 QTimer m_readValuesTimer; 0069 QTimer m_optionPollTimer; 0070 bool m_optionPollingNaughtylisted = false; 0071 0072 QString m_saneUserName; 0073 QString m_sanePassword; 0074 0075 ScanThread *m_scanThread = nullptr; 0076 FindSaneDevicesThread *m_findDevThread; 0077 Authentication *m_auth; 0078 Interface *q; 0079 0080 // state variables 0081 // determines whether scanner will send multiple images 0082 bool m_executeMultiPageScanning = false; 0083 // scanning has been cancelled externally 0084 bool m_cancelMultiPageScan = false; 0085 // next scanning will start with a hardware button press 0086 bool m_waitForExternalButton = false; 0087 // batch mode options 0088 BaseOption *m_batchMode = nullptr; 0089 BaseOption *m_batchModeDelay = nullptr; 0090 QTimer m_batchModeTimer; 0091 int m_batchModeCounter = 0; 0092 }; 0093 0094 } // NameSpace KSaneCore 0095 0096 #endif // KSANE_CORE_PRIVATE_H