mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* Added a Basic Share Manager for the replacement "Add Share" on MainWindow
* Fixed SharedFilesDialog columns git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@883 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f362746576
commit
5459a536be
@ -75,6 +75,7 @@ HEADERS += rshare.h \
|
||||
gui/SearchDialog.h \
|
||||
gui/SharedFilesDialog.h \
|
||||
gui/ShareFilesDialog.h \
|
||||
gui/ShareManager.h \
|
||||
gui/StatisticDialog.h \
|
||||
gui/HelpDialog.h \
|
||||
gui/LogoBar.h \
|
||||
@ -203,6 +204,7 @@ FORMS += gui/ChatDialog.ui \
|
||||
gui/SearchDialog.ui \
|
||||
gui/SharedFilesDialog.ui \
|
||||
gui/ShareFilesDialog.ui \
|
||||
gui/ShareManager.ui \
|
||||
gui/StatisticDialog.ui \
|
||||
gui/MessagesDialog.ui \
|
||||
gui/help/browser/helpbrowser.ui \
|
||||
@ -294,6 +296,7 @@ SOURCES += main.cpp \
|
||||
gui/SearchDialog.cpp \
|
||||
gui/SharedFilesDialog.cpp \
|
||||
gui/ShareFilesDialog.cpp \
|
||||
gui/ShareManager.cpp \
|
||||
gui/StatisticDialog.cpp \
|
||||
gui/MessagesDialog.cpp \
|
||||
gui/help/browser/helpbrowser.cpp \
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "TransferFeed.h"
|
||||
#include "MsgFeed.h"
|
||||
#include "ChannelFeed.h"
|
||||
#include "ShareManager.h"
|
||||
|
||||
|
||||
#include <rshare.h>
|
||||
@ -146,7 +147,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/** Left Side ToolBar**/
|
||||
connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
|
||||
connect(ui.actionInvite_Friend, SIGNAL(triggered() ), this , SLOT( inviteFriend() ) );
|
||||
connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( addSharedDirectory() ) );
|
||||
connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) );
|
||||
connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT( showPreferencesWindow()) );
|
||||
connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
|
||||
connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) );
|
||||
@ -509,6 +510,14 @@ void MainWindow::addSharedDirectory()
|
||||
|
||||
}
|
||||
|
||||
/** Shows Preferences */
|
||||
void MainWindow::openShareManager()
|
||||
{
|
||||
static ShareManager* sharemanager = new ShareManager(this);
|
||||
sharemanager->show();
|
||||
|
||||
}
|
||||
|
||||
/** Shows Preferences */
|
||||
/*void MainWindow::showPreferencesWindow()
|
||||
{
|
||||
|
@ -135,6 +135,7 @@ private slots:
|
||||
void showApplWindow();
|
||||
void showsmplayer();
|
||||
void showabout();
|
||||
void openShareManager();
|
||||
|
||||
/** Displays the help browser and displays the most recently viewed help
|
||||
* topic. */
|
||||
|
111
retroshare-gui/src/gui/ShareManager.cpp
Normal file
111
retroshare-gui/src/gui/ShareManager.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, 2007 crypton
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include "ShareManager.h"
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
/** Default constructor */
|
||||
ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShareDirectory() ) );
|
||||
connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
|
||||
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
|
||||
ui.addButton->setToolTip(tr("Add a Share Directory"));
|
||||
ui.addButton->setStatusTip(tr("Add a Share Directory"));
|
||||
ui.removeButton->setToolTip(tr("Remove selected Shared Directory"));
|
||||
ui.removeButton->setStatusTip(tr("Remove selected Shared Directory"));
|
||||
|
||||
}
|
||||
/** Loads the settings for this page */
|
||||
void ShareManager::load()
|
||||
{
|
||||
std::list<std::string>::const_iterator it;
|
||||
std::list<std::string> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
/* get a link to the table */
|
||||
QListWidget *listWidget = ui.shareddirList;
|
||||
|
||||
/* remove old items ??? */
|
||||
listWidget->clear();
|
||||
|
||||
for(it = dirs.begin(); it != dirs.end(); it++)
|
||||
{
|
||||
/* (0) Dir Name */
|
||||
listWidget->addItem(QString::fromStdString(*it));
|
||||
}
|
||||
|
||||
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
|
||||
|
||||
listWidget->update(); /* update display */
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ShareManager::addShareDirectory()
|
||||
{
|
||||
|
||||
/* select a dir
|
||||
*/
|
||||
|
||||
|
||||
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
/* add it to the server */
|
||||
std::string dir = qdir.toStdString();
|
||||
if (dir != "")
|
||||
{
|
||||
rsFiles->addSharedDirectory(dir);
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::removeShareDirectory()
|
||||
{
|
||||
/* id current dir */
|
||||
/* ask for removal */
|
||||
QListWidget *listWidget = ui.shareddirList;
|
||||
QListWidgetItem *qdir = listWidget -> currentItem();
|
||||
if (qdir)
|
||||
{
|
||||
rsFiles->removeSharedDirectory( qdir->text().toStdString());
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
retroshare-gui/src/gui/ShareManager.h
Normal file
56
retroshare-gui/src/gui/ShareManager.h
Normal file
@ -0,0 +1,56 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#ifndef _SHAREMANAGER_H
|
||||
#define _SHAREMANAGER_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "ui_ShareManager.h"
|
||||
|
||||
class ShareManager : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
ShareManager( QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default destructor */
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void load();
|
||||
public slots:
|
||||
protected:
|
||||
private slots:
|
||||
|
||||
void addShareDirectory();
|
||||
void removeShareDirectory();
|
||||
|
||||
private:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareManager ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
116
retroshare-gui/src/gui/ShareManager.ui
Normal file
116
retroshare-gui/src/gui/ShareManager.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<ui version="4.0" >
|
||||
<class>ShareManager</class>
|
||||
<widget class="QDialog" name="ShareManager" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>312</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Add Share Manager</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="images.qrc" >:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" colspan="4" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Shared Folder Manager</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QListWidget" name="shareddirList" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QPushButton" name="addButton" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>34</width>
|
||||
<height>34</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QPushButton" name="removeButton" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>34</width>
|
||||
<height>34</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/directoryremove_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>101</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -112,14 +112,19 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * r_header = ui.remoteDirTreeView->header () ;
|
||||
#if defined(Q_OS_WIN32)
|
||||
r_header->setResizeMode (0, QHeaderView::Interactive);
|
||||
r_header->setStretchLastSection(true);
|
||||
#else
|
||||
r_header->setResizeMode (0, QHeaderView::Stretch);
|
||||
r_header->setStretchLastSection(false);
|
||||
#endif
|
||||
r_header->setResizeMode (1, QHeaderView::Fixed);
|
||||
r_header->setResizeMode (2, QHeaderView::Fixed);
|
||||
r_header->setResizeMode (3, QHeaderView::Fixed);
|
||||
|
||||
r_header->setStretchLastSection(false);
|
||||
|
||||
r_header->resizeSection ( 0, 210 );
|
||||
r_header->resizeSection ( 0, 250 );
|
||||
r_header->resizeSection ( 1, 70 );
|
||||
r_header->resizeSection ( 2, 100 );
|
||||
r_header->resizeSection ( 3, 100 );
|
||||
|
Loading…
Reference in New Issue
Block a user