gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7403 - in gnunet-qt/src: common core include plugins/about


From: gnunet
Subject: [GNUnet-SVN] r7403 - in gnunet-qt/src: common core include plugins/about plugins/fs plugins/general plugins/stats
Date: Wed, 9 Jul 2008 12:43:15 -0600 (MDT)

Author: durner
Date: 2008-07-09 12:43:15 -0600 (Wed, 09 Jul 2008)
New Revision: 7403

Added:
   gnunet-qt/src/common/pluginInitParams.h
Modified:
   gnunet-qt/src/common/Makefile.am
   gnunet-qt/src/common/pluginLoader.cc
   gnunet-qt/src/common/pluginLoader.h
   gnunet-qt/src/core/main.cc
   gnunet-qt/src/core/wndMain.cc
   gnunet-qt/src/core/wndMain.h
   gnunet-qt/src/core/wndMain.ui
   gnunet-qt/src/include/gnunet_qt_common.h
   gnunet-qt/src/plugins/about/about.cc
   gnunet-qt/src/plugins/fs/fs.cc
   gnunet-qt/src/plugins/fs/fs.h
   gnunet-qt/src/plugins/general/general.cc
   gnunet-qt/src/plugins/stats/statsPlugin.cc
Log:
put initialization params for plugins into one struct

Modified: gnunet-qt/src/common/Makefile.am
===================================================================
--- gnunet-qt/src/common/Makefile.am    2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/common/Makefile.am    2008-07-09 18:43:15 UTC (rev 7403)
@@ -14,6 +14,7 @@
   itemModel.cc \
   textEditor.cc \
   plugin.h \
+  pluginInitParams.h \
   pluginLoader.h \
   event.h \
   eventDispatcher.h \

Added: gnunet-qt/src/common/pluginInitParams.h
===================================================================
--- gnunet-qt/src/common/pluginInitParams.h                             (rev 0)
+++ gnunet-qt/src/common/pluginInitParams.h     2008-07-09 18:43:15 UTC (rev 
7403)
@@ -0,0 +1,30 @@
+/*
+     This file is part of gnunet-qt.
+     (C) 2008 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.
+*/
+
+#ifndef PLUGINITPARAMS_H_
+#define PLUGINITPARAMS_H_
+
+typedef struct
+{
+  struct GNUNET_GC_Configuration *config;
+  struct GNUNET_GE_Context *errorContext;
+} GPluginInitParams;
+
+#endif /* PLUGINITPARAMS_H_ */

Modified: gnunet-qt/src/common/pluginLoader.cc
===================================================================
--- gnunet-qt/src/common/pluginLoader.cc        2008-07-09 18:33:16 UTC (rev 
7402)
+++ gnunet-qt/src/common/pluginLoader.cc        2008-07-09 18:43:15 UTC (rev 
7403)
@@ -33,12 +33,12 @@
 }
 
 GPlugin *GPluginLoader::load(const QString &strName,
-  struct GNUNET_GC_Configuration *config, struct GNUNET_GE_Context 
*errorContext)
+    GPluginInitParams *params)
 {
   InitPlugin init;
   GPluginSpec spec;
 
-  spec.lib = GNUNET_plugin_load(errorContext, "libgnunetqtmodule_", 
qPrintable(strName));
+  spec.lib = GNUNET_plugin_load(params->errorContext, "libgnunetqtmodule_", 
qPrintable(strName));
   spec.wnd = NULL;
 
   if (spec.lib)
@@ -46,9 +46,9 @@
     plugins.append(spec);
     init = (InitPlugin) GNUNET_plugin_resolve_function(spec.lib, "init_", 
GNUNET_YES);
     if (init)
-      spec.wnd = init(config, errorContext);
+      spec.wnd = init(params);
   }
-    
+
   return spec.wnd;
 }
 
