Skip to content

Commit e6821a2

Browse files
author
Jeremy Bowman
committed
Added support for running on Mac OS X with Qt 3
1 parent eaf3041 commit e6821a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2337
-44
lines changed

CHANGES

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2004-05-06 JMB Mac OS X support
2+
3+
Lots of little code tweaks to make PortaBase work properly and look
4+
reasonably native on Mac OS X. Also added the files needed to generate
5+
an application bundle. This is the code that was submitted to
6+
Trolltech's Qt/Mac application developer contest.
7+
18
2004-03-29 #################### PortaBase 1.9 ####################
29

310
2004-03-29 JMB Translation updates, minor row viewer fix, etc.

INSTALL

+40-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,26 @@ will need the following:
2626
- A recent version of Qt 3 (including qmake and development headers)
2727
- Other packages as needed to satisfy the above requirements or create
2828
packages for your OS/distribution
29+
30+
Mac OS X Development Environment
31+
--------------------------------
32+
To compile PortaBase for use as a Mac OS X desktop application, you will
33+
need the following:
34+
- Mac OS X Jaguar (10.2) or higher
35+
- The Apple developer tools (which are on one of the CDs that come with
36+
Panther, and are available from http://developer.apple.com)
37+
- A recent version of Qt 3
2938

3039
Metakit Compilation
3140
-------------------
3241
To compile PortaBase, Metakit must be compiled first. PortaBase uses a
3342
version of 2.4.9.3 patched to allow case-sensitive searches, locale-sensitive
3443
sorting, and unicode filename support where available. Therefore, the patch
3544
file metakit-2.4.9.3.patch must be applied to the Metakit 2.4.9.3 source tree
36-
before building.
45+
before building. When building for Mac OS X, however, a more recent version
46+
from CVS is necessary in order to avoid a build problem present in the older
47+
code; for the Qt/Mac developer contest, an already-patched Metakit source
48+
code tarball (metakit.tar.gz) has been included for convenience.
3749

3850
To build Metakit for the desktop test environment, run dev-x86-qpe.sh and then
3951
follow the Metakit installation instructions (in the Metakit README file).
@@ -56,7 +68,8 @@ placed in (probably not /usr/local this time). Then copy libmk4.a to
5668

5769
To compile Metakit for Windows, follow the instructions in Metakit's README
5870
file; be sure to build the static library version (mklib). To compile
59-
Metakit for use in Linux desktop PortaBase, just follow the README directions.
71+
Metakit for use in Linux or Mac OS X desktop PortaBase, just follow the
72+
README directions (the "UNIX" instructions in both cases).
6073

6174
BeeCrypt compilation
6275
--------------------
@@ -73,10 +86,11 @@ libjpeg compilation
7386
-------------------
7487
For desktop Linux, this is probably already on your system; just make sure to
7588
install the appropriate dev package if it hasn't already been installed (for
76-
Debian this is libjpeg62-dev). For Windows, get version 6b from
89+
Debian this is libjpeg62-dev). For Windows and Mac OS X, get version 6b from
7790
http://www.ijg.org and follow the build instructions from the install.doc file
78-
that comes with the source code. For the Zaurus version, it's easiest to just
79-
use the Debian arm package for libjpeg62-dev; after downloading the .deb file,
91+
that comes with the source code (at least on Mac OS X, remember to run "make
92+
install-lib" at the end). For the Zaurus version, it's easiest to just use
93+
the Debian arm package for libjpeg62-dev; after downloading the .deb file,
8094
you can extract the necessary files by running:
8195

8296
ar x libjpeg62-dev_6b-9_arm.deb
@@ -172,6 +186,26 @@ files into the correct locations:
172186
...and so on. (The portabase.qm files are created by running lrelease on
173187
portabase.pro.)
174188

189+
Mac OS X compilation
190+
--------------------
191+
- Install Qt version 3.2 or newer and configure it, as per the directions
192+
in its INSTALL file. Newer versions are better, as this port is
193+
relatively new and many bugs have been fixed recently.
194+
- Make sure the BeeCrypt and libjpeg static libraries (.a) are in
195+
/usr/local/lib, and that the other library files (.dylib, .la, etc.)
196+
aren't. Run ranlib on both of these files, e.g.
197+
"sudo ranlib /usr/local/lib/libjpeg.a". The Metakit shared library
198+
file (libmk4.dylib) should be here also.
199+
- Make sure that "desktop" is among the CONFIG parameters in portabase.pro
200+
(and that "qtopia", "sharp", and "test" aren't).
201+
- Run qmake on portabase.pro
202+
- Run make
203+
- Enter the "mac" subdirectory and run "./build_bundle.sh". This will
204+
create the PortaBase application bundle in that directory (copying and
205+
appropriately linking the PortaBase executable and the Metakit shared
206+
library file in the process). You can now run it and move it wherever
207+
you'd like.
208+
175209
Package Building
176210
----------------
177211
To create ".ipk" files for installation on the Zaurus, create the following
@@ -185,6 +219,7 @@ directory hierarchy as root in a directory of your choice:
185219
/portabase/opt/QtPalmtop/help/ja/html/portabase.html
186220
/portabase/opt/QtPalmtop/help/zh_TW/html/portabase.html
187221
/portabase/opt/QtPalmtop/i18n/cs/portabase.qm
222+
/portabase/opt/QtPalmtop/i18n/de/portabase.qm
188223
/portabase/opt/QtPalmtop/i18n/fr/portabase.qm
189224
/portabase/opt/QtPalmtop/i18n/ja/portabase.qm
190225
/portabase/opt/QtPalmtop/i18n/zh_TW/portabase.qm

README.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PortaBase 1.9 (March 2004)
33
PortaBase (portable database) is a personal database application originally
44
written for the Linux-based models of Sharp Zaurus PDA (and should work on
55
any other Linux PDA using the Qtopia environment.) It can now also be
6-
run as a Linux or Windows desktop application.
6+
run as a Linux, Mac OS X, or Windows desktop application.
77

88
The main features PortaBase currently has are:
99
- One data table per file
@@ -54,6 +54,11 @@ Windows Installation and Upgrades
5454
Run the downloaded executable; it will launch the installation program,
5555
just follow the directions.
5656

57+
Mac OS X Installation
58+
---------------------
59+
Extract the application bundle from the downloaded archive and put it where
60+
you want it.
61+
5762
Technical Info and Acknowledgements
5863
-----------------------------------
5964
PortaBase is written in C++, using the Qt and Qtopia libraries for GUI widgets,

calculator.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ Calculator::Calculator(QWidget* parent, const char *name)
7171
buttons[PLUSMINUS] = new QPushButton("+-", this);
7272
buttons[PERCENT] = new QPushButton("%", this);
7373

74-
int buttonWidth = 30;
7574
int i;
75+
#if !defined(Q_OS_MACX)
76+
int buttonWidth = 30;
7677
for (i = 0; i < MAX_BUTTONS; i++) {
7778
buttons[i]->setMinimumWidth(buttonWidth);
7879
buttons[i]->setMaximumWidth(buttonWidth);
7980
}
81+
#endif
8082

8183
grid->addWidget(buttons[7], 1, 0);
8284
grid->addWidget(buttons[8], 1, 1);

datewidget.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <qdatetime.h>
1313
#include <qlabel.h>
1414
#include <qpushbutton.h>
15+
#include <qtoolbutton.h>
1516
#include "database.h"
1617
#include "datewidget.h"
1718

@@ -50,7 +51,11 @@ DateWidget::DateWidget(QWidget *parent, const char *name, WFlags f)
5051
months.append(tr("Nov"));
5152
months.append(tr("Dec"));
5253
dateObj = QDate::currentDate();
54+
#if defined(Q_OS_MACX)
55+
QToolButton *button = new QToolButton(this);
56+
#else
5357
QPushButton *button = new QPushButton(this);
58+
#endif
5459
button->setPixmap(Resource::loadPixmap("portabase/calendar"));
5560
connect(button, SIGNAL(clicked()), this, SLOT(launchSelector()));
5661
display = new QLabel(toString(dateObj), this);

desktop/QtaDatePicker.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <qpixmap.h>
1717
#include <qpushbutton.h>
1818
#include <qspinbox.h>
19+
#include <qtoolbutton.h>
1920
#include <stdio.h>
2021
//
2122
// Globals
@@ -48,9 +49,13 @@ QDatePicker::QDatePicker(QDate *inDate, QWidget *parent)
4849
vbox->addWidget(hbox);
4950

5051
// Create the 'prev' month button
52+
#if defined(Q_OS_MACX)
53+
QToolButton *prevMonthButton = new QToolButton(Qt::LeftArrow, hbox);
54+
#else
5155
QPushButton *prevMonthButton = new QPushButton(hbox);
5256
QPixmap prevPixmap = Resource::loadPixmap("portabase/QtaDatePickerPrev");
5357
prevMonthButton->setPixmap(prevPixmap);
58+
#endif
5459
connect(prevMonthButton, SIGNAL(clicked()),
5560
this, SLOT(datePickerPrevMonth()));
5661

@@ -74,9 +79,13 @@ QDatePicker::QDatePicker(QDate *inDate, QWidget *parent)
7479
this, SLOT(datePickerMonthChanged(int)));
7580

7681
// Create the 'next' month button
82+
#if defined(Q_OS_MACX)
83+
QToolButton *nextMonthButton = new QToolButton(Qt::RightArrow, hbox);
84+
#else
7785
QPushButton *nextMonthButton = new QPushButton(hbox);
7886
QPixmap nextPixmap = Resource::loadPixmap("portabase/QtaDatePickerNext");
7987
nextMonthButton->setPixmap(nextPixmap);
88+
#endif
8089
connect(nextMonthButton, SIGNAL(clicked()),
8190
this, SLOT(datePickerNextMonth()));
8291

desktop/qpeapplication.cpp

+27-5
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ QString QPEApplication::iconDir()
4040
{
4141
#if defined(Q_WS_WIN)
4242
return qApp->applicationDirPath() + "/icons/";
43+
#else
44+
#if defined(Q_OS_MACX)
45+
return QPEApplication::resourcePath() + "icons/";
4346
#else
4447
return "/usr/share/portabase/icons/";
4548
#endif
49+
#endif
4650
}
4751

4852
QString QPEApplication::documentDir()
@@ -83,16 +87,21 @@ QStringList QPEApplication::languageList()
8387
QString QPEApplication::translationFile()
8488
{
8589
QStringList langs = QPEApplication::languageList();
90+
QString suffix = "/portabase.qm";
8691
#if defined(Q_WS_WIN)
8792
QString path = qApp->applicationDirPath() + "/i18n/";
93+
#else
94+
#if defined(Q_OS_MACX)
95+
QString path = QPEApplication::resourcePath();
96+
suffix = ".lproj/portabase.qm";
8897
#else
8998
QString path = "/usr/share/portabase/i18n/";
9099
#endif
91-
QString filename = "/portabase.qm";
100+
#endif
92101
int count = langs.count();
93102
for (int i = 0; i < count; i++) {
94-
if (QFile::exists(path + langs[i] + filename)) {
95-
return path + langs[i] + filename;
103+
if (QFile::exists(path + langs[i] + suffix)) {
104+
return path + langs[i] + suffix;
96105
}
97106
}
98107
// No appropriate translation file, just use what's in the code
@@ -102,20 +111,26 @@ QString QPEApplication::translationFile()
102111
QString QPEApplication::helpDir()
103112
{
104113
QStringList langs = QPEApplication::languageList();
114+
QString suffix = "/";
105115
#if defined(Q_WS_WIN)
106116
QString path = qApp->applicationDirPath() + "/help/";
117+
#else
118+
#if defined(Q_OS_MACX)
119+
QString path = QPEApplication::resourcePath();
120+
suffix = ".lproj/";
107121
#else
108122
QString path = "/usr/share/portabase/help/";
123+
#endif
109124
#endif
110125
int count = langs.count();
111126
for (int i = 0; i < count; i++) {
112127
QDir dir(path + langs[i]);
113128
if (dir.exists()) {
114-
return path + langs[i] + "/";
129+
return path + langs[i] + suffix;
115130
}
116131
}
117132
// Default to English, will usually be present
118-
return path + "en/";
133+
return path + "en" + suffix;
119134
}
120135

121136
void QPEApplication::showMainDocumentWidget(QWidget* mw, bool nomaximize)
@@ -127,3 +142,10 @@ void QPEApplication::showMainDocumentWidget(QWidget* mw, bool nomaximize)
127142
mw->show();
128143
}
129144
}
145+
146+
#if defined(Q_OS_MACX)
147+
QString QPEApplication::resourcePath()
148+
{
149+
return qApp->applicationDirPath() + "/../Resources/";
150+
}
151+
#endif

desktop/qpeapplication.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* qpeapplication.h
33
*
4-
* (c) 2003 by Jeremy Bowman <[email protected]>
4+
* (c) 2003-2004 by Jeremy Bowman <[email protected]>
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,9 @@ class QPEApplication : public QApplication
3131

3232
private:
3333
static QStringList languageList();
34+
#if defined(Q_OS_MACX)
35+
static QString resourcePath();
36+
#endif
3437
};
3538

