Skip to content

Commit

Permalink
Added support for running on Mac OS X with Qt 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Bowman committed Dec 21, 2009
1 parent eaf3041 commit e6821a2
Show file tree
Hide file tree
Showing 48 changed files with 2,337 additions and 44 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2004-05-06 JMB Mac OS X support

Lots of little code tweaks to make PortaBase work properly and look
reasonably native on Mac OS X. Also added the files needed to generate
an application bundle. This is the code that was submitted to
Trolltech's Qt/Mac application developer contest.

2004-03-29 #################### PortaBase 1.9 ####################

2004-03-29 JMB Translation updates, minor row viewer fix, etc.
Expand Down
45 changes: 40 additions & 5 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,26 @@ will need the following:
- A recent version of Qt 3 (including qmake and development headers)
- Other packages as needed to satisfy the above requirements or create
packages for your OS/distribution

Mac OS X Development Environment
--------------------------------
To compile PortaBase for use as a Mac OS X desktop application, you will
need the following:
- Mac OS X Jaguar (10.2) or higher
- The Apple developer tools (which are on one of the CDs that come with
Panther, and are available from http://developer.apple.com)
- A recent version of Qt 3

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

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

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

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

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

Mac OS X compilation
--------------------
- Install Qt version 3.2 or newer and configure it, as per the directions
in its INSTALL file. Newer versions are better, as this port is
relatively new and many bugs have been fixed recently.
- Make sure the BeeCrypt and libjpeg static libraries (.a) are in
/usr/local/lib, and that the other library files (.dylib, .la, etc.)
aren't. Run ranlib on both of these files, e.g.
"sudo ranlib /usr/local/lib/libjpeg.a". The Metakit shared library
file (libmk4.dylib) should be here also.
- Make sure that "desktop" is among the CONFIG parameters in portabase.pro
(and that "qtopia", "sharp", and "test" aren't).
- Run qmake on portabase.pro
- Run make
- Enter the "mac" subdirectory and run "./build_bundle.sh". This will
create the PortaBase application bundle in that directory (copying and
appropriately linking the PortaBase executable and the Metakit shared
library file in the process). You can now run it and move it wherever
you'd like.

Package Building
----------------
To create ".ipk" files for installation on the Zaurus, create the following
Expand All @@ -185,6 +219,7 @@ directory hierarchy as root in a directory of your choice:
/portabase/opt/QtPalmtop/help/ja/html/portabase.html
/portabase/opt/QtPalmtop/help/zh_TW/html/portabase.html
/portabase/opt/QtPalmtop/i18n/cs/portabase.qm
/portabase/opt/QtPalmtop/i18n/de/portabase.qm
/portabase/opt/QtPalmtop/i18n/fr/portabase.qm
/portabase/opt/QtPalmtop/i18n/ja/portabase.qm
/portabase/opt/QtPalmtop/i18n/zh_TW/portabase.qm
Expand Down
7 changes: 6 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PortaBase 1.9 (March 2004)
PortaBase (portable database) is a personal database application originally
written for the Linux-based models of Sharp Zaurus PDA (and should work on
any other Linux PDA using the Qtopia environment.) It can now also be
run as a Linux or Windows desktop application.
run as a Linux, Mac OS X, or Windows desktop application.

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

Mac OS X Installation
---------------------
Extract the application bundle from the downloaded archive and put it where
you want it.

Technical Info and Acknowledgements
-----------------------------------
PortaBase is written in C++, using the Qt and Qtopia libraries for GUI widgets,
Expand Down
4 changes: 3 additions & 1 deletion calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ Calculator::Calculator(QWidget* parent, const char *name)
buttons[PLUSMINUS] = new QPushButton("+-", this);
buttons[PERCENT] = new QPushButton("%", this);

int buttonWidth = 30;
int i;
#if !defined(Q_OS_MACX)
int buttonWidth = 30;
for (i = 0; i < MAX_BUTTONS; i++) {
buttons[i]->setMinimumWidth(buttonWidth);
buttons[i]->setMaximumWidth(buttonWidth);
}
#endif

grid->addWidget(buttons[7], 1, 0);
grid->addWidget(buttons[8], 1, 1);
Expand Down
5 changes: 5 additions & 0 deletions datewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <qdatetime.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include "database.h"
#include "datewidget.h"

Expand Down Expand Up @@ -50,7 +51,11 @@ DateWidget::DateWidget(QWidget *parent, const char *name, WFlags f)
months.append(tr("Nov"));
months.append(tr("Dec"));
dateObj = QDate::currentDate();
#if defined(Q_OS_MACX)
QToolButton *button = new QToolButton(this);
#else
QPushButton *button = new QPushButton(this);
#endif
button->setPixmap(Resource::loadPixmap("portabase/calendar"));
connect(button, SIGNAL(clicked()), this, SLOT(launchSelector()));
display = new QLabel(toString(dateObj), this);
Expand Down
9 changes: 9 additions & 0 deletions desktop/QtaDatePicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <stdio.h>
//
// Globals
Expand Down Expand Up @@ -48,9 +49,13 @@ QDatePicker::QDatePicker(QDate *inDate, QWidget *parent)
vbox->addWidget(hbox);

// Create the 'prev' month button
#if defined(Q_OS_MACX)
QToolButton *prevMonthButton = new QToolButton(Qt::LeftArrow, hbox);
#else
QPushButton *prevMonthButton = new QPushButton(hbox);
QPixmap prevPixmap = Resource::loadPixmap("portabase/QtaDatePickerPrev");
prevMonthButton->setPixmap(prevPixmap);
#endif
connect(prevMonthButton, SIGNAL(clicked()),
this, SLOT(datePickerPrevMonth()));

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

// Create the 'next' month button
#if defined(Q_OS_MACX)
QToolButton *nextMonthButton = new QToolButton(Qt::RightArrow, hbox);
#else
QPushButton *nextMonthButton = new QPushButton(hbox);
QPixmap nextPixmap = Resource::loadPixmap("portabase/QtaDatePickerNext");
nextMonthButton->setPixmap(nextPixmap);
#endif
connect(nextMonthButton, SIGNAL(clicked()),
this, SLOT(datePickerNextMonth()));

Expand Down
32 changes: 27 additions & 5 deletions desktop/qpeapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ QString QPEApplication::iconDir()
{
#if defined(Q_WS_WIN)
return qApp->applicationDirPath() + "/icons/";
#else
#if defined(Q_OS_MACX)
return QPEApplication::resourcePath() + "icons/";
#else
return "/usr/share/portabase/icons/";
#endif
#endif
}

QString QPEApplication::documentDir()
Expand Down Expand Up @@ -83,16 +87,21 @@ QStringList QPEApplication::languageList()
QString QPEApplication::translationFile()
{
QStringList langs = QPEApplication::languageList();
QString suffix = "/portabase.qm";
#if defined(Q_WS_WIN)
QString path = qApp->applicationDirPath() + "/i18n/";
#else
#if defined(Q_OS_MACX)
QString path = QPEApplication::resourcePath();
suffix = ".lproj/portabase.qm";
#else
QString path = "/usr/share/portabase/i18n/";
#endif
QString filename = "/portabase.qm";
#endif
int count = langs.count();
for (int i = 0; i < count; i++) {
if (QFile::exists(path + langs[i] + filename)) {
return path + langs[i] + filename;
if (QFile::exists(path + langs[i] + suffix)) {
return path + langs[i] + suffix;
}
}
// No appropriate translation file, just use what's in the code
Expand All @@ -102,20 +111,26 @@ QString QPEApplication::translationFile()
QString QPEApplication::helpDir()
{
QStringList langs = QPEApplication::languageList();
QString suffix = "/";
#if defined(Q_WS_WIN)
QString path = qApp->applicationDirPath() + "/help/";
#else
#if defined(Q_OS_MACX)
QString path = QPEApplication::resourcePath();
suffix = ".lproj/";
#else
QString path = "/usr/share/portabase/help/";
#endif
#endif
int count = langs.count();
for (int i = 0; i < count; i++) {
QDir dir(path + langs[i]);
if (dir.exists()) {
return path + langs[i] + "/";
return path + langs[i] + suffix;
}
}
// Default to English, will usually be present
return path + "en/";
return path + "en" + suffix;
}

void QPEApplication::showMainDocumentWidget(QWidget* mw, bool nomaximize)
Expand All @@ -127,3 +142,10 @@ void QPEApplication::showMainDocumentWidget(QWidget* mw, bool nomaximize)
mw->show();
}
}

#if defined(Q_OS_MACX)
QString QPEApplication::resourcePath()
{
return qApp->applicationDirPath() + "/../Resources/";
}
#endif
5 changes: 4 additions & 1 deletion desktop/qpeapplication.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* qpeapplication.h
*
* (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
* (c) 2003-2004 by Jeremy Bowman <jmbowman@alum.mit.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -31,6 +31,9 @@ class QPEApplication : public QApplication

private:
static QStringList languageList();
#if defined(Q_OS_MACX)
static QString resourcePath();
#endif
};

#endif
2 changes: 1 addition & 1 deletion filtereditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FilterEditor::FilterEditor(QWidget *parent, const char *name)
{
QHBox *hbox = new QHBox(this);
vbox->addWidget(hbox);
new QLabel(tr("Filter Name"), hbox);
new QLabel(tr("Filter Name") + " ", hbox);
nameBox = new QLineEdit(hbox);

listBox = new QListBox(this);
Expand Down
45 changes: 45 additions & 0 deletions mac/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFAppleHelpAnchor</key>
<string>portabase</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pob</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>PortaBaseFile</string>
<key>CFBundleTypeName</key>
<string>PortaBase File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>PortaBase</string>
<key>CFBundleGetInfoString</key>
<string>1.9, (c) Jeremy Bowman, 2002-2004</string>
<key>CFBundleIconFile</key>
<string>PortaBase</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.portabase</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.9</string>
<key>CFBundleSignature</key>
<string>PBas</string>
<key>CFBundleVersion</key>
<string>1.9</string>
<key>LSMinimumSystemVersion</key>
<string>10.2.0</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions mac/PkgInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPLPBas
Binary file added mac/PortaBase.icns
Binary file not shown.
Binary file added mac/PortaBaseFile.icns
Binary file not shown.
Loading

0 comments on commit e6821a2

Please sign in to comment.