From 1bc0cf6bf38f2afc7aebbe0ba397f0fd6d474585 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 27 Aug 2008 08:41:43 +0000 Subject: [PATCH] * updated Library Dialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@708 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/LibraryDialog.cpp | 117 ++++++++++++++++--- retroshare-gui/src/gui/LibraryDialog.h | 17 ++- retroshare-gui/src/gui/LibraryDialog.ui | 7 +- retroshare-gui/src/gui/feeds/ForumNewItem.ui | 17 +++ 4 files changed, 139 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/LibraryDialog.cpp b/retroshare-gui/src/gui/LibraryDialog.cpp index d88c30c5c..f09707798 100644 --- a/retroshare-gui/src/gui/LibraryDialog.cpp +++ b/retroshare-gui/src/gui/LibraryDialog.cpp @@ -71,14 +71,8 @@ LibraryDialog::LibraryDialog(QWidget *parent) PopulateList(); - - QDirModel * dmodel=new QDirModel(this); - ui.organizertreeView->setModel(dmodel); - ui.organizerListView->setModel(dmodel); - ui.organizerListView->setSpacing(10); - QDir retroshareLib; - retroshareLib.mkdir("RetroShare Library"); + connect(ui.organizerListView, SIGNAL(rightButtonClicked(QModelIndex,QPoint)), this, SLOT(ListLibrarymenu(QModelIndex,QPoint))); connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library())); connect(ui.tileView_btn_library,SIGNAL(clicked()),this, SLOT(CallTileViewBtn_library())); @@ -100,16 +94,89 @@ LibraryDialog::LibraryDialog(QWidget *parent) #endif } + void LibraryDialog::PopulateList() { - QDir dir; - QString libPath; + QDir DwnlFolder,ShrFolder,retroshareLib,treePath; + retroshareLib.mkdir("RetroShare Library"); + DwnlFolder.mkdir("RetroShare Library/Download"); + ShrFolder.mkdir("RetroShare Library/SharedFolder"); + LibShared=treePath.currentPath(); + LibShared.append("/RetroShare Library"); + QDirModel * dmodel=new QDirModel; + ui.organizertreeView->setModel(dmodel); + ui.organizertreeView->setRootIndex(dmodel->index(LibShared)); + ui.organizerListView->setModel(dmodel); + ui.organizerListView->setViewMode(QListView::ListMode); + ui.organizerListView->setWordWrap (true); - QDirModel *dirmodel=new QDirModel(this); - //ui.organizertreeView->setModel(dirmodel); - libPath=dir.currentPath(); - //QModelIndex cmodel=dirmodel->index(QDir::rootPath()); - //ui.organizertreeView->setRootIndex(cmodel); +} + + +void LibraryDialog::ListLibrarymenu(QModelIndex index,QPoint pos) +{ + ind=index; + if(index.isValid()) + { + bool indexselected=true; + QMenu rmenu(this); + rmenu.move(pos); + if(indexselected) + rmenu.addAction(QIcon(""),tr("Play"), this, SLOT(PlayFrmList())); + if(indexselected) + rmenu.addAction(QIcon(""),tr("Copy"), this, SLOT(copyFile())); + if(indexselected) + rmenu.addAction(QIcon(""),tr("Delete"), this, SLOT(DeleteFile())); + if(indexselected) + rmenu.addAction(QIcon(""),tr("Rename"), this, SLOT(RenameFile())); + rmenu.exec(); + } + else + return; +} + +void LibraryDialog::PlayFrmList() +{ + QDirModel *dmodel=new QDirModel; + QModelIndex parentIndex = dmodel->index(LibShared+"/Download"); + QModelIndex index = dmodel->index(ind.row(), 0, parentIndex); + QString text = dmodel->data(index, Qt::DisplayRole).toString(); + + filechose.clear(); + QDir dir; + filechose.append(LibShared+"/Download/"); + filechose.append(text); + if(filechose.contains("avi")|| filechose.contains("MP3")||filechose.contains("mp3")|| filechose.contains("wmv")||filechose.contains("wav")|| filechose.contains("dat")|| filechose.contains("mov")|| filechose.contains("mpeg")|| filechose.contains("mpg")) + { + player(); + } + else + QMessageBox::information(this,"Information", "Not Supported By the Player"); +} + +void LibraryDialog::copyFile() +{ + +} + +void LibraryDialog::DeleteFile() +{ + +} + +void LibraryDialog::RenameFile() +{ + ui.organizerListView->openPersistentEditor (ind); + progtime=new QTimer(this); + progtime->start(100000); + connect(progtime, SIGNAL(timeout()), this, SLOT(StopRename())); + +} + +void LibraryDialog::StopRename() +{ + ui.organizerListView->closePersistentEditor(ind); + progtime->stop(); } @@ -151,3 +218,25 @@ void LibraryDialog::CallFindBtn_library() FindWindow *files = new FindWindow(this); files->show(); } + +void LibraryDialog:: player() +{ + QString avi; + avi.append(filechose); + QStringList argu; + QString smlayer="./smplayer"; + argu<start(smlayer,argu); + +} + +void LibraryDialog::browseFile() + { + QDir dir; + QString pathseted =dir.currentPath(); + pathseted.append("/RetroShare Library/Download"); + filechose = QFileDialog::getOpenFileName(this, tr("Open File..."), + pathseted, tr("Media-Files (*.avi *.mp3 *.wmv *.wav *.dat *.mov *.mpeg);;All Files (*)")); + //movieEdit->setText(filechose); + } diff --git a/retroshare-gui/src/gui/LibraryDialog.h b/retroshare-gui/src/gui/LibraryDialog.h index 10ff72584..7401149f6 100644 --- a/retroshare-gui/src/gui/LibraryDialog.h +++ b/retroshare-gui/src/gui/LibraryDialog.h @@ -42,9 +42,11 @@ public: /** Default Destructor */ QString filePass(); + QString LibShared; + QString filechose; + QModelIndex ind; private slots: - void PopulateList(); @@ -54,14 +56,23 @@ private slots: void CallCreateAlbumBtn_library(); void CallDeleteAlbumBtn_library(); void CallFindBtn_library(); - - + + void browseFile(); + void player(); + void ListLibrarymenu(QModelIndex,QPoint); + void PlayFrmList(); + void copyFile(); + void DeleteFile(); + void RenameFile(); + void StopRename(); signals: + void rightButtonClicked(const QModelIndex , const QPoint); private: + QTimer *progtime; /** Qt Designer generated object */ diff --git a/retroshare-gui/src/gui/LibraryDialog.ui b/retroshare-gui/src/gui/LibraryDialog.ui index ca6d9bdde..7f59de9d8 100644 --- a/retroshare-gui/src/gui/LibraryDialog.ui +++ b/retroshare-gui/src/gui/LibraryDialog.ui @@ -526,6 +526,9 @@ + + Qt::DefaultContextMenu + QListView::Free @@ -675,9 +678,9 @@ organizertreeView - clicked(QModelIndex) + doubleClicked(QModelIndex) organizerListView - setCurrentIndex(QModelIndex) + setRootIndex(QModelIndex) 139 diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.ui b/retroshare-gui/src/gui/feeds/ForumNewItem.ui index a21fe66d0..b9e9f4b3e 100644 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.ui +++ b/retroshare-gui/src/gui/feeds/ForumNewItem.ui @@ -53,6 +53,9 @@ Remove Item + + + @@ -93,6 +96,9 @@ true + + + Connected @@ -116,6 +122,9 @@ + + + name @@ -214,6 +223,10 @@ + + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 lightgray, stop:1 darkgray); + @@ -230,6 +243,10 @@ 0 + + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 lightgray, stop:1 darkgray); + Description of Forum