@@ -56,7 +56,7 @@
 {
   ShutdownPlugin shutdown;
   GPluginSpec spec;
-  
+
   int count = plugins.count();
   while (count)
   {
@@ -64,7 +64,7 @@
     shutdown = (ShutdownPlugin) GNUNET_plugin_resolve_function(spec.lib, 
"shutdown_", GNUNET_YES);
     if (shutdown)
       shutdown(spec.wnd);
-    
+
     GNUNET_plugin_unload(spec.lib);
     count--;
   }

Modified: gnunet-qt/src/common/pluginLoader.h
===================================================================
--- gnunet-qt/src/common/pluginLoader.h 2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/common/pluginLoader.h 2008-07-09 18:43:15 UTC (rev 7403)
@@ -30,6 +30,7 @@
 #include <QObject>
 #include <GNUnet/gnunet_util.h>
 
+#include "gnunet_qt_common.h"
 #include "plugin.h"
 
 typedef struct
@@ -42,19 +43,17 @@
 class GPluginLoader : public QObject
 {
   Q_OBJECT
-  
+
 public:
   ~GPluginLoader();
-  GPlugin *load(const QString &strName, struct GNUNET_GC_Configuration *config,
-    struct GNUNET_GE_Context *errorContext);
+  GPlugin *load(const QString &strName, GPluginInitParams *params);
   void unloadAll();
-  
+
 protected:
   QList<GPluginSpec> plugins;
 };
 
-typedef GPlugin *(*InitPlugin) (const struct GNUNET_GC_Configuration *config,
-  const struct GNUNET_GE_Context *errorContext);
+typedef GPlugin *(*InitPlugin) (GPluginInitParams *params);
 typedef void (*ShutdownPlugin) (GPlugin *plugin);
 
 #endif /*PLUGINLOADER_H_*/

Modified: gnunet-qt/src/core/main.cc
===================================================================
--- gnunet-qt/src/core/main.cc  2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/core/main.cc  2008-07-09 18:43:15 UTC (rev 7403)
@@ -85,7 +85,7 @@
     LCID lcid;
     char locale[6];
   } GLcid2Locale;
-  
+
   static const GLcid2Locale Lcid2Locale[] =
   {
     { 0x0436,"af_ZA"},  { 0x041c,"sq_AL"},  { 0x045e,"am_ET"},  { 
0x1401,"ar_DZ"},
@@ -131,20 +131,20 @@
     { 0x042a,"vi_VN"},  { 0x0452,"cy_GB"},  { 0x0488,"wo_SN"},  { 
0x0434,"xh_ZA"},
     { 0x0478,"ii_CN"},  { 0x046a,"yo_NG"},  { 0x0435,"zu_ZA"},  { 0x0000,"C"}
   };
-  
+
   const char *locale()
   {
     GLcid2Locale *entry = (GLcid2Locale *) Lcid2Locale;
     LCID lcid = GetThreadLocale() & 0x7FFF;
-    
+
     while(entry->lcid)
     {
       if (entry->lcid == lcid)
         return entry->locale;
-      
+
       entry++;
     }
-    
+
     return entry->locale;
   }
 #endif
@@ -158,9 +158,9 @@
 static void logger(void *cls, GNUNET_GE_KIND kind, const char *date, const 
char *msg)
 {
   Q_UNUSED(date)
-  
+
   QPixmap icon;
-  
+
   if (kind & GNUNET_GE_DEBUG)
     icon.load(":/pixmaps/debug.png");
   else if (kind & GNUNET_GE_STATUS)
@@ -173,7 +173,7 @@
     icon.load(":/pixmaps/error.png");
   else if (kind & GNUNET_GE_FATAL)
     icon.load(":/pixmaps/fatal.png");
-    
+
   ((GLoggerClosure *) cls)->lock.lock();
   ((GLoggerClosure *) cls)->mainWnd->setStatusText(icon, QString(msg));
   ((GLoggerClosure *) cls)->lock.unlock();
@@ -184,7 +184,7 @@
 {
   this->ectx = NULL;
   this->cfg = cfg;
-  
+
   strCfgFile = cfgFilename;
 }
 
@@ -197,23 +197,27 @@
 {
   int count;
   char *cfgPlugins;
-  
+  GPluginInitParams params;
+
+  params.errorContext = ectx;
+  params.config = cfg;
+
   GNUNET_GC_get_configuration_value_string(cfg, "GNUNET-QT", "PLUGINS", "about 
general fs stats", &cfgPlugins);
   QStringList plugins = QString(cfgPlugins).split(QRegExp("\\s+"));
   count = plugins.count();
-  
+
   while(count)
   {
     QWidget *child;
     QString strPlugin = plugins.takeFirst();
-    
-    child = loader.load(strPlugin, cfg, ectx);
+
+    child = loader.load(strPlugin, &params);
     if (child)
        wnd.addApplication(child, child->windowIcon(), child->windowTitle());
 
     count--;
   }
-  
+
   GNUNET_free(cfgPlugins);
 }
 
@@ -236,7 +240,7 @@
     wnd.setVisible(false);
     return true;
   }
-  
+
   return false;
 }
 #endif
