- Migrate to qt4

PR:		ports/154148
Submitted by:	G. Paul Ziemba <p-fbsd-bugs@ziemba.us>
Feature safe:	yes
This commit is contained in:
Pav Lucistnik 2011-01-20 12:26:11 +00:00
parent 715c27998b
commit 20eb7a844c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=268034
16 changed files with 356 additions and 60 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= xglobe
PORTVERSION= 0.5
PORTREVISION= 9
PORTREVISION= 10
CATEGORIES= astro
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR=kris
@ -15,14 +15,15 @@ MASTER_SITE_SUBDIR=kris
MAINTAINER= ports@FreeBSD.org
COMMENT= Displays a view of the Earth (like xearth) with a rendered photo map
USE_QT_VER= 3
USE_QT_VER= 4
QT_COMPONENTS= corelib gui qt3support moc_build
USE_GMAKE= yes
MAKE_ENV= PTHREAD_LIBS=${PTHREAD_LIBS}
MAKE_ENV= PTHREAD_LIBS=${PTHREAD_LIBS} QT_PREFIX=${QT_PREFIX}
do-install:
@${MKDIR} ${PREFIX}/share/xglobe/
@${MKDIR} ${DATADIR}
@${INSTALL_PROGRAM} ${WRKSRC}/xglobe ${PREFIX}/bin/
@${INSTALL_DATA} ${WRKSRC}/map.bmp ${PREFIX}/share/xglobe/
@${INSTALL_DATA} ${WRKSRC}/xglobe-markers ${PREFIX}/share/xglobe/
@${INSTALL_DATA} ${WRKSRC}/map.bmp ${DATADIR}
@${INSTALL_DATA} ${WRKSRC}/xglobe-markers ${DATADIR}
.include <bsd.port.mk>

View file

@ -1,3 +1,2 @@
MD5 (xglobe-0.5.tar.gz) = 87caf7803f1d71a0b024188e3a2c759c
SHA256 (xglobe-0.5.tar.gz) = 45518dc6a9122f3cf09c0a2d78ffe00a17290072eb825246840dc6543e1cf4d3
SIZE (xglobe-0.5.tar.gz) = 982309

View file

@ -1,6 +1,6 @@
--- Makefile.orig Mon Jul 19 14:56:27 1999
+++ Makefile Sat Jan 25 14:51:03 2003
@@ -4,29 +4,30 @@
--- Makefile.orig 1999-07-19 05:56:27.000000000 -0700
+++ Makefile 2011-01-19 09:39:21.000000000 -0800
@@ -4,43 +4,44 @@
####### Installation directory
@ -15,11 +15,11 @@
-X11_INCLUDE_DIR = /usr/X11R6/include
-QT_INCLUDE_DIR = $(QTDIR)/include
+X11_INCLUDE_DIR = $(LOCALBASE)/include
+QT_INCLUDE_DIR = $(QT_PREFIX)/include/
+QT_INCLUDE_DIR = $(QT_PREFIX)/include/qt4
-QT_LIB_DIR = $(QTDIR)/lib
-X11_LIB_DIR = /usr/X11R6/lib
+QT_LIB_DIR = $(QT_PREFIX)/lib
+QT_LIB_DIR = $(QT_PREFIX)/lib/qt4
+X11_LIB_DIR = $(LOCALBASE)/lib
@ -27,25 +27,27 @@
-CPP = g++
-LINK = g++
-MOC = moc
+CXX ?= c++
+CPP = ${CXX}
+LINK = ${CXX}
MOC = moc
+MOC = moc-qt4
INSTALL = install
####### compile and link options
-CFLAGS = $(INCLUDE_DIRS) -DXGLOBE_LIB_DIR=\"$(XGLOBE_LIB_DIR)\" $(WITH_QIMGIO) -O2 -Wall
+CFLAGS += $(INCLUDE_DIRS) -DXGLOBE_LIB_DIR=\"$(XGLOBE_LIB_DIR)\" $(WITH_QIMGIO)
+CFLAGS += -DQT3_SUPPORT $(INCLUDE_DIRS) -DXGLOBE_LIB_DIR=\"$(XGLOBE_LIB_DIR)\" $(WITH_QIMGIO)
LFLAGS =
@@ -34,13 +35,13 @@
-INCLUDE_DIRS = -I$(QT_INCLUDE_DIR) -I$(X11_INCLUDE_DIR)
+INCLUDE_DIRS = -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/Qt -I$(QT_INCLUDE_DIR)/QtGui -I$(X11_INCLUDE_DIR)
LIB_DIRS = -L$(QT_LIB_DIR) -L$(X11_LIB_DIR)
-LIBS = -lX11 -lqt -lm
+LIBS = -lX11 -lqt-mt -lm ${PTHREAD_LIBS}
+LIBS = -lX11 -lQt3Support -lQtGui -lm ${PTHREAD_LIBS}
# If you want to use the QImageIO lib (to support jpg and png maps) use the
# next two lines and comment the one above
#WITH_QIMGIO = -DWITH_QIMAGEIO

