From 50564aecc2fdd3ba7e3a8b2b6f26690f54779988 Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Fri, 6 Oct 2023 08:46:54 +0300 Subject: [PATCH 1/5] [win] csvcmanager: fix app version in app display name after update --- .../extras/update-daemon/src/classes/csvcmanager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/win-linux/extras/update-daemon/src/classes/csvcmanager.cpp b/win-linux/extras/update-daemon/src/classes/csvcmanager.cpp index b6d751e54..8b89db22d 100644 --- a/win-linux/extras/update-daemon/src/classes/csvcmanager.cpp +++ b/win-linux/extras/update-daemon/src/classes/csvcmanager.cpp @@ -163,6 +163,15 @@ auto restartService()->void CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } + +auto verToAppVer(const wstring &ver)->wstring +{ + size_t pos = ver.find(L'.'); + if (pos == std::wstring::npos) + return ver; + pos = ver.find(L'.', pos + 1); + return (pos == std::wstring::npos) ? ver : ver.substr(0, pos); +} #endif CSvcManager::CSvcManager(): @@ -503,7 +512,7 @@ void CSvcManager::startReplacingFiles(const tstring &packageType, const bool res wstring app_key(app_name); app_key += (packageType == TEXT("iss")) ? L"_is1" : L""; if (RegOpenKeyEx(hKey, app_key.c_str(), 0, KEY_ALL_ACCESS, &hAppKey) == ERROR_SUCCESS) { - wstring disp_name = app_name + L" " + ver + L" (" + currentArch().substr(1) + L")"; + wstring disp_name = app_name + L" " + verToAppVer(ver) + L" (" + currentArch().substr(1) + L")"; if (RegSetValueEx(hAppKey, TEXT("DisplayName"), 0, REG_SZ, (const BYTE*)disp_name.c_str(), (DWORD)(disp_name.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS) NS_Logger::WriteLog(L"Can't update DisplayName in registry!"); if (RegSetValueEx(hAppKey, TEXT("DisplayVersion"), 0, REG_SZ, (const BYTE*)ver.c_str(), (DWORD)(ver.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS) From 70b035ad536681ce19d78a3972ef0b405636bd78 Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Fri, 6 Oct 2023 08:51:22 +0300 Subject: [PATCH 2/5] [win-linux] fix the position of the icon 'encrypted' --- win-linux/src/components/celipsislabel.cpp | 7 +++++++ win-linux/src/components/celipsislabel.h | 4 ++++ win-linux/src/windows/ceditorwindow_p.h | 24 +++++++++++++++------- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/win-linux/src/components/celipsislabel.cpp b/win-linux/src/components/celipsislabel.cpp index ee4f978e2..05f31704c 100644 --- a/win-linux/src/components/celipsislabel.cpp +++ b/win-linux/src/components/celipsislabel.cpp @@ -62,6 +62,13 @@ void CElipsisLabel::resizeEvent(QResizeEvent *event) if ( event->size().width() != event->oldSize().width() ) { QString elt = ellipsis_text_(this, orig_text, elide_mode); QLabel::setText(elt); + QFontMetrics fm(font()); +#if (QT_VERSION < QT_VERSION_CHECK(5,11,0)) + int textWidth = fm.width(elt); +#else + int textWidth = fm.horizontalAdvance(elt); +#endif + emit onResize(event->size(), textWidth); } } diff --git a/win-linux/src/components/celipsislabel.h b/win-linux/src/components/celipsislabel.h index 194992fce..a3ff8df8a 100644 --- a/win-linux/src/components/celipsislabel.h +++ b/win-linux/src/components/celipsislabel.h @@ -38,6 +38,7 @@ class CElipsisLabel : public QLabel { + Q_OBJECT public: CElipsisLabel(const QString &text, QWidget *parent = Q_NULLPTR); CElipsisLabel(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); @@ -46,6 +47,9 @@ class CElipsisLabel : public QLabel auto setEllipsisMode(Qt::TextElideMode) -> void; auto updateText() -> void; +signals: + void onResize(QSize size, int textWidth); + protected: virtual void resizeEvent(QResizeEvent *event) final; using QLabel::setText; diff --git a/win-linux/src/windows/ceditorwindow_p.h b/win-linux/src/windows/ceditorwindow_p.h index a3d9ad721..c74d022de 100644 --- a/win-linux/src/windows/ceditorwindow_p.h +++ b/win-linux/src/windows/ceditorwindow_p.h @@ -65,6 +65,7 @@ #define TOP_PANEL_OFFSET 6*TOOLBTN_WIDTH #define ICON_SPACER_WIDTH 9 +#define ICON_SIZE QSize(20,20) using namespace NSEditorApi; @@ -605,6 +606,7 @@ class CEditorWindowPrivate : public CCefEventsGate if ( iconcrypted ) { iconcrypted->setPixmap(QIcon{":/title/icons/secure.svg"}.pixmap(QSize(20,20) * f)); + iconcrypted->setFixedSize(ICON_SIZE * f); } for (const auto& btn: m_mapTitleButtons) { @@ -730,12 +732,22 @@ class CEditorWindowPrivate : public CCefEventsGate QLabel * iconCrypted() { - Q_ASSERT(window->m_boxTitleBtns != nullptr); + Q_ASSERT(window->m_labelTitle != nullptr); if ( !iconcrypted ) { - iconcrypted = new QLabel(window->m_boxTitleBtns); + iconcrypted = new QLabel(window->m_labelTitle); iconcrypted->setObjectName("iconcrypted"); iconcrypted->setPixmap(QIcon{":/title/icons/secure.svg"}.pixmap(QSize(20,20) * window->m_dpiRatio)); + iconcrypted->setFixedSize(ICON_SIZE * window->m_dpiRatio); + int y = (window->m_labelTitle->height() - ICON_SIZE.height() * window->m_dpiRatio)/2; + iconcrypted->move(0, y); + connect(window->m_labelTitle, &CElipsisLabel::onResize, this, [=](QSize size, int textWidth) { + if (iconcrypted) { + int x = (size.width() - textWidth)/2 - ((ICON_SIZE.width() + 6) * window->m_dpiRatio); + int y = (size.height() - ICON_SIZE.height() * window->m_dpiRatio)/2; + iconcrypted->move(x, y); + } + }); } return iconcrypted; @@ -752,7 +764,7 @@ class CEditorWindowPrivate : public CCefEventsGate } if ( panel()->data()->hasFeature(L"crypted\":true") && boxtitlelabel && !iconcrypted ) { - qobject_cast(boxtitlelabel->layout())->insertWidget(0, iconCrypted()); + iconCrypted(); } if ( is_read_only != panel()->data()->hasFeature(L"readonly\":") && boxtitlelabel ) { @@ -855,13 +867,11 @@ class CEditorWindowPrivate : public CCefEventsGate boxtitlelabel->layout()->setSpacing(0); boxtitlelabel->layout()->setMargin(0); boxtitlelabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - + boxtitlelabel->layout()->addWidget(window->m_labelTitle); if ( m_panel->data()->hasFeature(L"crypted\":true") && !iconcrypted ) { - boxtitlelabel->layout()->addWidget(iconCrypted()); + iconCrypted(); } - boxtitlelabel->layout()->addWidget(window->m_labelTitle); - if (usedOldEditorVersion) { // For old editors only _layout->insertWidget(1, boxtitlelabel); if ( _layout->itemAt(0)->widget() != leftboxbuttons ) From 3bc5cbb445b4f704e70c328b77249cbfaf361a90 Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Fri, 6 Oct 2023 08:52:10 +0300 Subject: [PATCH 3/5] [win-linux] fix bug 64503 --- win-linux/src/windows/cmainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win-linux/src/windows/cmainwindow.cpp b/win-linux/src/windows/cmainwindow.cpp index e930d2b1c..f523f4e5a 100644 --- a/win-linux/src/windows/cmainwindow.cpp +++ b/win-linux/src/windows/cmainwindow.cpp @@ -242,9 +242,9 @@ void CMainWindow::close() onFullScreen(-1, false); #ifdef _WIN32 - if (isSessionInProgress() && m_pTabs->count() > 1) { + if (isSessionInProgress() && m_pTabs->count(cvwtEditor) > 1) { #else - if (m_pTabs->count() > 1) { + if (m_pTabs->count(cvwtEditor) > 1) { #endif GET_REGISTRY_USER(reg_user); if (!reg_user.value("ignoreMsgAboutOpenTabs", false).toBool()) { From e861f3dd45e58e3cda7596791b03a644b5ad850b Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Fri, 6 Oct 2023 17:03:48 +0300 Subject: [PATCH 4/5] [win] fix theme changing. "system theme" became hidden --- win-linux/src/cascapplicationmanagerwrapper.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/win-linux/src/cascapplicationmanagerwrapper.cpp b/win-linux/src/cascapplicationmanagerwrapper.cpp index abd17be92..ca265ebf5 100644 --- a/win-linux/src/cascapplicationmanagerwrapper.cpp +++ b/win-linux/src/cascapplicationmanagerwrapper.cpp @@ -1716,8 +1716,7 @@ void CAscApplicationManagerWrapper::applyTheme(const wstring& theme, bool force) {"type", _app.m_themes->current().stype()}, {"id", QString::fromStdWString(_app.m_themes->current().id())} #ifndef Q_OS_LINUX -// ,{"system", _app.m_themes->isSystemSchemeDark() ? "dark" : "light"} - ,{"system", "disabled"} + ,{"system", _app.m_themes->isSystemSchemeDark() ? "dark" : "light"} #else ,{"system", "disabled"} #endif From 1906a01e47708b427e69e9c521ddbc2b7a0ca1df Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Fri, 6 Oct 2023 17:17:47 +0300 Subject: [PATCH 5/5] [win-linux] fix bug 64506 --- win-linux/src/components/ctabbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win-linux/src/components/ctabbar.cpp b/win-linux/src/components/ctabbar.cpp index ca5ac07be..a1f1c4ab1 100644 --- a/win-linux/src/components/ctabbar.cpp +++ b/win-linux/src/components/ctabbar.cpp @@ -1149,7 +1149,7 @@ bool CTabBar::eventFilter(QObject *watched, QEvent *event) if (mouse_event->button() == Qt::LeftButton) { while (d->animationInProgress) PROCESSEVENTS(); - if (d->movedTab) { + if (d->movedTab && !d->lock) { if (d->currentIndex != d->movedTabIndex) { d->reorderIndexes(); int posX = d->tabLayouts[d->currentIndex].x();