@@ -289,10 +293,10 @@
   ret = app->exec();
 
   delete app;
-  
+
   GNUNET_GE_free_context(ectx);
   GNUNET_fini(stdECtx, cfg);
-  
+
        return ret;
 }
 
@@ -303,22 +307,22 @@
   int argc, ret;
   char **argv, *idx, *line, *start, mod[4097];
   bool quoted, esc;
-  
+
   argc = 0;
   quoted = esc = 0;
   line = strdup(lpCmdLine);
   argv = (char **) malloc(sizeof(char *) * 2);
-  
+
   GetModuleFileNameA(NULL, mod, 4096);
   argv[0] = mod;
   argv[1] = NULL;
   start = line;
-  
+
   for (idx = line; *idx != 0; idx++)
   {
     if (*idx == '"' && (idx == line || *(idx-1) != '\\'))
       quoted = !quoted;
-    
+
     if (!quoted && (*idx == '\t' || *idx == ' '))
     {
       argc++;
@@ -333,7 +337,7 @@
   ret = gn_main(argc + 1, (char * const *) argv);
   free(argv);
   free(line);
-  
+
   return ret;
 }
 #endif

Modified: gnunet-qt/src/core/wndMain.cc
===================================================================
--- gnunet-qt/src/core/wndMain.cc       2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/core/wndMain.cc       2008-07-09 18:43:15 UTC (rev 7403)
@@ -49,7 +49,7 @@
   QHBoxLayout *lay;
   QMenu *trayMenu;
   QAction *trayShow, *trayExit;
-  
+
   setupUi(this);
   delete tabRoot;
 
@@ -66,14 +66,14 @@
   connect(trayExit, SIGNAL(triggered()), qApp, SLOT(quit()));
   trayIcon->setContextMenu(trayMenu);
   trayIcon->show();
-  
+
   QStatusBar *bar = statusBar();
   if (bar)
   {
     lay = new QHBoxLayout();
-    
+
     statusText.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-    
+
     bar->setSizeGripEnabled(false);
 
     lay->addWidget(&statusIcon);
@@ -81,12 +81,12 @@
     lay->addWidget(&networkIcon);
     lay->addWidget(&networkText);
     delete bar->layout();
-    bar->setLayout(lay);    
+    bar->setLayout(lay);
 
     networkIcon.setToolTip(tr("Number of connected peers"));
     networkText.setToolTip(tr("Number of connected peers"));
   }
-  
+
   connect(action_Context_help, SIGNAL(triggered()), this, SLOT(contextHelp()));
   connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));
   connect(actionExit, SIGNAL(triggered()), qApp, SLOT(quit()));
@@ -103,7 +103,7 @@
 void GMainWindow::about()
 {
   GAboutDlg dlg(this);
-  
+
   dlg.exec();
 }
 
@@ -151,7 +151,7 @@
 void GMainWindow::setStatusText(const QPixmap &icon, const QString strText)
 {
   GStatusTextEvent *e;
-  
+
   e = new GStatusTextEvent(QEvent::User);
   e->icon = icon;
   e->text = strText;
@@ -162,18 +162,18 @@
 void GMainWindow::setNetworkStatus(const QPixmap &icon, const QString strText)
 {
   GNetworkStatusEvent *e;
-  
+
   e = new GNetworkStatusEvent(QEvent::User);
   e->icon = icon;
   e->text = strText;
-  
+
   qApp->postEvent(this, e);
 }
 
 bool GMainWindow::event(QEvent *event)
 {
   GStatusTextEvent *e;
-  
+
   e = dynamic_cast<class GNetworkStatusEvent *> (event);
   if (e)
   {
@@ -191,8 +191,16 @@
       return true;
     }
   }
-  
-  return QMainWindow::event(event);  
+
+  return QMainWindow::event(event);
 }
 
+QMenu *GMainWindow::menu(menuType menu)
+{
+  if (menu == FILE)
+    return menu_File;
+  else
+    return menuHelp;
+}
+
 /* end of wndMain.cc */

