Merged branch for GUI improvements into trunk. The improvement phase is not finsihed yet. The work on GUI will continue into trunk

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-02-22 21:42:27 +00:00
parent c23cfd4a0f
commit 50db473329
46 changed files with 2536 additions and 2984 deletions

View File

@ -3,6 +3,7 @@
#include <QMessageBox>
#include "ChatLobbyWidget.h"
#include "chat/CreateLobbyDialog.h"
#include "chat/ChatTabWidget.h"
#include "common/RSTreeWidgetItem.h"
#include "notifyqt.h"
#include "chat/ChatLobbyDialog.h"
@ -40,6 +41,12 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
lobbyTreeWidget = new QTreeWidget ;
getTabWidget()->addTab(lobbyTreeWidget,tr("Lobby list")) ;
layout()->addWidget( getTabWidget() ) ;
layout()->update() ;
QObject::connect(lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCostumPopupMenu()));
QObject::connect(lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
@ -349,6 +356,13 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
subscribeLobby(item);
}
ChatTabWidget *ChatLobbyWidget::getTabWidget()
{
static ChatTabWidget *instance = new ChatTabWidget() ;
return instance ;
}
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str)
{
std::cerr << "Received displayChatLobbyEvent()!" << std::endl;

View File

@ -1,9 +1,11 @@
#pragma once
#include <QTreeWidget>
#include "ui_ChatLobbyWidget.h"
#include "RsAutoUpdatePage.h"
class RSTreeWidgetItemCompareRole;
class ChatTabWidget ;
class ChatLobbyWidget : public RsAutoUpdatePage, Ui::ChatLobbyWidget
{
@ -18,6 +20,7 @@ public:
virtual void updateDisplay();
static ChatTabWidget *getTabWidget() ;
protected slots:
void lobbyChanged();
void lobbyTreeWidgetCostumPopupMenu();
@ -32,4 +35,7 @@ private:
RSTreeWidgetItemCompareRole *compareRole;
QTreeWidgetItem *privateLobbyItem;
QTreeWidgetItem *publicLobbyItem;
ChatTabWidget *tabWidget ;
QTreeWidget *lobbyTreeWidget ;
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>608</width>
<height>397</height>
<height>188</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -89,40 +89,6 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="lobbyTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<property name="columnCount">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources>

View File

@ -20,11 +20,15 @@
****************************************************************/
#include <QStandardItemModel>
#include <QClipboard>
#include "DetailsDialog.h"
#include "TransfersDialog.h"
#include "retroshare/rsfiles.h"
#include "util/misc.h"
#include "FileTransferInfoWidget.h"
#include "RetroShareLink.h"
/** Default constructor */
DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags)
@ -41,34 +45,44 @@ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags)
CommentsModel->setHeaderData(1, Qt::Horizontal, tr("Comments"));
CommentsModel->setHeaderData(2, Qt::Horizontal, tr("File Name"));
ui.commentsTreeView->setModel(CommentsModel);
ui.commentsTreeView->setSortingEnabled(true);
ui.commentsTreeView->setRootIsDecorated(false);
//ui.commentsTreeView->setModel(CommentsModel);
//ui.commentsTreeView->setSortingEnabled(true);
//ui.commentsTreeView->setRootIsDecorated(false);
/* Set header resize modes and initial section sizes */
QHeaderView * _coheader = ui.commentsTreeView->header();
_coheader->setResizeMode ( 0, QHeaderView::Custom);
_coheader->resizeSection ( 0, 100 );
_coheader->resizeSection ( 1, 240 );
_coheader->resizeSection ( 2, 100 );
//QHeaderView * _coheader = ui.commentsTreeView->header();
//_coheader->setResizeMode ( 0, QHeaderView::Custom);
//_coheader->resizeSection ( 0, 100 );
//_coheader->resizeSection ( 1, 240 );
//_coheader->resizeSection ( 2, 100 );
FileTransferInfoWidget *ftiw = new FileTransferInfoWidget();
ui.fileTransferInfoWidget->setWidget(ftiw);
ui.fileTransferInfoWidget->setWidgetResizable(true);
ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole);
ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame);
ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus);
setAttribute(Qt::WA_DeleteOnClose,false) ;
connect(ui.copylinkdetailsButton,SIGNAL(clicked()),this,SLOT(copyLink())) ;
}
/** Destructor. */
DetailsDialog::~DetailsDialog()
void DetailsDialog::copyLink()
{
TransfersDialog::detailsdlg = NULL;
QApplication::clipboard()->setText( ui.Linktext->toPlainText() );
}
void DetailsDialog::on_ok_dButton_clicked()
{
QDialog::close();
QDialog::hide();
}
void DetailsDialog::on_cancel_dButton_clicked()
{
//reject();
QDialog::close();
QDialog::hide();
}
@ -85,101 +99,17 @@ DetailsDialog::show()
}
}
void DetailsDialog::closeEvent (QCloseEvent * event)
void DetailsDialog::setFileHash(const std::string & hash)
{
QWidget::closeEvent(event);
dynamic_cast<FileTransferInfoWidget*>(ui.fileTransferInfoWidget->widget())->setFileHash(hash) ;
FileInfo nfo ;
if(!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, nfo))
return ;
RetroShareLink link ;
link.createFile(QString::fromStdString(nfo.fname),nfo.size,QString::fromStdString(nfo.hash)) ;
ui.Linktext->setText(link.toString()) ;
}
void DetailsDialog::setFileName(const QString & filename)
{
int c;
QModelIndex index;
c = CommentsModel->rowCount();
CommentsModel->removeRows(0,c);
c = CommentsModel->rowCount();
CommentsModel->insertRow(c);
index = CommentsModel->index(c, 0);
CommentsModel->setData(index, tr("Not Rated"));
index = CommentsModel->index(c, 1);
CommentsModel->setData(index, tr("No Comments"));
index = CommentsModel->index(c, 2);
CommentsModel->setData(index, filename);
ui.name_label_2->setText(filename);
}
void DetailsDialog::setHash(const QString & hash)
{
ui.hash_label_2->setText(hash);
}
void DetailsDialog::setSize(const qulonglong & size)
{
ui.size_label_2->setText(misc::friendlyUnit(size) + " " + "(" + QString::number(size) + " " + "Bytes" + ")");
}
void DetailsDialog::setStatus(const QString & status)
{
ui.status_label_2->setText(status);
}
void DetailsDialog::setPriority(const QString & priority)
{
ui.priority_label_2->setText(priority);
}
void DetailsDialog::setType(const QString & type)
{
ui.type_label_2->setText(type);
}
void DetailsDialog::setSources(const QString & sources)
{
ui.sources_line->setText(sources);
}
void DetailsDialog::setDatarate(const double & datarate)
{
QString temp;
temp.clear();
temp.sprintf("%.2f", datarate/1024.);
temp += " KB/s";
ui.datarate_line->setText(temp);
}
void DetailsDialog::setCompleted(const QString & completed)
{
ui.completed_line->setText(completed);
}
void DetailsDialog::setRemaining(const QString & remaining)
{
ui.remaining_line->setText(remaining);
}
void DetailsDialog::setDownloadtime(const QString & downloadtime)
{
ui.downloadtime_line->setText(downloadtime);
}
void DetailsDialog::setLink(const QString & link)
{
ui.Linktext->setText(link);
}
void DetailsDialog::setChunkSize(uint32_t chunksize)
{
ui.chunksizelabel->setText(misc::friendlyUnit(chunksize));
}
void DetailsDialog::setNumberOfChunks(size_t numberofchunks)
{
ui.numberofchunkslabel->setText(QString::number(numberofchunks));
}

View File

@ -35,32 +35,14 @@ public:
/** Default constructor */
DetailsDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
~DetailsDialog();
~DetailsDialog() {}
void setFileHash(const std::string& hash) { _file_hash = hash ; }
void setFileHash(const std::string& hash) ;
public slots:
/** Overloaded QWidget.show */
void show();
void setFileName(const QString & filename);
void setHash(const QString & hash);
void setLink(const QString & link);
void setSize(const qulonglong & size);
void setStatus(const QString & status);
void setPriority(const QString & priority);
void setSources(const QString & sources);
void setDatarate(const double & datarate);
void setCompleted(const QString & completed);
void setRemaining(const QString & remaining) ;
void setDownloadtime(const QString & downloadtime);
void setType(const QString & type);
void setChunkSize(const uint32_t chunksize);
void setNumberOfChunks(const size_t numberofchunks);
protected:
void closeEvent (QCloseEvent * event);
void copyLink() ;
private slots:
void on_ok_dButton_clicked();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>525</width>
<height>477</height>
<width>787</width>
<height>644</height>
</rect>
</property>
<property name="windowTitle">
@ -21,348 +21,143 @@
<item row="0" column="0" colspan="3">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/fileinfo.png</normaloff>:/images/fileinfo.png</iconset>
<normaloff>:/images/blockdevice.png</normaloff>:/images/blockdevice.png</iconset>
</attribute>
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QGridLayout">
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="genralgroupBox">
<property name="title">
<string>General</string>
</property>
<layout class="QGridLayout">
<layout class="QGridLayout" name="_3">
<item row="0" column="0">
<widget class="QLabel" name="name_label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<widget class="QLabel" name="label_3">
<property name="text">
<string>File Name:</string>
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-downloaded.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="name_label_2">
<widget class="QLabel" name="label_5">
<property name="text">
<string notr="true">Name Label</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="7">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>336</width>
<height>98</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="hash_label">
<property name="maximumSize">
<size>
<width>1677215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Hash:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="size_label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="size_label_2">
<property name="text">
<string notr="true">Size Label</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="status_label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="status_label_2">
<property name="text">
<string notr="true">Status Label</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="priority_label">
<property name="text">
<string>Priority:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="priority_label_2">
<property name="text">
<string notr="true">Priority Label</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="type_label_2">
<property name="text">
<string notr="true">Type Label</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="type_label">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="hash_label_2">
<property name="text">
<string notr="true">Hash Label</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
<string>Done</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Transfer</string>
</property>
<layout class="QGridLayout">
<item row="0" column="1">
<layout class="QGridLayout" name="_4">
<item row="0" column="0">
<widget class="QLabel" name="sources_label">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Sources:</string>
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="datarate_label">
<property name="text">
<string>Datarate:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="completed_label">
<property name="text">
<string>Completed:</string>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-downloading.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="sources_line">
<widget class="QLabel" name="label_7">
<property name="text">
<string notr="true">Source Label</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="datarate_line">
<property name="text">
<string notr="true">Datarate Label</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="completed_line">
<property name="text">
<string notr="true">Completed Label</string>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="7">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="chunksizelabel">
<property name="text">
<string notr="true">Chunks Label</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Chunk size:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="numberofchunkslabel">
<property name="toolTip">
<string>Number of Chunks</string>
</property>
<property name="text">
<string notr="true">Chunks Number Label</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>Number of Chunks</string>
</property>
<property name="text">
<string>Chunks:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="remaining_line">
<property name="text">
<string notr="true">Remaining Label</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="remaining_label">
<property name="text">
<string>Remaining:</string>
<string>Active</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Date</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Download time:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="downloadtime_line">
<property name="text">
<string notr="true">Download Time Label</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>274</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabComments">
<attribute name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/filecomments.png</normaloff>:/images/filecomments.png</iconset>
</attribute>
<attribute name="title">
<string>Comments</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="3">
<layout class="QGridLayout" name="_5">
<item row="0" column="0">
<widget class="QTreeView" name="commentsTreeView"/>
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-notdownload.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Outstanding</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>368</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-checking.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Needs checking</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QScrollArea" name="fileTransferInfoWidget">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>747</width>
<height>505</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
@ -374,37 +169,24 @@
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>retroshare link(s)</string>
<string>retroshare link</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QTextEdit" name="Linktext"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<item row="0" column="0">
<widget class="QPushButton" name="copylinkdetailsButton">
<property name="text">
<string>Copy</string>
<string>Copy link to clipboard</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="1">

View File

