3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
5
* Copyright 1999-2006 by the BibleTime developers.
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
12
/* $Header: /cvsroot/bibletime/bibletime/bibletime/main.cpp,v 1.143 2007/04/02 21:53:48 joachim Exp $ */
13
/* $Revision: 1.143 $ */
21
#include "bibletimeapp.h"
22
#include "bibletime.h"
26
#include "util/scoped_resource.h"
27
#include "util/cresmgr.h"
30
#include "frontend/kstartuplogo.h"
31
#include "frontend/cbtconfig.h"
37
#include <kcmdlineargs.h>
40
#include <kapplication.h>
41
#include <kstandarddirs.h>
42
#include <kinstance.h>
43
#include <kaboutdata.h>
46
bool showDebugMessages = false;
47
BibleTime* bibletime_ptr = 0;
49
void myMessageOutput( QtMsgType type, const char *msg ) {
50
//we use this messagehandler to switch debugging off in final releases
53
if (showDebugMessages) { //only show messages if they are enabled!
54
fprintf( stderr,"(BibleTime %s) Debug: %s\n",VERSION, msg );
58
//if (showDebugMessages) //comment out for releases so users don't get our debug warnings
59
fprintf( stderr,"(BibleTime %s) WARNING: %s\n",VERSION, msg );
62
fprintf( stderr,"(BibleTime %s) _FATAL_: %s\nPlease contact info@bibletime.de and report this bug!",VERSION, msg );
63
abort(); // dump core on purpose
68
static void setSignalHandler(void (*handler)(int));
70
// Crash recovery signal handler
71
static void signalHandler(int sigId) {
72
setSignalHandler(SIG_DFL);
73
fprintf(stderr, "*** BibleTime got signal %d (Exiting)\n", sigId);
74
// try to cleanup all windows
75
if (CBTConfig::get(CBTConfig::crashedLastTime)) {
76
//crashed this time and the execution before this one, probably a bug which occurs every time
77
CBTConfig::set(CBTConfig::crashedTwoTimes, true);
80
//try to restore next time.
81
CBTConfig::set(CBTConfig::crashedLastTime, true);
84
bibletime_ptr->saveSettings();
85
fprintf(stderr, "*** Saving seemed to be successful. If restoring does not work on next startup please use the option --ignore-session\n");
87
::exit(-1); //exit BibleTime
90
// Crash recovery signal handler
91
static void crashHandler(int sigId) {
92
setSignalHandler(SIG_DFL);
93
fprintf(stderr, "*** BibleTime got signal %d (Crashing). Trying to save settings.\n", sigId);
94
if (CBTConfig::get(CBTConfig::crashedLastTime)) {
95
// crashed this time and the execution before this one,
96
// probably a bug which occurs every time
97
CBTConfig::set(CBTConfig::crashedTwoTimes, true);
100
//try to restore next time.
101
CBTConfig::set(CBTConfig::crashedLastTime, true);
104
bibletime_ptr->saveSettings();
105
fprintf(stderr, "*** Saving seemed to be successful. If restoring does not work on next startup please use the option --ignore-session\n");
107
// Return to DrKonqi.
110
static void setSignalHandler(void (*handler)(int)) {
111
signal(SIGKILL, handler);
112
signal(SIGTERM, handler);
113
signal(SIGHUP, handler);
114
KCrash::setEmergencySaveFunction(crashHandler);
118
int main(int argc, char* argv[]) {
119
qInstallMsgHandler( myMessageOutput );
121
//create about data for this application
122
static KCmdLineOptions options[] =
124
{"debug", I18N_NOOP("Enable debug messages"),0},
125
{"ignore-session", I18N_NOOP("Ignore the startup session that was saved when BibleTime was closed the last time."),0},
126
{"open-default-bible <key>", I18N_NOOP("Open the standard Bible with the given key. Use <random> to open at a random position."),0},
127
//{"install-local <path>", I18N_NOOP("Open the SwordSetup dialog to install works from <path>"),0},
131
KAboutData aboutData(
135
I18N_NOOP("Bible study tool for KDE"),
136
KAboutData::License_GPL_V2,
137
I18N_NOOP("(c)1999-2007, The BibleTime Team"),
138
I18N_NOOP("BibleTime is an easy to use but powerful Bible study tool for KDE.\n\nWe are looking for developers and translators.\nIf you'd like to join our team, please send an email to info@bibletime.info."),
139
"http://www.bibletime.info/",
140
"info@bibletime.info"
143
/***********************************************
144
* Active developers (sorted by last name) *
145
************************************************/
146
// Project coordination
147
aboutData.addAuthor("Joachim Ansorg", I18N_NOOP("Project coordinator"), "nospam@joachim-ansorg.de", "http://www.joachim-ansorg.de/");
148
// Second main developer
149
aboutData.addAuthor("Martin Gruner", I18N_NOOP("Frontend, backend"), "mg.pub@gmx.net", "");
151
aboutData.addAuthor("James Ots", I18N_NOOP("Crystal icons, crystal startlogo, webpage"), "me@jamesots.com", "http://www.jamesots.com");
155
/***********************************************
156
* Credits (sorted by last name) *
157
************************************************/
158
// Update to the Romanian GUI translation
159
aboutData.addCredit("Horatiu Alexe", I18N_NOOP("Romanian translation"), "");
160
//highcolor icons, startlogo for BT <= 1.4
161
aboutData.addCredit("David Blue", I18N_NOOP("High contrast template"), "davidslists@gmx.net");
162
//helped out with the installation manager
163
aboutData.addCredit("Tim Brodie", I18N_NOOP("Installation manager"),"tbrodie@displayworksinc.com", "");
164
//first set of icons and the first startup logos
165
aboutData.addCredit("Timothy R. Butler", I18N_NOOP("Icons, startlogo"), "tbutler@uninetsolutions.com", "http://www.uninetsolutions.com");
167
aboutData.addCredit("Jim Campbell", I18N_NOOP("GUI"), "jdc.email@gmail.com", "");
168
//Indexed search, gui improvements
169
aboutData.addCredit("Lee Carpenter", I18N_NOOP("GUI, instant search"),"Lee Carpenter <elc@carpie.net>", "http://www.carpie.net");
170
//Translations into Traditional and Simplified Chinese
171
aboutData.addCredit("Chun-shek Chan", I18N_NOOP("GUI translations into Traditional and Simplified Chinese"), "chunshek@gmail.com", "");
172
//Binary packages of CLucene, BibleTime and Sword for Fedore, SUSE, Mandriva
173
aboutData.addCredit("Jeremy Erickson", I18N_NOOP("Binary packages"), "", "");
174
//Started the Crosswire porject, also contributed some code
175
aboutData.addCredit("Troy A. Griffits", I18N_NOOP("Founder of the Sword project"), "scribe@crosswire.org", "http://www.crosswire.org/");
176
//Sponsored many years the www.bibletime.de domain!
177
aboutData.addCredit("Thomas Hagedorn", I18N_NOOP("Sponsored our internet domain for many years"), "tom@theta-consulting.de", "");
178
//He provided us with the Bible Study HowTo
179
aboutData.addCredit("Bob Harman", I18N_NOOP("Bible Study HowTo"), "ncc@ncchampton.org", "");
180
// and / or search for multiple words, other fixes and improvements
181
aboutData.addCredit("Nikolay Igotti", I18N_NOOP("Search dialog enhancements"), "olonho@hotmail.com", "");
182
// Language codes iso639-1, iso639-2 and SIL language codes
183
aboutData.addCredit("SIL International", I18N_NOOP("Language codes and names"), "", "http://www.ethnologue.com/iso639");
184
//Patch for the mag delay (2007-03-22)
185
aboutData.addCredit("Eeli Kaikkonen", I18N_NOOP("GUI improvements"),"eekaikko@mail.student.oulu.fi", "");
186
//Update the the Finnish GUI translation
187
aboutData.addCredit("Ilpo Kantonen", I18N_NOOP("Finnish translation"),"", "");
188
//Smaller frontend enhancements
189
aboutData.addCredit("Chris Kujawa", I18N_NOOP("Frontend"),"christopher.kujawa@verizon.net", "");
190
//Update to the Czech GUI translation
191
aboutData.addCredit("Pavel Lauko", I18N_NOOP("Czech translation"),"", "");
192
//Smaller searchdialog enhancements
193
aboutData.addCredit("Mark Lybarger", I18N_NOOP("Searchdialog"), "mlybarge@insight.rr.com","");
194
//Polish GUI translation update
195
aboutData.addCredit("Piotr Markiewicz", I18N_NOOP("Polish translation"), "pmarki@o2.pl", "");
196
//Smaller frontend enhancements
197
aboutData.addCredit("Luke Mauldin", I18N_NOOP("Frontend"), "lukeskyfly@txk.net", "");
198
//translated parts of the russian website files
199
aboutData.addCredit("Igor Rykhlin", I18N_NOOP("Russian website translation"), "", "");
200
// update to the Spanish website translation
201
aboutData.addCredit("Gabriel Pérez", I18N_NOOP("Spanish website translation updates"), "", "");
202
//Update to the russian website translation
203
aboutData.addCredit("Igor Plisco", I18N_NOOP("Update to the russian website translation"), "", "");
204
// handbook documentation
205
aboutData.addCredit("Fred Saalbach", I18N_NOOP("Documentation"), "saalbach@sybercom.net", "");
206
// Original Russian website translator
207
aboutData.addCredit("Vlad Savitsky", I18N_NOOP("Russian website translation"), "", "");
208
// comitted search in default bible, opened modules, other smaller things
209
aboutData.addCredit("Gary Sims", I18N_NOOP("Search dialog enhancements"), "gary@garysims.co.uk", "");
210
// Very helpful testing
211
aboutData.addCredit("Wolfgang Stradner", I18N_NOOP("Very helpful and detailed testing"), "wolfgang_stradner@wycliffe.org", "");
212
//The first lead developer
213
aboutData.addCredit("Torsten Uhlmann", I18N_NOOP("The first lead developer"), "", "");
214
//Update of the dutch website translation
215
aboutData.addCredit("Johan van der Lingen", I18N_NOOP("Translation updates for the Dutch GUI, the website and the handbook"), "", "");
216
//French handbook translation
217
aboutData.addCredit("Jean Van Schaftingen", I18N_NOOP("French handbook translation"), "", "");
218
//scoped_ptr and related classes
219
aboutData.addCredit("David White", I18N_NOOP("Helpful source code additions"), "", "http://www.wesnoth.org/");
220
//Translated the GUI into Russian
221
aboutData.addCredit("Dmitry Yurevich", I18N_NOOP("Translated the GUI into Russian"), "", "");
222
//The new keychooser for Bible modules
223
aboutData.addCredit("Mark Zealey", I18N_NOOP("New Bible key choosers"), "mspam@zealey.org", "");
224
//Update to the Spanish GUI translation
225
aboutData.addCredit("Esteban Zeller", I18N_NOOP("Spanish translation"), "", "");
228
//special message so the translator get his credits in the about box, don't remove this!
229
QString dummy = I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"); //translator's name
230
dummy = I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"); //translators eMail
232
KCmdLineArgs::init(argc, argv, &aboutData);
233
KCmdLineArgs::addCmdLineOptions( options );
236
KGlobal::dirs()->addResourceType("BT_pic", "share/apps/bibletime/pics");
237
KGlobal::dirs()->addResourceType("BT_DisplayTemplates", "share/apps/bibletime/display-templates");
239
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
241
// A binary option (on / off)
242
if (args->isSet("debug")) {
243
showDebugMessages = true;
246
if (kapp->isRestored()) {
247
// qWarning("Restoring BibleTime");
248
RESTORE( BibleTime );
251
const bool showIt = CBTConfig::get(CBTConfig::logo);
254
KStartupLogo::createSplash();
255
KStartupLogo::showSplash();
256
KStartupLogo::setStatusMessage( i18n("Starting BibleTime") + QString("...") );
259
setSignalHandler(signalHandler);
261
// compatibility stuff for 1.3, needs to be moved to better place later
262
if (CBTConfig::get(CBTConfig::bibletimeVersion) != VERSION) {
263
KStandardDirs stdDirs;
264
QDir dir(stdDirs.saveLocation("data", "bibletime/"));
265
if (!dir.exists("sessions/") && dir.exists("profiles/")) { //only old dir exists
266
dir.rename("profiles", "sessions");
270
bibletime_ptr = new BibleTime();
272
// a new BibleTime version was installed (maybe a completely new installation)
273
if (CBTConfig::get(CBTConfig::bibletimeVersion) != VERSION) {
274
KStartupLogo::hideSplash();
276
CBTConfig::set(CBTConfig::bibletimeVersion, VERSION);
277
bibletime_ptr->slotSettingsOptions();
281
if (CBTConfig::get(CBTConfig::tips)) {
282
KStartupLogo::hideSplash();
283
bibletime_ptr->slotHelpTipOfDay();
286
// restore the workspace and process command line options
287
app.setMainWidget(bibletime_ptr);
288
bibletime_ptr->show();
289
bibletime_ptr->processCommandline(); //must be done after the bibletime window is visible
292
KStartupLogo::hideSplash();
293
KStartupLogo::deleteSplash();
297
const int ret = app.exec();
299
delete bibletime_ptr;