summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/BTCpack.cmake134
-rw-r--r--cmake/BTDeveloper.cmake16
-rw-r--r--cmake/BTDocumentation.cmake75
-rw-r--r--cmake/BTSourceFileList.cmake (renamed from cmake/bibletime_source_list.cmake)51
-rw-r--r--cmake/BTWinIcon.rc1
-rw-r--r--cmake/config.h.cmake15
-rw-r--r--cmake/platforms/linux/bibletime.desktop.cmake11
-rw-r--r--cmake/platforms/windows/README.txt2
-rw-r--r--cmake/platforms/windows/filemgr.cpp570
9 files changed, 830 insertions, 45 deletions
diff --git a/cmake/BTCpack.cmake b/cmake/BTCpack.cmake
new file mode 100644
index 0000000..e570a5d
--- /dev/null
+++ b/cmake/BTCpack.cmake
@@ -0,0 +1,134 @@
+# This is the CPack section
+# Copied and modified from http://www.vtk.org/Wiki/CMake:Packaging_With_CPack
+
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "BibleTime for Windows svn")
+SET(CPACK_PACKAGE_VENDOR "http://www.bibletime.info")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${BT_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${BT_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${BT_REVISION_PATCH})
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "BibleTime")
+
+######################################################
+# Windows segment
+######################################################
+IF(WIN32 AND NOT UNIX)
+ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+ # There is a bug in NSI that does not handle full unix paths properly. Make
+ # sure there is at least one set of four (4) backlasshes.
+
+ # We need the libraries, and they're not pulled in automatically
+ INCLUDE(${QT_USE_FILE})
+ SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
+ INSTALL(FILES
+ "${QT_LIBRARY_DIR}/QtWebKitd4.dll"
+ "${QT_LIBRARY_DIR}/QtGuid4.dll"
+ "${QT_LIBRARY_DIR}/QtXmld4.dll"
+ "${QT_LIBRARY_DIR}/QtTestd4.dll"
+ "${QT_LIBRARY_DIR}/QtNetworkd4.dll"
+ "${QT_LIBRARY_DIR}/QtCored4.dll"
+ "${QT_LIBRARY_DIR}/phonond4.dll"
+ "${QT_LIBRARY_DIR}/QtSvgd4.dll"
+ DESTINATION "${BT_DESTINATION}"
+ CONFIGURATIONS "Debug"
+ )
+ INSTALL(FILES
+ "${QT_LIBRARY_DIR}/QtWebKit4.dll"
+ "${QT_LIBRARY_DIR}/QtGui4.dll"
+ "${QT_LIBRARY_DIR}/QtXml4.dll"
+ "${QT_LIBRARY_DIR}/QtTest4.dll"
+ "${QT_LIBRARY_DIR}/QtNetwork4.dll"
+ "${QT_LIBRARY_DIR}/QtCore4.dll"
+ "${QT_LIBRARY_DIR}/phonon4.dll"
+ "${QT_LIBRARY_DIR}/QtSvg4.dll"
+ DESTINATION "${BT_DESTINATION}"
+ CONFIGURATIONS "Release"
+ )
+
+ # Qt Plugins
+ INSTALL(FILES
+ "${QT_PLUGINS_DIR}/iconengines/qsvgicon4.dll"
+ DESTINATION "${BT_DESTINATION}/plugins/iconengines"
+ CONFIGURATIONS "Release"
+ )
+ INSTALL(FILES
+ "${QT_PLUGINS_DIR}/imageformats/qgif4.dll"
+ "${QT_PLUGINS_DIR}/imageformats/qico4.dll"
+ "${QT_PLUGINS_DIR}/imageformats/qjpeg4.dll"
+ "${QT_PLUGINS_DIR}/imageformats/qmng4.dll"
+ "${QT_PLUGINS_DIR}/imageformats/qsvg4.dll"
+ "${QT_PLUGINS_DIR}/imageformats/qtiff4.dll"
+ DESTINATION "${BT_DESTINATION}/plugins/imageformats"
+ CONFIGURATIONS "Release"
+ )
+
+ # This adds in the required Windows system libraries
+ INSTALL(PROGRAMS ${MSVC_REDIST} DESTINATION bin)
+ SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
+ ExecWait \\\"$INSTDIR\\\\bin\\\\vcredist_x86.exe /q:a\\\"
+ Delete \\\"$INSTDIR\\\\bin\\\\vcredist_x86.exe\\\"
+ ")
+
+ # add the libsword.dll
+ STRING(REPLACE ".lib" ".dll" SWORD_DLL "${SWORD_LIBRARY}")
+ INSTALL(FILES ${SWORD_DLL} DESTINATION ${BT_DESTINATION}) # This will also take effect in the regular install
+
+ # Some options for the CPack system. These should be pretty self-evident
+ SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\pics\\\\icons\\\\bibletime.png")
+ SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\bibletime.exe")
+ SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} for Windows")
+ SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.bibletime.info")
+ SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.bibletime.info")
+ SET(CPACK_NSIS_CONTACT "bt-devel@crosswire.org")
+ SET(CPACK_NSIS_MODIFY_PATH OFF)
+ SET(CPACK_GENERATOR "NSIS")
+####################################
+# Apple Segment
+####################################
+ELSEIF(APPLE)
+ INCLUDE(${QT_USE_FILE})
+ SET(QT_FRAMEWORKS_USED "QtWebKit"
+ "QtGui"
+ "QtXml"
+ "QtTest"
+ "QtNetwork"
+ "QtCore"
+ "QtSvg")
+ FOREACH(QT_FRAME ${QT_FRAMEWORKS_USED})
+ INSTALL(DIRECTORY
+ "${QT_LIBRARY_DIR}/${QT_FRAME}.framework"
+ DESTINATION "${BT_DESTINATION}/../Library/Frameworks/")
+ ENDFOREACH(QT_FRAME ${QT_FRAMEWORKS_USED})
+ # Other libraries I need
+ INSTALL(FILES "${CLUCENE_LIBRARY}"
+ "${CLUCENE_LIBRARY_DIR}/libclucene.0.0.0.dylib"
+ "${CLUCENE_LIBRARY_DIR}/libclucene.0.dylib"
+ "/opt/local/lib/libcurl.4.dylib"
+ "/opt/local/lib/libssl.0.9.8.dylib"
+ "/opt/local/lib/libcrypto.0.9.8.dylib"
+# "/opt/local/lib/libicui18n.40.dylib"
+# "/opt/local/lib/libicui18n.40.0.dylib"
+# "/opt/local/lib/libicuuc.40.dylib"
+# "/opt/local/lib/libicuuc.40.0.dylib"
+# "/opt/local/lib/libicuio.40.dylib"
+# "/opt/local/lib/libicuio.40.0.dylib"
+# "/opt/local/lib/libicudata.40.dylib"
+# "/opt/local/lib/libicudata.40.0.dylib"
+ "/opt/local/lib/libpng12.0.dylib"
+ DESTINATION "${BT_DESTINATION}/../Library")
+
+ # Qt Plugins
+ INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/iconengines" "${QT_PLUGINS_DIR}/imageformats" DESTINATION "${BT_DESTINATION}/../../plugins")
+ # A file to execute that might get rid of the above mess
+ SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/macos/bt_start.sh")
+ SET(CPACK_BUNDLE_NAME "BibleTime")
+ SET(CPACK_PACKAGE_FILE_NAME "BibleTime_Mac_Beta")
+ SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/macos/Info.plist")
+ SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/macos/BibleTime.icns")
+ SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/macos/BibleTime.icns")
+ SET(CPACK_GENERATOR "Bundle")
+ENDIF(WIN32 AND NOT UNIX)
+
+SET(CPACK_PACKAGE_EXECUTABLES "bibletime" "BibleTime")
+
+INCLUDE(CPack)
diff --git a/cmake/BTDeveloper.cmake b/cmake/BTDeveloper.cmake
new file mode 100644
index 0000000..3293737
--- /dev/null
+++ b/cmake/BTDeveloper.cmake
@@ -0,0 +1,16 @@
+FILE(GLOB_RECURSE ORIG_SOURCE_FILES
+ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
+)
+FOREACH(FILE ${ORIG_SOURCE_FILES})
+ SET(REFORMAT_FILES "${REFORMAT_FILES} ${FILE}")
+ENDFOREACH(FILE ${ORIG_SOURCE_FILES})
+
+SET(ASTYLE_OPTIONS "--indent=spaces=4 --brackets=attach --indent-classes --indent-switches --brackets=break-closing --pad=oper --suffix=none --options=none")
+
+ADD_CUSTOM_TARGET("reformat_codebase"
+ COMMAND "sh" "-c" "astyle ${ASTYLE_OPTIONS} ${REFORMAT_FILES}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/"
+ VERBATIM
+) \ No newline at end of file
diff --git a/cmake/BTDocumentation.cmake b/cmake/BTDocumentation.cmake
new file mode 100644
index 0000000..9e7eca9
--- /dev/null
+++ b/cmake/BTDocumentation.cmake
@@ -0,0 +1,75 @@
+######################################################
+# Update source catalog files (this is the basis for the translator's work)
+# Invoke this with "make messages"
+#
+
+FIND_PROGRAM(QT_LUPDATE_EXECUTABLE
+ NAMES lupdate-qt4 lupdate
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH
+)
+
+FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
+ NAMES lrelease-qt4 lrelease
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH
+)
+
+ADD_CUSTOM_TARGET("messages")
+FOREACH(MESSAGE_LOCALE_LANG ${MESSAGE_LOCALE_LANGS})
+ ADD_CUSTOM_TARGET("messages_${MESSAGE_LOCALE_LANG}"
+ COMMAND ${QT_LUPDATE_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src" -ts "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages/bibletime_ui_${MESSAGE_LOCALE_LANG}.ts")
+ ADD_CUSTOM_TARGET("compile_messages_${MESSAGE_LOCALE_LANG}"
+ COMMAND ${QT_LRELEASE_EXECUTABLE} "bibletime_ui_${MESSAGE_LOCALE_LANG}.ts" -qm "bibletime_ui_${MESSAGE_LOCALE_LANG}.qm"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages/")
+ ADD_DEPENDENCIES("compile_messages_${MESSAGE_LOCALE_LANG}" "messages_${MESSAGE_LOCALE_LANG}")
+ ADD_DEPENDENCIES("messages" "compile_messages_${MESSAGE_LOCALE_LANG}")
+ENDFOREACH(MESSAGE_LOCALE_LANG)
+
+# Template file for translators
+ADD_CUSTOM_TARGET("messages_default"
+ COMMAND ${QT_LUPDATE_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src" -ts "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages/bibletime_ui.ts")
+ADD_DEPENDENCIES(messages "messages_default")
+######################################################
+
+IF(CMAKE_SYSTEM MATCHES "BSD")
+ SET(BT_DOCBOOK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/cmake/docs/docs_freebsd.xsl")
+ELSE(CMAKE_SYSTEM MATCHES "BSD")
+ SET(BT_DOCBOOK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/cmake/docs/docs.xsl")
+ENDIF(CMAKE_SYSTEM MATCHES "BSD")
+
+######################################################
+# Update handbook
+ADD_CUSTOM_TARGET("handbook")
+
+ADD_CUSTOM_TARGET("handbook_translations"
+ COMMAND po4a -v --no-backups -k 0 cmake/docs/handbook_po4a.conf
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
+FOREACH(HANDBOOK_LOCALE_LANG ${HANDBOOK_LOCALE_LANGS} "en")
+ ADD_CUSTOM_TARGET("handbook_${HANDBOOK_LOCALE_LANG}"
+ COMMAND xsltproc --stringparam l10n.gentext.default.language ${HANDBOOK_LOCALE_LANG} ${BT_DOCBOOK_XSL} ../docbook/index.docbook
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/handbook/${HANDBOOK_LOCALE_LANG}/html/")
+ ADD_DEPENDENCIES("handbook_${HANDBOOK_LOCALE_LANG}" "handbook_translations")
+ ADD_DEPENDENCIES("handbook" "handbook_${HANDBOOK_LOCALE_LANG}")
+ENDFOREACH(HANDBOOK_LOCALE_LANG ${HANDBOOK_LOCALE_LANGS})
+######################################################
+
+######################################################
+# Update howto
+ADD_CUSTOM_TARGET("howto")
+ADD_CUSTOM_TARGET("howto_translations"
+ COMMAND po4a -v --no-backups -k 0 cmake/docs/howto_po4a.conf
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+ADD_DEPENDENCIES("howto" "howto_translations")
+
+
+FOREACH(HOWTO_LOCALE_LANG ${HOWTO_LOCALE_LANGS} "en")
+ ADD_CUSTOM_TARGET("howto_${HOWTO_LOCALE_LANG}"
+ COMMAND xsltproc --stringparam l10n.gentext.default.language ${HOWTO_LOCALE_LANG} ${BT_DOCBOOK_XSL} "../docbook/index.docbook"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/howto/${HOWTO_LOCALE_LANG}/html/")
+ ADD_DEPENDENCIES("howto_${HOWTO_LOCALE_LANG}" "howto_translations")
+ ADD_DEPENDENCIES("howto" "howto_${HOWTO_LOCALE_LANG}")
+ENDFOREACH(HOWTO_LOCALE_LANG ${HOWTO_LOCALE_LANGS})
+
+###################################################### \ No newline at end of file
diff --git a/cmake/bibletime_source_list.cmake b/cmake/BTSourceFileList.cmake
index 20e7135..45ad65c 100644
--- a/cmake/bibletime_source_list.cmake
+++ b/cmake/BTSourceFileList.cmake
@@ -8,7 +8,9 @@ SET(bibletime_SOURCES
#backend bookshelf model:
src/backend/bookshelfmodel/btbookshelfmodel.cpp
src/backend/bookshelfmodel/btbookshelftreemodel.cpp
- src/backend/bookshelfmodel/btcheckstatefilterproxymodel.cpp
+# src/backend/bookshelfmodel/btcheckstatefilterproxymodel.cpp
+# src/backend/bookshelfmodel/btmodulecategoryfilterproxymodel.cpp
+ src/backend/bookshelfmodel/btmodulehiddenfilterproxymodel.cpp
src/backend/bookshelfmodel/btmodulenamefilterproxymodel.cpp
src/backend/bookshelfmodel/categoryitem.cpp
src/backend/bookshelfmodel/distributionitem.cpp
@@ -18,6 +20,7 @@ SET(bibletime_SOURCES
#backend filters
src/backend/filters/bt_gbfhtml.cpp
src/backend/filters/bt_osishtml.cpp
+ src/backend/filters/bt_teihtml.cpp
src/backend/filters/bt_plainhtml.cpp
src/backend/filters/bt_thmlhtml.cpp
src/backend/filters/bt_thmlplain.cpp
@@ -34,7 +37,7 @@ SET(bibletime_SOURCES
src/backend/managers/btstringmgr.cpp
src/backend/managers/cdisplaytemplatemgr.cpp
src/backend/managers/clanguagemgr.cpp
- src/backend/managers/creferencemanager.cpp
+ src/backend/managers/referencemanager.cpp
src/backend/managers/cswordbackend.cpp
#backend module drivers
src/backend/drivers/cswordmoduleinfo.cpp
@@ -56,11 +59,11 @@ SET(bibletime_SOURCES
#utilities
src/util/cresmgr.cpp
src/util/cpointers.cpp
- src/util/ctoolclass.cpp
+ src/util/tool.cpp
src/util/dialogutil.cpp
- src/util/directoryutil.cpp
+ src/util/directory.cpp
src/util/migrationutil.cpp
-
+
# frontend top level
src/frontend/btbookshelfdockwidget.cpp
src/frontend/cdragdrop.cpp
@@ -76,23 +79,17 @@ SET(bibletime_SOURCES
# Bookshelf/Bookmarks widget in main window
src/frontend/mainindex/btbookshelfview.cpp
-
+
src/frontend/mainindex/bookmarks/cbookmarkindex.cpp
src/frontend/mainindex/bookmarks/btbookmarkloader.cpp
src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp
src/frontend/mainindex/bookmarks/btbookmarkitem.cpp
src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp
- src/frontend/mainindex/bookshelf/cbookshelfindex.cpp
- src/frontend/mainindex/bookshelf/btindexitem.cpp
- src/frontend/mainindex/bookshelf/btindexmodule.cpp
- src/frontend/mainindex/bookshelf/btindexfolder.cpp
- src/frontend/mainindex/bookshelf/chidemodulechooserdialog.cpp
-
#Settings dialog (configuration)
- src/frontend/settingsdialogs/btshortcutsdialog.cpp
- src/frontend/settingsdialogs/btshortcutseditor.cpp
- src/frontend/settingsdialogs/cacceleratorsettings.cpp
+ src/frontend/settingsdialogs/btshortcutsdialog.cpp
+ src/frontend/settingsdialogs/btshortcutseditor.cpp
+ src/frontend/settingsdialogs/cacceleratorsettings.cpp
src/frontend/settingsdialogs/cdisplaysettings.cpp
src/frontend/settingsdialogs/cswordsettings.cpp
src/frontend/settingsdialogs/clanguagesettings.cpp
@@ -118,15 +115,17 @@ SET(bibletime_SOURCES
src/frontend/bookshelfmanager/removepage/btremovepage.cpp
src/frontend/bookshelfmanager/indexpage/btindexpage.cpp
- #Search dialog
- src/frontend/searchdialog/csearchdialog.cpp
- src/frontend/searchdialog/csearchresultview.cpp
- src/frontend/searchdialog/btsearchresultarea.cpp
+ # Search dialog
src/frontend/searchdialog/btsearchoptionsarea.cpp
+ src/frontend/searchdialog/btsearchresultarea.cpp
src/frontend/searchdialog/chistorycombobox.cpp
src/frontend/searchdialog/cmoduleresultview.cpp
- src/frontend/searchdialog/csearchmodulechooserdialog.cpp
src/frontend/searchdialog/crangechooserdialog.cpp
+ src/frontend/searchdialog/csearchdialog.cpp
+ src/frontend/searchdialog/csearchmodulechooserdialog.cpp
+ src/frontend/searchdialog/csearchresultview.cpp
+
+ # Search analysis
src/frontend/searchdialog/analysis/csearchanalysisitem.cpp
src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp
src/frontend/searchdialog/analysis/csearchanalysisscene.cpp
@@ -153,7 +152,7 @@ SET(bibletime_SOURCES
src/frontend/keychooser/versekeychooser/btversekeymenu.cpp
src/frontend/keychooser/bthistory.cpp
-
+
#behaviour for display areas
src/frontend/display/bthtmlfindtext.cpp
src/frontend/display/bthtmljsobject.cpp
@@ -165,7 +164,7 @@ SET(bibletime_SOURCES
src/frontend/display/chtmlwritedisplay.cpp
src/frontend/display/btfontsizewidget.cpp
src/frontend/display/btcolorwidget.cpp
-
+
#display windows and their widgets
src/frontend/displaywindow/bttoolbarpopupaction.cpp
src/frontend/displaywindow/btactioncollection.cpp
@@ -182,7 +181,7 @@ SET(bibletime_SOURCES
src/frontend/displaywindow/ccommentaryreadwindow.cpp
src/frontend/displaywindow/cbookreadwindow.cpp
src/frontend/displaywindow/cdisplaywindowfactory.cpp
-
+
# web based tab dialogs
src/frontend/htmldialogs/btaboutdialog.cpp
src/frontend/htmldialogs/bttabhtmldialog.cpp
@@ -201,7 +200,9 @@ SET(bibletime_SOURCES
SET(bibletime_MOCABLE_HEADERS
src/backend/bookshelfmodel/btbookshelfmodel.h
src/backend/bookshelfmodel/btbookshelftreemodel.h
- src/backend/bookshelfmodel/btcheckstatefilterproxymodel.h
+# src/backend/bookshelfmodel/btcheckstatefilterproxymodel.h
+# src/backend/bookshelfmodel/btmodulecategoryfilterproxymodel.h
+ src/backend/bookshelfmodel/btmodulehiddenfilterproxymodel.h
src/backend/bookshelfmodel/btmodulenamefilterproxymodel.h
src/backend/drivers/cswordmoduleinfo.h
src/backend/managers/cswordbackend.h
@@ -220,8 +221,6 @@ SET(bibletime_MOCABLE_HEADERS
src/frontend/searchdialog/csearchresultview.h
src/frontend/searchdialog/chistorycombobox.h
src/frontend/cdragdrop.h
- src/frontend/mainindex/bookshelf/chidemodulechooserdialog.h
- src/frontend/mainindex/bookshelf/cbookshelfindex.h
src/frontend/mainindex/btbookshelfview.h
src/frontend/mainindex/bookmarks/cbookmarkindex.h
src/frontend/cmdiarea.h
diff --git a/cmake/BTWinIcon.rc b/cmake/BTWinIcon.rc
new file mode 100644
index 0000000..87a81e8
--- /dev/null
+++ b/cmake/BTWinIcon.rc
@@ -0,0 +1 @@
+IDI_ICON1 ICON DISCARDABLE "..\\pics\\icons\\bibletime.ico" \ No newline at end of file
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
deleted file mode 100644
index 721e8a4..0000000
--- a/cmake/config.h.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef CONFIG_H_CMAKE
-#define CONFIG_H_CMAKE
-
-#define BT_VERSION "${BT_VERSION}"
-
-#endif //CONFIG_H_CMAKE
diff --git a/cmake/platforms/linux/bibletime.desktop.cmake b/cmake/platforms/linux/bibletime.desktop.cmake
index a668d0b..15dd6d1 100644
--- a/cmake/platforms/linux/bibletime.desktop.cmake
+++ b/cmake/platforms/linux/bibletime.desktop.cmake
@@ -4,7 +4,10 @@ Comment[C]=An easy to use bible study tool
Comment[cs]=Snadno pouiteln n�troj pro studium Bible
Comment[da]=Et letanvendeligt bibelstudieprogram
Comment[de]=Ein einfach zu benutzendes Bibelprogramm
-Comment[fr]=Un outil d'�ude biblique facile �utiliser
+Comment[et]=Lihtne Piibliuurimise vahend
+Comment[fi]=Helppokäyttöinen raamatunlukuohjelmisto
+Comment[fr]=Un outil d'éde biblique facile àtiliser
+Comment[it]=Un semplice strumento per studiare la Bibbia
Exec=bibletime
Icon=bibletime
MimeType=
@@ -13,11 +16,11 @@ Name[C]=BibleTime ${BT_VERSION}
Name[cs]=BibleTime ${BT_VERSION}
Name[da]=Bibletime ${BT_VERSION}
Name[de]=BibleTime ${BT_VERSION}
+Name[et]=BibleTime ${BT_VERSION}
Name[fr]=BibleTime ${BT_VERSION}
+Name[it]=BibleTime ${BT_VERSION}
GenericName=Bible Study Tool
Terminal=false
Type=Application
-X-KDE-SubstituteUID=false
-X-KDE-Username=
-Categories=X-Bible;X-Religion;Literature;Art;Education;Utility;KDE;Qt;
+Categories=X-Bible;X-Religion;Literature;Education;Dictionary;Qt
DocPath=bibletime/handbook/index.html
diff --git a/cmake/platforms/windows/README.txt b/cmake/platforms/windows/README.txt
new file mode 100644
index 0000000..4810a98
--- /dev/null
+++ b/cmake/platforms/windows/README.txt
@@ -0,0 +1,2 @@
+
+The filemgr.cpp in this directory should be copied into the sword/src/mgr directory and overwrite the filemgr.cpp in that directory.
diff --git a/cmake/platforms/windows/filemgr.cpp b/cmake/platforms/windows/filemgr.cpp
new file mode 100644
index 0000000..11c2800
--- /dev/null
+++ b/cmake/platforms/windows/filemgr.cpp
@@ -0,0 +1,570 @@
+/******************************************************************************
+ * filemgr.cpp - implementation of class FileMgr used for pooling file
+ * handles
+ *
+ * $Id: filemgr.cpp 2245 2009-02-10 23:22:28Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <filemgr.h>
+#include <utilstr.h>
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <swbuf.h>
+#if !defined(__GNUC__) && !defined(_WIN32_WCE)
+#include <io.h>
+#include <direct.h>
+#else
+#include <unistd.h>
+#endif
+
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifndef S_IRGRP
+#define S_IRGRP 0
+#endif
+
+#ifndef S_IROTH
+#define S_IROTH 0
+#endif
+
+// Fix for VC6
+#ifndef S_IREAD
+#ifdef _S_IREAD
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#endif
+#endif
+// -----------
+
+
+SWORD_NAMESPACE_START
+
+
+int FileMgr::CREAT = O_CREAT;
+int FileMgr::APPEND = O_APPEND;
+int FileMgr::TRUNC = O_TRUNC;
+int FileMgr::RDONLY = O_RDONLY;
+int FileMgr::RDWR = O_RDWR;
+int FileMgr::WRONLY = O_WRONLY;
+int FileMgr::IREAD = S_IREAD;
+int FileMgr::IWRITE = S_IWRITE;
+
+
+// ---------------- statics -----------------
+FileMgr *FileMgr::systemFileMgr = 0;
+
+class __staticsystemFileMgr {
+public:
+ __staticsystemFileMgr() { }
+ ~__staticsystemFileMgr() { delete FileMgr::systemFileMgr; }
+} _staticsystemFileMgr;
+
+
+FileMgr *FileMgr::getSystemFileMgr() {
+ if (!systemFileMgr)
+ systemFileMgr = new FileMgr();
+
+ return systemFileMgr;
+}
+
+
+void FileMgr::setSystemFileMgr(FileMgr *newFileMgr) {
+ if (systemFileMgr)
+ delete systemFileMgr;
+ systemFileMgr = newFileMgr;
+}
+
+// --------------- end statics --------------
+
+
+FileDesc::FileDesc(FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade) {
+ this->parent = parent;
+ this->path = 0;
+ stdstr(&this->path, path);
+ this->mode = mode;
+ this->perms = perms;
+ this->tryDowngrade = tryDowngrade;
+ offset = 0;
+ fd = -77;
+}
+
+
+FileDesc::~FileDesc() {
+ if (fd > 0)
+ close(fd);
+
+ if (path)
+ delete [] path;
+}
+
+
+int FileDesc::getFd() {
+ if (fd == -77)
+ fd = parent->sysOpen(this);
+// if ((fd < -1) && (fd != -77)) // kludge to hand ce
+// return 777;
+ return fd;
+}
+
+
+long FileDesc::seek(long offset, int whence) {
+ return lseek(getFd(), offset, whence);
+}
+
+
+long FileDesc::read(void *buf, long count) {
+ int fd = getFd();
+ if (fd < 0) {
+ return 0;
+ }
+ return ::read(fd, buf, count);
+}
+
+
+long FileDesc::write(const void *buf, long count) {
+ return ::write(getFd(), buf, count);
+}
+
+
+FileMgr::FileMgr(int maxFiles) {
+ this->maxFiles = maxFiles; // must be at least 2
+ files = 0;
+}
+
+
+FileMgr::~FileMgr() {
+ FileDesc *tmp;
+
+ while(files) {
+ tmp = files->next;
+ delete files;
+ files = tmp;
+ }
+}
+
+
+FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
+ return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
+}
+
+
+FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
+ FileDesc **tmp, *tmp2;
+
+ for (tmp = &files; *tmp; tmp = &((*tmp)->next)) {
+ if ((*tmp)->fd < 0) // insert as first non-system_open file
+ break;
+ }
+
+ tmp2 = new FileDesc(this, path, mode, perms, tryDowngrade);
+ tmp2->next = *tmp;
+ *tmp = tmp2;
+
+ return tmp2;
+}
+
+
+void FileMgr::close(FileDesc *file) {
+ FileDesc **loop;
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if (*loop == file) {
+ *loop = (*loop)->next;
+ delete file;
+ break;
+ }
+ }
+}
+
+
+int FileMgr::sysOpen(FileDesc *file) {
+ FileDesc **loop;
+ int openCount = 1; // because we are presently opening 1 file, and we need to be sure to close files to accomodate, if necessary
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+
+ if ((*loop)->fd > 0) {
+ if (++openCount > maxFiles) {
+ (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
+ ::close((*loop)->fd);
+ (*loop)->fd = -77;
+ }
+ }
+
+ if (*loop == file) {
+ if (*loop != files) {
+ *loop = (*loop)->next;
+ file->next = files;
+ files = file;
+ }
+ if ((!access(file->path, 04)) || ((file->mode & O_CREAT) == O_CREAT)) { // check for at least file exists / read access before we try to open
+ char tries = (((file->mode & O_RDWR) == O_RDWR) && (file->tryDowngrade)) ? 2 : 1; // try read/write if possible
+ for (int i = 0; i < tries; i++) {
+ if (i > 0) {
+ file->mode = (file->mode & ~O_RDWR); // remove write access
+ file->mode = (file->mode | O_RDONLY);// add read access
+ }
+ file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
+
+ if (file->fd >= 0)
+ break;
+ }
+
+ if (file->fd >= 0)
+ lseek(file->fd, file->offset, SEEK_SET);
+ }
+ else file->fd = -1;
+ if (!*loop)
+ break;
+ }
+ }
+ return file->fd;
+}
+
+
+// to truncate a file at its current position
+// leaving byte at current possition intact
+// deleting everything afterward.
+signed char FileMgr::trunc(FileDesc *file) {
+
+ static const char *writeTest = "x";
+ long size = file->seek(1, SEEK_CUR);
+ if (size == 1) // was empty
+ size = 0;
+ char nibble [ 32767 ];
+ bool writable = file->write(writeTest, 1);
+ int bytes = 0;
+
+ if (writable) {
+ // get tmpfilename
+ char *buf = new char [ strlen(file->path) + 10 ];
+ int i;
+ for (i = 0; i < 9999; i++) {
+ sprintf(buf, "%stmp%.4d", file->path, i);
+ if (!existsFile(buf))
+ break;
+ }
+ if (i == 9999)
+ return -2;
+
+ int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ if (fd < 0)
+ return -3;
+
+ file->seek(0, SEEK_SET);
+ while (size > 0) {
+ bytes = file->read(nibble, 32767);
+ write(fd, nibble, (bytes < size)?bytes:size);
+ size -= bytes;
+ }
+ // zero out the file
+ ::close(file->fd);
+ file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ ::close(file->fd);
+ file->fd = -77; // force file open by filemgr
+ // copy tmp file back (dumb, but must preserve file permissions)
+ lseek(fd, 0, SEEK_SET);
+ do {
+ bytes = read(fd, nibble, 32767);
+ file->write(nibble, bytes);
+ } while (bytes == 32767);
+
+ ::close(fd);
+ ::close(file->fd);
+ removeFile(buf); // remove our tmp file
+ file->fd = -77; // causes file to be swapped out forcing open on next call to getFd()
+ }
+ else { // put offset back and return failure
+ file->seek(-1, SEEK_CUR);
+ return -1;
+ }
+ return 0;
+}
+
+
+signed char FileMgr::existsFile(const char *ipath, const char *ifileName)
+{
+ int len = strlen(ipath) + ((ifileName)?strlen(ifileName):0) + 3;
+ char *ch;
+ char *path = new char [ len ];
+ strcpy(path, ipath);
+
+ if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
+ path[strlen(path)-1] = 0;
+
+ if (ifileName) {
+ ch = path + strlen(path);
+ sprintf(ch, "/%s", ifileName);
+ }
+ signed char retVal = !access(path, 04);
+ delete [] path;
+ return retVal;
+}
+
+
+signed char FileMgr::existsDir(const char *ipath, const char *idirName)
+{
+ char *ch;
+ int len = strlen(ipath) + ((idirName)?strlen(idirName):0) + 1;
+ if (idirName)
+ len += strlen(idirName);
+ char *path = new char [ len ];
+ strcpy(path, ipath);
+
+ if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
+ path[strlen(path)-1] = 0;
+
+ if (idirName) {
+ ch = path + strlen(path);
+ sprintf(ch, "/%s", idirName);
+ }
+ signed char retVal = !access(path, 04);
+ delete [] path;
+ return retVal;
+}
+
+
+int FileMgr::createParent(const char *pName) {
+ char *buf = new char [ strlen(pName) + 1 ];
+ int retCode = 0;
+
+ strcpy(buf, pName);
+ int end = strlen(buf) - 1;
+ while (end) {
+ if ((buf[end] == '/') || (buf[end] == '\\'))
+ break;
+ end--;
+ }
+ buf[end] = 0;
+ if (strlen(buf)>0) {
+ if (access(buf, 02)) { // not exists with write access?
+ if ((retCode = mkdir(buf
+#ifndef WIN32
+ , 0755
+#endif
+ ))) {
+ createParent(buf);
+ retCode = mkdir(buf
+#ifndef WIN32
+ , 0755
+#endif
+ );
+ }
+ }
+ }
+ else retCode = -1;
+ delete [] buf;
+ return retCode;
+}
+
+
+int FileMgr::openFileReadOnly(const char *fName) {
+ int fd = ::open(fName, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ return fd;
+}
+
+
+int FileMgr::createPathAndFile(const char *fName) {
+ int fd;
+
+ fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ if (fd < 1) {
+ createParent(fName);
+ fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ }
+ return fd;
+}
+
+
+int FileMgr::copyFile(const char *sourceFile, const char *targetFile) {
+ int sfd, dfd, len;
+ char buf[4096];
+
+ if ((sfd = ::open(sourceFile, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH)) < 1)
+ return -1;
+ if ((dfd = createPathAndFile(targetFile)) < 1)
+ return -1;
+
+ do {
+ len = read(sfd, buf, 4096);
+ write(dfd, buf, len);
+ }
+ while(len == 4096);
+ ::close(dfd);
+ ::close(sfd);
+
+ return 0;
+}
+
+
+int FileMgr::removeFile(const char *fName) {
+ return ::remove(fName);
+}
+
+char FileMgr::getLine(FileDesc *fDesc, SWBuf &line) {
+ int len;
+ bool more = true;
+ char chunk[255];
+
+ line = "";
+
+ // assert we have a valid file handle
+ if (fDesc->getFd() < 1)
+ return 0;
+
+ while (more) {
+ more = false;
+ long index = fDesc->seek(0, SEEK_CUR);
+ len = fDesc->read(chunk, 254);
+
+ // assert we have a readable file (not a directory)
+ if (len < 1)
+ break;
+
+ int start = 0;
+ // clean up any preceding white space if we're at the beginning of line
+ if (!line.length()) {
+ for (;start < len; start++) {
+ if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
+ break;
+ }
+ }
+
+ // find the end
+ int end;
+ for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
+
+ if ((chunk[end] != 10) && (len == 254)) {
+ more = true;
+ }
+ index += (end + 1);
+
+ // reposition to next valid place to read
+ fDesc->seek(index, SEEK_SET);
+
+ // clean up any trailing junk on line if we're at the end
+ if (!more) {
+ for (; end > start; end--) {
+ if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
+ if (chunk[end] == '\\') {
+ more = true;
+ end--;
+ }
+ break;
+ }
+ }
+ }
+
+ int size = (end - start) + 1;
+
+ if (size > 0) {
+ // line.appendFormatted("%.*s", size, chunk+start);
+ line.append(chunk+start, size);
+ }
+ }
+ return ((len > 0) || line.length());
+}
+
+
+char FileMgr::isDirectory(const char *path) {
+ struct stat stats;
+ if (stat(path, &stats))
+ return 0;
+ return ((stats.st_mode & S_IFDIR) == S_IFDIR);
+}
+
+
+int FileMgr::copyDir(const char *srcDir, const char *destDir) {
+ DIR *dir;
+ struct dirent *ent;
+ if ((dir = opendir(srcDir))) {
+ rewinddir(dir);
+ while ((ent = readdir(dir))) {
+ if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
+ SWBuf srcPath = (SWBuf)srcDir + (SWBuf)"/" + ent->d_name;
+ SWBuf destPath = (SWBuf)destDir + (SWBuf)"/" + ent->d_name;
+ if (!isDirectory(srcPath.c_str())) {
+ copyFile(srcPath.c_str(), destPath.c_str());
+ }
+ else {
+ copyDir(srcPath.c_str(), destPath.c_str());
+ }
+ }
+ }
+ closedir(dir);
+ }
+ return 0;
+}
+
+
+int FileMgr::removeDir(const char *targetDir) {
+ DIR *dir = opendir(targetDir);
+ struct dirent *ent;
+ if (dir) {
+ rewinddir(dir);
+ while ((ent = readdir(dir))) {
+ if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
+ SWBuf targetPath = (SWBuf)targetDir + (SWBuf)"/" + ent->d_name;
+ if (!isDirectory(targetPath.c_str())) {
+ FileMgr::removeFile(targetPath.c_str());
+ }
+ else {
+ removeDir(targetPath.c_str());
+ }
+ }
+ }
+ closedir(dir);
+ removeFile(targetDir);
+ }
+ return 0;
+}
+
+
+void FileMgr::flush() {
+ FileDesc **loop;
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
+ ::close((*loop)->fd);
+ (*loop)->fd = -77;
+ }
+ }
+}
+
+long FileMgr::resourceConsumption() {
+ long count = 0;
+ FileDesc **loop;
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ count++;
+ }
+ }
+ return count;
+}
+
+
+SWORD_NAMESPACE_END