View file

@ -1,10 +1,36 @@
--- desktopwidget.cpp.orig Sun Jan 26 09:35:35 2003
+++ desktopwidget.cpp Sun Jan 26 09:38:52 2003
@@ -18,6 +18,7 @@
--- desktopwidget.cpp.orig 1998-12-09 10:15:52.000000000 -0800
+++ desktopwidget.cpp 2011-01-18 22:40:26.000000000 -0800
@@ -18,10 +18,14 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include "desktopwidget.h"
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QPixmap>
DesktopWidget::DesktopWidget(QWidget *parent, const char *name)
- : QWidget( parent, name, WType_Desktop | WPaintDesktop)
+ : QWidget( parent, name, Qt::WType_Desktop | Qt::WPaintDesktop)
{
haveImage = FALSE;
currentImage = new QPixmap(width(), height());
@@ -43,6 +47,7 @@
{
QPainter p(this);
+ printf("DesktopWidget::paintEvent\n");
if(!haveImage)
{
p.setFont(QFont("helvetica", 35));
@@ -62,7 +67,8 @@
void DesktopWidget::updateDisplay(QImage *image)
{
- ASSERT(image != NULL);
+ fprintf(stderr, "updateDisplay called\n");
+ Q_ASSERT(image != NULL);
currentImage->convertFromImage(*image);
haveImage = TRUE;
setBackgroundPixmap(*currentImage);

View file

@ -0,0 +1,11 @@
--- desktopwidget.h.orig 1998-12-09 10:16:54.000000000 -0800
+++ desktopwidget.h 2011-01-18 14:22:52.000000000 -0800
@@ -23,6 +23,8 @@
#include <qwidget.h>
#include <qpixmap.h>
#include <qpainter.h>
+//Added by qt3to4:
+#include <QPaintEvent>
class DesktopWidget : public QWidget
{

View file

@ -0,0 +1,77 @@
--- earthapp.cpp.orig 1999-12-06 08:14:10.000000000 -0800
+++ earthapp.cpp 2011-01-19 09:28:15.000000000 -0800
@@ -69,6 +69,12 @@
#include "config.h"
#include "earthapp.h"
#include "moonpos.h"
+//Added by qt3to4:
+#include <QPixmap>
+#include <QPalette>
+#include <QX11Info>
+
+#include <X11/Xlib.h>
/* ------------------------------------------------------------------------*/
@@ -334,7 +340,7 @@
if(use_kde)
{
dwidget = new DesktopWidget();
- ASSERT(dwidget != NULL);
+ Q_ASSERT(dwidget != NULL);
dwidget->update();
}
}
@@ -343,9 +349,9 @@
EarthApplication::~EarthApplication(void)
{
- ASSERT(r != NULL);
+ Q_ASSERT(r != NULL);
delete r;
- ASSERT(timer != NULL);
+ Q_ASSERT(timer != NULL);
timer->stop();
delete timer;
@@ -937,8 +943,8 @@
void EarthApplication::randomPosition()
{
- view_lat = ((rand()%30001)/30000.)*180. - 90.;
- view_long = ((rand()%30001)/30000.)*360. - 180.;
+ view_lat = ((random()%30001)/30000.)*180. - 90.;
+ view_long = ((random()%30001)/30000.)*360. - 180.;
}
/* ------------------------------------------------------------------------*/
@@ -1233,7 +1239,7 @@
r->setRotation(rotation);
timer = new QTimer(this);
- ASSERT(timer != NULL);
+ Q_ASSERT(timer != NULL);
connect(timer, SIGNAL(timeout()), this, SLOT(recalc()));
QTimer::singleShot(1, this, SLOT(recalc())); // this will start rendering
@@ -1307,7 +1313,19 @@
{
QPixmap pm;
pm.convertFromImage(*(r->getImage()));
- desktop()->setBackgroundPixmap(pm);
+
+
+ QPalette palette;
+ palette.setBrush(desktop()->backgroundRole(), QBrush(pm));
+ desktop()->setPalette(palette);
+
+ //
+ // With Qt4, this step seems to be necessary to make the
+ // changes appear immediately. Is there a way to do it via
+ // Qt4 methods?
+ //
+ XClearWindow(QX11Info::display(), QX11Info::appRootWindow());
+
if(once)
{
processEvents();

View file

@ -0,0 +1,11 @@
--- earthapp.h.orig 1999-12-06 08:14:23.000000000 -0800
+++ earthapp.h 2011-01-18 14:22:52.000000000 -0800
@@ -54,6 +54,8 @@
#define _EARTHAPP_H
#include <qapplication.h>
+#include <QApplication>
+#include <QDesktopWidget>
#include <qtimer.h>
#include <qsize.h>
#include <qstring.h>

View file

@ -0,0 +1,19 @@
--- main.cpp.orig 1999-07-13 10:32:55.000000000 -0700
+++ main.cpp 2011-01-18 14:22:52.000000000 -0800
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <qstring.h>
#include "config.h"
@@ -37,6 +38,8 @@
{
EarthApplication myApp(argc, argv);
+ srandomdev();
+
#ifdef WITH_QIMAGEIO
qInitImageIO();
#endif

View file

@ -0,0 +1,9 @@
--- marker.xpm.orig 1998-11-20 09:16:30.000000000 -0800
+++ marker.xpm 2011-01-19 09:32:52.000000000 -0800
@@ -1,5 +1,5 @@
/* XPM */
-static char * marker_xpm[] = {
+static const char * marker_xpm[] = {
"7 7 3 1",
" c None",
". c #000000",

View file

@ -0,0 +1,25 @@
--- markerlist.cpp.orig 1999-07-13 11:13:41.000000000 -0700
+++ markerlist.cpp 2011-01-18 14:22:52.000000000 -0800
@@ -28,7 +28,7 @@
#include "markerlist.h"
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
/* ------------------------------------------------------------------------ */
@@ -94,11 +94,11 @@
int pos1;
int pos2;
QFile f(filename);
- QTextStream t(&f);
+ Q3TextStream t(&f);
QString line;
QColor color;
- if(!f.open(IO_ReadOnly))
+ if(!f.open(QIODevice::ReadOnly))
return FALSE;
while(!t.eof())

View file

@ -0,0 +1,36 @@
--- markerlist.h.orig 1999-07-13 11:14:07.000000000 -0700
+++ markerlist.h 2011-01-18 14:22:52.000000000 -0800
@@ -56,21 +56,23 @@
class MarkerList
{
public:
- MarkerList() { list.setAutoDelete(TRUE); }
- ~MarkerList() { list.clear(); }
- inline void append(const Location *l) { list.append(l); }
- inline Location *first() { return list.first(); }
- inline Location *last() { return list.last(); }
- inline Location *next() { return list.next(); }
- inline Location *prev() { return list.prev(); }
- inline Location *current() { return list.current(); }
+ MarkerList() { }
+ ~MarkerList() { qDeleteAll(list); list.clear(); }
+ inline void append(Location *l) { list.append(l); }
+// inline Location *first() { return list.first(); }
+// inline Location *last() { return list.last(); }
+// inline Location *next() { return list.next(); }
+// inline Location *prev() { return list.prev(); }
+// inline Location *current() { return list.current(); }
+ inline Location *atindex(int i) {return list[i]; } // Q&D
inline uint count() { return list.count(); }
- inline void clear() { list.clear(); }
+ inline void clear() { qDeleteAll(list); list.clear(); }
+ inline int size() { return list.size(); }
bool loadMarkerFile(const char *filename);
protected:
- QList<Location> list;
+ QList<Location *> list;
};
#endif

View file

@ -1,32 +0,0 @@
--- earthapp.cpp.orig Sat Feb 24 10:13:10 2001
+++ earthapp.cpp Sat Feb 24 10:13:29 2001
@@ -937,8 +937,8 @@
void EarthApplication::randomPosition()
{
- view_lat = ((rand()%30001)/30000.)*180. - 90.;
- view_long = ((rand()%30001)/30000.)*360. - 180.;
+ view_lat = ((random()%30001)/30000.)*180. - 90.;
+ view_long = ((random()%30001)/30000.)*360. - 180.;
}
/* ------------------------------------------------------------------------*/
--- main.cpp.orig Tue Jul 13 10:32:55 1999
+++ main.cpp Sat Feb 24 10:14:56 2001
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <qstring.h>
#include "config.h"
@@ -36,6 +37,8 @@
int main(int argc, char **argv)
{
EarthApplication myApp(argc, argv);
+
+ srandomdev();
#ifdef WITH_QIMAGEIO
qInitImageIO();

View file

@ -1,6 +1,87 @@
--- renderer.cpp.orig Tue Dec 7 03:13:35 1999
+++ renderer.cpp Wed Jan 4 23:17:40 2006
@@ -1434,7 +1434,7 @@
--- renderer.cpp.orig 1999-12-06 08:13:35.000000000 -0800
+++ renderer.cpp 2011-01-18 14:22:52.000000000 -0800
@@ -123,7 +123,7 @@
this->ambientGreen = 0.15;
this->ambientBlue = 0.15;
this->markerpixmap = new QPixmap((const char **)marker_xpm);
- ASSERT(markerpixmap != NULL);
+ Q_ASSERT(markerpixmap != NULL);
this->show_label = TRUE;
this->gridtype = NO_GRID;
this->d_gridline = 15.0*PI/180.;
@@ -448,7 +448,7 @@
void Renderer::setMarkerList(MarkerList *l)
{
- ASSERT(l != NULL);
+ Q_ASSERT(l != NULL);
markerlist = l;
}
@@ -1136,7 +1136,7 @@
Location **visible_locations;
visible_locations = new Location*[markerlist->count()];
- ASSERT(visible_locations != NULL);
+ Q_ASSERT(visible_locations != NULL);
// Matrix M of renderFrame, but transposed
m11 = cos(rot)*cos(view_long)-sin(view_lat)*sin(view_long)*sin(rot);
@@ -1151,8 +1151,9 @@
visible_angle = radius/center_dist;
- for(i=0, l = markerlist->first(); l != NULL; l = markerlist->next())
+ for(i=0, num=0; i < markerlist->size(); ++i)
{
+ l = markerlist->atindex(i);
lon = l->getLongitude()*PI/180.;
lat = l->getLatitude()*PI/180.;
@@ -1185,12 +1186,9 @@
l->x = screen_x + shift_x;
l->y = screen_y + shift_y;
- visible_locations[i] = l;
- i++;
+ visible_locations[num++] = l;
}
- num = i;
-
// sort the markers according to depth
qsort(visible_locations, num, sizeof(Location *),
Renderer::compareLocations);
@@ -1208,8 +1206,8 @@
{
double c1, c2;
- c1 = (*((Location **)l1))->cos_angle;
- c2 = (*((Location **)l2))->cos_angle;
+ c1 = ((Location *)l1)->cos_angle;
+ c2 = ((Location *)l2)->cos_angle;
if(c1 > c2)
return 1;
@@ -1364,7 +1362,7 @@
QImage *clonedImage = NULL;
clonedImage = new QImage(*renderedImage);
- ASSERT(clonedImage != NULL);
+ Q_ASSERT(clonedImage != NULL);
return clonedImage;
}
@@ -1391,7 +1389,7 @@
#if QT_VERSION >= 200
p.setPen(Qt::black);
#else
- p.setPen(black);
+ p.setPen(Qt::black);
#endif
wx = -br.x()+markerpixmap->width()+2;
wy = -br.y();
@@ -1434,7 +1432,7 @@
for(wx=0 ; wx<visiblerect.width(); wx++)
{
@ -9,7 +90,7 @@
{
case 0x00000000:
*dest++ = 0;
@@ -1483,8 +1483,8 @@
@@ -1483,8 +1481,8 @@
labelstring.sprintf("%s, %s %d. %d, %d:%02d %s\n"
"View pos %2.2f° %c %2.2f° %c\n"
"Sun pos %2.2f° %c %2.2f° %c",
@ -20,7 +101,27 @@
dt.date().day(), dt.date().year(),
dt.time().hour(), dt.time().minute(),
tzname[tm->tm_isdst],
@@ -1562,9 +1562,9 @@
@@ -1499,7 +1497,7 @@
QRect br = fm.boundingRect(0, 0, 0, 0, Qt::AlignLeft|Qt::AlignTop,
labelstring);
#else
- QRect br = fm.boundingRect(0, 0, 0, 0, AlignLeft|AlignTop, labelstring);
+ QRect br = fm.boundingRect(0, 0, 0, 0, Qt::AlignLeft|Qt::AlignTop, labelstring);
#endif
QPixmap pm(br.width()+10, br.height()+10);
@@ -1512,8 +1510,8 @@
p.drawText(5, 5, br.width(), br.height(), Qt::AlignLeft|Qt::AlignTop,
labelstring);
#else
- p.setPen(white);
- p.drawText(5, 5, br.width(), br.height(), AlignLeft|AlignTop, labelstring);
+ p.setPen(Qt::white);
+ p.drawText(5, 5, br.width(), br.height(), Qt::AlignLeft|Qt::AlignTop, labelstring);
#endif
p.end();
@@ -1562,9 +1560,9 @@
for(int i=0; i<numstars; i++)
{

View file

@ -0,0 +1,11 @@
--- sunpos.cpp.orig 1998-12-09 10:51:09.000000000 -0800
+++ sunpos.cpp 2011-01-18 14:22:52.000000000 -0800
@@ -203,7 +203,7 @@
double JD;
/* lazy test to ensure gregorian calendar */
- ASSERT(y >= 1583);
+ Q_ASSERT(y >= 1583);
if ((m == 1) || (m == 2))
{

View file

@ -2,4 +2,4 @@ Displays a rendered view of the earth in your root window, similar to
xearth, but instead uses a satellite image map of the earth. You can also
substitute surface maps of other planets if you're feeling cosmic.
WWW: http://www.cs.unc.edu/~scheuerm/xglobe/
WWW: http://www.shaderwrangler.com/xglobe/

View file

@ -1,4 +1,4 @@
bin/xglobe
share/xglobe/map.bmp
share/xglobe/xglobe-markers
@dirrm share/xglobe
%%DATADIR%%/map.bmp
%%DATADIR%%/xglobe-markers
@dirrm %%DATADIR%%