BiblioteQ

biblioteq_book.h
1 /*
2 ** Copyright (c) 2006 - present, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from BiblioteQ without specific prior written permission.
15 **
16 ** BIBLIOTEQ IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** BIBLIOTEQ, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef _BIBLIOTEQ_BOOK_H_
29 #define _BIBLIOTEQ_BOOK_H_
30
31 #include "biblioteq_item.h"
32 #include "biblioteq_marc.h"
33 #include "ui_biblioteq_bookinfo.h"
34 #include "ui_biblioteq_passwordPrompt.h"
35
36 #include <QBuffer>
37 #include <QNetworkReply>
38 #include <QPointer>
39
40 class biblioteq_generic_thread;
41
42 class biblioteq_book: public QMainWindow, public biblioteq_item
43 {
44 Q_OBJECT
45
46 public:
47 biblioteq_book(biblioteq *parentArg,
48 const QString &oidArg,
49 const QModelIndex &index);
50 ~biblioteq_book();
51 void duplicate(const QString &p_oid, const int state);
52 void insert(void);
53 void modify(const int state);
54 void search(const QString &field = "", const QString &value = "");
55
56 void setPublicationDateFormat(const QString &dateFormat)
57 {
58 id.publication_date->setDisplayFormat(dateFormat);
59 }
60
61 void updateWindow(const int);
62
63 private:
64 enum Columns
65 {
66 COMPRESSED_SIZE = 2,
67 DESCRIPTION = 3,
68 DIGEST = 1,
69 FILE = 0,
70 MYOID = 4
71 };
72
73 QBuffer m_imageBuffer;
74 QByteArray m_openLibraryResults;
75 QByteArray m_sruResults;
76 QDialog *m_proxyDialog;
77 QNetworkAccessManager *m_imageManager;
78 QNetworkAccessManager *m_openLibraryManager;
79 QNetworkAccessManager *m_sruManager;
80 QPalette m_te_orig_pal;
81 QPalette m_white_pal;
82 QPointer<biblioteq_generic_thread> m_thread;
83 QPointer<biblioteq_item_working_dialog> m_openLibraryWorking;
84 QPointer<biblioteq_item_working_dialog> m_sruWorking;
85 QString m_cb_orig_ss;
86 QString m_dt_orig_ss;
87 QString m_engWindowTitle;
88 Ui_informationDialog id;
89 Ui_passwordDialog ui_p;
90 bool m_duplicate;
91 biblioteq_item_working_dialog *createImageDownloadDialog
92 (const QString &downloadType);
93 void changeEvent(QEvent *event);
94 void closeEvent(QCloseEvent *event);
95 void createFile(const QByteArray &digest,
96 const QByteArray &bytes,
97 const QString &fileName) const;
98 void createOpenLibraryDialog(void);
99 void createSRUDialog(void);
100 void populateAfterOpenLibrary(void);
101 void populateAfterSRU(const QString &recordSyntax, const QString &text);
102 void populateAfterZ3950(const QString &text,
103 const biblioteq_marc::RECORD_SYNTAX recordSyntax);
104 void populateFiles(void);
105 void prepareFavorites(void);
106 void resetQueryHighlights(void);
107
108 private slots:
109 void downloadFinished(void);
110 void openLibraryDownloadFinished(void);
111 void setGlobalFonts(const QFont &font);
112 void slotAttachFiles(void);
113 void slotCancel(void);
114 void slotCancelImageDownload(void);
115 void slotConvertISBN10to13(void);
116 void slotConvertISBN13to10(void);
117 void slotDataTransferProgress(qint64 bytesread, qint64 totalbytes);
118 void slotDeleteFiles(void);
119 void slotDownloadFinished(void);
120 void slotDownloadImage(void);
121 void slotExportFiles(void);
122 void slotFilesDoubleClicked(QTableWidgetItem *item);
123 void slotGo(void);
124 void slotOpenLibraryCanceled(void);
125 void slotOpenLibraryDownloadFinished(bool error);
126 void slotOpenLibraryDownloadFinished(void);
127 void slotOpenLibraryError(QNetworkReply::NetworkError error);
128 void slotOpenLibraryQuery(void);
129 void slotOpenLibraryQueryError(const QString &text);
130 void slotOpenLibraryReadyRead(void);
131 void slotOpenLibrarySslErrors(const QList<QSslError> &list);
132 void slotParseMarcTags(void);
133 void slotPopulateCopiesEditor(void);
134 void slotPrint(void);
135 void slotPrintAuthorTitleDewey(void);
136 void slotPrintCallDewey(void);
137 void slotProxyAuthenticationRequired(const QNetworkProxy &proxy,
138 QAuthenticator *authenticator);
139 void slotPublicationDateEnabled(bool state);
140 void slotReadyRead(void);
141 void slotReset(void);
142 void slotSRUCanceled(void);
143 void slotSRUDownloadFinished(bool error);
144 void slotSRUDownloadFinished(void);
145 void slotSRUError(QNetworkReply::NetworkError error);
146 void slotSRUQuery(void);
147 void slotSRUQueryError(const QString &text);
148 void slotSRUReadyRead(void);
149 void slotSRUSslErrors(const QList<QSslError> &list);
150 void slotSelectImage(void);
151 void slotShowPDF(void);
152 void slotShowUsers(void);
153 void slotZ3950Query(void);
154 void sruDownloadFinished(void);
155
156 signals:
157 void openLibraryQueryError(const QString &text);
158 void sruQueryError(const QString &text);
159 };
160
161 #endif
biblioteq_book
Definition: biblioteq_book.h:43
biblioteq_generic_thread
Definition: biblioteq_generic_thread.h:38
biblioteq_item_working_dialog
Definition: biblioteq_item.h:43
biblioteq_item
Definition: biblioteq_item.h:72
biblioteq
Definition: biblioteq.h:274