diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e1f8e09 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,163 @@ +name: FRequest Build +on: [push] +jobs: + Build-windows: + runs-on: windows-2022 + steps: + - name: Check out FRequest code + uses: actions/checkout@v3 + with: + path: 'FRequest' + - name: Check out CommonLibs + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonLibs + path: 'CommonLibs' + - name: Check out CommonUtils + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonUtils + path: 'CommonUtils' + - name: Download Qt SDK and FRequest binaries + run: | + $files_url="https://github.com/${{ github.event.repository.owner.login }}/Files/releases/download" + Invoke-WebRequest "$files_url/frequestwindows/Qt5.15.2.7z" -OutFile Qt5.15.2.7z + Invoke-WebRequest "$files_url/frequestwindows/FRequestBinaries.7z" -OutFile FRequestBinaries.7z + 7z.exe x -mmt=4 Qt5.15.2.7z -o"Qt5.15.2" + 7z.exe x -mmt=4 FRequestBinaries.7z -o"FRequestBinaries" + - name: Set Enviroments variables for SDK + run: | + # https://stackoverflow.com/a/64831469 + echo "${{ github.workspace }}\Qt5.15.2\5.15.2\mingw81_32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "${{ github.workspace }}\Qt5.15.2\Tools\mingw810_32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Compile code + run: | + mkdir output + cd output + qmake ../${{ github.event.repository.name }}/FRequest.pro "CONFIG+=release" + mingw32-make -j + cd .. + - name: Copy executable / dependencies / readme / license to final folder + run: | + Invoke-WebRequest "https://github.com/${{ github.event.repository.owner.login }}/Files/releases/download/common/get_zip_name.py" -OutFile get_zip_name.py + $zip_name=python3 get_zip_name.py ${{ github.event.repository.owner.login }} ${{ github.event.repository.name }} + mkdir distributable + mkdir distributable\FRequest + cp output\release\FRequest.exe distributable\FRequest + xcopy FRequestBinaries distributable\FRequest /e + cp ${{ github.event.repository.name }}\readme.txt distributable\FRequest + cp ${{ github.event.repository.name }}\LICENSE distributable\FRequest + 7z a -tzip -mmt=4 "distributable\$zip_name.zip" "${{ github.workspace }}\distributable\FRequest" + - name: Archive the final folder + uses: actions/upload-artifact@v3 + with: + name: FRequest-windows + path: distributable/*.zip + Build-macos: + runs-on: macos-10.15 + steps: + - name: Check out FRequest code + uses: actions/checkout@v3 + with: + path: 'FRequest' + - name: Check out CommonLibs + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonLibs + path: 'CommonLibs' + - name: Check out CommonUtils + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonUtils + path: 'CommonUtils' + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: 5.15.2 + target: desktop + modules: none + # - name: Download and Install Qt SDK (alternative) + # # https://superuser.com/a/422785 + # run: | + # brew install qt@5 + # brew link qt@5 + - name: Compile code + run: | + mkdir output + cd output + qmake ../${{ github.event.repository.name }}/FRequest.pro "CONFIG+=release" + make -j + cd .. + - name: Copy app bundle / readme / license to final folder + run: | + wget "https://github.com/${{ github.event.repository.owner.login }}/Files/releases/download/common/get_zip_name.py" + zip_name=$(python3 get_zip_name.py ${{ github.event.repository.owner.login }} ${{ github.event.repository.name }}) + macdeployqt output/FRequest.app + mkdir distributable + mkdir distributable/FRequest + cp -R output/FRequest.app distributable/FRequest + cp ${{ github.event.repository.name }}/readme.txt distributable/FRequest + cp ${{ github.event.repository.name }}/LICENSE distributable/FRequest + 7z a -tzip -mmt=4 distributable/$zip_name.zip ${{ github.workspace }}/distributable/FRequest + - name: Archive the final folder + uses: actions/upload-artifact@v3 + with: + name: FRequest-macos + path: distributable/*.zip + Build-linux: + runs-on: ubuntu-18.04 + steps: + - name: Check out FRequest code + uses: actions/checkout@v3 + with: + path: 'FRequest' + - name: Check out CommonLibs + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonLibs + path: 'CommonLibs' + - name: Check out CommonUtils + uses: actions/checkout@v3 + with: + repository: ${{ github.event.repository.owner.login }}/CommonUtils + path: 'CommonUtils' + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: 5.15.2 + target: desktop + modules: none + - name: Download and Set linuxdeployqt + run: | + wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage + chmod a+x linuxdeployqt-continuous-x86_64.AppImage + - name: Compile code + run: | + mkdir output + cd output + qmake ../${{ github.event.repository.name }}/FRequest.pro "CONFIG+=release" + make -j + cd .. + - name: Generate AppImage + run: | + mkdir AppImage + cp output/FRequest AppImage + cp ${{ github.event.repository.name }}/LinuxAppImageDeployment/*.* AppImage + cd AppImage + ${{ github.workspace }}/linuxdeployqt-continuous-x86_64.AppImage frequest.desktop -no-translations -appimage + cd .. + - name: Copy AppImage / readme / license to final folder + run: | + wget "https://github.com/${{ github.event.repository.owner.login }}/Files/releases/download/common/get_zip_name.py" + zip_name=$(python3 get_zip_name.py ${{ github.event.repository.owner.login }} ${{ github.event.repository.name }}) + mkdir distributable + mkdir distributable/FRequest + cp ${{ github.event.repository.name }}/readme.txt distributable/FRequest + cp ${{ github.event.repository.name }}/LICENSE distributable/FRequest + cp AppImage/FRequest-x86_64.AppImage distributable/FRequest + 7z a -tzip -mmt=4 distributable/$zip_name ${{ github.workspace }}/distributable/FRequest + - name: Archive the final folder + uses: actions/upload-artifact@v3 + with: + name: FRequest-linux + path: distributable/*.zip \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2ffc12c..a722492 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # ignore QtCreator user files -*.pro.user +*.pro.user* # ignore MacOS specific files *.DS_Store diff --git a/FRequest.pro b/FRequest.pro index e302c6a..a7bcfea 100755 --- a/FRequest.pro +++ b/FRequest.pro @@ -98,4 +98,4 @@ RESOURCES += \ macx { RESOURCES += \ Resources/macos_resources.qrc -} \ No newline at end of file +} diff --git a/Widgets/frequesttreewidgetprojectitem.h b/Widgets/frequesttreewidgetprojectitem.h index 37206fb..6e638f8 100644 --- a/Widgets/frequesttreewidgetprojectitem.h +++ b/Widgets/frequesttreewidgetprojectitem.h @@ -23,6 +23,8 @@ along with this program. If not, see . #include "frequesttreewidgetrequestitem.h" #include "utilfrequest.h" +#include + class FRequestTreeWidgetProjectItem : public FRequestTreeWidgetItem { public: diff --git a/XmlParsers/configfilefrequest.cpp b/XmlParsers/configfilefrequest.cpp index fd362c5..523e46e 100644 --- a/XmlParsers/configfilefrequest.cpp +++ b/XmlParsers/configfilefrequest.cpp @@ -35,7 +35,7 @@ void ConfigFileFRequest::createNewConfig(){ pugi::xml_document doc; pugi::xml_node rootNode = doc.append_child("FRequestConfig"); - rootNode.append_attribute("frequestVersion").set_value(QSTR_TO_CSTR(GlobalVars::LastCompatibleVersionConfig)); + rootNode.append_attribute("frequestVersion").set_value(QSTR_TO_TEMPORARY_CSTR(GlobalVars::LastCompatibleVersionConfig)); pugi::xml_node generalNode = rootNode.append_child("General"); @@ -51,7 +51,7 @@ void ConfigFileFRequest::createNewConfig(){ pugi::xml_node recentProjectsNode = rootNode.append_child("RecentProjects"); for(int i=1; i<=GlobalVars::AppRecentProjectsMaxSize; i++){ - recentProjectsNode.append_child(QSTR_TO_CSTR("RecentProject" + QString::number(i))); + recentProjectsNode.append_child(QSTR_TO_TEMPORARY_CSTR("RecentProject" + QString::number(i))); } pugi::xml_node proxyNode = rootNode.append_child("Proxy"); @@ -72,7 +72,7 @@ void ConfigFileFRequest::createNewConfig(){ pugi::xml_node defaultHeadersNode = rootNode.append_child("DefaultHeaders"); defaultHeadersNode.append_attribute("useDefaultHeaders").set_value(currentSettings.defaultHeaders.useDefaultHeaders); - if(!doc.save_file(QSTR_TO_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ + if(!doc.save_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ #ifdef Q_OS_MAC QString errorMessage = "An error ocurred while creating the FRequest config file.
" "Make sure the application is placed on a writable location." @@ -103,7 +103,7 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) { pugi::xml_document doc; - doc.load_file(QSTR_TO_CSTR(this->fileFullPath)); + doc.load_file(QSTR_TO_TEMPORARY_CSTR(this->fileFullPath)); pugi::xml_node generalNode = doc.select_single_node("/FRequestConfig/General").node(); @@ -111,22 +111,22 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) generalNode.attribute("maxRequestResponseDataSizeToDisplay").set_value(newSettings.maxRequestResponseDataSizeToDisplay); generalNode.attribute("onStartupOption").set_value(static_cast(newSettings.onStartupSelectedOption)); generalNode.attribute("theme").set_value(static_cast(newSettings.theme)); - generalNode.attribute("lastProjectPath").set_value(QSTR_TO_CSTR(newSettings.lastProjectPath)); - generalNode.attribute("lastResponseFilePath").set_value(QSTR_TO_CSTR(newSettings.lastResponseFilePath)); + generalNode.attribute("lastProjectPath").set_value(QSTR_TO_TEMPORARY_CSTR(newSettings.lastProjectPath)); + generalNode.attribute("lastResponseFilePath").set_value(QSTR_TO_TEMPORARY_CSTR(newSettings.lastResponseFilePath)); generalNode.attribute("showRequestTypesIcons").set_value(newSettings.showRequestTypesIcons); generalNode.attribute("hideProjectSavedDialog").set_value(newSettings.hideProjectSavedDialog); pugi::xml_node recentProjectsNode = doc.select_single_node("/FRequestConfig/RecentProjects").node(); for(int i=1; i<=GlobalVars::AppRecentProjectsMaxSize && newSettings.recentProjectsPaths.size() >= i; i++){ - recentProjectsNode.child(QSTR_TO_CSTR("RecentProject" + QString::number(i))).text().set(QSTR_TO_CSTR(newSettings.recentProjectsPaths.at(i-1))); + recentProjectsNode.child(QSTR_TO_TEMPORARY_CSTR("RecentProject" + QString::number(i))).text().set(QSTR_TO_TEMPORARY_CSTR(newSettings.recentProjectsPaths.at(i-1))); } pugi::xml_node proxyNode = doc.select_single_node("/FRequestConfig/Proxy").node(); proxyNode.attribute("useProxy").set_value(newSettings.useProxy); proxyNode.attribute("proxyType").set_value(static_cast(newSettings.proxySettings.type)); - proxyNode.attribute("hostName").set_value(QSTR_TO_CSTR(newSettings.proxySettings.hostName)); + proxyNode.attribute("hostName").set_value(QSTR_TO_TEMPORARY_CSTR(newSettings.proxySettings.hostName)); proxyNode.attribute("port").set_value(newSettings.proxySettings.portNumber); pugi::xml_node windowsGeometryNode = doc.select_single_node("/FRequestConfig/WindowsGeometry").node(); @@ -135,9 +135,9 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) pugi::xml_node mainWindowNode = windowsGeometryNode.child("MainWindow"); - mainWindowNode.child("MainWindowGeometry").text().set(QSTR_TO_CSTR(QString(newSettings.windowsGeometry.mainWindow_MainWindowGeometry.toBase64()))); - mainWindowNode.child("RequestsSplitterState").text().set(QSTR_TO_CSTR(QString(newSettings.windowsGeometry.mainWindow_RequestsSplitterState.toBase64()))); - mainWindowNode.child("RequestResponseSplitterState").text().set(QSTR_TO_CSTR(QString(newSettings.windowsGeometry.mainWindow_RequestResponseSplitterState.toBase64()))); + mainWindowNode.child("MainWindowGeometry").text().set(QSTR_TO_TEMPORARY_CSTR(QString(newSettings.windowsGeometry.mainWindow_MainWindowGeometry.toBase64()))); + mainWindowNode.child("RequestsSplitterState").text().set(QSTR_TO_TEMPORARY_CSTR(QString(newSettings.windowsGeometry.mainWindow_RequestsSplitterState.toBase64()))); + mainWindowNode.child("RequestResponseSplitterState").text().set(QSTR_TO_TEMPORARY_CSTR(QString(newSettings.windowsGeometry.mainWindow_RequestResponseSplitterState.toBase64()))); pugi::xml_node defaultHeadersNode = doc.select_single_node("/FRequestConfig/DefaultHeaders").node(); @@ -151,18 +151,18 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) for(const UtilFRequest::HttpHeader ¤tHeader : headers){ pugi::xml_node headerNode = rawNode.append_child("Header"); - headerNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).text().set(QSTR_TO_CSTR(currentHeader.name)); - headerNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).text().set(QSTR_TO_CSTR(currentHeader.value)); + headerNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).text().set(QSTR_TO_TEMPORARY_CSTR(currentHeader.name)); + headerNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).text().set(QSTR_TO_TEMPORARY_CSTR(currentHeader.value)); } }; auto fWriteRequestType = [&fUpdateHeaders, &defaultHeadersNode](const QString &requestText, const std::experimental::optional &requestHeaders, const bool hasBody){ if(requestHeaders.has_value()){ - pugi::xml_node currentHeaderNode = defaultHeadersNode.child(QSTR_TO_CSTR(requestText)); + pugi::xml_node currentHeaderNode = defaultHeadersNode.child(QSTR_TO_TEMPORARY_CSTR(requestText)); if(currentHeaderNode.empty()){ - currentHeaderNode = defaultHeadersNode.append_child(QSTR_TO_CSTR(requestText)); + currentHeaderNode = defaultHeadersNode.append_child(QSTR_TO_TEMPORARY_CSTR(requestText)); } if(requestHeaders.value().headers_Raw.has_value()){ @@ -200,8 +200,8 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) const FRequestAuthentication &authData = *currentConfigAuth.authData; pugi::xml_node currentAuth = configAuthNode.append_child("Authentication"); - currentAuth.append_attribute("lastProjectName").set_value(QSTR_TO_CSTR(currentConfigAuth.lastProjectName)); - currentAuth.append_attribute("projectUuid").set_value(QSTR_TO_CSTR(currentConfigAuth.projectUuid)); + currentAuth.append_attribute("lastProjectName").set_value(QSTR_TO_TEMPORARY_CSTR(currentConfigAuth.lastProjectName)); + currentAuth.append_attribute("projectUuid").set_value(QSTR_TO_TEMPORARY_CSTR(currentConfigAuth.projectUuid)); currentAuth.append_attribute("type").set_value(static_cast(authData.type)); currentAuth.append_attribute("bRetryLoginIfError").set_value(authData.retryLoginIfError401); @@ -210,20 +210,20 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) { const RequestAuthentication &requestAuth = static_cast(authData); - currentAuth.append_attribute("requestUuid").set_value(QSTR_TO_CSTR(requestAuth.requestForAuthenticationUuid)); - currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(requestAuth.username)); - currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(requestAuth.passwordSalt)); + currentAuth.append_attribute("requestUuid").set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.requestForAuthenticationUuid)); + currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.username)); + currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.passwordSalt)); currentAuth.append_child("Password").append_child(pugi::xml_node_type::node_pcdata). - set_value((QSTR_TO_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(requestAuth.passwordSalt, requestAuth.password).toBase64())))); + set_value(QSTR_TO_TEMPORARY_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(requestAuth.passwordSalt, requestAuth.password).toBase64()))); break; } case FRequestAuthentication::AuthenticationType::BASIC_AUTHENTICATION: { const BasicAuthentication &basicAuth = static_cast(authData); - currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(basicAuth.username)); - currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(basicAuth.passwordSalt)); + currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(basicAuth.username)); + currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(basicAuth.passwordSalt)); currentAuth.append_child("Password").append_child(pugi::xml_node_type::node_pcdata). - set_value(QSTR_TO_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(basicAuth.passwordSalt, basicAuth.password).toBase64()))); + set_value(QSTR_TO_TEMPORARY_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(basicAuth.passwordSalt, basicAuth.password).toBase64()))); break; } @@ -236,8 +236,8 @@ void ConfigFileFRequest::saveSettings(ConfigFileFRequest::Settings &newSettings) } } } - if(!doc.save_file(QSTR_TO_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ - throw std::runtime_error(QSTR_TO_CSTR("Error while saving: '" + fileFullPath + "'")); + if(!doc.save_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Error while saving: '" + fileFullPath + "'")); } } catch(const std::exception &e) @@ -257,7 +257,7 @@ void ConfigFileFRequest::readSettingsFromFile(){ pugi::xml_document doc; - doc.load_file(QSTR_TO_CSTR(this->fileFullPath)); + doc.load_file(QSTR_TO_TEMPORARY_CSTR(this->fileFullPath)); pugi::xml_node generalNode = doc.select_single_node("/FRequestConfig/General").node(); @@ -275,9 +275,9 @@ void ConfigFileFRequest::readSettingsFromFile(){ this->currentSettings.recentProjectsPaths.clear(); for(int i=1; i<=GlobalVars::AppRecentProjectsMaxSize; i++){ - if(!recentProjectsNode.child(QSTR_TO_CSTR("RecentProject" + QString::number(i))).empty()){ - if(!QString(recentProjectsNode.child(QSTR_TO_CSTR("RecentProject" + QString::number(i))).text().as_string()).isEmpty()){ - this->currentSettings.recentProjectsPaths.append(recentProjectsNode.child(QSTR_TO_CSTR("RecentProject" + QString::number(i))).text().as_string()); + if(!recentProjectsNode.child(QSTR_TO_TEMPORARY_CSTR("RecentProject" + QString::number(i))).empty()){ + if(!QString(recentProjectsNode.child(QSTR_TO_TEMPORARY_CSTR("RecentProject" + QString::number(i))).text().as_string()).isEmpty()){ + this->currentSettings.recentProjectsPaths.append(recentProjectsNode.child(QSTR_TO_TEMPORARY_CSTR("RecentProject" + QString::number(i))).text().as_string()); } } } @@ -297,7 +297,7 @@ void ConfigFileFRequest::readSettingsFromFile(){ auto fReadBase64Setting = [&mainWindowNode](const char * const node) -> QByteArray{ QByteArray auxBase64Decode; - auxBase64Decode.append(QString(mainWindowNode.child(node).text().as_string())); + auxBase64Decode.append(QString(mainWindowNode.child(node).text().as_string()).toUtf8()); return QByteArray::fromBase64(auxBase64Decode); }; @@ -325,10 +325,10 @@ void ConfigFileFRequest::readSettingsFromFile(){ nodeName = "X-form-www-urlencoded"; break; default: - throw std::runtime_error(QSTR_TO_CSTR("Unknown body type " + QString::number(static_cast(bodyType)))); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Unknown body type " + QString::number(static_cast(bodyType)))); } - for(const pugi::xml_node ¤tNode : currentHeaderNode.child(QSTR_TO_CSTR(nodeName)).children()){ + for(const pugi::xml_node ¤tNode : currentHeaderNode.child(QSTR_TO_TEMPORARY_CSTR(nodeName)).children()){ if(!requestHeaders.has_value()){ requestHeaders = ProtocolHeader(); @@ -347,7 +347,7 @@ void ConfigFileFRequest::readSettingsFromFile(){ currentHeaders = &requestHeaders.value().headers_X_form_www_urlencoded; break; default: - throw std::runtime_error(QSTR_TO_CSTR("Unknown body type " + QString::number(static_cast(bodyType)))); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Unknown body type " + QString::number(static_cast(bodyType)))); } if(!currentHeaders->has_value()){ @@ -364,7 +364,7 @@ void ConfigFileFRequest::readSettingsFromFile(){ auto fReadRequestType = [&defaultHeadersNode, &fReadHeaders](const QString &requestText, std::experimental::optional &requestHeaders, const bool hasBody){ - pugi::xml_node currentHeaderNode = defaultHeadersNode.child(QSTR_TO_CSTR(requestText)); + pugi::xml_node currentHeaderNode = defaultHeadersNode.child(QSTR_TO_TEMPORARY_CSTR(requestText)); if(!currentHeaderNode.empty()){ @@ -445,8 +445,8 @@ void ConfigFileFRequest::readSettingsFromFile(){ this->currentSettings.mapOfConfigAuths_UuidToConfigAuth.insert(currProjAuth.projectUuid, currProjAuth); } - if(!doc.save_file(QSTR_TO_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ - throw std::runtime_error(QSTR_TO_CSTR("Error while saving: '" + fileFullPath + "'")); + if(!doc.save_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Error while saving: '" + fileFullPath + "'")); } } catch(const std::exception &e) @@ -522,10 +522,10 @@ void ConfigFileFRequest::upgradeConfigFileIfNecessary(){ pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_file(QSTR_TO_CSTR(this->fileFullPath)); + pugi::xml_parse_result result = doc.load_file(QSTR_TO_TEMPORARY_CSTR(this->fileFullPath)); if(result.status!=pugi::status_ok){ - throw std::runtime_error(QSTR_TO_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); } QString currentConfigVersion = QString(doc.select_single_node("/FRequestConfig").node().attribute("frequestVersion").as_string()); @@ -548,13 +548,13 @@ void ConfigFileFRequest::upgradeConfigFileIfNecessary(){ if(currentConfigVersion == oldVersion){ // Update version - doc.select_single_node("/FRequestConfig").node().attribute("frequestVersion").set_value(QSTR_TO_CSTR(newVersion)); + doc.select_single_node("/FRequestConfig").node().attribute("frequestVersion").set_value(QSTR_TO_TEMPORARY_CSTR(newVersion)); // do specific upgrade changes upgradeFunction(); - if(!doc.save_file(QSTR_TO_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ - throw std::runtime_error(QSTR_TO_CSTR("Error while saving: '" + fileFullPath + "'. After file version upgrade. (to version " + newVersion + " )")); + if(!doc.save_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Error while saving: '" + fileFullPath + "'. After file version upgrade. (to version " + newVersion + " )")); } currentConfigVersion = newVersion; diff --git a/XmlParsers/configfilefrequest.h b/XmlParsers/configfilefrequest.h index 2aef570..75683e6 100644 --- a/XmlParsers/configfilefrequest.h +++ b/XmlParsers/configfilefrequest.h @@ -24,6 +24,8 @@ along with this program. If not, see . #include "Authentications/requestauthentication.h" #include "Authentications/basicauthentication.h" +#include + class ConfigFileFRequest { public: diff --git a/XmlParsers/projectfilefrequest.cpp b/XmlParsers/projectfilefrequest.cpp index cec9f30..18256a8 100644 --- a/XmlParsers/projectfilefrequest.cpp +++ b/XmlParsers/projectfilefrequest.cpp @@ -27,14 +27,14 @@ ProjectFileFRequest::ProjectData ProjectFileFRequest::readProjectDataFromFile(co pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_file(QSTR_TO_CSTR(fileFullPath)); + pugi::xml_parse_result result = doc.load_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath)); if(result.status!=pugi::status_ok){ - throw std::runtime_error(QSTR_TO_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); } if(QString(doc.root().first_child().name()) != "FRequestProject"){ - throw std::runtime_error(QSTR_TO_CSTR(QString(doc.root().name()) + "The file opened is not a valid FRequestProject file. Load aborted.")); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString(doc.root().name()) + "The file opened is not a valid FRequestProject file. Load aborted.")); } QString projFRequestVersion; @@ -44,7 +44,7 @@ ProjectFileFRequest::ProjectData ProjectFileFRequest::readProjectDataFromFile(co } catch (const pugi::xpath_exception& e) { - throw std::runtime_error(QSTR_TO_CSTR(QString("Couldn't find the frequestVersion of the current project. Load aborted.\n") + e.what())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString("Couldn't find the frequestVersion of the current project. Load aborted.\n") + e.what())); } if(projFRequestVersion != GlobalVars::LastCompatibleVersionProjects){ @@ -207,15 +207,15 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con // If file already exists try to read the project file if(!isNewFile){ - pugi::xml_parse_result result = doc.load_file(QSTR_TO_CSTR(fileFullPath)); + pugi::xml_parse_result result = doc.load_file(QSTR_TO_TEMPORARY_CSTR(fileFullPath)); if(result.status!=pugi::status_ok){ - throw std::runtime_error(QSTR_TO_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); } // Try to clear deleted items from projects file if they exist for(const QString ¤tDeletedItemUuid : uuidsToCleanUp){ - pugi::xml_node nodeToDelete = doc.select_node(QSTR_TO_CSTR("/FRequestProject/Request[@uuid='" + currentDeletedItemUuid + "']")).node(); + pugi::xml_node nodeToDelete = doc.select_node(QSTR_TO_TEMPORARY_CSTR("/FRequestProject/Request[@uuid='" + currentDeletedItemUuid + "']")).node(); if(!nodeToDelete.empty()){ nodeToDelete.parent().remove_child(nodeToDelete); @@ -228,10 +228,10 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con rootNode = doc.append_child("FRequestProject"); // create } - createOrGetPugiXmlAttribute(rootNode, "frequestVersion").set_value(QSTR_TO_CSTR(GlobalVars::LastCompatibleVersionProjects)); - createOrGetPugiXmlAttribute(rootNode, "name").set_value(QSTR_TO_CSTR(newProjectData.projectName)); - createOrGetPugiXmlAttribute(rootNode, "mainUrl").set_value(QSTR_TO_CSTR(newProjectData.mainUrl)); - createOrGetPugiXmlAttribute(rootNode, "uuid").set_value(QSTR_TO_CSTR(newProjectData.projectUuid)); + createOrGetPugiXmlAttribute(rootNode, "frequestVersion").set_value(QSTR_TO_TEMPORARY_CSTR(GlobalVars::LastCompatibleVersionProjects)); + createOrGetPugiXmlAttribute(rootNode, "name").set_value(QSTR_TO_TEMPORARY_CSTR(newProjectData.projectName)); + createOrGetPugiXmlAttribute(rootNode, "mainUrl").set_value(QSTR_TO_TEMPORARY_CSTR(newProjectData.mainUrl)); + createOrGetPugiXmlAttribute(rootNode, "uuid").set_value(QSTR_TO_TEMPORARY_CSTR(newProjectData.projectUuid)); createOrGetPugiXmlAttribute(rootNode, "saveIdentCharacter").set_value(static_cast(newProjectData.saveIdentCharacter)); // Delete old auth data if exists (we always need to rebuild it @@ -249,20 +249,20 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con { const RequestAuthentication &requestAuth = static_cast(*newProjectData.authData.get()); - currentAuth.append_attribute("requestUuid").set_value(QSTR_TO_CSTR(requestAuth.requestForAuthenticationUuid)); - currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(requestAuth.username)); - currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(requestAuth.passwordSalt)); + currentAuth.append_attribute("requestUuid").set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.requestForAuthenticationUuid)); + currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.username)); + currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(requestAuth.passwordSalt)); currentAuth.append_child("Password").append_child(pugi::xml_node_type::node_pcdata). - set_value((QSTR_TO_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(requestAuth.passwordSalt, requestAuth.password).toBase64())))); + set_value(QSTR_TO_TEMPORARY_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(requestAuth.passwordSalt, requestAuth.password).toBase64()))); break; } case FRequestAuthentication::AuthenticationType::BASIC_AUTHENTICATION: { const BasicAuthentication &basicAuth = static_cast(*newProjectData.authData.get()); - currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(basicAuth.username)); - currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(basicAuth.passwordSalt)); + currentAuth.append_child("Username").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(basicAuth.username)); + currentAuth.append_child("PasswordSalt").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(basicAuth.passwordSalt)); currentAuth.append_child("Password").append_child(pugi::xml_node_type::node_pcdata). - set_value(QSTR_TO_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(basicAuth.passwordSalt, basicAuth.password).toBase64()))); + set_value(QSTR_TO_TEMPORARY_CSTR(QString(UtilFRequest::simpleStringObfuscationDeobfuscation(basicAuth.passwordSalt, basicAuth.password).toBase64()))); break; } @@ -281,7 +281,7 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con pugi::xml_node requestNode; - pugi::xpath_node xpathRequestNode = doc.select_node(QSTR_TO_CSTR("/FRequestProject/Request[@uuid='" + currentRequest.uuid + "']")); + pugi::xpath_node xpathRequestNode = doc.select_node(QSTR_TO_TEMPORARY_CSTR("/FRequestProject/Request[@uuid='" + currentRequest.uuid + "']")); // if it doesn't exist yet create it if(xpathRequestNode.node().empty()){ @@ -291,12 +291,12 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con requestNode = xpathRequestNode.node(); } - createOrGetPugiXmlAttribute(requestNode, "name").set_value(QSTR_TO_CSTR(currentRequest.name)); - createOrGetPugiXmlAttribute(requestNode, "uuid").set_value(QSTR_TO_CSTR(currentRequest.uuid)); + createOrGetPugiXmlAttribute(requestNode, "name").set_value(QSTR_TO_TEMPORARY_CSTR(currentRequest.name)); + createOrGetPugiXmlAttribute(requestNode, "uuid").set_value(QSTR_TO_TEMPORARY_CSTR(currentRequest.uuid)); createOrGetPugiXmlAttribute(requestNode, "order").set_value(currentRequest.order); createOrGetPugiXmlAttribute(requestNode, "bOverridesMainUrl").set_value(currentRequest.bOverridesMainUrl); - createOrGetPugiXmlAttribute(requestNode, "overrideMainUrl").set_value(QSTR_TO_CSTR(currentRequest.overrideMainUrl)); - createOrGetPugiXmlAttribute(requestNode, "path").set_value(QSTR_TO_CSTR(currentRequest.path)); + createOrGetPugiXmlAttribute(requestNode, "overrideMainUrl").set_value(QSTR_TO_TEMPORARY_CSTR(currentRequest.overrideMainUrl)); + createOrGetPugiXmlAttribute(requestNode, "path").set_value(QSTR_TO_TEMPORARY_CSTR(currentRequest.path)); createOrGetPugiXmlAttribute(requestNode, "type").set_value(static_cast(currentRequest.requestType)); createOrGetPugiXmlAttribute(requestNode, "bDownloadResponseAsFile").set_value(currentRequest.bDownloadResponseAsFile); createOrGetPugiXmlAttribute(requestNode, "bDisableGlobalHeaders").set_value(currentRequest.bDisableGlobalHeaders); @@ -313,16 +313,16 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con for(const UtilFRequest::HttpFormKeyValueType ¤tKeyValue : bodyForm){ pugi::xml_node currentFormKeyValueNode = bodyNode.append_child("FormKeyValue"); - currentFormKeyValueNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentKeyValue.key)); - currentFormKeyValueNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentKeyValue.value)); - currentFormKeyValueNode.append_child("Type").append_child(pugi::node_pcdata).set_value(QSTR_TO_CSTR(QString::number(static_cast(currentKeyValue.type)))); // TODO check if pugixml accepts int directly + currentFormKeyValueNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentKeyValue.key)); + currentFormKeyValueNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentKeyValue.value)); + currentFormKeyValueNode.append_child("Type").append_child(pugi::node_pcdata).set_value(QSTR_TO_TEMPORARY_CSTR(QString::number(static_cast(currentKeyValue.type)))); // TODO check if pugixml accepts int directly } }; switch (currentRequest.bodyType) { case UtilFRequest::BodyType::RAW: { - bodyNode.append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentRequest.body)); + bodyNode.append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentRequest.body)); break; } case UtilFRequest::BodyType::FORM_DATA: @@ -349,8 +349,8 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con for(const UtilFRequest::HttpHeader ¤tRequestHeader : currentRequest.headers){ pugi::xml_node currentRequestHeaderNode = requestHeadersNode.append_child("Header"); - currentRequestHeaderNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentRequestHeader.name)); - currentRequestHeaderNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentRequestHeader.value)); + currentRequestHeaderNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentRequestHeader.name)); + currentRequestHeaderNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentRequestHeader.value)); } } @@ -361,8 +361,8 @@ void ProjectFileFRequest::saveProjectDataToFile(const QString &fileFullPath, con for (const UtilFRequest::HttpHeader ¤tGlobalHeader: newProjectData.globalHeaders) { pugi::xml_node currentGlobalHeaderNode = globalHeadersNode.append_child("Header"); - currentGlobalHeaderNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentGlobalHeader.name)); - currentGlobalHeaderNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_CSTR(currentGlobalHeader.value)); + currentGlobalHeaderNode.append_child("Key").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentGlobalHeader.name)); + currentGlobalHeaderNode.append_child("Value").append_child(pugi::xml_node_type::node_cdata).set_value(QSTR_TO_TEMPORARY_CSTR(currentGlobalHeader.value)); } const pugi::char_t* const identCharacterChar = newProjectData.saveIdentCharacter == UtilFRequest::IdentCharacter::SPACE ? pugiIdentChars::spaceChar : pugiIdentChars::tabChar; @@ -388,10 +388,10 @@ void ProjectFileFRequest::upgradeProjectFileIfNecessary(const QString &filePath) pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_file(QSTR_TO_CSTR(filePath)); + pugi::xml_parse_result result = doc.load_file(QSTR_TO_TEMPORARY_CSTR(filePath)); if(result.status!=pugi::status_ok){ - throw std::runtime_error(QSTR_TO_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(QString("An error ocurred while loading project file.\n") + result.description())); } QString currProjectVersion = QString(doc.select_single_node("/FRequestProject").node().attribute("frequestVersion").as_string()); @@ -417,13 +417,13 @@ void ProjectFileFRequest::upgradeProjectFileIfNecessary(const QString &filePath) pugi::xml_node projectNode = doc.select_single_node("/FRequestProject").node(); // Update version - projectNode.attribute("frequestVersion").set_value(QSTR_TO_CSTR(newVersion)); + projectNode.attribute("frequestVersion").set_value(QSTR_TO_TEMPORARY_CSTR(newVersion)); // do specific upgrade changes upgradeFunction(); - if(!doc.save_file(QSTR_TO_CSTR(filePath), identChar, pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ - throw std::runtime_error(QSTR_TO_CSTR("Error while saving: '" + filePath + "'. After file version upgrade. (to version " + newVersion + " )")); + if(!doc.save_file(QSTR_TO_TEMPORARY_CSTR(filePath), identChar, pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR("Error while saving: '" + filePath + "'. After file version upgrade. (to version " + newVersion + " )")); } currProjectVersion = newVersion; @@ -436,7 +436,7 @@ void ProjectFileFRequest::upgradeProjectFileIfNecessary(const QString &filePath) pugi::xml_node projectNode = doc.select_single_node("/FRequestProject").node(); // Generate an uuid to the project - projectNode.append_attribute("uuid").set_value(QSTR_TO_CSTR(QUuid::createUuid().toString())); + projectNode.append_attribute("uuid").set_value(QSTR_TO_TEMPORARY_CSTR(QUuid::createUuid().toString())); // Add types to form rows diff --git a/XmlParsers/projectfilefrequest.h b/XmlParsers/projectfilefrequest.h index 5eabe81..a0c3817 100644 --- a/XmlParsers/projectfilefrequest.h +++ b/XmlParsers/projectfilefrequest.h @@ -21,6 +21,7 @@ along with this program. If not, see . #define PROJECTFILEFREQUEST_H #include +#include #include "utilfrequest.h" #include "Authentications/requestauthentication.h" diff --git a/mainwindow.cpp b/mainwindow.cpp index fa1218b..8c8eccd 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -19,6 +19,34 @@ along with this program. If not, see . #include "mainwindow.h" #include "ui_mainwindow.h" +#include "about.h" +#include "preferences.h" +#include "utilfrequest.h" +#include "Widgets/frequesttreewidgetprojectitem.h" +#include "HttpRequests/posthttprequest.h" +#include "HttpRequests/puthttprequest.h" +#include "HttpRequests/gethttprequest.h" +#include "HttpRequests/deletehttprequest.h" +#include "HttpRequests/patchhttprequest.h" +#include "HttpRequests/headhttprequest.h" +#include "HttpRequests/tracehttprequest.h" +#include "HttpRequests/optionshttprequest.h" +#include "XmlParsers/configfilefrequest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -28,7 +56,7 @@ MainWindow::MainWindow(QWidget *parent) : // We use this appender because it is the native way to have \r\n in windows in plog library // example: https://github.com/SergiusTheBest/plog/blob/master/samples/NativeEOL/Main.cpp static plog::RollingFileAppender> fileAppender - (QSTR_TO_CSTR(Util::FileSystem::getAppPath() + "/" + GlobalVars::AppLogFileName), 1024*5 /* 5 Mb max log size */, 3); + (QSTR_TO_TEMPORARY_CSTR(Util::FileSystem::getAppPath() + "/" + GlobalVars::AppLogFileName), 1024*5 /* 5 Mb max log size */, 3); plog::init(plog::info, &fileAppender); this->currentSettings = this->configFileManager.getCurrentSettings(); @@ -141,7 +169,7 @@ MainWindow::MainWindow(QWidget *parent) : } else{ // center window if we are not restoring geometry - this->setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,this->size(),qApp->desktop()->availableGeometry())); + this->setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,this->size(),qApp->primaryScreen()->availableGeometry())); } ui->treeWidget->setFocus(); diff --git a/mainwindow.h b/mainwindow.h index eec4ac0..9fb41cd 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -21,46 +21,17 @@ along with this program. If not, see . #define MAINWINDOW_H #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -#include -#include -#include - #include #include -#include "about.h" -#include "preferences.h" #include "projectproperties.h" -#include "utilfrequest.h" #include "updatechecker.h" -#include "Widgets/frequesttreewidgetprojectitem.h" #include "SyntaxHighlighters/frequestjsonhighlighter.h" #include "SyntaxHighlighters/frequestxmlhighlighter.h" - #include "XmlParsers/projectfilefrequest.h" -#include "XmlParsers/configfilefrequest.h" - -#include "HttpRequests/posthttprequest.h" -#include "HttpRequests/puthttprequest.h" -#include "HttpRequests/gethttprequest.h" -#include "HttpRequests/deletehttprequest.h" -#include "HttpRequests/patchhttprequest.h" -#include "HttpRequests/headhttprequest.h" -#include "HttpRequests/tracehttprequest.h" -#include "HttpRequests/optionshttprequest.h" namespace Ui { class MainWindow; diff --git a/readme.txt b/readme.txt index e2d610f..a7234fe 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ readme.txt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -FRequest v1.2 +FRequest v1.2a ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---------------------------------- @@ -33,6 +33,14 @@ manually) FRequest is licensed under GPL 3.0 (https://www.gnu.org/licenses/gpl-3.0.en.html). +---------------------------------- +Supported operating system: +---------------------------------- + +- Windows 7 SP1 and above +- macOS High Sierra (10.13) and above +- Ubuntu 18.04 and above (other Linux distributions dated similar should likely work but are not tested) + ---------------------------------- Installation: ---------------------------------- @@ -41,13 +49,13 @@ Windows / macOS: Just extract the inner FRequest folder to any place in your computer. Run the executable. Linux: -Download the AppImage, make it executable and run the executable. +Extract the inner FRequest folder to any place in your computer, make it executable (chmod +x) and run the executable. -You may need to install "libssl1.0-dev" package to get the ssl requests to work properly +You may need to install openssl 1.1.1 to get the ssl requests to work properly (and also to check for updates within the program). -In ubuntu you can do it like this: -sudo apt-get install libssl1.0-dev +In ubuntu (18.04) you can do it like this: +sudo apt-get install openssl ---------------------------------- Upgrading: @@ -78,6 +86,12 @@ https://github.com/fabiobento512/FRequest ---------------------------------- Change Log: ---------------------------------- +1.2a, 13-03-2022 +- Upgraded Qt version on all platforms to 15.5.2, this fixes the openssl issue for linux users +(the problem that 1.0.1 is not the repositories anymore) and provides support for TLS 1.3 +- Added github actions builds, which simplifies the building on the three supported operating systems a lot +- Minor code refactoring +---------------------------------- 1.2, 18-05-2021 - Added global headers feature (thanks alevalv) - Now request/reponse area is scrollabled (thanks fcolecumberri) diff --git a/updatechecker.cpp b/updatechecker.cpp index aa8da46..0fd66ec 100644 --- a/updatechecker.cpp +++ b/updatechecker.cpp @@ -47,12 +47,12 @@ void UpdateChecker::replyFinished(QNetworkReply *reply){ try{ if(!this->replyHasFinished){ if (reply->error()) { - throw std::runtime_error(QSTR_TO_CSTR(reply->errorString())); + throw std::runtime_error(QSTR_TO_TEMPORARY_CSTR(reply->errorString())); } QString answer = reply->readAll(); - QJsonDocument doc = QJsonDocument::fromJson(QSTR_TO_CSTR(answer)); + QJsonDocument doc = QJsonDocument::fromJson(answer.toUtf8()); if(!doc.isObject()){ throw std::runtime_error("(http api error) json is not an object."); diff --git a/utilfrequest.cpp b/utilfrequest.cpp index 3125fd1..66bfbaa 100755 --- a/utilfrequest.cpp +++ b/utilfrequest.cpp @@ -252,9 +252,9 @@ void addRequestFormBodyRow(QTableWidget * const myTable, const QString &key, con // If it is a file, change the row color to blue in order to differentiate if(type == UtilFRequest::FormKeyValueType::FILE){ - myTable->item(tableSize-1, 0)->setTextColor(Qt::blue); - myTable->item(tableSize-1, 1)->setTextColor(Qt::blue); - addedRowTypeItem->setTextColor(Qt::blue); + myTable->item(tableSize-1, 0)->setForeground(Qt::blue); + myTable->item(tableSize-1, 1)->setForeground(Qt::blue); + addedRowTypeItem->setForeground(Qt::blue); } } @@ -279,7 +279,7 @@ QString getStringFormattedForSerializationType(const QString &content, const Ser case UtilFRequest::SerializationFormatType::XML: { pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_string(QSTR_TO_CSTR(content)); + pugi::xml_parse_result result = doc.load_string(QSTR_TO_TEMPORARY_CSTR(content)); if(result.status != pugi::xml_parse_status::status_ok){ QString errorMessage = "An error occurred while formatting the content as XML: " + content.left(10); @@ -318,7 +318,7 @@ SerializationFormatType getSerializationFormatTypeForString(const QString &conte } pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_string(QSTR_TO_CSTR(QString(content))); + pugi::xml_parse_result result = doc.load_string(QSTR_TO_TEMPORARY_CSTR(content)); if(result.status == pugi::xml_parse_status::status_ok){ return UtilFRequest::SerializationFormatType::XML; diff --git a/utilglobalvars.h b/utilglobalvars.h index 84dfa62..6ffc9a0 100755 --- a/utilglobalvars.h +++ b/utilglobalvars.h @@ -23,7 +23,7 @@ along with this program. If not, see . namespace GlobalVars{ static const QString AppName = "FRequest"; -static const QString AppVersion = "1.2"; +static const QString AppVersion = "1.2a"; static const QString LastCompatibleVersionConfig = "1.2"; static const QString LastCompatibleVersionProjects= "1.2"; static const QString AppConfigFileName = AppName + ".cfg";