Permalink
Browse files

RELEASE 1.12

  • Loading branch information...
1 parent e1121eb commit c2b48f22cdf42623fcfa48b84bf983f4e3a3b4bf Samu Juvonen committed Jun 19, 2012
View
@@ -1,11 +1,17 @@
-git
+1.12
- Allow renaming directories in the directory tree.
- Allow to resize the main window to be very small.
- Fix random infinite loop when saving changes to files.
- Highlight changed fields in tag editor.
- Tool windows have always-on-top flag set.
- Conditionally enable inline editing of tags.
- Fixed an issue with the caret jumping to the end when editing a value from the middle.
+- Added tooltips on apply-to-all buttons.
+- Restored Ctrl+A shortcut for "select all tracks" button.
+- "Select all" and "invert selection" buttons now use icons from the desktop's icon theme.
+- Ability to automaticly generate track numbers for files.
+- Statusbar now displays the number of found files.
+- Fixed "Revert changes" button.
1.11
- Fixed toolbar button default size and style.
@@ -5,6 +5,8 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
+#include <QSettings>
+#include <QSignalMapper>
#include <QThread>
#include <QUrl>
@@ -17,8 +19,7 @@
volatile bool abortAction = false;
MetaDataModel2::MetaDataModel2(QObject * parent)
-: QAbstractItemModel(parent), _networkManager(0), _recursive(false), _locked(false),
- _editInline(false) {
+: QAbstractItemModel(parent), _networkManager(0), _recursive(false), _locked(false) {
_fields.insert(MetaData::TitleField, tr("Title"));
_fields.insert(MetaData::ArtistField, tr("Artist"));
@@ -302,14 +303,15 @@ QModelIndex MetaDataModel2::parent(const QModelIndex & idx) const {
Qt::ItemFlags MetaDataModel2::flags(const QModelIndex & idx) const {
Qt::ItemFlags flags = QAbstractItemModel::flags(idx);
+ bool editInline = QSettings().value("EditTagsInline").toBool();
// Allow drops on invalid indices too so that we can drop items on empty
// views aswell.
if (!idx.parent().isValid() || idx.column() == MetaData::PicturesField) {
flags |= Qt::ItemIsDropEnabled;
}
- if (_editInline && !idx.parent().isValid() && idx.column() != MetaData::PicturesField) {
+ if (editInline && !idx.parent().isValid() && idx.column() != MetaData::PicturesField) {
flags |= Qt::ItemIsEditable;
}
@@ -406,16 +408,18 @@ void MetaDataModel2::readDirectory(const QString & dir) {
QThread * thread = new QThread(this);
scanner->moveToThread(thread);
+// connectMappers(scanner, FindMediaAction);
+
connect(scanner, SIGNAL(itemFound(MetaData)), SLOT(add(MetaData)));
- connect(scanner, SIGNAL(finished()), SIGNAL(actionFinished()));
connect(scanner, SIGNAL(started()), SIGNAL(actionStarted()));
+ connect(scanner, SIGNAL(finished()), SIGNAL(actionFinished()));
connect(scanner, SIGNAL(progress(int)), SIGNAL(actionProgress(int)));
connect(scanner, SIGNAL(maximumChanged(int)), SIGNAL(actionMaximumChanged(int)));
connect(scanner, SIGNAL(finished()), scanner, SLOT(deleteLater()));
connect(scanner, SIGNAL(finished()), thread, SLOT(quit()));
- connect(scanner, SIGNAL(finished()), thread, SLOT(deleteLater()));
+ connect(scanner, SIGNAL(destroyed()), thread, SLOT(deleteLater()));
connect(thread, SIGNAL(started()), scanner, SLOT(scan()));
@@ -427,7 +431,15 @@ void MetaDataModel2::reload() {
}
void MetaDataModel2::restore() {
-
+
+ for (int i = 0; i < rowCount(); i++) {
+ if (_original.at(i).null() == false) {
+ _data.replace(i, _original.at(i));
+ _original.replace(i, MetaData());
+ }
+ }
+
+ emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void MetaDataModel2::save() {
@@ -457,6 +469,8 @@ void MetaDataModel2::save() {
writer->moveToThread(thread);
writer->setQueue(changed);
+// connectMappers(writer, WriteTagsAction);
+
connect(writer, SIGNAL(started()), SIGNAL(actionStarted()));
connect(writer, SIGNAL(finished()), SIGNAL(actionFinished()));
connect(writer, SIGNAL(progress(int)), SIGNAL(actionProgress(int)));
@@ -483,12 +497,29 @@ void MetaDataModel2::backup(int row) {
emit metaDataStateChanged(true);
}
+void MetaDataModel2::connectMappers(QObject * object, int actionType) {
+ QSignalMapper * startMapper = new QSignalMapper();
+ startMapper->setMapping(object, actionType);
+
+ QSignalMapper * finishMapper = new QSignalMapper();
+ finishMapper->setMapping(object, actionType);
+
+// connect(startMapper, SIGNAL(mapped(int)), SIGNAL(actionStarted(int)));
+// connect(finishMapper, SIGNAL(mapped(int)), SIGNAL(actionFinished(int)));
+
+ connect(object, SIGNAL(started()), startMapper, SLOT(map()));
+ connect(object, SIGNAL(finished()), finishMapper, SLOT(map()));
+
+ connect(object, SIGNAL(finished()), startMapper, SLOT(deleteLater()));
+ connect(object, SIGNAL(finished()), finishMapper, SLOT(deleteLater()));
+}
+
QImage MetaDataModel2::downloadImage(const QUrl & url) {
QNetworkReply * reply = _networkManager->get(QNetworkRequest(url));
- emit actionStarted();
+// emit actionStarted();
- connect(reply, SIGNAL(finished()), SIGNAL(actionFinished()));
+// connect(reply, SIGNAL(finished()), SIGNAL(actionFinished()));
connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
SLOT(networkActionProgressChanged(qint64, qint64)));
@@ -19,6 +19,7 @@ class MetaDataModel2 : public QAbstractItemModel {
public:
enum DataRole { FieldTypeRole = Qt::UserRole + 1, FieldChangedRole = Qt::UserRole + 2 };
+ enum ActionType { FindMediaAction, WriteTagsAction };
MetaDataModel2(QObject * parent=0);
@@ -27,9 +28,6 @@ class MetaDataModel2 : public QAbstractItemModel {
bool recursive() const { return _recursive; }
QString directory() const { return _directory; }
- void setInlineEdit(bool state) { _editInline = state; }
- bool inlineEdit() const { return _editInline; }
-
MetaData metaData(int row) const;
bool addImage(int row, const MetaDataImage & image);
@@ -94,6 +92,7 @@ class MetaDataModel2 : public QAbstractItemModel {
private:
void backup(int row);
+ void connectMappers(QObject * object, int actionType);
QImage downloadImage(const QUrl & url);
@@ -108,7 +107,6 @@ class MetaDataModel2 : public QAbstractItemModel {
bool _recursive;
bool _locked;
- bool _editInline;
volatile bool _abortAction;
};
View
@@ -30,6 +30,11 @@ EditorWidget::EditorWidget(QWidget * parent)
_ui->exportImage->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
+ _ui->autoNumbers->setIcon(QIcon::fromTheme(
+ "view-sort-ascending",
+ style()->standardPixmap(QStyle::SP_ArrowDown)
+ ));
+
_mapper = new QDataWidgetMapper(this);
_mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
@@ -82,9 +87,6 @@ EditorWidget::EditorWidget(QWidget * parent)
foreach (QRadioButton * button, findChildren<QRadioButton*>())
connect(button, SIGNAL(clicked()), radioMapper, SLOT(map()));
-// foreach (QLineEdit * input, findChildren<QLineEdit*>())
-// connect(input, SIGNAL(textEdited(QString)), _mapper, SLOT(submit()));
-
foreach (QLineEdit * input, findChildren<QLineEdit*>())
connect(input, SIGNAL(textEdited(QString)), this, SLOT(submitChanges()));
@@ -130,6 +132,7 @@ void EditorWidget::setModel(QAbstractItemModel * model) {
_mapper2->addMapping(_ui->labelUrl, MetaData::UrlField);
_mapper2->addMapping(_ui->labelDisc, MetaData::DiscNumberField);
_mapper2->addMapping(_ui->labelNumber, MetaData::NumberField);
+ _mapper2->addMapping(_ui->labelMaxNumber, MetaData::MaxNumberField);
_mapper2->addMapping(_ui->labelYear, MetaData::YearField);
_mapper2->addMapping(_ui->labelOriginalArtist, MetaData::OriginalArtistField);
_mapper2->addMapping(_ui->labelComposer, MetaData::ComposerField);
@@ -192,6 +195,18 @@ void EditorWidget::setSelection(const QItemSelection & selection) {
* PRIVATE SLOTS
**/
+void EditorWidget::automaticNumbering() {
+ int total = model()->rowCount();
+
+ for (int i = 0; i < total; i++) {
+ const QModelIndex numberIdx = model()->index(i, MetaData::NumberField);
+ const QModelIndex maxNumberIdx = model()->index(i, MetaData::MaxNumberField);
+
+ model()->setData(numberIdx, i+1);
+ model()->setData(maxNumberIdx, total);
+ }
+}
+
void EditorWidget::copyField(int field) {
if (!model() || rows().isEmpty() || rows().value(0).isValid() == false)
return;
View
@@ -28,6 +28,7 @@ class EditorWidget : public DataWidget {
void setSelection(const QItemSelection & selection);
private slots:
+ void automaticNumbering();
void copyField(int field);
void displayImageProperties(const QModelIndex & idx);
void setImageDescription(const QString & text);
View
@@ -28,6 +28,17 @@ MainWindow::MainWindow(MetaDataModel * model, QWidget * parent)
_ui = new Ui::MainWindow();
_ui->setupUi(this);
+ const QIcon selectAll = QIcon::fromTheme("edit-select-all");
+ const QIcon invertSelection = QIcon::fromTheme("object-rotate-left");
+
+ if (!selectAll.isNull()) {
+ _ui->actionSelect_all->setIcon(selectAll);
+ }
+
+ if (!invertSelection.isNull()) {
+ _ui->actionSelect_inverse->setIcon(invertSelection);
+ }
+
QSortFilterProxyModel * proxy = new QSortFilterProxyModel(this);
proxy->setDynamicSortFilter(true);
@@ -62,6 +73,11 @@ MainWindow::MainWindow(MetaDataModel * model, QWidget * parent)
_ui->items->horizontalHeader()->sortIndicatorOrder()
);
+ _statusMessage = new QLabel(this);
+ _statusMessage->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ _statusMessage->setMaximumWidth(200);
+ statusBar()->addPermanentWidget(_statusMessage, 1);
+
setupBookmarkMenu();
setupToolBar();
@@ -476,8 +492,6 @@ void MainWindow::showSettingsDialog() {
SettingsDialog d(this);
d.setBackend(&s);
d.exec();
-
- _model->setInlineEdit(QSettings().value("EditTagsInline").toBool());
}
void MainWindow::showHeaderContextMenu(const QPoint & pos) {
@@ -513,6 +527,8 @@ void MainWindow::afterModelAction() {
_ui->actionReloadOrAbort->setIcon(style()->standardIcon(QStyle::SP_BrowserReload));
_ui->actionReloadOrAbort->setText(tr("Reload"));
+ _statusMessage->setText(tr("%1 files").arg(_model->rowCount()));
+
/*
if (QSortFilterProxyModel * p = qobject_cast<QSortFilterProxyModel*>(_ui->items->model()))
p->setDynamicSortFilter(false);
@@ -615,6 +631,7 @@ void MainWindow::setMetaDataModel(MetaDataModel * model) {
connect(_ui->actionReset, SIGNAL(triggered()),
model, SLOT(restore()));
+
connect(_ui->actionReloadOrAbort, SIGNAL(triggered()),
model, SLOT(reload()));
View
@@ -3,6 +3,7 @@
#include <QMainWindow>
+class QLabel;
class QNetworkAccessManager;
class BookmarkModel;
@@ -81,6 +82,7 @@ class MainWindow : public QMainWindow {
Ui::MainWindow * _ui;
+ QLabel * _statusMessage;
QNetworkAccessManager * _networkManager;
BookmarkModel * _bookmarks;
@@ -90,4 +92,4 @@ class MainWindow : public QMainWindow {
};
-#endif
+#endif
Oops, something went wrong.

0 comments on commit c2b48f2

Please sign in to comment.