diff --git a/0001-feat-KiranLabel-KiranPasswdEdit-new-control-KiranLab.patch b/0001-feat-KiranLabel-KiranPasswdEdit-new-control-KiranLab.patch deleted file mode 100644 index 75582261c6334a35583527954043c58e0e2f5882..0000000000000000000000000000000000000000 --- a/0001-feat-KiranLabel-KiranPasswdEdit-new-control-KiranLab.patch +++ /dev/null @@ -1,1078 +0,0 @@ -From bb02ffffe0ff6a51bc8fc6dd7ad09d4e7b278aff Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Wed, 30 Nov 2022 13:53:05 +0800 -Subject: [PATCH 1/3] feat(KiranLabel,KiranPasswdEdit): new control - KiranLabel,KiranPasswdEdit -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 新增控件 KiranLabel以及KiranPasswdEdit ---- - CMakeLists.txt | 5 +- - TODO | 9 + - TODO.md | 6 - - .../images/passwd-edit/reveal-passwd.svg | 39 ++ - .../images/passwd-edit/unreveal-passwd.svg | 39 ++ - resources/kiranwidgets-qt5-resources.qrc | 2 + - .../kiran-image-selector.cpp | 2 +- - src/widgets/kiran-label/kiran-label-private.h | 40 +++ - src/widgets/kiran-label/kiran-label.cpp | 337 ++++++++++++++++++ - src/widgets/kiran-label/kiran-label.h | 39 ++ - .../kiran-passwd-edit/kiran-passwd-edit.cpp | 169 +++++++++ - .../kiran-passwd-edit/kiran-passwd-edit.h | 60 ++++ - test/CMakeLists.txt | 4 +- - test/kiran-label-test.cpp | 94 +++++ - test/kiran-passwd-edit-test.cpp | 50 +++ - translations/kiranwidgets-qt5.zh_CN.ts | 6 + - 16 files changed, 892 insertions(+), 9 deletions(-) - create mode 100644 TODO - delete mode 100644 TODO.md - create mode 100644 resources/images/passwd-edit/reveal-passwd.svg - create mode 100644 resources/images/passwd-edit/unreveal-passwd.svg - create mode 100644 src/widgets/kiran-label/kiran-label-private.h - create mode 100644 src/widgets/kiran-label/kiran-label.cpp - create mode 100644 src/widgets/kiran-label/kiran-label.h - create mode 100644 src/widgets/kiran-passwd-edit/kiran-passwd-edit.cpp - create mode 100644 src/widgets/kiran-passwd-edit/kiran-passwd-edit.h - create mode 100644 test/kiran-label-test.cpp - create mode 100644 test/kiran-passwd-edit-test.cpp - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 20792a0..369bdea 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -69,12 +69,15 @@ set(DEVEL_HEADER - "src/widgets/kiran-push-button/kiran-push-button.h" - "src/widgets/kiran-hover-tips/kiran-hover-tips.h" - "src/widgets/kiran-color-block/kiran-color-block.h" -+ "src/widgets/kiran-label/kiran-label.h" -+ "src/widgets/kiran-passwd-edit/kiran-passwd-edit.h" -+ - "src/kiran-style/widget-property-helper.h" - "src/kiran-style/kiran-style-public-define.h" ) - - include_directories("${CMAKE_BINARY_DIR}") - --find_package(Qt5 COMPONENTS Widgets Svg Network X11Extras Concurrent LinguistTools) -+find_package(Qt5 COMPONENTS Widgets Gui Svg Network X11Extras Concurrent LinguistTools) - - qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) - -diff --git a/TODO b/TODO -new file mode 100644 -index 0000000..3dcd0ac ---- /dev/null -+++ b/TODO -@@ -0,0 +1,9 @@ -+待优化项目(影响兼容性,需要在升级接口升级大版本时考虑该问题): -+ -+1. kiran-widgets-qt5 d-pointer结构优化,现在的所有私有类指针未携带一个统一的继承关系 (暂时没有必要,现在的kiran-widgets-qt5内部继承层级并不多,修改的话同时也带来了接口不兼容) -+eg: 例如 KiranButton --继承与--> KiranWidget , 在构造一个KiranButton时将创建一个KiranButtonPrivate的私有类,同时父类KiranWidget也会创建一个私有类KiranWidgetPrivate,如果继承层数过多时,分配内存的次数也会得到明显的提高, -+若后期有必要可以考虑和Qt一致,例如 QFrame --继承于--> QWidget , QFramePrivate --继承与--> QWidgetPrivate , 构造QFrame时,将会分类QFramePrivate内存, 然后将QFramePrivate作为QWidget构造函数的参数,进行隐式装换为QWidgetPrivate*. -+ -+2. kiran-widgets-qt5 d-pointer 成员变量为d_ptr与 Qt d-pointer重复的同时也不便于理解,考虑后续重命名为k_d_ptr -+ -+3. 剔除kiran-widgets-qt5中自带的KiranStyle源码以及安装的头文件接口 -\ No newline at end of file -diff --git a/TODO.md b/TODO.md -deleted file mode 100644 -index 9555fff..0000000 ---- a/TODO.md -+++ /dev/null -@@ -1,6 +0,0 @@ --#TODO List --- [ ] 将之前提供的Kiran::WidgetPropertyHelper接口以及kiran-style-public-define.h定义的枚举标记废弃,通过转调至kiran-qt5-integration之中的KiranStyle提供的接口,将枚举定义移动到其他位置 --- [ ] 修改之前自定义控件的绘制,确认是否将自动控件的绘制过程不交由Style进行绘制,直接通过kiran-qt5-integration提供的KiranPalette拿到颜色进行绘制 --- [ ] 加入字体绑定的功能,加入字体分级 --- [ ] kiranwidgets-qt5项目之中的kiranstyle后续都将废弃,后续更新接口时删除该部分代码 --- [ ] scrollarea 不占用空间 overlap -\ No newline at end of file -diff --git a/resources/images/passwd-edit/reveal-passwd.svg b/resources/images/passwd-edit/reveal-passwd.svg -new file mode 100644 -index 0000000..2a36261 ---- /dev/null -+++ b/resources/images/passwd-edit/reveal-passwd.svg -@@ -0,0 +1,39 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/resources/images/passwd-edit/unreveal-passwd.svg b/resources/images/passwd-edit/unreveal-passwd.svg -new file mode 100644 -index 0000000..6d9ebff ---- /dev/null -+++ b/resources/images/passwd-edit/unreveal-passwd.svg -@@ -0,0 +1,39 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/resources/kiranwidgets-qt5-resources.qrc b/resources/kiranwidgets-qt5-resources.qrc -index 72dd4fd..76b4ae9 100644 ---- a/resources/kiranwidgets-qt5-resources.qrc -+++ b/resources/kiranwidgets-qt5-resources.qrc -@@ -21,6 +21,8 @@ - images/hover-tips/tips-suc.svg - images/hover-tips/tips-warning.svg - -+ images/passwd-edit/reveal-passwd.svg -+ images/passwd-edit/unreveal-passwd.svg - - - -diff --git a/src/widgets/kiran-image-selector/kiran-image-selector.cpp b/src/widgets/kiran-image-selector/kiran-image-selector.cpp -index 59240fe..35ab27c 100644 ---- a/src/widgets/kiran-image-selector/kiran-image-selector.cpp -+++ b/src/widgets/kiran-image-selector/kiran-image-selector.cpp -@@ -95,7 +95,7 @@ void KiranImageSelector::paintEvent(QPaintEvent *event) - - QStyleOption option; - option.initFrom(this); -- -+ option.state &= ~QStyle::State_MouseOver; - auto background = kiranPalette->color(this,&option,StylePalette::Window,StylePalette::Background); - auto border = kiranPalette->color(this,&option,StylePalette::Window,StylePalette::Border); - -diff --git a/src/widgets/kiran-label/kiran-label-private.h b/src/widgets/kiran-label/kiran-label-private.h -new file mode 100644 -index 0000000..fe96f0f ---- /dev/null -+++ b/src/widgets/kiran-label/kiran-label-private.h -@@ -0,0 +1,40 @@ -+/** -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * kiranwidgets-qt5 is licensed under Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You may obtain a copy of Mulan PSL v2 at: -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * -+ * Author: liuxinhao -+ */ -+#ifndef __KIRAN_LABEL_PRIVATE_H__ -+#define __KIRAN_LABEL_PRIVATE_H__ -+ -+#include "kiran-label.h" -+ -+class KiranLabelPrivate:public QObject -+{ -+ Q_OBJECT -+ Q_DECLARE_PUBLIC(KiranLabel) -+public: -+ explicit KiranLabelPrivate(KiranLabel* ptr,QObject* parent = nullptr); -+ ~KiranLabelPrivate(); -+ -+ void init(); -+ -+ //以下方法由于QLabelPrivate未暴露函数符号,将QLabel::paintEvent中使用QLabelPrivate的方法,移动至KiranLabelPrivate重新实现 -+ static Qt::LayoutDirection textDirection(QLabelPrivate* ld); -+ static QRectF layoutRect(QLabelPrivate* ld); -+ static QRectF documentRect(QLabelPrivate* ld); -+ static void ensureTextLayouted(QLabelPrivate* ld); -+ -+private: -+ KiranLabel* q_ptr; -+ Qt::TextElideMode elideMode = Qt::ElideNone; -+}; -+ -+#endif -\ No newline at end of file -diff --git a/src/widgets/kiran-label/kiran-label.cpp b/src/widgets/kiran-label/kiran-label.cpp -new file mode 100644 -index 0000000..6302357 ---- /dev/null -+++ b/src/widgets/kiran-label/kiran-label.cpp -@@ -0,0 +1,337 @@ -+/** -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * kiranwidgets-qt5 is licensed under Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You may obtain a copy of Mulan PSL v2 at: -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * -+ * Author: liuxinhao -+ */ -+ -+#include "kiran-label.h" -+#include "kiran-label-private.h" -+ -+#include -+#include -+#include -+#include -+#include -+ -+KiranLabelPrivate::KiranLabelPrivate(KiranLabel *ptr, QObject *parent) -+ : QObject(parent), -+ q_ptr(ptr) -+{ -+} -+ -+KiranLabelPrivate::~KiranLabelPrivate() -+{ -+} -+ -+void KiranLabelPrivate::init() -+{ -+} -+ -+Qt::LayoutDirection KiranLabelPrivate::textDirection(QLabelPrivate *ld) -+{ -+ if (ld->control) -+ { -+ QTextOption opt = ld->control->document()->defaultTextOption(); -+ return opt.textDirection(); -+ } -+ -+ return ld->text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; -+} -+ -+QRectF KiranLabelPrivate::layoutRect(QLabelPrivate *ld) -+{ -+ QRectF cr = documentRect(ld); -+ if (!ld->control) -+ return cr; -+ ensureTextLayouted(ld); -+ // Caculate y position manually -+ qreal rh = ld->control->document()->documentLayout()->documentSize().height(); -+ qreal yo = 0; -+ if (ld->align & Qt::AlignVCenter) -+ yo = qMax((cr.height() - rh) / 2, qreal(0)); -+ else if (ld->align & Qt::AlignBottom) -+ yo = qMax(cr.height() - rh, qreal(0)); -+ return QRectF(cr.x(), yo + cr.y(), cr.width(), cr.height()); -+} -+ -+QRectF KiranLabelPrivate::documentRect(QLabelPrivate *ld) -+{ -+ QLabel *q = qobject_cast(ld->q_ptr); -+ Q_ASSERT_X(ld->isTextLabel, "documentRect", "document rect called for label that is not a text label!"); -+ QRect cr = q->contentsRect(); -+ cr.adjust(ld->margin, ld->margin, -ld->margin, -ld->margin); -+ const int align = QStyle::visualAlignment(ld->isTextLabel ? textDirection(ld) -+ : q->layoutDirection(), -+ QFlag(ld->align)); -+ int m = ld->indent; -+ if (m < 0 && q->frameWidth()) // no indent, but we do have a frame -+ m = q->fontMetrics().horizontalAdvance(QLatin1Char('x')) / 2 - ld->margin; -+ if (m > 0) -+ { -+ if (align & Qt::AlignLeft) -+ cr.setLeft(cr.left() + m); -+ if (align & Qt::AlignRight) -+ cr.setRight(cr.right() - m); -+ if (align & Qt::AlignTop) -+ cr.setTop(cr.top() + m); -+ if (align & Qt::AlignBottom) -+ cr.setBottom(cr.bottom() - m); -+ } -+ return cr; -+} -+ -+void KiranLabelPrivate::ensureTextLayouted(QLabelPrivate *ld) -+{ -+ if (ld->textLayoutDirty) -+ { -+ if (ld->textDirty) -+ { -+ if (ld->control) -+ { -+ QTextDocument *doc = ld->control->document(); -+ if (ld->textDirty) -+ { -+#ifndef QT_NO_TEXTHTMLPARSER -+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) -+ if (ld->textformat == Qt::TextFormat::RichText) -+#else -+ if (ld->isRichText) -+#endif -+ doc->setHtml(ld->text); -+ else -+ doc->setPlainText(ld->text); -+#else -+ doc->setPlainText(ld->text); -+#endif -+ doc->setUndoRedoEnabled(false); -+ -+#ifndef QT_NO_SHORTCUT -+ if (ld->hasShortcut) -+ { -+ // Underline the first character that follows an ampersand (and remove the others ampersands) -+ int from = 0; -+ bool found = false; -+ QTextCursor cursor; -+ while (!(cursor = ld->control->document()->find((QLatin1String("&")), from)).isNull()) -+ { -+ cursor.deleteChar(); // remove the ampersand -+ cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); -+ from = cursor.position(); -+ if (!found && cursor.selectedText() != QLatin1String("&")) -+ { // not a second & -+ found = true; -+ ld->shortcutCursor = cursor; -+ } -+ } -+ } -+#endif -+ } -+ } -+ ld->textDirty = false; -+ } -+ -+ if (ld->control) -+ { -+ QTextDocument *doc = ld->control->document(); -+ QTextOption opt = doc->defaultTextOption(); -+ -+ opt.setAlignment(QFlag(ld->align)); -+ -+ if (ld->align & Qt::TextWordWrap) -+ opt.setWrapMode(QTextOption::WordWrap); -+ else -+ opt.setWrapMode(QTextOption::ManualWrap); -+ -+ doc->setDefaultTextOption(opt); -+ -+ QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); -+ fmt.setMargin(0); -+ doc->rootFrame()->setFrameFormat(fmt); -+ doc->setTextWidth(documentRect(ld).width()); -+ } -+ ld->textLayoutDirty = false; -+ } -+} -+ -+KiranLabel::KiranLabel(QWidget *parent, Qt::WindowFlags f) -+ : QLabel(parent, f), -+ kiran_d_ptr(new KiranLabelPrivate(this)) -+{ -+ kiran_d_ptr->init(); -+} -+ -+KiranLabel::KiranLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) -+ : QLabel(text,parent, f), -+ kiran_d_ptr(new KiranLabelPrivate(this)) -+{ -+ kiran_d_ptr->init(); -+} -+ -+KiranLabel::~KiranLabel() -+{ -+ delete kiran_d_ptr; -+} -+ -+void KiranLabel::setElideMode(Qt::TextElideMode elideMode) -+{ -+ if (KiranLabel::elideMode() == elideMode) -+ { -+ return; -+ } -+ -+ kiran_d_ptr->elideMode = elideMode; -+ update(); -+} -+ -+Qt::TextElideMode KiranLabel::elideMode() const -+{ -+ return kiran_d_ptr->elideMode; -+} -+ -+/// @brief 从QLabel::paintEvent修改而来,将QLabelPrivate相关方法(由于未暴露符号)移动至KiranLabelPrivate之中 -+void KiranLabel::paintEvent(QPaintEvent *event) -+{ -+ QLabelPrivate *d = static_cast(d_ptr.data()); -+ QStyle *style = QWidget::style(); -+ -+ QPainter p(this); -+ -+ drawFrame(&p); -+ -+ QRect cr = contentsRect(); -+ cr.adjust(d->margin, d->margin, d->margin, d->margin); -+ int align = QStyle::visualAlignment(d->isTextLabel ? KiranLabelPrivate::textDirection(d) : layoutDirection(), QFlag(d->align)); -+ -+#if QT_CONFIG(movie) -+ if (d->movie && !d->movie->currentPixmap().isNull()) -+ { -+ if (d->scaledcontents) -+ style->drawItemPixmap(&p, cr, align, d->movie->currentPixmap().scaled(cr.size())); -+ else -+ style->drawItemPixmap(&p, cr, align, d->movie->currentPixmap()); -+ } -+ else -+#endif -+ if (d->isTextLabel) -+ { -+ QRectF lr = KiranLabelPrivate::layoutRect(d).toAlignedRect(); -+ QStyleOption opt; -+ opt.initFrom(this); -+ -+ if (d->control) -+ { -+#ifndef QT_NO_SHORTCUT -+ const bool underline = static_cast(style->styleHint(QStyle::SH_UnderlineShortcut, -+ nullptr, this, nullptr)); -+ if (d->shortcutId != 0 && underline != d->shortcutCursor.charFormat().fontUnderline()) -+ { -+ QTextCharFormat fmt; -+ fmt.setFontUnderline(underline); -+ d->shortcutCursor.mergeCharFormat(fmt); -+ } -+#endif -+ KiranLabelPrivate::ensureTextLayouted(d); -+ -+ QAbstractTextDocumentLayout::PaintContext context; -+ // Adjust the palette -+ context.palette = opt.palette; -+ -+ if (foregroundRole() != QPalette::Text && isEnabled()) -+ context.palette.setColor(QPalette::Text, context.palette.color(foregroundRole())); -+ -+ p.save(); -+ p.translate(lr.topLeft()); -+ p.setClipRect(lr.translated(-lr.x(), -lr.y())); -+ d->control->setPalette(context.palette); -+ d->control->drawContents(&p, QRectF(), this); -+ p.restore(); -+ } -+ else -+ { -+ int flags = align | (KiranLabelPrivate::textDirection(d) == Qt::LeftToRight ? Qt::TextForceLeftToRight -+ : Qt::TextForceRightToLeft); -+ if (d->hasShortcut) -+ { -+ flags |= Qt::TextShowMnemonic; -+ if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this)) -+ flags |= Qt::TextHideMnemonic; -+ } -+ -+ QString elideText = d->text; -+ if (kiran_d_ptr->elideMode != Qt::ElideNone) -+ { -+ const QFontMetrics fm(fontMetrics()); -+ elideText = fm.elidedText(elideText, elideMode(), width(), Qt::TextShowMnemonic); -+ } -+ -+ style->drawItemText(&p, lr.toRect(), flags, opt.palette, isEnabled(), elideText, foregroundRole()); -+ } -+ } -+ else -+#ifndef QT_NO_PICTURE -+ if (d->picture) -+ { -+ QRect br = d->picture->boundingRect(); -+ int rw = br.width(); -+ int rh = br.height(); -+ if (d->scaledcontents) -+ { -+ p.save(); -+ p.translate(cr.x(), cr.y()); -+ p.scale((double)cr.width() / rw, (double)cr.height() / rh); -+ p.drawPicture(-br.x(), -br.y(), *d->picture); -+ p.restore(); -+ } -+ else -+ { -+ int xo = 0; -+ int yo = 0; -+ if (align & Qt::AlignVCenter) -+ yo = (cr.height() - rh) / 2; -+ else if (align & Qt::AlignBottom) -+ yo = cr.height() - rh; -+ if (align & Qt::AlignRight) -+ xo = cr.width() - rw; -+ else if (align & Qt::AlignHCenter) -+ xo = (cr.width() - rw) / 2; -+ p.drawPicture(cr.x() + xo - br.x(), cr.y() + yo - br.y(), *d->picture); -+ } -+ } -+ else -+#endif -+ if (d->pixmap && !d->pixmap->isNull()) -+ { -+ QPixmap pix; -+ if (d->scaledcontents) -+ { -+ QSize scaledSize = cr.size() * devicePixelRatioF(); -+ if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) -+ { -+ if (!d->cachedimage) -+ d->cachedimage = new QImage(d->pixmap->toImage()); -+ delete d->scaledpixmap; -+ QImage scaledImage = -+ d->cachedimage->scaled(scaledSize, -+ Qt::IgnoreAspectRatio, Qt::SmoothTransformation); -+ d->scaledpixmap = new QPixmap(QPixmap::fromImage(std::move(scaledImage))); -+ d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF()); -+ } -+ pix = *d->scaledpixmap; -+ } -+ else -+ pix = *d->pixmap; -+ QStyleOption opt; -+ opt.initFrom(this); -+ if (!isEnabled()) -+ pix = style->generatedIconPixmap(QIcon::Disabled, pix, &opt); -+ style->drawItemPixmap(&p, cr, align, pix); -+ } -+} -\ No newline at end of file -diff --git a/src/widgets/kiran-label/kiran-label.h b/src/widgets/kiran-label/kiran-label.h -new file mode 100644 -index 0000000..2266076 ---- /dev/null -+++ b/src/widgets/kiran-label/kiran-label.h -@@ -0,0 +1,39 @@ -+/** -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * kiranwidgets-qt5 is licensed under Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You may obtain a copy of Mulan PSL v2 at: -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * -+ * Author: liuxinhao -+ */ -+#ifndef __KIRAN_LABEL_H__ -+#define __KIRAN_LABEL_H__ -+ -+#include -+ -+class KiranLabelPrivate; -+class KiranLabel : public QLabel -+{ -+ Q_OBJECT -+ Q_DECLARE_PRIVATE_D(kiran_d_ptr,KiranLabel) -+public: -+ explicit KiranLabel(QWidget* parent = nullptr,Qt::WindowFlags f=Qt::WindowFlags()); -+ explicit KiranLabel(const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()); -+ ~KiranLabel(); -+ -+ void setElideMode(Qt::TextElideMode elideMode); -+ Qt::TextElideMode elideMode() const; -+ -+protected: -+ void paintEvent(QPaintEvent *event) override; -+ -+private: -+ KiranLabelPrivate* kiran_d_ptr; -+}; -+ -+#endif -\ No newline at end of file -diff --git a/src/widgets/kiran-passwd-edit/kiran-passwd-edit.cpp b/src/widgets/kiran-passwd-edit/kiran-passwd-edit.cpp -new file mode 100644 -index 0000000..a1a474d ---- /dev/null -+++ b/src/widgets/kiran-passwd-edit/kiran-passwd-edit.cpp -@@ -0,0 +1,169 @@ -+/** -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * kiranwidgets-qt5 is licensed under Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You may obtain a copy of Mulan PSL v2 at: -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * -+ * Author: liuxinhao -+ */ -+#include "kiran-passwd-edit.h" -+ -+#include -+#include -+#include -+ -+class KiranPasswdEditPrivate -+{ -+public: -+ KiranPasswdEditPrivate(KiranPasswdEdit *qq) -+ : q(qq) -+ { -+ } -+ void initialize(); -+ void echoModeToggled(); -+ void showToggleEchoModeAction(const QString &text); -+ -+ QIcon passwordIcon; -+ QIcon visibleIcon; -+ -+ QLineEdit *passwordLineEdit = nullptr; -+ QAction *toggleEchoModeAction = nullptr; -+ bool isToggleEchoModeAvailable = true; -+ bool revealPasswordAvailable = true; -+ KiranPasswdEdit *const q; -+}; -+ -+void KiranPasswdEditPrivate::initialize() -+{ -+ QIcon visibilityIcon = QIcon::fromTheme(QStringLiteral("visibility"), QIcon(QStringLiteral(":/icons/visibility.svg"))); -+ toggleEchoModeAction = passwordLineEdit->addAction(visibilityIcon, QLineEdit::TrailingPosition); -+ toggleEchoModeAction->setObjectName(QStringLiteral("visibilityAction")); -+ toggleEchoModeAction->setVisible(false); -+ toggleEchoModeAction->setToolTip(QObject::tr("Change the visibility of the password", "@info:tooltip")); -+ q->connect(toggleEchoModeAction, &QAction::triggered, q, [this]() -+ { echoModeToggled(); }); -+ q->connect(passwordLineEdit, &QLineEdit::textChanged, q, [this](const QString &str) -+ { showToggleEchoModeAction(str); }); -+} -+ -+void KiranPasswdEditPrivate::showToggleEchoModeAction(const QString &text) -+{ -+ if (revealPasswordAvailable) -+ { -+ toggleEchoModeAction->setVisible(isToggleEchoModeAvailable && (passwordLineEdit->echoMode() == QLineEdit::Normal || !text.isEmpty())); -+ } -+ else -+ { -+ toggleEchoModeAction->setVisible(false); -+ } -+} -+ -+void KiranPasswdEditPrivate::echoModeToggled() -+{ -+ if (passwordLineEdit->echoMode() == QLineEdit::Password) -+ { -+ passwordLineEdit->setEchoMode(QLineEdit::Normal); -+ if (passwordIcon.isNull()) -+ { -+ passwordIcon = QIcon(":/kiranwidgets-qt5/images/passwd-edit/reveal-passwd.svg"); -+ } -+ toggleEchoModeAction->setIcon(passwordIcon); -+ } -+ else if (passwordLineEdit->echoMode() == QLineEdit::Normal) -+ { -+ if (visibleIcon.isNull()) -+ { -+ visibleIcon = QIcon(":/kiranwidgets-qt5/images/passwd-edit/unreveal-passwd.svg"); -+ } -+ passwordLineEdit->setEchoMode(QLineEdit::Password); -+ toggleEchoModeAction->setIcon(visibleIcon); -+ } -+ Q_EMIT q->echoModeChanged(passwordLineEdit->echoMode()); -+} -+ -+KiranPasswdEdit::KiranPasswdEdit(QWidget *parent) -+ : QWidget(parent), d_ptr(new KiranPasswdEditPrivate(this)) -+{ -+ QHBoxLayout *mainLayout = new QHBoxLayout(this); -+ mainLayout->setObjectName(QStringLiteral("mainlayout")); -+ mainLayout->setContentsMargins(0, 0, 0, 0); -+ d_ptr->passwordLineEdit = new QLineEdit(this); -+ d_ptr->passwordLineEdit->setObjectName(QStringLiteral("passwordlineedit")); -+ d_ptr->passwordLineEdit->setEchoMode(QLineEdit::Password); -+ connect(d_ptr->passwordLineEdit, &QLineEdit::textChanged, this, &KiranPasswdEdit::passwordChanged); -+ setFocusProxy(d_ptr->passwordLineEdit); -+ setFocusPolicy(d_ptr->passwordLineEdit->focusPolicy()); -+ mainLayout->addWidget(d_ptr->passwordLineEdit); -+ d_ptr->initialize(); -+ -+ setStyleSheet("QLineEdit[echoMode=\"2\"]{ lineedit-password-character: 9679; }"); -+} -+ -+KiranPasswdEdit::~KiranPasswdEdit() = default; -+ -+void KiranPasswdEdit::setPassword(const QString &password) -+{ -+ if (d_ptr->passwordLineEdit->text() != password) -+ { -+ d_ptr->isToggleEchoModeAvailable = password.isEmpty(); -+ d_ptr->passwordLineEdit->setText(password); -+ } -+} -+ -+QString KiranPasswdEdit::password() const -+{ -+ return d_ptr->passwordLineEdit->text(); -+} -+ -+void KiranPasswdEdit::clear() -+{ -+ d_ptr->passwordLineEdit->clear(); -+} -+ -+void KiranPasswdEdit::setClearButtonEnabled(bool clear) -+{ -+ d_ptr->passwordLineEdit->setClearButtonEnabled(clear); -+} -+ -+bool KiranPasswdEdit::isClearButtonEnabled() const -+{ -+ return d_ptr->passwordLineEdit->isClearButtonEnabled(); -+} -+ -+void KiranPasswdEdit::setEchoMode(QLineEdit::EchoMode mode) -+{ -+ d_ptr->passwordLineEdit->setEchoMode(mode); -+} -+ -+QLineEdit::EchoMode KiranPasswdEdit::echoMode() const -+{ -+ return d_ptr->passwordLineEdit->echoMode(); -+} -+ -+QLineEdit *KiranPasswdEdit::lineEdit() const -+{ -+ return d_ptr->passwordLineEdit; -+} -+ -+void KiranPasswdEdit::setRevealPasswordAvailable(bool reveal) -+{ -+ d_ptr->revealPasswordAvailable = reveal; -+ d_ptr->showToggleEchoModeAction(password()); -+} -+ -+bool KiranPasswdEdit::isRevealPasswordAvailable() const -+{ -+ return d_ptr->revealPasswordAvailable; -+} -+ -+QAction *KiranPasswdEdit::toggleEchoModeAction() const -+{ -+ return d_ptr->toggleEchoModeAction; -+} -+ -+#include "moc_kiran-passwd-edit.cpp" -\ No newline at end of file -diff --git a/src/widgets/kiran-passwd-edit/kiran-passwd-edit.h b/src/widgets/kiran-passwd-edit/kiran-passwd-edit.h -new file mode 100644 -index 0000000..39ceba7 ---- /dev/null -+++ b/src/widgets/kiran-passwd-edit/kiran-passwd-edit.h -@@ -0,0 +1,60 @@ -+/** -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * kiranwidgets-qt5 is licensed under Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You may obtain a copy of Mulan PSL v2 at: -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * -+ * Author: liuxinhao -+ */ -+#ifndef __KIRAN_PASSWD_EDIT_H__ -+#define __KIRAN_PASSWD_EDIT_H__ -+ -+#include -+#include -+#include -+ -+class QAction; -+class KiranPasswdEditPrivate; -+ -+class KiranPasswdEdit : public QWidget -+{ -+ Q_OBJECT -+ Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) -+ Q_PROPERTY(bool clearButtonEnabled READ isClearButtonEnabled WRITE setClearButtonEnabled) -+ Q_PROPERTY(QLineEdit::EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) -+ Q_DECLARE_PRIVATE(KiranPasswdEdit) -+public: -+ explicit KiranPasswdEdit(QWidget *parent = nullptr); -+ ~KiranPasswdEdit() override; -+ -+ void setPassword(const QString &password); -+ QString password() const; -+ -+ void clear(); -+ -+ void setClearButtonEnabled(bool clear); -+ bool isClearButtonEnabled() const; -+ -+ void setEchoMode(QLineEdit::EchoMode mode); -+ QLineEdit::EchoMode echoMode() const; -+ -+ void setRevealPasswordAvailable(bool reveal); -+ bool isRevealPasswordAvailable() const; -+ -+ QAction *toggleEchoModeAction() const; -+ QLineEdit *lineEdit() const; -+ -+Q_SIGNALS: -+ void echoModeChanged(QLineEdit::EchoMode echoMode); -+ void passwordChanged(const QString &password); -+ -+private: -+ KiranPasswdEditPrivate *d_ptr; -+}; -+ -+#endif -\ No newline at end of file -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index cc86b89..e8bcaf5 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -25,4 +25,6 @@ ADD_TEST_ENTRY(kiran-message-box-test) - ADD_TEST_ENTRY(kiran-sidebar-widget-test) - ADD_TEST_ENTRY(kiran-hover-tips-test) - ADD_TEST_ENTRY(kiran-tips-test) --ADD_TEST_ENTRY(kiran-color-block-test) -\ No newline at end of file -+ADD_TEST_ENTRY(kiran-color-block-test) -+ADD_TEST_ENTRY(kiran-passwd-edit-test) -+ADD_TEST_ENTRY(kiran-label-test) -\ No newline at end of file -diff --git a/test/kiran-label-test.cpp b/test/kiran-label-test.cpp -new file mode 100644 -index 0000000..39ccd7a ---- /dev/null -+++ b/test/kiran-label-test.cpp -@@ -0,0 +1,94 @@ -+#include "kiran-label/kiran-label.h" -+ -+#include -+#include -+#include -+#include -+ -+#define TEST_TEXT_1 "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend."\ -+ "hello, my friend." -+ -+ -+#define TEST_TEXT_2 "wow!!!!"\ -+ "wow!!!!"\ -+ "wow!!!!"\ -+ "wow!!!!"\ -+ "wow!!!!"\ -+ "wow!!!!"\ -+ "wow!!!!"\ -+ -+class KiranLabelTest: public QObject -+{ -+ Q_OBJECT -+private slots: -+ void initTestCase() -+ { -+ kiranLabel = new KiranLabel; -+ kiranLabel->resize(500, 200); -+ kiranLabel->show(); -+ QTest::qWaitForWindowExposed(kiranLabel); -+ } -+ -+ void testElideRight() -+ { -+ kiranLabel->resize(500, 200); -+ kiranLabel->setText(TEST_TEXT_1); -+ kiranLabel->setElideMode(Qt::ElideRight); -+ QTest::qWait(1000); -+ kiranLabel->resize(200, 200); -+ QTest::qWait(1000); -+ kiranLabel->setText(TEST_TEXT_2); -+ QTest::qWait(1000); -+ } -+ -+ void testElideLeft() -+ { -+ kiranLabel->resize(500, 200); -+ kiranLabel->setText(TEST_TEXT_1); -+ kiranLabel->setElideMode(Qt::ElideLeft); -+ QTest::qWait(1000); -+ kiranLabel->resize(200, 200); -+ QTest::qWait(1000); -+ kiranLabel->setText(TEST_TEXT_2); -+ QTest::qWait(1000); -+ } -+ -+ void testElideMiddle() -+ { -+ kiranLabel->resize(500, 200); -+ kiranLabel->setText(TEST_TEXT_1); -+ kiranLabel->setElideMode(Qt::ElideMiddle); -+ QTest::qWait(1000); -+ kiranLabel->resize(200, 200); -+ QTest::qWait(1000); -+ kiranLabel->setText(TEST_TEXT_2); -+ QTest::qWait(1000); -+ } -+ -+ void cleanupTestCase() -+ { -+ kiranLabel->hide(); -+ delete kiranLabel; -+ } -+ -+private: -+ KiranLabel* kiranLabel; -+}; -+ -+QTEST_MAIN(KiranLabelTest) -+#include "kiran-label-test.moc" -\ No newline at end of file -diff --git a/test/kiran-passwd-edit-test.cpp b/test/kiran-passwd-edit-test.cpp -new file mode 100644 -index 0000000..2b06253 ---- /dev/null -+++ b/test/kiran-passwd-edit-test.cpp -@@ -0,0 +1,50 @@ -+#include "kiran-passwd-edit/kiran-passwd-edit.h" -+ -+#include -+#include -+#include -+#include -+ -+class KiranPasswdEditTest: public QObject -+{ -+ Q_OBJECT -+private slots: -+ void initTestCase() -+ { -+ passwdEdit = new KiranPasswdEdit; -+ passwdEdit->resize(500, 200); -+ passwdEdit->show(); -+ QTest::qWaitForWindowExposed(passwdEdit); -+ } -+ -+ void testClearButton() -+ { -+ passwdEdit->lineEdit()->setText("test clean button...."); -+ passwdEdit->setClearButtonEnabled(true); -+ QTest::qWait(1000); -+ passwdEdit->setClearButtonEnabled(false); -+ QTest::qWait(1000); -+ passwdEdit->lineEdit()->clear(); -+ } -+ -+ void testEchoModeButton() -+ { -+ passwdEdit->lineEdit()->setText("test text...."); -+ passwdEdit->setEchoMode(QLineEdit::Normal); -+ QTest::qWait(1000); -+ passwdEdit->lineEdit()->clear(); -+ QTest::qWait(1000); -+ } -+ -+ void cleanupTestCase() -+ { -+ passwdEdit->hide(); -+ delete passwdEdit; -+ } -+ -+private: -+ KiranPasswdEdit* passwdEdit; -+}; -+ -+QTEST_MAIN(KiranPasswdEditTest) -+#include "kiran-passwd-edit-test.moc" -\ No newline at end of file -diff --git a/translations/kiranwidgets-qt5.zh_CN.ts b/translations/kiranwidgets-qt5.zh_CN.ts -index 1cf974b..3ade04d 100644 ---- a/translations/kiranwidgets-qt5.zh_CN.ts -+++ b/translations/kiranwidgets-qt5.zh_CN.ts -@@ -101,6 +101,12 @@ - Restore Defaults - 恢复默认 - -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ 更改密码的可见性 -+ - - - TitlebarWindowSimple --- -2.33.0 - diff --git a/0002-fix-KiranSiderbarWidget-If-the-text-is-too-wide-and-.patch b/0002-fix-KiranSiderbarWidget-If-the-text-is-too-wide-and-.patch deleted file mode 100644 index 2c7ea71ed8d4fd85307cb0ec1a0c78b66bdf9f21..0000000000000000000000000000000000000000 --- a/0002-fix-KiranSiderbarWidget-If-the-text-is-too-wide-and-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d9b440c4fc2192084dd1cb531dd74f0063d8a9de Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Thu, 1 Dec 2022 16:37:12 +0800 -Subject: [PATCH 2/3] fix(KiranSiderbarWidget): If the text is too wide and too - long, it will be omitted -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 文本过宽过长超过分配空间大小的情况下,对文本进行省略 ---- - .../kiran-sidebar-widget/kiran-siderbar-delegate.cpp | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/src/widgets/kiran-sidebar-widget/kiran-siderbar-delegate.cpp b/src/widgets/kiran-sidebar-widget/kiran-siderbar-delegate.cpp -index f900fef..2ad8fbe 100644 ---- a/src/widgets/kiran-sidebar-widget/kiran-siderbar-delegate.cpp -+++ b/src/widgets/kiran-sidebar-widget/kiran-siderbar-delegate.cpp -@@ -84,7 +84,9 @@ void KiranSiderbarDelegate::paint(QPainter *painter, const QStyleOptionViewItem - { - //将存储的数据根据locale转换 - QString text = textForRole(Qt::DisplayRole, displayVar, option.locale); -- drawDisplay(painter, opt, textRect, text); -+ //处理文本过宽,超出分配的空间时,对文本进行省略 -+ QString elideText = option.fontMetrics.elidedText(text, Qt::ElideRight, textRect.width(),Qt::TextShowMnemonic); -+ drawDisplay(painter, opt, textRect, elideText); - } - - //status desc -@@ -265,6 +267,13 @@ void KiranSiderbarDelegate::doLayout(const QStyleOptionViewItem &option, const Q - int textSpaceX = pixmapSize.isEmpty() ? pixmapRectTemp.right() : pixmapRectTemp.right() + 10; - int textSpaceWidth = statusDescRectTemp.left() - (statusDescSize.isEmpty() ? 0 : 10) - textSpaceX; - QRect textRectTemp = QRect(textSpaceX, rect.y(), textSpaceWidth, rect.height()); -+ -+ //对TextSize进行限制,若文字大小超出了剩余的控空间大小,调整为剩余控件大小 -+ if ( textSize.width() > textRectTemp.width() ) -+ { -+ textSize.setWidth(textRectTemp.width()); -+ } -+ - textRect.setSize(textSize); - if (option.displayAlignment & Qt::AlignLeft) - { --- -2.33.0 - diff --git a/0003-fix-KiranTitlebarWindow-Fix-when-zoomed-twice_GTK_FR.patch b/0003-fix-KiranTitlebarWindow-Fix-when-zoomed-twice_GTK_FR.patch deleted file mode 100644 index 28a55eedb95dd73d944b030cacbab34a579f34a0..0000000000000000000000000000000000000000 --- a/0003-fix-KiranTitlebarWindow-Fix-when-zoomed-twice_GTK_FR.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c158fb1f0616606f68fdd281a4632fb927065e1f Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Thu, 1 Dec 2022 16:48:10 +0800 -Subject: [PATCH 3/3] fix(KiranTitlebarWindow): Fix when zoomed - twice_GTK_FRAME_EXTENTS attribute needs to be updated -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 修复缩放两倍时_GTK_FRAME_EXTENTS属性需要更新的问题 ---- - .../kiran-titlebar-window/kiran-titlebar-window-private.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp b/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -index b16871e..18a2aa3 100644 ---- a/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -+++ b/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -@@ -548,7 +548,8 @@ bool KiranTitlebarWindowPrivate::eventFilter(QObject *obj, QEvent *event) - // 在接近显示时进行处理设置_GTK_FRAME_EXTENTS属性 - if( m_isCompositingManagerRunning ) - { -- XLibHelper::SetShadowWidth(QX11Info::display(),q_ptr->winId(),shadowWidth,shadowWidth,shadowWidth,shadowWidth); -+ int scaledShadowWidth = q_ptr->devicePixelRatio()*shadowWidth; -+ XLibHelper::SetShadowWidth(QX11Info::display(), q_ptr->winId(), scaledShadowWidth, scaledShadowWidth, scaledShadowWidth, scaledShadowWidth); - } - break; - case QEvent::HoverMove: --- -2.33.0 - diff --git a/0004-fix-translate-add-some-translation.patch b/0004-fix-translate-add-some-translation.patch deleted file mode 100644 index 9ef9f5d1898f774026cb651ecf3de550f1a4b350..0000000000000000000000000000000000000000 --- a/0004-fix-translate-add-some-translation.patch +++ /dev/null @@ -1,758 +0,0 @@ -From 65b3dcd8af297fdf33419a5a3dd67a5001d3cf6c Mon Sep 17 00:00:00 2001 -From: wangyucheng -Date: Mon, 3 Apr 2023 10:53:30 +0800 -Subject: [PATCH] fix(translate):add some translation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 添加一些翻译 - -Relates #67661 ---- - CMakeLists.txt | 4 +- - translations/kiranwidgets-qt5.bo_CN.ts | 135 +++++++++++++++++++++++++ - translations/kiranwidgets-qt5.kk_KG.ts | 135 +++++++++++++++++++++++++ - translations/kiranwidgets-qt5.kk_KZ.ts | 135 +++++++++++++++++++++++++ - translations/kiranwidgets-qt5.mn_MN.ts | 135 +++++++++++++++++++++++++ - translations/kiranwidgets-qt5.ug_CN.ts | 135 +++++++++++++++++++++++++ - 6 files changed, 677 insertions(+), 2 deletions(-) - create mode 100644 translations/kiranwidgets-qt5.bo_CN.ts - create mode 100644 translations/kiranwidgets-qt5.kk_KG.ts - create mode 100644 translations/kiranwidgets-qt5.kk_KZ.ts - create mode 100644 translations/kiranwidgets-qt5.mn_MN.ts - create mode 100644 translations/kiranwidgets-qt5.ug_CN.ts - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 369bdea..8e81fd7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,7 +52,7 @@ file(GLOB_RECURSE STYLE_H "src/kiran-style/*.h") - file(GLOB_RECURSE RESOURCES "resources/*.qrc") - - #翻译 --set(TS_FILES "translations/kiranwidgets-qt5.zh_CN.ts") -+file(GLOB TS_FILES "translations/kiranwidgets-qt5.*.ts") - - #开发头文件,需提供到devel包的文件 - set(DEVEL_HEADER -@@ -148,4 +148,4 @@ endif() - - if( build-tests ) - add_subdirectory(test) --endif() -\ No newline at end of file -+endif() -diff --git a/translations/kiranwidgets-qt5.bo_CN.ts b/translations/kiranwidgets-qt5.bo_CN.ts -new file mode 100644 -index 0000000..836fbd0 ---- /dev/null -+++ b/translations/kiranwidgets-qt5.bo_CN.ts -@@ -0,0 +1,135 @@ -+ -+ -+ KiranTips -+ -+ -+ Form -+ རྣམ་པ། -+ -+ -+ -+ QObject -+ -+ -+ OK -+ འགྲིགས། -+ -+ -+ -+ Save -+ གྲོན་ཆུང་བྱེད་དགོས། -+ -+ -+ -+ Save All -+ ཚང་མ་ཉར་ཚགས་ཡག་པོ -+ -+ -+ -+ Open -+ སྒོ་ཕྱེ་བ། -+ -+ -+ -+ Yes -+ རེད། -+ -+ -+ -+ Yes to All -+ ཚང་མར་ཁས་བླངས་པ་རེད། -+ -+ -+ -+ No -+ མིན། -+ -+ -+ -+ No to All -+ མི་ཚང་མར་མི་ཆོག -+ -+ -+ -+ Abort -+ མངལ་ཤོར་དུ་འཇུག་པ། -+ -+ -+ -+ Retry -+ བསྐྱར་དུ་ཞིབ་བཤེར་བྱ་དགོས། -+ -+ -+ -+ Ignore -+ སྣང་མེད་དུ་བཞག་ -+ -+ -+ -+ Close -+ སྒོ་རྒྱག་པ། -+ -+ -+ -+ Cancel -+ ཕྱིར་འཐེན། -+ -+ -+ -+ Discard -+ བེད་མེད་དུ་བསྐྱུར་བ། -+ -+ -+ -+ Help -+ རོགས་རམ་བྱེད་པ། -+ -+ -+ -+ Apply -+ རེ་ཞུ་ -+ -+ -+ -+ Reset -+ བསྐྱར་དུ་བཀོད་སྒྲིག་བྱེད་པ -+ -+ -+ -+ Restore Defaults -+ སྔོན་ཆད་ཀྱི་གནས་ཚུལ་སླར་གསོ་ -+ -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ གསང་གྲངས་ཀྱི་མཐོང་ཚད་ལ་འགྱུར་ལྡོག་གཏོང་དགོས། -+ -+ -+ -+ TitlebarWindowSimple -+ -+ -+ Form -+ རྣམ་པ། -+ -+ -+ -+ KiranTitlebarWindowSimple -+ KiranTitlebarWindowSimple -+ -+ -+ -+ TitlebarWindowUI -+ -+ -+ Form -+ རྣམ་པ། -+ -+ -+ -+ KiranTitlebarWindow -+ ཁི་ལན་ཐི་ལེ་ཐི་པ་ཝུན་ཏུའོ་ཡིས་བཤད་རྒྱུར། -+ -+ -+ -\ No newline at end of file -diff --git a/translations/kiranwidgets-qt5.kk_KG.ts b/translations/kiranwidgets-qt5.kk_KG.ts -new file mode 100644 -index 0000000..750ff78 ---- /dev/null -+++ b/translations/kiranwidgets-qt5.kk_KG.ts -@@ -0,0 +1,135 @@ -+ -+ -+ KiranTips -+ -+ -+ Form -+ форма -+ -+ -+ -+ QObject -+ -+ -+ OK -+ жакшы -+ -+ -+ -+ Save -+ сактоо -+ -+ -+ -+ Save All -+ Баарын сактоо -+ -+ -+ -+ Open -+ ачуу -+ -+ -+ -+ Yes -+ Ооба -+ -+ -+ -+ Yes to All -+ Ооба баарына -+ -+ -+ -+ No -+ жок -+ -+ -+ -+ No to All -+ Баарына жок -+ -+ -+ -+ Abort -+ токтотуу -+ -+ -+ -+ Retry -+ кайра -+ -+ -+ -+ Ignore -+ этибарга албаңыз -+ -+ -+ -+ Close -+ жакын -+ -+ -+ -+ Cancel -+ жокко чыгаруу -+ -+ -+ -+ Discard -+ жокко чыгаруу -+ -+ -+ -+ Help -+ жардам -+ -+ -+ -+ Apply -+ колдонуу -+ -+ -+ -+ Reset -+ баштапкы абалга келтирүү -+ -+ -+ -+ Restore Defaults -+ Демейки калыбына келтирүү -+ -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ Сырсөздүн көрүнүшүн өзгөртүңүз -+ -+ -+ -+ TitlebarWindowSimple -+ -+ -+ Form -+ форма -+ -+ -+ -+ KiranTitlebarWindowSimple -+ KiranTitlebarWindowSimple -+ -+ -+ -+ TitlebarWindowUI -+ -+ -+ Form -+ форма -+ -+ -+ -+ KiranTitlebarWindow -+ KiranTitlebarWindow -+ -+ -+ -\ No newline at end of file -diff --git a/translations/kiranwidgets-qt5.kk_KZ.ts b/translations/kiranwidgets-qt5.kk_KZ.ts -new file mode 100644 -index 0000000..d6d29c1 ---- /dev/null -+++ b/translations/kiranwidgets-qt5.kk_KZ.ts -@@ -0,0 +1,135 @@ -+ -+ -+ KiranTips -+ -+ -+ Form -+ Пішіні -+ -+ -+ -+ QObject -+ -+ -+ OK -+ Жарайды -+ -+ -+ -+ Save -+ & Сақтау -+ -+ -+ -+ Save All -+ Барлығын сақтау -+ -+ -+ -+ Open -+ Ашу -+ -+ -+ -+ Yes -+ Иә -+ -+ -+ -+ Yes to All -+ Барлығына -+ -+ -+ -+ No -+ Жоқ -+ -+ -+ -+ No to All -+ Барлығына жоқ деп айтыңыз -+ -+ -+ -+ Abort -+ Доғару -+ -+ -+ -+ Retry -+ Әрекетті қайталау -+ -+ -+ -+ Ignore -+ Елемеу -+ -+ -+ -+ Close -+ Жабу -+ -+ -+ -+ Cancel -+ Бас тарту -+ -+ -+ -+ Discard -+ & Қоқыс тастау -+ -+ -+ -+ Help -+ Анықтама -+ -+ -+ -+ Apply -+ Қолдану -+ -+ -+ -+ Reset -+ Іс -+ -+ -+ -+ Restore Defaults -+ Әдепкісін қалпына келтіру -+ -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ Парольдің көрінуін өзгертіңіз -+ -+ -+ -+ TitlebarWindowSimple -+ -+ -+ Form -+ Пішіні -+ -+ -+ -+ KiranTitlebarWindowSimple -+ IranitleBarindoMaple -+ -+ -+ -+ TitlebarWindowUI -+ -+ -+ Form -+ Пішіні -+ -+ -+ -+ KiranTitlebarWindow -+ IranitleBarindow -+ -+ -+ -\ No newline at end of file -diff --git a/translations/kiranwidgets-qt5.mn_MN.ts b/translations/kiranwidgets-qt5.mn_MN.ts -new file mode 100644 -index 0000000..71085e7 ---- /dev/null -+++ b/translations/kiranwidgets-qt5.mn_MN.ts -@@ -0,0 +1,135 @@ -+ -+ -+ KiranTips -+ -+ -+ Form -+ Маягт -+ -+ -+ -+ QObject -+ -+ -+ OK -+ ЗА -+ -+ -+ -+ Save -+ Хадгалах -+ -+ -+ -+ Save All -+ Бүгдийг авраач -+ -+ -+ -+ Open -+ Нээлттэй -+ -+ -+ -+ Yes -+ Тийм ээ -+ -+ -+ -+ Yes to All -+ Бүх хүмүүст тийм -+ -+ -+ -+ No -+ Үгүй -+ -+ -+ -+ No to All -+ Бүгдэд үгүй -+ -+ -+ -+ Abort -+ Аборт -+ -+ -+ -+ Retry -+ Ретри -+ -+ -+ -+ Ignore -+ Үл тоомсорлох -+ -+ -+ -+ Close -+ Хаах -+ -+ -+ -+ Cancel -+ Цуцлах -+ -+ -+ -+ Discard -+ Хаяг -+ -+ -+ -+ Help -+ Тусламж -+ -+ -+ -+ Apply -+ Хэрэгжүүлэх -+ -+ -+ -+ Reset -+ Дахин тохируулах -+ -+ -+ -+ Restore Defaults -+ Дефолтыг сэргээх -+ -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ Нууц үгийн харагдах байдлыг өөрчлөх -+ -+ -+ -+ TitlebarWindowSimple -+ -+ -+ Form -+ Маягт -+ -+ -+ -+ KiranTitlebarWindowSimple -+ KiranTitlebarWindowSimple -+ -+ -+ -+ TitlebarWindowUI -+ -+ -+ Form -+ Маягт -+ -+ -+ -+ KiranTitlebarWindow -+ КирантлбарВиндов -+ -+ -+ -\ No newline at end of file -diff --git a/translations/kiranwidgets-qt5.ug_CN.ts b/translations/kiranwidgets-qt5.ug_CN.ts -new file mode 100644 -index 0000000..0901937 ---- /dev/null -+++ b/translations/kiranwidgets-qt5.ug_CN.ts -@@ -0,0 +1,135 @@ -+ -+ -+ KiranTips -+ -+ -+ Form -+ جەدۋەل -+ -+ -+ -+ QObject -+ -+ -+ OK -+ ماقۇل -+ -+ -+ -+ Save -+ ساقلاش -+ -+ -+ -+ Save All -+ ھەممىنى ساقلىۋېلىش -+ -+ -+ -+ Open -+ ئېچىش -+ -+ -+ -+ Yes -+ شۇنداق -+ -+ -+ -+ Yes to All -+ ھەئە ھەممىگە -+ -+ -+ -+ No -+ ياق -+ -+ -+ -+ No to All -+ ھەممە ئادەم يوق -+ -+ -+ -+ Abort -+ توختىت -+ -+ -+ -+ Retry -+ قايتا قايتا تىرشىش -+ -+ -+ -+ Ignore -+ نەزەردىن ساقىت قىلىش -+ -+ -+ -+ Close -+ ياپ -+ -+ -+ -+ Cancel -+ ئەمەلدىن قالدۇرۇش -+ -+ -+ -+ Discard -+ ۋازكەس -+ -+ -+ -+ Help -+ ياردەم -+ -+ -+ -+ Apply -+ ئىلتىماس قىلىش -+ -+ -+ -+ Reset -+ قايتا تىڭشى -+ -+ -+ -+ Restore Defaults -+ كۆڭۈلدىكىلەرنى ئەسلىگە كەلتۈرۈش -+ -+ -+ -+ Change the visibility of the password -+ @info:tooltip -+ پارولنىڭ كۆرۈش دەرىجىسىنى ئۆزگەرتىش -+ -+ -+ -+ TitlebarWindowSimple -+ -+ -+ Form -+ جەدۋەل -+ -+ -+ -+ KiranTitlebarWindowSimple -+ KiranTitlebarWindowSimple -+ -+ -+ -+ TitlebarWindowUI -+ -+ -+ Form -+ جەدۋەل -+ -+ -+ -+ KiranTitlebarWindow -+ KiranTitlebarWindow -+ -+ -+ -\ No newline at end of file --- -2.33.0 - diff --git a/0005-fix-icon-Update-the-title-bar-icon-when-the-window-s.patch b/0005-fix-icon-Update-the-title-bar-icon-when-the-window-s.patch deleted file mode 100644 index 11664ceb8b416422df8bc313af99dbc50c652496..0000000000000000000000000000000000000000 --- a/0005-fix-icon-Update-the-title-bar-icon-when-the-window-s.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 3eec02dc69346fc452aeb1ee2dc29803848500e7 Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Sun, 25 Jun 2023 19:07:19 +0800 -Subject: [PATCH] fix(icon): Update the title bar icon when the window state - changes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 窗口状态改变时,更新标题栏图标 - -Closes #I7FTM3 ---- - .../kiran-titlebar-window/kiran-titlebar-window-private.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp b/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -index 18a2aa3..8252d97 100644 ---- a/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -+++ b/src/widgets/kiran-titlebar-window/kiran-titlebar-window-private.cpp -@@ -585,6 +585,7 @@ bool KiranTitlebarWindowPrivate::eventFilter(QObject *obj, QEvent *event) - { - m_frame->setRadius(radius); - } -+ updateTitlebarButtonIcon(); - break; - default: - break; --- -2.33.0 - diff --git a/0006-fix-qt5.9.7-fits-the-Qt5.9.7-interface.patch b/0006-fix-qt5.9.7-fits-the-Qt5.9.7-interface.patch deleted file mode 100644 index 6fb6fc11e2ebf1faaf4d7842a750dd73252f7377..0000000000000000000000000000000000000000 --- a/0006-fix-qt5.9.7-fits-the-Qt5.9.7-interface.patch +++ /dev/null @@ -1,97 +0,0 @@ -From c6b513e64aa283ee22fab2b4ba862950bcafd28f Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Tue, 5 Sep 2023 15:18:49 +0800 -Subject: [PATCH] fix(qt5.9.7): fits the Qt5.9.7 interface -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- 适配Qt5.9.7接口,修复编译报错 ---- - src/widgets/kiran-label/kiran-label.cpp | 20 ++++++++++++-------- - src/widgets/kiran-tips/kiran-tips.cpp | 6 +++++- - test/kiran-image-selector-test.cpp | 4 ++-- - 3 files changed, 19 insertions(+), 11 deletions(-) - -diff --git a/src/widgets/kiran-label/kiran-label.cpp b/src/widgets/kiran-label/kiran-label.cpp -index 6302357..3dcd0e5 100644 ---- a/src/widgets/kiran-label/kiran-label.cpp -+++ b/src/widgets/kiran-label/kiran-label.cpp -@@ -1,14 +1,14 @@ - /** -- * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. -+ * Copyright (c) 2020 ~ 2022 KylinSec Co., Ltd. - * kiranwidgets-qt5 is licensed under Mulan PSL v2. -- * You can use this software according to the terms and conditions of the Mulan PSL v2. -+ * You can use this software according to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: -- * http://license.coscl.org.cn/MulanPSL2 -- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -- * See the Mulan PSL v2 for more details. -- * -+ * http://license.coscl.org.cn/MulanPSL2 -+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -+ * See the Mulan PSL v2 for more details. -+ * - * Author: liuxinhao - */ - -@@ -73,7 +73,11 @@ QRectF KiranLabelPrivate::documentRect(QLabelPrivate *ld) - QFlag(ld->align)); - int m = ld->indent; - if (m < 0 && q->frameWidth()) // no indent, but we do have a frame -+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) - m = q->fontMetrics().horizontalAdvance(QLatin1Char('x')) / 2 - ld->margin; -+#else -+ m = q->fontMetrics().width(QLatin1Char('x')) / 2 - ld->margin; -+#endif - if (m > 0) - { - if (align & Qt::AlignLeft) -diff --git a/src/widgets/kiran-tips/kiran-tips.cpp b/src/widgets/kiran-tips/kiran-tips.cpp -index d5bcbf6..91d2e6f 100644 ---- a/src/widgets/kiran-tips/kiran-tips.cpp -+++ b/src/widgets/kiran-tips/kiran-tips.cpp -@@ -231,7 +231,11 @@ QSize KiranTips::getRightSize() const - QFontMetrics fontMetrics(font); - QMargins layoutContentMargins = this->layout()->contentsMargins(); - -+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) - d_ptr->m_labelText->setFixedWidth(fontMetrics.horizontalAdvance(d_ptr->m_labelText->text()) + 10); -+#else -+ d_ptr->m_labelText->setFixedWidth(fontMetrics.width(d_ptr->m_labelText->text()) + 10); -+#endif - d_ptr->m_labelText->setFixedHeight(fontMetrics.height()); - - QSize size; -@@ -355,7 +359,7 @@ void KiranTipsPrivate::init() - m_EnterAnimation->setEasingCurve(QEasingCurve::OutQuad); - - // clang-format off -- connect(&m_fadeOutTimer, &QTimer::timeout, [this](){ -+ connect(&m_fadeOutTimer, &QTimer::timeout, [this](){ - q_ptr->hideTip(); - }); - connect(m_EnterAnimation, &QPropertyAnimation::finished, [this](){ -diff --git a/test/kiran-image-selector-test.cpp b/test/kiran-image-selector-test.cpp -index 7651e07..cf306cd 100644 ---- a/test/kiran-image-selector-test.cpp -+++ b/test/kiran-image-selector-test.cpp -@@ -43,8 +43,8 @@ private slots: - - void testItemSpacing() - { -- QList itemSpacingSet = {5,10,15,20,25,50,100,150,300,10}; -- foreach ( const int& spacing, itemSpacingSet ) -+ QList itemSpacingSet = {5,10,15,20,25,50,100,150,300,10}; -+ foreach ( const quint64& spacing, itemSpacingSet ) - { - imageSelector->setItemSpacing(spacing); - QCOMPARE(imageSelector->itemSpacing(),spacing); --- -2.33.0 - diff --git a/kiran-widgets-qt5-2.4.0.tar.gz b/kiran-widgets-qt5-2.4.0.tar.gz deleted file mode 100644 index 0761d81c8caca6c1a4921dd193dc6d7db5815a54..0000000000000000000000000000000000000000 Binary files a/kiran-widgets-qt5-2.4.0.tar.gz and /dev/null differ diff --git a/kiran-widgets-qt5-2.4.1.tar.gz b/kiran-widgets-qt5-2.4.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e90d5854c90e0f4e4557a8a818c30f1e89e25d28 Binary files /dev/null and b/kiran-widgets-qt5-2.4.1.tar.gz differ diff --git a/kiran-widgets-qt5.spec b/kiran-widgets-qt5.spec index 1ccfac5093c0a2d9b06f59b64bbf189ab77dde73..8aae5795a8baf44a7c5a439f537d2d8e09b9f2ff 100644 --- a/kiran-widgets-qt5.spec +++ b/kiran-widgets-qt5.spec @@ -1,19 +1,12 @@ Name: kiran-widgets-qt5 -Version: 2.4.0 -Release: 6 +Version: 2.4.1 +Release: 1 Summary: Encapsulated QT Widget Summary(zh_CN): 封装的Qt小部件 License: MulanPSL-2.0 Source0: %{name}-%{version}.tar.gz -Patch0001: 0001-feat-KiranLabel-KiranPasswdEdit-new-control-KiranLab.patch -Patch0002: 0002-fix-KiranSiderbarWidget-If-the-text-is-too-wide-and-.patch -Patch0003: 0003-fix-KiranTitlebarWindow-Fix-when-zoomed-twice_GTK_FR.patch -Patch0004: 0004-fix-translate-add-some-translation.patch -Patch0005: 0005-fix-icon-Update-the-title-bar-icon-when-the-window-s.patch -Patch0006: 0006-fix-qt5.9.7-fits-the-Qt5.9.7-interface.patch - BuildRequires: cmake >= 3.5 BuildRequires: gcc-c++ @@ -83,6 +76,9 @@ make %{?_smp_mflags} rm -rf %{buildroot} %changelog +* Tue Sep 05 2023 liuxinhao - 2.4.1-1 +- KYBD: rebuild + * Tue Sep 05 2023 liuxinhao - 2.4.0-6 - KYOS-F: fits the Qt5.9.7 interface