"Fossies" - the Fresh Open Source Software Archive 
Member "cb2bib-2.0.1/src/c2bIdPatternLineEdit.cpp" (12 Feb 2021, 6000 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "c2bIdPatternLineEdit.cpp" see the
Fossies "Dox" file reference documentation.
1 /***************************************************************************
2 * Copyright (C) 2004-2021 by Pere Constans
3 * constans@molspaces.com
4 * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3.
5 * See the LICENSE file that comes with this distribution.
6 *
7 * Improvements and modifications:
8 * July 2009 - Added <<author_all_abbreviated>>, (C) 2009 by Dayu Huang
9 ***************************************************************************/
10 #include "c2bIdPatternLineEdit.h"
11
12 #include "c2bUtils.h"
13
14 #include <cb2bib_parameters.h>
15
16 #include <QAction>
17
18
19 c2bIdPatternLineEdit::c2bIdPatternLineEdit(QWidget* parentw) : c2bLineEdit(parentw)
20 {
21 a_author_all_abbreviated = new QAction(this);
22 a_author_all_initials = new QAction(this);
23 a_author_first = new QAction(this);
24 a_author_first_lowercase = new QAction(this);
25 a_citeid = new QAction(this);
26 a_journal_initials = new QAction(this);
27 a_pages_first = new QAction(this);
28 a_ppages_first = new QAction(this);
29 a_title = new QAction(this);
30 a_title_first_word = new QAction(this);
31 a_title_underscored = new QAction(this);
32 a_volume = new QAction(this);
33 a_year_abbreviated = new QAction(this);
34 a_year_full = new QAction(this);
35
36 a_reset = new QAction(this);
37
38 c2bUtils::addSeparator(this);
39 addAction(a_author_all_abbreviated);
40 addAction(a_author_all_initials);
41 addAction(a_author_first);
42 addAction(a_author_first_lowercase);
43 c2bUtils::addSeparator(this);
44 addAction(a_citeid);
45 c2bUtils::addSeparator(this);
46 addAction(a_journal_initials);
47 c2bUtils::addSeparator(this);
48 addAction(a_pages_first);
49 addAction(a_ppages_first);
50 c2bUtils::addSeparator(this);
51 addAction(a_title);
52 addAction(a_title_underscored);
53 addAction(a_title_first_word);
54 c2bUtils::addSeparator(this);
55 addAction(a_volume);
56 c2bUtils::addSeparator(this);
57 addAction(a_year_abbreviated);
58 addAction(a_year_full);
59 c2bUtils::addSeparator(this);
60 addAction(a_reset);
61
62 a_author_all_abbreviated->setText(tr("Insert <<author_all_abbreviated>>"));
63 a_author_all_initials->setText(tr("Insert <<author_all_initials>>"));
64 a_author_first->setText(tr("Insert <<author_first>>"));
65 a_author_first_lowercase->setText(tr("Insert <<author_first_lowercase>>"));
66 a_citeid->setText(tr("Insert <<citeid>>"));
67 a_journal_initials->setText(tr("Insert <<journal_initials>>"));
68 a_pages_first->setText(tr("Insert <<pages_first>>"));
69 a_ppages_first->setText(tr("Insert <<ppages_first>>"));
70 a_title->setText(tr("Insert <<title>>"));
71 a_title_first_word->setText(tr("Insert <<title_first_word>>"));
72 a_title_underscored->setText(tr("Insert <<title_underscored>>"));
73 a_volume->setText(tr("Insert <<volume>>"));
74 a_year_abbreviated->setText(tr("Insert <<year_abbreviated>>"));
75 a_year_full->setText(tr("Insert <<year_full>>"));
76
77 a_reset->setText(tr("Reset ID Pattern"));
78
79 connect(a_author_all_abbreviated, SIGNAL(triggered()), this, SLOT(author_all_abbreviated()));
80 connect(a_author_all_initials, SIGNAL(triggered()), this, SLOT(author_all_initials()));
81 connect(a_author_first, SIGNAL(triggered()), this, SLOT(author_first()));
82 connect(a_author_first_lowercase, SIGNAL(triggered()), this, SLOT(author_first_lowercase()));
83 connect(a_citeid, SIGNAL(triggered()), this, SLOT(citeid()));
84 connect(a_journal_initials, SIGNAL(triggered()), this, SLOT(journal_initials()));
85 connect(a_pages_first, SIGNAL(triggered()), this, SLOT(pages_first()));
86 connect(a_ppages_first, SIGNAL(triggered()), this, SLOT(ppages_first()));
87 connect(a_title, SIGNAL(triggered()), this, SLOT(title()));
88 connect(a_title_first_word, SIGNAL(triggered()), this, SLOT(title_first_word()));
89 connect(a_title_underscored, SIGNAL(triggered()), this, SLOT(title_underscored()));
90 connect(a_volume, SIGNAL(triggered()), this, SLOT(volume()));
91 connect(a_year_abbreviated, SIGNAL(triggered()), this, SLOT(year_abbreviated()));
92 connect(a_year_full, SIGNAL(triggered()), this, SLOT(year_full()));
93
94 connect(a_reset, SIGNAL(triggered()), this, SLOT(reset()));
95
96 // Hide citeid as default: CiteID line edit
97 a_citeid->setVisible(false);
98 setPlaceholderText(C2B_CITE_ID_PATTERN);
99 }
100
101 c2bIdPatternLineEdit::~c2bIdPatternLineEdit() {}
102
103
104 void c2bIdPatternLineEdit::setDocumentIDEdit()
105 {
106 a_citeid->setVisible(true);
107 setPlaceholderText(C2B_DOCUMENT_ID_PATTERN);
108 }
109
110 void c2bIdPatternLineEdit::author_all_abbreviated()
111 {
112 insert(QLatin1String("<<author_all_abbreviated>>"));
113 }
114
115 void c2bIdPatternLineEdit::author_all_initials()
116 {
117 insert(QLatin1String("<<author_all_initials>>"));
118 }
119
120 void c2bIdPatternLineEdit::author_first()
121 {
122 insert(QLatin1String("<<author_first>>"));
123 }
124
125 void c2bIdPatternLineEdit::author_first_lowercase()
126 {
127 insert(QLatin1String("<<author_first_lowercase>>"));
128 }
129
130 void c2bIdPatternLineEdit::citeid()
131 {
132 insert(QLatin1String("<<citeid>>"));
133 }
134
135 void c2bIdPatternLineEdit::journal_initials()
136 {
137 insert(QLatin1String("<<journal_initials>>"));
138 }
139
140 void c2bIdPatternLineEdit::pages_first()
141 {
142 insert(QLatin1String("<<pages_first>>"));
143 }
144
145 void c2bIdPatternLineEdit::ppages_first()
146 {
147 insert(QLatin1String("<<ppages_first>>"));
148 }
149
150 void c2bIdPatternLineEdit::title()
151 {
152 insert(QLatin1String("<<title_25>>"));
153 }
154
155 void c2bIdPatternLineEdit::title_underscored()
156 {
157 insert(QLatin1String("<<title_underscored_25>>"));
158 }
159
160 void c2bIdPatternLineEdit::title_first_word()
161 {
162 insert(QLatin1String("<<title_first_word>>"));
163 }
164
165 void c2bIdPatternLineEdit::volume()
166 {
167 insert(QLatin1String("<<volume>>"));
168 }
169
170 void c2bIdPatternLineEdit::year_abbreviated()
171 {
172 insert(QLatin1String("<<year_abbreviated>>"));
173 }
174
175 void c2bIdPatternLineEdit::year_full()
176 {
177 insert(QLatin1String("<<year_full>>"));
178 }
179
180 void c2bIdPatternLineEdit::reset()
181 {
182 if (a_citeid->isVisible())
183 setText(C2B_DOCUMENT_ID_PATTERN);
184 else
185 setText(C2B_CITE_ID_PATTERN);
186 }