@ -28,6 +28,7 @@
#include <retroshare/rstypes.h>
#include "util/misc.h"
#include "FileTransferInfoWidget.h"
#include "RetroShareLink.h"
// Variables to decide of display behaviour. Should be adapted to window size.
//
@ -110,7 +111,7 @@ void FileTransferInfoWidget::paintEvent(QPaintEvent */*event*/)
void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info,QPainter *painter)
{
x=0;
y=0;
y=5;
int blocks = info.chunks.size() ;
uint64_t fileSize = info.file_size ;
uint32_t blockSize = info.chunk_size ;
@ -240,10 +241,11 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
// various info:
//
painter->setPen(QColor::fromRgb(0,0,0)) ;
y += text_height ; painter->drawText(0,y,tr("File info") + ":") ;
y += block_sep ;
y += text_height ; painter->drawText(20,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromStdString(nfo.fname)) ;
y += block_sep ;
y += text_height ; painter->drawText(20,y,tr("File hash") + ":") ; painter->drawText(tab_size,y,QString::fromStdString(nfo.hash)) ;
y += block_sep ;
y += text_height ; painter->drawText(20,y,tr("File size") + ":") ; painter->drawText(tab_size,y,QString::number(info.file_size) + " " + tr("bytes") + " " + "(" + misc::friendlyUnit(info.file_size) + ")") ;

View File

@ -42,7 +42,6 @@
#include "im_history/ImHistoryBrowser.h"
#include "MainWindow.h"
#include "NewsFeed.h"
#include "ChatLobbyWidget.h"
#include "notifyqt.h"
#include "profile/ProfileWidget.h"
#include "profile/StatusMessage.h"
@ -51,14 +50,17 @@
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "chat/CreateLobbyDialog.h"
#include "FriendRecommendDialog.h"
#include "FriendsDialog.h"
#include "ServicePermissionDialog.h"
#include "NetworkView.h"
#include "NetworkDialog.h"
/* Images for Newsfeed icons */
#define IMAGE_NEWSFEED ""
#define IMAGE_NEWSFEED_NEW ":/images/message-state-new.png"
#define IMAGE_NETWORK2 ":/images/rs1.png"
#define IMAGE_PEERS ":/images/groupchat.png"
/******
* #define FRIENDS_DEBUG 1
@ -85,7 +87,6 @@ FriendsDialog::FriendsDialog(QWidget *parent)
connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage()));
connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect( ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend()));
connect( ui.actionCreate_new_Chat_lobby, SIGNAL(triggered()), this, SLOT(createChatLobby()));
connect( ui.actionFriendRecommendations, SIGNAL(triggered()), this, SLOT(recommendFriends()));
connect( ui.actionServicePermission, SIGNAL(triggered()), this, SLOT(servicePermission()));
connect( ui.filter_lineEdit, SIGNAL(textChanged(QString)), ui.friendList, SLOT(filterItems(QString)));
@ -97,11 +98,13 @@ FriendsDialog::FriendsDialog(QWidget *parent)
ui.avatar->setOwnId();
ui.tabWidget->setTabPosition(QTabWidget::North);
ui.tabWidget->addTab(new ChatLobbyWidget(), tr("Chat lobbies"));
ui.tabWidget->addTab(new ProfileWidget(), tr("Profile"));
newsFeed = new NewsFeed();
int newsFeedTabIndex = ui.tabWidget->insertTab(0, newsFeed, tr("News Feed"));
ui.tabWidget->setCurrentIndex(newsFeedTabIndex);
ui.tabWidget->addTab(networkView = new NetworkView(),QIcon(IMAGE_NETWORK2), tr("Local network"));
ui.tabWidget->addTab(networkDialog = new NetworkDialog(),QIcon(IMAGE_PEERS), tr("Known people"));
//ui.tabWidget->addTab(new ProfileWidget(), tr("Profile"));
//newsFeed = new NewsFeed();
//int newsFeedTabIndex = ui.tabWidget->insertTab(0, newsFeed, tr("News Feed"));
//ui.tabWidget->setCurrentIndex(newsFeedTabIndex);
ui.tabWidget->hideCloseButton(0);
ui.tabWidget->hideCloseButton(1);
@ -109,10 +112,10 @@ FriendsDialog::FriendsDialog(QWidget *parent)
ui.tabWidget->hideCloseButton(3);
/* get the current text and text color of the tab bar */
newsFeedTabColor = ui.tabWidget->tabBar()->tabTextColor(newsFeedTabIndex);
newsFeedText = ui.tabWidget->tabBar()->tabText(newsFeedTabIndex);
//newsFeedTabColor = ui.tabWidget->tabBar()->tabTextColor(newsFeedTabIndex);
//newsFeedText = ui.tabWidget->tabBar()->tabText(newsFeedTabIndex);
connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int)));
//connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int)));
connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));
@ -849,29 +852,23 @@ void FriendsDialog::on_actionAdd_Group_activated()
createGrpDialog.exec();
}
void FriendsDialog::newsFeedChanged(int count)
{
int newsFeedTabIndex = ui.tabWidget->indexOf(newsFeed);
if (newsFeedTabIndex < 0) {
return;
}
if (count) {
ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, QString("%1 (%2)").arg(newsFeedText).arg(count));
ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, Qt::blue);
ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED_NEW));
} else {
ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, newsFeedText);
ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, newsFeedTabColor);
ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
}
}
void FriendsDialog::createChatLobby()
{
std::list<std::string> friends;
CreateLobbyDialog(friends).exec();
}
// void FriendsDialog::newsFeedChanged(int count)
// {
// int newsFeedTabIndex = ui.tabWidget->indexOf(newsFeed);
// if (newsFeedTabIndex < 0) {
// return;
// }
//
// if (count) {
// ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, QString("%1 (%2)").arg(newsFeedText).arg(count));
// ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, Qt::blue);
// ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED_NEW));
// } else {
// ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, newsFeedText);
// ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, newsFeedTabColor);
// ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
// }
// }
void FriendsDialog::recommendFriends()
{
@ -884,11 +881,6 @@ void FriendsDialog::servicePermission()
dlg.exec();
}
/*static*/ ChatTabWidget *FriendsDialog::getTabWidget()
{
return instance ? instance->ui.tabWidget : NULL;
}
/*static*/ bool FriendsDialog::isGroupChatActive()
{
FriendsDialog *friendsDialog = dynamic_cast<FriendsDialog*>(MainWindow::getPage(MainWindow::Friends));

View File

@ -32,6 +32,8 @@ class QAction;
class QTextEdit;
class QTextCharFormat;
class ChatTabWidget;
class NetworkDialog;
class NetworkView;
class FriendsDialog : public RsAutoUpdatePage
{
@ -47,10 +49,11 @@ public:
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
static ChatTabWidget *getTabWidget();
static bool isGroupChatActive();
static void groupChatActivate();
NetworkDialog *networkDialog ;
NetworkView *networkView ;
public slots:
void publicChatChanged(int type);
@ -111,9 +114,8 @@ private slots:
void setCurrentFileName(const QString &fileName);
void newsFeedChanged(int count);
//void newsFeedChanged(int count);
void createChatLobby();
void recommendFriends();
void servicePermission();
@ -137,9 +139,9 @@ private:
QFont mCurrentFont; /* how the text will come out */
QWidget *newsFeed;
QColor newsFeedTabColor;
QString newsFeedText;
//QWidget *newsFeed;
//QColor newsFeedTabColor;
//QString newsFeedText;
bool inChatCharFormatChanged;
/** Qt Designer generated object */

View File

@ -291,7 +291,7 @@
</property>
<widget class="QWidget" name="groupChatTab">
<attribute name="title">
<string>Group Chat</string>
<string>Broadcast</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">

View File

@ -43,15 +43,16 @@
#include "SearchDialog.h"
#include "TransfersDialog.h"
#include "MessagesDialog.h"
#include "SharedFilesDialog.h"
//#include "SharedFilesDialog.h"
#include "PluginsPage.h"
#include "NewsFeed.h"
#include "ShareManager.h"
#include "NetworkView.h"
#include "ForumsDialog.h"
#include "FriendsDialog.h"
#include "ChatLobbyWidget.h"
#include "HelpDialog.h"
#include "AboutDialog.h"
#include "QuickStartWizard.h"
#include "ChannelFeed.h"
#include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h"
@ -118,9 +119,8 @@
/* Images for toolbar icons */
#define IMAGE_NETWORK2 ":/images/rs1.png"
//#define IMAGE_NETWORK2 ":/images/rs1.png"
#define IMAGE_PEERS ":/images/groupchat.png"
#define IMAGE_SEARCH ":/images/filefind.png"
#define IMAGE_TRANSFERS ":/images/ktorrent32.png"
#define IMAGE_FILES ":/images/fileshare32.png"
#define IMAGE_CHANNELS ":/images/channels.png"
@ -238,22 +238,26 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
QActionGroup *grp = new QActionGroup(this);
QAction *action;
ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages),
createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp));
ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages),
createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp));
// ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages),
// createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp));
ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp));
notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action));
ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages),
createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp));
// ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages),
// createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp));
ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp));
notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action));
ui->stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui->stackPages),
createPageAction(QIcon(IMAGE_FILES), tr("Files"), grp));
ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages),
action = createPageAction(QIcon(IMAGE_CHAT), tr("Chat Lobbies"), grp));
notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action));
ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
@ -785,20 +789,20 @@ void SetForegroundWindowInternal(HWND hWnd)
MainPage *Page = NULL;
switch (page) {
case Network:
Page = _instance->networkDialog;
break;
// case Network:
// Page = _instance->networkDialog;
// break;
case Friends:
Page = _instance->friendsDialog;
break;
case Search:
Page = _instance->searchDialog;
case ChatLobby:
Page = _instance->chatLobbyDialog;
break;
case Transfers:
Page = _instance->transfersDialog;
break;
case SharedDirectories:
Page = _instance->sharedfilesDialog;
// case SharedDirectories:
// Page = _instance->sharedfilesDialog;
break;
case Messages:
Page = _instance->messagesDialog;
@ -814,6 +818,8 @@ void SetForegroundWindowInternal(HWND hWnd)
Page = _instance->blogsFeed;
break;
#endif
default:
std::cerr << "Show page called on value that is not handled yet. Please code it! (value = " << Page << ")" << std::endl;
}
if (Page) {
@ -834,21 +840,21 @@ void SetForegroundWindowInternal(HWND hWnd)
QWidget *page = _instance->ui->stackPages->currentWidget();
if (page == _instance->networkDialog) {
return Network;
}
// if (page == _instance->networkDialog) {
// return Network;
// }
if (page == _instance->friendsDialog) {
return Friends;
}
if (page == _instance->searchDialog) {
return Search;
if (page == _instance->chatLobbyDialog) {
return ChatLobby;
}
if (page == _instance->transfersDialog) {
return Transfers;
}
if (page == _instance->sharedfilesDialog) {
return SharedDirectories;
}
// if (page == _instance->sharedfilesDialog) {
// return SharedDirectories;
// }
if (page == _instance->messagesDialog) {
return Messages;
}
@ -880,16 +886,16 @@ void SetForegroundWindowInternal(HWND hWnd)
}
switch (page) {
case Network:
return _instance->networkDialog;
// case Network:
// return _instance->networkDialog;
case Friends:
return _instance->friendsDialog;
case Search:
return _instance->searchDialog;
case ChatLobby:
return _instance->chatLobbyDialog;
case Transfers:
return _instance->transfersDialog;
case SharedDirectories:
return _instance->sharedfilesDialog;
// case SharedDirectories:
// return _instance->sharedfilesDialog;
case Messages:
return _instance->messagesDialog;
#ifdef RS_USE_LINKS
@ -1080,12 +1086,6 @@ void MainWindow::showHelpDialog(const QString &topic)
HelpBrowser::showWindow(topic);
}
void MainWindow::on_actionQuick_Start_Wizard_activated()
{
QuickStartWizard qstartwizard(this);
qstartwizard.exec();
}
/** Called when the user changes the UI translation. */
void
MainWindow::retranslateUi()

View File

@ -43,6 +43,7 @@ class DHTStatus;
class HashingStatus;
class ForumsDialog;
class FriendsDialog;
class ChatLobbyWidget;
class ChatDialog;
class NetworkDialog;
class SearchDialog;
@ -54,6 +55,7 @@ class PluginsPage;
class ChannelFeed;
class BandwidthGraph;
class MainPage;
class NewsFeed;
class UserNotify;
#ifdef RS_USE_LINKS
@ -78,17 +80,18 @@ public:
/* Fixed numbers for load and save the last page */
Network = 0, /** Network page. */
Friends = 1, /** Friends page. */
Search = 2, /** Search page. */
ChatLobby = 2, /** Chat Lobby page. */
Transfers = 3, /** Transfers page. */
SharedDirectories = 4, /** Shared Directories page. */
Messages = 5, /** Messages page. */
Channels = 6, /** Channels page. */
Forums = 7, /** Forums page. */
Search = 8, /** Search page. */
#ifdef BLOGS
Blogs = 8, /** Blogs page. */
Blogs = 9, /** Blogs page. */
#endif
#ifdef RS_USE_LINKS
Links = 9, /** Links page. */
Links = 10, /** Links page. */
#endif
};
@ -117,10 +120,13 @@ public:
* Notify Class...
*/
NetworkDialog *networkDialog;
// NetworkDialog *networkDialog;
// SearchDialog *searchDialog;
NewsFeed *newsFeed;
FriendsDialog *friendsDialog;
SearchDialog *searchDialog;
TransfersDialog *transfersDialog;
ChatLobbyWidget *chatLobbyDialog;
MessagesDialog *messagesDialog;
SharedFilesDialog *sharedfilesDialog;
ForumsDialog *forumsDialog;
@ -203,7 +209,6 @@ private slots:
/** Called when user attempts to quit via quit button*/
void doQuit();
void on_actionQuick_Start_Wizard_activated();
void updateTrayCombine();
private:

View File

@ -53,7 +53,6 @@
<addaction name="separator"/>
<addaction name="actionMessenger"/>
<addaction name="actionAbout"/>
<addaction name="actionQuick_Start_Wizard"/>
<addaction name="actionOptions"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>

View File