Modified: gnunet-qt/src/core/wndMain.h
===================================================================
--- gnunet-qt/src/core/wndMain.h        2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/core/wndMain.h        2008-07-09 18:43:15 UTC (rev 7403)
@@ -38,7 +38,7 @@
 class GMainWindow: public QMainWindow, protected Ui::WndMain
 {
   Q_OBJECT
-  
+
 public:
   GMainWindow(QWidget *parent = NULL);
   void addApplication(QWidget *wnd, const QIcon &icon, const QString &label);
@@ -47,6 +47,9 @@
 public:
   QLabel statusIcon, statusText, networkIcon, networkText;
   QSystemTrayIcon *trayIcon;
+
+  typedef enum {FILE, HELP} menuType;
+  QMenu *menu(menuType menu);
 protected:
   virtual bool event(QEvent *event);
 public slots:

Modified: gnunet-qt/src/core/wndMain.ui
===================================================================
--- gnunet-qt/src/core/wndMain.ui       2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/core/wndMain.ui       2008-07-09 18:43:15 UTC (rev 7403)
@@ -46,7 +46,7 @@
    </layout>
   </widget>
   <widget class="QStatusBar" name="statusbar" />
-  <widget class="QMenuBar" name="menuBar" >
+  <widget class="QMenuBar" name="menu_Bar" >
    <property name="geometry" >
     <rect>
      <x>0</x>

Modified: gnunet-qt/src/include/gnunet_qt_common.h
===================================================================
--- gnunet-qt/src/include/gnunet_qt_common.h    2008-07-09 18:33:16 UTC (rev 
7402)
+++ gnunet-qt/src/include/gnunet_qt_common.h    2008-07-09 18:43:15 UTC (rev 
7403)
@@ -37,6 +37,7 @@
 #include "../common/itemModel.h"
 #include "../common/textEditor.h"
 #include "../common/plugin.h"
+#include "../common/pluginInitParams.h"
 #include "../common/pluginLoader.h"
 
 #define GNUNETQT_ASSERT(cond)  do { if (! (cond)) 
gnunet_qt_assert_quit(__FILE__, __LINE__); } while(0);
@@ -73,7 +74,7 @@
    * @brief Capitalize every word in this string
    */
   void proper();
-  
+
  /**
   * @brief Return the content as C string
   */
@@ -83,7 +84,7 @@
   * @brief Return the content as UTF-8 encoded C string
   */
  char *toUtf8CStr();
- 
+
  static GString fromByteSize(qlonglong size);
 protected:
   char *cstr;

Modified: gnunet-qt/src/plugins/about/about.cc
===================================================================
--- gnunet-qt/src/plugins/about/about.cc        2008-07-09 18:33:16 UTC (rev 
7402)
+++ gnunet-qt/src/plugins/about/about.cc        2008-07-09 18:43:15 UTC (rev 
7403)
@@ -32,7 +32,7 @@
 {
   setupUi(this);
   connect(htmAbout, SIGNAL(anchorClicked(const QUrl &)), this, 
SLOT(linkHandler(const QUrl &)));
-  
+
   welcome();
 }
 
@@ -73,7 +73,7 @@
             "</td>"
           "</tr>"
         "</table>"
-        "<br>"  
+        "<br>"
   );
 }
 
@@ -98,13 +98,13 @@
                   "</font>"
                   "<ul>"
                     "<li>" +
