[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2999 - gnunet-qt/src/core
From: |
durner |
Subject: |
[GNUnet-SVN] r2999 - gnunet-qt/src/core |
Date: |
Sat, 10 Jun 2006 04:06:17 -0700 (PDT) |
Author: durner
Date: 2006-06-10 04:06:13 -0700 (Sat, 10 Jun 2006)
New Revision: 2999
Modified:
gnunet-qt/src/core/core.pro.in
gnunet-qt/src/core/main.cc
Log:
initalize GNUnet-Util at startup
Modified: gnunet-qt/src/core/core.pro.in
===================================================================
--- gnunet-qt/src/core/core.pro.in 2006-06-10 09:22:11 UTC (rev 2998)
+++ gnunet-qt/src/core/core.pro.in 2006-06-10 11:06:13 UTC (rev 2999)
@@ -2,8 +2,8 @@
TARGET = gnunet_qt
DESTDIR = .
DEPENDPATH += .
-INCLUDEPATH += ../include .
-LIBS += -L../common/ -lgnunetqt_common
+INCLUDEPATH += ../include @top_builddir@ .
+LIBS += -L../common/ -lgnunetqt_common -lgnunetutil
QMAKE_LFLAGS += @LDFLAGS@
QMAKE_LIBS += @LIBS@
QMAKE_CFLAGS += @CPPFLAGS@
Modified: gnunet-qt/src/core/main.cc
===================================================================
--- gnunet-qt/src/core/main.cc 2006-06-10 09:22:11 UTC (rev 2998)
+++ gnunet-qt/src/core/main.cc 2006-06-10 11:06:13 UTC (rev 2999)
@@ -24,7 +24,11 @@
* @author Nils Durner
*/
+#include "config.h"
#include "main.h"
+#include "GNUnet/gnunet_util.h"
+
+#include <QObject>
#include <QSettings>
static GApplication *app;
@@ -45,7 +49,7 @@
while(count)
{
QWidget *child;
- QString strPlugin = plugins.takeLast();
+ QString strPlugin = plugins.takeFirst();
child = loader.load(strPlugin);
if (child)
@@ -60,6 +64,54 @@
wnd.show();
}
+/**
+ * Parse the options, set the timeout.
+ * @param argc the number of options
+ * @param argv the option list (including keywords)
+ * @return SYSERR if we should exit, OK otherwise
+ */
+static int parseOptions(int argc, char ** argv)
+{
+ int c;
+
+ while (1)
+ {
+ int option_index = 0;
+ static struct GNoption long_options[] =
+ {
+ LONG_DEFAULT_OPTIONS,
+ { 0,0,0,0 }
+ };
+ c = GNgetopt_long(argc,
+ argv,
+ "c:hH:L:vd",
+ long_options,
+ &option_index);
+ if (c == -1)
+ break; /* No more flags to process */
+ if (YES == parseDefaultOptions(c, GNoptarg))
+ continue;
+ switch(c)
+ {
+ case 'h':
+ // FIXME: standard printhelp() requires gettext()
+ //printhelp();
+ return SYSERR;
+ case 'v':
+ printf("gnunet-qt v%s\n",
+ VERSION);
+ return SYSERR;
+ default:
+ LOG(LOG_FAILURE,
+ QObject::tr("Use --help to get a list of
options.\n").toLocal8Bit().data());
+ return SYSERR;
+ } /* end of parsing commandline */
+ } /* while (1) */
+ setConfigurationStringList(&argv[GNoptind],
+ argc-GNoptind);
+ return OK;
+}
+
int main(int argc, char **argv)
{
int ret;
@@ -67,10 +119,17 @@
app = new GApplication(argc, argv);
app->loadPlugins();
app->showWindow();
-
+
+ if (SYSERR == initUtil(argc,
+ argv,
+ &parseOptions))
+ return 0;
+
ret = app->exec();
delete app;
+ doneUtil();
+
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2999 - gnunet-qt/src/core,
durner <=