@ -134,7 +134,7 @@ NetworkDialog::NetworkDialog(QWidget *parent)
ui.unvalidGPGkeyWidget->sortItems( 1, Qt::AscendingOrder );
// ui.networkTab->addTab(new TrustView(),QString(tr("Authentication matrix")));
ui.networkTab->addTab(networkview = new NetworkView(),QString(tr("Network View")));
// ui.networkTab->addTab(networkview = new NetworkView(),QString(tr("Network View")));
ui.showUnvalidKeys->setMinimumWidth(20);
@ -159,7 +159,7 @@ NetworkDialog::NetworkDialog(QWidget *parent)
menu->addSeparator();
menu->addAction(ui.actionTabsTriangular);
menu->addAction(ui.actionTabsRounded);
ui.viewButton->setMenu(menu);
//ui.viewButton->setMenu(menu);
QTimer *timer2 = new QTimer(this);
connect(timer2, SIGNAL(timeout()), this, SLOT(updateNetworkStatus()));
@ -170,8 +170,8 @@ NetworkDialog::NetworkDialog(QWidget *parent)
ui.filterLineEdit->addFilter(QIcon(), tr("Peer ID"), COLUMN_PEERID, tr("Search Peer ID"));
ui.filterLineEdit->setCurrentFilter(COLUMN_PEERNAME);
updateNetworkStatus();
loadtabsettings();
//updateNetworkStatus();
//loadtabsettings();
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -192,12 +192,12 @@ void NetworkDialog::changeEvent(QEvent *e)
}
}
void NetworkDialog::updateNewDiscoveryInfo()
{
//std::cerr << "Received new p3disc info. Updating networkview." << std::endl;
networkview->update();
networkview->updateDisplay();
}
//void NetworkDialog::updateNewDiscoveryInfo()
//{
// //std::cerr << "Received new p3disc info. Updating networkview." << std::endl;
// //networkview->update();
// //networkview->updateDisplay();
//}
void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint /*point*/ )
{
@ -687,117 +687,74 @@ void NetworkDialog::on_actionCreate_New_Profile_activated()
// gencertdialog.exec ();
}
void NetworkDialog::updateNetworkStatus()
{
if(RsAutoUpdatePage::eventsLocked())
return ;
rsiface->lockData(); /* Lock Interface */
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
/******* Network Status Tab *******/
if(config.netUpnpOk)
{
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledon1.png"));
}
else
{
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledoff1.png"));
}
if (config.netLocalOk)
{
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledon1.png"));
}
else
{
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledoff1.png"));
}
if (config.netExtraAddressOk)
{
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledon1.png"));
}
else
{
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
}
rsiface->unlockData(); /* UnLock Interface */
}
void NetworkDialog::on_actionTabsnorth_activated()
{
ui.networkTab->setTabPosition(QTabWidget::North);
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
}
void NetworkDialog::on_actionTabssouth_activated()
{
ui.networkTab->setTabPosition(QTabWidget::South);
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
}
void NetworkDialog::on_actionTabswest_activated()
{
ui.networkTab->setTabPosition(QTabWidget::West);
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
}
void NetworkDialog::on_actionTabsright_activated()
{
ui.networkTab->setTabPosition(QTabWidget::East);
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
}
void NetworkDialog::on_actionTabsTriangular_activated()
{
ui.networkTab->setTabShape(QTabWidget::Triangular);
ui.tabBottom->setTabShape(QTabWidget::Triangular);
}
void NetworkDialog::on_actionTabsRounded_activated()
{
ui.networkTab->setTabShape(QTabWidget::Rounded);
ui.tabBottom->setTabShape(QTabWidget::Rounded);
}
void NetworkDialog::loadtabsettings()
{
Settings->beginGroup("NetworkDialog");
if(Settings->value("TabWidget_Position","0").toInt() == 0)
{
qDebug() << "Tab North";
ui.networkTab->setTabPosition(QTabWidget::North);
}
else if (Settings->value("TabWidget_Position","1").toInt() == 1)
{
qDebug() << "Tab South";
ui.networkTab->setTabPosition(QTabWidget::South);
}
else if (Settings->value("TabWidget_Position","2").toInt() ==2)
{
qDebug() << "Tab West";
ui.networkTab->setTabPosition(QTabWidget::West);
}
else if(Settings->value("TabWidget_Position","3").toInt() ==3)
{
qDebug() << "Tab East";
ui.networkTab->setTabPosition(QTabWidget::East);
}
Settings->endGroup();
}
// void NetworkDialog::on_actionTabsnorth_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::North);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabssouth_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::South);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
//
// }
//
// void NetworkDialog::on_actionTabswest_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::West);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabsright_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::East);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabsTriangular_activated()
// {
// ui.networkTab->setTabShape(QTabWidget::Triangular);
// ui.tabBottom->setTabShape(QTabWidget::Triangular);
// }
//
// void NetworkDialog::on_actionTabsRounded_activated()
// {
// ui.networkTab->setTabShape(QTabWidget::Rounded);
// ui.tabBottom->setTabShape(QTabWidget::Rounded);
// }
//
// void NetworkDialog::loadtabsettings()
// {
// Settings->beginGroup("NetworkDialog");
//
// if(Settings->value("TabWidget_Position","0").toInt() == 0)
// {
// qDebug() << "Tab North";
// ui.networkTab->setTabPosition(QTabWidget::North);
// }
// else if (Settings->value("TabWidget_Position","1").toInt() == 1)
// {
// qDebug() << "Tab South";
// ui.networkTab->setTabPosition(QTabWidget::South);
// }
// else if (Settings->value("TabWidget_Position","2").toInt() ==2)
// {
// qDebug() << "Tab West";
// ui.networkTab->setTabPosition(QTabWidget::West);
// }
// else if(Settings->value("TabWidget_Position","3").toInt() ==3)
// {
// qDebug() << "Tab East";
// ui.networkTab->setTabPosition(QTabWidget::East);
// }
//
// Settings->endGroup();
// }
void NetworkDialog::filterColumnChanged(int)
{

View File

@ -59,7 +59,7 @@ public slots:
void insertConnect();
// std::string loadneighbour();
/* void loadneighbour(); */
void updateNewDiscoveryInfo() ;
//void updateNewDiscoveryInfo() ;
protected:
void changeEvent(QEvent *e);
@ -87,17 +87,17 @@ private slots:
void on_actionCreate_New_Profile_activated();
void updateNetworkStatus();
//void updateNetworkStatus();
void loadtabsettings();
// void loadtabsettings();
void on_actionTabsright_activated();
void on_actionTabsnorth_activated();
void on_actionTabssouth_activated();
void on_actionTabswest_activated();
void on_actionTabsRounded_activated();
void on_actionTabsTriangular_activated();
// void on_actionTabsright_activated();
// void on_actionTabsnorth_activated();
// void on_actionTabssouth_activated();
// void on_actionTabswest_activated();
//
// void on_actionTabsRounded_activated();
// void on_actionTabsTriangular_activated();
void filterColumnChanged(int);
void filterItems(const QString &text);
@ -107,7 +107,7 @@ private:
QTreeWidget *connecttreeWidget;
class NetworkView *networkview;
// class NetworkView *networkview;
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);

View File

@ -6,46 +6,48 @@
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>346</height>
<width>825</width>
<height>567</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>6</number>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="topMargin">
<number>9</number>
<property name="text">
<string>Filter:</string>
</property>
<property name="rightMargin">
<number>6</number>
</widget>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Search Network</string>
</property>
<property name="bottomMargin">
<number>0</number>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showUnvalidKeys">
<property name="text">
<string>Show all accessible keys</string>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="networkTab">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="networkTab_1">
<attribute name="title">
<string>Network</string>
</attribute>
<layout class="QGridLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QTreeWidget" name="connecttreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -124,231 +126,6 @@
</property>
</column>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="titleBarFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/rs1.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Search Network</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showUnvalidKeys">
<property name="text">
<string>Show keys that are not validated by the PGP web of trust</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="viewButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Display</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QTabWidget" name="tabBottom">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="networkstatus">
<attribute name="title">
<string>Network Status</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<layout class="QGridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_netLimited">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabel_netLimited">
<property name="text">
<string>Local network</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_upnp">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabel_upnp">
<property name="text">
<string>UPnP</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QGridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_ext">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabel_ext">
<property name="text">
<string>External ip address finder</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>250</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QTreeWidget" name="unvalidGPGkeyWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
@ -394,9 +171,6 @@
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -118,9 +118,9 @@ void NetworkView::updateDisplay()
/* add all friends */
std::string ownGPGId = rsPeers->getGPGOwnId();
#ifdef DEBUG_NETWORKVIEW
//#ifdef DEBUG_NETWORKVIEW
std::cerr << "NetworkView::updateDisplay()" << std::endl;
#endif
//#endif
std::deque<NodeInfo> nodes_to_treat ; // list of nodes to be treated. Used as a queue. The int is the level of friendness
std::set<std::string> nodes_considered ; // list of nodes already considered. Eases lookup.

View File

@ -619,7 +619,7 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int
if (RemoteMode)
return tr("Friend");
else
return tr("Share Type");
return tr("Share Flags");
case 4:
if (RemoteMode)
return tr("What's new");
@ -665,7 +665,7 @@ QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int
if(RemoteMode)
return tr("Friend");
else
return tr("Share Type");
return tr("Share Flags");
case 4:
return tr("Directory");
}
@ -1307,8 +1307,9 @@ void FlatStyle_RDM::updateRefs()
#endif
_ref_stack.pop_back() ;
DirDetails details ;
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (requestDirDetails(ref, details, RS_FILE_HINTS_REMOTE))
if (requestDirDetails(ref, details, flags))
{
if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons.
_ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(details)));

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>331</height>
<width>758</width>
<height>339</height>
</rect>
</property>
<property name="sizePolicy">
@ -16,14 +16,8 @@
<verstretch>1</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="titleBarFrame">
<property name="maximumSize">
<size>
@ -41,6 +35,281 @@
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="searchLineFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="LineEditClear" name="lineEdit">
<property name="toolTip">
<string>Enter a keyword here (at least 3 char long)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSearch">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start Search</string>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="toggleAdvancedSearchBtn">
<property name="toolTip">
<string>Advanced Search</string>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_friendListsearch_SB">
<property name="toolTip">
<string>Search inside &quot;browsable&quot; files of your friends</string>
</property>
<property name="text">
<string>Browsable files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_anonF2Fsearch_CB">
<property name="toolTip">
<string>Multi-hop search at distance 6 in the network
(always reports available files)</string>
</property>
<property name="text">
<string>Distant</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_ownFiles_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Include files from your own file list in the search result</string>
</property>
<property name="text">
<string>Own files</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cloaseallsearchresultsButton">
<property name="toolTip">
<string>Close all Search Results</string>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeWidget" name="searchSummaryWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>KeyWords</string>
</property>
</column>
<column>
<property name="text">
<string>Results</string>
</property>
</column>
<column>
<property name="text">
<string>Search Id</string>
</property>
</column>
</widget>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="SearchTreeWidget" name="searchResultWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Sources</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Filter Search Result</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Max results:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_max_results_SB">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="FileTypeComboBox">
<item>
@ -127,252 +396,6 @@
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="searchLineFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="LineEditClear" name="lineEdit">
<property name="toolTip">
<string>Enter a keyword here (at least 3 char long)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSearch">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start Search</string>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="toggleAdvancedSearchBtn">
<property name="toolTip">
<string>Advanced Search</string>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeWidget" name="searchSummaryWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>KeyWords</string>
</property>
</column>
<column>
<property name="text">
<string>Results</string>
</property>
</column>
<column>
<property name="text">
<string>Search Id</string>
</property>
</column>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<widget class="SearchTreeWidget" name="searchResultWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Sources</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
</widget>
</item>
<item row="0" column="0">
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Filter Search Result</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="cloaseallsearchresultsButton">
<property name="toolTip">
<string>Close all Search Results</string>
</property>
<property name="text">
<string>Close All Search Results</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>29</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonDownload">
<property name="minimumSize">
<size>
@ -390,7 +413,7 @@
<string>Download Selected</string>
</property>
<property name="text">
<string>Download</string>
<string>Download selected</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
@ -398,114 +421,11 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QFrame" name="buttonFrame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>38</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>3</number>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="_ownFiles_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Include files from your own file list in the search result</string>
</property>
<property name="text">
<string>Include my files</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="_friendListsearch_SB">
<property name="toolTip">
<string>Search inside &quot;browsable&quot; files of your friends</string>
</property>
<property name="text">
<string>Search in friends lists</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="_anonF2Fsearch_CB">
<property name="toolTip">
<string>Multi-hop search at distance 6 in the network
(always reports available files)</string>
</property>
<property name="text">
<string>F2F search</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Limit number of results to :</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="_max_results_SB">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>5</height>
</size>
</property>
</spacer>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>

View File

