From c6c8e63e9126995802b0ea897322bb5a8a63cafa Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 10 Apr 2010 14:56:34 +0000 Subject: [PATCH] ported branch commits 2666-2668, 2670-2672, 2679, 2682-2683 into trunk git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2702 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/dbase/fimonitor.cc | 7 +- libretroshare/src/libretroshare.pro | 2 +- libretroshare/src/pqi/authgpg.cc | 12 +- retroshare-gui/src/RetroShare.pro | 1 + retroshare-gui/src/gui/MainWindow.cpp | 2 +- retroshare-gui/src/gui/SearchDialog.cpp | 5 +- retroshare-gui/src/gui/TransfersDialog.cpp | 321 +++++++----------- retroshare-gui/src/gui/TransfersDialog.h | 2 +- .../src/gui/settings/ServerPage.cpp | 17 +- .../src/gui/settings/TransferPage.h | 2 +- .../src/gui/settings/rsettingswin.cpp | 13 +- retroshare-gui/src/main.cpp | 2 +- 12 files changed, 153 insertions(+), 233 deletions(-) diff --git a/libretroshare/src/dbase/fimonitor.cc b/libretroshare/src/dbase/fimonitor.cc index c7f920803..a7a462d22 100644 --- a/libretroshare/src/dbase/fimonitor.cc +++ b/libretroshare/src/dbase/fimonitor.cc @@ -297,6 +297,8 @@ void FileIndexMonitor::updateCycle() mInCheck = true; } + cb->notifyHashingInfo("Examining shared files...") ; + std::vector to_hash ; while(moretodo) @@ -514,6 +516,8 @@ void FileIndexMonitor::updateCycle() if(!to_hash.empty()) hashFiles(to_hash) ; + cb->notifyHashingInfo("") ; + { /* LOCKED DIRS */ RsStackMutex stack(fiMutex); /**** LOCKED DIRS ****/ @@ -579,7 +583,7 @@ void FileIndexMonitor::hashFiles(const std::vector& to_hash) std::ostringstream tmpout; tmpout << cnt+1 << "/" << n_files << " (" << int(size/double(total_size)*100.0) << "%) : " << to_hash[i].fentries[j].name ; - cb->notifyHashingInfo(tmpout.str()) ; + cb->notifyHashingInfo("Hashing file " + tmpout.str()) ; FileEntry fe(to_hash[i].fentries[j]) ; // copied, because hashFile updates the hash member @@ -609,7 +613,6 @@ void FileIndexMonitor::hashFiles(const std::vector& to_hash) } - cb->notifyHashingInfo("") ; cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0); } diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 81599dab1..a34b36cd1 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -25,7 +25,7 @@ debug { ################################# Linux ########################################## linux-* { DESTDIR = lib - QMAKE_CXXFLAGS *= -Wall + QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64 QMAKE_CC = g++ SSL_DIR = /usr/include/openssl diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index 1288630a4..e6e2ee00b 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -359,9 +359,9 @@ bool AuthGPG::storeAllKeys_locked() if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0)) { std::cerr << "AuthGPG::storeAllKeys_locked() Error iterating through KeyList" << std::endl; - if (rsicontrol != NULL) { - rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list."); - } +// if (rsicontrol != NULL) { +// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list."); +// } gpgme_set_keylist_mode(CTX, origmode); return false; } @@ -371,9 +371,9 @@ bool AuthGPG::storeAllKeys_locked() ERR = gpgme_op_keylist_next (CTX, &KEY); if (GPG_ERR_NO_ERROR != ERR) { std::cerr << "AuthGPG::storeAllKeys_locked() didn't find any gpg key in the keyring" << std::endl; - if (rsicontrol != NULL) { - rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list."); - } +// if (rsicontrol != NULL) { +// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list."); +// } return false; } else { //let's start a new list diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 2f013e468..bc7f24a73 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -18,6 +18,7 @@ debug { # Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib linux-* { CONFIG += version_detail_bash_script + QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64 LIBS += ../../libretroshare/src/lib/libretroshare.a LIBS += -lssl -lgpgme -lupnp } diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 2b42868e7..2f32c6290 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -391,7 +391,7 @@ void MainWindow::updateHashingInfo(const QString& s) _hashing_info_label->hide() ; else { - _hashing_info_label->setText("Hashing file " + s) ; + _hashing_info_label->setText(s) ; _hashing_info_label->show() ; } } diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index a9b647f2f..e45bd96ae 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -824,9 +824,6 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const if(nb_results[searchId] >= ui._max_results_SB->value()) return ; - else - ++nb_results[searchId] ; - // 1 - look in result window whether the file already exists. // @@ -957,6 +954,8 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const if(!found) { + ++nb_results[searchId] ; + /* translate search results */ QTreeWidgetItem *item = new QTreeWidgetItem(); diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 066d2771a..f3c64730d 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -228,10 +228,9 @@ TransfersDialog::TransfersDialog(QWidget *parent) clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this ); connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) ); -#ifndef RS_RELEASE_VERSION + copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this ); connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) ); -#endif pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this ); connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) ); queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this); @@ -294,27 +293,18 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) bool addOpenFileOption = false; if (info.downloadStatus == FT_STATE_COMPLETE) - { - std::cerr << "Add Play Option" << std::endl; + { + std::cerr << "Add Play Option" << std::endl; + + addOpenFileOption = true; + + size_t pos = info.fname.find_last_of('.'); + + /* check if the file is a media file */ + if(pos != std::string::npos && misc::isPreviewable(info.fname.substr(pos + 1).c_str())) + addPlayOption = true; + } - addOpenFileOption = true; - - size_t pos = info.fname.find_last_of('.'); - - if (pos == std::string::npos) return; /* can't identify type of file */ - - /* check if the file is a media file */ - if (misc::isPreviewable(info.fname.substr(pos + 1).c_str())) - { - addPlayOption = true; - } - - - } - - - QMenu viewMenu( tr("View"), this ); - QMenu priorityQueueMenu(tr("Move in Queue..."), this); priorityQueueMenu.setIcon(QIcon(IMAGE_PRIORITY)); priorityQueueMenu.addAction(queueTopAct); @@ -373,13 +363,18 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) if(all_downloading) contextMnu.addMenu( &chunkMenu); - if(single) - { - if(info.downloadStatus == FT_STATE_PAUSED) - contextMnu.addAction( resumeAct); - else if(info.downloadStatus != FT_STATE_COMPLETE) + if(!all_paused) contextMnu.addAction( pauseAct); - } + if(!all_downld) + contextMnu.addAction( resumeAct); + + if(single) + { + if(info.downloadStatus == FT_STATE_PAUSED) + contextMnu.addAction( resumeAct); + else if(info.downloadStatus != FT_STATE_COMPLETE) + contextMnu.addAction( pauseAct); + } if(info.downloadStatus != FT_STATE_COMPLETE) contextMnu.addAction( cancelAct); @@ -402,15 +397,14 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) contextMnu.addAction( clearcompletedAct); contextMnu.addSeparator(); -#ifndef RS_RELEASE_VERSION - if(single) + + if(!items.empty()) contextMnu.addAction( copylinkAct); -#endif + if(!RSLinkClipboard::empty()) contextMnu.addAction( pastelinkAct); contextMnu.addSeparator(); - contextMnu.addMenu( &viewMenu); contextMnu.exec( mevent.globalPos() ); } @@ -479,7 +473,7 @@ int TransfersDialog::addItem(const QString&, const QString& name, const QString& return row; } -int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status, const FileProgressInfo& peerInfo) +int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo) { QStandardItem *dlItem = DLListModel->item(row); if (!dlItem) return -1; @@ -496,36 +490,41 @@ int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& break; } - if (childRow == -1) { + + QStandardItem *si1 = NULL,*si7=NULL; + + if (childRow == -1) + { //set this false if you want to expand on double click dlItem->setEditable(false); - QList items; - QStandardItem *i1 = new QStandardItem(); i1->setData(QVariant((QString)" "+name), Qt::DisplayRole); - QStandardItem *i2 = new QStandardItem(); i2->setData(QVariant(QString()), Qt::DisplayRole); - QStandardItem *i3 = new QStandardItem(); i3->setData(QVariant(QString()), Qt::DisplayRole); - QStandardItem *i4 = new QStandardItem(); i4->setData(QVariant((double)dlspeed), Qt::DisplayRole); - QStandardItem *i5 = new QStandardItem(); i5->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole); - QStandardItem *i6 = new QStandardItem(); i6->setData(QVariant(QString()), Qt::DisplayRole); - QStandardItem *i7 = new QStandardItem(); i7->setData(QVariant((QString)status), Qt::DisplayRole); - QStandardItem *i8 = new QStandardItem(); i8->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority - QStandardItem *i9 = new QStandardItem(); i9->setData(QVariant(QString()), Qt::DisplayRole); - QStandardItem *i10 = new QStandardItem(); i10->setData(QVariant(QString()), Qt::DisplayRole); - QStandardItem *i11 = new QStandardItem(); i11->setData(QVariant((QString)coreID), Qt::DisplayRole); + QStandardItem *i1 = new QStandardItem(); + QStandardItem *i2 = new QStandardItem(); + QStandardItem *i3 = new QStandardItem(); + QStandardItem *i4 = new QStandardItem(); + QStandardItem *i5 = new QStandardItem(); + QStandardItem *i6 = new QStandardItem(); + QStandardItem *i7 = new QStandardItem(); + QStandardItem *i8 = new QStandardItem(); + QStandardItem *i9 = new QStandardItem(); + QStandardItem *i10 = new QStandardItem(); + QStandardItem *i11 = new QStandardItem(); - /* set status icon in the name field */ - if (status == "Downloading") { - i1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); - } else if (status == "Failed") { - i1->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole); - } else if (status == "Okay") { - i1->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole); - } else if (status == "Waiting") { - i1->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole); - } else if (status == "Unknown") { - i1->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole); - } else if (status == "Complete") { - } + si1 = i1 ; + si7 = i7 ; + + QList items; + i1->setData(QVariant((QString)" "+name), Qt::DisplayRole); + i2->setData(QVariant(QString()), Qt::DisplayRole); + i3->setData(QVariant(QString()), Qt::DisplayRole); + i4->setData(QVariant((double)dlspeed), Qt::DisplayRole); + i5->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole); + i6->setData(QVariant(QString()), Qt::DisplayRole); + + i8->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority + i9->setData(QVariant(QString()), Qt::DisplayRole); + i10->setData(QVariant(QString()), Qt::DisplayRole); + i11->setData(QVariant((QString)coreID), Qt::DisplayRole); items.append(i1); items.append(i2); @@ -541,64 +540,47 @@ int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& dlItem->appendRow(items); childRow = dlItem->rowCount()-1 ; - } else { + } + else + { //just update the child (peer) dlItem->child(childRow, DLSPEED)->setData(QVariant((double)dlspeed), Qt::DisplayRole); - dlItem->child(childRow, STATUS)->setData(QVariant((QString)status), Qt::DisplayRole); dlItem->child(childRow, PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole); - - std::set dlitems; - std::set::iterator it; - getIdOfSelectedItems(dlitems); - - FileInfo info; - for (it = dlitems.begin(); it != dlitems.end(); it ++) { - if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue; - break; - } - - /* set status icon in the name field */ - if ( info.downloadStatus == FT_STATE_DOWNLOADING) - { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); - } - else if ( info.downloadStatus == FT_STATE_FAILED) - { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole); - } - else if ( info.downloadStatus == FT_STATE_OKAY) - { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole); - } - else if ( info.downloadStatus == FT_STATE_WAITING) - { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole); - } - else if ( info.downloadStatus == FT_STATE_COMPLETE) - { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); - } - else - { - //dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole); - } - - /* set status icon in the name field */ - /*if (status == "Downloading") { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); - } else if (status == "Failed") { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole); - } else if (status == "Okay") { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole); - } else if (status == "Waiting") { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole); - } else if (status == "Unknown") { - dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole); - } else if (status == "Complete") { - }*/ + + si1 = dlItem->child(childRow,NAME) ; + si7 = dlItem->child(childRow, STATUS) ; } - return childRow; + QString sstatus; + switch (status) + { + case FT_STATE_FAILED: si7->setData(QVariant(tr("Failed"))) ; + si1->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole); + break ; + + case FT_STATE_OKAY: si7->setData(QVariant(tr("Okay"))); + si1->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole); + break ; + + case FT_STATE_WAITING: si7->setData(QVariant(tr(""))); + si1->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole); + break ; + + case FT_STATE_DOWNLOADING: si7->setData(QVariant(tr("Transferring"))); + si1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); + break ; + + case FT_STATE_COMPLETE: si7->setData(QVariant(tr("Complete"))); + si1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole); + break ; + + default: si7->setData(QVariant(tr(""))); + break ; + si1->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole); + } + + + return childRow; } @@ -725,9 +707,6 @@ void TransfersDialog::insertTransfers() int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime); used_hashes.insert(info.hash) ; - /* continue to next download item if no peers to add */ - if (!info.peers.size()) continue; - std::map::iterator vit; std::map versions; bool retv = rsDisc->getDiscVersions(versions); @@ -745,15 +724,6 @@ void TransfersDialog::insertTransfers() version = tr("version: ") + QString::fromStdString(vit->second); } - QString status; - switch (pit->status) { - case FT_STATE_FAILED: status = tr("Failed"); break; - case FT_STATE_OKAY: status = tr("Okay"); break; - case FT_STATE_WAITING: status = tr(""); break; - case FT_STATE_DOWNLOADING: status = tr("Transferring"); break; - case FT_STATE_COMPLETE: status = tr("Complete"); break; - default: status = tr(""); break; - } double peerDlspeed = 0; if ((uint32_t)pit->status == FT_STATE_DOWNLOADING && info.downloadStatus != FT_STATE_PAUSED && info.downloadStatus != FT_STATE_COMPLETE) peerDlspeed = pit->tfRate * 1024.0; @@ -764,15 +734,7 @@ void TransfersDialog::insertTransfers() peerpinfo.progress = 0.0 ; // we don't display completion for sources. peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:fcinfo.chunks.size(); - // std::cerr << std::endl ; - // std::cerr << "Source " << pit->peerId << " as map " << peerpinfo.cmap._map.size() << " compressed chunks" << std::endl ; - // for(uint j=0;jrowCount()) + { + std::string hash = ULListModel->item(removeIndex, UHASH)->data(Qt::EditRole).toString().toStdString(); + + if(used_hashes.find(hash) == used_hashes.end()) + ULListModel->takeRow(removeIndex); + else + removeIndex++; + } + + } QString TransfersDialog::getPeerName(const std::string& id) const @@ -980,6 +909,7 @@ void TransfersDialog::cancel() void TransfersDialog::copyLink () { QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes (); + std::vector links ; for (int i = 0; i < lst.count (); i++) if ( lst[i].column() == 0 ) @@ -989,11 +919,10 @@ void TransfersDialog::copyLink () qulonglong fsize= ind.model ()->data (ind.model ()->index (ind.row (), SIZE)).toULongLong() ; QString fname= ind.model ()->data (ind.model ()->index (ind.row (), NAME)).toString() ; - RetroShareLink link(fname, fsize, fhash); - - QApplication::clipboard()->setText(link.toString()); - break ; + RetroShareLink link(fname, uint64_t(fsize), fhash); + links.push_back(link) ; } + RSLinkClipboard::copyLinks(links) ; } void TransfersDialog::showDetailsDialog() diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index 3611774a9..1759f2155 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -175,7 +175,7 @@ public slots: // these two functions add entries to the transfers dialog, and return the row id of the entry modified/added // int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime); - int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status, const FileProgressInfo& peerInfo); + int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo); void delItem(int row); int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining); diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index f8a4f35d7..0267f1f91 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -165,13 +165,13 @@ void ServerPage::load() /** Loads the settings for this page */ void ServerPage::updateStatus() { + if(!isVisible()) + return ; /* load up configuration from rsPeers */ RsPeerDetails detail; if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) - { return; - } /* only update if can't edit */ if (!ui.localPort->isEnabled()) @@ -185,8 +185,6 @@ void ServerPage::updateStatus() ui.localAddress->setText(QString::fromStdString(detail.localAddr)); /* set the server address */ ui.extAddress->setText(QString::fromStdString(detail.extAddr)); - - } void ServerPage::toggleUPnP() @@ -220,14 +218,11 @@ void ServerPage::saveAddresses() bool saveAddr = false; - RsPeerDetails detail; std::string ownId = rsPeers->getOwnId(); if (!rsPeers->getPeerDetails(ownId, detail)) - { return; - } int netIndex = ui.netModeComboBox->currentIndex(); @@ -248,26 +243,18 @@ void ServerPage::saveAddresses() } if (detail.tryNetMode != netMode) - { rsPeers->setNetworkMode(ownId, netMode); - } int visState = 0; /* Check if vis has changed */ if (0 == ui.discComboBox->currentIndex()) - { visState |= RS_VS_DISC_ON; - } if (visState != detail.visState) - { rsPeers->setVisState(ownId, visState); - } if (0 != netIndex) - { saveAddr = true; - } if (saveAddr) { diff --git a/retroshare-gui/src/gui/settings/TransferPage.h b/retroshare-gui/src/gui/settings/TransferPage.h index 5169f14a7..ce8cf1007 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.h +++ b/retroshare-gui/src/gui/settings/TransferPage.h @@ -36,7 +36,7 @@ class TransferPage: public ConfigPage ~TransferPage() {} /** Saves the changes on this page */ - virtual bool save(QString &errmsg) {} + virtual bool save(QString &errmsg) { return true ; } /** Loads the settings for this page */ virtual void load() {} diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index d1d83ce74..9bacfe805 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -145,22 +145,22 @@ RSettingsWin::loadSettings() void RSettingsWin::saveChanges() { - bool saveOk; QString errmsg; /* Call each config page's save() method to save its data */ int i, count = stackedWidget->count(); - for (i = 0; i < count; i++) { - ConfigPage *page = (ConfigPage *) stackedWidget->widget(i); - saveOk = page->save(errmsg); + for (i = 0; i < count; i++) + { + ConfigPage *page = dynamic_cast(stackedWidget->widget(i)); - if (!saveOk) { + if(!page->save(errmsg)) + { /* Display the offending page */ stackedWidget->setCurrentWidget(page); /* Show the user what went wrong */ QMessageBox::warning(this, - tr("Error Saving Configuration"), errmsg, + tr("Error Saving Configuration on page ")+QString::number(i), errmsg, QMessageBox::Ok, QMessageBox::NoButton); /* Don't process the rest of the pages */ @@ -173,3 +173,4 @@ RSettingsWin::saveChanges() QDialog::close(); } + diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index c7adc4909..22ec4f791 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ; QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ; - QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ; + QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&)),Qt::QueuedConnection) ; /* only show window, if not startMinimized */ RshareSettings *_settings = new RshareSettings();