3639
#endif

filtereditor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ FilterEditor::FilterEditor(QWidget *parent, const char *name)
2525
{
2626
QHBox *hbox = new QHBox(this);
2727
vbox->addWidget(hbox);
28-
new QLabel(tr("Filter Name"), hbox);
28+
new QLabel(tr("Filter Name") + " ", hbox);
2929
nameBox = new QLineEdit(hbox);
3030

3131
listBox = new QListBox(this);

mac/Info.plist

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFAppleHelpAnchor</key>
6+
<string>portabase</string>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>English</string>
9+
<key>CFBundleDocumentTypes</key>
10+
<array>
11+
<dict>
12+
<key>CFBundleTypeExtensions</key>
13+
<array>
14+
<string>pob</string>
15+
</array>
16+
<key>CFBundleTypeIconFile</key>
17+
<string>PortaBaseFile</string>
18+
<key>CFBundleTypeName</key>
19+
<string>PortaBase File</string>
20+
<key>CFBundleTypeRole</key>
21+
<string>Editor</string>
22+
</dict>
23+
</array>
24+
<key>CFBundleExecutable</key>
25+
<string>PortaBase</string>
26+
<key>CFBundleGetInfoString</key>
27+
<string>1.9, (c) Jeremy Bowman, 2002-2004</string>
28+
<key>CFBundleIconFile</key>
29+
<string>PortaBase</string>
30+
<key>CFBundleIdentifier</key>
31+
<string>net.sourceforge.portabase</string>
32+
<key>CFBundleInfoDictionaryVersion</key>
33+
<string>6.0</string>
34+
<key>CFBundlePackageType</key>
35+
<string>APPL</string>
36+
<key>CFBundleShortVersionString</key>
37+
<string>1.9</string>
38+
<key>CFBundleSignature</key>
39+
<string>PBas</string>
40+
<key>CFBundleVersion</key>
41+
<string>1.9</string>
42+
<key>LSMinimumSystemVersion</key>
43+
<string>10.2.0</string>
44+
</dict>
45+
</plist>

mac/PkgInfo

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
APPLPBas

mac/PortaBase.icns

49.9 KB
Binary file not shown.

mac/PortaBaseFile.icns

40.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)