From da939e30c73453d76cc627538a42861427e20600 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Fri, 22 May 2020 18:25:27 +0300 Subject: [PATCH 01/12] ProjectFilesystemPlugin 1.1.0: pseudo-threaded tree rebuild --- project_fs/ProjectFilesystemPlugin.json.in | 4 ++-- project_fs/projectfilesystemwidget.cpp | 20 ++++++++++++++++++++ project_fs/projectfilesystemwidget.h | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/project_fs/ProjectFilesystemPlugin.json.in b/project_fs/ProjectFilesystemPlugin.json.in index 0d8ab6d..3ae41ba 100644 --- a/project_fs/ProjectFilesystemPlugin.json.in +++ b/project_fs/ProjectFilesystemPlugin.json.in @@ -1,7 +1,7 @@ { \"Name\" : \"ProjectFilesystemPlugin\", - \"Version\" : \"1.0.0\", - \"CompatVersion\" : \"1.0.0\", + \"Version\" : \"1.1.0\", + \"CompatVersion\" : \"1.1.0\", \"Vendor\" : \"Peri4\", \"Copyright\" : \"(C) Peri4\", \"License\" : \"LGPLv3\", diff --git a/project_fs/projectfilesystemwidget.cpp b/project_fs/projectfilesystemwidget.cpp index 764fcf5..b858862 100644 --- a/project_fs/projectfilesystemwidget.cpp +++ b/project_fs/projectfilesystemwidget.cpp @@ -29,6 +29,7 @@ QFileInfo projectfs_menu_target; ProjectFilesystemWidget::ProjectFilesystemWidget(QWidget * parent): QWidget(parent) { setupUi(this); + in_proc = need_rebuild = false; int is = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this); label->setFixedSize(is, is); buttonClear->setIcon(Utils::Icons::CLEAN.icon()); @@ -74,6 +75,7 @@ void ProjectFilesystemWidget::changeEvent(QEvent *e) { void ProjectFilesystemWidget::createTree(QTreeWidgetItem * ti, const QString & dir) { QFileInfoList fl = QDir(dir).entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::LocaleAware | QDir::DirsFirst); + checkProcEvents(); for (QFileInfo i: fl) { QString nit = i.fileName(); if (i.isDir()) { @@ -163,7 +165,20 @@ void ProjectFilesystemWidget::setExtVariable() { } +void ProjectFilesystemWidget::checkProcEvents() { + if (tm.elapsed() < 10) return; + QApplication::processEvents(); + tm.start(); +} + + void ProjectFilesystemWidget::projectsChanged() { + if (in_proc) { + need_rebuild = true; + return; + } + in_proc = true; + tm.start(); last_expanded.clear(); item_map.clear(); int spos = tree->verticalScrollBar()->value(); @@ -192,6 +207,11 @@ void ProjectFilesystemWidget::projectsChanged() { QApplication::restoreOverrideCursor(); qApp->processEvents(); tree->verticalScrollBar()->setValue(spos); + in_proc = false; + if (need_rebuild) { + need_rebuild = false; + projectsChanged(); + } } diff --git a/project_fs/projectfilesystemwidget.h b/project_fs/projectfilesystemwidget.h index a017d13..0832d95 100644 --- a/project_fs/projectfilesystemwidget.h +++ b/project_fs/projectfilesystemwidget.h @@ -6,6 +6,7 @@ #include #include #include +#include #include extern QFileInfo projectfs_menu_target; @@ -32,13 +33,16 @@ protected: void rememberExpanded(QTreeWidgetItem * ti); void restoreExpanded(QTreeWidgetItem * ti); void setExtVariable(); + void checkProcEvents(); + bool in_proc, need_rebuild; ExtensionSystem::IPlugin * proj_plug; QMenu popup_menu; QMap item_map; QSet last_expanded; FilterDialog filter_dialog; FilterDialog::Filter cur_filter; + QElapsedTimer tm; public slots: void projectsChanged(); -- 2.43.0 From a627ea557e8c2722d7b9176cb56d1afadf3e1e65 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Sat, 23 May 2020 16:26:24 +0300 Subject: [PATCH 02/12] DrawTools, ui fix (line mode) --- qad/CMakeLists.txt | 5 ++++- qad/blockview/drawtools.cpp | 12 ++++++------ qad/blockview/drawtools.h | 2 +- qad/blockview/drawtools.ui | 32 ++++++++++++++++---------------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index 6b30462..ef416c2 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -48,7 +48,10 @@ endif() # Version -set(QAD_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/qad_version.h") +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qad_version.h") + file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/qad_version.h") +endif() +set(QAD_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/qad_version.h") set_version(QAD MAJOR "${_QAD_MAJOR}" MINOR "${_QAD_MINOR}" diff --git a/qad/blockview/drawtools.cpp b/qad/blockview/drawtools.cpp index 391c2d0..01631ea 100644 --- a/qad/blockview/drawtools.cpp +++ b/qad/blockview/drawtools.cpp @@ -509,7 +509,7 @@ void DrawTools::alignClicked() { } -void DrawTools::setTollButtonsEnabled(bool pen, bool brush, bool wid_hei) { +void DrawTools::setToolButtonsEnabled(bool pen, bool brush, bool wid_hei) { ui->labelPen->setEnabled(pen); ui->colorButtonPen->setEnabled(pen); ui->labelBrush->setEnabled(brush); @@ -620,7 +620,7 @@ void DrawTools::selectionChanged() { font_dlg.blockSignals(true); font_dlg.setCurrentFont(itext->font()); font_dlg.blockSignals(false); - setTollButtonsEnabled(true, false, false); + setToolButtonsEnabled(true, false, false); ui->widgetAlign2->setEnabled(false); ui->widgetAlign9->setEnabled(false); size_item.assignObject(itext); @@ -631,7 +631,7 @@ void DrawTools::selectionChanged() { font_dlg.blockSignals(true); font_dlg.setCurrentFont(iatext->font()); font_dlg.blockSignals(false); - setTollButtonsEnabled(true, false, false); + setToolButtonsEnabled(true, false, false); foreach (QAction * a, menu_hor.actions()) a->setChecked(false); foreach (QAction * a, menu_ver.actions()) a->setChecked(false); align = iatext->alignment(); @@ -655,7 +655,7 @@ void DrawTools::selectionChanged() { } else if (ipixmap) { ui->stackedProperties->setCurrentIndex(2); ui->spinScale->setValue(sqrt(ipixmap->transform().determinant())); - setTollButtonsEnabled(false, false, false); + setToolButtonsEnabled(false, false, false); size_item.assignObject(ipixmap); } else if (irect || iell) { ui->stackedProperties->setCurrentIndex(1); @@ -675,7 +675,7 @@ void DrawTools::selectionChanged() { ui->colorButtonBrush->setColor(ishape->brush().color()); ui->spinThick->setValue(ishape->pen().widthF()); ui->comboLineStyle->setCurrentIndex(qMin((int)ishape->pen().style(), ui->comboLineStyle->count() - 1)); - setTollButtonsEnabled(true, true, true); + setToolButtonsEnabled(true, true, true); if (resize_enabled) size_item.assignObject(ishape); } @@ -684,7 +684,7 @@ void DrawTools::selectionChanged() { ui->colorButtonPen->setColor(iline->pen().color()); ui->spinThick->setValue(iline->pen().widthF()); ui->comboLineStyle->setCurrentIndex(qMin((int)iline->pen().style(), ui->comboLineStyle->count() - 1)); - setTollButtonsEnabled(true, false, false); + setToolButtonsEnabled(true, false, false); if (resize_enabled) size_item.assignObject(iline); } else { diff --git a/qad/blockview/drawtools.h b/qad/blockview/drawtools.h index 57ec4bd..a0f0042 100644 --- a/qad/blockview/drawtools.h +++ b/qad/blockview/drawtools.h @@ -94,7 +94,7 @@ protected: bool eventFilter(QObject * o, QEvent * e); QAction * newAction(const QString & text, const QIcon & icon, int type); - void setTollButtonsEnabled(bool pen, bool brush, bool wid_hei); + void setToolButtonsEnabled(bool pen, bool brush, bool wid_hei); void blockPropSignals(bool block_); void actionAlignTrigger(bool vert, Qt::AlignmentFlag value); void emitZAvailabe(QGraphicsItem * item = 0); diff --git a/qad/blockview/drawtools.ui b/qad/blockview/drawtools.ui index 86776a9..849f997 100644 --- a/qad/blockview/drawtools.ui +++ b/qad/blockview/drawtools.ui @@ -526,22 +526,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - @@ -561,6 +545,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + -- 2.43.0 From 3137dc7c034cd2187895a6e5ff528ed3df86148b Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Sat, 23 May 2020 16:39:06 +0300 Subject: [PATCH 03/12] pip --- pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip b/pip index 51a76be..e04e619 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit 51a76be487384b392adb0c6ff70ba9391bf5a64b +Subproject commit e04e6199e3dda5e601b1da5e2d404d05b8f1dec0 -- 2.43.0 From 8dd574fef1d2f7692bbef424f789c53cda858ffe Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Sat, 23 May 2020 17:42:30 +0300 Subject: [PATCH 04/12] pip --- pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip b/pip index e04e619..a5809d5 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit e04e6199e3dda5e601b1da5e2d404d05b8f1dec0 +Subproject commit a5809d5f39b79d2d4855657401faaa78788e1a77 -- 2.43.0 From 0418638fc9ccb1ea18479f89c950e179d095fd57 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Sat, 23 May 2020 21:42:00 +0300 Subject: [PATCH 05/12] QPIConfig multiline support --- pip | 2 +- qad/CMakeLists.txt | 2 +- qad/utils/qpiconfig.cpp | 53 +++++++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/pip b/pip index a5809d5..21f8a03 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit a5809d5f39b79d2d4855657401faaa78788e1a77 +Subproject commit 21f8a035d8ca050bd535a2fdc00058a9be2679f9 diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index ef416c2..5fb0ea8 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(qad) set(_QAD_MAJOR 1) set(_QAD_MINOR 2) -set(_QAD_REVISION 0) +set(_QAD_REVISION 1) set(_QAD_SUFFIX beta) set(_QAD_COMPANY SHS) set(_QAD_DOMAIN org.SHS) diff --git a/qad/utils/qpiconfig.cpp b/qad/utils/qpiconfig.cpp index 785b3cb..e415072 100644 --- a/qad/utils/qpiconfig.cpp +++ b/qad/utils/qpiconfig.cpp @@ -243,6 +243,7 @@ QPIConfig::QPIConfig(const QString & path, QIODevice::OpenMode mode, QPIConfig:: type = type_; if (!path.isEmpty()) { open(mode); + incdirs << QFileInfo(path).absoluteDir().path(); parse(); } } @@ -253,6 +254,7 @@ QPIConfig::QPIConfig(const QString & path, QIODevice::OpenMode mode): QFile(path type = Config; if (!path.isEmpty()) { open(mode); + incdirs << QFileInfo(path).absoluteDir().path(); parse(); } } @@ -263,6 +265,7 @@ QPIConfig::QPIConfig(const QString & path, QPIConfig::FileType type_): QFile(pat type = type_; if (!path.isEmpty()) { open(QIODevice::ReadWrite); + incdirs << QFileInfo(path).absoluteDir().path(); parse(); } } @@ -748,9 +751,9 @@ void QPIConfig::parse(QString content) { root.clear(); QString src, str, tab, comm, all, name, type, prefix, tprefix; QStringList tree; - Entry * entry, * te, * ce; + Entry * entry = 0, * te = 0, * ce = 0; int ind, sind; - bool isNew, isPrefix; + bool isNew = false, isPrefix = false, wasMultiline = false, isMultiline = false; foreach (QPIConfig * c, inc_devs) delete c; inc_devs.clear(); @@ -781,22 +784,42 @@ void QPIConfig::parse(QString content) { tab = str.left(str.indexOf(str.trimmed().left(1))); str = str.trimmed(); all = str; + + sind = str.indexOf('#'); + if (sind > 0) { + comm = str.mid(sind + 1).trimmed(); + if (comm.length() > 0) { + type = comm[0]; + comm = comm.mid(1).trimmed(); + } else type = "s"; + str = str.left(sind).trimmed(); + } else { + type = "s"; + comm = ""; + } + + if (str.endsWith("\\")) { + isMultiline = true; + str.chop(1); + str = str.trimmed(); + } else + isMultiline = false; + + if (wasMultiline) { + wasMultiline = false; + if (ce) { + ce->_value += str; + ce->_all += "\\\n" + all; + } + str.clear(); + } + wasMultiline = isMultiline; + ind = str.indexOf('='); if ((ind > 0) && !(str[0] == '#')) { - sind = str.indexOf('#'); - if (sind > 0) { - comm = str.right(str.length() - sind - 1).trimmed(); - if (comm.length() > 0) type = comm[0]; - else type = "s"; - comm = comm.right(comm.length() - 1).trimmed(); - str = str.left(sind); - } else { - type = "s"; - comm = ""; - } tree = (prefix + str.left(ind).trimmed()).split(delim); if (tree.front() == "include") { - name = str.right(str.length() - ind - 1).trimmed(); + name = str.mid(ind + 1).trimmed(); QPIConfig * iconf = new QPIConfig(name, incdirs); if (!iconf->dev) { delete iconf; @@ -832,7 +855,7 @@ void QPIConfig::parse(QString content) { ce->delim = delim; ce->_tab = tab; ce->_name = name; - ce->_value = str.right(str.length() - ind - 1).trimmed(); + ce->_value = str.mid(ind + 1).trimmed(); ce->_type = type; ce->_comment = comm; ce->_line = lines; -- 2.43.0 From da32c7c7238c59626f74d93113ae54a8d42317e3 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Sat, 23 May 2020 21:55:31 +0300 Subject: [PATCH 06/12] multiline fix --- pip | 2 +- qad/utils/qpiconfig.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pip b/pip index 21f8a03..6413e77 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit 21f8a035d8ca050bd535a2fdc00058a9be2679f9 +Subproject commit 6413e7747e5843356f75265bf29b2e758aa57816 diff --git a/qad/utils/qpiconfig.cpp b/qad/utils/qpiconfig.cpp index e415072..1a8b05a 100644 --- a/qad/utils/qpiconfig.cpp +++ b/qad/utils/qpiconfig.cpp @@ -798,9 +798,9 @@ void QPIConfig::parse(QString content) { comm = ""; } - if (str.endsWith("\\")) { + if (str.endsWith(" \\")) { isMultiline = true; - str.chop(1); + str.chop(2); str = str.trimmed(); } else isMultiline = false; @@ -809,10 +809,11 @@ void QPIConfig::parse(QString content) { wasMultiline = false; if (ce) { ce->_value += str; - ce->_all += "\\\n" + all; + ce->_all += " \\\n" + all; } str.clear(); - } + } else + ce = 0; wasMultiline = isMultiline; ind = str.indexOf('='); -- 2.43.0 From 6a84167a581240ce2d8fac91748e05dda0ac0dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 25 May 2020 11:49:49 +0300 Subject: [PATCH 07/12] add default session path --- qad/widgets/session_manager.cpp | 27 +++++++++++++++++---------- qad/widgets/session_manager.h | 3 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/qad/widgets/session_manager.cpp b/qad/widgets/session_manager.cpp index 065bcdb..e05d830 100644 --- a/qad/widgets/session_manager.cpp +++ b/qad/widgets/session_manager.cpp @@ -7,6 +7,15 @@ # include #endif #include "session_manager.h" +#include "qad_locations.h" + + +SessionManager::SessionManager(QString file) { + if (file.isEmpty() && !QCoreApplication::applicationName().isEmpty()) { + file = QAD::userPath(QAD::ltConfig, "session"); + } + setFile(file); +} void SessionManager::setFile(const QString & file) { @@ -34,7 +43,10 @@ void SessionManager::removeMainWidget(QWidget * e) { void SessionManager::save() { - if (file_.isEmpty()) return; + if (file_.isEmpty()) { + qDebug() << "[SessionManager] filename is empty"; + return; + } QPIConfig sr(file_); QObjectList tsc; for (int i = 0; i < mwindows.size(); ++i) { @@ -137,19 +149,14 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) { srect.y() + (srect.height() - w->height()) / 2, w->width(), w->height()); } - /*if (w->windowState().testFlag(Qt::WindowMaximized)) { - foreach (QScreen * s, sl) { - if (s->geometry().contains(w->geometry())) { - //w->setGeometry(s->availableGeometry()); - break; - } - } - }*/ } void SessionManager::load(bool onlyMainwindow) { - if (file_.isEmpty()) return; + if (file_.isEmpty()) { + qDebug() << "[SessionManager] filename is empty"; + return; + } QPIConfig sr(file_); QObjectList tsc; for (int i = 0; i < mwindows.size(); ++i) { diff --git a/qad/widgets/session_manager.h b/qad/widgets/session_manager.h index faf058b..d788b2c 100644 --- a/qad/widgets/session_manager.h +++ b/qad/widgets/session_manager.h @@ -47,8 +47,7 @@ class QAD_EXPORT SessionManager: public QObject { Q_OBJECT public: - SessionManager(const QString & file = QString()) {setFile(file);} - ~SessionManager() {;} + SessionManager(QString file = QString()); void setFile(const QString & file); -- 2.43.0 From 1384cf3c217a0e0cffae3dba1ab86c4ddb9ac079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 25 May 2020 11:49:49 +0300 Subject: [PATCH 08/12] add default session path --- qad/CMakeLists.txt | 6 +++--- qad/widgets/session_manager.cpp | 27 +++++++++++++++++---------- qad/widgets/session_manager.h | 3 +-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index 5fb0ea8..d9575a8 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(qad) set(_QAD_MAJOR 1) -set(_QAD_MINOR 2) -set(_QAD_REVISION 1) -set(_QAD_SUFFIX beta) +set(_QAD_MINOR 3) +set(_QAD_REVISION 0) +set(_QAD_SUFFIX alpha) set(_QAD_COMPANY SHS) set(_QAD_DOMAIN org.SHS) diff --git a/qad/widgets/session_manager.cpp b/qad/widgets/session_manager.cpp index 065bcdb..e05d830 100644 --- a/qad/widgets/session_manager.cpp +++ b/qad/widgets/session_manager.cpp @@ -7,6 +7,15 @@ # include #endif #include "session_manager.h" +#include "qad_locations.h" + + +SessionManager::SessionManager(QString file) { + if (file.isEmpty() && !QCoreApplication::applicationName().isEmpty()) { + file = QAD::userPath(QAD::ltConfig, "session"); + } + setFile(file); +} void SessionManager::setFile(const QString & file) { @@ -34,7 +43,10 @@ void SessionManager::removeMainWidget(QWidget * e) { void SessionManager::save() { - if (file_.isEmpty()) return; + if (file_.isEmpty()) { + qDebug() << "[SessionManager] filename is empty"; + return; + } QPIConfig sr(file_); QObjectList tsc; for (int i = 0; i < mwindows.size(); ++i) { @@ -137,19 +149,14 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) { srect.y() + (srect.height() - w->height()) / 2, w->width(), w->height()); } - /*if (w->windowState().testFlag(Qt::WindowMaximized)) { - foreach (QScreen * s, sl) { - if (s->geometry().contains(w->geometry())) { - //w->setGeometry(s->availableGeometry()); - break; - } - } - }*/ } void SessionManager::load(bool onlyMainwindow) { - if (file_.isEmpty()) return; + if (file_.isEmpty()) { + qDebug() << "[SessionManager] filename is empty"; + return; + } QPIConfig sr(file_); QObjectList tsc; for (int i = 0; i < mwindows.size(); ++i) { diff --git a/qad/widgets/session_manager.h b/qad/widgets/session_manager.h index faf058b..d788b2c 100644 --- a/qad/widgets/session_manager.h +++ b/qad/widgets/session_manager.h @@ -47,8 +47,7 @@ class QAD_EXPORT SessionManager: public QObject { Q_OBJECT public: - SessionManager(const QString & file = QString()) {setFile(file);} - ~SessionManager() {;} + SessionManager(QString file = QString()); void setFile(const QString & file); -- 2.43.0 From 69b0ee9d1acbdf4c7ad91c9ec0ff7a7dee7246a2 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Mon, 25 May 2020 13:56:55 +0300 Subject: [PATCH 09/12] EMainWindow session fix --- qad/application/emainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qad/application/emainwindow.cpp b/qad/application/emainwindow.cpp index 13968a8..9196281 100644 --- a/qad/application/emainwindow.cpp +++ b/qad/application/emainwindow.cpp @@ -31,7 +31,6 @@ action_show_all_docks(this), action_hide_all_docks(this), first_show(true) { EMainWindow::~EMainWindow() { if (tid > 0) killTimer(tid); tid = 0; - saveSession(); } @@ -72,6 +71,7 @@ void EMainWindow::showEvent(QShowEvent * e) { void EMainWindow::closeEvent(QCloseEvent * e) { if (!checkSave()) e->ignore(); + else saveSession(); } -- 2.43.0 From c1fa3751453dd9abcb30bb5b64c406a6183ca8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 25 May 2020 16:59:19 +0300 Subject: [PATCH 10/12] add dynamic language change support add "en" ts --- qad/application/aboutwindow.cpp | 1 + qad/application/emainwindow.cpp | 16 + qad/application/emainwindow.h | 1 + qad/application/etabwidget.cpp | 12 + qad/application/etabwidget.h | 1 + qad/application/historyview.cpp | 13 + qad/application/historyview.h | 1 + qad/application/lang/qad_application_en.ts | 105 ++++ qad/application/lang/qad_application_ru.ts | 2 +- qad/application/lang/update.bat | 1 + qad/application/ribbon.cpp | 12 + qad/application/ribbon.h | 1 + qad/blockview/blockeditor.cpp | 21 +- qad/blockview/blockeditor.h | 1 + qad/blockview/drawtools.cpp | 61 +- qad/blockview/drawtools.h | 7 +- qad/blockview/lang/qad_blockview_en.ts | 383 ++++++++++++ qad/blockview/lang/qad_blockview_ru.ts | 74 ++- qad/blockview/lang/update.bat | 1 + qad/graphic/graphic.cpp | 2 +- qad/graphic/graphic_conf.cpp | 2 +- qad/graphic/lang/qad_graphic_en.ts | 387 ++++++++++++ qad/graphic/lang/qad_graphic_ru.ts | 10 +- qad/graphic/lang/update.bat | 1 + qad/sql_table/lang/qad_sql_table_en.ts | 54 ++ qad/sql_table/lang/update.bat | 1 + qad/sql_table/sql_table_widget.cpp | 13 + qad/sql_table/sql_table_widget.h | 1 + qad/widgets/chardialog.cpp | 2 +- qad/widgets/clineedit.cpp | 2 +- qad/widgets/colorbutton.cpp | 20 +- qad/widgets/colorbutton.h | 2 + qad/widgets/ecombobox.cpp | 14 + qad/widgets/ecombobox.h | 2 + qad/widgets/evalspinbox.cpp | 2 +- qad/widgets/lang/qad_widgets_en.ts | 677 +++++++++++++++++++++ qad/widgets/lang/qad_widgets_ru.ts | 198 +++--- qad/widgets/lang/update.bat | 1 + qad/widgets/matrixedit.cpp | 12 + qad/widgets/matrixedit.h | 1 + qad/widgets/qcodeedit.cpp | 13 + qad/widgets/qcodeedit.h | 1 + qad/widgets/qpiconfigwidget.cpp | 26 +- qad/widgets/qpointedit.cpp | 2 +- qad/widgets/qrectedit.cpp | 2 +- qad/widgets/qvariantedit.cpp | 4 +- qad/widgets/shortcuts.cpp | 2 + qglview/globject_editor.cpp | 1 - qglview/material_editor.cpp | 1 - qglview/material_map_editor.cpp | 1 - 50 files changed, 1965 insertions(+), 206 deletions(-) create mode 100644 qad/application/lang/qad_application_en.ts create mode 100644 qad/blockview/lang/qad_blockview_en.ts create mode 100644 qad/graphic/lang/qad_graphic_en.ts create mode 100644 qad/sql_table/lang/qad_sql_table_en.ts create mode 100644 qad/widgets/lang/qad_widgets_en.ts diff --git a/qad/application/aboutwindow.cpp b/qad/application/aboutwindow.cpp index 49d605a..14169de 100644 --- a/qad/application/aboutwindow.cpp +++ b/qad/application/aboutwindow.cpp @@ -154,6 +154,7 @@ void AboutWindow::changeEvent(QEvent *e) { switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); + setWindowTitle(QApplication::applicationName() + " - " + tr("About")); break; case QEvent::FontChange: case QEvent::Polish: diff --git a/qad/application/emainwindow.cpp b/qad/application/emainwindow.cpp index 9196281..4bd3da6 100644 --- a/qad/application/emainwindow.cpp +++ b/qad/application/emainwindow.cpp @@ -119,6 +119,22 @@ void EMainWindow::timerEvent(QTimerEvent * e) { } +void EMainWindow::changeEvent(QEvent * e) { + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + action_show_all_tools.setText(tr("Show all")); + action_show_all_docks.setText(tr("Show all")); + action_hide_all_tools.setText(tr("Hide all")); + action_hide_all_docks.setText(tr("Hide all")); + action_clear_recent->setText(tr("Clear recent list")); + break; + default: + break; + } +} + + QMenu * EMainWindow::createPopupMenu() { QMenu * menuPopup = new QMenu; QWidgetAction * wa; diff --git a/qad/application/emainwindow.h b/qad/application/emainwindow.h index abce86f..87faa61 100644 --- a/qad/application/emainwindow.h +++ b/qad/application/emainwindow.h @@ -92,6 +92,7 @@ protected: void closeEvent(QCloseEvent * ); bool eventFilter(QObject * o, QEvent * e); void timerEvent(QTimerEvent * e); + void changeEvent(QEvent * e); QMenu * createPopupMenu(); void addToRecent(const QString & path); void prepareRecent(); diff --git a/qad/application/etabwidget.cpp b/qad/application/etabwidget.cpp index 4da9dc3..437409f 100644 --- a/qad/application/etabwidget.cpp +++ b/qad/application/etabwidget.cpp @@ -91,6 +91,18 @@ bool ETabWidget::eventFilter(QObject * o, QEvent * e) { } +void ETabWidget::changeEvent(QEvent * e) { + QTabWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + retranslate(); + break; + default: + break; + } +} + + void ETabWidget::buttonClicked() { QToolButton * s = qobject_cast(sender()); if (s == 0) return; diff --git a/qad/application/etabwidget.h b/qad/application/etabwidget.h index 3296251..bf0346d 100644 --- a/qad/application/etabwidget.h +++ b/qad/application/etabwidget.h @@ -49,6 +49,7 @@ private: bool eventFilter(QObject * o, QEvent * e); void tabInserted(int) {emit countChanged();} void tabRemoved(int) {emit countChanged();} + void changeEvent(QEvent * e); struct TabButton { TabButton(int r, const QIcon & i, const QString & t) {role = r; icon = i; visible = true; srcToolTip = t; toolTip = QApplication::translate("MainWindow", t.toUtf8(), 0/*, QCoreApplication::UnicodeUTF8*/);} diff --git a/qad/application/historyview.cpp b/qad/application/historyview.cpp index 2e13223..1be0263 100644 --- a/qad/application/historyview.cpp +++ b/qad/application/historyview.cpp @@ -1,4 +1,5 @@ #include "historyview.h" +#include HistoryView::HistoryView(QWidget* parent): QListWidget(parent) { @@ -89,6 +90,18 @@ void HistoryView::checkLimit() { } +void HistoryView::changeEvent(QEvent * e) { + QListWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + actions_[-1].text = tr("History cleared"); + break; + default: + break; + } +} + + void HistoryView::itemClicked(QListWidgetItem * item) { if (!active_) return; if (index == row(item) + 1) return; diff --git a/qad/application/historyview.h b/qad/application/historyview.h index 9634bb6..f46d0a4 100644 --- a/qad/application/historyview.h +++ b/qad/application/historyview.h @@ -65,6 +65,7 @@ private: }; void checkLimit(); + void changeEvent(QEvent * e); QString actionText(int action, int count_); QMap actions_; diff --git a/qad/application/lang/qad_application_en.ts b/qad/application/lang/qad_application_en.ts new file mode 100644 index 0000000..0027b17 --- /dev/null +++ b/qad/application/lang/qad_application_en.ts @@ -0,0 +1,105 @@ + + + + + AboutWindow + + + - About + + + + + Versions + + + + + Build + + + + + Authors + + + + + About Qt... + + + + + OK + + + + + About + + + + + EMainWindow + + + Clear recent list + + + + + + Show all + + + + + + Hide all + + + + + Toolbars + + + + + Docks + + + + + Select file to open + + + + + Select files to open + + + + + Save changes%1? + + + + + in + + + + + Select file to save + + + + + HistoryView + + + History cleared + + + + diff --git a/qad/application/lang/qad_application_ru.ts b/qad/application/lang/qad_application_ru.ts index ea95b5e..eaa3765 100644 --- a/qad/application/lang/qad_application_ru.ts +++ b/qad/application/lang/qad_application_ru.ts @@ -31,7 +31,7 @@ OK - + diff --git a/qad/application/lang/update.bat b/qad/application/lang/update.bat index d67bb8b..34f3eee 100644 --- a/qad/application/lang/update.bat +++ b/qad/application/lang/update.bat @@ -1 +1,2 @@ lupdate ../ -ts qad_application_ru.ts +lupdate ../ -ts qad_application_en.ts diff --git a/qad/application/ribbon.cpp b/qad/application/ribbon.cpp index d8664e1..a17ad7d 100644 --- a/qad/application/ribbon.cpp +++ b/qad/application/ribbon.cpp @@ -49,6 +49,18 @@ void Ribbon::timerEvent(QTimerEvent * e) { } +void Ribbon::changeEvent(QEvent * e) { + QToolBar::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + retranslate(); + break; + default: + break; + } +} + + void Ribbon::_resize() { return; // WARNING for (int i = 0; i < tab->count(); ++i) { diff --git a/qad/application/ribbon.h b/qad/application/ribbon.h index 8d2de58..d189e72 100644 --- a/qad/application/ribbon.h +++ b/qad/application/ribbon.h @@ -54,6 +54,7 @@ public: private: bool eventFilter(QObject * o, QEvent * e); void timerEvent(QTimerEvent * e); + void changeEvent(QEvent *e); void _resize(); void _setIconsSize(); diff --git a/qad/blockview/blockeditor.cpp b/qad/blockview/blockeditor.cpp index f2fa148..0bbdbf3 100644 --- a/qad/blockview/blockeditor.cpp +++ b/qad/blockview/blockeditor.cpp @@ -173,6 +173,17 @@ bool BlockEditor::eventFilter(QObject *o, QEvent *e) { } +void BlockEditor::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: break; + } +} + + void BlockEditor::on_actionRemove_items_triggered() { QList si = ui->blockView->scene()->selectedItems(); foreach (QGraphicsItem * i, si) @@ -342,12 +353,12 @@ QWidget * PinAlignDelegate::createEditor(QWidget * parent, const QStyleOptionVie QString PinAlignDelegate::displayText(const QVariant & value, const QLocale & locale) const { int cv = value.toInt(); switch (cv) { - case Qt::AlignLeft: return "Left"; break; - case Qt::AlignRight: return "Right"; break; - case Qt::AlignTop: return "Top"; break; - case Qt::AlignBottom: return "Bottom"; break; + case Qt::AlignLeft: return tr("Left"); break; + case Qt::AlignRight: return tr("Right"); break; + case Qt::AlignTop: return tr("Top"); break; + case Qt::AlignBottom: return tr("Bottom"); break; } - return "unknown"; + return tr("unknown"); } diff --git a/qad/blockview/blockeditor.h b/qad/blockview/blockeditor.h index e380e48..5342bcb 100644 --- a/qad/blockview/blockeditor.h +++ b/qad/blockview/blockeditor.h @@ -71,6 +71,7 @@ private slots: private: bool eventFilter(QObject * o, QEvent * e); + void changeEvent(QEvent * e); Ui::BlockEditor *ui; QMap pin_tli; diff --git a/qad/blockview/drawtools.cpp b/qad/blockview/drawtools.cpp index 01631ea..0e6abe3 100644 --- a/qad/blockview/drawtools.cpp +++ b/qad/blockview/drawtools.cpp @@ -225,7 +225,7 @@ bool _DTSizeItem::sceneEventFilter(QGraphicsItem * watched, QEvent * event) { -DrawTools::DrawTools(BlockView * parent): QObject(parent), +DrawTools::DrawTools(BlockView * parent): QWidget(parent), actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom(this) { widget_props = new QWidget(); ui = new Ui::DrawTools(); @@ -238,9 +238,6 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( int fh = qMax(QApplication::fontMetrics().size(0, "0").height(), 22); int thick = lineThickness(); QSize sz(fh * 2.5, fh); - QStringList styles; - styles << tr("NoPen") << tr("Solid") << tr("Dash") - << tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot"); ui->comboLineStyle->setIconSize(sz); for (int i = 0; i < 6; i++) { QPixmap pix(sz); @@ -249,7 +246,7 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( p.setPen(QPen(Qt::black, thick, (Qt::PenStyle)i)); p.drawLine(0, pix.height() / 2, pix.width(), pix.height() / 2); p.end(); - ui->comboLineStyle->addItem(QIcon(pix), styles[i]); + ui->comboLineStyle->addItem(QIcon(pix), ""); } #ifdef Q_OS_MACOS setAlignCompact(true); @@ -264,22 +261,21 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( new_item = cur_item = 0; view_ = 0; resize_enabled = true; - text_dlg.setWindowTitle(tr("Edit text")); text_dlg.setLayout(new QBoxLayout(QBoxLayout::TopToBottom)); QDialogButtonBox * bbox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel); connect(bbox, SIGNAL(accepted()), &text_dlg, SLOT(accept())); connect(bbox, SIGNAL(rejected()), &text_dlg, SLOT(reject())); text_dlg.layout()->addWidget(&text_edit); text_dlg.layout()->addWidget(bbox); - actions_Z_up.setText(tr("Bring\nforward")); actions_Z_up.setIcon(QIcon(":/icons/z-up.png")); actions_Z_up.setEnabled(false); - actions_Z_top.setText(tr("Bring\nto front")); actions_Z_top.setIcon(QIcon(":/icons/z-top.png")); actions_Z_top.setEnabled(false); - actions_Z_down.setText(tr("Send\nbackward")); actions_Z_down.setIcon(QIcon(":/icons/z-down.png")); actions_Z_down.setEnabled(false); - actions_Z_bottom.setText(tr("Send\nto back")); actions_Z_bottom.setIcon(QIcon(":/icons/z-bottom.png")); actions_Z_bottom.setEnabled(false); - actions_add << newAction(tr("Draw\nRectangle"), QIcon(":/icons/draw-rectangle.png"), 1) - << newAction(tr("Draw\nEllipse"), QIcon(":/icons/draw-ellipse.png"), 2) - << newAction(tr("Draw\nLine"), QIcon(":/icons/draw-line.png"), 4) - << newAction(tr("Draw\nText"), QIcon(":/icons/draw-text.png"), 0) - << newAction(tr("Draw\nImage"), QIcon(":/icons/view-preview.png"), 3); + actions_Z_up.setIcon(QIcon(":/icons/z-up.png")); actions_Z_up.setEnabled(false); + actions_Z_top.setIcon(QIcon(":/icons/z-top.png")); actions_Z_top.setEnabled(false); + actions_Z_down.setIcon(QIcon(":/icons/z-down.png")); actions_Z_down.setEnabled(false); + actions_Z_bottom.setIcon(QIcon(":/icons/z-bottom.png")); actions_Z_bottom.setEnabled(false); + actions_add << newAction(QIcon(":/icons/draw-rectangle.png"), 1) + << newAction(QIcon(":/icons/draw-ellipse.png"), 2) + << newAction(QIcon(":/icons/draw-line.png"), 4) + << newAction(QIcon(":/icons/draw-text.png"), 0) + << newAction(QIcon(":/icons/view-preview.png"), 3); buttons_align << ui->buttonAlignTL << ui->buttonAlignTC << ui->buttonAlignTR << ui->buttonAlignCL << ui->buttonAlignCC << ui->buttonAlignCR << ui->buttonAlignBL << ui->buttonAlignBC << ui->buttonAlignBR; @@ -321,6 +317,7 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( connect(&actions_Z_down, SIGNAL(triggered(bool)), this, SLOT(actionZ_triggered())); connect(&actions_Z_bottom, SIGNAL(triggered(bool)), this, SLOT(actionZ_triggered())); setBlockView(parent); + retranslate(); } @@ -331,6 +328,24 @@ DrawTools::~DrawTools() { } +void DrawTools::retranslate() { + QStringList styles; + styles << tr("NoPen") << tr("Solid") << tr("Dash") + << tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot"); + for (int i = 0; i < styles.size(); i++) ui->comboLineStyle->setItemText(i, styles[i]); + text_dlg.setWindowTitle(tr("Edit text")); + actions_Z_up.setText(tr("Bring\nforward")); + actions_Z_top.setText(tr("Bring\nto front")); + actions_Z_down.setText(tr("Send\nbackward")); + actions_Z_bottom.setText(tr("Send\nto back")); + actions_add[0]->setText(tr("Draw\nRectangle")); + actions_add[1]->setText(tr("Draw\nEllipse")); + actions_add[2]->setText(tr("Draw\nLine")); + actions_add[3]->setText(tr("Draw\nText")); + actions_add[4]->setText(tr("Draw\nImage")); +} + + void DrawTools::setBlockView(BlockView * v) { if (view_) view_->viewport()->removeEventFilter(this); disconnect(this, SLOT(selectionChanged())); @@ -454,6 +469,18 @@ bool DrawTools::eventFilter(QObject * o, QEvent * e) { } +void DrawTools::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + retranslate(); + break; + default: break; + } +} + + QComboBox * DrawTools::textEditCombo() const { return ui->comboText; } @@ -468,8 +495,8 @@ void DrawTools::changeEvent(QEvent * e) { } */ -QAction * DrawTools::newAction(const QString & text, const QIcon & icon, int type) { - QAction * ret = new QAction(icon, text, this); +QAction * DrawTools::newAction(const QIcon & icon, int type) { + QAction * ret = new QAction(icon, QString(), this); ret->setCheckable(true); ret->setData(type); return ret; diff --git a/qad/blockview/drawtools.h b/qad/blockview/drawtools.h index a0f0042..51e8db9 100644 --- a/qad/blockview/drawtools.h +++ b/qad/blockview/drawtools.h @@ -72,7 +72,7 @@ namespace Ui { } -class QAD_EXPORT DrawTools: public QObject +class QAD_EXPORT DrawTools: public QWidget { Q_OBJECT Q_PROPERTY(bool resizeHandlesEnabled READ isResizeHandlesEnabled WRITE setResizeHandlesEnabled) @@ -92,8 +92,9 @@ public: protected: bool eventFilter(QObject * o, QEvent * e); + void changeEvent(QEvent * e); - QAction * newAction(const QString & text, const QIcon & icon, int type); + QAction * newAction(const QIcon & icon, int type); void setToolButtonsEnabled(bool pen, bool brush, bool wid_hei); void blockPropSignals(bool block_); void actionAlignTrigger(bool vert, Qt::AlignmentFlag value); @@ -150,6 +151,8 @@ signals: void itemEdited(QGraphicsItem * item); void itemZChanged(QGraphicsItem * item); +private: + void retranslate(); }; diff --git a/qad/blockview/lang/qad_blockview_en.ts b/qad/blockview/lang/qad_blockview_en.ts new file mode 100644 index 0000000..a8abcb3 --- /dev/null +++ b/qad/blockview/lang/qad_blockview_en.ts @@ -0,0 +1,383 @@ + + + + + BlockBusItem + + + Add point: Ctrl + LeftClick +Remove point\segment: Ctrl + RightClick +New branch: Shift + LeftClick +Remove connection: Shift + RightClick + + + + + BlockEditor + + + Block editor + + + + + Block parameters + + + + + Width: + + + + + Heigth: + + + + + Pins margin: + + + + + Color: + + + + + Pins + + + + + Name + + + + + Bus + + + + + Add + + + + + Clone + + + + + Remove selected + + + + + Remove all + + + + + Save + + + + + + Ctrl+S + + + + + Save as ... + + + + + Load ... + + + + + Ctrl+O + + + + + Clear + + + + + Remove items + + + + + Del + + + + + DrawTools + + + Form + + + + + Font ... + + + + + Text: + + + + + + Edit text ... + + + + + + + Align center left + + + + + Align center + + + + + Align center right + + + + + Align top right + + + + + Align bottom right + + + + + Align bottom center + + + + + Align top left + + + + + Align top center + + + + + Align bottom left + + + + + Width: + + + + + Thickness: + + + + + Height: + + + + + Style: + + + + + Load image ... + + + + + Paste image ... + + + + + Scale: + + + + + Top + + + + + + + + Center + + + + + + Bottom + + + + + + Left + + + + + + Right + + + + + NoPen + + + + + Solid + + + + + Dash + + + + + Dot + + + + + Dash-Dot + + + + + Dash-Dot-Dot + + + + + Edit text + + + + + Bring +forward + + + + + Bring +to front + + + + + Send +backward + + + + + Send +to back + + + + + Draw +Rectangle + + + + + Draw +Ellipse + + + + + Draw +Line + + + + + Draw +Text + + + + + Draw +Image + + + + + Select image + + + + + PinAlignDelegate + + + Left + + + + + Right + + + + + Top + + + + + Bottom + + + + + unknown + + + + diff --git a/qad/blockview/lang/qad_blockview_ru.ts b/qad/blockview/lang/qad_blockview_ru.ts index 4be20eb..9a7ecdc 100644 --- a/qad/blockview/lang/qad_blockview_ru.ts +++ b/qad/blockview/lang/qad_blockview_ru.ts @@ -20,7 +20,7 @@ Remove connection: Shift + RightClick Block editor - + Редактор блока @@ -91,7 +91,7 @@ Remove connection: Shift + RightClick Ctrl+S - + @@ -106,7 +106,7 @@ Remove connection: Shift + RightClick Ctrl+O - + @@ -121,7 +121,7 @@ Remove connection: Shift + RightClick Del - + @@ -214,7 +214,7 @@ Remove connection: Shift + RightClick Высота: - + Style: Стиль: @@ -226,7 +226,7 @@ Remove connection: Shift + RightClick Paste image ... - + Вставить картинку ... @@ -265,107 +265,135 @@ Remove connection: Shift + RightClick Право - + NoPen НетЛинии - + Solid Сплошная - + Dash Штриховая - + Dot Пунктирная - + Dash-Dot ШтрихПунктирная - + Dash-Dot-Dot ШтрихПунктирПунктирная - + Edit text Редактировать текст - + Bring forward Переместить выше - + Bring to front На передний фон - + Send backward Переместить ниже - + Send to back На задний фон - + Draw Rectangle Нарисовать прямоугольник - + Draw Ellipse Нарисовать эллипс - + Draw Line Нарисовать линию - + Draw Text Нарисовать текст - + Draw Image Нарисовать картинку - + Select image Выбрать картинку + + PinAlignDelegate + + + Left + Лево + + + + Right + Право + + + + Top + Верх + + + + Bottom + Низ + + + + unknown + неизвестно + + diff --git a/qad/blockview/lang/update.bat b/qad/blockview/lang/update.bat index c157fce..0ac75d0 100644 --- a/qad/blockview/lang/update.bat +++ b/qad/blockview/lang/update.bat @@ -1 +1,2 @@ lupdate ../ -ts qad_blockview_ru.ts +lupdate ../ -ts qad_blockview_en.ts diff --git a/qad/graphic/graphic.cpp b/qad/graphic/graphic.cpp index 8fd8530..a6ceb83 100644 --- a/qad/graphic/graphic.cpp +++ b/qad/graphic/graphic.cpp @@ -140,11 +140,11 @@ Graphic::~Graphic() { void Graphic::changeEvent(QEvent * e) { + QFrame::changeEvent(e); if (e->type() == QEvent::LanguageChange) { ui->retranslateUi(this); return; } - QFrame::changeEvent(e); } diff --git a/qad/graphic/graphic_conf.cpp b/qad/graphic/graphic_conf.cpp index 265e64f..d497251 100644 --- a/qad/graphic/graphic_conf.cpp +++ b/qad/graphic/graphic_conf.cpp @@ -29,11 +29,11 @@ GraphicConf::GraphicConf(QVector & graphics_, QWidget * parent): QD void GraphicConf::changeEvent(QEvent * e) { + QDialog::changeEvent(e); if (e->type() == QEvent::LanguageChange) { ui->retranslateUi(this); return; } - QDialog::changeEvent(e); } diff --git a/qad/graphic/lang/qad_graphic_en.ts b/qad/graphic/lang/qad_graphic_en.ts new file mode 100644 index 0000000..32f57ad --- /dev/null +++ b/qad/graphic/lang/qad_graphic_en.ts @@ -0,0 +1,387 @@ + + + + + Graphic + + + Autofit + + + + + Grid + + + + + Cursor axis + + + + + Only expand Y + + + + + Only expand X + + + + + Fullscreen + + + + + Border inputs + + + + + Legend + + + + + Pause + + + + + Configure ... + + + + + Save image ... + + + + + Clear + + + + + Close + + + + + Cursor: ( ; ) + + + + + + Cursor: + + + + + Selection + + + + + Size + + + + + + Range + + + + + + Length + + + + + + Cursor + + + + + Save Image + + + + + y(x) + + + + + Check all + + + + + GraphicConf + + + Graphic parameters + + + + + Appearance + + + + + Border inputs + + + + + Antialiasing + + + + + Status bar + + + + + OpenGL + + + + + Legend + + + + + Background color: + + + + + Text color: + + + + + Graphics + + + + + + Color: + + + + + + Style: + + + + + Lines width: + + + + + Points width: + + + + + Fill: + + + + + Grid + + + + + Width: + + + + + Step X: + + + + + Step Y: + + + + + Auto X + + + + + Auto Y + + + + + + 30 + + + + + + 50 + + + + + Margins + + + + + + + + + px + + + + + All: + + + + + Right: + + + + + Left: + + + + + Bottom: + + + + + Top: + + + + + NoPen + + + + + Solid + + + + + Dash + + + + + Dot + + + + + Dash-Dot + + + + + Dash-Dot-Dot + + + + + MainWindow + + + QPICalculator + + + + + Calculator + + + + + Expression + + + + + Result + + + + + Correct + + + + + + 0 + + + + + Variables + + + + + Name + + + + + Value + + + + + + Del + + + + + Graphics + + + + + On + + + + + Function + + + + diff --git a/qad/graphic/lang/qad_graphic_ru.ts b/qad/graphic/lang/qad_graphic_ru.ts index 0faf829..4c1209f 100644 --- a/qad/graphic/lang/qad_graphic_ru.ts +++ b/qad/graphic/lang/qad_graphic_ru.ts @@ -236,13 +236,13 @@ 30 - + 50 - + Auto step @@ -323,7 +323,7 @@ QPICalculator - + Калькулятор @@ -349,7 +349,7 @@ 0 - + @@ -370,7 +370,7 @@ Del - + diff --git a/qad/graphic/lang/update.bat b/qad/graphic/lang/update.bat index 0500d56..3b281f7 100644 --- a/qad/graphic/lang/update.bat +++ b/qad/graphic/lang/update.bat @@ -1 +1,2 @@ lupdate ../ -ts qad_graphic_ru.ts +lupdate ../ -ts qad_graphic_en.ts diff --git a/qad/sql_table/lang/qad_sql_table_en.ts b/qad/sql_table/lang/qad_sql_table_en.ts new file mode 100644 index 0000000..1506e1f --- /dev/null +++ b/qad/sql_table/lang/qad_sql_table_en.ts @@ -0,0 +1,54 @@ + + + + + SQLTableWidget + + + SQLTableWidget + + + + + Table doesn`t exists! + + + + + Add record + + + + + Configure filters + + + + + Clear + + + + + + Operator AND + + + + + + Operator OR + + + + + Remove selected + + + + + Table "%1" doesn`t exists! + + + + diff --git a/qad/sql_table/lang/update.bat b/qad/sql_table/lang/update.bat index ab17807..b0d78e5 100644 --- a/qad/sql_table/lang/update.bat +++ b/qad/sql_table/lang/update.bat @@ -1 +1,2 @@ lupdate ../ -ts qad_sql_table_ru.ts +lupdate ../ -ts qad_sql_table_en.ts diff --git a/qad/sql_table/sql_table_widget.cpp b/qad/sql_table/sql_table_widget.cpp index 7aae643..9503ee6 100644 --- a/qad/sql_table/sql_table_widget.cpp +++ b/qad/sql_table/sql_table_widget.cpp @@ -443,6 +443,19 @@ void SQLTableWidget::timerEvent(QTimerEvent * ) { } +void SQLTableWidget::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + action_del->setText(tr("Remove selected")); + break; + default: + break; + } +} + + void SQLTableWidget::setTableName(const QString & t) { ui->labelEmpty->setText(tr("Table \"%1\" doesn`t exists!").arg(t)); stopTimer(); diff --git a/qad/sql_table/sql_table_widget.h b/qad/sql_table/sql_table_widget.h index 0a858b2..1bf1ced 100644 --- a/qad/sql_table/sql_table_widget.h +++ b/qad/sql_table/sql_table_widget.h @@ -282,6 +282,7 @@ private: bool eventFilter(QObject * o, QEvent * e); void timerEvent(QTimerEvent * ); + void changeEvent(QEvent * e); void stopTimer() {if (timer != 0) killTimer(timer); timer = 0;} bool checkTable(); QStringList getTableColumns(const QString & t); diff --git a/qad/widgets/chardialog.cpp b/qad/widgets/chardialog.cpp index 992564f..5c255c0 100644 --- a/qad/widgets/chardialog.cpp +++ b/qad/widgets/chardialog.cpp @@ -48,6 +48,7 @@ void CharDialog::setCharFont(const QFont & f) { void CharDialog::changeEvent(QEvent * e) { + QDialog::changeEvent(e); if (e->type() == QEvent::LanguageChange) { ui->retranslateUi(this); QStringList cat; @@ -65,7 +66,6 @@ void CharDialog::changeEvent(QEvent * e) { ui->comboCategory->setCurrentIndex(pi); return; } - QDialog::changeEvent(e); } diff --git a/qad/widgets/clineedit.cpp b/qad/widgets/clineedit.cpp index bf0845c..fc2ef3e 100644 --- a/qad/widgets/clineedit.cpp +++ b/qad/widgets/clineedit.cpp @@ -40,11 +40,11 @@ void CLineEdit::resizeEvent(QResizeEvent * e) { void CLineEdit::changeEvent(QEvent * e) { + QLineEdit::changeEvent(e); if (e->type() == QEvent::LanguageChange) { cw->setToolTip(tr("Clear")); return; } - QLineEdit::changeEvent(e); } diff --git a/qad/widgets/colorbutton.cpp b/qad/widgets/colorbutton.cpp index 215a05f..42aac1d 100644 --- a/qad/widgets/colorbutton.cpp +++ b/qad/widgets/colorbutton.cpp @@ -17,10 +17,10 @@ ColorButton::ColorButton(QWidget * parent): QPushButton(parent) { label->setFrameStyle(QFrame::Panel | QFrame::Sunken); label->show(); pal = label->palette(); - menu.addAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this, SLOT(copy())); - menu.addAction(QIcon(":/icons/edit-paste.png"), tr("Paste"), this, SLOT(paste())); + a_copy = menu.addAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this, SLOT(copy())); + a_paste = menu.addAction(QIcon(":/icons/edit-paste.png"), tr("Paste"), this, SLOT(paste())); menu.addSeparator(); - menu.addAction(tr("Mix with clipboard"), this, SLOT(mix())); + a_mix = menu.addAction(tr("Mix with clipboard"), this, SLOT(mix())); setAcceptDrops(true); connect(this, SIGNAL(clicked(bool)), this, SLOT(clicked())); } @@ -86,6 +86,20 @@ void ColorButton::dropEvent(QDropEvent * e) { } +void ColorButton::changeEvent(QEvent * e) { + QPushButton::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + a_copy->setText(tr("Copy")); + a_paste->setText(tr("Paste")); + a_mix->setText(tr("Mix with clipboard")); + break; + default: + break; + } +} + + void ColorButton::clicked() { QColor ret = QColorDialog::getColor(color(), this, tr("Choose color"), options); if (!ret.isValid()) return; diff --git a/qad/widgets/colorbutton.h b/qad/widgets/colorbutton.h index 826ba0c..1b73324 100644 --- a/qad/widgets/colorbutton.h +++ b/qad/widgets/colorbutton.h @@ -60,9 +60,11 @@ private: void resizeEvent(QResizeEvent * ); void dragEnterEvent(QDragEnterEvent * e); void dropEvent(QDropEvent * e); + void changeEvent(QEvent *e); QFrame * label; QWidget * back; + QAction * a_copy, * a_paste, * a_mix; QPalette pal; QPoint pp; QMenu menu; diff --git a/qad/widgets/ecombobox.cpp b/qad/widgets/ecombobox.cpp index db2f316..546dfc6 100644 --- a/qad/widgets/ecombobox.cpp +++ b/qad/widgets/ecombobox.cpp @@ -72,6 +72,20 @@ void EComboBox::showPopup() { } +void EComboBox::changeEvent(QEvent * e) { + QComboBox::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: +#if QT_VERSION >= 0x040700 + filter.setPlaceholderText(tr("Filter")); +#endif + break; + default: + break; + } +} + + void EComboBox::filterChanged(const QString & text, bool first) { if (filter.text().isEmpty()) filter.setFont(ifont); else filter.setFont(nfont); diff --git a/qad/widgets/ecombobox.h b/qad/widgets/ecombobox.h index f96ef5e..7f5c6e6 100644 --- a/qad/widgets/ecombobox.h +++ b/qad/widgets/ecombobox.h @@ -39,6 +39,8 @@ public slots: virtual void showPopup(); private: + void changeEvent(QEvent *e); + QTreeView iv; QWidget header; QLabel icon; diff --git a/qad/widgets/evalspinbox.cpp b/qad/widgets/evalspinbox.cpp index 1c0d76a..28324c5 100644 --- a/qad/widgets/evalspinbox.cpp +++ b/qad/widgets/evalspinbox.cpp @@ -88,11 +88,11 @@ void EvalSpinBox::resizeEvent(QResizeEvent * e) { void EvalSpinBox::changeEvent(QEvent * e) { + QAbstractSpinBox::changeEvent(e); if (e->type() == QEvent::LanguageChange) { cw->setToolTip(tr("Clear")); return; } - QAbstractSpinBox::changeEvent(e); } diff --git a/qad/widgets/lang/qad_widgets_en.ts b/qad/widgets/lang/qad_widgets_en.ts new file mode 100644 index 0000000..0bf28b5 --- /dev/null +++ b/qad/widgets/lang/qad_widgets_en.ts @@ -0,0 +1,677 @@ + + + + + CLineEdit + + + + Clear + + + + + CharDialog + + + Choose symbol + + + + + + No Category + + + + + + Mark NonSpacing + + + + + + Mark SpacingCombining + + + + + + Mark Enclosing + + + + + + Number DecimalDigit + + + + + + Number Letter + + + + + + Number Other + + + + + + Separator Space + + + + + + Separator Line + + + + + + Separator Paragraph + + + + + + Other Control + + + + + + Other Format + + + + + + Other Surrogate + + + + + + Other PrivateUse + + + + + + Other NotAssigned + + + + + + Letter Uppercase + + + + + + Letter Lowercase + + + + + + Letter Titlecase + + + + + + Letter Modifier + + + + + + Letter Other + + + + + + Punctuation Connector + + + + + + Punctuation Dash + + + + + + Punctuation Open + + + + + + Punctuation Close + + + + + + Punctuation InitialQuote + + + + + + Punctuation FinalQuote + + + + + + Punctuation Other + + + + + + Symbol Math + + + + + + Symbol Currency + + + + + + Symbol Modifier + + + + + + Symbol Other + + + + + ColorButton + + + + Copy + + + + + + Paste + + + + + + Mix with clipboard + + + + + Choose color + + + + + EComboBox + + + + Filter + + + + + EvalSpinBox + + + + Clear + + + + + MatrixEdit + + + Cols: + + + + + Rows: + + + + + Null + + + + + 0 + + + + + Identity + + + + + I + + + + + PathEdit + + + All files(*) + + + + + + Choose + + + + + Select directory + + + + + Select file + + + + + QCodeEdit + + + Search: + + + + + Case sensitive + + + + + Aa + + + + + Whole words + + + + + W + + + + + Previous + + + + + Next + + + + + Replace: + + + + + Replace + + + + + R + + + + + Replace and search + + + + + Rs + + + + + Replace all + + + + + Ra + + + + + + Press F1 for details + + + + + QPIConfigNewDialog + + + Dialog + + + + + Type + + + + + string + + + + + s + + + + + integer + + + + + n + + + + + float + + + + + f + + + + + string list + + + + + l + + + + + boolean + + + + + b + + + + + color + + + + + c + + + + + rectangle + + + + + r + + + + + area + + + + + a + + + + + point + + + + + p + + + + + vector + + + + + v + + + + + ip + + + + + i + + + + + Name: + + + + + Comment: + + + + + Value: + + + + + QPIConfigWidget + + + Name + + + + + Value + + + + + Type + + + + + Comment + + + + + Add item ... + + + + + Add node ... + + + + + Convert to item + + + + + Convert to node + + + + + Remove + + + + + Expand all + + + + + Collapse all + + + + + QPointEdit + + + + X + + + + + + Y + + + + + QRectEdit + + + + X + + + + + + Y + + + + + + Height + + + + + + Width + + + + + QVariantEdit + + + Invalid value + + + + + ScrollSpinBox + + + Grab and scroll + + + + + Shortcuts + + + + Command + + + + + + Shortcut + + + + + StringListEdit + + + + Add + + + + + + Remove + + + + + + Clear + + + + diff --git a/qad/widgets/lang/qad_widgets_ru.ts b/qad/widgets/lang/qad_widgets_ru.ts index 6af567c..e933d26 100644 --- a/qad/widgets/lang/qad_widgets_ru.ts +++ b/qad/widgets/lang/qad_widgets_ru.ts @@ -5,7 +5,7 @@ CLineEdit - + Clear Сбросить @@ -19,187 +19,187 @@ - + No Category Вне категории - + Mark NonSpacing - + Mark SpacingCombining - + Mark Enclosing - + Number DecimalDigit - + Number Letter - + Number Other - + Separator Space - + Separator Line - + Separator Paragraph - + Other Control - + Other Format - + Other Surrogate - + Other PrivateUse - + Other NotAssigned - + Letter Uppercase - + Letter Lowercase - + Letter Titlecase - + Letter Modifier - + Letter Other - + Punctuation Connector - + Punctuation Dash - + Punctuation Open - + Punctuation Close - + Punctuation InitialQuote - + Punctuation FinalQuote - + Punctuation Other - + Symbol Math - + Symbol Currency - + Symbol Modifier - + Symbol Other @@ -208,21 +208,24 @@ ColorButton + Copy Копировать + Paste Вставить + Mix with clipboard Смешать со скопированным - + Choose color Выбрать цвет @@ -231,6 +234,7 @@ EComboBox + Filter Фильтр @@ -239,7 +243,7 @@ EvalSpinBox - + Clear Очистить @@ -249,12 +253,12 @@ Cols: - + Колонки: Rows: - + Строки: @@ -264,7 +268,7 @@ 0 - + @@ -274,7 +278,7 @@ I - + @@ -286,7 +290,7 @@ - + Choose Выберите @@ -305,6 +309,7 @@ QCodeEdit + Press F1 for details Нажмите F1 для справочной информации @@ -321,7 +326,7 @@ Aa - + Аа @@ -389,7 +394,7 @@ Type - Тип + Тип @@ -504,128 +509,73 @@ Name: - + Имя: Comment: - + Комментарий: Value: - + Значение: QPIConfigWidget - + Name Имя - + Value Значение - + Type Тип - + Comment Описание - - - string - - - - - string list - - - - - integer - - - - - float - - - - - boolean - - - - - color - - - - - rectangle - - - - - area - - - - - point - - - vector - + Add item ... + Добавить поле ... - ip - + Add node ... + Добавить секцию ... - Add item ... - + Convert to item + Преобразовать в значение - Add node ... - + Convert to node + Преобразовать в секцию - Convert to item - - - - - Convert to node - - - - Remove Удалить - + Expand all Свернуть все - + Collapse all Развернуть все @@ -634,13 +584,13 @@ QPointEdit - + X - + Y @@ -649,25 +599,25 @@ QRectEdit - + X - + Y - + Height Высота - + Width Ширина @@ -692,13 +642,13 @@ Shortcuts - + Command Команда - + Shortcut Горячая клавиша @@ -707,19 +657,19 @@ StringListEdit - + Add Добавить - + Remove Удалить - + Clear Очистить diff --git a/qad/widgets/lang/update.bat b/qad/widgets/lang/update.bat index d54631f..e456a60 100644 --- a/qad/widgets/lang/update.bat +++ b/qad/widgets/lang/update.bat @@ -1 +1,2 @@ lupdate ../ -ts qad_widgets_ru.ts +lupdate ../ -ts qad_widgets_en.ts diff --git a/qad/widgets/matrixedit.cpp b/qad/widgets/matrixedit.cpp index bed96f2..da8e502 100644 --- a/qad/widgets/matrixedit.cpp +++ b/qad/widgets/matrixedit.cpp @@ -52,6 +52,18 @@ void MatrixEdit::clear(bool ident) { } +void MatrixEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + + QVector MatrixEdit::vector() const { QVector ret; if (ui->table->columnCount() < 1) return ret; diff --git a/qad/widgets/matrixedit.h b/qad/widgets/matrixedit.h index ed5d08d..53af595 100644 --- a/qad/widgets/matrixedit.h +++ b/qad/widgets/matrixedit.h @@ -46,6 +46,7 @@ public: private: void setVectorMode(bool yes); void clear(bool ident = false); + void changeEvent(QEvent * e); Ui::MatrixEdit * ui; bool ro; diff --git a/qad/widgets/qcodeedit.cpp b/qad/widgets/qcodeedit.cpp index d9ae230..4c72bf4 100644 --- a/qad/widgets/qcodeedit.cpp +++ b/qad/widgets/qcodeedit.cpp @@ -562,6 +562,19 @@ void QCodeEdit::leaveEvent(QEvent * e) { } +void QCodeEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + lbl_help[1]->setText(tr("Press F1 for details")); + break; + default: + break; + } +} + + char antiBracket(char c) { switch (c) { case '(': return ')'; diff --git a/qad/widgets/qcodeedit.h b/qad/widgets/qcodeedit.h index f4bcdfb..6b437c3 100644 --- a/qad/widgets/qcodeedit.h +++ b/qad/widgets/qcodeedit.h @@ -115,6 +115,7 @@ private: void showEvent(QShowEvent * ); void timerEvent(QTimerEvent * ); void leaveEvent(QEvent * ); + void changeEvent(QEvent * e); void highlightBrackets(); void applyExtraSelection(); void nextCompletition(); diff --git a/qad/widgets/qpiconfigwidget.cpp b/qad/widgets/qpiconfigwidget.cpp index 22cabd1..dfb1ad7 100644 --- a/qad/widgets/qpiconfigwidget.cpp +++ b/qad/widgets/qpiconfigwidget.cpp @@ -46,13 +46,11 @@ QPIConfigWidget::QPIConfigWidget(QWidget * parent, QPIConfig * c, bool on): QTre void QPIConfigWidget::changeEvent(QEvent * e) { + QTreeWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { translate(); return; } - //for (int i = 0; i < 4; ++i) - // setColumnHidden(i, c_hidden[i]); - QTreeWidget::changeEvent(e); } @@ -342,17 +340,17 @@ void QPIConfigWidget::translate() { if (active) setHeaderLabels(l); types.clear(); s_types.clear(); - addTrEntry("s", tr("string")); - addTrEntry("l", tr("string list")); - addTrEntry("n", tr("integer")); - addTrEntry("f", tr("float")); - addTrEntry("b", tr("boolean")); - addTrEntry("c", tr("color")); - addTrEntry("r", tr("rectangle")); - addTrEntry("a", tr("area")); - addTrEntry("p", tr("point")); - addTrEntry("v", tr("vector")); - addTrEntry("i", tr("ip")); + addTrEntry("s", "string"); + addTrEntry("l", "string list"); + addTrEntry("n", "integer"); + addTrEntry("f", "float"); + addTrEntry("b", "boolean"); + addTrEntry("c", "color"); + addTrEntry("r", "rectangle"); + addTrEntry("a", "area"); + addTrEntry("p", "point"); + addTrEntry("v", "vector"); + addTrEntry("i", "ip"); actionAddItem.setText(tr("Add item ...")); actionAddNode.setText(tr("Add node ...")); actionToItem.setText(tr("Convert to item")); diff --git a/qad/widgets/qpointedit.cpp b/qad/widgets/qpointedit.cpp index ebd0aae..c70dc30 100644 --- a/qad/widgets/qpointedit.cpp +++ b/qad/widgets/qpointedit.cpp @@ -25,10 +25,10 @@ QPointEdit::QPointEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftT void QPointEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { s_x->setToolTip(tr("X")); s_y->setToolTip(tr("Y")); return; } - QWidget::changeEvent(e); } diff --git a/qad/widgets/qrectedit.cpp b/qad/widgets/qrectedit.cpp index e1387a4..c823398 100644 --- a/qad/widgets/qrectedit.cpp +++ b/qad/widgets/qrectedit.cpp @@ -45,6 +45,7 @@ QRectEdit::QRectEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToR void QRectEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { s_x->setToolTip(tr("X")); s_y->setToolTip(tr("Y")); @@ -52,5 +53,4 @@ void QRectEdit::changeEvent(QEvent * e) { s_h->setToolTip(tr("Width")); return; } - QWidget::changeEvent(e); } diff --git a/qad/widgets/qvariantedit.cpp b/qad/widgets/qvariantedit.cpp index 42eebec..b2c01ea 100644 --- a/qad/widgets/qvariantedit.cpp +++ b/qad/widgets/qvariantedit.cpp @@ -81,13 +81,13 @@ StringListEdit::StringListEdit(QWidget * parent): QWidget(parent), lay(QBoxLayou void StringListEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { butt_add->setToolTip(tr("Add")); butt_del->setToolTip(tr("Remove")); butt_clear->setToolTip(tr("Clear")); return; } - QWidget::changeEvent(e); } @@ -120,11 +120,11 @@ PathEdit::PathEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRig void PathEdit::changeEvent(QEvent * e) { + QWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { butt_select->setToolTip(tr("Choose") + " ..."); return; } - QWidget::changeEvent(e); } diff --git a/qad/widgets/shortcuts.cpp b/qad/widgets/shortcuts.cpp index 234a637..ccb4ece 100644 --- a/qad/widgets/shortcuts.cpp +++ b/qad/widgets/shortcuts.cpp @@ -49,10 +49,12 @@ Shortcuts::~Shortcuts() { void Shortcuts::changeEvent(QEvent * e) { + QTreeWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { QStringList l; l << tr("Command") << tr("Shortcut"); setHeaderLabels(l); + return; } } diff --git a/qglview/globject_editor.cpp b/qglview/globject_editor.cpp index 8e284c3..30263e8 100644 --- a/qglview/globject_editor.cpp +++ b/qglview/globject_editor.cpp @@ -35,7 +35,6 @@ GLObjectEditor::GLObjectEditor(QWidget * parent): QWidget(parent) { void GLObjectEditor::changeEvent(QEvent * e) { - return; QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: diff --git a/qglview/material_editor.cpp b/qglview/material_editor.cpp index 5c57b21..502a84e 100644 --- a/qglview/material_editor.cpp +++ b/qglview/material_editor.cpp @@ -29,7 +29,6 @@ MaterialEditor::MaterialEditor(QWidget * parent): QWidget(parent) { void MaterialEditor::changeEvent(QEvent * e) { - return; QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: diff --git a/qglview/material_map_editor.cpp b/qglview/material_map_editor.cpp index fecb6dd..d3e8672 100644 --- a/qglview/material_map_editor.cpp +++ b/qglview/material_map_editor.cpp @@ -28,7 +28,6 @@ MaterialMapEditor::MaterialMapEditor(QWidget * parent): QWidget(parent) { void MaterialMapEditor::changeEvent(QEvent * e) { - return; QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: -- 2.43.0 From e90f5d23c4e5992613a978c1f615da951924db04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 25 May 2020 18:47:28 +0300 Subject: [PATCH 11/12] remove translations before load --- qad/utils/qad_locations.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/qad/utils/qad_locations.cpp b/qad/utils/qad_locations.cpp index 266fab5..8a9407f 100644 --- a/qad/utils/qad_locations.cpp +++ b/qad/utils/qad_locations.cpp @@ -14,6 +14,15 @@ #endif +class __QADTranslators__ { +public: + static QMap translators; +private: +}; + +QMap __QADTranslators__::translators = QMap(); + + QString QAD::userPath(QAD::LocationType loc, QString name) { QString dir, ext; switch (loc) { @@ -58,6 +67,13 @@ QStringList QAD::resourcePaths(QString type) { void QAD::loadTranslations(QString lang) { + QMapIterator i(__QADTranslators__::translators); + while (i.hasNext()) { + i.next(); + qApp->removeTranslator(i.value()); + delete i.value(); + } + __QADTranslators__::translators.clear(); if (lang.isEmpty()) lang = QLocale().bcp47Name(); QString short_lang = lang.left(2); @@ -72,6 +88,7 @@ void QAD::loadTranslations(QString lang) { QTranslator * tr = new QTranslator(); if (tr->load(dit.filePath())) { qApp->installTranslator(tr); + __QADTranslators__::translators[dit.filePath()] = tr; qDebug() << "Add tr" << dit.fileName(); } else { qDebug() << "Can`t load translation" << dit.fileName(); @@ -107,10 +124,10 @@ QStringList QAD::availableTranslations() { if (loc.language() != QLocale::C) ret << lang[i]; } - //qDebug() << "Can`t load translation" << dit.fileName(); - delete tr; } + delete tr; } } return ret.values(); } + -- 2.43.0 From 5abe72697d908d3956a6999afb26e4267b805d32 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Tue, 26 May 2020 16:27:21 +0300 Subject: [PATCH 12/12] version 1.3.1_beta qad_locations simplify pip --- pip | 2 +- qad/CMakeLists.txt | 4 ++-- qad/utils/qad_locations.cpp | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/pip b/pip index 6413e77..b6ab5aa 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit 6413e7747e5843356f75265bf29b2e758aa57816 +Subproject commit b6ab5aa202513357caa27dd596a04eb5458fc3c9 diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index d9575a8..464dc12 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(qad) set(_QAD_MAJOR 1) set(_QAD_MINOR 3) -set(_QAD_REVISION 0) -set(_QAD_SUFFIX alpha) +set(_QAD_REVISION 1) +set(_QAD_SUFFIX beta) set(_QAD_COMPANY SHS) set(_QAD_DOMAIN org.SHS) diff --git a/qad/utils/qad_locations.cpp b/qad/utils/qad_locations.cpp index 8a9407f..bcc9d6e 100644 --- a/qad/utils/qad_locations.cpp +++ b/qad/utils/qad_locations.cpp @@ -16,11 +16,11 @@ class __QADTranslators__ { public: - static QMap translators; + static QList translators; private: }; -QMap __QADTranslators__::translators = QMap(); +QList __QADTranslators__::translators = QList(); QString QAD::userPath(QAD::LocationType loc, QString name) { @@ -67,11 +67,9 @@ QStringList QAD::resourcePaths(QString type) { void QAD::loadTranslations(QString lang) { - QMapIterator i(__QADTranslators__::translators); - while (i.hasNext()) { - i.next(); - qApp->removeTranslator(i.value()); - delete i.value(); + foreach (QTranslator * t, __QADTranslators__::translators) { + qApp->removeTranslator(t); + delete t; } __QADTranslators__::translators.clear(); if (lang.isEmpty()) @@ -88,7 +86,7 @@ void QAD::loadTranslations(QString lang) { QTranslator * tr = new QTranslator(); if (tr->load(dit.filePath())) { qApp->installTranslator(tr); - __QADTranslators__::translators[dit.filePath()] = tr; + __QADTranslators__::translators << tr; qDebug() << "Add tr" << dit.fileName(); } else { qDebug() << "Can`t load translation" << dit.fileName(); -- 2.43.0