• 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 <kstandarddirs.h>
35#include <tdeversion.h>
36
37#include "karamba.h"
38#include "karambasessionmanaged.h"
39#include "karambainterface.h"
40#include "karamba_python.h"
41
42static const char *description =
43 I18N_NOOP("A TDE Eye-candy Application");
44
45static const char *version = "0.42";
46
47static TDECmdLineOptions options[] =
48{
49 // { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
50 // { "!nosystray", I18N_NOOP("Disable systray icon"), 0 },
51 { "+file", I18N_NOOP("A required argument 'file'"), 0 },
52 { 0, 0, 0 }
53};
54
55// This is for redirecting all tqWarning, tqDebug,... messages to file.
56// Usefull when testing session management issues etc.
57// #define KARAMBA_LOG 1
58
59#ifdef KARAMBA_LOG
60
61void karambaMessageOutput(TQtMsgType type, const char *msg)
62{
63 FILE* fp = fopen("/tmp/karamba.log", "a");
64 if(fp)
65 {
66 pid_t pid = getpid();
67
68 switch ( type )
69 {
70 case QtDebugMsg:
71 fprintf( fp, "Debug (%d): %s\n", pid, msg );
72 break;
73 case QtWarningMsg:
74 if (strncmp(msg, "X Error", 7) != 0)
75 fprintf( fp, "Warning (%d): %s\n", pid, msg );
76 break;
77 case QtFatalMsg:
78 fprintf( fp, "Fatal (%d): %s\n", pid, msg );
79 abort(); // deliberately core dump
80 }
81 fclose(fp);
82 }
83}
84
85#endif
86
87int main(int argc, char **argv)
88{
89#ifdef KARAMBA_LOG
90 qInstallMsgHandler(karambaMessageOutput);
91#endif
92 TDEAboutData about("superkaramba", I18N_NOOP("SuperKaramba"),
93 version, description,
94 TDEAboutData::License_GPL,
95 I18N_NOOP("(c) 2003-2006 The SuperKaramba developers"));
96 about.addAuthor("Adam Geitgey", 0, "adam@rootnode.org");
97 about.addAuthor("Hans Karlsson", 0, "karlsson.h@home.se");
98 about.addAuthor("Ryan Nickell", 0, "p0z3r@earthlink.net");
99 about.addAuthor("Petri Damstén", 0, "petri.damsten@iki.fi");
100 about.addAuthor("Alexander Wiedenbruch", 0, "mail@wiedenbruch.de");
101 about.addAuthor("Luke Kenneth Casson Leighton", 0, "lkcl@lkcl.net");
102 TDECmdLineArgs::init(argc, argv, &about);
103 TDECmdLineArgs::addCmdLineOptions(options);
104 KarambaSessionManaged ksm;
105 //karamba *mainWin = 0;
106 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
107 TQStringList lst;
108 int ret = 0;
109
110 // Create ~/.superkaramba if necessary
111 KarambaApplication::checkSuperKarambaDir();
112
113 KarambaApplication::lockKaramba();
114
115 KarambaApplication app;
116
117 TQString mainAppId = app.getMainKaramba();
118 if(!mainAppId.isEmpty())
119 {
120 app.initDcopStub(mainAppId.ascii());
121 }
122 else
123 {
124 //Set up systray icon
125 app.setUpSysTray(&about);
126 app.initDcopStub();
127 }
128
129 KarambaApplication::unlockKaramba();
130
131 app.connect(tqApp,TQ_SIGNAL(lastWindowClosed()),tqApp,TQ_SLOT(quit()));
132
133 // Try to restore a previous session if applicable.
134 app.checkPreviousSession(app, lst);
135 if( (lst.size() == 0) && !app.isRestored() )
136 {
137 //Not a saved session - check for themes given on command line
138 app.checkCommandLine(args, lst);
139
140 if(lst.size() == 0)
141 {
142 //No themes given on command line and no saved session.
143 //Show welcome dialog.
144 app.globalShowThemeDialog();
145 }
146 }
147
148 args->clear();
149
150 KarambaPython::initPython();
151 //tqDebug("startThemes");
152 if(app.startThemes(lst) || mainAppId.isEmpty())
153 ret = app.exec();
154 KarambaPython::shutdownPython();
155 return ret;
156}

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.4
This website is maintained by Timothy Pearson.