diff --git a/CMakeLists.txt b/CMakeLists.txt index a059ada..19bf899 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ set(SRC_FILES network/testdownload.cpp network/vimeodownload.cpp network/youtubedownload.cpp + resources/json.qrc ) set(WIDGETS_HEADER_FILES @@ -163,22 +164,6 @@ use_qt_utilities() # add Qt modules which can currently not be detected automatically list(APPEND ADDITIONAL_QT_MODULES Network) -# add installs for JSON resource files -install(FILES resources/json/groovesharkauthenticationinfo.json - DESTINATION share/${META_PROJECT_NAME}/json - COMPONENT json-res -) -install(FILES resources/json/itaginfo.json - DESTINATION share/${META_PROJECT_NAME}/json - COMPONENT json-res -) -if(NOT TARGET install-json-res) - add_custom_target(install-json-res - DEPENDS ${META_PROJECT_NAME} - COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=json-res -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - ) -endif() - # include modules to apply configuration include(BasicConfig) include(QtGuiConfig) diff --git a/gui/settings.cpp b/gui/settings.cpp index e75eaf0..b9aada3 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -481,19 +481,10 @@ void restoreSettings() UiPage::multiSelection() = settings.value("multiselection").toBool(); // load grooveshark authentication file - const auto errorMsg = QApplication::translate("QtGui::Settings", - "Unable to read Grooveshark authentication information file.\n\nReason: %1\n\nThe values stored in this file are required " - "when connection to Grooveshark. Built-in will values be used instead, but these might be deprecated."); - const auto groovesharkAuthenticationFile - = ConfigFile::locateConfigFile(QStringLiteral(PROJECT_NAME), QStringLiteral("json/groovesharkauthenticationinfo.json"), &settings); QString reason; - if (!groovesharkAuthenticationFile.isEmpty()) { - if (!GroovesharkDownload::loadAuthenticationInformationFromFile(groovesharkAuthenticationFile, &reason)) { - QMessageBox::warning(nullptr, QApplication::applicationName(), errorMsg.arg(reason)); - } - } else { + if (!GroovesharkDownload::loadAuthenticationInformationFromFile(QStringLiteral(":/jsonobjects/groovesharkauthenticationinfo"), &reason)) { QMessageBox::warning(nullptr, QApplication::applicationName(), - errorMsg.arg(QApplication::translate("QtGui::Settings", "Unable to find \"groovesharkauthenticationinfo.json\"."))); + QCoreApplication::translate("QtGui::restoreSettings", "Unable to load Grooveshark authentication file: %1").arg(reason)); } } diff --git a/network/youtubedownload.cpp b/network/youtubedownload.cpp index db5e1d3..331c46e 100644 --- a/network/youtubedownload.cpp +++ b/network/youtubedownload.cpp @@ -4,13 +4,10 @@ #include "resources/config.h" -#include - #include #include using namespace CppUtilities; -using namespace QtUtilities; using namespace Application; namespace Network { @@ -62,12 +59,7 @@ Download *YoutubeDownload::infoRequestDownload(bool &success, QString &reasonFor void YoutubeDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer) { if (m_itagInfo.isEmpty()) { - // allow an external config file to be used instead of built-in values - QString path = ConfigFile::locateConfigFile(QStringLiteral(PROJECT_NAME), QStringLiteral("json/itaginfo.json")); - if (path.isEmpty()) { - path = QStringLiteral(":/jsonobjects/itaginfo"); - } - m_itagInfo = loadJsonObjectFromResource(path); + m_itagInfo = loadJsonObjectFromResource(QStringLiteral(":/jsonobjects/itaginfo")); } QString videoInfo(videoInfoBuffer->readAll()); QStringList completeFields = videoInfo.split(QChar('&'), QString::SkipEmptyParts, Qt::CaseSensitive); diff --git a/resources/json.qrc b/resources/json.qrc index 74b4044..f974967 100644 --- a/resources/json.qrc +++ b/resources/json.qrc @@ -1,5 +1,6 @@ json/itaginfo.json + json/groovesharkauthenticationinfo.json