Skip to content

Commit

Permalink
+ Added correct respose size and header
Browse files Browse the repository at this point in the history
- Removed Ctrl-Z shortcut
  • Loading branch information
trueromanus committed Feb 18, 2025
1 parent 53e9389 commit 72ee6c0
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 20 deletions.
16 changes: 0 additions & 16 deletions src/ListModels/shortcutslistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@
ShortcutsListModel::ShortcutsListModel(QObject *parent)
: QObject{parent}
{
/*auto getOpenApiSchemeSection = new ShortcutSection();
getOpenApiSchemeSection->setMode(m_openApiMode);
getOpenApiSchemeSection->setTitle("Getting Open API Schema");
getOpenApiSchemeSection->setDescription("Load or reaload OpenAPI scheme from remote server");
getOpenApiSchemeSection->addShortcut("Ctrl-Z or F5", "Load scheme");
getOpenApiSchemeSection->addShortcut("Ctrl-B or F4", "Cancel load scheme");
m_sections.append(getOpenApiSchemeSection);
auto addressesManagement = new ShortcutSection();
addressesManagement->setMode(m_openApiMode);
addressesManagement->setTitle("Addresses management");
addressesManagement->setDescription("Create SavedOption and select it later");
addressesManagement->addShortcut("Ctrl-Insert", "Create a new SavedOption from the currently filled fields");
addressesManagement->addShortcut("Ctrl-Home", "Edit current selected SavedOption");
addressesManagement->addShortcut("Ctrl-Tab", "holding Ctrl and further pressing Tab change selected SavedOption");
m_sections.append(addressesManagement);*/
}

void ShortcutsListModel::setFilter(const QString &filter) noexcept
Expand Down
19 changes: 17 additions & 2 deletions src/Models/globalvariablespostscriptmodel.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
ArdorQuery http tester
Copyright (C) 2022 Roman Vladimirov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include "globalvariablespostscriptmodel.h"

GlobalVariablesPostScriptModel::GlobalVariablesPostScriptModel(QObject *parent, GlobalVariablesListModel* globalVariables,
Expand Down Expand Up @@ -38,7 +53,7 @@ QVariantMap GlobalVariablesPostScriptModel::getQueryStatus(const QString &unique
map["hasErrors"] = item->resultModel()->hasError();
map["errorMessage"] = item->resultModel()->networkError();
map["status"] = item->resultModel()->statusCode();
map["responseSize"] = item->resultModel()->responseSize();
map["responseSize"] = item->resultModel()->originResponseSize();

return map;
}
Expand All @@ -59,6 +74,6 @@ QList<QString> GlobalVariablesPostScriptModel::getQueryHeaders(const QString &un

auto item = *iterator;

result.append(item->resultModel()->headers());
result.append(item->resultModel()->rawHeaders());
return result;
}
15 changes: 15 additions & 0 deletions src/Models/globalvariablespostscriptmodel.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
ArdorQuery http tester
Copyright (C) 2022 Roman Vladimirov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef GLOBALVARIABLESPOSTSCRIPTMODEL_H
#define GLOBALVARIABLESPOSTSCRIPTMODEL_H

Expand Down
6 changes: 6 additions & 0 deletions src/Models/postscriptresultmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ void PostScriptResultModel::setErrorMessage(const QString &errorMessage) noexcep
emit errorMessageChanged();
}

void PostScriptResultModel::enableError(const QString &message)
{
setHasErrors(true);
setErrorMessage(message);
}

void PostScriptResultModel::saveToFile(const QString &fileName, bool openAfterSave)
{
emit needSaveToFile(fileName, openAfterSave);
Expand Down
1 change: 1 addition & 0 deletions src/Models/postscriptresultmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PostScriptResultModel : public QObject
QString errorMessage() const noexcept { return m_errorMessage; }
void setErrorMessage(const QString& errorMessage) noexcept;

Q_INVOKABLE void enableError(const QString& message);
Q_INVOKABLE void saveToFile(const QString& fileName, bool openAfterSave);

signals:
Expand Down
1 change: 0 additions & 1 deletion src/ViewModels/backendviewmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ void BackendViewModel::fillMappings()
#endif
m_shortcutCommandMapping.insert("control-backspace", m_changeSelectedQueryCommand);
m_shortcutCommandMapping.insert("control-m", m_performQueriesMultipleCommand);
m_shortcutCommandMapping.insert("control-z", m_performQueryCommand);
m_shortcutCommandMapping.insert("f5", m_performQueryCommand);
m_shortcutCommandMapping.insert("control-b", m_cancelQueryCommand);
m_shortcutCommandMapping.insert("f4", m_cancelQueryCommand);
Expand Down
2 changes: 2 additions & 0 deletions src/ViewModels/httprequestresultviewmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class HttpRequestResultViewModel : public QObject
QStringList headers() const noexcept { return m_displayHeaders; }
void setHeaders(const QStringList& headers) noexcept;

QStringList rawHeaders() const noexcept { return m_headers; }

void setBody(const QByteArray& body) noexcept;
void reformatting() noexcept;

Expand Down
1 change: 0 additions & 1 deletion src/ViewModels/openapiexporterviewmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ void OpenApiExporterViewModel::writeCache(const QString& cacheFile, const QList<
void OpenApiExporterViewModel::fillMappings()
{
m_shortcutCommandMapping.insert("f5", m_loadSchemaCommand);
m_shortcutCommandMapping.insert("control-z", m_loadSchemaCommand);

m_shortcutCommandMapping.insert("f4", m_cancelLoadSchemaCommand);
m_shortcutCommandMapping.insert("control-b", m_cancelLoadSchemaCommand);
Expand Down
15 changes: 15 additions & 0 deletions src/globalenums.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
ArdorQuery http tester
Copyright (C) 2022 Roman Vladimirov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef GLOBALENUMS_H
#define GLOBALENUMS_H

Expand Down
15 changes: 15 additions & 0 deletions src/globalhelpers.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
ArdorQuery http tester
Copyright (C) 2022 Roman Vladimirov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <QUrl>
#include "globalhelpers.h"
#include "globalconstants.h"
Expand Down
15 changes: 15 additions & 0 deletions src/globalhelpers.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
ArdorQuery http tester
Copyright (C) 2022 Roman Vladimirov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <QString>
#include <QDir>
#include <QStandardPaths>
Expand Down

0 comments on commit 72ee6c0

Please sign in to comment.