Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export request to CURL format #86

Merged
merged 15 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/cartero.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<file alias="main_window.ui" compressed="true" preprocess="xml-stripblanks">ui/main_window.ui</file>
<file alias="method_dropdown.ui" compressed="true" preprocess="xml-stripblanks">ui/method_dropdown.ui</file>
<file alias="payload_tab.ui" compressed="true" preprocess="xml-stripblanks">ui/payload_tab.ui</file>
<file alias="export_tab.ui" compressed="true" preprocess="xml-stripblanks">ui/export_tab.ui</file>
<file alias="code_export_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/code_export_pane.ui</file>
<file alias="raw_payload_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/raw_payload_pane.ui</file>
<file alias="response_headers.ui" compressed="true" preprocess="xml-stripblanks">ui/response_headers.ui</file>
<file alias="response_panel.ui" compressed="true" preprocess="xml-stripblanks">ui/response_panel.ui</file>
Expand Down
6 changes: 4 additions & 2 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

blueprint_files = [
'gtk/help_overlay.blp',
'ui/code_export_pane.blp',
'ui/endpoint_pane.blp',
'ui/export_tab.blp',
'ui/formdata_payload_pane.blp',
'ui/main_window.blp',
'ui/main_window_no_csd.blp',
'ui/key_value_pane.blp',
'ui/key_value_row.blp',
danirod marked this conversation as resolved.
Show resolved Hide resolved
'ui/main_window.blp',
'ui/main_window_no_csd.blp',
'ui/method_dropdown.blp',
'ui/payload_tab.blp',
'ui/raw_payload_pane.blp',
Expand Down
66 changes: 66 additions & 0 deletions data/ui/code_export_pane.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2024 the Cartero authors
*
* 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/>.
*/
// SPDX-License-Identifier: GPL-3.0-or-later
using Gtk 4.0;
using GtkSource 5;

template $CarteroCodeExportPane: $CarteroBaseExportPane {
ScrolledWindow {
hexpand: true;
vexpand: true;

Gtk.Overlay {
vexpand: true;
hexpand: true;

GtkSource.View view {
left-margin: 10;
right-margin: 10;
top-margin: 10;
bottom-margin: 10;
smart-backspace: true;
monospace: true;
buffer: buffer;
editable: false;
}

[overlay]
Gtk.Button copy_button {
valign: end;
halign: end;
margin-end: 10;
margin-bottom: 10;
clicked => $on_copy_button_clicked() swapped;

Gtk.Box {
orientation: horizontal;
spacing: 6;

Image {
icon-name: "edit-copy-symbolic";
}

Label {
label: _("Copy");
}
}
}
}
}
}

GtkSource.Buffer buffer {}
8 changes: 8 additions & 0 deletions data/ui/endpoint_pane.blp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ template $CarteroEndpointPane: Adw.BreakpointBin {

child: $CarteroPayloadTab payload_pane {};
}

NotebookPage {
tab: Label {
label: _("Export request");
};

child: $CarteroExportTab export_pane {};
}
}
};

Expand Down
72 changes: 72 additions & 0 deletions data/ui/export_tab.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright 2024 the Cartero authors
*
* 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/>.
*/
// SPDX-License-Identifier: GPL-3.0-or-later
using Gtk 4.0;
using Adw 1;

template $CarteroExportTab: Gtk.Box {
styles [
"background"
]

orientation: vertical;
spacing: 15;

Adw.Clamp {
margin-top: 10;
vexpand: false;

Adw.PreferencesGroup {
Adw.ComboRow combo {
title: _("Export to");
model: entries;
notify::selected => $on_selection_changed() swapped;
}
}
}

Gtk.Box {
orientation: vertical;
vexpand: true;
valign: fill;

Gtk.Separator sep {}

Gtk.Stack stack {
Gtk.StackPage {
name: "none";

child: Adw.Bin {};
}

Gtk.StackPage {
name: "code";

child: $CarteroCodeExportPane code {};
}

visible-child-name: "none";
}
}
}

Gtk.StringList entries {
strings [
_("(none)"),
"cURL",
]
}
10 changes: 9 additions & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ data/cartero.desktop.in.in
data/es.danirod.Cartero.gschema.xml

