moved parts of the MainWindow class to new TagEditorWidget class
This commit is contained in:
parent
010f47a6c6
commit
f8cfb3ec14
|
@ -56,6 +56,7 @@ set(WIDGETS_HEADER_FILES
|
|||
gui/settingsdialog.h
|
||||
gui/tagedit.h
|
||||
gui/tagfieldedit.h
|
||||
gui/tageditorwidget.h
|
||||
renamingutility/filesystemitem.h
|
||||
renamingutility/filesystemitemmodel.h
|
||||
renamingutility/filteredfilesystemitemmodel.h
|
||||
|
@ -82,6 +83,7 @@ set(WIDGETS_SRC_FILES
|
|||
gui/settingsdialog.cpp
|
||||
gui/tagedit.cpp
|
||||
gui/tagfieldedit.cpp
|
||||
gui/tageditorwidget.cpp
|
||||
renamingutility/filesystemitem.cpp
|
||||
renamingutility/filesystemitemmodel.cpp
|
||||
renamingutility/filteredfilesystemitemmodel.cpp
|
||||
|
@ -106,6 +108,7 @@ set(WIDGETS_UI_FILES
|
|||
gui/attachmentsedit.ui
|
||||
gui/editortempoptionpage.ui
|
||||
gui/filelayout.ui
|
||||
gui/tageditorwidget.ui
|
||||
)
|
||||
#set(QUICK_HEADER_FILES
|
||||
#)
|
||||
|
|
|
@ -37,7 +37,7 @@ int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs,
|
|||
MainWindow w;
|
||||
w.show();
|
||||
if(!path.isEmpty()) {
|
||||
w.startParsing(path, true);
|
||||
w.startParsing(path);
|
||||
}
|
||||
res = a.exec();
|
||||
}
|
||||
|
|
1337
gui/mainwindow.cpp
1337
gui/mainwindow.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
#ifndef TAGEDITORDIALOG_H
|
||||
#define TAGEDITORDIALOG_H
|
||||
#ifndef TAGEDITORMAINWINDOW_H
|
||||
#define TAGEDITORMAINWINDOW_H
|
||||
|
||||
#include "./filefilterproxymodel.h"
|
||||
#include "./previousvaluehandling.h"
|
||||
|
@ -10,26 +10,10 @@
|
|||
#include <QMainWindow>
|
||||
#include <QByteArray>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
|
||||
#ifdef TAGEDITOR_USE_WEBENGINE
|
||||
# define WEB_VIEW_PROVIDER QWebEngineView
|
||||
#else
|
||||
# define WEB_VIEW_PROVIDER QWebView
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
class QPlainTextEdit;
|
||||
class QGraphicsScene;
|
||||
class QFileSystemModel;
|
||||
class QFileSystemWatcher;
|
||||
class WEB_VIEW_PROVIDER;
|
||||
QT_END_NAMESPACE
|
||||
QT_FORWARD_DECLARE_CLASS(QFileSystemModel)
|
||||
QT_FORWARD_DECLARE_CLASS(QItemSelectionModel)
|
||||
|
||||
namespace Media {
|
||||
DECLARE_ENUM(TagType, unsigned int)
|
||||
|
@ -46,7 +30,7 @@ namespace Ui {
|
|||
class MainWindow;
|
||||
}
|
||||
|
||||
class TagEdit;
|
||||
class TagEditorWidget;
|
||||
class RenameFilesDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
|
@ -60,93 +44,47 @@ public:
|
|||
// file browser
|
||||
QString currentDirectory();
|
||||
void setCurrentDirectory(const QString &path);
|
||||
|
||||
public slots:
|
||||
// opened file: load, save, delete, close
|
||||
bool startParsing(const QString &path, bool forceRefresh = false);
|
||||
bool reparseFile();
|
||||
bool applyEntriesAndSaveChangings();
|
||||
bool deleteAllTagsAndSave();
|
||||
void closeFile();
|
||||
void startParsing(const QString &path);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
private slots:
|
||||
// file selection
|
||||
void pathEntered();
|
||||
void fileSelected();
|
||||
void saveAndShowNextFile();
|
||||
void selectNextFile();
|
||||
void selectNextFile(QItemSelectionModel *selectionModel, const QModelIndex ¤tIndex, bool notDeeper);
|
||||
void showNextFileNotFound();
|
||||
void showOpenFileDlg();
|
||||
|
||||
// editor
|
||||
void fileChangedOnDisk(const QString &path);
|
||||
void showFile(char result);
|
||||
void saveFileInformation();
|
||||
void handleReturnPressed();
|
||||
void handleKeepPreviousValuesActionTriggered(QAction *action);
|
||||
void applySettingsFromDialog();
|
||||
void addTag(const std::function<Media::Tag *(Media::MediaFileInfo &)> &createTag);
|
||||
void removeTag(Media::Tag *tag);
|
||||
void changeTarget(Media::Tag *tag);
|
||||
void handleFileStatusChange(bool opened, bool hasTag);
|
||||
void handleFileSaved(const QString ¤tPath);
|
||||
|
||||
// saving
|
||||
bool startSaving();
|
||||
void showSavingResult(bool processingError, bool ioError);
|
||||
// settings
|
||||
void showSettingsDlg();
|
||||
void applySettingsFromDialog();
|
||||
|
||||
// misc
|
||||
void showAboutDlg();
|
||||
void showSettingsDlg();
|
||||
void showRenameFilesDlg();
|
||||
void updateInfoWebView();
|
||||
void showInfoWebViewContextMenu(const QPoint &);
|
||||
void copyInfoWebViewSelection();
|
||||
void spawnExternalPlayer();
|
||||
|
||||
private:
|
||||
void updateDocumentTitleEdits();
|
||||
void updateTagEditsAndAttachmentEdits(bool updateUi = true, PreviousValueHandling previousValueHandling = PreviousValueHandling::Auto);
|
||||
void updateTagSelectionComboBox();
|
||||
void updateUiStatus();
|
||||
void updateTagManagementMenu();
|
||||
void insertTitleFromFilename();
|
||||
void foreachTagEdit(const std::function<void (TagEdit *)> &function);
|
||||
bool confirmCreationOfId3TagForUnsupportedFile();
|
||||
std::mutex &fileOperationMutex();
|
||||
Media::MediaFileInfo &fileInfo();
|
||||
|
||||
// UI
|
||||
std::unique_ptr<Ui::MainWindow> m_ui;
|
||||
QMenu *m_keepPreviousValuesMenu;
|
||||
QMenu *m_tagOptionsMenu;
|
||||
QMenu *m_addTagMenu;
|
||||
QMenu *m_removeTagMenu;
|
||||
QMenu *m_changeTargetMenu;
|
||||
WEB_VIEW_PROVIDER *m_infoWebView;
|
||||
// models
|
||||
QFileSystemModel *m_fileModel;
|
||||
FileFilterProxyModel *m_fileFilterModel;
|
||||
// tag, file, directory management
|
||||
QString m_currentPath;
|
||||
QString m_currentDir; // this is the actual direcotry of the opened file and may differ from the directory selected in the tree view
|
||||
QString m_lastDir;
|
||||
QFileSystemWatcher *m_fileWatcher;
|
||||
bool m_fileChangedOnDisk;
|
||||
Media::MediaFileInfo m_fileInfo;
|
||||
QString m_nextFilePath;
|
||||
std::vector<Media::Tag *> m_tags;
|
||||
QByteArray m_fileInfoHtml;
|
||||
// dialogs
|
||||
Dialogs::AboutDialog *m_aboutDlg;
|
||||
Dialogs::SettingsDialog *m_settingsDlg;
|
||||
std::unique_ptr<RenameFilesDialog> m_renameFilesDlg;
|
||||
// status
|
||||
bool m_makingResultsAvailable;
|
||||
Media::NotificationList m_originalNotifications;
|
||||
bool m_abortClicked;
|
||||
std::mutex m_fileOperationMutex;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TAGEDITORDIALOG_H
|
||||
#endif // TAGEDITORMAINWINDOW_H
|
||||
|
|
|
@ -72,261 +72,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="rightWidget" native="true">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No file selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="NotificationLabel" name="parsingNotificationWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="tagSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="tagEditVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="docTitleWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="docTitleLabel">
|
||||
<property name="text">
|
||||
<string>Document title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="tagSelectionHorizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="tagSelectionComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="keepPreviousValuesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Let you choose whether the values of the
|
||||
previously opened file should be cleared when
|
||||
opening the next file.
|
||||
Keeping these values might be useful when
|
||||
tagging multiple files of the same album.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Keep previous values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="tagOptionsPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Let you enable or disable the automatic
|
||||
creation or removal of tags (according to
|
||||
the settings) when loading a file.
|
||||
|
||||
You can also create or remove tags manually.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tag management</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restoreEntriesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Restores the original values read from
|
||||
the file reverting all unsaved changings.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restore</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-revert">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearEntriesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Clears all values.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-clear">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="NotificationLabel" name="makingNotificationWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="abortButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Aborts the saving process. The tageditor will try to restore the original file from the backup.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abort</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="process-stop">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="buttonsWidget" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCommandLinkButton" name="saveButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>all entered values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCommandLinkButton" name="deleteTagsButton">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>all tags from the file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCommandLinkButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Open next file</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>and save current before</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCommandLinkButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>the file and discard changings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="TagEditorWidget" name="tagEditorWidget"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -521,42 +267,6 @@ the file reverting all unsaved changings.</string>
|
|||
<string>F8</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKeep_previous_values_never">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No, disable this feature</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKeep_previous_values_within_same_dir">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yes, but only if both files are in the same directory</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKeep_previous_values_always">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yes, regardless where the files are stored</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionManage_tags_automatically_when_loading_file">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="autocorrection">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage tags automatically when loading file</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReload">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -595,16 +305,14 @@ the file reverting all unsaved changings.</string>
|
|||
<header>gui/pathlineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>NotificationLabel</class>
|
||||
<class>TagEditorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/notificationlabel.h</header>
|
||||
<container>1</container>
|
||||
<header>gui/tageditorwidget.h</header>
|
||||
<container>0</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>filesTreeView</tabstop>
|
||||
<tabstop>saveButton</tabstop>
|
||||
<tabstop>deleteTagsButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../resources/icons.qrc"/>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,187 @@
|
|||
#ifndef TAGEDITORWIDGET_H
|
||||
#define TAGEDITORWIDGET_H
|
||||
|
||||
#include "./previousvaluehandling.h"
|
||||
|
||||
#include <tagparser/mediafileinfo.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
|
||||
#if defined(TAGEDITOR_NO_WEBVIEW)
|
||||
# error "not supported (yet)."
|
||||
#elif defined(TAGEDITOR_USE_WEBENGINE)
|
||||
# define WEB_VIEW_PROVIDER QWebEngineView
|
||||
#else
|
||||
# define WEB_VIEW_PROVIDER QWebView
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
|
||||
QT_FORWARD_DECLARE_CLASS(QMenu)
|
||||
#ifndef TAGEDITOR_NO_WEBVIEW
|
||||
QT_FORWARD_DECLARE_CLASS(WEB_VIEW_PROVIDER)
|
||||
#endif
|
||||
|
||||
namespace Media {
|
||||
DECLARE_ENUM(TagType, unsigned int)
|
||||
}
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
namespace Ui {
|
||||
class TagEditorWidget;
|
||||
}
|
||||
|
||||
class TagEdit;
|
||||
|
||||
class TagEditorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString currentPath READ currentPath)
|
||||
Q_PROPERTY(QByteArray fileInfoHtml READ fileInfoHtml)
|
||||
Q_PROPERTY(bool fileNameVisible READ isFileNameVisible WRITE setFileNameVisible)
|
||||
Q_PROPERTY(bool buttonsVisible READ areButtonsVisible WRITE setButtonVisible)
|
||||
|
||||
public:
|
||||
explicit TagEditorWidget(QWidget *parent = nullptr);
|
||||
virtual ~TagEditorWidget();
|
||||
|
||||
public:
|
||||
std::mutex &fileOperationMutex();
|
||||
const QString ¤tPath() const;
|
||||
Media::MediaFileInfo &fileInfo();
|
||||
const QByteArray &fileInfoHtml() const;
|
||||
bool isFileNameVisible() const;
|
||||
void setFileNameVisible(bool visible);
|
||||
bool areButtonsVisible() const;
|
||||
void setButtonVisible(bool visible);
|
||||
|
||||
public slots:
|
||||
// operations with the currently opened file: load, save, delete, close
|
||||
bool startParsing(const QString &path, bool forceRefresh = false);
|
||||
bool startSaving();
|
||||
void saveAndShowNextFile();
|
||||
bool reparseFile();
|
||||
bool applyEntriesAndSaveChangings();
|
||||
bool deleteAllTagsAndSave();
|
||||
void closeFile();
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief Emitted when loading the next file has been triggered.
|
||||
*/
|
||||
void nextFileSelected();
|
||||
|
||||
/*!
|
||||
* \brief Emitted to show a status message.
|
||||
*/
|
||||
void statusMessage(const QString &message, int timeout = 0);
|
||||
|
||||
/*!
|
||||
* \brief Emmited when the file status (opened/closed) has changed.
|
||||
*/
|
||||
void fileStatusChange(bool opened, bool hasTag);
|
||||
|
||||
/*!
|
||||
* \brief Emitted when the current path changed.
|
||||
*/
|
||||
void fileSaved(const QString &newPath);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
||||
private slots:
|
||||
// editor
|
||||
void fileChangedOnDisk(const QString &path);
|
||||
void showFile(char result);
|
||||
void handleReturnPressed();
|
||||
void handleKeepPreviousValuesActionTriggered(QAction *action);
|
||||
void applySettingsFromDialog();
|
||||
void addTag(const std::function<Media::Tag *(Media::MediaFileInfo &)> &createTag);
|
||||
void removeTag(Media::Tag *tag);
|
||||
void changeTarget(Media::Tag *tag);
|
||||
|
||||
// saving
|
||||
void showSavingResult(bool processingError, bool ioError);
|
||||
|
||||
// web view
|
||||
void updateInfoWebView();
|
||||
void showInfoWebViewContextMenu(const QPoint &);
|
||||
void copyInfoWebViewSelection();
|
||||
|
||||
private:
|
||||
void updateDocumentTitleEdits();
|
||||
void updateTagEditsAndAttachmentEdits(bool updateUi = true, PreviousValueHandling previousValueHandling = PreviousValueHandling::Auto);
|
||||
void updateTagSelectionComboBox();
|
||||
void updateFileStatusStatus();
|
||||
void updateTagManagementMenu();
|
||||
void insertTitleFromFilename();
|
||||
void foreachTagEdit(const std::function<void (TagEdit *)> &function);
|
||||
bool confirmCreationOfId3TagForUnsupportedFile();
|
||||
|
||||
// UI
|
||||
std::unique_ptr<Ui::TagEditorWidget> m_ui;
|
||||
QMenu *m_keepPreviousValuesMenu;
|
||||
QMenu *m_tagOptionsMenu;
|
||||
QMenu *m_addTagMenu;
|
||||
QMenu *m_removeTagMenu;
|
||||
QMenu *m_changeTargetMenu;
|
||||
WEB_VIEW_PROVIDER *m_infoWebView;
|
||||
// tag, file, directory management
|
||||
QString m_currentPath;
|
||||
QFileSystemWatcher *m_fileWatcher;
|
||||
bool m_fileChangedOnDisk;
|
||||
Media::MediaFileInfo m_fileInfo;
|
||||
std::vector<Media::Tag *> m_tags;
|
||||
QByteArray m_fileInfoHtml;
|
||||
/*!
|
||||
* \brief This is the actual direcotry of the opened file which may differ from the directory selected in the tree view of the main window.
|
||||
*/
|
||||
QString m_currentDir;
|
||||
QString m_lastDir;
|
||||
// status
|
||||
bool m_nextFileAfterSaving;
|
||||
bool m_makingResultsAvailable;
|
||||
Media::NotificationList m_originalNotifications;
|
||||
bool m_abortClicked;
|
||||
std::mutex m_fileOperationMutex;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Returns the mutex which is internally used for thread-synchronization.
|
||||
*/
|
||||
inline std::mutex &TagEditorWidget::fileOperationMutex()
|
||||
{
|
||||
return m_fileOperationMutex;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the current path.
|
||||
*/
|
||||
inline const QString &TagEditorWidget::currentPath() const
|
||||
{
|
||||
return m_currentPath;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return file info.
|
||||
*/
|
||||
inline Media::MediaFileInfo &TagEditorWidget::fileInfo()
|
||||
{
|
||||
return m_fileInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the HTML source of the info website.
|
||||
*/
|
||||
inline const QByteArray &TagEditorWidget::fileInfoHtml() const
|
||||
{
|
||||
return m_fileInfoHtml;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // TAGEDITORWIDGET_H
|
|
@ -0,0 +1,305 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QtGui::TagEditorWidget</class>
|
||||
<widget class="QWidget" name="QtGui::TagEditorWidget">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="tagEditorWidgetVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No file selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="NotificationLabel" name="parsingNotificationWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="tagSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="tagEditVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="docTitleWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="docTitleLabel">
|
||||
<property name="text">
|
||||
<string>Document title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="tagSelectionHorizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="tagSelectionComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="keepPreviousValuesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Let you choose whether the values of the
|
||||
previously opened file should be cleared when
|
||||
opening the next file.
|
||||
Keeping these values might be useful when
|
||||
tagging multiple files of the same album.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Keep previous values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="tagOptionsPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Let you enable or disable the automatic
|
||||
creation or removal of tags (according to
|
||||
the settings) when loading a file.
|
||||
|
||||
You can also create or remove tags manually.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tag management</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restoreEntriesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Restores the original values read from
|
||||
the file reverting all unsaved changings.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restore</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-revert">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearEntriesPushButton">
|
||||
<property name="toolTip">
|
||||
<string>Clears all values.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-clear">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="NotificationLabel" name="makingNotificationWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="abortButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Aborts the saving process. The tageditor will try to restore the original file from the backup.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abort</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="process-stop">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="buttonsWidget" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCommandLinkButton" name="saveButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>all entered values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCommandLinkButton" name="deleteTagsButton">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>all tags from the file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCommandLinkButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Open next file</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>and save current before</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCommandLinkButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>the file and discard changings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionKeep_previous_values_never">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No, disable this feature</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKeep_previous_values_within_same_dir">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yes, but only if both files are in the same directory</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKeep_previous_values_always">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yes, regardless where the files are stored</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionManage_tags_automatically_when_loading_file">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="autocorrection">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage tags automatically when loading file</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>NotificationLabel</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/notificationlabel.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -5,11 +5,9 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDir;
|
||||
class QAbstractItemModel;
|
||||
class QModelIndex;
|
||||
QT_END_NAMESPACE
|
||||
QT_FORWARD_DECLARE_CLASS(QDir)
|
||||
QT_FORWARD_DECLARE_CLASS(QAbstractItemModel)
|
||||
QT_FORWARD_DECLARE_CLASS(QModelIndex)
|
||||
|
||||
namespace Media {
|
||||
class MediaFileInfo;
|
||||
|
|
|
@ -62,7 +62,8 @@ HEADERS += \
|
|||
gui/entertargetdialog.h \
|
||||
gui/attachmentsmodel.h \
|
||||
gui/attachmentsedit.h \
|
||||
gui/codeedit.h
|
||||
gui/codeedit.h \
|
||||
gui/tageditorwidget.h
|
||||
|
||||
SOURCES += \
|
||||
application/main.cpp \
|
||||
|
@ -92,7 +93,8 @@ SOURCES += \
|
|||
gui/entertargetdialog.cpp \
|
||||
gui/attachmentsmodel.cpp \
|
||||
gui/attachmentsedit.cpp \
|
||||
gui/codeedit.cpp
|
||||
gui/codeedit.cpp \
|
||||
gui/tageditorwidget.cpp
|
||||
|
||||
FORMS += \
|
||||
gui/id3v2optionpage.ui \
|
||||
|
@ -109,7 +111,8 @@ FORMS += \
|
|||
gui/entertargetdialog.ui \
|
||||
gui/attachmentsedit.ui \
|
||||
gui/editortempoptionpage.ui \
|
||||
gui/filelayout.ui
|
||||
gui/filelayout.ui \
|
||||
gui/tageditorwidget.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources/icons.qrc \
|
||||
|
|
Loading…
Reference in New Issue