• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
main.cpp
1 /*
2  * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
3  * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
4  * Copyright (c) 2005 Ryan Nickell <p0z3r@earthlink.net>
5  *
6  * This file is part of SuperKaramba.
7  *
8  * SuperKaramba is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * SuperKaramba is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with SuperKaramba; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  ****************************************************************************/
22 
23 #include <karambaapp.h>
24 #include <tqobject.h>
25 
26 #include <tdeaboutdata.h>
27 #include <tdecmdlineargs.h>
28 #include <tdelocale.h>
29 #include <tdeconfig.h>
30 #include <tdemainwindow.h>
31 #include <tqfileinfo.h>
32 #include <tqstringlist.h>
33 #include <tdeconfig.h>
34 #include <tdestandarddirs.h>
35 
36 #include "karamba.h"
37 #include "karambasessionmanaged.h"
38 #include "karambainterface.h"
39 #include "karamba_python.h"
40 
41 static const char *description =
42  I18N_NOOP("A TDE Eye-candy Application");
43 
44 static const char *version = "0.42";
45 
46 static TDECmdLineOptions options[] =
47 {
48  // { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
49  // { "!nosystray", I18N_NOOP("Disable systray icon"), 0 },
50  { "+file", I18N_NOOP("A required argument 'file'"), 0 },
51  { 0, 0, 0 }
52 };
53 
54 // This is for redirecting all tqWarning, tqDebug,... messages to file.
55 // Usefull when testing session management issues etc.
56 // #define KARAMBA_LOG 1
57 
58 #ifdef KARAMBA_LOG
59 
60 void karambaMessageOutput(TQtMsgType type, const char *msg)
61 {
62  FILE* fp = fopen("/tmp/karamba.log", "a");
63  if(fp)
64  {
65  pid_t pid = getpid();
66 
67  switch ( type )
68  {
69  case QtDebugMsg:
70  fprintf( fp, "Debug (%d): %s\n", pid, msg );
71  break;
72  case QtWarningMsg:
73  if (strncmp(msg, "X Error", 7) != 0)
74  fprintf( fp, "Warning (%d): %s\n", pid, msg );
75  break;
76  case QtFatalMsg:
77  fprintf( fp, "Fatal (%d): %s\n", pid, msg );
78  abort(); // deliberately core dump
79  }
80  fclose(fp);
81  }
82 }
83 
84 #endif
85 
86 int main(int argc, char **argv)
87 {
88 #ifdef KARAMBA_LOG
89  qInstallMsgHandler(karambaMessageOutput);
90 #endif
91  TDEAboutData about("superkaramba", I18N_NOOP("SuperKaramba"),
92  version, description,
93  TDEAboutData::License_GPL,
94  I18N_NOOP("(c) 2003-2006 The SuperKaramba developers"));
95  about.addAuthor("Adam Geitgey", 0, "adam@rootnode.org");
96  about.addAuthor("Hans Karlsson", 0, "karlsson.h@home.se");
97  about.addAuthor("Ryan Nickell", 0, "p0z3r@earthlink.net");
98  about.addAuthor("Petri Damstén", 0, "petri.damsten@iki.fi");
99  about.addAuthor("Alexander Wiedenbruch", 0, "mail@wiedenbruch.de");
100  about.addAuthor("Luke Kenneth Casson Leighton", 0, "lkcl@lkcl.net");
101  TDECmdLineArgs::init(argc, argv, &about);
102  TDECmdLineArgs::addCmdLineOptions(options);
103  KarambaSessionManaged ksm;
104  //karamba *mainWin = 0;
105  TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
106  TQStringList lst;
107  int ret = 0;
108 
109  // Create ~/.superkaramba if necessary
110  KarambaApplication::checkSuperKarambaDir();
111 
112  KarambaApplication::lockKaramba();
113 
114  KarambaApplication app;
115 
116  TQString mainAppId = app.getMainKaramba();
117  if(!mainAppId.isEmpty())
118  {
119  app.initDcopStub(mainAppId.ascii());
120  }
121  else
122  {
123  //Set up systray icon
124  app.setUpSysTray(&about);
125  app.initDcopStub();
126  }
127 
128  KarambaApplication::unlockKaramba();
129 
130  app.connect(tqApp,TQ_SIGNAL(lastWindowClosed()),tqApp,TQ_SLOT(quit()));
131 
132  // Try to restore a previous session if applicable.
133  app.checkPreviousSession(app, lst);
134  if( (lst.size() == 0) && !app.isRestored() )
135  {
136  //Not a saved session - check for themes given on command line
137  app.checkCommandLine(args, lst);
138 
139  if(lst.size() == 0)
140  {
141  //No themes given on command line and no saved session.
142  //Show welcome dialog.
143  app.globalShowThemeDialog();
144  }
145  }
146 
147  args->clear();
148 
149  KarambaPython::initPython();
150  //tqDebug("startThemes");
151  if(app.startThemes(lst) || mainAppId.isEmpty())
152  ret = app.exec();
153  KarambaPython::shutdownPython();
154  return ret;
155 }

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.9.1
This website is maintained by Timothy Pearson.