Directory model, reset button, save and load settings

This commit is contained in:
David Sansome 2010-06-24 17:34:23 +00:00
parent 8fbc954279
commit e680c441c1
31 changed files with 343 additions and 92 deletions

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -986,6 +990,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -342,9 +349,6 @@ msgstr "Nastavit klávesové zkratky"
msgid "Configure library..."
msgstr "Nastavit knihovnu..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Zkopírovat do knihovny..."
@ -990,6 +994,9 @@ msgstr "Možnosti výstupu"
msgid "Output plugin"
msgstr "Výstupní modul:"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Párty"

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -342,9 +349,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Indstil bibliotek..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Kopiér til bibliotek..."
@ -991,6 +995,9 @@ msgstr ""
msgid "Output plugin"
msgstr "Output-plugin"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Tastenkürzel einrichten"
msgid "Configure library..."
msgstr "Musiksammlung einrichten..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "In die Musiksammlung kopieren..."
@ -994,6 +998,9 @@ msgstr "Optionen"
msgid "Output plugin"
msgstr "Ausgabemodul"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -84,6 +84,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -343,9 +350,6 @@ msgstr "Ρύθμιση συντομεύσεων"
msgid "Configure library..."
msgstr "Παραμετροποίηση της βιβλιοθήκης"
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Αντιγραφή στην βιβλιοθήκη..."
@ -995,6 +999,9 @@ msgstr "Επιλογές εξόδου"
msgid "Output plugin"
msgstr "Επέκταση εξόδου"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Πάρτι"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Configure Shortcuts"
msgid "Configure library..."
msgstr "Configure library..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copy to library..."
@ -991,6 +995,9 @@ msgstr "Output options"
msgid "Output plugin"
msgstr "Output plugin"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Configure library..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copy to library..."
@ -988,6 +992,9 @@ msgstr ""
msgid "Output plugin"
msgstr "Output plugin"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -343,9 +350,6 @@ msgstr "Configurar Accesos Rápidos"
msgid "Configure library..."
msgstr "Configurar colección..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copiar a la colección..."
@ -999,6 +1003,9 @@ msgstr "Opciones de salida"
msgid "Output plugin"
msgstr "Extensión de salida"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Fiesta"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Kirjaston asetukset"
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Kopioi kirjastoon"
@ -986,6 +990,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -342,9 +349,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Configurer votre bibliothèque..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copier dans la bilbiothèque..."
@ -994,6 +998,9 @@ msgstr ""
msgid "Output plugin"
msgstr "Module de sortie"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Soirée"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Configurar a biblioteca..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copiar para a biblioteca"
@ -988,6 +992,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Festa"

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -342,9 +349,6 @@ msgstr "Configura scorciatoie"
msgid "Configure library..."
msgstr "Configura raccolta..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copia nella raccolta..."
@ -997,6 +1001,9 @@ msgstr "Opzioni di uscita"
msgid "Output plugin"
msgstr "Plugin di uscita"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Festa"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -988,6 +992,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Sett opp bibliotek..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Kopier til bibliotek..."
@ -989,6 +993,9 @@ msgstr ""
msgid "Output plugin"
msgstr "Lydavspillingstillegg"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Fest"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Configurar los acorchis de clavièr"
msgid "Configure library..."
msgstr ""
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -986,6 +990,9 @@ msgstr "Opcions de creacion"
msgid "Output plugin"
msgstr "Modul de sortida"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Fèsta"

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -342,9 +349,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Konfiguruj bibliotekę..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Skopiuj do biblioteki..."
@ -988,6 +992,9 @@ msgstr ""
msgid "Output plugin"
msgstr "Wtyczka wyjściowa"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Configurar Atalhos"
msgid "Configure library..."
msgstr "Configurar biblioteca..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copiar para a biblioteca..."
@ -993,6 +997,9 @@ msgstr "Opções de saída"
msgid "Output plugin"
msgstr "Plugin de saída"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Festa"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Configurar Atalhos"
msgid "Configure library..."
msgstr "Configurar biblioteca"
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copiar para biblioteca..."
@ -995,6 +999,9 @@ msgstr "Opções de Saída"
msgid "Output plugin"
msgstr "Plugin de saída"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Festa"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "Configurează biblioteca..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Copiază în bibliotecă..."
@ -987,6 +991,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Petrecere"

