* updated Library Dialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@708 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-27 08:41:43 +00:00
parent d62876ae37
commit 1bc0cf6bf3
4 changed files with 139 additions and 19 deletions

View File

@ -72,13 +72,7 @@ LibraryDialog::LibraryDialog(QWidget *parent)
PopulateList(); PopulateList();
QDirModel * dmodel=new QDirModel(this); connect(ui.organizerListView, SIGNAL(rightButtonClicked(QModelIndex,QPoint)), this, SLOT(ListLibrarymenu(QModelIndex,QPoint)));
ui.organizertreeView->setModel(dmodel);
ui.organizerListView->setModel(dmodel);
ui.organizerListView->setSpacing(10);
QDir retroshareLib;
retroshareLib.mkdir("RetroShare Library");
connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library())); connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library()));
connect(ui.tileView_btn_library,SIGNAL(clicked()),this, SLOT(CallTileViewBtn_library())); connect(ui.tileView_btn_library,SIGNAL(clicked()),this, SLOT(CallTileViewBtn_library()));
@ -100,16 +94,89 @@ LibraryDialog::LibraryDialog(QWidget *parent)
#endif #endif
} }
void LibraryDialog::PopulateList() void LibraryDialog::PopulateList()
{ {
QDir dir; QDir DwnlFolder,ShrFolder,retroshareLib,treePath;
QString libPath; 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()); void LibraryDialog::ListLibrarymenu(QModelIndex index,QPoint pos)
//ui.organizertreeView->setRootIndex(cmodel); {
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); FindWindow *files = new FindWindow(this);
files->show(); files->show();
} }
void LibraryDialog:: player()
{
QString avi;
avi.append(filechose);
QStringList argu;
QString smlayer="./smplayer";
argu<<avi;
QProcess *retroshareplayer=new QProcess(this);
retroshareplayer->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);
}

View File

@ -42,10 +42,12 @@ public:
/** Default Destructor */ /** Default Destructor */
QString filePass(); QString filePass();
QString LibShared;
QString filechose;
QModelIndex ind;
private slots: private slots:
void PopulateList(); void PopulateList();
void CallShareFilesBtn_library(); void CallShareFilesBtn_library();
@ -55,13 +57,22 @@ private slots:
void CallDeleteAlbumBtn_library(); void CallDeleteAlbumBtn_library();
void CallFindBtn_library(); void CallFindBtn_library();
void browseFile();
void player();
void ListLibrarymenu(QModelIndex,QPoint);
void PlayFrmList();
void copyFile();
void DeleteFile();
void RenameFile();
void StopRename();
signals: signals:
void rightButtonClicked(const QModelIndex , const QPoint);
private: private:
QTimer *progtime;
/** Qt Designer generated object */ /** Qt Designer generated object */

View File

@ -526,6 +526,9 @@
</item> </item>
<item row="1" column="1" colspan="4" > <item row="1" column="1" colspan="4" >
<widget class="QListView" name="organizerListView" > <widget class="QListView" name="organizerListView" >
<property name="contextMenuPolicy" >
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="movement" > <property name="movement" >
<enum>QListView::Free</enum> <enum>QListView::Free</enum>
</property> </property>
@ -675,9 +678,9 @@
<connections> <connections>
<connection> <connection>
<sender>organizertreeView</sender> <sender>organizertreeView</sender>
<signal>clicked(QModelIndex)</signal> <signal>doubleClicked(QModelIndex)</signal>
<receiver>organizerListView</receiver> <receiver>organizerListView</receiver>
<slot>setCurrentIndex(QModelIndex)</slot> <slot>setRootIndex(QModelIndex)</slot>
<hints> <hints>
<hint type="sourcelabel" > <hint type="sourcelabel" >
<x>139</x> <x>139</x>

View File

@ -53,6 +53,9 @@
<property name="toolTip" > <property name="toolTip" >
<string>Remove Item</string> <string>Remove Item</string>
</property> </property>
<property name="styleSheet" >
<string notr="true" />
</property>
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
@ -93,6 +96,9 @@
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet" >
<string notr="true" />
</property>
<property name="text" > <property name="text" >
<string>Connected</string> <string>Connected</string>
</property> </property>
@ -116,6 +122,9 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="nameLabel" > <widget class="QLabel" name="nameLabel" >
<property name="styleSheet" >
<string notr="true" />
</property>
<property name="text" > <property name="text" >
<string>name</string> <string>name</string>
</property> </property>
@ -214,6 +223,10 @@
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<widget class="QLabel" name="iconLabel" > <widget class="QLabel" name="iconLabel" >
<property name="styleSheet" >
<string notr="true" > background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 lightgray, stop:1 darkgray);</string>
</property>
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
@ -230,6 +243,10 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="styleSheet" >
<string notr="true" > background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 lightgray, stop:1 darkgray);</string>
</property>
<property name="text" > <property name="text" >
<string>Description <string>Description
of Forum</string> of Forum</string>