tageditor/gui/mainwindow.h

100 lines
2.4 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
2018-03-06 23:10:13 +01:00
namespace TagParser {
2016-07-11 21:34:05 +02:00
DECLARE_ENUM_CLASS(TagType, unsigned int);
2015-04-22 19:33:53 +02:00
}
namespace Dialogs {
class AboutDialog;
class SettingsDialog;
2018-03-07 01:18:01 +01:00
} // namespace Dialogs
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);
~MainWindow();
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;
public 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:
2016-01-09 03:38:58 +01:00
bool event(QEvent *event);
2015-04-22 19:33:53 +02:00
private slots:
// 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);
2015-04-22 19:33:53 +02:00
// settings
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
Dialogs::AboutDialog *m_aboutDlg;
Dialogs::SettingsDialog *m_settingsDlg;
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