View File

@ -81,6 +81,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -340,9 +347,6 @@ msgstr "Настройка горячих клавиш"
msgid "Configure library..."
msgstr "Настроить коллекцию..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Копировать в коллекцию..."
@ -992,6 +996,9 @@ msgstr "Опции вывода"
msgid "Output plugin"
msgstr "Плагин вывода"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -83,6 +83,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -342,9 +349,6 @@ msgstr "Nastaviť skratky"
msgid "Configure library..."
msgstr "Nastaviť zbierku..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Skopírovať do zbierky..."
@ -993,6 +997,9 @@ msgstr "Možnosti výstupu"
msgid "Output plugin"
msgstr "plugin výstupu"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Party"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Anpassa genvägar"
msgid "Configure library..."
msgstr "Ställ in bibliotek..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Kopiera till bibliotek..."
@ -991,6 +995,9 @@ msgstr "Utdataalternativ"
msgid "Output plugin"
msgstr "Insticksprogram för utmatning"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Fest"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Kısayolları Yapılandır"
msgid "Configure library..."
msgstr "Kütüphaneyi düzenle..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -988,6 +992,9 @@ msgstr "Çıktı seçenekleri"
msgid "Output plugin"
msgstr "Çıktı eklentisi"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Parti"

View File

@ -73,6 +73,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -332,9 +339,6 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -977,6 +981,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr "AIFF"
@ -341,9 +348,6 @@ msgstr "Налаштування комбінацій клавіш"
msgid "Configure library..."
msgstr "Налаштувати фонотеку"
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr "Скопіювати до фонотеки..."
@ -993,6 +997,9 @@ msgstr "Параметри виведення"
msgid "Output plugin"
msgstr "Модуль виводу"
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr "Вечірка"

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr "配置乐库..."
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -986,6 +990,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -82,6 +82,13 @@ msgstr ""
msgid "128k MP3"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
"<p>If you surround sections of text that contain a token with curly-braces, "
"that section will be hidden if the token is empty.</p>"
msgstr ""
msgid "AIFF"
msgstr ""
@ -341,9 +348,6 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Copy to"
msgstr ""
msgid "Copy to library..."
msgstr ""
@ -986,6 +990,9 @@ msgstr ""
msgid "Output plugin"
msgstr ""
msgid "Overwrite files"
msgstr ""
msgid "Party"
msgstr ""

View File

@ -28,6 +28,7 @@
#include "engines/enginebase.h"
#include "library/groupbydialog.h"
#include "library/libraryconfig.h"
#include "library/librarydirectorymodel.h"
#include "library/library.h"
#include "playlist/playlistbackend.h"
#include "playlist/playlist.h"
@ -185,6 +186,8 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
ui_->radio_view->SetModel(radio_model_);
organise_dialog_->AddDirectoryModel(library_->model()->directory_model());
cover_manager_->Init();
// Icons

View File

