annotate src/main.h @ 123:e76d85ea87ac

Rename SQL_MAX_* defines to SQL_LEN_* for being more descriptive .. maybe.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Jul 2017 15:47:18 +0300
parents 404d567edaab
children 6e2d26e7a0b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // Syntilista - velkalistasovellus Kampus-kahvilaan
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Programmed and designed by Matti Hämäläinen <ccr@tnsp.org>
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // (C) Copyright 2017 Tecnic Software productions (TNSP)
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
57
893f69fcf050 Add license.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
6 // Distributed under 3-clause BSD style license, refer to
893f69fcf050 Add license.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
7 // included file "COPYING" for exact terms.
893f69fcf050 Add license.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
8 //
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
9 #ifndef SYNTILISTA_H
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
10 #define SYNTILISTA_H
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #include <QMainWindow>
17
d40345d63733 Implement some keyboard shortcuts.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
13 #include <QShortcut>
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 #include <QDialog>
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #include <QtSql>
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #include <QSqlQueryModel>
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
17 #include <QPainter>
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
18 #include <QPrinter>
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 //
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
22 // Global application defines
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 //
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
24 #define APP_VENDOR "TNSP" // Vendor ID (for settings, etc.)
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
25 #define APP_ID "Kampus Syntilista" // Application ID (for settings)
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
26 #define APP_NAME "Café Kampus Syntilista" // Application title/name
42
60ffa45b4014 Use #define APP_SQLITE_FILE for the application Sqlite3 database filename.
Matti Hamalainen <ccr@tnsp.org>
parents: 41
diff changeset
27 #define APP_SQLITE_FILE "syntilista.sqlite3" // SQLite3 database file name (without path)
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
123
e76d85ea87ac Rename SQL_MAX_* defines to SQL_LEN_* for being more descriptive .. maybe.
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
30 #define SQL_LEN_FIRST_NAME 128
e76d85ea87ac Rename SQL_MAX_* defines to SQL_LEN_* for being more descriptive .. maybe.
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
31 #define SQL_LEN_LAST_NAME 128
e76d85ea87ac Rename SQL_MAX_* defines to SQL_LEN_* for being more descriptive .. maybe.
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
32 #define SQL_LEN_EXTRA_INFO 2048
113
907f2ddf6801 Use #defines for SQL table field lengths.
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
33
907f2ddf6801 Use #defines for SQL table field lengths.
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
34
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 //
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 // Custom SQL models
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 //
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 class PersonInfo : public QObject
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 Q_OBJECT
112
2524434a7193 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
41
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 explicit PersonInfo()
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 {
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
45 id = -1;
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
46 firstName = "";
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
47 lastName = "";
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
48 extraInfo = "";
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
49 balance = 0;
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 }
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 ~PersonInfo()
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 }
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
56 void dump();
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
57
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 qint64 id;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 QString firstName, lastName, extraInfo;
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
60 double balance;
4
f2404a9987dc Cleaning up the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
61 QDateTime added, updated;
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 class PersonSQLModel : public QSqlQueryModel
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 Q_OBJECT
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 PersonSQLModel(QObject *parent = 0);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 QVariant data(const QModelIndex &item, int role) const Q_DECL_OVERRIDE;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
13
ca5ce74c0563 Refactoring.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
77 int updatePerson(const PersonInfo &person);
109
62e570222f66 Return inserted person ID from addPerson() (or negative value in case of errors.)
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
78 qint64 addPerson(const PersonInfo &person);
13
ca5ce74c0563 Refactoring.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
79 int deletePerson(qint64 id);
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 void updateModel();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 class TransactionSQLModel : public QSqlQueryModel
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 Q_OBJECT
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 TransactionSQLModel(QObject *parent = 0);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 QVariant data(const QModelIndex &item, int role) const Q_DECL_OVERRIDE;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 void updateModel();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 //
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 // Main window
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 //
100
6d02b4ae936c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
104 namespace Ui
6d02b4ae936c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
105 {
6d02b4ae936c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
106 class SyntilistaMainWindow;
6d02b4ae936c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
107 class EditPerson;
6d02b4ae936c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
108 class AboutWindow;
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 }
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
111 typedef struct
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
112 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
113 int nlinesPerPage;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
114 int npages;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
115 } SLPageInfo;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
116
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
117
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 class SyntilistaMainWindow : public QMainWindow
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 Q_OBJECT
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 explicit SyntilistaMainWindow(QWidget *parent = 0);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 ~SyntilistaMainWindow();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 void statusMsg(const QString &msg);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 void readSettings();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 void saveSettings();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 void setActivePerson(qint64 id);
4
f2404a9987dc Cleaning up the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
131 int addTransaction(qint64 id, double value, PersonInfo &info);
f2404a9987dc Cleaning up the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
132 int addTransactionGUI(qint64 id, bool debt, double value);
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 void updatePersonList();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
135 bool printDocumentPage(SLPageInfo &pinfo, const bool getPageInfo, const int page, QPainter *pt, QPrinter *printer);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
136
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 PersonSQLModel *model_People;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
109
62e570222f66 Return inserted person ID from addPerson() (or negative value in case of errors.)
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
139 public slots:
62e570222f66 Return inserted person ID from addPerson() (or negative value in case of errors.)
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
140 void focusDebtEdit();
62e570222f66 Return inserted person ID from addPerson() (or negative value in case of errors.)
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
141
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 private slots:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 void on_button_AddPerson_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 void on_button_EditPerson_clicked();
66
6767807df30e Reorder slot definitions.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
145 void on_button_DeletePerson_clicked();
6767807df30e Reorder slot definitions.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
146
79
f48b8fc1de64 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
147 void on_edit_PersonFilter_textChanged(const QString &arg1);
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 void on_button_ClearFilter_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 void on_button_Quit_clicked();
60
d7a2a48ebe24 Add a separate "About" button, don't use the logo as one. Change logo widget
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
151 void on_button_About_clicked();
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
152 void on_button_Print_clicked();
47
08c0d5116e82 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
153
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 void on_button_AddDebt_clicked();
2
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
155 void on_button_PayDebt_clicked();
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
156 void on_button_PayFullDebt_clicked();
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 void on_tableview_People_doubleClicked(const QModelIndex &index);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 void selectedPersonChanged(const QModelIndex &, const QModelIndex &);
65
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
161
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
162 void selectRowPrev();
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
163 void selectRowNext();
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
164
46
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
165 void changeUIZoomIn();
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
166 void changeUIZoomOut();
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
167 void changeUIZoomReset();
112
2524434a7193 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
168
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 void updateSortOrder(int index, Qt::SortOrder order);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
171 void printDocument(QPrinter *printer);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
172
6
0315a3b9f560 Implement person and transaction history deletion.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
173
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 Ui::SyntilistaMainWindow *ui;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 TransactionSQLModel *model_Latest;
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
178 PersonInfo currPerson;
2
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
179
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 int peopleSortIndex;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 Qt::SortOrder peopleSortOrder;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 QString peopleFilter;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
186 //
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
187 // Person edit / new person dialog
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
188 //
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 class EditPerson : public QDialog
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 Q_OBJECT
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 explicit EditPerson(QWidget *parent = 0);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 ~EditPerson();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 void statusMsg(const QString &msg);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 void clearForm();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 bool validateForm();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 void setPerson(qint64 id);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 private slots:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 void on_button_OK_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 void on_button_Cancel_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 void on_edit_FirstName_textChanged(const QString &arg1);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 void on_edit_LastName_textChanged(const QString &arg1);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211
121
404d567edaab Validate the length of extra info field in the add/edit person dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
212 void on_textedit_ExtraInfo_textChanged();
404d567edaab Validate the length of extra info field in the add/edit person dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
213
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 Ui::EditPerson *ui;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
217 PersonInfo selPerson;
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 TransactionSQLModel *model_Transactions;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220
90
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
221
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
222 //
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
223 // About dialog
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
224 //
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
225 class AboutWindow : public QDialog
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
226 {
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
227 Q_OBJECT
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
228
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
229 public:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
230 explicit AboutWindow(QWidget *parent = 0);
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
231 ~AboutWindow();
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
232
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
233 private slots:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
234 void on_button_Close_clicked();
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
235
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
236 private:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
237 Ui::AboutWindow *ui;
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
238 };
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
239
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
240
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
241 //
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
242 // Custom painter drawing helper class
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
243 //
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
244 class SLDrawContext : public QObject
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
245 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
246 Q_OBJECT
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
247
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
248 public:
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
249 QPointF m_pos;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
250 QString m_str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
251 qreal m_lf_add;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
252
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
253 explicit SLDrawContext(QPainter *pt)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
254 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
255 painter = pt;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
256 metrics = NULL;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
257 m_str = "ABC";
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
258 setPos(0, 0);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
259 m_lf_add = 0;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
260 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
261
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
262 ~SLDrawContext()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
263 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
264 if (metrics)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
265 delete metrics;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
266 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
267
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
268 void setFont(const QFont &ft)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
269 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
270 if (metrics)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
271 delete metrics;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
272
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
273 font = QFont(ft, painter->device());
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
274 painter->setFont(font);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
275 metrics = new QFontMetricsF(font);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
276 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
277
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
278 void setLFAdd(const qreal lf_add)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
279 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
280 m_lf_add = lf_add;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
281 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
282
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
283 void drawText(const QPointF &pos, const QString &str)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
284 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
285 m_str = str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
286 painter->drawText(m_pos + pos, str);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
287 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
288
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
289 void drawText(const QString &str)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
290 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
291 drawText(QPointF(0, 0), str);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
292 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
293
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
294 void drawText(const qreal xc, const qreal width, const QString &str, const int flags = 0)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
295 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
296 m_str = str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
297 painter->drawText(
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
298 m_pos.x() + xc, m_pos.y(),
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
299 width, boundRect().height(),
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
300 flags,
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
301 str);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
302 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
303
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
304 const QRectF boundRect(const QString str)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
305 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
306 return metrics->boundingRect(str);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
307 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
308
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
309 const QRectF boundRect()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
310 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
311 return metrics->boundingRect(m_str);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
312 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
313
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
314 void lf(qreal yadd)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
315 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
316 m_pos.setY(m_pos.y() + boundRect().height() + yadd);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
317 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
318
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
319 void lf()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
320 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
321 lf(m_lf_add);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
322 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
323
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
324 void setPos(const QPointF &pos)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
325 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
326 m_pos = pos;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
327 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
328
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
329 void setPos(const qreal x, const qreal y)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
330 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
331 setPos(QPointF(x, y));
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
332 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
333
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
334 void move(const QPointF &pos)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
335 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
336 m_pos += pos;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
337 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
338
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
339 void move(const qreal x, const qreal y)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
340 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
341 move(QPointF(x, y));
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
342 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
343
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
344 private:
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
345 QPainter *painter;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
346 QFont font;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
347 QFontMetricsF *metrics;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
348 };
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
349
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
350
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
351 #endif // SYNTILISTA_H