From 99c038a4db62fd1be25f105e26b2a19ecfa5984b Mon Sep 17 00:00:00 2001 From: drbob Date: Thu, 27 Nov 2008 21:26:52 +0000 Subject: [PATCH] Enabled save() function in SubFileItems. Improved Channel Menu Item: added Icon and popularity. Reduced most of the margins in Channel Feed. updated libretroshare interface files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@845 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ChannelFeed.cpp | 10 + retroshare-gui/src/gui/LibraryDialog.cpp | 6 + retroshare-gui/src/gui/feeds/ChanMenuItem.cpp | 5 + retroshare-gui/src/gui/feeds/ChanMenuItem.ui | 367 ++++++++++++------ retroshare-gui/src/gui/feeds/SubFileItem.cpp | 22 ++ retroshare-gui/src/rsiface/rsfiles.h | 3 + 6 files changed, 287 insertions(+), 126 deletions(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 8cf604aaf..29682597b 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -53,6 +53,9 @@ ChannelFeed::ChannelFeed(QWidget *parent) /*************** Setup Left Hand Side (List of Channels) ****************/ mGroupLayout = new QVBoxLayout; + mGroupLayout->setSpacing(0); + mGroupLayout->setMargin(0); + mGroupLayout->setContentsMargins(0,0,0,0); mGroupOwn = new ChanGroupItem("Own Channels"); mGroupSub = new ChanGroupItem("Subscribed Channels"); @@ -80,12 +83,17 @@ ChannelFeed::ChannelFeed(QWidget *parent) layout2->addWidget(scrollArea); layout2->setSpacing(0); layout2->setMargin(0); + layout2->setContentsMargins(0,0,0,0); + chanFrame->setLayout(layout2); /*************** Setup Left Hand Side (List of Channels) ****************/ mMsgLayout = new QVBoxLayout; + mMsgLayout->setSpacing(0); + mMsgLayout->setMargin(0); + mMsgLayout->setContentsMargins(0,0,0,0); QWidget *middleWidget2 = new QWidget(); middleWidget2->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); @@ -101,6 +109,8 @@ ChannelFeed::ChannelFeed(QWidget *parent) layout3->addWidget(scrollArea2); layout3->setSpacing(0); layout3->setMargin(0); + layout3->setContentsMargins(0,0,0,0); + msgFrame->setLayout(layout3); diff --git a/retroshare-gui/src/gui/LibraryDialog.cpp b/retroshare-gui/src/gui/LibraryDialog.cpp index f09707798..882297d70 100644 --- a/retroshare-gui/src/gui/LibraryDialog.cpp +++ b/retroshare-gui/src/gui/LibraryDialog.cpp @@ -98,11 +98,17 @@ LibraryDialog::LibraryDialog(QWidget *parent) void LibraryDialog::PopulateList() { QDir DwnlFolder,ShrFolder,retroshareLib,treePath; + +#if 0 retroshareLib.mkdir("RetroShare Library"); DwnlFolder.mkdir("RetroShare Library/Download"); ShrFolder.mkdir("RetroShare Library/SharedFolder"); LibShared=treePath.currentPath(); LibShared.append("/RetroShare Library"); +#else + LibShared=treePath.currentPath(); +#endif + QDirModel * dmodel=new QDirModel; ui.organizertreeView->setModel(dmodel); ui.organizertreeView->setRootIndex(dmodel->index(LibShared)); diff --git a/retroshare-gui/src/gui/feeds/ChanMenuItem.cpp b/retroshare-gui/src/gui/feeds/ChanMenuItem.cpp index f16069f9c..fa92a3cf5 100644 --- a/retroshare-gui/src/gui/feeds/ChanMenuItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanMenuItem.cpp @@ -61,6 +61,10 @@ void ChanMenuItem::updateItemStatic() { titleLabel->setText(QString::fromStdWString(ci.channelName)); descLabel->setText(QString::fromStdWString(ci.channelDesc)); + pop_lcd->display((int) ci.pop); + /* TODO */ + fetches_lcd->display(9999); + avail_lcd->display(9999); } else { @@ -77,6 +81,7 @@ void ChanMenuItem::updateItem() std::cerr << "ChanMenuItem::updateItem()"; std::cerr << std::endl; #endif + } diff --git a/retroshare-gui/src/gui/feeds/ChanMenuItem.ui b/retroshare-gui/src/gui/feeds/ChanMenuItem.ui index 0969ed5c6..33f787609 100644 --- a/retroshare-gui/src/gui/feeds/ChanMenuItem.ui +++ b/retroshare-gui/src/gui/feeds/ChanMenuItem.ui @@ -5,8 +5,8 @@ 0 0 - 290 - 226 + 216 + 367 @@ -39,7 +39,10 @@ QFrame::Raised - + + + 0 + 0 @@ -52,130 +55,242 @@ 0 - - 0 - - - 0 - - - - - - 0 - 0 - + + + + 0 - - - 16777215 - 14 - - - - Expand - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 21 - 28 - - - - - - - - - 0 - 0 - - - - - 200 - 16777215 - - - - - 75 - true - true - - - - Connected - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 341 - 28 - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - + + + + + 0 + 0 + + + + + 16777215 + 14 + + + + Expand + + + + + + + + + + + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 21 + 28 + + + + + + + + + 0 + 0 + + + + + 200 + 16777215 + + + + + 75 + true + true + + + + Connected + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 341 + 28 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + - - - + + + 0 - - + + 0 - + + + + Popularity: + + + + + + + + + + Fetches: + + + + + + + + + + Available: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + + + :/images/friendsfolder24.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -201,9 +316,9 @@ - - - + + + diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index e7ce32340..6170a59ee 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -558,6 +558,28 @@ void SubFileItem::save() std::cerr << "SubFileItem::save()"; std::cerr << std::endl; #endif + + if (mType == SFI_TYPE_CHANNEL) + { + /* only enable these function for Channels. */ + + /* find out where they want to save it */ + QString startpath = ""; + QString dir = QFileDialog::getExistingDirectory(this, tr("Save Channel File"), + startpath, + QFileDialog::ShowDirsOnly + | QFileDialog::DontResolveSymlinks); + + std::string destpath = dir.toStdString(); + + if (destpath != "") + { + rsFiles->ExtraFileMove(mFileName, mFileHash, mFileSize, destpath); + } + } + else + { + } } diff --git a/retroshare-gui/src/rsiface/rsfiles.h b/retroshare-gui/src/rsiface/rsfiles.h index 511db19fd..3f8575035 100644 --- a/retroshare-gui/src/rsiface/rsfiles.h +++ b/retroshare-gui/src/rsiface/rsfiles.h @@ -119,6 +119,9 @@ virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0; virtual bool ExtraFileHash(std::string localpath, uint32_t period, uint32_t flags) = 0; virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0; +virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, + std::string destpath) = 0; + /***