[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3081 - in gnunet-qt/src: common include
From: |
durner |
Subject: |
[GNUnet-SVN] r3081 - in gnunet-qt/src: common include |
Date: |
Sat, 1 Jul 2006 03:32:12 -0700 (PDT) |
Author: durner
Date: 2006-07-01 03:32:03 -0700 (Sat, 01 Jul 2006)
New Revision: 3081
Added:
gnunet-qt/src/common/assert.cc
Modified:
gnunet-qt/src/common/common.pro.in
gnunet-qt/src/include/gnunet_qt_common.h
Log:
assertions
Added: gnunet-qt/src/common/assert.cc
===================================================================
--- gnunet-qt/src/common/assert.cc 2006-07-01 03:01:46 UTC (rev 3080)
+++ gnunet-qt/src/common/assert.cc 2006-07-01 10:32:03 UTC (rev 3081)
@@ -0,0 +1,44 @@
+/*
+ This file is part of gnunet-qt.
+ (C) 2006 Nils Durner (and other contributing authors)
+
+ gnunet-qt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ gnunet-qt is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/common/assert.cc
+ * @brief Assertion function for gnunet-qt
+ * @author Nils Durner
+ */
+
+#include <QApplication>
+#include <QMessageBox>
+#include <QString>
+
+void gnunet_qt_assert_quit(char *file, int line)
+{
+ QString strError = QObject::tr("An internal error has occured and gnunet-qt "
+ "will shut down to prevent further damage.\n\nPlease report this problem
to "
+ "the GNUnet developers (see gnunet.org).\n\nDetailed error information: "
+ "assertion failed at %1:%2.")
+ .arg(QString(file)
+ .arg(QString::number(line)));
+
+ QMessageBox::critical(NULL, QObject::tr("Fatal error"), strError);
+ qApp->quit();
+}
+
+/* end of assert.cc */
Modified: gnunet-qt/src/common/common.pro.in
===================================================================
--- gnunet-qt/src/common/common.pro.in 2006-07-01 03:01:46 UTC (rev 3080)
+++ gnunet-qt/src/common/common.pro.in 2006-07-01 10:32:03 UTC (rev 3081)
@@ -8,5 +8,5 @@
INCLUDEPATH = ../include
-SOURCES = pluginLoader.cc gstring.cc
+SOURCES = assert.cc pluginLoader.cc gstring.cc
HEADERS = pluginLoader.h ../include/gnunet_qt_common.h
\ No newline at end of file
Modified: gnunet-qt/src/include/gnunet_qt_common.h
===================================================================
--- gnunet-qt/src/include/gnunet_qt_common.h 2006-07-01 03:01:46 UTC (rev
3080)
+++ gnunet-qt/src/include/gnunet_qt_common.h 2006-07-01 10:32:03 UTC (rev
3081)
@@ -31,12 +31,16 @@
#include <QString>
#include <QLibrary>
+#define GNUNETQT_ASSERT(cond) do { if (! (cond))
gnunet_qt_assert_quit(__FILE__, __LINE__); } while(0);
+
#ifdef Q_OS_WIN32
#define GNUNETQT_API __declspec(dllexport)
#else
#define GNUNETQT_API
#endif
+void gnunet_qt_assert_quit(char *file, int line);
+
typedef struct
{
class QLibrary *lib;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3081 - in gnunet-qt/src: common include,
durner <=