tageditor/application/settings.h

133 lines
3.3 KiB
C
Raw Normal View History

2015-04-22 19:33:53 +02:00
#ifndef SETTINGS_H
#define SETTINGS_H
2016-10-24 20:15:10 +02:00
#include "./knownfieldmodel.h"
2018-03-11 18:58:50 +01:00
#include "./targetlevelmodel.h"
2016-10-24 20:15:10 +02:00
#include <tagparser/abstractcontainer.h>
#include <tagparser/settings.h>
2016-10-24 20:15:10 +02:00
#include <tagparser/tag.h>
2018-03-11 18:58:50 +01:00
#include <tagparser/tagvalue.h>
2015-04-22 19:33:53 +02:00
2016-10-24 20:15:10 +02:00
#include <qtutilities/settingsdialog/qtsettings.h>
2015-04-22 19:33:53 +02:00
2016-10-24 20:15:10 +02:00
#include <QByteArray>
#include <QRegularExpression>
2018-03-11 18:58:50 +01:00
#include <QString>
2016-08-14 22:49:47 +02:00
2015-04-22 19:33:53 +02:00
namespace Settings {
2018-03-11 18:58:50 +01:00
enum class ActionEnabled { Ask, Yes, No };
2015-04-22 19:33:53 +02:00
2018-03-11 18:58:50 +01:00
enum class AdoptFields { Never, WithinDirectory, Always };
2016-10-24 20:15:10 +02:00
2018-03-11 18:58:50 +01:00
enum class MultipleTagHandling { SingleEditorPerTarget, SeparateEditors };
2016-10-24 20:15:10 +02:00
struct CustomSubstitution {
QRegularExpression regex;
QString replacement;
bool enabled = false;
};
2018-03-11 18:58:50 +01:00
struct AutoCompletition {
2016-10-24 20:15:10 +02:00
AutoCompletition();
bool insertTitleFromFilename = false;
bool trimWhitespaces = true;
bool formatNames = false;
bool fixUmlauts = false;
CustomSubstitution customSubstitution;
2016-10-24 20:15:10 +02:00
KnownFieldModel fields;
};
2018-03-11 18:58:50 +01:00
struct Editor {
2016-10-24 20:15:10 +02:00
Editor();
2018-07-10 16:35:50 +02:00
std::string backupDirectory;
2016-10-24 20:15:10 +02:00
AdoptFields adoptFields = AdoptFields::Never;
bool saveAndShowNextOnEnter = false;
bool askBeforeDeleting = true;
MultipleTagHandling multipleTagHandling = MultipleTagHandling::SingleEditorPerTarget;
bool hideTagSelectionComboBox = false;
bool forceFullParse = false;
#ifndef TAGEDITOR_NO_WEBVIEW
2016-10-24 20:15:10 +02:00
bool noWebView = false;
#endif
2016-10-24 20:15:10 +02:00
bool hideCoverButtons = false;
AutoCompletition autoCompletition;
KnownFieldModel fields;
TargetLevelModel defaultTargets;
};
2015-04-22 19:33:53 +02:00
2018-03-11 18:58:50 +01:00
enum class UnsupportedFieldHandling { Ignore, Discard };
2016-08-14 22:49:47 +02:00
2018-03-11 18:58:50 +01:00
struct FileBrowser {
2016-10-24 20:15:10 +02:00
bool hideBackupFiles = true;
bool readOnly = true;
};
2018-03-11 18:58:50 +01:00
struct FileLayout {
2016-10-24 20:15:10 +02:00
bool forceRewrite = true;
2018-03-06 23:10:13 +01:00
TagParser::ElementPosition preferredTagPosition = TagParser::ElementPosition::BeforeData;
2016-10-24 20:15:10 +02:00
bool forceTagPosition = true;
2018-03-06 23:10:13 +01:00
TagParser::ElementPosition preferredIndexPosition = TagParser::ElementPosition::BeforeData;
2016-10-24 20:15:10 +02:00
bool forceIndexPosition = true;
std::size_t minPadding = 0;
std::size_t maxPadding = 0;
std::size_t preferredPadding = 0;
};
2018-03-11 18:58:50 +01:00
struct TagProcessing {
2018-03-06 23:10:13 +01:00
TagParser::TagTextEncoding preferredEncoding = TagParser::TagTextEncoding::Utf8;
2016-10-24 20:15:10 +02:00
UnsupportedFieldHandling unsupportedFieldHandling = UnsupportedFieldHandling::Ignore;
bool autoTagManagement = true;
bool preserveModificationTime = false;
bool preserveMuxingApp = false;
bool preserveWritingApp = false;
bool convertTotalFields = true;
TagParser::TagCreationSettings creationSettings;
2016-10-24 20:15:10 +02:00
FileLayout fileLayout;
};
2018-03-11 18:58:50 +01:00
struct MainWindow {
2016-10-24 20:15:10 +02:00
QByteArray geometry;
QByteArray state;
QString currentFileBrowserDirectory;
bool layoutLocked = false;
};
2018-03-11 18:58:50 +01:00
struct DbQuery {
2016-10-24 20:15:10 +02:00
DbQuery();
bool widgetShown = false;
bool override = false;
KnownFieldModel fields;
QString musicBrainzUrl;
QString coverArtArchiveUrl;
QString lyricsWikiaUrl;
QString makeItPersonalUrl;
QString tekstowoUrl;
2016-10-24 20:15:10 +02:00
};
2018-03-11 18:58:50 +01:00
struct RenamingUtility {
2016-10-24 20:15:10 +02:00
int scriptSource = 0;
QString externalScript;
QString editorScript;
};
2018-03-11 18:58:50 +01:00
struct Settings {
QString error;
2016-10-24 20:15:10 +02:00
Editor editor;
FileBrowser fileBrowser;
TagProcessing tagPocessing;
MainWindow mainWindow;
DbQuery dbQuery;
RenamingUtility renamingUtility;
2019-06-10 22:49:46 +02:00
QtUtilities::QtSettings qt;
2016-10-24 20:15:10 +02:00
};
Settings &values();
2015-04-22 19:33:53 +02:00
void restore();
void save();
2018-03-11 18:58:50 +01:00
} // namespace Settings
2015-04-22 19:33:53 +02:00
#endif // SETTINGS_H