## Installation

### Requirements

- A Linux or FreeBSD compatible or Mac OS X operating system.
- Qt development library. At least Qt 3.3.* version. Qt 4 not yet supported.
- Berkeley DB database. At least db-4.1 version. FreeBSD users are required to use the 4.3 version.
- TA-Lib Technical Analysis Library. At least ta-lib-0.3.0 version. See below.

When upgrading Qtstalker from a previous source version, see the notes below.

See notes below about where stuff gets installed.

### Installing via packages

Packages are available for some operating systems:

- Debian packages

### Installing from source

Note: Package users can ignore the following advice as this will be done automatically by the package installer.

Important (Qt): Ensure that Qt is installed properly. Also ensure that the $QTDIR environment variable is set (see below). Also ensure that '`qmake`' and friends are available (e.g. add $QTDIR/bin to your $PATH).

Important (DB): Ensure that Berkeley DB is installed properly. If you installed Berkeley DB at a non-standard location, then edit the Qtstalker "configure" file (e.g. "`INCLUDEPATH += /opt/local/include/db4`").
And some installations miss symbolic links in the lib directory.

Important (TA-Lib): Ensure that TA-Lib is installed properly. Also ensure that the '`ta-lib-config`' program is available on your $PATH

#### Hint for Ubuntu / Debian users

You need to install these packages before:

- build-essential (meta package for compiler etc.)
- libdb4.4-dev (for Berkely)
- qt3-dev-tools (for qmake)
- libqt3-mt-dev (this will also select much more packages to install, don't be afraid)

#### Install TA-Lib

Since version 0.34 of Qtstalker you must install TA-Lib separately before you install Qtstalker itself. In previous versions, TA-Lib was included in the Qtstalker source tree, but not now. You can download the source of TA-Lib e.g. with the command...

`wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz`

...entered in your terminal. Unpack the downloaded file, cd into the extracted folder and compile/install TA-Lib with the sequence

1. `./configure`
2. `make`
3. `make install` (as root)
4. There may also need to modify something if an error like this appears when you start Qtstalker ...

   `/usr/local/bin/qtstalker: error while loading shared libraries: libqtstalker.so.0: cannot open shared object file: No such file or directory`

   To fix this add `/usr/local/lib` to your `/etc/ld.so.conf` file and run `ldconfig -v` (as root).

If you installed TA-Lib at a non-standard location, then edit the Qtstalker "configure" file (e.g. "`INCLUDEPATH += /opt/local/include/ta-lib`").

Also ensure that the '`ta-lib-config`' program is available on your $PATH

#### Install Qtstalker

##### For Linux users

See important pre-requisite notes above.

- Ensure that your shell QTDIR environment variable is set to point to the location of the root Qt directory. This setting is usually something like this: '`export QTDIR=/usr/lib/qt`' or something similar to this. Failure to set this properly will result in make errors.
- Unpack the Qtstalker source.
- `./configure` (this will create the Makefile)
- `make`
- `make install` (as root)

If you get errors about undefined symbols when you start qtstalker, then add `/usr/local/lib` to your `/etc/ld.so.conf` file and run `ldconfig -v` (as root).

##### For FreeBSD users

See important pre-requisite notes above.

- Set a few environment variables in your shell.
  Enter this: '`export QTDIR=/usr/X11R6`'
  Then enter this '`export QMAKESPEC=/usr/local/share/qt/mkspecs/freebsd-g++`'.
  Failure to set these variables properly will result in make errors.
- Unpack the Qtstalker source.
- `./configure` (this will create the Makefile)
- `make`
- `make install` (as root)

##### For Macintosh OS X users (Tiger 10.4+)

See important pre-requisite notes above.

Note: By default Qtstalker will only look for supporting libraries etc. under `/usr/local/` so Mac users will need to tell Qtstalker via the "`configure`" file where to look for these. We cannot give explicit instructions because you might install some bits via Fink and other bits via MacPorts, etc. so the following notes are just a guide.

- Get Berkeley DB using MacPorts.org (which would install stuff under `/opt` directory) or Fink.sf.net (which would install stuff under `/sw` directory)
  We have reports of needing e.g. '`cd /opt/local/lib; ln -s libdb-4.2.dylib libdb.dylib`')
- Get TA-Lib source and install as described above.
- Get "Qt for Aqua" (i.e. not for X11). Trolltech says must be at least qt-3.3.5 version. You can get this via Fink, or MacPorts, or direct from Trolltech.
- Set your shell QTDIR environment variable to point where you installed Qt.
  e.g. '`export QTDIR=/sw/lib/qt3mac`' or something similar.
  Failure to set this properly will result in make errors.
- Unpack the Qtstalker source.
- Edit the "configure" file to be something like:
  `qmake "DEFINES += QT_NO_COMPAT" "CONFIG += qt" "macx:INCLUDEPATH += /opt/local/include/db4" "macx:LIBS += -L/opt/local/lib" -o Makefile qtstalker.pro`
- `./configure` (this will create the Makefile)
- `make`
- `sudo make install`
- To start, type '`open /usr/local/bin/qtstalker.app`'

### Where does stuff get installed

- The executable 'qtstalker' will be copied to the `/usr/local/bin` directory
- The plugins will be copied to `/usr/local/lib/qtstalker` directory
- The translation files will be copied to `/usr/local/share/qtstalker/i18n` directory
- The docs will be copied to `/usr/local/share/doc/qtstalker/html` directory (see toc.html for the table of contents)

The user workspace is in your home at `~/.qtstalker/data1/` directory.

The user settings are persistent. On most platforms they are stored in the `~/.qt/qtstalkerrc` plain-text file. On "Mac OS X" they are stored in a binary plist. See notes.

### Updating from a previous version

If you are updating from a previous source version already installed on your system, it is best that you first uninstall the previous version first before you install the upgraded version. Doing this will better ensure a problem-free upgrade. Many upgrade errors can be caused by old plugins and libraries hanging around complicating things. You can uninstall the old version by doing `'sudo make uninstall'` from the top directory of the old source install.

#### Updating from 0.33 to 0.35

When the newly installed 0.35 program starts, it will automatically upgrade the internal database used with 0.33 to a new format. The new user workspace will be `~/.qtstalker/data1/` and the old `~/.qtstalker/data0/` will remain in case you need it.

If you cancel the upgrade process, then you will need to clean up. Remove the `~/.qtstalker/data1/` directory and edit Qtstalker settings to set the "Version" back to 0.33 and each "data1" path back to "data0".

Version 0.32 and older are not supported, so you would need to import your raw data with the Quote plugins and add new indicators.

### Using the current development source

See instructions for using CVS.