From d890b302f1ee3059a188c3e5e470c3ccd6f38b53 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 3 Sep 2013 05:26:51 +0000 Subject: improved details dialog (Closes issue 380) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3679 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/detailsdialog.cpp | 115 +++++++++++++++++++---------- src/qmmpui/detailsdialog.h | 11 ++- src/qmmpui/translations/libqmmpui_cs.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_de.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_es.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_fr.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_he.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_hu.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_it.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_ja.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_kk.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_lt.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_nl.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_pl_PL.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_pt_BR.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_ru.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_sk.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_tr.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_uk_UA.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_zh_CN.ts | 35 +++++---- src/qmmpui/translations/libqmmpui_zh_TW.ts | 35 +++++---- 21 files changed, 465 insertions(+), 326 deletions(-) diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index 2b936bc0f..293b23bbd 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -36,34 +36,16 @@ DetailsDialog::DetailsDialog(QList tracks, QWidget *parent) : QDialog(parent) { m_ui = new Ui::DetailsDialog; - setAttribute(Qt::WA_QuitOnClose, false); - setAttribute(Qt::WA_DeleteOnClose, false); - m_metaDataModel = 0; - m_item = tracks.at(0); m_ui->setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); - m_path = m_item->url(); - setWindowTitle (m_path.section('/',-1)); - m_ui->pathEdit->setText(m_path); + setAttribute(Qt::WA_QuitOnClose, false); + setAttribute(Qt::WA_DeleteOnClose, true); m_ui->directoryButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); m_ui->nextButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowRight)); m_ui->prevButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowLeft)); - m_metaDataModel = MetaDataManager::instance()->createMetaDataModel(m_item->url(), this); - - if(m_metaDataModel) - { - foreach(TagModel *tagModel, m_metaDataModel->tags()) - m_ui->tabWidget->addTab(new TagEditor(tagModel, this), tagModel->name()); - - foreach(QString title, m_metaDataModel->descriptions().keys()) - { - QTextEdit *textEdit = new QTextEdit(this); - textEdit->setReadOnly(true); - textEdit->setPlainText(m_metaDataModel->descriptions().value(title)); - m_ui->tabWidget->addTab(textEdit, title); - } - } - printInfo(); + m_metaDataModel = 0; + m_page = 0; + m_tracks = tracks; + updatePage(); } DetailsDialog::~DetailsDialog() @@ -93,15 +75,84 @@ void DetailsDialog:: on_directoryButton_clicked() #endif } +void DetailsDialog::on_buttonBox_clicked(QAbstractButton *button) +{ + if(m_ui->buttonBox->standardButton(button) == QDialogButtonBox::Save) + { + TagEditor *tab = qobject_cast (m_ui->tabWidget->currentWidget()); + if(tab) + tab->save(); + } + else + reject(); +} + +void DetailsDialog::on_prevButton_clicked() +{ + if(m_page == 0) + m_page = m_tracks.count() - 1; + else + m_page--; + updatePage(); +} + +void DetailsDialog::on_nextButton_clicked() +{ + if(m_page >= m_tracks.count() - 1) + m_page = 0; + else + m_page++; + updatePage(); +} + +void DetailsDialog::updatePage() +{ + if(m_metaDataModel) + { + delete m_metaDataModel; + m_metaDataModel = 0; + } + + while (m_ui->tabWidget->count() > 1) + { + int index = m_ui->tabWidget->count() - 1; + QWidget *w = m_ui->tabWidget->widget(index); + m_ui->tabWidget->removeTab(index); + w->deleteLater(); + } + + m_ui->pageLabel->setText(tr("%1/%2").arg(m_page + 1).arg(m_tracks.count())); + m_track = m_tracks.at(m_page); + m_path = m_track->url(); + setWindowTitle (m_path.section('/',-1)); + m_ui->pathEdit->setText(m_path); + 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()); + + foreach(QString title, m_metaDataModel->descriptions().keys()) + { + QTextEdit *textEdit = new QTextEdit(this); + textEdit->setReadOnly(true); + textEdit->setPlainText(m_metaDataModel->descriptions().value(title)); + m_ui->tabWidget->addTab(textEdit, title); + } + } + printInfo(); +} + void DetailsDialog::printInfo() { SoundCore *core = SoundCore::instance(); QList flist = MetaDataManager::instance()->createPlayList(m_path, true); QMap metaData; - if(!flist.isEmpty() && QFile::exists(m_item->url())) + if(!flist.isEmpty() && QFile::exists(m_track->url())) metaData = flist.at(0)->metaData(); else - metaData = *m_item; + metaData = *m_track; QString formattedText; if(layoutDirection() == Qt::RightToLeft) formattedText.append("
"); @@ -175,15 +226,3 @@ QString DetailsDialog::formatRow(const QString key, const QString value) str.append(""); return str; } - -void DetailsDialog::on_buttonBox_clicked(QAbstractButton *button) -{ - if(m_ui->buttonBox->standardButton(button) == QDialogButtonBox::Save) - { - TagEditor *tab = qobject_cast (m_ui->tabWidget->currentWidget()); - if(tab) - tab->save(); - } - else - reject(); -} diff --git a/src/qmmpui/detailsdialog.h b/src/qmmpui/detailsdialog.h index 9d439fe49..53bc3d657 100644 --- a/src/qmmpui/detailsdialog.h +++ b/src/qmmpui/detailsdialog.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2012 by Ilya Kotov * + * Copyright (C) 2009-2013 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -55,14 +55,19 @@ public: private slots: void on_buttonBox_clicked(QAbstractButton *button); void on_directoryButton_clicked(); + void on_prevButton_clicked(); + void on_nextButton_clicked(); private: Ui::DetailsDialog *m_ui; + void updatePage(); void printInfo(); - QString m_path; QString formatRow(const QString key, const QString value); + QString m_path; MetaDataModel *m_metaDataModel; - PlayListTrack *m_item; + PlayListTrack *m_track; + QList m_tracks; + int m_page; }; #endif diff --git a/src/qmmpui/translations/libqmmpui_cs.ts b/src/qmmpui/translations/libqmmpui_cs.ts index ce451a0d0..df7ffa8b0 100644 --- a/src/qmmpui/translations/libqmmpui_cs.ts +++ b/src/qmmpui/translations/libqmmpui_cs.ts @@ -612,47 +612,52 @@ DetailsDialog - + + %1/%2 + + + + Title Název - + Artist Umělec - + Album Album - + Comment Poznámka - + Genre Žánr - + Composer Skladatel - + Year Rok - + Track Stopa - + Disc number Číslo disku @@ -662,17 +667,17 @@ Podrobnosti - + Open the directory containing this file Otevřít adresář obsahující tento soubor - + ... ... - + Summary Přehled @@ -740,8 +745,8 @@ PlayListManager - - + + Playlist Seznam skladeb @@ -749,7 +754,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_de.ts b/src/qmmpui/translations/libqmmpui_de.ts index cdc3998da..274196f68 100644 --- a/src/qmmpui/translations/libqmmpui_de.ts +++ b/src/qmmpui/translations/libqmmpui_de.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Titel - + Artist Interpret - + Album Album - + Comment Kommentar - + Genre Genre - + Composer Komponent - + Year Jahr - + Track Stück - + Disc number CD-Nummer @@ -661,17 +666,17 @@ Details - + Open the directory containing this file Das Verzeichnis öffnen, in dem sich diese Datei befindet - + ... - + Summary Zusammenfassung @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Wiedergabeliste @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_es.ts b/src/qmmpui/translations/libqmmpui_es.ts index 9e266a378..dff7c6835 100644 --- a/src/qmmpui/translations/libqmmpui_es.ts +++ b/src/qmmpui/translations/libqmmpui_es.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Título - + Artist Intérprete - + Album Album - + Comment Comentario - + Genre Género - + Composer Compositor - + Year Año - + Track Pista - + Disc number Número de disco @@ -661,17 +666,17 @@ Detalles - + Open the directory containing this file Abrir el directorio que contiene este archivo - + ... ... - + Summary Sumario @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Lista de reproducción @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_fr.ts b/src/qmmpui/translations/libqmmpui_fr.ts index 249faa7e9..4560ecefa 100644 --- a/src/qmmpui/translations/libqmmpui_fr.ts +++ b/src/qmmpui/translations/libqmmpui_fr.ts @@ -616,62 +616,67 @@ - + Open the directory containing this file - + ... - + Summary - + + %1/%2 + + + + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_he.ts b/src/qmmpui/translations/libqmmpui_he.ts index f2087fe41..2b8685577 100644 --- a/src/qmmpui/translations/libqmmpui_he.ts +++ b/src/qmmpui/translations/libqmmpui_he.ts @@ -616,62 +616,67 @@ פרטים - + Open the directory containing this file פתח את המדור שמכיל את קובץ זה - + ... - + Summary סיכום - + + %1/%2 + + + + Title כותרת - + Artist אמן - + Album אלבום - + Comment הערה - + Genre ז'אנר - + Composer מלחין - + Year שנה - + Track רצועה - + Disc number מספר תקליטור @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist רשימת השמעה @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_hu.ts b/src/qmmpui/translations/libqmmpui_hu.ts index 6898c5819..10527c198 100644 --- a/src/qmmpui/translations/libqmmpui_hu.ts +++ b/src/qmmpui/translations/libqmmpui_hu.ts @@ -616,62 +616,67 @@ - + Open the directory containing this file - + ... - + Summary - + + %1/%2 + + + + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_it.ts b/src/qmmpui/translations/libqmmpui_it.ts index 81c315818..8d24c40d4 100644 --- a/src/qmmpui/translations/libqmmpui_it.ts +++ b/src/qmmpui/translations/libqmmpui_it.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Titolo - + Artist Interprete - + Album Album - + Comment Commento - + Genre Genere - + Composer Compositore - + Year Anno - + Track Traccia - + Disc number Disco n° @@ -661,17 +666,17 @@ Dettagli - + Open the directory containing this file - + ... ... - + Summary Sommario @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Lista esecuzione @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_ja.ts b/src/qmmpui/translations/libqmmpui_ja.ts index 0e354ae64..d2d70ee5f 100644 --- a/src/qmmpui/translations/libqmmpui_ja.ts +++ b/src/qmmpui/translations/libqmmpui_ja.ts @@ -616,62 +616,67 @@ 詳細 - + Open the directory containing this file このファイルが保管されているディレクトリを開く - + ... ... - + Summary あらまし - + + %1/%2 + + + + Title タイトル - + Artist アーティスト - + Album アルバム - + Comment コメント - + Genre ジャンル - + Composer 作曲者 - + Year - + Track トラック - + Disc number ディスク番号 @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist プレイリスト @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_kk.ts b/src/qmmpui/translations/libqmmpui_kk.ts index 2d81f1529..de14a3e8d 100644 --- a/src/qmmpui/translations/libqmmpui_kk.ts +++ b/src/qmmpui/translations/libqmmpui_kk.ts @@ -616,62 +616,67 @@ - + Open the directory containing this file - + ... - + Summary - + + %1/%2 + + + + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_lt.ts b/src/qmmpui/translations/libqmmpui_lt.ts index 0cc08a0c8..d678f621f 100644 --- a/src/qmmpui/translations/libqmmpui_lt.ts +++ b/src/qmmpui/translations/libqmmpui_lt.ts @@ -612,47 +612,52 @@ DetailsDialog - + + %1/%2 + + + + Title Pavadinimas - + Artist Atlikėjas - + Album Albumas - + Comment Komentaras - + Genre Žanras - + Composer Autorius - + Year Metai - + Track Takelis - + Disc number Disko numeris @@ -662,17 +667,17 @@ Apie - + Open the directory containing this file Atverti aplanką, kuriame yra ši byla - + ... ... - + Summary Takelio informacija @@ -739,8 +744,8 @@ PlayListManager - - + + Playlist Grojaraštis @@ -748,7 +753,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_nl.ts b/src/qmmpui/translations/libqmmpui_nl.ts index afc9b1f21..73ea37a49 100644 --- a/src/qmmpui/translations/libqmmpui_nl.ts +++ b/src/qmmpui/translations/libqmmpui_nl.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Naam - + Artist Artiest - + Album Album - + Comment Commentaar - + Genre - + Composer Componist - + Year Jaar - + Track Nummer - + Disc number CD nummer @@ -661,17 +666,17 @@ Details - + Open the directory containing this file Open de bijbehorende map van dit bestand - + ... - + Summary Samenvatting @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Afspeellijst @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_pl_PL.ts b/src/qmmpui/translations/libqmmpui_pl_PL.ts index d093f820d..4611e9224 100644 --- a/src/qmmpui/translations/libqmmpui_pl_PL.ts +++ b/src/qmmpui/translations/libqmmpui_pl_PL.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Tytuł - + Artist Artysta - + Album Album - + Comment Komentarz - + Genre Gatunek - + Composer Kompozytor - + Year Rok - + Track Ścieżka - + Disc number Numer płyty @@ -661,17 +666,17 @@ Szczegóły - + Open the directory containing this file Otwórz katalog zawierający ten plik - + ... ... - + Summary Informacje @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Lista odtwarzania @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_pt_BR.ts b/src/qmmpui/translations/libqmmpui_pt_BR.ts index db623839a..a5dcf674a 100644 --- a/src/qmmpui/translations/libqmmpui_pt_BR.ts +++ b/src/qmmpui/translations/libqmmpui_pt_BR.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Título - + Artist Artista - + Album Álbum - + Comment Comentário - + Genre Gênero - + Composer - + Year Ano - + Track - + Disc number @@ -661,17 +666,17 @@ - + Open the directory containing this file - + ... ... - + Summary @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Lista de músicas @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_ru.ts b/src/qmmpui/translations/libqmmpui_ru.ts index c75934fb7..d87265f7f 100644 --- a/src/qmmpui/translations/libqmmpui_ru.ts +++ b/src/qmmpui/translations/libqmmpui_ru.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Название - + Artist Исполнитель - + Album Альбом - + Comment Комментарий - + Genre Жанр - + Composer Композитор - + Year Год - + Track Дорожка - + Disc number Номер диска @@ -661,17 +666,17 @@ Информация - + Open the directory containing this file Открыть директорию, содержащую файл - + ... ... - + Summary Общая информация @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Список @@ -747,7 +752,7 @@ PlayListTrack - + Empty group Пустая группа diff --git a/src/qmmpui/translations/libqmmpui_sk.ts b/src/qmmpui/translations/libqmmpui_sk.ts index 5407ef458..6ad7f8e4c 100644 --- a/src/qmmpui/translations/libqmmpui_sk.ts +++ b/src/qmmpui/translations/libqmmpui_sk.ts @@ -616,62 +616,67 @@ - + Open the directory containing this file - + ... ... - + Summary - + + %1/%2 + + + + Title Názov - + Artist Interprét - + Album Album - + Comment Poznámka - + Genre Žáner - + Composer Skladateľ - + Year Rok - + Track Skladba - + Disc number Číslo disku @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Playlist @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_tr.ts b/src/qmmpui/translations/libqmmpui_tr.ts index 81297f1ea..b04c02725 100644 --- a/src/qmmpui/translations/libqmmpui_tr.ts +++ b/src/qmmpui/translations/libqmmpui_tr.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Başlık - + Artist Sanatçı - + Album Albüm - + Comment Yorum - + Genre Tarz - + Composer - + Year Yıl - + Track - + Disc number @@ -661,17 +666,17 @@ - + Open the directory containing this file - + ... ... - + Summary @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Çalma Listesi @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_uk_UA.ts b/src/qmmpui/translations/libqmmpui_uk_UA.ts index 9c59aa8f6..cfddb2b11 100644 --- a/src/qmmpui/translations/libqmmpui_uk_UA.ts +++ b/src/qmmpui/translations/libqmmpui_uk_UA.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title Заголовок - + Artist Виконавець - + Album Альбом - + Comment Коментар - + Genre Жанр - + Composer Композитор - + Year Рік - + Track Доріжка - + Disc number Номер диску @@ -661,17 +666,17 @@ Подробиці - + Open the directory containing this file Відкрити теку, яка містить цей файл - + ... - + Summary Підсумок @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist Список @@ -747,7 +752,7 @@ PlayListTrack - + Empty group Пуста група diff --git a/src/qmmpui/translations/libqmmpui_zh_CN.ts b/src/qmmpui/translations/libqmmpui_zh_CN.ts index 01cec5e1e..d4cf8385b 100644 --- a/src/qmmpui/translations/libqmmpui_zh_CN.ts +++ b/src/qmmpui/translations/libqmmpui_zh_CN.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title 标题 - + Artist 艺术家 - + Album 专辑 - + Comment 备注 - + Genre 流派 - + Composer 作曲 - + Year 年代 - + Track 音轨 - + Disc number 光盘编号 @@ -661,17 +666,17 @@ 详细资料 - + Open the directory containing this file 打开该文件所在的文件夹 - + ... ... - + Summary 摘要 @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist 播放列表 @@ -747,7 +752,7 @@ PlayListTrack - + Empty group diff --git a/src/qmmpui/translations/libqmmpui_zh_TW.ts b/src/qmmpui/translations/libqmmpui_zh_TW.ts index 78d55e252..82ef6ac93 100644 --- a/src/qmmpui/translations/libqmmpui_zh_TW.ts +++ b/src/qmmpui/translations/libqmmpui_zh_TW.ts @@ -611,47 +611,52 @@ DetailsDialog - + + %1/%2 + + + + Title 標題 - + Artist 藝術家 - + Album 專輯 - + Comment 備註 - + Genre 流派 - + Composer 作曲 - + Year 年代 - + Track 音軌 - + Disc number 光槃編號 @@ -661,17 +666,17 @@ 詳細資料 - + Open the directory containing this file 打開該文件所在的文件夾 - + ... - + Summary 摘要 @@ -738,8 +743,8 @@ PlayListManager - - + + Playlist 播放清單 @@ -747,7 +752,7 @@ PlayListTrack - + Empty group -- cgit v1.2.3-13-gbd6f