@ -35,6 +35,7 @@
#include "AddLinksDialog.h"
#endif
#include "RetroShareLink.h"
#include "ShareManager.h"
#include "RemoteDirModel.h"
#include "ShareDialog.h"
#include "common/PeerDefs.h"
@ -90,36 +91,23 @@ private:
};
/** Constructor */
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareDirModel *_flat_model,QWidget *parent)
: RsAutoUpdatePage(1000,parent),model(NULL)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.checkButton, SIGNAL(clicked()), this, SLOT(forceCheck()));
connect(ui.localButton, SIGNAL(toggled(bool)), this, SLOT(showFrame(bool)));
connect(ui.remoteButton, SIGNAL(toggled(bool)), this, SLOT(showFrameRemote(bool)));
connect(ui.splittedButton, SIGNAL(toggled(bool)), this, SLOT(showFrameSplitted(bool)));
//== connect(ui.localButton, SIGNAL(toggled(bool)), this, SLOT(showFrame(bool)));
//== connect(ui.remoteButton, SIGNAL(toggled(bool)), this, SLOT(showFrameRemote(bool)));
//== connect(ui.splittedButton, SIGNAL(toggled(bool)), this, SLOT(showFrameSplitted(bool)));
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
connect( ui.localDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sharedDirTreeWidgetContextMenu( QPoint ) ) );
connect( ui.remoteDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirtreeviewCostumPopupMenu( QPoint ) ) );
// connect( ui.remoteDirTreeView, SIGNAL( doubleClicked(const QModelIndex&)), this, SLOT( downloadRemoteSelected()));
connect( ui.downloadButton, SIGNAL( clicked()), this, SLOT( downloadRemoteSelected()));
connect( ui.dirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
connect(ui.indicatorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indicatorChanged(int)));
/*
connect( ui.remoteDirTreeView, SIGNAL( itemExpanded( QTreeWidgetItem * ) ),
this, SLOT( checkForLocalDirRequest( QTreeWidgetItem * ) ) );
connect( ui.localDirTreeWidget, SIGNAL( itemExpanded( QTreeWidgetItem * ) ),
this, SLOT( checkForRemoteDirRequest( QTreeWidgetItem * ) ) );
*/
tree_model = new TreeStyle_RDM(true);
flat_model = new FlatStyle_RDM(true);
tree_model = _tree_model ;
flat_model = _flat_model ;
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
tree_proxyModel->setDynamicSortFilter(true);
@ -135,88 +123,31 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
flat_proxyModel->sort(0);
localModel = new TreeStyle_RDM(false);
localProxyModel = new SFDSortFilterProxyModel(localModel, this);
localProxyModel->setDynamicSortFilter(true);
localProxyModel->setSourceModel(localModel);
localProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
localProxyModel->setSortRole(RetroshareDirModel::SortRole);
localProxyModel->sort(0);
ui.localDirTreeView->setModel(localProxyModel);
connect( ui.localDirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), localModel, SLOT( collapsed(const QModelIndex & ) ) );
connect( ui.localDirTreeView, SIGNAL( expanded(const QModelIndex & ) ), localModel, SLOT( expanded(const QModelIndex & ) ) );
connect( localModel, SIGNAL( layoutAboutToBeChanged() ), ui.localDirTreeView, SLOT( reset() ) );
connect( localModel, SIGNAL( layoutChanged() ), ui.localDirTreeView, SLOT( update() ) );
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
connect(ui.filterPatternLineEdit, SIGNAL(returnPressed()), this, SLOT(startFilter()));
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
/* Set header resize modes and initial section sizes */
QHeaderView * l_header = ui.localDirTreeView->header () ;
QHeaderView * header = ui.dirTreeView->header () ;
header->setResizeMode (0, QHeaderView::Interactive);
l_header->resizeSection ( 0, 490 );
l_header->resizeSection ( 1, 70 );
l_header->resizeSection ( 2, 100 );
l_header->resizeSection ( 3, 100 );
l_header->resizeSection ( 4, 100 );
header->resizeSection ( 0, 490 );
header->resizeSection ( 1, 70 );
header->resizeSection ( 2, 100 );
header->resizeSection ( 3, 100 );
header->resizeSection ( 4, 100 );
l_header->setStretchLastSection(false);
// l_header->setHighlightSections(false);
// Setup the current view model.
//
changeCurrentViewModel(ui.viewType_CB->currentIndex()) ;
/* Set header resize modes and initial section sizes */
QHeaderView * r_header = ui.remoteDirTreeView->header () ;
r_header->setResizeMode (0, QHeaderView::Interactive);
r_header->setStretchLastSection(false);
// r_header->setResizeMode (1, QHeaderView::Fixed);
// // r_header->setResizeMode (2, QHeaderView::Interactive);
// r_header->setResizeMode (3, QHeaderView::Fixed);
// // r_header->setResizeMode (4, QHeaderView::Interactive);
r_header->resizeSection ( 0, 490 );
r_header->resizeSection ( 1, 70 );
r_header->resizeSection ( 2, 80 );
r_header->resizeSection ( 3, 100 );
r_header->resizeSection ( 4, 80 );
// r_header->setHighlightSections(false);
header->setStretchLastSection(false);
/* Set Multi Selection */
ui.remoteDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
ui.localDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
//#ifdef RS_RELEASE_VERSION
// ui.filterLabel->hide();
// ui.filterPatternLineEdit->hide();
//#endif
// load settings
processSettings(true);
// Hide columns after loading the settings
ui.remoteDirTreeView->setColumnHidden(3,false) ;
ui.remoteDirTreeView->setColumnHidden(4,true) ;
ui.localDirTreeView->setColumnHidden(4,false) ;
ui.dirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
copylinklocalAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard" ), this );
connect( copylinklocalAct , SIGNAL( triggered() ), this, SLOT( copyLinkLocal() ) );
copylinklocalhtmlAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard (HTML)" ), this );
connect( copylinklocalhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard" ), this );
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
copylinkhtmlAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard (HTML)" ), this );
connect( copylinkhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
#ifdef RS_USE_LINKS
@ -225,21 +156,62 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
addlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Add Links to Cloud" ), this );
connect( addlinkCloudAct , SIGNAL( triggered() ), this, SLOT( addLinkToCloud( ) ) );
#endif
}
LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
: SharedFilesDialog(new TreeStyle_RDM(false),new FlatStyle_RDM(false),parent)
{
// Hide columns after loading the settings
ui.dirTreeView->setColumnHidden(4,false) ;
ui.downloadButton->hide() ;
// load settings
processSettings(true);
// Setup the current view model.
//
changeCurrentViewModel(ui.viewType_CB->currentIndex()) ;
connect(ui.addShares_PB, SIGNAL(clicked()), this, SLOT(addShares()));
connect(ui.checkButton, SIGNAL(clicked()), this, SLOT(forceCheck()));
createcollectionfileAct = new QAction(QIcon(IMAGE_COLLECTION), tr("Create collection file"), this);
connect(createcollectionfileAct, SIGNAL(triggered()), this, SLOT(createCollectionFile()));
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
editshareAct = new QAction(QIcon(IMAGE_EDITSHARE), tr("Edit Share Permissions"), this);
connect(createcollectionfileAct, SIGNAL(triggered()), this, SLOT(createCollectionFile()));
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
connect(editshareAct, SIGNAL(triggered()), this, SLOT(editSharePermissions()));
}
RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
: SharedFilesDialog(new TreeStyle_RDM(true),new FlatStyle_RDM(true),parent)
{
ui.dirTreeView->setColumnHidden(3,false) ;
ui.dirTreeView->setColumnHidden(4,true) ;
ui.checkButton->hide() ;
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
// load settings
processSettings(true);
// Setup the current view model.
//
changeCurrentViewModel(ui.viewType_CB->currentIndex()) ;
ui.addShares_PB->hide() ;
}
void LocalSharedFilesDialog::addShares()
{
ShareManager::showYourself();
}
void SharedFilesDialog::hideEvent(QHideEvent *)
{
if(model!=NULL)
model->setVisible(false) ;
//std::cerr << "Hidden!"<< std::endl;
}
void SharedFilesDialog::showEvent(QShowEvent *)
{
@ -248,15 +220,50 @@ void SharedFilesDialog::showEvent(QShowEvent *)
model->setVisible(true) ;
model->update() ;
}
//std::cerr << "Shown!"<< std::endl;
}
SharedFilesDialog::~SharedFilesDialog()
RemoteSharedFilesDialog::~RemoteSharedFilesDialog()
{
// save settings
processSettings(false);
}
void SharedFilesDialog::processSettings(bool bLoad)
LocalSharedFilesDialog::~LocalSharedFilesDialog()
{
// save settings
processSettings(false);
}
void LocalSharedFilesDialog::processSettings(bool bLoad)
{
Settings->beginGroup("LocalSharedFilesDialog");
if (bLoad) {
// load settings
// state of the trees
ui.dirTreeView->header()->restoreState(Settings->value("LocalDirTreeView").toByteArray());
// state of splitter
ui.splitter->restoreState(Settings->value("LocalSplitter").toByteArray());
// view type
ui.viewType_CB->setCurrentIndex(Settings->value("LocalViewType").toInt());
} else {
// save settings
// state of trees
Settings->setValue("LocalDirTreeView", ui.dirTreeView->header()->saveState());
// state of splitter
Settings->setValue("LocalSplitter", ui.splitter->saveState());
// view type
Settings->setValue("LocalViewType", ui.viewType_CB->currentIndex());
}
Settings->endGroup();
}
void RemoteSharedFilesDialog::processSettings(bool bLoad)
{
Settings->beginGroup("SharedFilesDialog");
@ -264,26 +271,24 @@ void SharedFilesDialog::processSettings(bool bLoad)
// load settings
// state of the trees
ui.localDirTreeView->header()->restoreState(Settings->value("LocalDirTreeView").toByteArray());
ui.remoteDirTreeView->header()->restoreState(Settings->value("RemoteDirTreeView").toByteArray());
ui.dirTreeView->header()->restoreState(Settings->value("RemoteDirTreeView").toByteArray());
// state of splitter
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
ui.splitter->restoreState(Settings->value("RemoteSplitter").toByteArray());
// view type
ui.viewType_CB->setCurrentIndex(Settings->value("ViewType").toInt());
ui.viewType_CB->setCurrentIndex(Settings->value("RemoteViewType").toInt());
} else {
// save settings
// state of trees
Settings->setValue("LocalDirTreeView", ui.localDirTreeView->header()->saveState());
Settings->setValue("RemoteDirTreeView", ui.remoteDirTreeView->header()->saveState());
Settings->setValue("RemoteDirTreeView", ui.dirTreeView->header()->saveState());
// state of splitter
Settings->setValue("Splitter", ui.splitter->saveState());
Settings->setValue("RemoteSplitter", ui.splitter->saveState());
// view type
Settings->setValue("ViewType", ui.viewType_CB->currentIndex());
Settings->setValue("RemoteViewType", ui.viewType_CB->currentIndex());
}
Settings->endGroup();
@ -291,18 +296,51 @@ void SharedFilesDialog::processSettings(bool bLoad)
void SharedFilesDialog::changeCurrentViewModel(int c)
{
disconnect( ui.remoteDirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), 0, 0 );
disconnect( ui.remoteDirTreeView, SIGNAL( expanded(const QModelIndex & ) ), 0, 0 );
disconnect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), 0, 0 );
disconnect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), 0, 0 );
if(model!=NULL)
model->setVisible(false) ;
if(c == 0)
if(c==0)
{
model = tree_model ;
proxyModel = tree_proxyModel ;
ui.remoteDirTreeView->setColumnHidden(3,true) ;
ui.remoteDirTreeView->setColumnHidden(4,true) ;
}
else
{
model = flat_model ;
proxyModel = flat_proxyModel ;
}
showProperColumns() ;
if(isVisible())
{
model->setVisible(true) ;
model->update() ;
}
connect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), model, SLOT( collapsed(const QModelIndex & ) ) );
connect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), model, SLOT( expanded(const QModelIndex & ) ) );
ui.dirTreeView->setModel(proxyModel);
ui.dirTreeView->update();
ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
if(c == 1)
#endif
FilterItems();
}
void LocalSharedFilesDialog::showProperColumns()
{
if(model == tree_model)
{
ui.dirTreeView->setColumnHidden(3,false) ;
ui.dirTreeView->setColumnHidden(4,false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->hide();
ui.filterPatternLineEdit->hide();
@ -312,37 +350,39 @@ void SharedFilesDialog::changeCurrentViewModel(int c)
}
else
{
model = flat_model ;
proxyModel = flat_proxyModel ;
ui.remoteDirTreeView->setColumnHidden(3,false) ;
ui.remoteDirTreeView->setColumnHidden(4,false) ;
ui.dirTreeView->setColumnHidden(3,true) ;
ui.dirTreeView->setColumnHidden(4,false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->show();
ui.filterPatternLineEdit->show();
#endif
}
if(isVisible())
}
void RemoteSharedFilesDialog::showProperColumns()
{
if(model == tree_model)
{
model->setVisible(true) ;
model->update() ;
}
connect( ui.remoteDirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), model, SLOT( collapsed(const QModelIndex & ) ) );
connect( ui.remoteDirTreeView, SIGNAL( expanded(const QModelIndex & ) ), model, SLOT( expanded(const QModelIndex & ) ) );
ui.remoteDirTreeView->setModel(proxyModel);
ui.remoteDirTreeView->update();
ui.remoteDirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ;
ui.dirTreeView->setColumnHidden(3,true) ;
ui.dirTreeView->setColumnHidden(4,true) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
if(c == 1)
ui.filterLabel->hide();
ui.filterPatternLineEdit->hide();
ui.filterStartButton->hide();
ui.filterClearButton->hide();
#endif
FilterItems();
}
else
{
ui.dirTreeView->setColumnHidden(3,false) ;
ui.dirTreeView->setColumnHidden(4,false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->show();
ui.filterPatternLineEdit->show();
#endif
}
}
void SharedFilesDialog::checkUpdate()
void LocalSharedFilesDialog::checkUpdate()
{
/* update */
if (rsFiles->InDirectoryCheck())
@ -359,17 +399,15 @@ void SharedFilesDialog::checkUpdate()
return;
}
void SharedFilesDialog::forceCheck()
void LocalSharedFilesDialog::forceCheck()
{
rsFiles->ForceDirectoryCheck();
return;
}
void SharedFilesDialog::shareddirtreeviewCostumPopupMenu( QPoint point )
void RemoteSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
{
QModelIndex idx = ui.remoteDirTreeView->indexAt(point);
QModelIndex idx = ui.dirTreeView->indexAt(point);
if (!idx.isValid())
return;
QModelIndex midx = proxyModel->mapToSource(idx);
@ -388,36 +426,25 @@ void SharedFilesDialog::shareddirtreeviewCostumPopupMenu( QPoint point )
contextMnu.addAction( downloadAct);
if (type == DIR_TYPE_FILE) {
QAction *copyremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), &contextMnu );
connect( copyremotelinkAct , SIGNAL( triggered() ), this, SLOT( copyLinkRemote() ) );
//QAction *copyremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), &contextMnu );
//connect( copyremotelinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
QAction *sendremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), &contextMnu );
connect( sendremotelinkAct , SIGNAL( triggered() ), this, SLOT( sendremoteLinkTo( ) ) );
//QAction *sendremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), &contextMnu );
//connect( sendremotelinkAct , SIGNAL( triggered() ), this, SLOT( sendremoteLinkTo( ) ) );
contextMnu.addSeparator();
contextMnu.addAction( copyremotelinkAct);
contextMnu.addAction( sendremotelinkAct);
contextMnu.addAction( copylinkAct);
contextMnu.addAction( sendlinkAct);
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(addMsgRemoteSelected()));
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg()));
}
contextMnu.exec(QCursor::pos());
}
QModelIndexList SharedFilesDialog::getLocalSelected()
QModelIndexList SharedFilesDialog::getSelected()
{
QModelIndexList list = ui.localDirTreeView->selectionModel()->selectedIndexes();
QModelIndexList proxyList;
for (QModelIndexList::iterator index = list.begin(); index != list.end(); index++) {
proxyList.append(localProxyModel->mapToSource(*index));
}
return proxyList;
}
QModelIndexList SharedFilesDialog::getRemoteSelected()
{
QModelIndexList list = ui.remoteDirTreeView->selectionModel()->selectedIndexes();
QModelIndexList list = ui.dirTreeView->selectionModel()->selectedIndexes();
QModelIndexList proxyList;
for (QModelIndexList::iterator index = list.begin(); index != list.end(); index++) {
proxyList.append(proxyModel->mapToSource(*index));
@ -426,27 +453,27 @@ QModelIndexList SharedFilesDialog::getRemoteSelected()
return proxyList;
}
void SharedFilesDialog::createCollectionFile()
void LocalSharedFilesDialog::createCollectionFile()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Creating a collection file!" << std::endl;
QModelIndexList lst = getLocalSelected();
localModel->createCollectionFile(this, lst);
QModelIndexList lst = getSelected();
model->createCollectionFile(this, lst);
}
void SharedFilesDialog::downloadRemoteSelected()
void RemoteSharedFilesDialog::downloadRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Downloading Files";
std::cerr << std::endl;
QModelIndexList lst = getRemoteSelected();
QModelIndexList lst = getSelected();
model -> downloadSelected(lst);
}
void SharedFilesDialog::editSharePermissions()
void LocalSharedFilesDialog::editSharePermissions()
{
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
@ -468,10 +495,7 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
{
std::vector<DirDetails> dirVec;
if (remote)
model->getDirDetailsFromSelect(lst, dirVec);
else
localModel->getDirDetailsFromSelect(lst, dirVec);
QList<RetroShareLink> urls ;
@ -509,55 +533,24 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
RSLinkClipboard::copyLinks(urls) ;
}
void SharedFilesDialog::copyLinkRemote()
void SharedFilesDialog::copyLink()
{
QModelIndexList lst = getRemoteSelected();
copyLink (lst, true);
}
void SharedFilesDialog::copyLinkLocal()
{
QModelIndexList lst = getLocalSelected();
copyLink (lst, false);
copyLink ( getSelected() , isRemote());
}
void SharedFilesDialog::copyLinkhtml( )
{
copyLinkLocal ();
copyLink();
QString link = QApplication::clipboard()->text();
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText("<a href='" + link + "'> " + link + "</a>");
}
void SharedFilesDialog::sendremoteLinkTo()
{
copyLinkRemote ();
/* create a message */
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
/* fill it in
* files are receommended already
* just need to set peers
*/
std::cerr << "SharedFilesDialog::sendremoteLinkTo()" << std::endl;
nMsgDialog->setTitleText(tr("RetroShare Link"));
nMsgDialog->setMsgText(RSLinkClipboard::toHtml(), true);
nMsgDialog->show();
/* window will destroy itself! */
}
void SharedFilesDialog::sendLinkTo()
{
copyLinkLocal ();
copyLink();
/* create a message */
MessageComposer *nMsgDialog = MessageComposer::newMsg();
@ -581,7 +574,7 @@ void SharedFilesDialog::sendLinkTo()
#ifdef RS_USE_LINKS
void SharedFilesDialog::sendLinkToCloud()
{
copyLinkLocal ();
copyLink();
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
@ -593,7 +586,7 @@ void SharedFilesDialog::sendLinkToCloud()
void SharedFilesDialog::addLinkToCloud()
{
copyLinkLocal ();
copyLink();
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
@ -603,7 +596,7 @@ void SharedFilesDialog::addLinkToCloud()
}
#endif
void SharedFilesDialog::playselectedfiles()
void LocalSharedFilesDialog::playselectedfiles()
{
/* call back to the model (which does all the interfacing? */
@ -611,7 +604,7 @@ void SharedFilesDialog::playselectedfiles()
std::cerr << std::endl;
std::list<std::string> paths;
localModel -> getFilePaths(getLocalSelected(), paths);
model -> getFilePaths(getSelected(), paths);
std::list<std::string>::iterator it;
QStringList fullpaths;
@ -623,7 +616,6 @@ void SharedFilesDialog::playselectedfiles()
std::cerr << "Playing: " << fullpath;
std::cerr << std::endl;
}
playFiles(fullpaths);
@ -632,35 +624,11 @@ void SharedFilesDialog::playselectedfiles()
std::cerr << std::endl;
}
void SharedFilesDialog::addMsgRemoteSelected()
{
std::list<DirDetails> files_info ;
model->getFileInfoFromIndexList(getRemoteSelected(),files_info);
if(files_info.empty())
return ;
/* create a message */
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
nMsgDialog->setFileList(files_info) ;
nMsgDialog->setTitleText(tr("Recommendation(s)"));
nMsgDialog->setMsgText(tr("Recommendation(s)"));
nMsgDialog->show();
/* window will destroy itself! */
}
void SharedFilesDialog::recommendFilesToMsg()
{
std::list<DirDetails> files_info ;
localModel->getFileInfoFromIndexList(getLocalSelected(),files_info);
model->getFileInfoFromIndexList(getSelected(),files_info);
if(files_info.empty())
return ;
@ -680,98 +648,75 @@ void SharedFilesDialog::recommendFilesToMsg()
/* window will destroy itself! */
}
void SharedFilesDialog::openfile()
void LocalSharedFilesDialog::openfile()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "SharedFilesDialog::openfile" << std::endl;
QModelIndexList qmil = getLocalSelected();
localModel->openSelected(qmil);
QModelIndexList qmil = getSelected();
model->openSelected(qmil);
}
void SharedFilesDialog::openfolder()
void LocalSharedFilesDialog::openfolder()
{
std::cerr << "SharedFilesDialog::openfolder" << std::endl;
QModelIndexList qmil = getLocalSelected();
localModel->openSelected(qmil);
QModelIndexList qmil = getSelected();
model->openSelected(qmil);
}
void SharedFilesDialog::preModDirectories(bool update_local)
void SharedFilesDialog::preModDirectories()
{
//std::cerr << "SharedFilesDialog::preModDirectories called with update_local = " << update_local << std::endl ;
if (update_local)
localModel->preMods();
else
model->preMods();
}
void SharedFilesDialog::postModDirectories(bool update_local)
void SharedFilesDialog::postModDirectories()
{
//std::cerr << "SharedFilesDialog::postModDirectories called with update_local = " << update_local << std::endl ;
if (update_local)
{
localModel->postMods();
ui.localDirTreeView->update() ;
}
else
{
model->postMods();
ui.remoteDirTreeView->update() ;
ui.dirTreeView->update() ;
if (ui.filterPatternLineEdit->text().isEmpty() == false) {
if (ui.filterPatternLineEdit->text().isEmpty() == false)
FilterItems();
}
}
QCoreApplication::flush();
}
void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
{
if (!rsPeers) {
if (!rsPeers)
{
/* not ready yet! */
return;
}
QModelIndex idx = ui.localDirTreeView->indexAt(point);
QModelIndex idx = ui.dirTreeView->indexAt(point);
if (!idx.isValid())
return;
QModelIndex midx = localProxyModel->mapToSource(idx);
QModelIndex midx = proxyModel->mapToSource(idx);
if (!midx.isValid())
return;
currentFile = localModel->data(midx, RetroshareDirModel::FileNameRole).toString();
currentFile = model->data(midx, RetroshareDirModel::FileNameRole).toString();
int type = localModel->getType(midx);
int type = model->getType(midx);
QMenu contextMnu(this);
// QAction* menuAction = fileAssotiationAction(currentFile) ;
//new QAction(QIcon(IMAGE_PLAY), currentFile, this);
//tr( "111Play File(s)" ), this );
// connect( openfolderAct , SIGNAL( triggered() ), this,
// SLOT( playselectedfiles() ) );
switch (type) {
switch (type)
{
case DIR_TYPE_DIR:
contextMnu.addAction(openfolderAct);
//contextMnu.addSeparator();
//contextMnu.addAction(editshareAct) ;
contextMnu.addSeparator();
contextMnu.addSeparator() ;
contextMnu.addAction(createcollectionfileAct) ;
break;
case DIR_TYPE_FILE:
contextMnu.addAction(openfileAct);
contextMnu.addSeparator();
contextMnu.addAction(copylinklocalAct);
// contextMnu.addAction(copylinklocalhtmlAct);
contextMnu.addAction(copylinkAct);
contextMnu.addAction(sendlinkAct);
// contextMnu.addAction(sendhtmllinkAct);
contextMnu.addSeparator();
contextMnu.addAction(createcollectionfileAct) ;
contextMnu.addSeparator();
@ -793,7 +738,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
//============================================================================
QAction*
SharedFilesDialog::fileAssotiationAction(const QString /*fileName*/)
LocalSharedFilesDialog::fileAssotiationAction(const QString /*fileName*/)
{
QAction* result = 0;
@ -824,22 +769,17 @@ SharedFilesDialog::fileAssotiationAction(const QString /*fileName*/)
//============================================================================
void
SharedFilesDialog::runCommandForFile()
LocalSharedFilesDialog::runCommandForFile()
{
QStringList tsl;
tsl.append( currentFile );
QProcess::execute( currentCommand, tsl);
//QString("%1 %2").arg(currentCommand).arg(currentFile) );
// QString tmess = "Some command(%1) should be executed here for file %2";
// tmess = tmess.arg(currentCommand).arg(currentFile);
// QMessageBox::warning(this, tr("RetroShare"), tmess, QMessageBox::Ok);
}
//============================================================================
void
SharedFilesDialog::tryToAddNewAssotiation()
LocalSharedFilesDialog::tryToAddNewAssotiation()
{
AddFileAssociationDialog afad(true, this);//'add file assotiations' dialog
@ -856,72 +796,18 @@ SharedFilesDialog::tryToAddNewAssotiation()
}
}
//============================================================================
/**
Toggles the Splitted, Remote and Local View on and off*/
void SharedFilesDialog::showFrame(bool show)
{
if (show) {
ui.localframe->setVisible(true);
ui.remoteframe->setVisible(false);
ui.localButton->setChecked(true);
ui.remoteButton->setChecked(false);
ui.splittedButton->setChecked(false);
ui.titleBarLabel->setText( tr("<strong>My Shared Files</strong>"));
}
}
void SharedFilesDialog::showFrameRemote(bool show)
{
if (show) {
ui.remoteframe->setVisible(true);
ui.localframe->setVisible(false);
ui.remoteButton->setChecked(true);
ui.localButton->setChecked(false);
ui.splittedButton->setChecked(false);
ui.titleBarLabel->setText( tr("<strong>Friends Files</strong>"));
}
}
void SharedFilesDialog::showFrameSplitted(bool show)
{
if (show) {
ui.remoteframe->setVisible(true);
ui.localframe->setVisible(true);
ui.splittedButton->setChecked(true);
ui.localButton->setChecked(false);
ui.remoteButton->setChecked(false);
ui.titleBarLabel->setText( tr("<strong>Files</strong>"));
}
}
void SharedFilesDialog::indicatorChanged(int index)
{
static uint32_t correct_indicator[4] = { IND_ALWAYS,IND_LAST_DAY,IND_LAST_WEEK,IND_LAST_MONTH } ;
model->changeAgeIndicator(correct_indicator[index]);
localModel->changeAgeIndicator(correct_indicator[index]);
ui.remoteDirTreeView->update(ui.remoteDirTreeView->rootIndex());
ui.localDirTreeView->update(ui.localDirTreeView->rootIndex()) ;
ui.dirTreeView->update(ui.dirTreeView->rootIndex());
if (correct_indicator[index] != IND_ALWAYS)
{
ui.remoteDirTreeView->sortByColumn(2, Qt::AscendingOrder);
}
ui.dirTreeView->sortByColumn(2, Qt::AscendingOrder);
else
{
ui.remoteDirTreeView->sortByColumn(0, Qt::AscendingOrder);
}
ui.dirTreeView->sortByColumn(0, Qt::AscendingOrder);
updateDisplay() ;
}
@ -968,12 +854,12 @@ void SharedFilesDialog::FilterItems()
setCursor(Qt::WaitCursor);
QCoreApplication::processEvents() ;
int rowCount = ui.remoteDirTreeView->model()->rowCount();
int rowCount = ui.dirTreeView->model()->rowCount();
for (int row = 0; row < rowCount; row++)
if(proxyModel == tree_proxyModel)
tree_FilterItem(ui.remoteDirTreeView->model()->index(row, 0), text, 0);
tree_FilterItem(ui.dirTreeView->model()->index(row, 0), text, 0);
else
flat_FilterItem(ui.remoteDirTreeView->model()->index(row, 0), text, 0);
flat_FilterItem(ui.dirTreeView->model()->index(row, 0), text, 0);
setCursor(Qt::ArrowCursor);
}
@ -982,12 +868,12 @@ bool SharedFilesDialog::flat_FilterItem(const QModelIndex &index, const QString
{
if(index.data(RetroshareDirModel::FileNameRole).toString().contains(text, Qt::CaseInsensitive))
{
ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), false);
ui.dirTreeView->setRowHidden(index.row(), index.parent(), false);
return false ;
}
else
{
ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), true);
ui.dirTreeView->setRowHidden(index.row(), index.parent(), true);
return true ;
}
}
@ -1008,17 +894,17 @@ bool SharedFilesDialog::tree_FilterItem(const QModelIndex &index, const QString
}
int visibleChildCount = 0;
int rowCount = ui.remoteDirTreeView->model()->rowCount(index);
int rowCount = ui.dirTreeView->model()->rowCount(index);
for (int row = 0; row < rowCount; row++) {
if (tree_FilterItem(ui.remoteDirTreeView->model()->index(row, index.column(), index), text, level + 1)) {
if (tree_FilterItem(ui.dirTreeView->model()->index(row, index.column(), index), text, level + 1)) {
visibleChildCount++;
}
}
if (visible || visibleChildCount) {
ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), false);
ui.dirTreeView->setRowHidden(index.row(), index.parent(), false);
} else {
ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), true);
ui.dirTreeView->setRowHidden(index.row(), index.parent(), true);
}
return (visible || visibleChildCount);

