From 66a45f7578e5181d0af400ddf20f7d81cae88d51 Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 12 Jun 2019 20:47:44 +0200 Subject: [PATCH] Adapt to changes in c++utilities --- application/main.cpp | 3 +-- application/settings.cpp | 8 ++++---- cli/helper.h | 9 +++------ cli/json.cpp | 2 +- cli/mainfeatures.cpp | 12 ++++++------ cli/mainfeatures.h | 15 ++++++--------- dbquery/dbquery.cpp | 2 +- dbquery/dbquery.h | 6 +++--- gui/mainwindow.h | 2 +- gui/pathlineedit.cpp | 4 ++-- gui/settingsdialog.cpp | 7 +++---- gui/tagfieldedit.h | 2 +- tests/cli.cpp | 2 +- 13 files changed, 33 insertions(+), 41 deletions(-) diff --git a/application/main.cpp b/application/main.cpp index 88fd075..3155fdc 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -210,8 +210,7 @@ int main(int argc, char *argv[]) if (qtConfigArgs.areQtGuiArgsPresent()) { #if defined(TAGEDITOR_GUI_QTWIDGETS) return QtGui::runWidgetsGui(argc, argv, qtConfigArgs, - defaultFileArg.isPresent() && !defaultFileArg.values().empty() ? fromNativeFileName(defaultFileArg.values().front()) - : QString(), + defaultFileArg.isPresent() && !defaultFileArg.values().empty() ? fromNativeFileName(defaultFileArg.values().front()) : QString(), renamingUtilityArg.isPresent()); #else CMD_UTILS_START_CONSOLE; diff --git a/application/settings.cpp b/application/settings.cpp index 46e1bad..11b562d 100644 --- a/application/settings.cpp +++ b/application/settings.cpp @@ -30,10 +30,10 @@ Editor::Editor() DbQuery::DbQuery() : fields(QList() << KnownFieldModel::mkItem(KnownField::Title) << KnownFieldModel::mkItem(KnownField::TrackPosition) - << KnownFieldModel::mkItem(KnownField::DiskPosition) << KnownFieldModel::mkItem(KnownField::Album) - << KnownFieldModel::mkItem(KnownField::Artist) << KnownFieldModel::mkItem(KnownField::Year) - << KnownFieldModel::mkItem(KnownField::Genre) << KnownFieldModel::mkItem(KnownField::Cover, Qt::Unchecked) - << KnownFieldModel::mkItem(KnownField::Lyrics, Qt::Unchecked)) + << KnownFieldModel::mkItem(KnownField::DiskPosition) << KnownFieldModel::mkItem(KnownField::Album) + << KnownFieldModel::mkItem(KnownField::Artist) << KnownFieldModel::mkItem(KnownField::Year) + << KnownFieldModel::mkItem(KnownField::Genre) << KnownFieldModel::mkItem(KnownField::Cover, Qt::Unchecked) + << KnownFieldModel::mkItem(KnownField::Lyrics, Qt::Unchecked)) { } diff --git a/cli/helper.h b/cli/helper.h index 95b852e..21edbec 100644 --- a/cli/helper.h +++ b/cli/helper.h @@ -253,11 +253,9 @@ std::string incremented(const std::string &str, unsigned int toIncrement = 1); void printDiagMessages(const TagParser::Diagnostics &diag, const char *head = nullptr, bool beVerbose = false); void printProperty(const char *propName, const char *value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4); -void printProperty( - const char *propName, ElementPosition elementPosition, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4); +void printProperty(const char *propName, ElementPosition elementPosition, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4); -inline void printProperty( - const char *propName, const std::string &value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4) +inline void printProperty(const char *propName, const std::string &value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4) { printProperty(propName, value.data(), suffix, indentation); } @@ -296,8 +294,7 @@ CppUtilities::TimeSpanOutputFormat parseTimeSpanOutputFormat( const CppUtilities::Argument &usageArg, CppUtilities::TimeSpanOutputFormat defaultFormat); TagUsage parseUsageDenotation(const CppUtilities::Argument &usageArg, TagUsage defaultUsage); TagTextEncoding parseEncodingDenotation(const CppUtilities::Argument &encodingArg, TagTextEncoding defaultEncoding); -ElementPosition parsePositionDenotation( - const CppUtilities::Argument &posArg, const CppUtilities::Argument &valueArg, ElementPosition defaultPos); +ElementPosition parsePositionDenotation(const CppUtilities::Argument &posArg, const CppUtilities::Argument &valueArg, ElementPosition defaultPos); std::uint64_t parseUInt64(const CppUtilities::Argument &arg, std::uint64_t defaultValue); TagTarget::IdContainerType parseIds(const std::string &concatenatedIds); bool applyTargetConfiguration(TagTarget &target, const std::string &configStr); diff --git a/cli/json.cpp b/cli/json.cpp index 1756e08..ad8cd65 100644 --- a/cli/json.cpp +++ b/cli/json.cpp @@ -108,7 +108,7 @@ TargetInfo::TargetInfo(const TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document , editions(tagTarget.editions()) , attachments(tagTarget.attachments()) { - VAR_UNUSED(allocator) + CPP_UTILITIES_UNUSED(allocator) } /*! diff --git a/cli/mainfeatures.cpp b/cli/mainfeatures.cpp index cae7ea0..a51853f 100644 --- a/cli/mainfeatures.cpp +++ b/cli/mainfeatures.cpp @@ -28,12 +28,12 @@ #endif #include -#include #include #include #include #include #include +#include #if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK) #include @@ -127,9 +127,9 @@ void generateFileInfo(const ArgumentOccurrence &, const Argument &inputFileArg, cerr << Phrases::Error << "An IO failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush; } #else - VAR_UNUSED(inputFileArg); - VAR_UNUSED(outputFileArg); - VAR_UNUSED(validateArg); + CPP_UTILITIES_UNUSED(inputFileArg); + CPP_UTILITIES_UNUSED(outputFileArg); + CPP_UTILITIES_UNUSED(validateArg); cerr << Phrases::Error << "Generating HTML info is only available if built with Qt support." << Phrases::EndFlush; #endif } @@ -969,8 +969,8 @@ void exportToJson(const ArgumentOccurrence &, const Argument &filesArg, const Ar cout << endl; #else - VAR_UNUSED(filesArg); - VAR_UNUSED(prettyArg); + CPP_UTILITIES_UNUSED(filesArg); + CPP_UTILITIES_UNUSED(prettyArg); cerr << Phrases::Error << "JSON export has not been enabled when building the tag editor." << Phrases::EndFlush; #endif } diff --git a/cli/mainfeatures.h b/cli/mainfeatures.h index bd985d5..87ed266 100644 --- a/cli/mainfeatures.h +++ b/cli/mainfeatures.h @@ -49,18 +49,15 @@ extern const char *const fieldNames; extern const char *const fieldNamesForSet; void applyGeneralConfig(const CppUtilities::Argument &timeSapnFormatArg); void printFieldNames(const CppUtilities::ArgumentOccurrence &occurrence); -void displayFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, - const CppUtilities::Argument &verboseArg); +void displayFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, const CppUtilities::Argument &verboseArg); void generateFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &inputFileArg, const CppUtilities::Argument &outputFileArg, const CppUtilities::Argument &validateArg); -void displayTagInfo(const CppUtilities::Argument &fieldsArg, const CppUtilities::Argument &showUnsupportedArg, - const CppUtilities::Argument &filesArg, const CppUtilities::Argument &verboseArg); -void setTagInfo(const Cli::SetTagInfoArgs &args); -void extractField(const CppUtilities::Argument &fieldArg, const CppUtilities::Argument &attachmentArg, - const CppUtilities::Argument &inputFilesArg, const CppUtilities::Argument &outputFileArg, +void displayTagInfo(const CppUtilities::Argument &fieldsArg, const CppUtilities::Argument &showUnsupportedArg, const CppUtilities::Argument &filesArg, const CppUtilities::Argument &verboseArg); -void exportToJson(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, - const CppUtilities::Argument &prettyArg); +void setTagInfo(const Cli::SetTagInfoArgs &args); +void extractField(const CppUtilities::Argument &fieldArg, const CppUtilities::Argument &attachmentArg, const CppUtilities::Argument &inputFilesArg, + const CppUtilities::Argument &outputFileArg, const CppUtilities::Argument &verboseArg); +void exportToJson(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, const CppUtilities::Argument &prettyArg); } // namespace Cli diff --git a/dbquery/dbquery.cpp b/dbquery/dbquery.cpp index 1189b79..8a94e6e 100644 --- a/dbquery/dbquery.cpp +++ b/dbquery/dbquery.cpp @@ -310,7 +310,7 @@ QNetworkReply *HttpResultsModel::evaluateReplyResults(QNetworkReply *reply, QByt if ((data = reply->readAll()).isEmpty()) { m_errorList << tr("Server replied no data."); } -#ifdef DEBUG_BUILD +#ifdef CPP_UTILITIES_DEBUG_BUILD cerr << "Results from HTTP query:" << endl; cerr << data.data() << endl; #endif diff --git a/dbquery/dbquery.h b/dbquery/dbquery.h index 1dafb8c..b669dce 100644 --- a/dbquery/dbquery.h +++ b/dbquery/dbquery.h @@ -6,7 +6,7 @@ #include #include -#ifdef DEBUG_BUILD +#ifdef CPP_UTILITIES_DEBUG_BUILD #include #endif @@ -136,7 +136,7 @@ protected: template inline void HttpResultsModel::addReply(QNetworkReply *reply, Object object, Function handler) { (m_replies << reply), connect(reply, &QNetworkReply::finished, object, handler); -#ifdef DEBUG_BUILD +#ifdef CPP_UTILITIES_DEBUG_BUILD std::cerr << "HTTP query: " << reply->url().toString().toUtf8().data() << std::endl; #endif } @@ -148,7 +148,7 @@ template inline void HttpResultsModel::addReply(Q template inline void HttpResultsModel::addReply(QNetworkReply *reply, Function handler) { (m_replies << reply), connect(reply, &QNetworkReply::finished, handler); -#ifdef DEBUG_BUILD +#ifdef CPP_UTILITIES_DEBUG_BUILD std::cerr << "HTTP query: " << reply->url().toString().toUtf8().data() << std::endl; #endif } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 63fdc9d..6201f8a 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -20,7 +20,7 @@ enum class TagType : unsigned int; namespace QtUtilities { class AboutDialog; class SettingsDialog; -} // namespace Dialogs +} // namespace QtUtilities namespace QtGui { diff --git a/gui/pathlineedit.cpp b/gui/pathlineedit.cpp index 1865969..df6fad0 100644 --- a/gui/pathlineedit.cpp +++ b/gui/pathlineedit.cpp @@ -62,8 +62,8 @@ void PathLineEdit::contextMenuEvent(QContextMenuEvent *event) QFileInfo fileInfo(text()); if (fileInfo.exists()) { if (fileInfo.isFile()) { - connect(menu->addAction(QIcon::fromTheme(QStringLiteral("system-run")), tr("Open")), &QAction::triggered, - bind(&openLocalFileOrDir, text())); + connect( + menu->addAction(QIcon::fromTheme(QStringLiteral("system-run")), tr("Open")), &QAction::triggered, bind(&openLocalFileOrDir, text())); } else if (fileInfo.isDir()) { connect(menu->addAction(QIcon::fromTheme(QStringLiteral("system-file-manager")), tr("Explore")), &QAction::triggered, bind(&openLocalFileOrDir, text())); diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index aabe7a3..7f543e6 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -648,7 +648,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) category = new OptionCategory(this); category->setDisplayName(tr("Tag processing")); category->assignPages(QList() << new TagProcessingGeneralOptionPage << new Id3v1OptionPage << new Id3v2OptionPage - << new TagProcessingTargetsOptionPage << new FileLayoutPage); + << new TagProcessingTargetsOptionPage << new FileLayoutPage); category->setIcon(QIcon::fromTheme(QStringLiteral("tag"), QIcon(QStringLiteral(":/tageditor/icons/hicolor/32x32/settingscategories/tag.png")))); categories << category; @@ -656,9 +656,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) category->setDisplayName(tr("Editor")); category->setIcon( QIcon::fromTheme(QStringLiteral("document-edit"), QIcon(QStringLiteral(":/tageditor/icons/hicolor/32x32/settingscategories/key-enter.png")))); - category->assignPages(QList() - << new EditorGeneralOptionPage << new EditorTempOptionPage(this) << new EditorFieldsOptionPage << new InfoOptionPage - << new EditorAutoCorrectionOptionPage << new EditorDbQueryOptionsPage); + category->assignPages(QList() << new EditorGeneralOptionPage << new EditorTempOptionPage(this) << new EditorFieldsOptionPage + << new InfoOptionPage << new EditorAutoCorrectionOptionPage << new EditorDbQueryOptionsPage); categories << category; category = new OptionCategory(this); diff --git a/gui/tagfieldedit.h b/gui/tagfieldedit.h index e0561f9..8723249 100644 --- a/gui/tagfieldedit.h +++ b/gui/tagfieldedit.h @@ -26,7 +26,7 @@ class ClearComboBox; class ClearSpinBox; class ClearPlainTextEdit; class IconButton; -} // namespace Widgets +} // namespace QtUtilities namespace QtGui { diff --git a/tests/cli.cpp b/tests/cli.cpp index 49593be..ee0d15f 100644 --- a/tests/cli.cpp +++ b/tests/cli.cpp @@ -18,7 +18,7 @@ inline std::ostream &operator<<(std::ostream &os, const TagParser::DiagMessage & return os << diagMessage.levelName() << ':' << ' ' << diagMessage.message() << ' ' << '(' << diagMessage.context() << ')'; } -} // namespace TestUtilities +} // namespace CppUtilities using namespace CppUtilities;