mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
Added ShareDialog for ShareManager
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2693 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c30e0c071e
commit
92df7037b2
@ -164,6 +164,7 @@ HEADERS += rshare.h \
|
||||
gui/SearchDialog.h \
|
||||
gui/SharedFilesDialog.h \
|
||||
gui/ShareManager.h \
|
||||
gui/ShareDialog.h \
|
||||
gui/SFListDelegate.h \
|
||||
gui/SoundManager.h \
|
||||
gui/FileTransferInfoWidget.h \
|
||||
@ -276,6 +277,7 @@ FORMS += gui/StartDialog.ui \
|
||||
gui/SendLinkDialog.ui \
|
||||
gui/SharedFilesDialog.ui \
|
||||
gui/ShareManager.ui \
|
||||
gui/ShareDialog.ui \
|
||||
gui/MessagesDialog.ui \
|
||||
gui/MessagesPopupDialog.ui \
|
||||
gui/help/browser/helpbrowser.ui \
|
||||
@ -347,6 +349,7 @@ SOURCES += main.cpp \
|
||||
gui/AddLinksDialog.cpp \
|
||||
gui/SharedFilesDialog.cpp \
|
||||
gui/ShareManager.cpp \
|
||||
gui/ShareDialog.cpp \
|
||||
gui/SFListDelegate.cpp \
|
||||
gui/SoundManager.cpp \
|
||||
gui/MessagesDialog.cpp \
|
||||
|
127
retroshare-gui/src/gui/ShareDialog.cpp
Normal file
127
retroshare-gui/src/gui/ShareDialog.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006- 2010 RetroShare Team
|
||||
*
|
||||
* 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 "ShareDialog.h"
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCheckBox>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QHeaderView>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QComboBox>
|
||||
|
||||
/** Default constructor */
|
||||
ShareDialog::ShareDialog(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.browseButton, SIGNAL(clicked( bool ) ), this , SLOT( browseDirectory() ) );
|
||||
connect(ui.okButton, SIGNAL(clicked( bool ) ), this , SLOT( addDirectory() ) );
|
||||
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closedialog()));
|
||||
|
||||
load();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ShareDialog::load()
|
||||
{
|
||||
|
||||
ui.localpath_lineEdit->clear();
|
||||
ui.anonymouscheckBox->setChecked(false);
|
||||
ui.friendscheckBox->setChecked(false);
|
||||
}
|
||||
|
||||
void ShareDialog::browseDirectory()
|
||||
{
|
||||
|
||||
/* select a dir*/
|
||||
QString qdir = QFileDialog::getExistingDirectory(this, tr("Select A Folder To Share"), "", QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
/* add it to the server */
|
||||
std::string dir = qdir.toStdString();
|
||||
currentDir = qdir.toStdString();
|
||||
if (dir != "")
|
||||
{
|
||||
ui.localpath_lineEdit->setText(QString::fromStdString(dir));
|
||||
}
|
||||
}
|
||||
|
||||
void ShareDialog::addDirectory()
|
||||
{
|
||||
|
||||
SharedDirInfo sdi ;
|
||||
sdi.filename = currentDir ;
|
||||
|
||||
if( ui.anonymouscheckBox->isChecked() && ui.friendscheckBox->isChecked())
|
||||
{
|
||||
sdi.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||
}
|
||||
if ( ui.anonymouscheckBox->isChecked() && !ui.friendscheckBox->isChecked() )
|
||||
{
|
||||
sdi.shareflags = RS_FILE_HINTS_NETWORK_WIDE;
|
||||
}
|
||||
if ( ui.friendscheckBox->isChecked() && !ui.anonymouscheckBox->isChecked())
|
||||
{
|
||||
sdi.shareflags = RS_FILE_HINTS_BROWSABLE ;
|
||||
}
|
||||
|
||||
rsFiles->addSharedDirectory(sdi);
|
||||
|
||||
//messageBoxOk(tr("Shared Directory Added!"));
|
||||
load();
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
void ShareDialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
if (!event->spontaneous())
|
||||
{
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
void ShareDialog::closedialog()
|
||||
{
|
||||
ui.localpath_lineEdit->clear();
|
||||
ui.anonymouscheckBox->setChecked(false);
|
||||
ui.friendscheckBox->setChecked(false);
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
bool ShareDialog::messageBoxOk(QString msg)
|
||||
{
|
||||
QMessageBox mb("Share Manager InfoBox!",msg,QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
mb.exec();
|
||||
return true;
|
||||
}
|
64
retroshare-gui/src/gui/ShareDialog.h
Normal file
64
retroshare-gui/src/gui/ShareDialog.h
Normal file
@ -0,0 +1,64 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006 - 2010 RetroShare Team
|
||||
*
|
||||
* 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 _SHAREDIALOG_H
|
||||
#define _SHAREDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "ui_ShareDialog.h"
|
||||
|
||||
class ShareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/** Default constructor */
|
||||
ShareDialog( QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default destructor */
|
||||
|
||||
bool messageBoxOk(QString);
|
||||
|
||||
public slots:
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void load();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent * event);
|
||||
|
||||
private slots:
|
||||
|
||||
void browseDirectory();
|
||||
void addDirectory();
|
||||
void closedialog();
|
||||
|
||||
private:
|
||||
|
||||
std::string currentDir;
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
282
retroshare-gui/src/gui/ShareDialog.ui
Normal file
282
retroshare-gui/src/gui/ShareDialog.ui
Normal file
@ -0,0 +1,282 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShareDialog</class>
|
||||
<widget class="QDialog" name="ShareDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>536</width>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>RetroShare Share Folder</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{background-image: url(:/images/connect/connectFriendBanner.png);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="piclabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/fileshare48.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:26pt; font-weight:600; color:#ffffff;">Share Folder</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="6">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Share Folder</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Local Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="localpath_lineEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="browseButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>27</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Virtual Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="virtualpath_lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Share Flags</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="anonymouscheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Anonymous shared Network Wide</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Anonymous</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="friendscheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Browseable by Friends</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" 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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>191</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -21,6 +21,7 @@
|
||||
#include "ShareManager.h"
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
#include "ShareDialog.h"
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
@ -47,7 +48,7 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags)
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShareDirectory() ) );
|
||||
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( showShareDialog() ) );
|
||||
connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
|
||||
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
@ -256,3 +257,9 @@ void ShareManager::showEvent(QShowEvent *event)
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::showShareDialog()
|
||||
{
|
||||
static ShareDialog *sharedlg = new ShareDialog(this);
|
||||
sharedlg->show();
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ private:
|
||||
|
||||
public slots:
|
||||
|
||||
void showShareDialog();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent * event);
|
||||
|
||||
@ -58,6 +61,7 @@ private slots:
|
||||
void removeShareDirectory();
|
||||
void updateFlags(bool);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user