Skip to content

Commit

Permalink
Revert "Revert "rework use of openrpt shared libs""
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Pazo committed Sep 8, 2014
1 parent 08b7318 commit bef2cd4
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 174 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,12 @@ common/tmp/*.*
guiclient/ui/*.*
widgets/tmp/*.*
widgets/tmp
osx_obj/

# files generated by autobuild
guiclient/altVersion.cpp
share/XTupleGUIClient.qch
share/XTupleGUIClient.qhc
share/dict/welcome/wmsg.*.qm

*~
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: cpp

env:
# build openrpt .so, then csvimp and qt-client use the result
- BUILD_SHARED_LIBS=true USE_SHARED_OPENRPT=true

before_install:
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
- sudo apt-get update -qq
Expand All @@ -11,11 +15,15 @@ compiler:

before_script:
- git submodule update --init --recursive
- cd openrpt && qmake && make
- cd ../csvimp && qmake && make
- cd openrpt
- git pull origin master && echo "Remove after openrpt submodule is updated"
- qmake && make -j4
- cd ../csvimp
- git pull origin master && echo "Remove after csvimp submodule is updated"
- qmake && make -j2
- cd ..

script:
- qmake
- make -j2
- make -j4

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ Meanwhile, here's a brief description of how to set up a development environment

**Warning**:
If you open Qt Designer to view or edit a `.ui` user interface file, check the widget palette _before you do anything else_. If there is no section for xTuple widgets, _quit immediately_ without saving any changes. Otherwise you risk losing important information about the user interface definition.

*Note*:

On some Linux distributions you can build the desktop client using OpenRPT
and CSVImp development packages instead of compiling in the `openrpt` and
`csvimp` directories. In these cases, set the following environment variables:
- `OPENRPT_HEADERS` names the directory where the OpenRPT header files are
installed
- `OPENRPT_LIBDIR` names the directory where the OpenRPT libraries are
installed
- `OPENRPT_IMAGE_DIR` names the directory where the OpenRPT images are
installed
- `CSVIMP_HEADERS` names the directory where the CSVImp header files are
installed
- `OPENRPT_LIBDIR` names the directory where the OpenRPT libraries are
installed
32 changes: 16 additions & 16 deletions common/checkForUpdates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
#include <shellapi.h>
#endif

#include "../guiclient/guiclient.h"
#include <parameter.h>

#include "xsqlquery.h"

#define QT_NO_URL_CAST_FROM_STRING

#define DEBUG false
Expand Down Expand Up @@ -154,28 +155,26 @@ checkForUpdates::checkForUpdates(QWidget* parent, const char* name, bool modal,
connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(_ignore, SIGNAL(clicked()), this, SLOT(accept()));

XSqlQuery versions, metric;
versions.exec("SELECT metric_value AS dbver"
" FROM metric"
" WHERE (metric_name = 'ServerVersion');");
XSqlQuery metric;
metric.exec("SELECT fetchMetricText('ServerVersion') AS dbver,"
" fetchMetricBool('DisallowMismatchClientVersion') as disallowed,"
" fetchMetricBool('AutoVersionUpdate') as allow;");

QString serverVersion;
if(versions.first())
if(metric.first())
{
serverVersion = versions.value("dbver").toString();

_label->setText(tr("Your client does not match the server version: %1. Would you like to update?").arg(serverVersion));
serverVersion = metric.value("dbver").toString();

metric.exec("SELECT fetchMetricBool('DisallowMismatchClientVersion') as disallowed;");
metric.first();
_label->setText(tr("Your client does not match the server version: %1. "
"Would you like to update?").arg(serverVersion));
_ignore->setEnabled(!metric.value("disallowed").toBool());

metric.exec("SELECT fetchMetricBool('AutoVersionUpdate') as allow;");
metric.first();
_ok->setEnabled(metric.value("allow").toBool());
}
else if (versions.lastError().type() != QSqlError::NoError)
systemError(this, versions.lastError().text(), __FILE__, __LINE__);
else if (metric.lastError().type() != QSqlError::NoError) {
QMessageBox::warning(parent, tr("System Error"),
tr("Could not find version information: %1")
.arg(metric.lastError().text()));
}

_private = new checkForUpdatesPrivate(this, serverVersion);
}
Expand Down Expand Up @@ -253,6 +252,7 @@ void checkForUpdates::cancelDownload()

void checkForUpdates::downloadFinished()
{
int result = QDialog::Accepted;
if (DEBUG) qDebug() << "downloadFinished() entered";

if(downloadRequestAborted)
Expand Down
11 changes: 5 additions & 6 deletions common/common.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include( ../global.pri )

TARGET = xtuplecommon
TEMPLATE = lib
CONFIG += qt warn_on
xtcommon_shared {
CONFIG += dll
} else {
CONFIG += staticlib
}
CONFIG += qt warn_on dll

DEFINES += MAKELIB

INCLUDEPATH += $(QTDIR)/src/3rdparty/zlib
Expand All @@ -18,6 +14,9 @@ OBJECTS_DIR = tmp
MOC_DIR = tmp
UI_DIR = tmp

QMAKE_LIBDIR += $${OPENRPT_LIBDIR}
LIBS += -lopenrptcommon -lMetaSQL $${LIBDMTX} -lz

SOURCES = calendarcontrol.cpp \
calendargraphicsitem.cpp \
checkForUpdates.cpp \
Expand Down
148 changes: 55 additions & 93 deletions global.pri
Original file line number Diff line number Diff line change
Expand Up @@ -8,116 +8,100 @@
# to be bound by its terms.
#

#
# This file is included by all the other project files
# and is where options or configurations that affect all
# of the projects can be place.
#
# This file is included by all the other project files and is where
# options or configurations that affect all of the projects can be placed.

OPENRPT_HEADERS = $$(OPENRPT_HEADERS)
! isEmpty( OPENRPT_HEADERS ) {
OPENRPT_DIR = $$OPENRPT_HEADERS
} else {
#
# This is the relative directory path to the openrpt project.
#
exists(../openrpt) {
OPENRPT_DIR = ../openrpt
}
exists(openrpt) {
OPENRPT_DIR = openrpt
}

exists(openrpt) {
exists(../openrpt) {
OPENRPT_DIR = ../openrpt
}
}
exists(openrpt) { OPENRPT_DIR = openrpt }
exists(../openrpt) { OPENRPT_DIR = ../openrpt }
OPENRPT_DIR_REL=true
}

! exists($${OPENRPT_DIR}) {
error("Could not set the OPENRPT_DIR qmake variable.")
OPENRPT_BLD = $${OPENRPT_DIR}
exists($${OPENRPT_DIR}-build-desktop) {
OPENRPT_BLD = $${OPENRPT_DIR}-build-desktop
}

OPENRPT_LIBDIR = $$(OPENRPT_LIBDIR)
! isEmpty( OPENRPT_LIBDIR ) {
OPENRPT_BLD = $$OPENRPT_LIBDIR
} else {
OPENRPT_BLD = $${OPENRPT_DIR}
exists($${OPENRPT_DIR}-build-desktop) {
OPENRPT_BLD = $${OPENRPT_DIR}-build-desktop
}
isEmpty( OPENRPT_LIBDIR ) {
OPENRPT_LIBDIR = $${OPENRPT_BLD}/lib
OPENRPT_LIBDIR_REL=true
}

isEmpty( OPENRPT_HEADERS ) {
OPENRPT_DIR = ../$$OPENRPT_DIR
! exists($${OPENRPT_DIR}) {
error("Could not set the OPENRPT_DIR qmake variable.")
}

isEmpty( OPENRPT_LIBDIR ) {
OPENRPT_BLD = ../$$OPENRPT_BLD
! exists($${OPENRPT_LIBDIR}) {
error("Could not set the OPENRPT_LIBDIR qmake variable.")
}

CSVIMP_HEADERS = $$(CSVIMP_HEADERS)
! isEmpty( CSVIMP_HEADERS ) {
CSVIMP_DIR = $$CSVIMP_HEADERS
} else {
exists(../csvimp) {
CSVIMP_DIR = ../csvimp
}
exists(csvimp) {
CSVIMP_DIR = csvimp
}

exists(csvimp) {
exists(../csvimp) {
CSVIMP_DIR = ../csvimp
}
}
isEmpty( CSVIMP_HEADERS ) {
exists(csvimp) { CSVIMP_DIR = csvimp }
exists(../csvimp) { CSVIMP_DIR = ../csvimp }
CSVIMP_HEADERS = $$CSVIMP_DIR/csvimpcommon
CSVIMP_HEADERS_REL = true
}

! exists($${CSVIMP_DIR}) {
error("Could not set the CSVIMP_DIR qmake variable.")
! exists($${CSVIMP_HEADERS}) {
error("Could not set the CSVIMP_HEADERS qmake variable.")
}

CSVIMP_LIBDIR = $$(CSVIMP_LIBDIR)
! isEmpty( CSVIMP_LIBDIR ) {
CSVIMP_BLD = $$CSVIMP_LIBDIR
} else {
CSVIMP_BLD = $${CSVIMP_DIR}
exists($${CSVIMP_DIR}-build-desktop) {
CSVIMP_BLD = $${CSVIMP_DIR}-build-desktop
}
exists($${OPENRPT_LIBDIR}/libdmtx.$${QMAKE_EXTENSION_SHLIB}) {
DMTXLIB = -ldmtx
}

isEmpty( CSVIMP_HEADERS ) {
CSVIMP_DIR = ../$$CSVIMP_DIR
exists($${OPENRPT_LIBDIR}/libDmtx_Library.$${QMAKE_EXTENSION_SHLIB}) {
DMTXLIB = -lDmtx_Library
}
exists($${OPENRPT_LIBDIR}/libdmtx.a) { DMTXLIB = -ldmtx }
exists($${OPENRPT_LIBDIR}/libDmtx_Library.a) { DMTXLIB = -lDmtx_Library }
exists($${OPENRPT_LIBDIR}/libdmtx.lib) { DMTXLIB = -ldmtx }
exists($${OPENRPT_LIBDIR}/libDmtx_Library.lib) { DMTXLIB = -lDmtx_Library }

isEmpty( CSVIMP_LIBDIR ) {
CSVIMP_BLD = ../$$CSVIMP_BLD
}
# global.pri is processed at the top level but the variables are used down 1 level
! isEmpty( OPENRPT_DIR_REL ) { OPENRPT_DIR = ../$${OPENRPT_DIR}
OPENRPT_BLD = ../$${OPENRPT_BLD} }
! isEmpty( OPENRPT_LIBDIR_REL ) { OPENRPT_LIBDIR = ../$${OPENRPT_LIBDIR} }
! isEmpty( CSVIMP_HEADERS_REL ) { CSVIMP_HEADERS = ../$${CSVIMP_HEADERS} }

INCLUDEPATH += $${OPENRPT_DIR}/common $${OPENRPT_BLD}/common \
$${OPENRPT_DIR}/OpenRPT/renderer $${OPENRPT_BLD}/OpenRPT/renderer \
$${OPENRPT_DIR}/OpenRPT/wrtembed $${OPENRPT_BLD}/OpenRPT/wrtembed \
$${OPENRPT_DIR}/MetaSQL $${OPENRPT_BLD}/MetaSQL \
$${OPENRPT_DIR}/MetaSQL/tmp $${OPENRPT_BLD}/MetaSQL/tmp \
$${CSVIMP_DIR}/csvimpcommon $${CSVIMP_BLD}/csvimpcommon
$${CSVIMP_HEADERS}
INCLUDEPATH = $$unique(INCLUDEPATH)

XTUPLE_DIR=..
! exists(../qt-client) {
XTUPLE_DIR=../../xtuple
}
XTUPLE_BLD=$${XTUPLE_DIR}
exists(../xtuple-build-desktop) {
XTUPLE_BLD=../../xtuple-build-desktop
exists(../qt-client-build-desktop) {
XTUPLE_BLD=../../qt-client-build-desktop
}

DEPENDPATH += $${INCLUDEPATH}

CONFIG += release thread
#CONFIG += debug

# The packaged version of OpenRPT installs the images to
# /usr/share/openrpt/OpenRPT/images
# Set this variable in the environment to use that location
OPENRPT_IMAGE_DIR = $$(OPENRPT_IMAGE_DIR)
isEmpty( OPENRPT_IMAGE_DIR ) {
exists("/usr/share/openrpt") {
OPENRPT_IMAGE_DIR = /usr/share/openrpt/OpenRPT/images
} else {
OPENRPT_IMAGE_DIR = $${OPENRPT_DIR}/OpenRPT/images
}
}

OPENRPTLIBEXT = $${QMAKE_EXTENSION_SHLIB}
XTLIBEXT = $${QMAKE_EXTENSION_SHLIB}
isEmpty( OPENRPTLIBEXT ) { OPENRPTLIBEXT = .so }
isEmpty( XTLIBEXT ) { XTLIBEXT = .so }

macx:exists(macx.pri) {
include(macx.pri)
Expand All @@ -130,25 +114,3 @@ win32:exists(win32.pri) {
unix:exists(unix.pri) {
include(unix.pri)
}

# Use a shared library version of openrpt library dependency
USE_SHARED_OPENRPT = $$(USE_SHARED_OPENRPT)
! isEmpty( USE_SHARED_OPENRPT ) {
CONFIG += openrpt_shared
}

# The packaged version of OpenRPT installs the images to
# /usr/share/openrpt/OpenRPT/images
# Set this variable in the environment to use that location
OPENRPT_IMAGE_DIR = $$(OPENRPT_IMAGE_DIR)
isEmpty( OPENRPT_IMAGE_DIR ) {
OPENRPT_IMAGE_DIR = $${OPENRPT_DIR}/OpenRPT/images
}

# If this environment variable is set, libxtuplecommon is built
# as a shared object.
BUILD_XTCOMMON_SHARED = $$(BUILD_XTCOMMON_SHARED)
! isEmpty( BUILD_XTCOMMON_SHARED ) {
CONFIG += xtcommon_shared
}

23 changes: 16 additions & 7 deletions guiclient/guiclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,19 @@ GUIClient::GUIClient(const QString &pDatabaseURL, const QString &pUsername)

// load plugins before building the menus
// TODO? add a step later to add to the menus from the plugins?
QDir pluginsDir(QApplication::applicationDirPath());
while (! pluginsDir.exists("plugins") && pluginsDir.cdUp())
;
if (pluginsDir.cd("plugins"))
QStringList checkForPlugins;
checkForPlugins << QApplication::applicationDirPath()
<< QString("/usr/lib/postbooks");
foreach (QString dirname, checkForPlugins)
{
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
new QPluginLoader(pluginsDir.absoluteFilePath(fileName), this);
QDir pluginsDir(dirname);
while (! pluginsDir.exists("plugins") && pluginsDir.cdUp())
;
if (pluginsDir.cd("plugins"))
{
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
new QPluginLoader(pluginsDir.absoluteFilePath(fileName), this);
}
}

// Populate the menu bar
Expand Down Expand Up @@ -1342,6 +1348,7 @@ QString translationFile(QString localestr, const QString component, QString &ver
QStringList paths;
//qDebug() << QDesktopServices::storageLocation(QDesktopServices::DataLocation);
paths << QDesktopServices::storageLocation(QDesktopServices::DataLocation);
paths << "/usr/lib/postbooks/dict";
paths << "dict";
paths << "";
paths << "../dict";
Expand Down Expand Up @@ -2124,7 +2131,9 @@ void GUIClient::hunspell_initialize()
{
_spellReady = false;
QString langName = QLocale::languageToString(QLocale().language());
QString appPath = QApplication::applicationDirPath();
QString appPath("/usr/lib/postbooks");
if (! QFile::exists(appPath))
appPath = QApplication::applicationDirPath();
QString fullPathWithoutExt = appPath + "/" + langName;
QFile affFile(fullPathWithoutExt + tr(".aff"));
QFile dicFile(fullPathWithoutExt + tr(".dic"));
Expand Down
Loading

0 comments on commit bef2cd4

Please sign in to comment.