From 5dd33d3b1bde69b4ded0b1b35a874919c3007fe5 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 14 Dec 2010 19:20:31 +0000 Subject: added button to the detailsdialog, that opens up the directory of that file (based on patch by Panagiotis Papadopoulos) (Closes issue 361) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2010 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/detailsdialog.cpp | 28 +++++++++++++++-- src/qmmpui/detailsdialog.h | 2 ++ src/qmmpui/detailsdialog.ui | 75 ++++++++++++++++++++++---------------------- 3 files changed, 66 insertions(+), 39 deletions(-) (limited to 'src/qmmpui') diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index 5bb6b2be5..10cba244b 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Ilya Kotov * + * Copyright (C) 2009-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -17,11 +17,13 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include #include #include #include #include #include +#include #include #include #include @@ -43,7 +45,7 @@ DetailsDialog::DetailsDialog(PlayListItem *item, QWidget *parent) m_path = item->url(); setWindowTitle (m_path.section('/',-1)); m_ui->pathEdit->setText(m_path); - + m_ui->directoryButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); m_metaDataModel = MetaDataManager::instance()->createMetaDataModel(item->url(), this); if(m_metaDataModel) @@ -67,6 +69,28 @@ DetailsDialog::~DetailsDialog() delete m_ui; } +void DetailsDialog:: on_directoryButton_clicked() +{ + QString dir_path; + if(!m_path.contains("://")) //local file + dir_path = QFileInfo(m_path).absolutePath(); + else if (m_path.contains(":///")) //pseudo-protocol + { + dir_path = QUrl(m_path).path(); + dir_path.replace(QString(QUrl::toPercentEncoding("#")), "#"); + dir_path.replace(QString(QUrl::toPercentEncoding("?")), "?"); + dir_path.replace(QString(QUrl::toPercentEncoding("%")), "%"); + dir_path = QFileInfo(dir_path).absolutePath(); + } + else + return; +#ifdef Q_WS_X11 + QProcess::execute("xdg-open", QStringList() << dir_path); //works with lxde +#else + QDesktopServices::openUrl(QUrl::fromLocalFile(dir_path)); +#endif +} + void DetailsDialog::printInfo() { QList flist = MetaDataManager::instance()->createPlayList(m_path, true); diff --git a/src/qmmpui/detailsdialog.h b/src/qmmpui/detailsdialog.h index 3574ab408..c5e060bad 100644 --- a/src/qmmpui/detailsdialog.h +++ b/src/qmmpui/detailsdialog.h @@ -20,6 +20,7 @@ #ifndef DETAILSDIALOG_H #define DETAILSDIALOG_H +#include "ui_detailsdialog.h" #include #include #include @@ -54,6 +55,7 @@ public: private slots: void on_buttonBox_clicked(QAbstractButton *button); + void on_directoryButton_clicked(); private: Ui::DetailsDialog *m_ui; diff --git a/src/qmmpui/detailsdialog.ui b/src/qmmpui/detailsdialog.ui index 77261a1e6..ab4037fac 100644 --- a/src/qmmpui/detailsdialog.ui +++ b/src/qmmpui/detailsdialog.ui @@ -6,37 +6,42 @@ 0 0 - 456 - 385 + 485 + 390 Details - - - 6 - - - 6 - - - 6 - - - - - Qt::Horizontal - - - - 192 - 23 - - - + + + + + + + + 0 + 0 + + + + true + + + + + + + Open the directory containing this file + + + ... + + + + - + 0 @@ -45,9 +50,12 @@ Summary - - + + + + + true @@ -55,8 +63,8 @@ <!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:'Arial'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;"></p></body></html> @@ -64,14 +72,7 @@ p, li { white-space: pre-wrap; } - - - - true - - - - + QDialogButtonBox::Close|QDialogButtonBox::Save -- cgit v1.2.3-13-gbd6f