View File

@ -34,55 +34,44 @@ class SharedFilesDialog : public RsAutoUpdatePage
public:
/** Default Constructor */
SharedFilesDialog(QWidget *parent = 0);
/** Default Destructor */
~SharedFilesDialog();
SharedFilesDialog(RetroshareDirModel *tree_model,RetroshareDirModel *flat_model,QWidget *parent = 0);
/** Default Destructor */
~SharedFilesDialog() {}
virtual void updatePage() { checkUpdate() ; }
virtual void hideEvent(QHideEvent *) ;
virtual void showEvent(QShowEvent *) ;
protected:
QTreeView *directoryView() ;
virtual void showProperColumns() = 0 ;
virtual bool isRemote() const = 0 ;
protected slots:
virtual void spawnCustomPopupMenu(QPoint point) = 0;
private slots:
/* For handling the model updates */
void preModDirectories(bool update_local);
void postModDirectories(bool update_local);
void checkUpdate();
void forceCheck();
void preModDirectories() ;
void postModDirectories() ;
/** Create the context popup menu and it's submenus */
void shareddirtreeviewCostumPopupMenu( QPoint point );
// void customPopupMenu(QPoint point) ;
void sharedDirTreeWidgetContextMenu( QPoint point );
void downloadRemoteSelected();
void createCollectionFile();
void addMsgRemoteSelected();
void copyLinkRemote();
void copyLinkLocal();
void copyLink();
void copyLinkhtml();
void sendLinkTo();
void sendremoteLinkTo();
#ifdef RS_USE_LINKS
void sendLinkToCloud();
void addLinkToCloud();
#endif
void showFrame(bool show);
void showFrameRemote(bool show);
void showFrameSplitted(bool show);
void playselectedfiles();
void openfile();
void openfolder();
void editSharePermissions();
//== void showFrame(bool show);
//== void showFrameRemote(bool show);
//== void showFrameSplitted(bool show);
void recommendFilesToMsg();
void runCommandForFile();
void tryToAddNewAssotiation();
void indicatorChanged(int index);
@ -95,7 +84,12 @@ private slots:
signals:
void playFiles(QStringList files);
private:
protected:
/** Qt Designer generated object */
Ui::SharedFilesDialog ui;
virtual void processSettings(bool bLoad) = 0;
protected:
//now context menu are created again every time theu are called ( in some
//slots.. Maybe it's not good...
//** Define the popup menus for the Context menu */
@ -103,34 +97,23 @@ private:
//QMenu* contextMnu2;
void processSettings(bool bLoad);
void copyLink (const QModelIndexList& lst, bool remote);
void FilterItems();
bool tree_FilterItem(const QModelIndex &index, const QString &text, int level);
bool flat_FilterItem(const QModelIndex &index, const QString &text, int level);
QModelIndexList getRemoteSelected();
QModelIndexList getLocalSelected();
QModelIndexList getSelected();
/** Defines the actions for the context menu for QTreeWidget */
QAction* openfileAct;
QAction* createcollectionfileAct;
QAction* openfolderAct;
QAction* copyremotelinkAct;
QAction* copylinklocalAct;
QAction* copylinkAct;
QAction* sendlinkAct;
QAction* editshareAct;
#ifdef RS_USE_LINKS
QAction* sendlinkCloudAct;
QAction* addlinkCloudAct;
#endif
QAction* sendchatlinkAct;
QAction* copylinklocalhtmlAct;
/** Qt Designer generated object */
Ui::SharedFilesDialog ui;
QAction* copylinkhtmlAct;
/* RetroshareDirModel */
RetroshareDirModel *tree_model;
@ -140,15 +123,65 @@ private:
QSortFilterProxyModel *flat_proxyModel;
QSortFilterProxyModel *proxyModel;
RetroshareDirModel *localModel;
QSortFilterProxyModel *localProxyModel;
QString currentCommand;
QString currentFile;
QString lastFilterString;
};
class LocalSharedFilesDialog : public SharedFilesDialog
{
Q_OBJECT
public:
LocalSharedFilesDialog(QWidget *parent=NULL) ;
virtual ~LocalSharedFilesDialog();
virtual void spawnCustomPopupMenu(QPoint point);
virtual void updatePage() { checkUpdate() ; }
protected:
virtual void processSettings(bool bLoad) ;
virtual void showProperColumns() ;
virtual bool isRemote() const { return false ; }
private slots:
void addShares();
void createCollectionFile();
void checkUpdate() ;
void editSharePermissions();
void playselectedfiles();
void openfile();
void openfolder();
void runCommandForFile();
void tryToAddNewAssotiation();
void forceCheck();
QAction* fileAssotiationAction(const QString fileName);
private:
QAction* openfileAct;
QAction* createcollectionfileAct;
QAction* openfolderAct;
QAction* editshareAct;
};
class RemoteSharedFilesDialog : public SharedFilesDialog
{
Q_OBJECT
public:
RemoteSharedFilesDialog(QWidget *parent=NULL) ;
virtual ~RemoteSharedFilesDialog() ;
virtual void spawnCustomPopupMenu(QPoint point);
protected:
virtual void processSettings(bool bLoad) ;
virtual void showProperColumns() ;
virtual bool isRemote() const { return true ; }
private slots:
void downloadRemoteSelected();
};
#endif