data/gtk/help_overlay.blp
data/ui/code_export_pane.blp
data/ui/endpoint_pane.blp
data/ui/export_tab.blp
data/ui/formdata_payload_pane.blp
data/ui/key_value_pane.blp
data/ui/key_value_row.blp
Expand All @@ -29,7 +31,13 @@ src/file.rs
src/main.rs
src/objects/key_value_item.rs
src/objects/mod.rs
src/utils/mod.rs
src/widgets/endpoint_pane.rs
src/widgets/export_tab/base.rs
src/widgets/export_tab/code.rs
src/widgets/export_tab/mod.rs
src/widgets/export_tab/service.rs
src/widgets/export_tab/tab.rs
src/widgets/file_dialogs.rs
src/widgets/item_pane.rs
src/widgets/key_value_pane.rs
Expand All @@ -45,4 +53,4 @@ src/widgets/request_body/urlencoded.rs
src/widgets/response_headers.rs
src/widgets/response_panel.rs
src/widgets/save_dialog.rs
src/win.rs
src/win.rs
30 changes: 23 additions & 7 deletions po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: cartero\n"
"Report-Msgid-Bugs-To: https://github.com/danirod/cartero/issues\n"
"POT-Creation-Date: 2024-07-30 15:27+0200\n"
"POT-Creation-Date: 2024-11-01 21:04+0100\n"
"PO-Revision-Date: 2024-07-30 15:26+0200\n"
"Last-Translator: <>\n"
"Language-Team: Catalan\n"
Expand Down Expand Up @@ -124,6 +124,10 @@ msgstr "L'última ubicació on es va obrir un arxiu"
msgid "The last location where a file was saved"
msgstr "L'última ubicació on es va guardar un arxiu"

#: data/ui/code_export_pane.blp:58
msgid "Copy"
msgstr "Copiar"

#: data/ui/endpoint_pane.blp:59
msgid "Request URL"
msgstr "URL de petició"
Expand Down Expand Up @@ -152,6 +156,18 @@ msgstr "Variables"
msgid "Body"
msgstr "Cos"

#: data/ui/endpoint_pane.blp:175
msgid "Export request"
msgstr "Exportar petició"

#: data/ui/export_tab.blp:35
msgid "Export to"
msgstr "Exportar com"

#: data/ui/export_tab.blp:69 data/ui/payload_tab.blp:81
msgid "(none)"
msgstr "(nada)"

#: data/ui/key_value_row.blp:40
msgid "Name"
msgstr "Nom"
Expand Down Expand Up @@ -278,10 +294,6 @@ msgstr "Mètode de petició"
msgid "Body type"
msgstr "Tipus de cos"

#: data/ui/payload_tab.blp:81
msgid "(none)"
msgstr "(nada)"

#: data/ui/payload_tab.blp:82
msgid "URL Encoded"
msgstr "URL Encoded"
Expand Down Expand Up @@ -323,6 +335,10 @@ msgstr "_Descartar"
msgid "_Save"
msgstr "_Guardar"

#: src/widgets/export_tab/code.rs:114
msgid "Content copied to the clipboard"
msgstr "Contingut copiat al porta-retalls"

#: src/widgets/file_dialogs.rs:18
msgid "Request (.cartero)"
msgstr "Petició (.cartero)"
Expand All @@ -343,11 +359,11 @@ msgstr "(sense títol)"
msgid "Draft"
msgstr "Esborrany"

#: src/win.rs:495
#: src/win.rs:516
msgid "The Cartero authors"
msgstr "Els autors de Cartero"

#: src/win.rs:496
#: src/win.rs:517
msgid "© 2024 the Cartero authors"
msgstr "© 2024 Els autors de Cartero"

Expand Down
30 changes: 23 additions & 7 deletions po/cartero.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: cartero\n"
"Report-Msgid-Bugs-To: https://github.com/danirod/cartero/issues\n"
"POT-Creation-Date: 2024-08-05 17:30+0200\n"
"POT-Creation-Date: 2024-11-01 21:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -172,6 +172,10 @@ msgctxt "shortcuts window"
msgid "Send request"
msgstr ""

#: data/ui/code_export_pane.blp:58
msgid "Copy"
msgstr ""

#: data/ui/endpoint_pane.blp:59
msgid "Request URL"
msgstr ""
Expand Down Expand Up @@ -200,6 +204,18 @@ msgstr ""
msgid "Body"
msgstr ""

#: data/ui/endpoint_pane.blp:175
msgid "Export request"
msgstr ""

#: data/ui/export_tab.blp:35
msgid "Export to"
msgstr ""

#: data/ui/export_tab.blp:69 data/ui/payload_tab.blp:81
msgid "(none)"
msgstr ""

#: data/ui/key_value_row.blp:40
msgid "Name"
msgstr ""
Expand Down Expand Up @@ -326,10 +342,6 @@ msgstr ""
msgid "Body type"
msgstr ""

#: data/ui/payload_tab.blp:81
msgid "(none)"
msgstr ""

#: data/ui/payload_tab.blp:82
msgid "URL Encoded"
msgstr ""
Expand Down Expand Up @@ -370,6 +382,10 @@ msgstr ""
msgid "_Save"
msgstr ""

#: src/widgets/export_tab/code.rs:114
msgid "Content copied to the clipboard"
msgstr ""

#: src/widgets/file_dialogs.rs:18
msgid "Request (.cartero)"
msgstr ""
Expand All @@ -390,10 +406,10 @@ msgstr ""
msgid "Draft"
msgstr ""

#: src/win.rs:495
#: src/win.rs:516
msgid "The Cartero authors"
msgstr ""

#: src/win.rs:496
#: src/win.rs:517
msgid "© 2024 the Cartero authors"
msgstr ""
Loading