tageditor/gui/mainwindow.h

104 lines
2.6 KiB
C
Raw Normal View History

#ifndef TAGEDITORMAINWINDOW_H
#define TAGEDITORMAINWINDOW_H
2015-04-22 19:33:53 +02:00
2015-09-06 20:20:00 +02:00
#include "./filefilterproxymodel.h"
#include "./previousvaluehandling.h"
2015-04-22 19:33:53 +02:00
#include <tagparser/mediafileinfo.h>
#include <tagparser/tagvalue.h>
#include <QByteArray>
2018-03-07 01:18:01 +01:00
#include <QMainWindow>
2015-04-22 19:33:53 +02:00
QT_FORWARD_DECLARE_CLASS(QFileSystemModel)
QT_FORWARD_DECLARE_CLASS(QItemSelectionModel)
2015-04-22 19:33:53 +02:00
2019-07-07 12:00:16 +02:00
#define TAGEDITOR_ENUM_CLASS enum class
2018-03-06 23:10:13 +01:00
namespace TagParser {
2019-07-07 12:00:16 +02:00
TAGEDITOR_ENUM_CLASS TagType : unsigned int;
} // namespace TagParser
#undef TAGEDITOR_ENUM_CLASS
2015-04-22 19:33:53 +02:00
2019-06-10 22:49:46 +02:00
namespace QtUtilities {
2015-04-22 19:33:53 +02:00
class AboutDialog;
class SettingsDialog;
2019-06-12 20:47:44 +02:00
} // namespace QtUtilities
2015-04-22 19:33:53 +02:00
namespace QtGui {
namespace Ui {
class MainWindow;
}
class TagEditorWidget;
2015-04-22 19:33:53 +02:00
class RenameFilesDialog;
2016-03-03 22:21:15 +01:00
class DbQueryWidget;
2015-04-22 19:33:53 +02:00
2018-03-07 01:18:01 +01:00
class MainWindow : public QMainWindow {
2015-04-22 19:33:53 +02:00
Q_OBJECT
2016-09-25 23:59:04 +02:00
Q_PROPERTY(QString currentDirectory READ currentDirectory WRITE setCurrentDirectory)
Q_PROPERTY(bool layoutLocked READ isLayoutLocked WRITE setLayoutLocked)
2018-03-07 01:18:01 +01:00
2015-04-22 19:33:53 +02:00
public:
explicit MainWindow(QWidget *parent = nullptr);
2019-06-01 12:45:12 +02:00
~MainWindow() override;
2015-04-22 19:33:53 +02:00
2015-07-27 23:29:30 +02:00
// file browser
2016-09-25 23:59:04 +02:00
QString currentDirectory() const;
bool isLayoutLocked() const;
2020-03-08 14:04:29 +01:00
public Q_SLOTS:
2015-04-22 19:33:53 +02:00
void setCurrentDirectory(const QString &path);
2016-09-25 23:59:04 +02:00
void setLayoutLocked(bool locked);
void toggleLayoutLocked();
void startParsing(const QString &path);
2015-07-27 23:29:30 +02:00
2015-04-22 19:33:53 +02:00
protected:
2019-06-01 12:45:12 +02:00
bool event(QEvent *event) override;
2015-04-22 19:33:53 +02:00
2020-03-08 14:04:29 +01:00
private Q_SLOTS:
2015-04-22 19:33:53 +02:00
// file selection
void pathEntered();
void fileSelected();
void selectNextFile();
void selectNextFile(QItemSelectionModel *selectionModel, const QModelIndex &currentIndex, bool notDeeper);
void showNextFileNotFound();
2015-04-22 19:33:53 +02:00
void showOpenFileDlg();
2016-05-01 20:07:04 +02:00
void showSaveAsDlg();
void handleFileStatusChange(bool opened, bool hasTag);
2016-08-14 22:49:47 +02:00
void handleCurrentPathChanged(const QString &newPath);
2023-03-26 22:19:27 +02:00
void updateStyleSheet();
2015-04-22 19:33:53 +02:00
// settings
2020-11-25 18:14:40 +01:00
void showNewWindow();
void showSettingsDlg();
void applySettingsFromDialog();
2015-04-22 19:33:53 +02:00
// misc
void showAboutDlg();
void showRenameFilesDlg();
2015-10-14 20:15:10 +02:00
void spawnExternalPlayer();
2016-12-01 22:23:01 +01:00
void initDbQueryWidget();
void toggleDbQueryWidget();
2015-04-22 19:33:53 +02:00
private:
bool fileOperationOngoing() const;
2018-03-06 23:10:13 +01:00
TagParser::MediaFileInfo &fileInfo();
2015-04-22 19:33:53 +02:00
// UI
std::unique_ptr<Ui::MainWindow> m_ui;
// models
QFileSystemModel *m_fileModel;
FileFilterProxyModel *m_fileFilterModel;
bool m_internalFileSelection;
2015-04-22 19:33:53 +02:00
// dialogs
2019-06-10 22:49:46 +02:00
QtUtilities::AboutDialog *m_aboutDlg;
QtUtilities::SettingsDialog *m_settingsDlg;
2015-04-22 19:33:53 +02:00
std::unique_ptr<RenameFilesDialog> m_renameFilesDlg;
2016-03-03 22:21:15 +01:00
DbQueryWidget *m_dbQueryWidget;
2015-04-22 19:33:53 +02:00
};
2018-03-07 01:18:01 +01:00
} // namespace QtGui
2015-04-22 19:33:53 +02:00
#endif // TAGEDITORMAINWINDOW_H