aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-12-14 19:20:31 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-12-14 19:20:31 +0000
commit5dd33d3b1bde69b4ded0b1b35a874919c3007fe5 (patch)
tree34e21b03abdd05f7697e22066f0cff397f5add7d /src/qmmpui
parent20379a8a96b8827d096779de0fd5fbbb6f543d88 (diff)
downloadqmmp-5dd33d3b1bde69b4ded0b1b35a874919c3007fe5.tar.gz
qmmp-5dd33d3b1bde69b4ded0b1b35a874919c3007fe5.tar.bz2
qmmp-5dd33d3b1bde69b4ded0b1b35a874919c3007fe5.zip
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
Diffstat (limited to 'src/qmmpui')
-rw-r--r--src/qmmpui/detailsdialog.cpp28
-rw-r--r--src/qmmpui/detailsdialog.h2
-rw-r--r--src/qmmpui/detailsdialog.ui75
3 files changed, 66 insertions, 39 deletions
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 <QDesktopServices>
#include <QTextCodec>
#include <QSettings>
#include <QDir>
#include <QFile>
#include <QFileInfo>
+#include <QProcess>
#include <qmmp/metadatamanager.h>
#include <qmmp/metadatamodel.h>
#include <qmmp/tagmodel.h>
@@ -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 <FileInfo *> 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 <QDialog>
#include <QList>
#include <QMap>
@@ -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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>456</width>
- <height>385</height>
+ <width>485</width>
+ <height>390</height>
</rect>
</property>
<property name="windowTitle">
<string>Details</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item row="3" column="0">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>192</width>
- <height>23</height>
- </size>
- </property>
- </spacer>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="pathEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="directoryButton">
+ <property name="toolTip">
+ <string>Open the directory containing this file</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="1" column="0" colspan="2">
+ <item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
@@ -45,9 +50,12 @@
<attribute name="title">
<string>Summary</string>
</attribute>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
<widget class="QTextEdit" name="textEdit">
+ <property name="toolTip">
+ <string/>
+ </property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -55,8 +63,8 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -64,14 +72,7 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
- <item row="0" column="0" colspan="2">
- <widget class="QLineEdit" name="pathEdit">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>