View File

@ -14,167 +14,6 @@
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QFrame" name="remoteframe">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeView" name="remoteDirTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="autoExpandDelay">
<number>0</number>
</property>
<property name="itemsExpandable">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="localframe">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeView" name="localDirTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<property name="topMargin">
<number>2</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="downloadButton">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>Download selected</string>
</property>
<property name="text">
<string>Download</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>391</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="checkButton">
<property name="text">
<string>check files</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="hashLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy">
@ -297,8 +136,7 @@
</size>
</property>
<property name="font">
<font>
</font>
<font/>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
@ -330,8 +168,7 @@
</size>
</property>
<property name="font">
<font>
</font>
<font/>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
@ -416,89 +253,113 @@ border-image: url(:/images/closepressed.png)
</widget>
</item>
<item>
<widget class="QToolButton" name="splittedButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Split View</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/view_split_top_bottom.png</normaloff>:/images/view_split_top_bottom.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
<widget class="QLabel" name="hashLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="remoteButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Friends Folders</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/friendsfolder24.png</normaloff>:/images/friendsfolder24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
<widget class="QPushButton" name="checkButton">
<property name="text">
<string>check files</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="localButton">
<property name="maximumSize">
<widget class="QPushButton" name="downloadButton">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>My Folders</string>
<string>Download selected</string>
</property>
<property name="text">
<string>Download</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/folder16.png</normaloff>:/images/folder16.png</iconset>
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</widget>
</item>
<item>
<widget class="QPushButton" name="addShares_PB">
<property name="text">
<string/>
</property>
<property name="autoRaise">
<bool>true</bool>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QFrame" name="remoteframe">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeView" name="dirTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="autoExpandDelay">
<number>0</number>
</property>
<property name="itemsExpandable">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>

View File

@ -42,8 +42,8 @@
#include "DLListDelegate.h"
#include "ULListDelegate.h"
#include "FileTransferInfoWidget.h"
#include "TurtleRouterDialog.h"
#include "TurtleRouterStatistics.h"
#include "SearchDialog.h"
#include "SharedFilesDialog.h"
#include "xprogressbar.h"
#include "settings/rsharesettings.h"
#include "util/misc.h"
@ -66,6 +66,7 @@
/* Images for context menu icons */
#define IMAGE_INFO ":/images/fileinfo.png"
#define IMAGE_CANCEL ":/images/delete.png"
#define IMAGE_LIBRARY ":/images/library.png"
#define IMAGE_CLEARCOMPLETED ":/images/deleteall.png"
#define IMAGE_PLAY ":/images/player_play.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
@ -81,11 +82,10 @@
#define IMAGE_PRIORITYNORMAL ":/images/prioritynormal.png"
#define IMAGE_PRIORITYHIGH ":/images/priorityhigh.png"
#define IMAGE_PRIORITYAUTO ":/images/priorityauto.png"
#define IMAGE_SEARCH ":/images/filefind.png"
Q_DECLARE_METATYPE(FileProgressInfo)
DetailsDialog *TransfersDialog::detailsdlg = NULL;
class SortByNameItem : public QStandardItem
{
public:
@ -292,20 +292,24 @@ TransfersDialog::TransfersDialog(QWidget *parent)
// set default column and sort order for upload
ui.uploadsList->sortByColumn(UNAME, Qt::AscendingOrder);
FileTransferInfoWidget *ftiw = new FileTransferInfoWidget();
ui.fileTransferInfoWidget->setWidget(ftiw);
ui.fileTransferInfoWidget->setWidgetResizable(true);
ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole);
ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame);
ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus);
// FileTransferInfoWidget *ftiw = new FileTransferInfoWidget();
// ui.fileTransferInfoWidget->setWidget(ftiw);
// ui.fileTransferInfoWidget->setWidgetResizable(true);
// ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
// ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole);
// ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame);
// ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus);
QObject::connect(ui.downloadList->selectionModel(),SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),this,SLOT(showFileDetails())) ;
ui.tabWidget->addTab( new TurtleRouterStatistics(), tr("Router Statistics")) ;
ui.tabWidget->insertTab(2,searchDialog = new SearchDialog(), QIcon(IMAGE_SEARCH), tr("Search")) ;
ui.tabWidget->insertTab(3,remoteSharedFiles = new RemoteSharedFilesDialog(), QIcon(IMAGE_SEARCH), tr("Friends files")) ;
ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
ui.tabWidget->addTab(localSharedFiles = new LocalSharedFilesDialog(), QIcon(IMAGE_SEARCH), tr("Your files")) ;
//ui.tabWidget->addTab( new TurtleRouterStatistics(), tr("Router Statistics")) ;
//ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
for(int i=0;i<rsPlugins->nbPlugins();++i)
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_transfers_tab() != NULL)
@ -327,8 +331,12 @@ TransfersDialog::TransfersDialog(QWidget *parent)
#endif
QObject::connect(ui._showCacheTransfers_CB,SIGNAL(toggled(bool)),this,SLOT(insertTransfers())) ;
QObject::connect(ui.openCollection, SIGNAL(clicked()), this, SLOT(openCollection()));
toggleShowCacheTransfersAct = new QAction(tr( "Show cache transfers" ), this );
toggleShowCacheTransfersAct->setCheckable(true) ;
connect(toggleShowCacheTransfersAct,SIGNAL(triggered()),this,SLOT(toggleShowCacheTransfers())) ;
openCollectionAct = new QAction(QIcon(IMAGE_LIBRARY), tr( "Download from collection file..." ), this );
connect(openCollectionAct, SIGNAL(triggered()), this, SLOT(openCollection()));
// Actions. Only need to be defined once.
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this);
@ -405,6 +413,12 @@ UserNotify *TransfersDialog::getUserNotify(QObject *parent)
return new TransferUserNotify(parent);
}
void TransfersDialog::toggleShowCacheTransfers()
{
_show_cache_transfers = !_show_cache_transfers ;
insertTransfers() ;
}
void TransfersDialog::processSettings(bool bLoad)
{
m_bProcessSettings = true;
@ -418,14 +432,14 @@ void TransfersDialog::processSettings(bool bLoad)
// load settings
// state of checks
ui._showCacheTransfers_CB->setChecked(Settings->value("showCacheTransfers", false).toBool());
_show_cache_transfers = Settings->value("showCacheTransfers", false).toBool();
// state of the lists
DLHeader->restoreState(Settings->value("downloadList").toByteArray());
ULHeader->restoreState(Settings->value("uploadList").toByteArray());
// state of splitter
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
// ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
// selected tab
ui.tabWidget->setCurrentIndex(Settings->value("selectedTab").toInt());
@ -433,14 +447,14 @@ void TransfersDialog::processSettings(bool bLoad)
// save settings
// state of checks
Settings->setValue("showCacheTransfers", ui._showCacheTransfers_CB->isChecked());
Settings->setValue("showCacheTransfers", _show_cache_transfers);
// state of the lists
Settings->setValue("downloadList", DLHeader->saveState());
Settings->setValue("uploadList", ULHeader->saveState());
// state of splitter
Settings->setValue("Splitter", ui.splitter->saveState());
// Settings->setValue("Splitter", ui.splitter->saveState());
// selected tab
Settings->setValue("selectedTab", ui.tabWidget->currentIndex());
@ -606,6 +620,12 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint /*point*/ )
contextMnu.addSeparator();
contextMnu.addAction( toggleShowCacheTransfersAct ) ;
toggleShowCacheTransfersAct->setChecked(_show_cache_transfers) ;
contextMnu.addAction( openCollectionAct ) ;
contextMnu.addSeparator();
contextMnu.exec(QCursor::pos());
}
@ -908,8 +928,6 @@ void TransfersDialog::insertTransfers()
std::list<std::string> downHashes;
rsFiles->FileDownloads(downHashes);
bool showCacheTransfers = ui._showCacheTransfers_CB->isChecked();
/* get only once */
std::map<std::string, std::string> versions;
rsDisc->getDiscVersions(versions);
@ -945,7 +963,7 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
// if file transfer is a cache file index file, don't show it
DLListModel->removeRow(row);
rowCount = DLListModel->rowCount();
@ -971,7 +989,7 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
//if file transfer is a cache file index file, don't show it
continue;
}
@ -998,7 +1016,7 @@ void TransfersDialog::insertTransfers()
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
continue;
if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && showCacheTransfers)
if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && _show_cache_transfers)
continue ;
std::list<TransferInfo>::iterator pit;
@ -1170,39 +1188,23 @@ void TransfersDialog::copyLink ()
RSLinkClipboard::copyLinks(links) ;
}
DetailsDialog *TransfersDialog::detailsDialog()
{
static DetailsDialog *detailsdlg = new DetailsDialog ;
return detailsdlg ;
}
void TransfersDialog::showDetailsDialog()
{
if (detailsdlg == NULL) {
// create window
detailsdlg = new DetailsDialog ();
}
updateDetailsDialog ();
detailsdlg->show();
detailsDialog()->show();
}
void TransfersDialog::updateDetailsDialog()
{
if (detailsdlg == NULL) {
return;
}
std::string file_hash ;
QString fhash;
QString fsize;
QString fname;
QString fstatus;
QString fpriority;
QString fsources;
qulonglong filesize = 0;
double fdatarate = 0;
qulonglong fcompleted = 0;
qulonglong fremaining = 0;
qulonglong fdownloadtime = 0;
std::set<int> rows;
std::set<int>::iterator it;
getSelectedItems(NULL, &rows);
@ -1210,84 +1212,10 @@ void TransfersDialog::updateDetailsDialog()
if (rows.size()) {
int row = *rows.begin();
fhash = getID(row, DLListModel);
fsize = getFileSize(row, DLListModel);
fname = getFileName(row, DLListModel);
fstatus = getStatus(row, DLListModel);
fpriority = getPriority(row, DLListModel);
fsources = getSources(row, DLListModel);
filesize = getFileSize(row, DLListModel);
fdatarate = getSpeed(row, DLListModel);
fcompleted = getTransfered(row, DLListModel);
fremaining = getRemainingTime(row, DLListModel);
fdownloadtime = getDownloadTime(row, DLListModel);
// maybe show all links in retroshare link(s) Tab
// int nb_select = 0 ;
//
// for(int i = 0; i <= DLListModel->rowCount(); i++)
// if(selection->isRowSelected(i, QModelIndex()))
// {
// file_hash = getID(i, DLListModel).toStdString();
// ++nb_select ;
// }
file_hash = getID(row, DLListModel).toStdString();
}
detailsdlg->setFileHash(file_hash);
// Set Details.. Window Title
detailsdlg->setWindowTitle(tr("Details:") + fname);
// General GroupBox
detailsdlg->setHash(fhash);
detailsdlg->setFileName(fname);
detailsdlg->setSize(filesize);
detailsdlg->setStatus(fstatus);
detailsdlg->setPriority(fpriority);
detailsdlg->setType(QFileInfo(fname).suffix());
// Transfer GroupBox
detailsdlg->setSources(fsources);
detailsdlg->setDatarate(fdatarate);
if (fname.isEmpty()) {
detailsdlg->setCompleted(misc::friendlyUnit(-1));
detailsdlg->setRemaining(misc::friendlyUnit(-1));
} else {
detailsdlg->setCompleted(misc::friendlyUnit(fcompleted));
detailsdlg->setRemaining(misc::friendlyUnit(fremaining));
}
//Date GroupBox
if (fname.isEmpty()) {
detailsdlg->setDownloadtime(misc::userFriendlyDuration(-1));
} else {
detailsdlg->setDownloadtime(misc::userFriendlyDuration(fdownloadtime));
}
// retroshare link(s) Tab
if (fname.isEmpty()) {
detailsdlg->setLink("");
} else {
RetroShareLink link;
if (link.createFile(fname, filesize, fhash)) {
detailsdlg->setLink(link.toString());
} else {
detailsdlg->setLink("");
}
}
FileChunksInfo info ;
if (fhash.isEmpty() == false && rsFiles->FileDownloadChunksDetails(fhash.toStdString(), info)) {
detailsdlg->setChunkSize(info.chunk_size);
detailsdlg->setNumberOfChunks(info.chunks.size());
} else {
detailsdlg->setChunkSize(0);
detailsdlg->setNumberOfChunks(0);
}
detailsDialog()->setFileHash(file_hash);
}
void TransfersDialog::pasteLink()
@ -1593,13 +1521,9 @@ void TransfersDialog::showFileDetails()
++nb_select ;
}
if(nb_select != 1)
dynamic_cast<FileTransferInfoWidget*>(ui.fileTransferInfoWidget->widget())->setFileHash("") ;
detailsDialog()->setFileHash("") ;
else
dynamic_cast<FileTransferInfoWidget*>(ui.fileTransferInfoWidget->widget())->setFileHash(file_hash) ;
std::cout << "calling update " << std::endl ;
dynamic_cast<FileTransferInfoWidget*>(ui.fileTransferInfoWidget->widget())->updateDisplay() ;
std::cout << "done" << std::endl ;
detailsDialog()->setFileHash(file_hash) ;
updateDetailsDialog ();
}

