#ifndef TAGEDITORDIALOG_H #define TAGEDITORDIALOG_H #include "filefilterproxymodel.h" #include "previousvaluehandling.h" #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QLineEdit; class QComboBox; class QSpinBox; class QPlainTextEdit; class QGraphicsScene; class QFileSystemModel; QT_END_NAMESPACE namespace Media { DECLARE_ENUM(TagType, unsigned int) } namespace Dialogs { class AboutDialog; class SettingsDialog; } namespace QtGui { namespace Ui { class MainWindow; } class TagEdit; class RenameFilesDialog; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); virtual ~MainWindow(); QString currentDirectory(); void setCurrentDirectory(const QString &path); protected: virtual void closeEvent(QCloseEvent *); virtual bool eventFilter(QObject *obj, QEvent *event); private slots: // file selection void pathEntered(); void fileSelected(); void saveAndShowNextFile(); void selectNextFile(); void showOpenFileDlg(); // opened file: load, save, delete, close bool startParsing(const QString &path, bool forceRefresh = false); void showFile(char result); bool applyEntriesAndSaveChangings(); bool deleteAllTagsAndSave(); void closeFile(); // editor void saveFileInformation(); void handleReturnPressed(); void handleKeepPreviousValuesActionTriggered(QAction *action); void applySettingsFromDialog(); void addTag(const std::function &createTag); void removeTag(Media::Tag *tag); void changeTarget(Media::Tag *tag); // saving bool startSaving(); void showSavingResult(bool sucess); // misc void showAboutDlg(); void showSettingsDlg(); void showRenameFilesDlg(); void updateInfoWebView(); private: void updateTagEditsAndAttachmentEdits(bool updateUi = true, PreviousValueHandling previousValueHandling = PreviousValueHandling::Auto); void updateTagSelectionComboBox(); void updateUiStatus(); void updateTagManagementMenu(); void insertTitleFromFilename(); void foreachTagEdit(const std::function &function); bool confirmCreationOfId3TagForUnsupportedFile(); // UI std::unique_ptr m_ui; QMenu *m_keepPreviousValuesMenu; QMenu *m_tagOptionsMenu; QMenu *m_addTagMenu; QMenu *m_removeTagMenu; QMenu *m_changeTargetMenu; // 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; Media::MediaFileInfo m_fileInfo; QString m_nextFilePath; std::vector m_tags; QByteArray m_fileInfoHtml; // dialogs Dialogs::AboutDialog *m_aboutDlg; Dialogs::SettingsDialog *m_settingsDlg; std::unique_ptr m_renameFilesDlg; // status bool m_makingResultsAvailable; Media::NotificationList m_originalNotifications; bool m_abortClicked; std::mutex m_fileOperationMutex; }; } #endif // TAGEDITORDIALOG_H