annotate src/main.h @ 140:783417da6da3

Change the program description to english etc.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 Aug 2017 13:15:48 +0300
parents 10c6bd84eb32
children d0943d41f391
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 //
140
783417da6da3 Change the program description to english etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
2 // Syntilista - debt list/management database program
0
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)
126
b51cee929416 Add program debug logging.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
28 #define APP_LOG_FILE "log.txt" // Application log file
0
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();
130
10c6bd84eb32 Add "total balance" information in the UI, which displays the total sum balance of all people.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
134 void updateTotalBalance();
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
136 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
137
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 PersonSQLModel *model_People;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
109
62e570222f66 Return inserted person ID from addPerson() (or negative value in case of errors.)
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
140 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
141 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
142
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 private slots:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 void on_button_AddPerson_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 void on_button_EditPerson_clicked();
66
6767807df30e Reorder slot definitions.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
146 void on_button_DeletePerson_clicked();
6767807df30e Reorder slot definitions.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
147
79
f48b8fc1de64 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
148 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
149 void on_button_ClearFilter_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 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
152 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
153 void on_button_Print_clicked();
47
08c0d5116e82 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
154
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 void on_button_AddDebt_clicked();
2
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
156 void on_button_PayDebt_clicked();
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
157 void on_button_PayFullDebt_clicked();
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 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
160
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 void selectedPersonChanged(const QModelIndex &, const QModelIndex &);
65
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
162
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
163 void selectRowPrev();
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
164 void selectRowNext();
f9a1d33ed4a8 Add more keyboard controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
165
46
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
166 void changeUIZoomIn();
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
167 void changeUIZoomOut();
372c1be58996 Improve shortcuts functionality a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
168 void changeUIZoomReset();
112
2524434a7193 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
169
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 void updateSortOrder(int index, Qt::SortOrder order);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
172 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
173
6
0315a3b9f560 Implement person and transaction history deletion.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
174
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 Ui::SyntilistaMainWindow *ui;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 TransactionSQLModel *model_Latest;
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
179 PersonInfo currPerson;
2
edc1e8cf6e2c Implement "pay debt in full" button.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
180
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 int peopleSortIndex;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 Qt::SortOrder peopleSortOrder;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 QString peopleFilter;
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
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
187 //
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
188 // Person edit / new person dialog
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
189 //
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 class EditPerson : public QDialog
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 {
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 Q_OBJECT
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 public:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 explicit EditPerson(QWidget *parent = 0);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 ~EditPerson();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 void statusMsg(const QString &msg);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 void clearForm();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 bool validateForm();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 void setPerson(qint64 id);
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 private slots:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 void on_button_OK_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 void on_button_Cancel_clicked();
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 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
210
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 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
212
121
404d567edaab Validate the length of extra info field in the add/edit person dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
213 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
214
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 private:
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 Ui::EditPerson *ui;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217
5
a5a3baee3043 More cleanups and fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
218 PersonInfo selPerson;
0
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 TransactionSQLModel *model_Transactions;
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 };
fec4d0c461f2 Initial import of the post-prototyping phase code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221
90
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 //
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
224 // About dialog
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
225 //
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
226 class AboutWindow : public QDialog
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
227 {
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
228 Q_OBJECT
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
229
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
230 public:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
231 explicit AboutWindow(QWidget *parent = 0);
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
232 ~AboutWindow();
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
233
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
234 private slots:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
235 void on_button_Close_clicked();
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
236
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
237 private:
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
238 Ui::AboutWindow *ui;
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
efab68769c75 Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
241
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
242 //
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
243 // 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
244 //
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
245 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
246 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
247 Q_OBJECT
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
248
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
249 public:
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
250 QPointF m_pos;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
251 QString m_str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
252 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
253
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
254 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
255 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
256 painter = pt;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
257 metrics = NULL;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
258 m_str = "ABC";
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
259 setPos(0, 0);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
260 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
261 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
262
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
263 ~SLDrawContext()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
264 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
265 if (metrics)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
266 delete metrics;
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
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
269 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
270 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
271 if (metrics)
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
272 delete metrics;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
273
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
274 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
275 painter->setFont(font);
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
276 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
277 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
278
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
279 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
280 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
281 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
282 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
283
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
284 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
285 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
286 m_str = str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
287 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
288 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
289
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
290 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
291 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
292 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
293 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
294
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
295 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
296 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
297 m_str = str;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
298 painter->drawText(
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
299 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
300 width, boundRect().height(),
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
301 flags,
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
302 str);
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
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
305 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
306 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
307 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
308 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
309
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
310 const QRectF boundRect()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
311 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
312 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
313 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
314
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
315 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
316 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
317 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
318 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
319
125
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
320 qreal lfq(qreal yadd)
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
321 {
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
322 return m_pos.y() + boundRect().height() + yadd;
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
323 }
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
324
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
325 void lf()
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
326 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
327 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
328 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
329
125
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
330 qreal lfq()
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
331 {
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
332 return m_pos.y() + boundRect().height() + m_lf_add;
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
333 }
6e2d26e7a0b4 Add few helpers.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
334
114
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
335 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
336 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
337 m_pos = pos;
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
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
340 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
341 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
342 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
343 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
344
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
345 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
346 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
347 m_pos += pos;
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 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
351 {
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
352 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
353 }
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
354
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
355 private:
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
356 QPainter *painter;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
357 QFont font;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
358 QFontMetricsF *metrics;
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
359 };
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
360
a5c8741b8662 Initial prototype support for printing list of users + print preview dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
361
41
c953ee761af0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
362 #endif // SYNTILISTA_H