Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-visualization/zhu3d/files/, sci-visualization/zhu3d/
Date: Tue, 09 Jan 2018 01:36:08
Message-Id: 1515458326.d00e8fb937c0b220c170d3b78b4926ee933aa3e1.asturm@gentoo
1 commit: d00e8fb937c0b220c170d3b78b4926ee933aa3e1
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 9 00:29:19 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 9 00:38:46 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d00e8fb9
7
8 sci-visualization/zhu3d: Port to Qt5, EAPI 6, qmake-utils
9
10 Bug: https://bugs.gentoo.org/643970
11 Package-Manager: Portage-2.3.19, Repoman-2.3.6
12
13 .../zhu3d/files/zhu3d-4.2.6-qt5.patch | 205 +++++++++++++++++++++
14 sci-visualization/zhu3d/zhu3d-4.2.6-r1.ebuild | 84 +++++++++
15 2 files changed, 289 insertions(+)
16
17 diff --git a/sci-visualization/zhu3d/files/zhu3d-4.2.6-qt5.patch b/sci-visualization/zhu3d/files/zhu3d-4.2.6-qt5.patch
18 new file mode 100644
19 index 00000000000..e1d956c8c07
20 --- /dev/null
21 +++ b/sci-visualization/zhu3d/files/zhu3d-4.2.6-qt5.patch
22 @@ -0,0 +1,205 @@
23 +From 4557d1111c030d9fa4449500b5624024abe9fc8a Mon Sep 17 00:00:00 2001
24 +From: Andreas Sturmlechner <andreas.sturmlechner@×××××.com>
25 +Date: Tue, 9 Jan 2018 01:01:01 +0100
26 +Subject: [PATCH 1/2] Initial port to Qt5
27 +
28 +---
29 + src/legedit.cpp | 14 +++++++-------
30 + src/mainwindow.cpp | 2 +-
31 + src/property.cpp | 4 ++--
32 + src/usredit.cpp | 2 +-
33 + zhu3d.pro | 3 +--
34 + 5 files changed, 12 insertions(+), 13 deletions(-)
35 +
36 +diff --git a/src/legedit.cpp b/src/legedit.cpp
37 +index b0f5b28..9ce44b0 100644
38 +--- a/src/legedit.cpp
39 ++++ b/src/legedit.cpp
40 +@@ -89,13 +89,13 @@ void legWidget::createAxesTable() {
41 + axesTable->setColumnCount(7);
42 +
43 + axesTable->setHorizontalHeaderLabels(columnLabels);
44 +- axesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Interactive);
45 +- axesTable->horizontalHeader()->setResizeMode(1, QHeaderView::Interactive);
46 +- axesTable->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
47 +- axesTable->horizontalHeader()->setResizeMode(3, QHeaderView::Fixed);
48 +- axesTable->horizontalHeader()->setResizeMode(4, QHeaderView::Fixed);
49 +- axesTable->horizontalHeader()->setResizeMode(5, QHeaderView::Fixed);
50 +- axesTable->horizontalHeader()->setResizeMode(6, QHeaderView::Fixed);
51 ++ axesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
52 ++ axesTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
53 ++ axesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
54 ++ axesTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed);
55 ++ axesTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Fixed);
56 ++ axesTable->horizontalHeader()->setSectionResizeMode(5, QHeaderView::Fixed);
57 ++ axesTable->horizontalHeader()->setSectionResizeMode(6, QHeaderView::Fixed);
58 + axesTable->verticalHeader()->show();
59 + axesTable->setShowGrid(true);
60 +
61 +diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
62 +index 970f1bf..48d23af 100644
63 +--- a/src/mainwindow.cpp
64 ++++ b/src/mainwindow.cpp
65 +@@ -1804,7 +1804,7 @@ void MaiWindow::benchmarkSlot() {
66 + QMessageBox::information(
67 + this,
68 + tr("Benchmark"),
69 +- result.toAscii().data()
70 ++ result.toLatin1().data()
71 + );
72 +
73 + /** Restore and perform updates */
74 +diff --git a/src/property.cpp b/src/property.cpp
75 +index eff4442..99216d7 100644
76 +--- a/src/property.cpp
77 ++++ b/src/property.cpp
78 +@@ -138,11 +138,11 @@ void iniITL() {
79 + ** Copy a QString to a plain old character-string
80 + ****************************************************************************/
81 + void q2cstrcpy(char *str, const QString qstr) {
82 +- strcpy(str, qstr.toAscii().data());
83 ++ strcpy(str, qstr.toLatin1().data());
84 + }
85 +
86 + char *q2cstrcpy(const QString qstr) {
87 +- return qstr.toAscii().data();
88 ++ return qstr.toLatin1().data();
89 + }
90 +
91 +
92 +diff --git a/src/usredit.cpp b/src/usredit.cpp
93 +index 18b58d5..6088906 100644
94 +--- a/src/usredit.cpp
95 ++++ b/src/usredit.cpp
96 +@@ -128,7 +128,7 @@ void usrWidget::createUsrTable() {
97 + QStringList columnLabel(tr("Item"));
98 +
99 + usrTable->setHorizontalHeaderLabels(columnLabel);
100 +- usrTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
101 ++ usrTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
102 + usrTable->verticalHeader()->show();
103 + usrTable->setShowGrid(true);
104 +
105 +diff --git a/zhu3d.pro b/zhu3d.pro
106 +index efa3d53..cae8b78 100644
107 +--- a/zhu3d.pro
108 ++++ b/zhu3d.pro
109 +@@ -47,8 +47,7 @@
110 + TEMPLATE = app
111 + CONFIG += release
112 + TARGET = zhu3d
113 +-QT += opengl
114 +-
115 ++QT += opengl printsupport widgets
116 +
117 + # ============================================================================
118 + # Workaround for Qt4-4.8.4 and missing reference to 'gluPerspective'
119 +--
120 +2.15.1
121 +
122 +
123 +From fac5c787ef8e82d92c75c91554508211e1320418 Mon Sep 17 00:00:00 2001
124 +From: Andreas Sturmlechner <andreas.sturmlechner@×××××.com>
125 +Date: Tue, 9 Jan 2018 01:20:55 +0100
126 +Subject: [PATCH 2/2] Drop PostScript option, unsupported by Qt5PrintSupport
127 +
128 +---
129 + src/glwidget.cpp | 35 -----------------------------------
130 + src/picedit.cpp | 6 ------
131 + src/ui/picedit.ui | 10 ----------
132 + 3 files changed, 51 deletions(-)
133 +
134 +diff --git a/src/glwidget.cpp b/src/glwidget.cpp
135 +index 1719ec0..6343f1e 100644
136 +--- a/src/glwidget.cpp
137 ++++ b/src/glwidget.cpp
138 +@@ -910,41 +910,6 @@ void OGLWidget::savePic() {
139 + QApplication::restoreOverrideCursor();
140 + break;
141 + }
142 +-
143 +- case PS: {
144 +- fileName=QFileDialog::getSaveFileName(
145 +- this,
146 +- tr("Save as *.ps"),
147 +- workDir,
148 +- "Images (*.ps)");
149 +-
150 +- if(fileName.isEmpty())
151 +- return;
152 +-
153 +- /** Complete filename */
154 +- if(!fileName.toUpper().endsWith(".PS"))
155 +- fileName+=".ps";
156 +-
157 +- /** Set up printer */
158 +- QApplication::setOverrideCursor(Qt::WaitCursor);
159 +- QPrinter printer(QPrinter::HighResolution);
160 +- printer.setOutputFormat(QPrinter::PostScriptFormat);
161 +- printer.setResolution(pic.dpi);
162 +- printer.setOutputFileName(fileName); // Enables toFile automatically
163 +- printer.setFullPage(true);
164 +-
165 +- /** "Print" over painter */
166 +- QImage image=pixmap.toImage();
167 +- QPainter painter(&printer);
168 +- QRect rect=painter.viewport();
169 +- QSize size=image.size();
170 +- size.scale(rect.size(), Qt::KeepAspectRatio);
171 +- painter.setViewport(0, 0, size.width(), size.height());
172 +- painter.setWindow(image.rect());
173 +- painter.drawImage(0, 0, image);
174 +- QApplication::restoreOverrideCursor();
175 +- break;
176 +- }
177 + }
178 + }
179 +
180 +diff --git a/src/picedit.cpp b/src/picedit.cpp
181 +index 149c9d3..74383a7 100644
182 +--- a/src/picedit.cpp
183 ++++ b/src/picedit.cpp
184 +@@ -49,7 +49,6 @@ picWidget::picWidget(QWidget *parent) : QWidget(parent) {
185 + connect(pngFmt, SIGNAL(clicked()), this, SLOT(pngSlot()));
186 + connect(jpgFmt, SIGNAL(clicked()), this, SLOT(jpgSlot()));
187 + connect(pdfFmt, SIGNAL(clicked()), this, SLOT(pdfSlot()));
188 +- connect(psFmt, SIGNAL(clicked()), this, SLOT(psSlot()));
189 + }
190 +
191 +
192 +@@ -71,11 +70,6 @@ void picWidget::switchBox() {
193 + qual->setEnabled(false);
194 + dpi->setEnabled(false);
195 + break;
196 +- case PS:
197 +- psFmt->setChecked(true);
198 +- qual->setEnabled(false);
199 +- dpi->setEnabled(true);
200 +- break;
201 + }
202 + }
203 +
204 +diff --git a/src/ui/picedit.ui b/src/ui/picedit.ui
205 +index 12e6148..9a498f2 100644
206 +--- a/src/ui/picedit.ui
207 ++++ b/src/ui/picedit.ui
208 +@@ -263,16 +263,6 @@
209 + </property>
210 + </widget>
211 + </item>
212 +- <item>
213 +- <widget class="QRadioButton" name="psFmt" >
214 +- <property name="toolTip" >
215 +- <string>PostScript</string>
216 +- </property>
217 +- <property name="text" >
218 +- <string>PS</string>
219 +- </property>
220 +- </widget>
221 +- </item>
222 + </layout>
223 + </item>
224 + <item row="0" column="0" >
225 +--
226 +2.15.1
227 +
228
229 diff --git a/sci-visualization/zhu3d/zhu3d-4.2.6-r1.ebuild b/sci-visualization/zhu3d/zhu3d-4.2.6-r1.ebuild
230 new file mode 100644
231 index 00000000000..bbd09ac9b8e
232 --- /dev/null
233 +++ b/sci-visualization/zhu3d/zhu3d-4.2.6-r1.ebuild
234 @@ -0,0 +1,84 @@
235 +# Copyright 1999-2018 Gentoo Foundation
236 +# Distributed under the terms of the GNU General Public License v2
237 +
238 +EAPI=6
239 +
240 +inherit desktop qmake-utils
241 +
242 +DESCRIPTION="Interactive 3D mathematical function viewer"
243 +HOMEPAGE="https://sourceforge.net/projects/zhu3d"
244 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
245 +
246 +LICENSE="GPL-3"
247 +SLOT="0"
248 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
249 +IUSE=""
250 +
251 +DEPEND="
252 + dev-qt/qtcore:5
253 + dev-qt/qtgui:5
254 + dev-qt/qtopengl:5
255 + dev-qt/qtprintsupport:5
256 + dev-qt/qtwidgets:5
257 + virtual/glu
258 + virtual/opengl
259 +"
260 +RDEPEND="${DEPEND}"
261 +
262 +DOCS=( {readme,src/changelog}.txt )
263 +HTML_DOCS=( doc/. )
264 +
265 +PATCHES=( "${FILESDIR}"/${P}-qt5.patch )
266 +
267 +src_prepare() {
268 + default
269 +
270 + local datadir=/usr/share/${PN}
271 + sed \
272 + -e "s:^SYSDIR=:SYSDIR=${datadir}/system:" \
273 + -e "s:^TEXDIR=:TEXDIR=${datadir}/textures:" \
274 + -e "s:^WORKDIR=:WORKDIR=${datadir}/work:" \
275 + -e "s:^DOCDIR=:DOCDIR=/usr/share/doc/${PF}/html:" \
276 + -i ${PN}.pri || die "sed zhu3d.pri failed"
277 +
278 + sed \
279 + -e "/# Optimisation/,/# Include/d" \
280 + -i ${PN}.pro || die "optimisation sed failed"
281 +}
282 +
283 +src_configure() {
284 + eqmake5 zhu3d.pro
285 +}
286 +
287 +src_install() {
288 + # not working: emake install INSTALL_ROOT="${D}" || die
289 + dobin zhu3d
290 +
291 + einstalldocs
292 +
293 + local lang
294 + for lang in ${LANGS} ; do
295 + if use linguas_${lang} ; then
296 +
297 + insinto /usr/share/${PN}/system/languages
298 + doins system/languages/${PN}_${lang}.qm
299 +
300 + if [ -e doc/${PN}_${lang}.html ] ; then
301 + dohtml doc/${PN}_${lang}.html
302 + fi
303 + fi
304 + done
305 +
306 + insinto /usr/share/${PN}
307 + doins -r work/textures
308 +
309 + insinto /usr/share/${PN}/work
310 + doins -r work/*.zhu work/slideshow
311 +
312 + insinto /usr/share/${PN}/system
313 + doins -r system/*.zhu system/icons
314 +
315 + doicon system/icons/${PN}.png
316 + make_desktop_entry ${PN} "Zhu3D Function Viewer" \
317 + ${PN} "Education;Science;Math;Qt"
318 +}