-    tr("Anonymous publication and retrieval of individual files as well as 
complete directory structures") +                
+    tr("Anonymous publication and retrieval of individual files as well as 
complete directory structures") +
                     "</li>"
                     "<li>" +
-    tr("Search results with thumbnail previews and extensive content 
information, e.g. author, subject, ...") +                
+    tr("Search results with thumbnail previews and extensive content 
information, e.g. author, subject, ...") +
                     "</li>"
                      "<li>" +
-    tr("GNUnet network statistics") +                
+    tr("GNUnet network statistics") +
                     "</li>"
                   "</ul>"
                 "</font>"
@@ -311,12 +311,10 @@
 extern "C"
 {
 
-GNUNETQT_API GPlugin *init_about(struct GNUNET_GC_Configuration *config,
-  struct GNUNET_GE_Context *errorContext)
+GNUNETQT_API GPlugin *init_about(GPluginInitParams *params)
 {
-  Q_UNUSED(config)
-  Q_UNUSED(errorContext)
-  
+  Q_UNUSED(params)
+
   return new GAboutPlugin();
 }
 

Modified: gnunet-qt/src/plugins/fs/fs.cc
===================================================================
--- gnunet-qt/src/plugins/fs/fs.cc      2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/plugins/fs/fs.cc      2008-07-09 18:43:15 UTC (rev 7403)
@@ -25,6 +25,7 @@
  */
 
 #include <QEvent>
+#include <QMenu>
 #include <QLineEdit>
 #include <QMessageBox>
 #include <QFileDialog>
@@ -47,7 +48,7 @@
 {
   void *ret;
   int i;
-  
+
   GFSSearchController *searchCntrl = ((GFSPlugin *) cls)->searchController();
   GFSUploadController *uploadCntrl = ((GFSPlugin *) cls)->uploadController();
   GFSDownloadController *downloadCntrl = ((GFSPlugin *) 
cls)->downloadController();
@@ -143,14 +144,13 @@
       break;
     default:
       GNUNET_GE_LOG(errorContext, (GNUNET_GE_KIND) (GNUNET_GE_ERROR | 
GNUNET_GE_USER | GNUNET_GE_IMMEDIATE),
-        qPrintable(QObject::tr("Internal error: received unhandled event from 
FSUI.")));      
+        qPrintable(QObject::tr("Internal error: received unhandled event from 
FSUI.")));
   }
 
   return NULL;
 }
 
-GFSPlugin::GFSPlugin(struct GNUNET_GC_Configuration *config,
-  struct GNUNET_GE_Context *errorContext) : GPlugin()
+GFSPlugin::GFSPlugin(GPluginInitParams *params) : GPlugin()
 {
   setupUi(this);
 
@@ -162,17 +162,17 @@
   qRegisterMetaType<GPersistentModelIndexList>("GPersistentModelIndexList");
   qRegisterMetaType<GRanking>("GRanking");
 
-  cfg = config;
-  ectx = errorContext;
-  
+  cfg = params->config;
+  ectx = params->errorContext;
+
   // FS tab
   connect(pbSearch, SIGNAL(clicked(bool)), this, SLOT(searchClicked()));
   connect(cmbSearchFor->lineEdit(), SIGNAL(returnPressed()), this, 
SLOT(searchClicked()));
   searchItemDelegate = new GSearchItemDelegate();
-  
+
   treeDownloads->addAction(actionOpen_download);
   connect(actionOpen_download, SIGNAL(triggered()), this, 
SLOT(openDownloadClicked()));
-  
+
   tabResults->removeTab(0); // created by Qt Designer
   GFSSearch *view = new GFSSearch(this, tabResults);
   view->setEnabled(false);
@@ -190,12 +190,12 @@
 
   // Download
   downloadCntrl = new GFSDownloadController(this);
-  
+
   // Summary
   connect(pbClearDL, SIGNAL(clicked(bool)), this, SLOT(clearDLClicked()));
   connect(pbCancelDL, SIGNAL(clicked(bool)), this, SLOT(cancelDLClicked()));
   connect(pbClearUL, SIGNAL(clicked(bool)), this, SLOT(clearULClicked()));
-  
+
   treeSearches->setColumnWidth(0, 115);
   treeSearches->setColumnWidth(1, 70);
   treeSearches->setColumnWidth(2, 70);
@@ -209,7 +209,7 @@
   treeUploads->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
   /* FIXME: allow user to configure download parallelism */
-  fsuiContext = GNUNET_FSUI_start(errorContext, config, "gnunet_qt", 128, 
GNUNET_YES,
+  fsuiContext = GNUNET_FSUI_start(params->errorContext, params->config, 
"gnunet_qt", 128, GNUNET_YES,
     fsuiEventProcessor, this);
 }
 
@@ -226,12 +226,12 @@
 {
   QModelIndexList sel;
   QModelIndexList::iterator it;
-  
+
   sel = treeDownloads->selectionModel()->selectedIndexes();
   for (it = sel.begin(); it != sel.end(); it++)
   {
     QModelIndex idx = *it;
-    
+
     if (idx.column() == GFSDownloadController::COL_DST_PATH)
     {
       QString name;
@@ -246,10 +246,10 @@
       ShellExecuteA(0, 0, qPrintable(name), 0, 0, SW_SHOWNORMAL);
 #else
       QUrl url;
-      
+
       url.setScheme("file");
       url.setPath(info.absoluteFilePath());
-      
+
       QDesktopServices::openUrl(url);
 #endif
     }
@@ -271,7 +271,7 @@
 
   if (cmbSearchFor->findText(strSearch) == -1)
     cmbSearchFor->addItem(strSearch);
-    
+
   strNS = cmbNS->lineEdit()->text();
 
   /* Create URI */
@@ -279,7 +279,7 @@
   {
     QString strUri;
     char *ustring;
-    
+
     strUri = QString(GNUNET_ECRS_URI_PREFIX) + GNUNET_ECRS_SUBSPACE_INFIX + 
strNS + "/" +
       strSearch;
     ustring = strUri.toLocal8Bit().data();
@@ -294,9 +294,9 @@
 
   if (uri == NULL || searchCntrl->isActive(uri))
     return;
-  
+
   /* Start search */
-  GNUNET_FSUI_search_start(fsuiContext, spinSearchAnon->value(), 
+  GNUNET_FSUI_search_start(fsuiContext, spinSearchAnon->value(),
     uri);
 
   GNUNET_ECRS_uri_destroy(uri);
@@ -335,23 +335,23 @@
 bool GFSPlugin::event(QEvent *e)
 {
   EventType type;
-  
+
   GPlugin::event(e);
-  
+
   GEvent *event = dynamic_cast<class GEvent *> (e);
-  
+
   if (!event)
     return false;
-    
+
   type = (EventType) e->type();
-  
+
   if (type == NewSearch)
   {
     /* Setup new search window */
     GFSSearch *tab;
     int tabIdx;
     GFSNewSearchInfo *info = (GFSNewSearchInfo *) event->getParam();
-    
+
     /* The first tab is always there. Use this one if it isn't used (disabled) 
yet. */
     tab = (GFSSearch *) tabResults->widget(0);
     if (tab->isEnabled())
@@ -367,14 +367,14 @@
       tab->setEnabled(true);
       tabIdx = 0;
     }
-    
+
     tab->setItemDelegate(searchItemDelegate);
     tabResults->setCurrentIndex(tabIdx);
 
     tab->setUri(info->uri);
     tab->setModel(info->model);
     event->setReturn(tab);
-    
+
     return true;
   }
   else if (type == CloseSearch)
@@ -396,20 +396,20 @@
       tabResults->setTabText(0, tr("Search results"));
       lastTab = true;
     }
-    
+
     event->setReturn((void *) lastTab); // wakeup posting thread
   }
-  
+
   return false;
 }
 
 void GFSPlugin::chooseClicked()
 {
   QString strFile;
-    
+
   if (rbFile->isChecked())
     strFile = QFileDialog::getOpenFileName(this,
-      tr("File to publish"), editName->text());    
+      tr("File to publish"), editName->text());
   else
     strFile = QFileDialog::getExistingDirectory(this,
       tr("Choose a directory to publish:"), editName->text()).replace("\"", 
"\\\"");
@@ -427,10 +427,10 @@
   {
     QMessageBox::critical(this, tr("Error"), tr("No filename specified"),
       QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
-      
+
     return;
   }
-  
+
   if (uploadCntrl->start(this, strPath, rbIndex->isChecked(),
     spinPrio->value(), spinUploadAnon->value()))
   {
@@ -460,25 +460,30 @@
 void GFSPlugin::cancelDLClicked()
 {
   typedef QList<struct GNUNET_FSUI_DownloadList *> GCancelList;
-  
+
   QModelIndexList list;
   QModelIndexList::iterator it;
   GCancelList cancelList;
   GCancelList::iterator itCancel;
   QItemSelectionModel *selModel = treeDownloads->selectionModel();
   QAbstractItemModel *dataModel = treeDownloads->model();
-  
+
   list = selModel->selectedRows();
-  
+
   // collect handles of downloads first because indexes shift as rows are 
removed
   for (it = list.begin(); it != list.end(); it++)
     cancelList.push_back((struct GNUNET_FSUI_DownloadList *) 
dataModel->data(*it, Qt::UserRole).value<void *>());
-  
+
   // remove downloads
   for (itCancel = cancelList.begin(); itCancel != cancelList.end(); itCancel++)
     downloadCntrl->cancel(*itCancel);
 }
 
+void GFSPlugin::openURIClicked()
+{
+
+}
+
 void GFSPlugin::clearULClicked()
 {
   uploadCntrl->clear();
@@ -508,7 +513,7 @@
     case GNUNET_FSUI_upload_started:
     case GNUNET_FSUI_unindex_started:
       return tr("started");
-      
+
     case GNUNET_FSUI_search_result:
     case GNUNET_FSUI_download_progress:
     case GNUNET_FSUI_upload_progress:
@@ -548,7 +553,7 @@
     case GNUNET_FSUI_upload_resumed:
     case GNUNET_FSUI_unindex_resumed:
       return tr("resumed");
-      
+
     default:
       return QString();
   }
@@ -556,12 +561,11 @@
 
 extern "C"
 {
-  GNUNETQT_API GPlugin *init_fs(struct GNUNET_GC_Configuration *config,
-    struct GNUNET_GE_Context *errorContext)
+  GNUNETQT_API GPlugin *init_fs(GPluginInitParams *params)
   {
-    return new GFSPlugin(config, errorContext);
+    return new GFSPlugin(params);
   }
-  
+
   GNUNETQT_API void shutdown_fs(GPlugin *plugin)
   {
     delete plugin;

Modified: gnunet-qt/src/plugins/fs/fs.h
===================================================================
--- gnunet-qt/src/plugins/fs/fs.h       2008-07-09 18:33:16 UTC (rev 7402)
+++ gnunet-qt/src/plugins/fs/fs.h       2008-07-09 18:43:15 UTC (rev 7403)
@@ -48,26 +48,25 @@
 class GFSPlugin : public GPlugin, protected Ui::FSWnd
 {
   Q_OBJECT
-  
+
 public:
-  GFSPlugin(struct GNUNET_GC_Configuration *config,
-    struct GNUNET_GE_Context *errorContext);
+  GFSPlugin(GPluginInitParams *params);
   ~GFSPlugin();
-  
+
   typedef enum {NewSearch = QEvent::User, CloseSearch = QEvent::User + 1} 
EventType;
-  
+
   class GFSSearchController *searchController();
   class GFSUploadController *uploadController();
   class GFSDownloadController *downloadController();
   QAbstractItemView *uploadView();
   QTreeView *downloadView();
   QAbstractItemView *searchSummaryView();
-  
+
   struct GNUNET_GC_Configuration *config();
   struct GNUNET_GE_Context *errorContext();
   struct GNUNET_FSUI_Context *context();
   QString fsuiState(GNUNET_FSUI_EventType type);
-  
+
   virtual bool event(QEvent *e);
 
   void download(QPersistentModelIndex &searchIdx, struct 
GNUNET_FSUI_SearchList *handle,
@@ -83,7 +82,7 @@
   struct GNUNET_GE_Context *ectx;
   class GSearchItemDelegate *searchItemDelegate;
 
-public:  
+public:
 signals:
   int setStatusText(const QPixmap &icon, const QString strStatus);
   int setNetworkStatus(const QPixmap &icon, const QString strStatus);
@@ -96,6 +95,7 @@
   void cancelDLClicked();
   void clearULClicked();
   void openDownloadClicked();
+  void openURIClicked();
 };
 
 #endif /*FS_H_*/

Modified: gnunet-qt/src/plugins/general/general.cc
===================================================================
--- gnunet-qt/src/plugins/general/general.cc    2008-07-09 18:33:16 UTC (rev 
7402)
+++ gnunet-qt/src/plugins/general/general.cc    2008-07-09 18:43:15 UTC (rev 
7403)
@@ -33,9 +33,9 @@
     struct GNUNET_GE_Context *errorContext, QObject *parent) : GPlugin()
 {
   Q_UNUSED(parent)
-  
+
   setupUi(this);
-  
+
   startStopThread = new GStartStopThread(config, errorContext);
   checkDaemonThread = new GCheckDaemonThread(config, errorContext);
 
@@ -74,10 +74,10 @@
 void GGeneralPlugin::updateUi()
 {
   QPixmap *pic = new QPixmap();
-  
+
   if (pending)
     return;
-  
+
   if (isRunning)
   {
     pbStartStop->setText(tr("Stop process"));
@@ -101,14 +101,14 @@
 {
   QString strStatus;
   QPixmap icon;
-  
+
   if (success)
   {
     if (isRunning)
       strStatus = tr("Terminating server...");
     else
       strStatus = tr("Launching server...");
-    
+
     icon.load(":/pixmaps/clock.png");
     pbStartStop->setEnabled(false);
 
@@ -121,31 +121,31 @@
       strStatus = tr("Terminating server failed");
     else
       strStatus = tr("Launching server failed: %1").arg(msg);
-      
+
     icon.load(":/pixmaps/error.png");
   }
-      
-  emit setStatusText(icon, strStatus);  
+
+  emit setStatusText(icon, strStatus);
 }
 
 void GGeneralPlugin::applications(GGNUnetAppDescs *apps)
 {
   int count = apps->count();
   QTreeWidgetItem *item;
-  
+
   treeApps->clear();
   while(count)
   {
     GGNUnetAppDesc desc = apps->takeFirst();
     item = new QTreeWidgetItem();
-    
+
     item->setText(0, desc.strApp);
     item->setText(1, desc.strDesc);
     treeApps->addTopLevelItem(item);
-    
+
     count--;
   }
-  
+
   delete apps;
 }
 
@@ -167,14 +167,14 @@
     if (pending)
     {
       QPixmap icon;
-      
+
       pending = false;
       icon.load(":/pixmaps/gnunet-logo-small.png");
-      
+
       emit setStatusText(icon, isRunning ? tr("Server launched") :
         tr("Server terminated"));
     }
-    
+
     this->isRunning = isRunning;
     updateUi();
   }
@@ -182,18 +182,17 @@
 
 extern "C"
 {
-  
-  GNUNETQT_API GPlugin *init_general(struct GNUNET_GC_Configuration *config,
-    struct GNUNET_GE_Context *errorContext)
+
+  GNUNETQT_API GPlugin *init_general(GPluginInitParams *params)
   {
-    return new GGeneralPlugin(config, errorContext);
+    return new GGeneralPlugin(params->config, params->errorContext);
   }
-  
+
   GNUNETQT_API void shutdown_general(GPlugin *plugin)
   {
     delete (GGeneralPlugin *) plugin;
   }
-  
+
 } // extern "C"
 
 /* end of general.cc */

Modified: gnunet-qt/src/plugins/stats/statsPlugin.cc
===================================================================
--- gnunet-qt/src/plugins/stats/statsPlugin.cc  2008-07-09 18:33:16 UTC (rev 
7402)
+++ gnunet-qt/src/plugins/stats/statsPlugin.cc  2008-07-09 18:43:15 UTC (rev 
7403)
@@ -43,14 +43,14 @@
   struct GNUNET_GE_Context *errorContext) : GPlugin()
 {
   setupUi(this);
-  
+
   this->config = config;
   this->errorContext = errorContext;
   statsThread = new GStatsThread(config, errorContext);
-  
+
   connect(statsThread, SIGNAL(stat(QString, qulonglong)), this,
     SLOT(processStat(QString, qulonglong)), Qt::QueuedConnection);
-  
+
   treeStats->setColumnWidth(0, 550);
   statsThread->start();
 }
@@ -70,15 +70,15 @@
     bool found;
 
     found = false;
-    
+
     /* populate statistics tree */
     count = treeStats->topLevelItemCount();
     while (count > 0)
     {
       QTreeWidgetItem *item;
-      
+
       item = treeStats->topLevelItem(count - 1);
-      
+
       if (item->text(0) == strName)
       {
         item->setText(1, QString::number(value));
@@ -86,29 +86,29 @@
       }
       count--;
     }
-    
+
     if (!found)
     {
       QTreeWidgetItem *item = new QTreeWidgetItem(0);
-      
+
       item->setText(0, strName);
       item->setText(1, QString::number(value));
-    
+
       treeStats->addTopLevelItem(item);
     }
-    
+
     /* display # of connected peers in status bar */
     if (strName == "# of connected peers")
     {
       QPixmap icon;
-      
+
       if (value == 0)
         icon.load(":/pixmaps/network-status-offline.png");
       else
       {
         icon.load(":/pixmaps/network-status-online.png");
       }
-  
+
       emit setNetworkStatus(icon, QString::number(value));
     }
 }
@@ -116,18 +116,17 @@
 
 extern "C"
 {
-  
-  GNUNETQT_API GPlugin *init_stats(struct GNUNET_GC_Configuration *config,
-    struct GNUNET_GE_Context *errorContext)
+
+  GNUNETQT_API GPlugin *init_stats(GPluginInitParams *params)
   {
-    return new GStatsPlugin(config, errorContext);
+    return new GStatsPlugin(params->config, params->errorContext);
   }
-  
+
   GNUNETQT_API void shutdown_stats(GPlugin *plugin)
   {
     delete (GStatsPlugin *) plugin;
   }
-  
+
 } // extern "C"
 
 /* enf of statsPlugin.cc */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]