View File

@ -36,6 +36,9 @@ class QStandardItemModel;
class QStandardItem;
class DetailsDialog;
class FileProgressInfo;
class SearchDialog;
class LocalSharedFilesDialog;
class RemoteSharedFilesDialog;
class TransfersDialog : public RsAutoUpdatePage
{
@ -52,7 +55,11 @@ public:
// virtual void keyPressEvent(QKeyEvent *) ;
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
static DetailsDialog *detailsdlg;
static DetailsDialog *detailsDialog() ;
SearchDialog *searchDialog ;
LocalSharedFilesDialog *localSharedFiles ;
RemoteSharedFilesDialog *remoteSharedFiles ;
public slots:
void insertTransfers();
@ -150,6 +157,8 @@ private:
QAction *chunkRandomAct;
QAction *chunkStreamingAct;
QAction *detailsfileAct;
QAction *toggleShowCacheTransfersAct;
QAction *openCollectionAct;
bool m_bProcessSettings;
void processSettings(bool bLoad);
@ -167,6 +176,7 @@ private:
/** Qt Designer generated object */
Ui::TransfersDialog ui;
bool _show_cache_transfers ;
public slots:
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
//
@ -176,6 +186,7 @@ public slots:
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
void showFileDetails() ;
void toggleShowCacheTransfers() ;
double getProgress(int row, QStandardItemModel *model);
double getSpeed(int row, QStandardItemModel *model);

View File

@ -10,18 +10,31 @@
<height>353</height>
</rect>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout">
<property name="spacing">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</attribute>
<attribute name="title">
<string>Downloads</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<item>
<widget class="QTreeView" name="downloadList">
<property name="font">
<font>
@ -72,102 +85,8 @@
</attribute>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="titleBarFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/down.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Downloads</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>483</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="openCollection">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Open Collection</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_showCacheTransfers_CB">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="text">
<string>Show cache transfers</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uploadsTab">
<attribute name="icon">
<iconset resource="images.qrc">
@ -197,151 +116,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="transferTab">
<attribute name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/blockdevice.png</normaloff>:/images/blockdevice.png</iconset>
</attribute>
<attribute name="title">
<string>Selected transfer</string>
</attribute>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="fileTransferInfoWidget">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-downloaded.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-downloading.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Active</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-notdownload.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Outstanding</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>368</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/graph-checking.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Needs checking</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>

View File

@ -25,6 +25,7 @@
#include <QMenu>
#include "ChatLobbyDialog.h"
#include "gui/ChatLobbyWidget.h"
#include "ChatTabWidget.h"
#include "gui/settings/rsharesettings.h"
#include "gui/settings/RsharePeerSettings.h"
@ -32,6 +33,7 @@
#include "gui/FriendsDialog.h"
#include <gui/common/html.h>
#include "gui/common/RSTreeWidgetItem.h"
#include "gui/common/FriendSelectionDialog.h"
#include <retroshare/rsnotify.h>
@ -56,9 +58,45 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::WF
ui.participantsList->setColumnCount(COLUMN_COUNT);
ui.participantsList->setColumnWidth(COLUMN_ICON, 20);
// Mute a Participant
muteAct = new QAction(QIcon(), tr("Mute participant"), this);
connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState()));
// Add a button to invite friends.
//
inviteFriendsButton = new QPushButton ;
inviteFriendsButton->setMinimumSize(QSize(28,28)) ;
inviteFriendsButton->setMaximumSize(QSize(28,28)) ;
inviteFriendsButton->setText(QString()) ;
inviteFriendsButton->setToolTip(tr("Invite friends to this lobby"));
QIcon icon ;
icon.addPixmap(QPixmap(":/images/edit_add24.png")) ;
inviteFriendsButton->setIcon(icon) ;
inviteFriendsButton->setIconSize(QSize(22,22)) ;
connect(inviteFriendsButton, SIGNAL(clicked()), this , SLOT(inviteFriends()));
getChatWidget()->addChatButton(inviteFriendsButton) ;
}
void ChatLobbyDialog::inviteFriends()
{
std::cerr << "Inviting friends" << std::endl;
std::list<std::string> ids = FriendSelectionDialog::selectFriends() ;
std::cerr << "Inviting these friends:" << std::endl;
ChatLobbyId lobby_id;
if (!rsMsgs->isLobbyId(getPeerId(), lobby_id))
return ;
for(std::list<std::string>::const_iterator it(ids.begin());it!=ids.end();++it)
{
std::cerr << " " << *it << std::endl;
rsMsgs->invitePeerToLobby(lobby_id,*it) ;
}
}
void ChatLobbyDialog::participantsTreeWidgetCostumPopupMenu(QPoint)
@ -123,7 +161,8 @@ void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
showParticipantsFrame(PeerSettings->getShowParticipantsFrame(peerId));
// add to window
ChatTabWidget *tabWidget = FriendsDialog::getTabWidget();
ChatTabWidget *tabWidget = ChatLobbyWidget::getTabWidget();
if (tabWidget) {
tabWidget->addDialog(this);
}
@ -285,10 +324,10 @@ void ChatLobbyDialog::updateParticipantsList()
} else {
widgetitem->setIcon(COLUMN_ICON, QIcon(":/images/greenled.png"));
}
widgetitem->setToolTip(COLUMN_ICON, tr("Double click to mute/unmute participant"));
//widgetitem->setToolTip(COLUMN_ICON, tr("Double click to mute/unmute participant"));
widgetitem->setText(COLUMN_NAME, participant);
widgetitem->setToolTip(COLUMN_NAME, tr("Right click to mute/unmute participants"));
widgetitem->setToolTip(COLUMN_NAME,tr("Right click to mute/unmute participants<br/>Double click to address this person"));
ui.participantsList->addTopLevelItem(widgetitem);
if (selectedParcipants.contains(participant)) {
@ -340,20 +379,26 @@ void ChatLobbyDialog::participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item,
return;
}
if (column != COLUMN_ICON) {
return;
if(column == COLUMN_NAME)
{
getChatWidget()->pasteText("@"+item->text(COLUMN_NAME)) ;
return ;
}
QString nickname = item->text(COLUMN_NAME);
if (isParticipantMuted(nickname)) {
unMuteParticipant(nickname);
} else {
muteParticipant(nickname);
}
mutedParticipants->removeDuplicates();
updateParticipantsList();
// if (column == COLUMN_ICON) {
// return;
// }
//
// QString nickname = item->text(COLUMN_NAME);
// if (isParticipantMuted(nickname)) {
// unMuteParticipant(nickname);
// } else {
// muteParticipant(nickname);
// }
//
// mutedParticipants->removeDuplicates();
//
// updateParticipantsList();
}
void ChatLobbyDialog::muteParticipant(const QString &nickname) {
@ -455,8 +500,8 @@ bool ChatLobbyDialog::canClose()
void ChatLobbyDialog::showDialog(uint chatflags)
{
if (chatflags & RS_CHAT_FOCUS) {
MainWindow::showWindow(MainWindow::Friends);
ChatTabWidget *tabWidget = FriendsDialog::getTabWidget();
MainWindow::showWindow(MainWindow::ChatLobby);
ChatTabWidget *tabWidget = ChatLobbyWidget::getTabWidget();
if (tabWidget) {
tabWidget->setCurrentWidget(this);
}

View File

@ -45,6 +45,7 @@ public:
private slots:
void showParticipantsFrame(bool show);
void participantsTreeWidgetCostumPopupMenu( QPoint point );
void inviteFriends() ;
protected:
/** Default constructor */
@ -75,6 +76,8 @@ private:
QString _lobby_name ;
time_t lastUpdateListTime;
QPushButton *inviteFriendsButton ;
/** Qt Designer generated object */
Ui::ChatLobbyDialog ui;

View File

@ -387,15 +387,21 @@ bool ChatWidget::isActive()
return true;
}
void ChatWidget::pasteText(const QString& S)
{
//std::cerr << "In paste link" << std::endl;
ui->chatTextEdit->insertHtml(S);
}
void ChatWidget::pasteLink()
{
std::cerr << "In paste link" << std::endl;
//std::cerr << "In paste link" << std::endl;
ui->chatTextEdit->insertHtml(RSLinkClipboard::toHtml());
}
void ChatWidget::pasteOwnCertificateLink()
{
std::cerr << "In paste own certificate link" << std::endl;
//std::cerr << "In paste own certificate link" << std::endl;
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;

View File

@ -78,6 +78,7 @@ public:
bool isActive();
void setDefaultExtraFileFlags(TransferRequestFlags f) ;
void pasteText(const QString&);
private slots:
void clearChatHistory();

View File

@ -0,0 +1,48 @@
#include <list>
#include <QLayout>
#include <QDialogButtonBox>
#include "FriendSelectionDialog.h"
std::list<std::string> FriendSelectionDialog::selectFriends()
{
FriendSelectionDialog dialog ;
dialog.friends_widget->start() ;
dialog.setWindowTitle(tr("Choose some friends")) ;
if(QDialog::Rejected == dialog.exec())
return std::list<std::string>() ;
std::list<std::string> ids ;
dialog.friends_widget->selectedSslIds(ids,false) ;
return ids ;
}
FriendSelectionDialog::FriendSelectionDialog(QWidget *parent)
: QDialog(parent)
{
friends_widget = new FriendSelectionWidget(this) ;
friends_widget->setHeaderText(tr("Contacts:"));
friends_widget->setModus(FriendSelectionWidget::MODUS_CHECK);
friends_widget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
QLayout *l = new QVBoxLayout ;
setLayout(l) ;
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
l->addWidget(friends_widget) ;
l->addWidget(buttonBox) ;
l->update() ;
}
FriendSelectionDialog::~FriendSelectionDialog()
{
delete friends_widget ;
}

View File

@ -0,0 +1,17 @@
#pragma once
#include <QDialog>
#include <gui/common/FriendSelectionWidget.h>
class FriendSelectionDialog : public QDialog
{
public:
static std::list<std::string> selectFriends() ;
private:
virtual ~FriendSelectionDialog() ;
FriendSelectionDialog(QWidget *parent = NULL) ;
FriendSelectionWidget *friends_widget ;
};

View File

@ -20,6 +20,7 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDialogButtonBox>
#include "FriendSelectionWidget.h"
#include "ui_FriendSelectionWidget.h"
#include "gui/notifyqt.h"
@ -835,3 +836,4 @@ std::string FriendSelectionWidget::idFromItem(QTreeWidgetItem *item)
return item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
}

View File

@ -24,6 +24,7 @@
#define FRIENDSELECTIONWIDGET_H
#include <QWidget>
#include <QDialog>
namespace Ui {
class FriendSelectionWidget;

View File

@ -122,7 +122,7 @@ void SecurityItem::updateItemStatic()
avatar->setDefaultAvatar(":images/avatar_request.png");
break;
case SEC_TYPE_AUTH_DENIED:
title = tr("Not Yet Friends");
title = tr("Connection refused by remote peer");
requestLabel->hide();
avatar->setDefaultAvatar(":images/avatar_request.png");
break;

View File

@ -19,6 +19,7 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDate>
#include <QMessageBox>
#include <QClipboard>
#include <QFile>
@ -27,9 +28,12 @@
#include "CryptoPage.h"
#include "util/misc.h"
#include "util/DateTime.h"
#include <gui/RetroShareLink.h>
#include <gui/profile/ProfileManager.h>
#include <retroshare/rspeers.h> //for rsPeers variable
#include <retroshare/rsdisc.h> //for rsPeers variable
/** Constructor */
CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
@ -38,7 +42,7 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
// connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
connect(ui._includeSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(load()));
connect(ui._copyLink_PB, SIGNAL(clicked()), this, SLOT(copyRSLink()));
@ -48,7 +52,45 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
#ifdef Q_WS_WIN
#endif
connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager()));
ui.onlinesince->setText(DateTime::formatLongDateTime(QDateTime::currentDateTime()));
}
void CryptoPage::profilemanager()
{
ProfileManager profilemanager;
profilemanager.exec();
}
void CryptoPage::showEvent ( QShowEvent * /*event*/ )
{
RsPeerDetails detail;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
{
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
ui.country->setText(QString::fromUtf8(detail.location.c_str()));
ui.peerid->setText(QString::fromStdString(detail.id));
ui.pgpid->setText(QString::fromStdString(detail.gpg_id));
/* set retroshare version */
std::map<std::string, std::string>::iterator vit;
std::map<std::string, std::string> versions;
bool retv = rsDisc->getDiscVersions(versions);
if (retv && versions.end() != (vit = versions.find(detail.id)))
{
ui.version->setText(QString::fromStdString(vit->second));
}
std::list<std::string> ids;
ids.clear();
rsPeers->getGPGAcceptedList(ids);
int friends = ids.size();
ui.friendsEdit->setText(QString::number(friends));
}
load() ;
}
CryptoPage::~CryptoPage()
{

View File

@ -46,7 +46,8 @@ class CryptoPage : public ConfigPage
virtual void load();
void copyPublicKey();
void copyRSLink() ;
virtual void showEvent ( QShowEvent * event );
void profilemanager();
bool fileSave();
bool fileSaveAs();

View File

@ -6,18 +6,440 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>355</height>
<width>650</width>
<height>566</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="6">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Public Key</string>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Profile</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="profile_Button">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Profile Manager</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/contact_new.png</normaloff>:/images/contact_new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame_1">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Public Information</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="country">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Location ID:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="peerid">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Identity ID:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="pgpid">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6" columnstretch="0,0,0" columnminimumwidth="0,0,0">
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Number of Friends:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="friendsEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Software Version:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_16">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Online since:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="version">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="onlinesince">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Other Information</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>205</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Certificate</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="certtextEdit">
<property name="font">
<font>
@ -29,20 +451,16 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="copykeyButton">
<property name="toolTip">
<string>Copy my Key to Clipboard</string>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="_copyLink_PB">
<property name="text">
<string>Copy Key</string>
<string>Copy link to clipboard</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item>
<widget class="QPushButton" name="saveButton">
<property name="toolTip">
<string>Save Key into a file</string>
@ -52,34 +470,7 @@
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>278</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="_includeSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="_copyLink_PB">
<property name="text">
<string>Copy RetroShare link to clipboard</string>
</property>
</widget>
</item>
<item row="1" column="3">
<item>
<widget class="QCheckBox" name="_useOldFormat_CB">
<property name="text">
<string>Use old key format</string>
@ -89,8 +480,23 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_includeSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -29,6 +29,7 @@
#include <util/stringutil.h>
#include <QSystemTrayIcon>
#include "rsharesettings.h"
#include <gui/QuickStartWizard.h>
/** Constructor */
GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
@ -51,12 +52,17 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
ui.enableRetroShareProtocol->setVisible(false);
ui.adminLabel->setVisible(false);
#endif
connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
}
/** Destructor */
GeneralPage::~GeneralPage()
{
}
void GeneralPage::runStartWizard()
{
QuickStartWizard(this).exec();
}
/** Saves the changes on this page */
bool GeneralPage::save(QString &/*errmsg*/)

