annotate src/gui/widgets/text.cc @ 258:862d0d8619f6

*: HUUUGE changes animia has been renamed to animone, so instead of thinking of a health condition, you think of a beautiful flower :) I've also edited some of the code for animone, but I have no idea if it even works or not because I don't have a mac or windows machine lying around. whoops! ... anyway, all of the changes divergent from Anisthesia are now licensed under BSD. it's possible that I could even rewrite most of the code to where I don't even have to keep the MIT license, but that's thinking too far into the future I've been slacking off on implementing the anime seasons page, mostly out of laziness. I think I'd have to create another db file specifically for the seasons anyway, this code is being pushed *primarily* because the hard drive it's on is failing! yay :)
author Paper <paper@paper.us.eu.org>
date Mon, 01 Apr 2024 02:43:44 -0400
parents b3549da699a6
children 9a88e1725fd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "gui/widgets/text.h"
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/session.h"
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
3
77
6f7385bd334c *: update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
4 #include <QDebug>
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <QFrame>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <QLabel>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include <QTextBlock>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 #include <QVBoxLayout>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 namespace TextWidgets {
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
12 Header::Header(const QString& title, QWidget* parent) : QWidget(parent) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
13 QVBoxLayout* layout = new QVBoxLayout(this);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 static_text_title = new QLabel(title, this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 static_text_title->setTextFormat(Qt::PlainText);
183
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
18
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
19 {
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
20 QFont font = static_text_title->font();
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
21 font.setWeight(QFont::Bold);
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
22 static_text_title->setFont(font);
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
23 }
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 static_text_line = new QFrame(this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 static_text_line->setFrameShape(QFrame::HLine);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 static_text_line->setFrameShadow(QFrame::Sunken);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 static_text_line->setFixedHeight(2);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
30 layout->addWidget(static_text_title);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
31 layout->addWidget(static_text_line);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
32 layout->setSpacing(0);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
33 layout->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
36 void Header::SetText(const QString& text) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
37 static_text_title->setText(text);
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
38 updateGeometry();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
41 /* for now, this is a QLabel with a couple of default settings.
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
42 *
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
43 * eventually I'll have to implement this as a QScrollArea, just in case
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
44 * some random text decides to overflow or something.
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
45 */
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
46 Paragraph::Paragraph(const QString& text, QWidget* parent) : QLabel(text, parent) {
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
47 setTextInteractionFlags(Qt::TextBrowserInteraction);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
48 setFrameShape(QFrame::NoFrame);
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
49 setCursor(Qt::IBeamCursor); /* emulate Taiga */
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
50 setWordWrap(true);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
51
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
52 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
53 }
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
54
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
55 /* kept here for legacy reasons, see explanation above */
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
56 void Paragraph::SetText(const QString& text) {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
57 setText(text);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
58 }
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
59
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
60 /* Equivalent to Paragraph(), but disables word wrap. */
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
61 Line::Line(QWidget* parent) : Paragraph("", parent) {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
62 setWordWrap(false);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
63 }
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
64
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
65 Line::Line(const QString& text, QWidget* parent) : Paragraph(text, parent) {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
66 setWordWrap(false);
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
67 }
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
68
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
69 /* legacy function, don't use in new code */
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
70 void Line::SetText(const QString& text) {
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
71 setText(text);
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
72 }
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
73
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
74 Title::Title(const QString& title, QWidget* parent) : Line(title, parent) {
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
75 QFont fnt(font());
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
76 fnt.setPixelSize(16);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
77 setFont(fnt);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
78
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
79 QPalette pal(palette());
105
6d8da6e64d61 theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents: 102
diff changeset
80 pal.setColor(QPalette::Text, pal.color(QPalette::Highlight));
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
81 setPalette(pal);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
82 }
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
83
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
84 Section::Section(const QString& title, const QString& data, QWidget* parent) : QWidget(parent) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
85 QVBoxLayout* layout = new QVBoxLayout(this);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87 header = new Header(title, this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89 QWidget* content = new QWidget(this);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
90 QHBoxLayout* content_layout = new QHBoxLayout(content);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 paragraph = new Paragraph(data, this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
95 paragraph->setWordWrap(QTextOption::NoWrap);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
97 content_layout->addWidget(paragraph);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
98 content_layout->setSpacing(0);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
99 content_layout->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 content->setContentsMargins(12, 0, 0, 0);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
102 layout->addWidget(header);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
103 layout->addWidget(paragraph);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
104 layout->setSpacing(0);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
105 layout->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
108 Header* Section::GetHeader() {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 return header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
112 Paragraph* Section::GetParagraph() {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 return paragraph;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
116 LabelledParagraph::LabelledParagraph(const QString& label, const QString& data, QWidget* parent) : QWidget(parent) {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
117 QHBoxLayout* ly = new QHBoxLayout(this);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
118
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
119 labels = new Paragraph(label, this);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
120 labels->setTextInteractionFlags(Qt::NoTextInteraction);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
121 labels->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
122 labels->setWordWrap(QTextOption::NoWrap);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
123 labels->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
124
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
125 paragraph = new Paragraph(data, this);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
126 paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
127 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
128 paragraph->setWordWrap(QTextOption::NoWrap);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
129 paragraph->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
130
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
131 ly->addWidget(labels, 0, Qt::AlignTop);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
132 ly->addWidget(paragraph, 0, Qt::AlignTop);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
133 ly->setSpacing(20);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
134 ly->setContentsMargins(0, 0, 0, 0);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
135 }
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
136
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
137 Paragraph* LabelledParagraph::GetLabels() {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
138 return labels;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
139 }
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
140
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
141 Paragraph* LabelledParagraph::GetParagraph() {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
142 return paragraph;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
143 }
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
144
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
145 LabelledSection::LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent)
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
146 : QWidget(parent) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
147 QVBoxLayout* layout = new QVBoxLayout(this);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149 header = new Header(title, this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151 // this is not accessible from the object because there's really
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 // no reason to make it accessible...
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
153 content = new LabelledParagraph(label, data, this);
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
154 content->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155 content->setContentsMargins(12, 0, 0, 0);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
157 layout->addWidget(header);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
158 layout->addWidget(content);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
159 layout->setSpacing(0);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
160 layout->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
163 Header* LabelledSection::GetHeader() {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164 return header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
167 Paragraph* LabelledSection::GetLabels() {
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
168 return content->GetLabels();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
171 Paragraph* LabelledSection::GetParagraph() {
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
172 return content->GetParagraph();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
174
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
175 SelectableSection::SelectableSection(const QString& title, const QString& data, QWidget* parent) : QWidget(parent) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
176 QVBoxLayout* layout = new QVBoxLayout(this);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
177
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
178 header = new Header(title, this);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180 QWidget* content = new QWidget(this);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
181 QHBoxLayout* content_layout = new QHBoxLayout(content);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
182
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
183 paragraph = new Paragraph(data, content);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
184
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
185 content_layout->addWidget(paragraph);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
186 content_layout->setSpacing(0);
102
b315f3759c56 *: big patch
Paper <mrpapersonic@gmail.com>
parents: 97
diff changeset
187 content_layout->setContentsMargins(12, 0, 0, 0);
b315f3759c56 *: big patch
Paper <mrpapersonic@gmail.com>
parents: 97
diff changeset
188 content->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
189
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
190 layout->addWidget(header);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
191 layout->addWidget(content);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
192 layout->setSpacing(0);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
193 layout->setContentsMargins(0, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
194 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
195
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
196 Header* SelectableSection::GetHeader() {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
197 return header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
198 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
199
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
200 Paragraph* SelectableSection::GetParagraph() {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
201 return paragraph;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
202 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
203
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
204 OneLineSection::OneLineSection(const QString& title, const QString& text, QWidget* parent) : QWidget(parent) {
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
205 QVBoxLayout* layout = new QVBoxLayout(this);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
206
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
207 header = new Header(title, this);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
208
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
209 QWidget* content = new QWidget(this);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
210 QHBoxLayout* content_layout = new QHBoxLayout(content);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
211
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
212 line = new Line(text, content);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
213
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
214 content_layout->addWidget(line);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
215 content_layout->setSpacing(0);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
216 content_layout->setContentsMargins(0, 0, 0, 0);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
217 content->setContentsMargins(12, 0, 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
218
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
219 layout->addWidget(header);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
220 layout->addWidget(content);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
221 layout->setSpacing(0);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
222 layout->setContentsMargins(0, 0, 0, 0);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
223 }
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
224
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
225 Header* OneLineSection::GetHeader() {
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
226 return header;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
227 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
228
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
229 Line* OneLineSection::GetLine() {
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
230 return line;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
231 }
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
232
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
233 } // namespace TextWidgets