BiblioteQ

biblioteq_item.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_ITEM_H_
29 #define _BIBLIOTEQ_ITEM_H_
30
31 #include <QFont>
32 #include <QKeyEvent>
33 #include <QMainWindow>
34 #include <QPointer>
35 #include <QPrintDialog>
36 #include <QPrinter>
37 #include <QProgressDialog>
38
39 class QPersistentModelIndex;
40 class biblioteq;
41
42 class biblioteq_item_working_dialog: public QProgressDialog
43 {
44 Q_OBJECT
45
46 public:
47 biblioteq_item_working_dialog(QMainWindow *parent):QProgressDialog(parent)
48 {
49 }
50
51 ~biblioteq_item_working_dialog()
52 {
53 }
54
55 protected:
56 void closeEvent(QCloseEvent *event)
57 {
58 if(event)
59 event->ignore();
60 }
61
62 void keyPressEvent(QKeyEvent *event)
63 {
64 if(event && event->key() == Qt::Key_Escape)
65 event->ignore();
66 else
67 QProgressDialog::keyPressEvent(event);
68 }
69 };
70
71 class biblioteq_item
72 {
73 public:
74 biblioteq_item(const QModelIndex &index);
75 biblioteq_item(void);
76 virtual ~biblioteq_item();
77 QString getID(void) const;
78 int getOldQ(void) const;
79 int getRow(void) const;
80 void setOldQ(const int q);
81 void updateQuantity(const int q);
82 void updateRow(const QModelIndex &index);
83
84 protected:
85 QColor m_queryHighlightColor;
86 QColor m_requiredHighlightColor;
87 QMap<QString, QImage> m_imageValues;
88 QMap<QString, QString> m_widgetValues;
89 QPersistentModelIndex *m_index;
90 QPointer<QMainWindow> m_parentWid;
91 QString m_html;
92 QString m_oid;
93 biblioteq *qmain;
94 bool m_isQueryEnabled;
95 int m_oldq;
96 bool hasDataChanged(QMainWindow *window) const;
97 void print(QWidget *parent);
98 void setQMain(QMainWindow *window);
99 void setReadOnlyFields(QMainWindow *window, const bool state);
100 void storeData(QMainWindow *window);
101 void updateFont(const QFont &font, QWidget *window);
102 };
103
104 #endif
biblioteq_item_working_dialog
Definition: biblioteq_item.h:43
biblioteq_item
Definition: biblioteq_item.h:72
biblioteq
Definition: biblioteq.h:274