gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7388 - gnunet-qt/src/plugins/fs


From: gnunet
Subject: [GNUnet-SVN] r7388 - gnunet-qt/src/plugins/fs
Date: Sun, 6 Jul 2008 03:32:17 -0600 (MDT)

Author: durner
Date: 2008-07-06 03:32:17 -0600 (Sun, 06 Jul 2008)
New Revision: 7388

Modified:
   gnunet-qt/src/plugins/fs/searchController.cc
Log:
format

Modified: gnunet-qt/src/plugins/fs/searchController.cc
===================================================================
--- gnunet-qt/src/plugins/fs/searchController.cc        2008-07-05 19:58:07 UTC 
(rev 7387)
+++ gnunet-qt/src/plugins/fs/searchController.cc        2008-07-06 09:32:17 UTC 
(rev 7388)
@@ -52,13 +52,13 @@
   model = (GItemModel *) rowIndex->model();
   model->lock();
   idx = model->index(rowIndex->row(), MODEL_IDX(type), rowIndex->parent());
-  
+
   content = model->data(idx).toString();
 
   if (content != "")
     content += "\n";
   content += QString::fromUtf8(data);
-  
+
   model->setData(idx, QVariant(content), Qt::DisplayRole);
   model->unlock();
 
@@ -78,27 +78,27 @@
   info.model = new GItemModel;
   info.uri = uri;
   event = new GEvent((QEvent::Type) GFSPlugin::NewSearch, &info, (void **) 
&view, &sem);
-  
+
   GEventDispatcher::postEvent(fs, event);
   sem.acquire(1); // wait until event is processed
-  
+
   searches.insert(info.uri, list);
-  
+
   connect(view, SIGNAL(closeSearchWnd(GFSEcrsUri &)), this, 
SLOT(closed(GFSEcrsUri &)));
   connect(view,
     SIGNAL(download(GItemModel *, GFSEcrsUri &, GPersistentModelIndexList, 
int, bool)),
     this,
     SLOT(download(GItemModel *, GFSEcrsUri &, GPersistentModelIndexList, int, 
bool)));
-  
+
   searchSummaryCntrl->searchStarted(list, uri);
-  
+
   // insert search results from last session
   while (resultCount > 0)
   {
     result(info.model, list, &results[resultCount - 1]);
     resultCount--;
   }
-  
+
   searchInfo = new GFSSearchInfo;
   searchInfo->model = info.model;
   searchInfo->searchWindow = view;
@@ -118,7 +118,7 @@
   QStandardItem *child;
   QModelIndex childIdx, itemIdx;
   unsigned long long fileSize;
-  
+
   child = new QStandardItem;
   child->setColumnCount(SEARCH_MAX_COLUMN + 1);
   model->lock();
@@ -133,13 +133,13 @@
 
   // insert flat meta data
   GNUNET_meta_data_get_contents(info->meta, &insertMetaData, &childIdx);
-  
+
   // insert thumbnail data
   thumbSize = GNUNET_meta_data_get_thumbnail(info->meta, &thumb);
   if (thumbSize)
   {
     QByteArray data((char *) thumb, thumbSize);
-    
+
     itemIdx = model->index(row, MODEL_IDX(EXTRACTOR_THUMBNAIL_DATA), parent);
     model->setData(itemIdx, QVariant(data));
     GNUNET_free(thumb);
@@ -152,8 +152,8 @@
     fileSize = 0;
   itemIdx = model->index(row, MODEL_IDX(EXTRACTOR_FILE_SIZE), parent);
   model->setData(itemIdx, QVariant(GString::fromByteSize(fileSize)));
-  
 
+
   // make directories expandable
   itemIdx = model->index(row, MODEL_IDX(EXTRACTOR_MIMETYPE), parent);
   if (model->data(itemIdx).toString() == "application/gnunet-directory")
@@ -179,7 +179,7 @@
   meta = info->meta;
   itemIdx = model->index(row, SEARCH_META_COLUMN, parent);
   model->setData(itemIdx, QVariant(meta.serialized()));
-  
+
   model->unlock();
 }
 
@@ -215,17 +215,17 @@
   GEvent *event;
   QSemaphore sem;
   void *lastTab;
-  
+
   event = new GEvent((QEvent::Type) GFSPlugin::CloseSearch, info->searchWindow,
     (void **) &lastTab, &sem);
   GEventDispatcher::postEvent(fs, event);
   sem.acquire(1); // wait until event is processed
-  
+
   searchSummaryCntrl->searchStopped(info->handle);
-  
+
   if (!lastTab)
     info->model->object()->deleteLater();
-    
+
   delete info;
 }
 
@@ -245,10 +245,10 @@
   GRanking rank;
   QVariant var;
   QModelIndex idx;
-  
+
   model = info->model;
   ecrsUri = finfo->uri;
-  
+
   model->lock();
   lst = model->match(model->index(0, SEARCH_URI_COLUMN), Qt::EditRole,
       ecrsUri.serialized(), 1, Qt::MatchExactly | Qt::MatchCaseSensitive);
