From 91a61b1450755b29cf12f23d24a5edbe09fa24e4 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 1 Feb 2016 07:47:22 +0000 Subject: improved details dialog git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6115 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/detailsdialog.cpp | 18 +++++++++++++++--- src/qmmpui/detailsdialog.h | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index bb6a94121..f3633898e 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2015 by Ilya Kotov * + * Copyright (C) 2009-2016 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ DetailsDialog::DetailsDialog(QList tracks, QWidget *parent) m_page = 0; m_tracks = tracks; updatePage(); + on_tabWidget_currentChanged(0); } DetailsDialog::~DetailsDialog() @@ -87,6 +89,12 @@ void DetailsDialog::on_buttonBox_clicked(QAbstractButton *button) reject(); } +void DetailsDialog::on_tabWidget_currentChanged(int index) +{ + TagEditor *tab = qobject_cast (m_ui->tabWidget->widget(index)); + m_ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(tab != 0); +} + void DetailsDialog::on_prevButton_clicked() { if(m_page == 0) @@ -134,12 +142,16 @@ void DetailsDialog::updatePage() else m_metaData = *m_track; qDeleteAll(flist); + m_metaDataModel = MetaDataManager::instance()->createMetaDataModel(m_path, this); if(m_metaDataModel) { - foreach(TagModel *tagModel, m_metaDataModel->tags()) - m_ui->tabWidget->addTab(new TagEditor(tagModel, this), tagModel->name()); + if(QFile::exists(m_path) && QFileInfo(m_path).isWritable()) + { + foreach(TagModel *tagModel, m_metaDataModel->tags()) + m_ui->tabWidget->addTab(new TagEditor(tagModel, this), tagModel->name()); + } foreach(QString title, m_metaDataModel->descriptions().keys()) { diff --git a/src/qmmpui/detailsdialog.h b/src/qmmpui/detailsdialog.h index eeb1efc0c..39692d82d 100644 --- a/src/qmmpui/detailsdialog.h +++ b/src/qmmpui/detailsdialog.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2013 by Ilya Kotov * + * Copyright (C) 2009-2016 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -54,6 +54,7 @@ public: private slots: void on_buttonBox_clicked(QAbstractButton *button); + void on_tabWidget_currentChanged(int index); void on_directoryButton_clicked(); void on_prevButton_clicked(); void on_nextButton_clicked(); -- cgit v1.2.3-13-gbd6f