View File

@ -44,6 +44,8 @@ public:
virtual QPixmap iconPixmap() const { return QPixmap(":/images/kcmsystem24.png") ; }
virtual QString pageName() const { return tr("General") ; }
public slots:
void runStartWizard() ;
private:
/** Qt Designer generated object */
Ui::GeneralPage ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>400</height>
<width>485</width>
<height>465</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -182,18 +182,29 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>178</width>
<height>95</height>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="runStartWizard_PB">
<property name="text">
<string>Launch startup wizard</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/tools_wizard.png</normaloff>:/images/tools_wizard.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<resources>

View File

@ -21,6 +21,7 @@
#include "ServerPage.h"
#include <gui/TurtleRouterDialog.h>
#include <gui/TurtleRouterStatistics.h>
#include "rshare.h"
#include "rsharesettings.h"
@ -30,6 +31,7 @@
#include <retroshare/rsconfig.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsturtle.h>
#include <retroshare/rsiface.h>
#include <QTimer>
@ -44,11 +46,14 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
connect( ui.allowTunnelConnectionCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
connect( ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
connect( ui._turtle_enabled_CB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTurtleRouting(bool) ) );
connect( ui._routing_info_PB, SIGNAL( clicked() ), this, SLOT( showRoutingInfo() ) );
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
_routing_info_page = NULL ;
//load();
updateStatus();
@ -70,12 +75,30 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
ui.IPServersLV->addItem(QString::fromStdString(*it)) ;
TurtleRouterStatistics *trs = new TurtleRouterStatistics ;
trs->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding)) ;
ui.tabWidget->widget(2)->layout()->addWidget(trs) ;
ui.tabWidget->widget(2)->layout()->setContentsMargins(0,5,0,0) ;
QSpacerItem *verticalSpacer = new QSpacerItem(0,0,QSizePolicy::Expanding, QSizePolicy::Minimum);
ui.tabWidget->widget(2)->layout()->addItem(verticalSpacer) ;
ui.tabWidget->widget(2)->layout()->update() ;
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void ServerPage::showRoutingInfo()
{
if(_routing_info_page == NULL)
_routing_info_page = new TurtleRouterDialog ;
_routing_info_page->show() ;
}
void ServerPage::updateMaxTRUpRate(int b)
{
rsTurtle->setMaxTRForwardRate(b) ;
@ -192,12 +215,18 @@ void ServerPage::load()
ui.showDiscStatusBar->setChecked(Settings->getStatusBarFlags() & STATUSBAR_DISC);
ui._max_tr_up_per_sec_SB->setValue(rsTurtle->getMaxTRForwardRate()) ;
ui._turtle_enabled_CB->setChecked(rsTurtle->enabled()) ;
ui.ipAddressList->clear();
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
ui.ipAddressList->addItem(QString::fromStdString(*it));
}
void ServerPage::toggleTurtleRouting(bool b)
{
ui._max_tr_up_per_sec_SB->setEnabled(b) ;
ui._routing_info_PB->setEnabled(true) ; // always enabled!
rsTurtle->setEnabled(b) ;
}
@ -224,6 +253,34 @@ void ServerPage::updateStatus()
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
// Now update network bits.
//
rsiface->lockData(); /* Lock Interface */
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
/******* Network Status Tab *******/
if(config.netUpnpOk)
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledon1.png"));
else
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledoff1.png"));
if (config.netLocalOk)
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledon1.png"));
else
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledoff1.png"));
if (config.netExtraAddressOk)
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledon1.png"));
else
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
rsiface->unlockData(); /* UnLock Interface */
}
void ServerPage::toggleUPnP()

View File

@ -25,6 +25,8 @@
#include <retroshare-gui/configpage.h>
#include "ui_ServerPage.h"
class TurtleRouterDialog ;
class ServerPage: public ConfigPage
{
Q_OBJECT
@ -47,6 +49,7 @@ public slots:
private slots:
void saveAddresses();
void toggleUPnP();
void showRoutingInfo();
void toggleIpDetermination(bool) ;
void toggleTunnelConnection(bool) ;
void updateMaxTRUpRate(int) ;
@ -54,6 +57,8 @@ private slots:
private:
Ui::ServerPage ui;
TurtleRouterDialog *_routing_info_page ;
};
#endif // !SERVERPAGE_H

View File

@ -6,26 +6,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>573</width>
<height>421</height>
<width>632</width>
<height>683</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="title">
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Network Configuration</string>
</property>
<layout class="QHBoxLayout">
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -106,108 +104,9 @@ peers still need to trust each other to allow connection. </string>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Transfer Rates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Download (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalDownloadRate">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Upload (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalUploadRate">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Network Configuration</string>
</attribute>
<layout class="QGridLayout">
<item row="2" column="0">
<widget class="QCheckBox" name="allowTunnelConnectionCB">
<property name="toolTip">
<string>If you uncheck this, RetroShare will not use tunnel connection between peers that are firewalled and cannot connect directly. This is independent from F2F routing (turtle router).</string>
</property>
<property name="text">
<string>Allow Tunnel Connection</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
@ -301,34 +200,136 @@ peers still need to trust each other to allow connection. </string>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="sizeHint" stdset="0">
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_netLimited">
<property name="maximumSize">
<size>
<width>20</width>
<height>40</height>
<width>16</width>
<height>16</height>
</size>
</property>
</spacer>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="0" column="1">
<widget class="QLabel" name="textlabel_netLimited">
<property name="text">
<string>Local network</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="_6">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_ext">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabel_ext">
<property name="text">
<string>External ip address finder</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconlabel_upnp">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabel_upnp">
<property name="text">
<string>UPnP</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Known / Previous IPs:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="ipAddressList">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showDiscStatusBar">
<property name="text">
<string>Show Discovery information in statusbar</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>IP Service</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<item>
<widget class="QCheckBox" name="allowIpDeterminationCB">
<property name="toolTip">
<string>If you uncheck this, RetroShare can only determine your IP
@ -344,68 +345,172 @@ behind a firewall or a VPN.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QListWidget" name="IPServersLV">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>showDiscStatusBar</zorder>
<zorder>allowIpDeterminationCB</zorder>
<zorder>IPServersLV</zorder>
<zorder></zorder>
<zorder>textlabel_ext</zorder>
<zorder>textlabel_netLimited</zorder>
<zorder>ipAddressList</zorder>
<zorder>label_7</zorder>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Turtle router</string>
<string>Bandwidth</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Max Transfer Rates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Download (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalDownloadRate">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Upload (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalUploadRate">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/informations_24x24.png</pixmap>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</layout>
</item>
<item>
<widget class="QCheckBox" name="allowTunnelConnectionCB">
<property name="toolTip">
<string>If you uncheck this, RetroShare will not use tunnel connection between peers that are firewalled and cannot connect directly. This is independent from F2F routing (turtle router).</string>
</property>
<property name="text">
<string>Warning</string>
<string>Allow Tunnel Connection</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="plainText">
<string>This tab contains hard-core parameters which are unlikely to need modification. Don't change them unless you really know what you're doing.</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
</layout>
</widget>
<widget class="QWidget" name="TurtleRouter_TAB">
<attribute name="title">
<string>Turtle router</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="_turtle_enabled_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;Unchecking this disables all anonymous routing activity, except cache cleaning. Incoming tunnel requests are discarded, and no tunnel requests are sent to anyone.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_routing_info_PB">
<property name="text">
<string>Show routing info</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Max. tunnel requests forwarded per second:</string>
<string>Max. tunnel req. forwarded per second:</string>
</property>
</widget>
</item>
@ -436,29 +541,6 @@ The default value is 20.</string>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="_turtle_enabled_CB">
<property name="toolTip">
<string>Unchecking this disables all anonymous routing activity, except cache cleaning. Incoming tunnel requests are discarded, and no tunnel requests are sent to anyone.</string>
</property>
<property name="text">
<string>Enable anonymous data routing</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
@ -474,17 +556,14 @@ The default value is 20.</string>
<tabstop>extAddress</tabstop>
<tabstop>extPort</tabstop>
<tabstop>dynDNS</tabstop>
<tabstop>allowTunnelConnectionCB</tabstop>
<tabstop>showDiscStatusBar</tabstop>
<tabstop>totalDownloadRate</tabstop>
<tabstop>totalUploadRate</tabstop>
<tabstop>allowIpDeterminationCB</tabstop>
<tabstop>IPServersLV</tabstop>
<tabstop>plainTextEdit</tabstop>
<tabstop>_max_tr_up_per_sec_SB</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -194,12 +194,6 @@ void xProgressBar::overPaintSelectedChunks(const std::vector<uint32_t>& chunks,c
painter->setBrush(linearGrad);
std::cerr << "painting chunks: " ;
for(uint32_t i=0;i<chunks.size();++i)
std::cerr << chunks[i] << " " ;
std::cerr << std::endl;
if(chunks.empty())
return ;

View File

@ -43,6 +43,7 @@
#include "util/EventReceiver.h"
#include "gui/RetroShareLink.h"
#include "gui/SoundManager.h"
#include "gui/NetworkView.h"
#include "lang/languagesupport.h"
/*** WINDOWS DON'T LIKE THIS - REDEFINES VER numbers.
@ -322,22 +323,24 @@ int main(int argc, char *argv[])
qRegisterMetaType<FileDetail>("FileDetail") ;
std::cerr << "connecting signals and slots" << std::endl ;
QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ;
QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->transfersDialog->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ;
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->sharedfilesDialog ,SLOT(preModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->sharedfilesDialog ,SLOT(postModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->transfersDialog->localSharedFiles ,SLOT(preModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->transfersDialog->remoteSharedFiles ,SLOT(preModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->transfersDialog->localSharedFiles ,SLOT(postModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->transfersDialog->remoteSharedFiles ,SLOT(postModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool) )) ;
QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ;
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(insertConnect() )) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus()));
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->networkDialog,SLOT(setLogInfo(QString))) ;
QObject::connect(notify,SIGNAL(discInfoChanged()) ,w->networkDialog,SLOT(updateNewDiscoveryInfo()),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->friendsDialog->networkDialog,SLOT(setLogInfo(QString))) ;
QObject::connect(notify,SIGNAL(discInfoChanged()) ,w->friendsDialog->networkView,SLOT(update()),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(errorOccurred(int,int,const QString&)),w,SLOT(displayErrorMessage(int,int,const QString&))) ;
w->installGroupChatNotifier();

View File

@ -411,6 +411,7 @@ HEADERS += rshare.h \
gui/common/AvatarWidget.h \
gui/common/FriendList.h \
gui/common/FriendSelectionWidget.h \
gui/common/FriendSelectionDialog.h \
gui/common/HashBox.h \
gui/common/LineEditClear.h \
gui/common/DropLineEdit.h \
@ -682,6 +683,7 @@ SOURCES += main.cpp \
gui/common/AvatarWidget.cpp \
gui/common/FriendList.cpp \
gui/common/FriendSelectionWidget.cpp \
gui/common/FriendSelectionDialog.cpp \
gui/common/HashBox.cpp \
gui/common/LineEditClear.cpp \
gui/common/DropLineEdit.cpp \