From b867500aafa963a662575a74b7f12060af13ea54 Mon Sep 17 00:00:00 2001 From: peri4 Date: Fri, 28 Apr 2023 16:06:27 +0300 Subject: [PATCH] PIValueTreeEdit paste action in add menu add piqt_utils translation --- libs/piqt_utils/lang/piqt_utils_en.ts | 385 ++++++++++++++++++ libs/piqt_utils/lang/piqt_utils_ru.ts | 385 ++++++++++++++++++ libs/piqt_utils/lang/update.bat | 2 + libs/piqt_utils/pivaluetree_edit.cpp | 13 +- .../piqt_utils/pivaluetree_edit_parameters.ui | 12 + 5 files changed, 794 insertions(+), 3 deletions(-) create mode 100644 libs/piqt_utils/lang/piqt_utils_en.ts create mode 100644 libs/piqt_utils/lang/piqt_utils_ru.ts create mode 100644 libs/piqt_utils/lang/update.bat diff --git a/libs/piqt_utils/lang/piqt_utils_en.ts b/libs/piqt_utils/lang/piqt_utils_en.ts new file mode 100644 index 0000000..e493b64 --- /dev/null +++ b/libs/piqt_utils/lang/piqt_utils_en.ts @@ -0,0 +1,385 @@ + + + + + ConnectionEdit + + Connection editor + + + + Name: + + + + Device + + + + Path: + + + + eth://UDP:127.0.0.1:12345:127.0.0.1:12346 + + + + eth://TCP:127.0.0.1:16666 + + + + eth://UDP:192.168.0.5:16666:192.168.0.6:16667:mcast:234.0.2.1:mcast:234.0.2.2 + + + + file://./text.txt + + + + binlog://./logs/:mylog_:1 + + + + ser:///dev/ttyUSB0:9600:8:N:1 + + + + ser://COM32:115200:8:N:1 + + + + usb://0bb4:0c86:1:1:2 + + + + Mode: + + + + Options: + + + + Disconnect timeout: + + + + ms + + + + Buffer size: + + + + b + + + + Add + + + + Modify + + + + Filter + + + + Parameters + + + + Header: + + + + Footer: + + + + Timeout: + + + + Size: + + + + Sender + + + + Frequency: + + + + Hz + + + + Data: + + + + Remove + + + + Clear + + + + error + + + + Equal devices names: "%1"! + + + + + IODeviceEdit + + Edit ... + + + + + IODeviceEditDialog + + IODevice + + + + Type: + + + + Mode: + + + + Options: + + + + + PIValueTreeEdit + + Rename + + + + Input new name: + + + + This name already exists! + + + + New item + + + + No allowed names! + + + + Select new name: + + + + + PIValueTreeEditArray + + Count: + + + + + PIValueTreeEditEnum + + Edit Enum + + + + Name + + + + Value + + + + + PIValueTreeEditParameters + + Read-only + + + + Hidden + + + + Label + + + + Type: + + + + Comment: + + + + Array + + + + Attributes + + + + Remove + + + + Change ... + + + + Rename ... + + + + Value + + + + Group + + + + Reorder ... + + + + Copy + + + + Cut + + + + Paste before + + + + Paste after + + + + Grouping + + + + Change of "%1" + + + + Paste + + + + + PIValueTreeEditReorder + + Change order: + + + + Reorder of "%1" + + + + + PIVariantEdit + + Invalid type + + + + No editor for %1 + + + + + PIVariantEditors::FileBase + + Choose + + + + Select directory + + + + Select file + + + + Absolute path + + + + Existing only + + + + Set filter ... + + + + Select filter + + + + Input filter: + + + + + PIVariantEditors::StringList + + Apply + + + + Add + + + + Remove + + + + Clear + + + + Clear All + + + + Clear All? + + + + diff --git a/libs/piqt_utils/lang/piqt_utils_ru.ts b/libs/piqt_utils/lang/piqt_utils_ru.ts new file mode 100644 index 0000000..cf8f5e7 --- /dev/null +++ b/libs/piqt_utils/lang/piqt_utils_ru.ts @@ -0,0 +1,385 @@ + + + + + ConnectionEdit + + Connection editor + + + + Name: + Имя: + + + Device + Устройство + + + Path: + Путь: + + + eth://UDP:127.0.0.1:12345:127.0.0.1:12346 + + + + eth://TCP:127.0.0.1:16666 + + + + eth://UDP:192.168.0.5:16666:192.168.0.6:16667:mcast:234.0.2.1:mcast:234.0.2.2 + + + + file://./text.txt + + + + binlog://./logs/:mylog_:1 + + + + ser:///dev/ttyUSB0:9600:8:N:1 + + + + ser://COM32:115200:8:N:1 + + + + usb://0bb4:0c86:1:1:2 + + + + Mode: + Режим: + + + Options: + Опции: + + + Disconnect timeout: + Таймаут разъединения: + + + ms + мс + + + Buffer size: + Размер буфера: + + + b + б + + + Add + Добавить + + + Modify + Изменить + + + Filter + Фильтр + + + Parameters + Параметры + + + Header: + Заголовок: + + + Footer: + Окончание: + + + Timeout: + Таймаут: + + + Size: + Размер: + + + Sender + Отправитель + + + Frequency: + Частота: + + + Hz + Гц + + + Data: + Данные: + + + Remove + Удалить + + + Clear + Очистить + + + error + ошибка + + + Equal devices names: "%1"! + Одинаковые имена устройств: "%1"! + + + + IODeviceEdit + + Edit ... + Изменить ... + + + + IODeviceEditDialog + + IODevice + + + + Type: + Тип: + + + Mode: + Режим: + + + Options: + Опции: + + + + PIValueTreeEdit + + Rename + Переименовать + + + Input new name: + Введите новое имя: + + + This name already exists! + Такое имя уже существует! + + + New item + Новый элемент + + + No allowed names! + Нет доступных имён! + + + Select new name: + Выберите новое имя: + + + + PIValueTreeEditArray + + Count: + Количество: + + + + PIValueTreeEditEnum + + Edit Enum + Изменить Enum + + + Name + Имя + + + Value + Значение + + + + PIValueTreeEditParameters + + Read-only + Только для чтения + + + Hidden + Скрыт + + + Label + Метка + + + Type: + Тип: + + + Comment: + Комментарий: + + + Array + Массив + + + Attributes + Атрибуты + + + Remove + Удалить + + + Change ... + Изменить ... + + + Rename ... + Переименовать ... + + + Value + Значение + + + Group + Группа + + + Reorder ... + Изменить порядок ... + + + Copy + Копировать + + + Cut + Вырезать + + + Paste before + Вставить перед + + + Paste after + Вставить после + + + Grouping + Группировка + + + Change of "%1" + Изменение "%1" + + + Paste + Вставить + + + + PIValueTreeEditReorder + + Change order: + Изменить порядок: + + + Reorder of "%1" + Изменение порядка "%1" + + + + PIVariantEdit + + Invalid type + Недействительный тип + + + No editor for %1 + Нет редактора для %1 + + + + PIVariantEditors::FileBase + + Choose + Выбрать + + + Select directory + Выбор директории + + + Select file + Выбор файла + + + Absolute path + Абсолютный путь + + + Existing only + Только существующие + + + Set filter ... + Установить фильтр ... + + + Select filter + Установка фильтра + + + Input filter: + Задайте фильтр: + + + + PIVariantEditors::StringList + + Apply + Применить + + + Add + Добавить + + + Remove + Удалить + + + Clear + Очистить + + + Clear All + Удалить всё + + + Clear All? + Удалить всё? + + + diff --git a/libs/piqt_utils/lang/update.bat b/libs/piqt_utils/lang/update.bat new file mode 100644 index 0000000..b86886b --- /dev/null +++ b/libs/piqt_utils/lang/update.bat @@ -0,0 +1,2 @@ +lupdate ../ -ts piqt_utils_ru.ts +lupdate ../ -ts piqt_utils_en.ts diff --git a/libs/piqt_utils/pivaluetree_edit.cpp b/libs/piqt_utils/pivaluetree_edit.cpp index 9b20e78..0266c87 100644 --- a/libs/piqt_utils/pivaluetree_edit.cpp +++ b/libs/piqt_utils/pivaluetree_edit.cpp @@ -457,6 +457,7 @@ void PIValueTreeEdit::checkActions() { } widget_params->actionPasteBefore->setEnabled(can_paste); widget_params->actionPasteAfter->setEnabled(can_paste); + widget_params->actionPaste->setEnabled(can_paste); } @@ -628,15 +629,21 @@ PIValueTreeEdit::GridWidgets::GridWidgets(PIValueTreeEdit * p) { menu_conf.addActions({wp->actionRename, wp->actionChange, wp->actionReorder}); menu_group.addActions(common_actions); menu_conf.addActions(common_actions); - menu_new.addActions({wp->actionValue, wp->actionGroup, wp->actionArray}); - button_add = new QToolButton(); + menu_new.addActions({wp->actionValue, wp->actionGroup, wp->actionArray, newSeparator(), wp->actionPaste}); + button_add = new ToolButton(); button_add->setIcon(QIcon(":/icons/list-add.png")); button_add->setPopupMode(QToolButton::InstantPopup); button_add->setMenu(&menu_new); + ((ToolButton *)button_add)->setPressHandler([this]() { parent->checkActions(); }); wp->actionValue->setData((int)NewType::Value); wp->actionGroup->setData((int)NewType::Group); wp->actionArray->setData((int)NewType::Array); - connect(button_add, &QToolButton::triggered, this, [this](QAction * a) { parent->newRequest((NewType)a->data().toInt()); }); + connect(button_add, &QToolButton::triggered, this, [this](QAction * a) { + if (a == parent->widget_params->actionPaste) + parent->actionPaste(button_add, "", parent->current.children().size_s() + 1); + else + parent->newRequest((NewType)a->data().toInt()); + }); } diff --git a/libs/piqt_utils/pivaluetree_edit_parameters.ui b/libs/piqt_utils/pivaluetree_edit_parameters.ui index 4458dc0..74f2466 100644 --- a/libs/piqt_utils/pivaluetree_edit_parameters.ui +++ b/libs/piqt_utils/pivaluetree_edit_parameters.ui @@ -209,6 +209,18 @@ Paste after + + + + :/icons/edit-paste.png:/icons/edit-paste.png + + + Paste + + + Paste + +