main.cpp revision 61629542b22048ae51d3152ea3babb52a9075f19
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* The main() function
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#include "VBoxGlobal.h"
#include "VBoxSelectorWnd.h"
#include "VBoxConsoleWnd.h"
#include <qmessagebox.h>
/// @todo (dmik) later
///* German NLS is builtin */
//#include <vboxgui_de.h>
#include <signal.h>
#include <execinfo.h>
/* get REG_EIP from ucontext.h */
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <ucontext.h>
#ifdef __AMD64__
#else
#endif
/**
* the signal handler that prints out a backtrace of the call stack.
* the code is taken from http://www.linuxjournal.com/article/6391.
*/
void *trace[16];
int i, trace_size = 0;
/* Do something useful with siginfo_t */
Log (("GUI: Got signal %d, faulty address is %p, from %p\n",
else
/* overwrite sigaction with caller's address */
/* skip first stack frame (points here) */
Log (("GUI: [bt] Execution path:\n"));
for (i = 1; i < trace_size; ++i)
exit (0);
}
#endif
{
switch (type)
{
case QtDebugMsg:
break;
case QtWarningMsg:
#ifdef Q_WS_X11
/* Needed for instance for the message ``cannot connect to X server'' */
#endif
break;
case QtFatalMsg:
#ifdef Q_WS_X11
#endif
}
}
#ifdef __DARWIN__
/**
* App bundle tweaks.
*/
static void DarwinInit (void)
{
static struct
{
char path[RTPATH_MAX];
} s;
if (RT_FAILURE (rc))
{
RTPrintf ("RTPathProgram failed!\n");
exit (1);
}
if (!RTEnvGet ("VBOX_XPCOM_HOME"))
}
#endif
{
/* initialize VBox Runtime */
/* install our signal handler to backtrace the call stack */
#endif
#ifdef __DARWIN__
DarwinInit();
#endif
#ifdef Q_WS_X11
/* version check (major.minor are sensitive, fix number is ignored) */
.arg (ver_str_base)
.arg (rt_ver_str);
);
}
#endif
/// @todo (dmik) later
// QTranslator translator(0);
// // German is builtin
// if (strncmp(QTextCodec::locale(), "de", 2) == 0)
// {
// translator.load((const uchar*)vboxgui_de_qm_data, vboxgui_de_qm_len);
// } else
// {
// // try to load from the current directory
// translator.load(QString("vboxgui_") + QTextCodec::locale(), ".");
// }
// a.installTranslator(&translator);
int rc = 1;
if (vboxGlobal().isValid())
{
if (vboxGlobal().isVMConsoleProcess())
{
}
else
{
}
}
return rc;
}