@@ -257,24 +257,24 @@
 
   model->lock();
   row = lst.at(0).row();
-  
+
   rank.availability_rank = avail;
   rank.availability_certainty = cert;
   rank.applicability_rank = relevance;
   rank.rank_sort = (int) avail + (int) (avail * (int) cert * 65536);
   rank.keywords = GNUNET_ECRS_uri_get_keyword_count_from_ksk(searchURI);
-  
+
   var.setValue(rank);
   idx = model->index(row, SEARCH_RANK_COLUMN);
   model->setData(idx, var);
-  
+
   availmax = (((double) avail + (GNUNET_FSUI_MAX_PROBES - cert)) / 
GNUNET_FSUI_MAX_PROBES) * 100;
   availmin = (double) avail / GNUNET_FSUI_MAX_PROBES * 100;
   if (availmin < 0)
     availmin = 0;
-  
+
   model->setData(idx, tr("Relevance:") + " " +
-      QString::number((double) relevance / rank.keywords * 100.0, 'f', 2) + 
+      QString::number((double) relevance / rank.keywords * 100.0, 'f', 2) +
       "%\n" + tr("Availability:") + " " + QString::number(availmin) + "% " +
         ((availmax > 0 && availmax != availmin) ? " - " +
         QString::number(availmax) + "%" : ""), Qt::ToolTipRole);
@@ -310,19 +310,19 @@
     GNUNET_FSUI_SearchList *handle;
     QPersistentModelIndex persistIdx(*it);
     QString gnPath;
-    
+
     // get URI
     idx = model->index(it->row(), SEARCH_URI_COLUMN, it->parent());
     GFSEcrsUri fileUri(model->data(idx).toString());
-    
+
     // get meta data
     idx = model->index(it->row(), SEARCH_META_COLUMN, it->parent());
     GFSEcrsMetaData meta(model->data(idx).toByteArray());
-    
+
     // get filename
     idx = model->index(it->row(), MODEL_IDX(EXTRACTOR_FILENAME), it->parent());
     QString file = model->data(idx).toString();
-    
+
     // get GNUnet path
     idx = idx.parent();
     while (idx.isValid())
@@ -330,11 +330,11 @@
       gnPath = model->data(idx).toString() + gnPath;
       idx = idx.parent();
     }
-    
+
     // start download
     handle = searches[uri];
     GNUNETQT_ASSERT(handle);
-    
+
     fs->download(persistIdx, handle, fileUri, meta, gnPath, file, anonymity, 
recurse);
   }
 }
@@ -346,23 +346,23 @@
   int isRoot, void *closure)
 {
   Q_UNUSED(key)
-  
+
   QPersistentModelIndex *pIdx;
   GItemModel *model;
   QModelIndex parentIdx, child;
 
   if (isRoot == GNUNET_YES)
     return GNUNET_OK;
-  
+
   GFSEcrsUri uri(fi->uri);
 
   pIdx = (QPersistentModelIndex *) closure;
   model = (GItemModel *) pIdx->model();
   if (!pIdx->isValid())
     return GNUNET_NO;
-  
+
   parentIdx = model->index(pIdx->row(), 0, pIdx->parent());
-  
+
   /* check for existing entry -- this function maybe called multiple
      times for the same directory entry */
   child = parentIdx.child(0, SEARCH_URI_COLUMN);
@@ -370,12 +370,12 @@
   {
     if (GFSEcrsUri(model->data(child).toString()) == uri)
       return GNUNET_OK;
-    
+
     child = child.sibling(child.row() + 1, SEARCH_URI_COLUMN);
   }
-  
+
   GFSSearchController::addSearchResult(model, parentIdx, fi);
-  
+
   return GNUNET_OK;
 }
 
@@ -385,7 +385,7 @@
   GItemModel *model;
   struct GNUNET_MetaData *meta;
   int idxRow;
-  
+
   model = (GItemModel *) idx.model();
   model->lock();
   idxRow = idx.row();
@@ -402,29 +402,29 @@
     model->setData(idx, QVariant(RESULT_DOWNLOADED), Qt::UserRole);
 
     // remove dummy child
-    index = model->index(idxRow, 0, idx.parent());    
+    index = model->index(idxRow, 0, idx.parent());
     model->removeRow(0, index);
 
     // read directory
     if (file.endsWith("/") || file.endsWith("\\"))
       file = file.left(file.length() - 1);
     file += ".gnd";
-  
+
     QFile gnDir(file);
     gnDir.open(QIODevice::ReadOnly);
     QByteArray data = gnDir.readAll();
-    
+
     if (data.size())
-    { 
+    {
       meta = NULL;
       GNUNET_ECRS_directory_list_contents(fs->errorContext(), data.data(), 
data.size(), &meta,
         &addFilesToDirectory, &idx);
-    
+
       if (meta)
         GNUNET_meta_data_destroy(meta);
     }
   }
-  
+
   model->unlock();
 }
 





reply via email to

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