Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Defines | Functions | Variables
main_nix.cpp File Reference
#include <iostream>
#include <signal.h>
#include <qapplication.h>
#include "scribusapp.h"
#include "scribuscore.h"
#include "scribus.h"
#include "scconfig.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BASE_QM   "scribus"

Functions

int mainApp (int argc, char **argv)
 Launches the Gui.
void initCrashHandler ()
static void defaultCrashHandler (int sig)
int main (int argc, char *argv[])

Variables

ScribusCore SCRIBUS_APIScCore
ScribusMainWindow SCRIBUS_APIScMW
ScribusQApp SCRIBUS_APIScQApp
bool emergencyActivated

Define Documentation

#define BASE_QM   "scribus"

Definition at line 33 of file main_nix.cpp.


Function Documentation

void defaultCrashHandler ( int  sig) [static]

Definition at line 109 of file main_nix.cpp.

{
       static int crashRecursionCounter = 0;
       crashRecursionCounter++;
       signal(SIGALRM, SIG_DFL);
       if (crashRecursionCounter < 2)
       {
              emergencyActivated=true;
              crashRecursionCounter++;
              QString sigHdr=QObject::tr("Scribus Crash");
              QString sigLine="-------------";
              QString sigMsg=QObject::tr("Scribus crashes due to Signal #%1").arg(sig);
              std::cout << sigHdr << std::endl;
              std::cout << sigLine << std::endl;
              std::cout << sigMsg << std::endl;
              if (ScribusQApp::useGUI)
              {
                     ScCore->closeSplash();
                     QMessageBox::critical(ScMW, sigHdr, sigMsg, QObject::tr("&OK"));
                     ScMW->emergencySave();
                     ScMW->close();
              }
              alarm(300);
       }
       exit(255);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void initCrashHandler ( )

Definition at line 81 of file main_nix.cpp.

{
       typedef void (*HandlerType)(int);
       HandlerType handler  = 0;
       handler = defaultCrashHandler;
       if (!handler)
              handler = SIG_DFL;
       sigset_t mask;
       sigemptyset(&mask);
#ifdef SIGSEGV
       signal (SIGSEGV, handler);
       sigaddset(&mask, SIGSEGV);
#endif
#ifdef SIGFPE
       signal (SIGFPE, handler);
       sigaddset(&mask, SIGFPE);
#endif
#ifdef SIGILL
       signal (SIGILL, handler);
       sigaddset(&mask, SIGILL);
#endif
#ifdef SIGABRT
       signal (SIGABRT, handler);
       sigaddset(&mask, SIGABRT);
#endif
       sigprocmask(SIG_UNBLOCK, &mask, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 50 of file main_nix.cpp.

{
       return mainApp(argc, argv);
}

Here is the call graph for this function:

int mainApp ( int  argc,
char **  argv 
)

Launches the Gui.

Author:
Franz Schmid
Alessandro Rimoldi
Craig Bradney
Date:
Mon Feb 9 14:07:46 CET 2004
Parameters:
argcNumber of arguments passed to Scribus
argv*argv list of the arguments passed to Scribus
Return values:
intError code from the execution of Scribus

Definition at line 65 of file main_nix.cpp.

{
       emergencyActivated=false;
       ScribusQApp app(argc, argv);
       initCrashHandler();
       app.parseCommandLine();
       if (app.useGUI)
       {
              int appRetVal=app.init();
              if (appRetVal==EXIT_FAILURE)
                     return(EXIT_FAILURE);
              return app.exec();
       }
       return EXIT_SUCCESS; 
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 48 of file main_nix.cpp.

ScribusCore SCRIBUS_API* ScCore

Definition at line 45 of file main_nix.cpp.

ScribusMainWindow SCRIBUS_API* ScMW

Definition at line 46 of file main_nix.cpp.

ScribusQApp SCRIBUS_API* ScQApp

Definition at line 47 of file main_nix.cpp.