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