@ -19,17 +19,21 @@
#include <QDir>
#include <QMenu>
#include <QPushButton>
#include <QSettings>
#include <QSignalMapper>
const int OrganiseDialog::kNumberOfPreviews = 5;
const char* OrganiseDialog::kDefaultFormat =
"%artist/%album{ (Disc %disc)}/{%track - }%title.%extension";
const char* OrganiseDialog::kSettingsGroup = "OrganiseDialog";
OrganiseDialog::OrganiseDialog(QWidget *parent)
: QDialog(parent),
ui_(new Ui_OrganiseDialog)
{
ui_->setupUi(this);
connect(ui_->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(Reset()));
// Valid tags
QMap<QString, QString> tags;
@ -72,15 +76,18 @@ OrganiseDialog::OrganiseDialog(QWidget *parent)
connect(tag_mapper, SIGNAL(mapped(QString)), SLOT(InsertTag(QString)));
ui_->insert->setMenu(tag_menu);
// Load settings
ui_->naming->setPlainText(kDefaultFormat);
}
OrganiseDialog::~OrganiseDialog() {
delete ui_;
}
void OrganiseDialog::AddDirectoryModel(QAbstractItemModel *model) {
// TODO: Add this model to a proxy model that merges different models
// together, eg. from the local library and also removable devices.
ui_->destination->setModel(model);
}
void OrganiseDialog::SetUrls(const QList<QUrl> &urls) {
QStringList filenames;
foreach (const QUrl& url, urls) {
@ -117,7 +124,10 @@ void OrganiseDialog::UpdatePreviews() {
format_.set_replace_spaces(ui_->replace_spaces->isChecked());
format_.set_replace_the(ui_->replace_the->isChecked());
if (!format_.IsValid())
const bool format_valid = format_.IsValid();
ui_->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
format_valid && !ui_->destination->currentText().isEmpty());
if (!format_valid)
return;
ui_->preview->clear();
@ -126,3 +136,33 @@ void OrganiseDialog::UpdatePreviews() {
ui_->preview->addItem(QDir::toNativeSeparators(filename));
}
}
void OrganiseDialog::Reset() {
ui_->naming->setPlainText(kDefaultFormat);
ui_->replace_ascii->setChecked(false);
ui_->replace_spaces->setChecked(false);
ui_->replace_the->setChecked(false);
ui_->overwrite->setChecked(true);
}
void OrganiseDialog::showEvent(QShowEvent *) {
QSettings s;
s.beginGroup(kSettingsGroup);
ui_->naming->setPlainText(s.value("format", kDefaultFormat).toString());
ui_->replace_ascii->setChecked(s.value("replace_ascii", false).toBool());
ui_->replace_spaces->setChecked(s.value("replace_spaces", false).toBool());
ui_->replace_the->setChecked(s.value("replace_the", false).toBool());
ui_->overwrite->setChecked(s.value("overwrite", true).toBool());
}
void OrganiseDialog::accept() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("format", ui_->naming->toPlainText());
s.setValue("replace_ascii", ui_->replace_ascii->isChecked());
s.setValue("replace_spaces", ui_->replace_spaces->isChecked());
s.setValue("replace_the", ui_->replace_the->isChecked());
s.setValue("overwrite", ui_->overwrite->isChecked());
QDialog::accept();
}

View File

@ -26,6 +26,8 @@
class Ui_OrganiseDialog;
class QAbstractItemModel;
class OrganiseDialog : public QDialog {
Q_OBJECT
@ -35,13 +37,24 @@ public:
static const int kNumberOfPreviews;
static const char* kDefaultFormat;
static const char* kSettingsGroup;
void AddDirectoryModel(QAbstractItemModel* model);
void SetUrls(const QList<QUrl>& urls);
void SetFilenames(const QStringList& filenames);
bool IsFormatValid() const;
public slots:
void accept();
protected:
void showEvent(QShowEvent *);
private slots:
void Reset();
void InsertTag(const QString& tag);
void UpdatePreviews();

View File

@ -22,7 +22,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Copy to</string>
<string>Destination</string>
</property>
</widget>
</item>
@ -40,11 +40,10 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="LineTextEdit" name="naming">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="toolTip">
<string>&lt;p&gt;Tokens start with %, for example: %artist %album %title &lt;/p&gt;
&lt;p&gt;If you surround sections of text that contain a token with curly-braces, that section will be hidden if the token is empty.&lt;/p&gt;</string>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
@ -93,6 +92,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="overwrite">
<property name="text">
<string>Overwrite files</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -116,7 +122,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>