diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index d36cabb70..60c037804 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -48,7 +48,7 @@ HEADERS += rshare.h \ gui/StartDialog.h \ gui/ChatDialog.h \ gui/BlogDialog.h \ - gui/CalDialog.h \ + gui/CalDialog.h \ gui/NetworkDialog.h \ gui/GenCertDialog.h \ gui/TransfersDialog.h \ @@ -63,6 +63,7 @@ HEADERS += rshare.h \ gui/PhotoDialog.h \ gui/PhotoShow.h \ gui/LinksDialog.h \ + gui/LibraryDialog.h \ gui/ForumsDialog.h \ gui/forums/CreateForum.h \ gui/forums/CreateForumMsg.h \ @@ -72,6 +73,7 @@ HEADERS += rshare.h \ gui/SearchTreeWidget.h \ gui/SearchDialog.h \ gui/SharedFilesDialog.h \ + gui/ShareFilesDialog.h \ gui/StatisticDialog.h \ gui/HelpDialog.h \ gui/LogoBar.h \ @@ -186,6 +188,7 @@ FORMS += gui/ChatDialog.ui \ gui/PhotoDialog.ui \ gui/PhotoShow.ui \ gui/LinksDialog.ui \ + gui/LibraryDialog.ui \ gui/ForumsDialog.ui \ gui/forums/CreateForum.ui \ gui/forums/CreateForumMsg.ui \ @@ -194,6 +197,7 @@ FORMS += gui/ChatDialog.ui \ gui/PeersDialog.ui \ gui/SearchDialog.ui \ gui/SharedFilesDialog.ui \ + gui/ShareFilesDialog.ui \ gui/StatisticDialog.ui \ gui/MessagesDialog.ui \ gui/help/browser/helpbrowser.ui \ @@ -272,6 +276,7 @@ SOURCES += main.cpp \ gui/PhotoDialog.cpp \ gui/PhotoShow.cpp \ gui/LinksDialog.cpp \ + gui/LibraryDialog.cpp \ gui/ForumsDialog.cpp \ gui/forums/CreateForum.cpp \ gui/forums/CreateForumMsg.cpp \ @@ -281,6 +286,7 @@ SOURCES += main.cpp \ gui/SearchTreeWidget.cpp \ gui/SearchDialog.cpp \ gui/SharedFilesDialog.cpp \ + gui/ShareFilesDialog.cpp \ gui/StatisticDialog.cpp \ gui/MessagesDialog.cpp \ gui/help/browser/helpbrowser.cpp \ diff --git a/retroshare-gui/src/gui/ApplicationWindow.cpp b/retroshare-gui/src/gui/ApplicationWindow.cpp index a14325d07..ad4adff04 100644 --- a/retroshare-gui/src/gui/ApplicationWindow.cpp +++ b/retroshare-gui/src/gui/ApplicationWindow.cpp @@ -53,6 +53,8 @@ #include "TransferFeed.h" #include "MsgFeed.h" #include "ChannelFeed.h" +#include "LibraryDialog.h" + /* for smplayer */ #include "smplayer.h" @@ -83,7 +85,8 @@ #define IMAGE_NEWSFEED ":/images/konqsidebar_news24.png" #define IMAGE_LINKS ":/images/ktorrent.png" #define IMAGE_MESSAGES ":/images/evolution.png" -#define IMAGE_BLOGS ":/images/kblogger.png" +#define IMAGE_BLOGS ":/images/kblogger.png" +#define IMAGE_LIBRARY ":/images/library.png" /* Keys for UI Preferences */ @@ -150,6 +153,10 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) PhotoDialog *photoDialog = NULL; ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp)); + + LibraryDialog *libraryDialog = NULL; + ui.stackPages->add(libraryDialog = new LibraryDialog(ui.stackPages), + createPageAction(QIcon(IMAGE_LIBRARY), tr("Library"), grp)); CalDialog *calDialog = NULL; ui.stackPages->add(calDialog = new CalDialog(ui.stackPages), diff --git a/retroshare-gui/src/gui/LibraryDialog.cpp b/retroshare-gui/src/gui/LibraryDialog.cpp new file mode 100644 index 000000000..8eaedd4fb --- /dev/null +++ b/retroshare-gui/src/gui/LibraryDialog.cpp @@ -0,0 +1,134 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008, defnax + * + * 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 "rshare.h" +#include "LibraryDialog.h" + +#include "rsiface/rsiface.h" +#include "rsiface/rspeers.h" +#include "rsiface/rsfiles.h" +#include "rsiface/RemoteDirModel.h" +#include "ShareFilesDialog.h" + +#include "util/RsAction.h" +#include "msgs/ChanMsgDialog.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Images for context menu icons */ +#define IMAGE_DOWNLOAD ":/images/download16.png" +#define IMAGE_PLAY ":/images/start.png" +#define IMAGE_HASH_BUSY ":/images/settings.png" +#define IMAGE_HASH_DONE ":/images/friendsfolder24.png" +#define IMAGE_MSG ":/images/message-mail.png" +#define IMAGE_ATTACHMENT ":/images/attachment.png" +#define IMAGE_FRIEND ":/images/peers_16x16.png" +#define IMAGE_PROGRESS ":/images/browse-looking.gif" +#define IMAGE_LIBRARY ":/images/library.png" + + +/** Constructor */ +LibraryDialog::LibraryDialog(QWidget *parent) +: MainPage(parent) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); + + + PopulateList(); + + QDirModel * dmodel=new QDirModel(this); + ui.organizertreeView->setModel(dmodel); + ui.organizerListView->setModel(dmodel); + ui.organizerListView->setSpacing(10); + QDir DwnlFolder,ShrFolder; + + + connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library())); + connect(ui.tileView_btn_library,SIGNAL(clicked()),this, SLOT(CallTileViewBtn_library())); + connect(ui.showDetails_btn_library,SIGNAL(clicked()),this, SLOT(CallShowDetailsBtn_library())); + connect(ui.createAlbum_btn_library,SIGNAL(clicked()),this, SLOT(CallCreateAlbumBtn_library())); + connect(ui.deleteAlbum_btn_library,SIGNAL(clicked()),this, SLOT(CallDeleteAlbumBtn_library())); + connect(ui.find_btn_library,SIGNAL(clicked()),this, SLOT(CallFindBtn_library())); + + + + + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + timer->start(1000); + + /* Hide platform specific features */ +#ifdef Q_WS_WIN + +#endif +} + +void LibraryDialog::PopulateList() +{ + QDirModel *dirmodel=new QDirModel(this); + ui.organizertreeView->setModel(dirmodel); + QModelIndex cmodel=dirmodel->index(QDir::rootPath()); + ui.organizertreeView->setRootIndex(cmodel); +} + + +void LibraryDialog::CallShareFilesBtn_library() +{ + ShareFilesDialog *sf=new ShareFilesDialog(this,0); + sf->show(); +} + +void LibraryDialog::CallTileViewBtn_library() +{ + //QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- tilesView in Library")); +} + +void LibraryDialog::CallShowDetailsBtn_library() +{ + //QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- showdetails in Library")); +} + +void LibraryDialog::CallCreateAlbumBtn_library() +{ + //QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- Create Album in Library")); +} + +void LibraryDialog::CallDeleteAlbumBtn_library() +{ + //QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- Delete Album in Library")); +} + + diff --git a/retroshare-gui/src/gui/LibraryDialog.h b/retroshare-gui/src/gui/LibraryDialog.h new file mode 100644 index 000000000..04d378887 --- /dev/null +++ b/retroshare-gui/src/gui/LibraryDialog.h @@ -0,0 +1,73 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008, 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 _SHAREDFILESDIALOG_H +#define _SHAREDFILESDIALOG_H + +#include + +//#include + +#include "mainpage.h" +#include "ui_LibraryDialog.h" + +#include "rsiface/rstypes.h" +#include "rsiface/RemoteDirModel.h" + +class LibraryDialog : public MainPage +{ + Q_OBJECT + +public: + /** Default Constructor */ + LibraryDialog(QWidget *parent = 0); + /** Default Destructor */ + + + +private slots: + + + void PopulateList(); + + void CallShareFilesBtn_library(); + void CallTileViewBtn_library(); + void CallShowDetailsBtn_library(); + void CallCreateAlbumBtn_library(); + void CallDeleteAlbumBtn_library(); + + + + +signals: + + +private: + + + /** Qt Designer generated object */ + Ui::LibraryDialog ui; + + +}; + +#endif + diff --git a/retroshare-gui/src/gui/LibraryDialog.ui b/retroshare-gui/src/gui/LibraryDialog.ui new file mode 100644 index 000000000..87e021fa3 --- /dev/null +++ b/retroshare-gui/src/gui/LibraryDialog.ui @@ -0,0 +1,676 @@ + + LibraryDialog + + + + 0 + 0 + 629 + 463 + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 192 + 192 + 192 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 104 + 104 + 104 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 104 + 104 + 104 + + + + + + + 255 + 255 + 255 + + + + + + + 104 + 104 + 104 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + Qt::NoContextMenu + + + + + + Library + + + + + + background-color: rgb(253, 252, 248); + + + Exploring My RetroShare Library + + + + + + + Tile view + + + true + + + + + + + Show Details + + + true + + + + + + + QListView::Free + + + QListView::IconMode + + + false + + + + + + + + + + Create Album + + + true + + + + + + + + + + Delete Album + + + true + + + + + + + + + + pushButton_41:hover{ color : white;} + + + Find + + + true + + + + + + + QTabWidget::Triangular + + + 1 + + + + + 0 + 0 + 226 + 345 + + + + Folder + + + + + + border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255)); + + + + All File Types + + + + + Application + + + + + Archive + + + + + + + + + + 0 + 0 + 238 + 390 + + + + Organizer + + + + + + + Utopia + 8 + + + + + + + + border-color: rgb(0, 0, 0); + + + Share Files.. + + + true + + + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/ShareFilesDialog.cpp b/retroshare-gui/src/gui/ShareFilesDialog.cpp new file mode 100644 index 000000000..91bc13094 --- /dev/null +++ b/retroshare-gui/src/gui/ShareFilesDialog.cpp @@ -0,0 +1,116 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008, defnax + * + * 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 "ShareFilesDialog.h" + +#include +// +ShareFilesDialog::ShareFilesDialog( QWidget * parent, Qt::WFlags f) + : QDialog(parent, f) +{ + setupUi(this); + + connect(shareOk,SIGNAL(clicked()), this, SLOT(FilenameShared())); + connect(addfile_Btn,SIGNAL(clicked()), this, SLOT(addfileBrowse())); + connect(DownloadList,SIGNAL(currentRowChanged(int)), this, SLOT(currIndex(int))); + connect(remfile_Btn,SIGNAL(clicked()), this, SLOT(remove_File())); + connect(DownloadList,SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(filenametoShare(QListWidgetItem *))); +} + +void ShareFilesDialog::filenametoShare(QListWidgetItem *atname) +{ + filnameList = atname->text(); +} + +void ShareFilesDialog::FilenameShared() +{ + QDir dir; + QString finm = dir.currentPath(); + QString cpypathto =dir.currentPath(); + + finm.append("/DownLoad/"); + finm.append(filnameList); + cpypathto.append("/SharedFolder/"); + cpypathto.append(filnameList); + + QFile share; + share.copy(finm,cpypathto); + messageBoxOk("Added!"); +} +void ShareFilesDialog::addfileBrowse() +{ + QDir dir; + int ind; + QString pathseted =dir.currentPath(); + + pathseted.append("/DownLoad"); + + QString fileshare = QFileDialog::getOpenFileName(this, tr("Open File..."),pathseted, tr("All Files (*)")); + QString slash="/"; + + ind=fileshare.lastIndexOf("/"); + filnameShared =fileshare.mid(ind+1,((fileshare.size())-ind)); + DownloadList->addItem(filnameShared); + +} + +void ShareFilesDialog::currIndex(int row) +{ + + currrow=row; + +} + +void ShareFilesDialog::remove_File() +{ + + QDir dir; + QFile file; + int ind; + QString pathseted =dir.currentPath(); + QString path=dir.currentPath(); + path.append("/SharedFolder"); + QString fileshare = QFileDialog::getOpenFileName(this, tr("Open File..."),path, tr("All Files (*)")); + ind=fileshare.lastIndexOf("/"); + filnameShared =fileshare.mid(ind+1,((fileshare.size())-ind)); + + pathseted.append("/SharedFolder/"); + pathseted.append(filnameShared); + QString queryWrn; + queryWrn.clear(); + queryWrn.append("Do You Want to Delete ? "); + queryWrn.append(pathseted); + + if ((QMessageBox::question(this, tr("Warning!"),queryWrn,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok) + { + file.remove(pathseted); + } + else + return; +} + +bool ShareFilesDialog::messageBoxOk(QString msg) + { + QMessageBox mb("files and itz names!",msg,QMessageBox::Information,QMessageBox::Ok,0,0); + mb.setButtonText( QMessageBox::Ok, "OK" ); + mb.exec(); + return true; + } \ No newline at end of file diff --git a/retroshare-gui/src/gui/ShareFilesDialog.h b/retroshare-gui/src/gui/ShareFilesDialog.h new file mode 100644 index 000000000..5bbcfad23 --- /dev/null +++ b/retroshare-gui/src/gui/ShareFilesDialog.h @@ -0,0 +1,55 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008, defnax + * + * 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 SHAREDFILE_DIALOGIMPL_H +#define SHAREDFILE_DIALOGIMPL_H + +#include +#include +#include + +#include "ui_ShareFilesDialog.h" +// +class ShareFilesDialog: public QDialog, public Ui::ShareFilesDialog +{ +Q_OBJECT + +public: + ShareFilesDialog( QWidget * parent , Qt::WFlags f ); + int currrow; + bool messageBoxOk(QString); + QString filnameList; + QString filnameShared; + +private slots: + + void FilenameShared(); + void addfileBrowse(); + void remove_File(); + void currIndex(int); + void filenametoShare(QListWidgetItem *); +}; +#endif + + + + + diff --git a/retroshare-gui/src/gui/ShareFilesDialog.ui b/retroshare-gui/src/gui/ShareFilesDialog.ui new file mode 100644 index 000000000..d97325324 --- /dev/null +++ b/retroshare-gui/src/gui/ShareFilesDialog.ui @@ -0,0 +1,90 @@ + + ShareFilesDialog + + + + 0 + 0 + 557 + 315 + + + + Shared Folder Manager + + + + + + Shared Folder Manager: + + + + + + Add + + + + + + + Remove + + + + + + + Qt::Horizontal + + + + 170 + 20 + + + + + + + + Ok + + + + + + + Cancel + + + + + + + + + + + + + + + pushButton_4 + clicked() + sharedFile_dialog + reject() + + + 495 + 290 + + + 495 + 319 + + + + + diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 239a85da9..c6f8eb015 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -176,6 +176,7 @@ images/ktorrent.png images/ktorrent32.png images/knewsticker24.png + images/library.png images/loadcert16.png images/locale.png images/looknfeel.png diff --git a/retroshare-gui/src/gui/images/library.png b/retroshare-gui/src/gui/images/library.png new file mode 100644 index 000000000..d9e473dce Binary files /dev/null and b/retroshare-gui/src/gui/images/library.png differ