qt5-ukui-platformtheme/0000755000175000017500000000000014205353521014027 5ustar fengfengqt5-ukui-platformtheme/qt5-ukui.pro0000644000175000017500000000016114205314452016233 0ustar fengfengTEMPLATE = subdirs SUBDIRS += \ qt5-ukui-platformtheme \ ukui-styles \ libqt5-ukui-style \ test qt5-ukui-platformtheme/CONTRIBUTING.md0000644000175000017500000000673214205314371016270 0ustar fengfeng# How to contribute ## language ### [zh_CN](CONTRIBUTING_zh_CN.md) ## As an user UKUI style effects almost whole qt's applications in UKUI Desktop Environment. Such as button's rounded radius and color, tab page's switch animations, menu's transparency and blur effects, etc. We hope users point out the inconsistencies and lackes of details. That will help us make targeted improvements. However, ukui-style can not take over all works of application's displaying. One application might have it own style, even in UKUI. And there also might be some adjustment for applications which using ukui-style. It is hard to distinguish wether it is fully ukui-styled application for user. Anyway, if you found out a problem about visual senses or bugs. You can emit a issue to us. Whatever here or at projects which have problems. ## As a developer If you are familiar with Qt5 QPA platformtheme and QStyle, you will know the structure of this project quickly. This project is similar to some other platformtheme project, such as qt5-gtk2-platformtheme, qt5ct, kde, etc. By the platformtheme and style plugins of this project, we build our own desktop environment theme, that means not only our own applications, but also other qt's applications will seemed as UKUI style in our DE, too. Platformtheme will completely resove the problem that developers have to cost much time for tuning style to attach UKUI's desgin. We hope developers spend more their time in business logic and functions, and also can ensure the styled unity even in other platform, such as KDE. To archive that goal, it's hard to rely on me alone. Developers also need to understand how to develop an application in a standard, and how to comply with standards and expand the application. By doing that you will find its significance in long term. For now, Although I have put almost all my energy into the development of this project, It still progresses very slowly. There are many troubles that want volunteers' help to resolve. ### Platform Theme Level As other platform themes have done, we also want to provide all the features about a platform. - Platform Dialogs, such as filechooser dialogs. - Platform Configs, such as font. - Platform Extensions, such as global menu. Gtk's applcations theme is also a problem, we have to consider providing a way to uniform the applications' styles between Qt and Gtk. ### Styles Level A nice looking style is always complex, such as breeze and oxygen. For making our own style, we have to spend a lot of time for UI designing and details maintaining. As a developer, we need change the desgin to codes. There could be roughly divided into 2 parts. - Tuning of control's painting, such as button, menu's round radius. System or control's palette. - Combing animations with controls, such as tab switching with sliding, button hovering with fading. You first need to understand how QStyle and style plugins work, how they draw a control and let control animated. ### Animations Frameworks Level Animation Frameworks is usually based on Qt's Animations Frameworks. It aims to: - Make widgets and view items animated, and let the state changing more smoothly and cool. Note that even though Animations Frameworks is relatively independent with platform. But it will have great influence on the theme or style. ## Active communication If you were intersted to contribute, I would also be pleasure to help you understand this project for my best. Starting with an issue or e-mail is good. Yue Lan, qt5-ukui-platformtheme/COPYING0000644000175000017500000001674414205314371015076 0ustar fengfeng GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. qt5-ukui-platformtheme/test/0000755000175000017500000000000014205314371015006 5ustar fengfengqt5-ukui-platformtheme/test/mps-style-application/0000755000175000017500000000000014205314371021244 5ustar fengfengqt5-ukui-platformtheme/test/mps-style-application/mainwindow.h0000644000175000017500000000207614205314371023576 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H qt5-ukui-platformtheme/test/mps-style-application/mainwindow.cpp0000644000175000017500000000176014205314371024130 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } qt5-ukui-platformtheme/test/mps-style-application/mps-style-application.pro0000644000175000017500000000245514205314371026232 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2020-02-11T15:20:45 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = mps-style-application TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += plugin c++11 link_pkgconfig PKGCONFIG += gsettings-qt include(../../libqt5-ukui-style/libqt5-ukui-style.pri) SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/mps-style-application/mainwindow.ui0000644000175000017500000000515614205314371023766 0ustar fengfeng MainWindow 0 0 400 300 MainWindow 50 20 337 200 PushButton ... RadioButton QDialogButtonBox::Cancel|QDialogButtonBox::Ok Qt::Horizontal 24 0 0 400 37 TopToolBarArea false qt5-ukui-platformtheme/test/mps-style-application/main.cpp0000644000175000017500000000200714205314371022673 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include #include "internal-styles/mps-style.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle(new MPSStyle); MainWindow w; w.show(); return a.exec(); } qt5-ukui-platformtheme/test/system-settings/0000755000175000017500000000000014205314371020170 5ustar fengfengqt5-ukui-platformtheme/test/system-settings/mainwindow.h0000644000175000017500000000256414205314371022524 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_comboBox_currentIndexChanged(const QString &arg1); void on_comboBox_2_currentIndexChanged(const QString &arg1); void on_horizontalSlider_valueChanged(int value); void on_comboBox_3_currentTextChanged(const QString &arg1); void on_spinBox_valueChanged(int arg1); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H qt5-ukui-platformtheme/test/system-settings/mainwindow.cpp0000644000175000017500000000720014205314371023047 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include #include bool init_style = false; bool init_icon_theme = false; bool init_system_font = false; bool init_system_font_size = false; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QGSettings settings("org.ukui.style", "/org/ukui/style/"); auto currentStyle = settings.get("styleName").toString(); auto currentIconTheme = settings.get("iconThemeName").toString(); auto styles = QStyleFactory::keys(); styles.removeOne("ukui"); QStringListModel *style_model = new QStringListModel(styles, this); ui->comboBox->setModel(style_model); ui->comboBox->setCurrentText(currentStyle); QDir iconThemePaths = QDir("/usr/share/icons"); auto iconThemes = iconThemePaths.entryList(QDir::Dirs); QStringListModel *icon_theme_model = new QStringListModel(iconThemes, this); ui->comboBox_2->setModel(icon_theme_model); ui->comboBox_2->setCurrentText(currentIconTheme); QFontDatabase db; QStringListModel *fonts_model = new QStringListModel(db.families(), this); ui->comboBox_3->setModel(fonts_model); ui->comboBox_3->setCurrentText(settings.get("systemFont").toString()); ui->spinBox->setValue(settings.get("systemFontSize").toString().toDouble()); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1) { if (!init_style) { init_style = true; return; } //change style QGSettings settings("org.ukui.style", "/org/ukui/style/"); settings.set("styleName", arg1); } void MainWindow::on_comboBox_2_currentIndexChanged(const QString &arg1) { if (!init_icon_theme) { init_icon_theme = true; return; } //change icon theme QGSettings settings("org.ukui.style", "/org/ukui/style/"); settings.set("iconThemeName", arg1); } void MainWindow::on_horizontalSlider_valueChanged(int value) { QGSettings settings("org.ukui.style", "/org/ukui/style/"); settings.set("menuTransparency", value); } void MainWindow::on_comboBox_3_currentTextChanged(const QString &arg1) { if (!init_system_font) { init_system_font = true; return; } bool enableMenuSettings = true; if (arg1 != "ukui-white" || arg1 != "ukui-black") { enableMenuSettings = false; } ui->horizontalSlider->setEnabled(enableMenuSettings); QGSettings settings("org.ukui.style", "/org/ukui/style/"); settings.set("systemFont", arg1); } void MainWindow::on_spinBox_valueChanged(int arg1) { if (!init_system_font_size) { init_system_font_size = true; return; } QGSettings settings("org.ukui.style", "/org/ukui/style/"); settings.set("systemFontSize", arg1); } qt5-ukui-platformtheme/test/system-settings/system-settings.pro0000644000175000017500000000235014205314371024074 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2020-01-03T20:37:30 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = system-settings TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 link_pkgconfig PKGCONFIG += gsettings-qt SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/system-settings/mainwindow.ui0000644000175000017500000000462514205314371022712 0ustar fengfeng MainWindow 0 0 400 344 MainWindow style icon menu opacity Qt::Horizontal font 11 0 0 400 29 TopToolBarArea false qt5-ukui-platformtheme/test/system-settings/main.cpp0000644000175000017500000000200414205314371021614 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); QFontDatabase db; return a.exec(); } qt5-ukui-platformtheme/test/highlighted-icon-button/0000755000175000017500000000000014205314371021525 5ustar fengfengqt5-ukui-platformtheme/test/highlighted-icon-button/mainwindow.h0000644000175000017500000000242314205314371024053 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class QListWidget; class QMenu; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_checkBox_toggled(bool checked); void on_comboBox_currentIndexChanged(int index); private: Ui::MainWindow *ui; QListWidget *view; QMenu *menu; }; #endif // MAINWINDOW_H qt5-ukui-platformtheme/test/highlighted-icon-button/highlighted-icon-button.pro0000644000175000017500000000174114205314371026771 0ustar fengfengQT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/highlighted-icon-button/mainwindow.cpp0000644000175000017500000000614714205314371024415 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include "ui_mainwindow.h" #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->setEnabled(false); menu = new QMenu(ui->pushButton); menu->setProperty("fillIconSymbolicColor", true); menu->addAction(QIcon::fromTheme("edit-find-symbolic"), "edit-find-symbolic"); menu->addAction(QIcon::fromTheme("edit-cut-symbolic"), "edit-cut-symbolic"); menu->addAction(QIcon::fromTheme("user-trash"), "user-trash"); menu->addAction(QIcon::fromTheme("open-menu-symbolic"), "open-menu-symbolic"); menu->addAction(QIcon::fromTheme("pane-hide-symbolic"), "pane-hide-symbolic"); ui->pushButton->setMenu(menu); view = new QListWidget(this); view->resize(300, 200); view->move(100, 200); auto item = new QListWidgetItem(QIcon::fromTheme("window-close"), "window-close", view); item = new QListWidgetItem(QIcon::fromTheme("window-close-symbolic"), "window-close-symoblic", view); item = new QListWidgetItem(QIcon::fromTheme("user-trash"), "user-trash", view); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_checkBox_toggled(bool checked) { ui->pushButton->setProperty("useIconHighlightEffect", checked); ui->pushButton->update(); ui->toolButton->setProperty("useIconHighlightEffect", checked); ui->toolButton->update(); view->setProperty("useIconHighlightEffect", checked); view->viewport()->update(); menu->setProperty("useIconHighlightEffect", checked); ui->comboBox->setEnabled(checked); int mode = ui->comboBox->currentIndex(); ui->pushButton->setProperty("iconHighlightEffectMode", mode); ui->pushButton->update(); ui->toolButton->setProperty("iconHighlightEffectMode", mode); ui->toolButton->update(); view->setProperty("iconHighlightEffectMode", mode); view->viewport()->update(); menu->setProperty("iconHighlightEffectMode", mode); } void MainWindow::on_comboBox_currentIndexChanged(int index) { int mode = index; ui->pushButton->setProperty("iconHighlightEffectMode", mode); ui->pushButton->update(); ui->toolButton->setProperty("iconHighlightEffectMode", mode); ui->toolButton->update(); view->setProperty("iconHighlightEffectMode", mode); view->viewport()->update(); } qt5-ukui-platformtheme/test/highlighted-icon-button/mainwindow.ui0000644000175000017500000000467414205314371024253 0ustar fengfeng MainWindow 0 0 800 600 MainWindow 12 12 345 101 PushButton .. 36 36 use auto highlight icon ... .. 36 36 highlightOnly bothDefaultAndHighlight 0 0 800 36 qt5-ukui-platformtheme/test/highlighted-icon-button/main.cpp0000644000175000017500000000170114205314371023154 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } qt5-ukui-platformtheme/test/test.pro0000644000175000017500000000026614205314371016513 0ustar fengfengTEMPLATE = subdirs SUBDIRS += \ custom-shadow \ highlighted-icon-button \ messagebox \ region-blur \ system-settings \ tabwidget \ mps-style-application qt5-ukui-platformtheme/test/custom-shadow/0000755000175000017500000000000014205314371017603 5ustar fengfengqt5-ukui-platformtheme/test/custom-shadow/mainwindow.h0000644000175000017500000000175614205314371022141 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); }; #endif // MAINWINDOW_H qt5-ukui-platformtheme/test/custom-shadow/mainwindow.cpp0000644000175000017500000000162414205314371022466 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { } MainWindow::~MainWindow() { } qt5-ukui-platformtheme/test/custom-shadow/main.cpp0000644000175000017500000000243414205314371021236 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w3; w3.setWindowFlag(Qt::FramelessWindowHint); w3.setProperty("useCustomShadow", true); w3.setProperty("customShadowDarkness", 1.0); w3.setProperty("customShadowWidth", 20); w3.setProperty("customShadowRadius", QVector4D(1, 1, 1, 1)); w3.setProperty("customShadowMargins", QVector4D(20, 20, 20, 20)); w3.show(); return a.exec(); } qt5-ukui-platformtheme/test/custom-shadow/custom-shadow.pro0000644000175000017500000000170314205314371023123 0ustar fengfengQT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/messagebox/0000755000175000017500000000000014205350163017142 5ustar fengfengqt5-ukui-platformtheme/test/messagebox/messagebox.pro0000644000175000017500000000101014205314371022012 0ustar fengfengQT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp HEADERS += # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/messagebox/main.cpp0000644000175000017500000002135214205350163020575 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); qputenv("QT_QPA_PLATFORMTHEME", "ukui"); #if 0 QMessageBox::information(nullptr, "title", "information text", QMessageBox::Ok); QMessageBox::information(nullptr, "title", "information text1 " "information text2 " "information text3 " "information text4 " "information text5 " "information text6 " "information text7 " "information text8 " "information text9 " "information text10 " "information text11 " "information text12 " "information text13 " "information text14 " "information text15 " "information text16 " "information text17 " "information text18 " "information text19 " "information text20 " "information text21 " "information text22 " "information text23 " "information text24 " "information text25 " "information text26 " "information text27 " "information text28 " "information text29 " "information text30 " "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text" "information text", QMessageBox::Ok); QMessageBox::information(nullptr, "title", "information text", QMessageBox::Ok | QMessageBox::Cancel | QMessageBox::Save | QMessageBox::SaveAll); // QMessageBox::warning(nullptr, "title", "warning text", QMessageBox::Ok); QMessageBox::critical(nullptr, "title", "critical text", QMessageBox::Ok); QMessageBox::question(nullptr, "title", "question text", QMessageBox::Ok); // test button QMetaEnum metaEnum = QMetaEnum::fromType(); for (auto i = 0; i < metaEnum.keyCount(); ++i) { if (metaEnum.value(i) < QMessageBox::FirstButton || metaEnum.value(i) > QMessageBox::LastButton) { continue; } int ret = QMessageBox::information(nullptr, "title", "测试按钮", metaEnum.value(i)); qDebug() << "is current button:" << (ret == metaEnum.value(i)) << " ret:" << ret; } #endif #if 0 QMessageBox m; m.setText("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); int ret = m.exec(); qDebug() << (ret == QDialog::Accepted) << " --- " << ret; #endif #if 0 QMessageBox m; m.setText("这是中文测试1,中文测试2,中文测试3,中文测试4,中文测试5,中文测试6,中文测试7,中文测试8,中文测试9,中文测试10,中文测试11,中文测试12,中文测试13,中文测试14"); int ret = m.exec(); m.setIcon(QMessageBox::Critical); m.exec(); m.setText("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); m.exec(); qDebug() << (ret == QDialog::Accepted) << " --- " << ret; #endif #if 0 // 一个完整的布局展示相关测试例子 QMessageBox m; m.setText("

测试html是否可以正常显示

短字段

"); int ret = m.exec(); m.setText("

接下来要测试html是否可以正常显示

关于HTML显示的测试例子,需要假如一些style之类的字符串来干扰其文本框大小的预估,接下来就是style段

"); ret = m.exec(); m.setIcon(QMessageBox::Critical); m.setText("

接下来要测试html是否可以正常显示

关于HTML显示的测试例子,需要假如一些style之类的字符串来干扰其文本框大小的预估,接下来就是style段 + 图标

"); ret = m.exec(); m.setText("较短的纯文本汉字"); ret = m.exec(); m.setText("很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,"); ret = m.exec(); m.setText("english"); ret = m.exec(); m.exec(); m.setText("long long english ... aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); m.exec(); m.setText("中英文混合 Chinese and English mixed"); m.exec(); m.setText("中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合中英文混合 Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed.Chinese and English mixed."); m.exec(); qDebug() << (ret == QDialog::Accepted) << " --- " << ret; #endif #if 1 // 测试 detailLabel QMessageBox m; m.setIcon(QMessageBox::Critical); m.setText("

接下来要测试html是否可以正常显示

关于HTML显示的测试例子,需要假如一些style之类的字符串来干扰其文本框大小的预估,接下来就是style段 + 图标

"); m.setDetailedText("很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符,很长很长的中文字符"); m.exec(); m.setIcon(QMessageBox::Information); m.setText("

接下来要测试html是否可以正常显示

关于HTML显示的测试例子,需要假如一些style之类的字符串来干扰其文本框大小的预估,接下来就是style段 + 图标

"); m.setDetailedText(""); m.exec(); #endif return a.exec(); } qt5-ukui-platformtheme/test/tabwidget/0000755000175000017500000000000014205314371016760 5ustar fengfengqt5-ukui-platformtheme/test/tabwidget/widget.h0000644000175000017500000000171714205314371020422 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef WIDGET_H #define WIDGET_H #include class Widget : public QTabWidget { Q_OBJECT public: Widget(QWidget *parent = 0); ~Widget(); }; #endif // WIDGET_H qt5-ukui-platformtheme/test/tabwidget/widget.cpp0000644000175000017500000000305114205314371020746 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "widget.h" #include #include #include #include #include #include Widget::Widget(QWidget *parent) : QTabWidget(parent) { auto v1 = new QListView(this); v1->setViewMode(QListView::IconMode); auto m1 = new QFileSystemModel(v1); v1->setModel(m1); m1->setRootPath("/"); v1->setRootIndex(m1->index("/")); addTab(v1, "view1"); auto v2 = new QTreeView; v2->setModel(m1); v2->setRootIndex(m1->index("/")); addTab(v2, "view2"); addTab(new QPushButton("test1", this), "test1"); addTab(new QLabel("test2", this), "test2"); addTab(new QPushButton("test3", this), "test3"); addTab(new QLabel("test4", this), "test4"); } Widget::~Widget() { } qt5-ukui-platformtheme/test/tabwidget/tabwidget.pro0000644000175000017500000000221714205314371021456 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2020-01-09T11:25:46 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = tabwidget TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ widget.cpp HEADERS += \ widget.h # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/tabwidget/main.cpp0000644000175000017500000000213214205314371020406 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "widget.h" #include /// make a QTabWidget have a slide animation. /// This is integrated in ukui style by default. /// \see /// Qt5UKUIStyle, UKUI::TabWidget::DefaultSlideAnimator. int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); } qt5-ukui-platformtheme/test/region-blur/0000755000175000017500000000000014205314371017233 5ustar fengfengqt5-ukui-platformtheme/test/region-blur/mainwindow.h0000644000175000017500000000262314205314371021563 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include class QListWidget; class QToolBar; class MainWindow : public QMainWindow { Q_OBJECT Q_PROPERTY(QRegion blurRegion READ blurRegion WRITE setBlurRegion MEMBER m_region) public: MainWindow(QWidget *parent = 0); ~MainWindow(); const QRegion blurRegion() {return m_blur_region;} void setBlurRegion(const QRegion ®ion) {m_blur_region = region;} protected: void resizeEvent(QResizeEvent *e); private: QListWidget *m_list_view; QToolBar *m_tool_bar; QRegion m_blur_region = QRegion(); }; #endif // MAINWINDOW_H qt5-ukui-platformtheme/test/region-blur/region-blur.pro0000644000175000017500000000223114205314371022200 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2020-01-03T10:58:54 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = region-blur TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target qt5-ukui-platformtheme/test/region-blur/mainwindow.cpp0000644000175000017500000000327314205314371022120 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setAttribute(Qt::WA_TranslucentBackground); m_tool_bar = new QToolBar(this); m_tool_bar->addAction("test1"); m_tool_bar->addAction("test2"); m_tool_bar->addAction("test3"); m_tool_bar->addAction("test4"); addToolBar(m_tool_bar); m_list_view = new QListWidget(this); m_list_view->setAttribute(Qt::WA_TranslucentBackground); m_list_view->setAttribute(Qt::WA_Hover); m_list_view->setStyleSheet("background: transparent"); m_list_view->addItem("test1"); m_list_view->addItem("test2"); m_list_view->addItem("test3"); m_list_view->addItem("test4"); setCentralWidget(m_list_view); } MainWindow::~MainWindow() { } void MainWindow::resizeEvent(QResizeEvent *e) { QMainWindow::resizeEvent(e); m_blur_region = m_tool_bar->rect(); } qt5-ukui-platformtheme/test/region-blur/main.cpp0000644000175000017500000000236514205314371020671 0ustar fengfeng/* * Qt5-UKUI * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "mainwindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QApplication::setStyle("ukui"); MainWindow w; w.setProperty("useSystemStyleBlur", true); w.setWindowTitle("blur tool bar region"); w.show(); QMainWindow w2; w2.setProperty("useSystemStyleBlur", true); w2.setWindowTitle("whole window blur"); w2.setAttribute(Qt::WA_TranslucentBackground); w2.show(); return a.exec(); } qt5-ukui-platformtheme/.github/0000755000175000017500000000000014205314371015367 5ustar fengfengqt5-ukui-platformtheme/.github/workflows/0000755000175000017500000000000014205314371017424 5ustar fengfengqt5-ukui-platformtheme/.github/workflows/build.yml0000644000175000017500000000733014205314371021251 0ustar fengfengname: Check build on: push: branches: - master pull_request: branches: - master schedule: - cron: '0 0 * * *' jobs: archlinux-latest: name: on Archlinux Latest runs-on: ubuntu-20.04 container: docker.io/library/archlinux:latest steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Refresh pacman repository run: pacman -Sy - name: Install build dependencies run: pacman -S --noconfirm base-devel qt5-base gsettings-qt kwindowsystem qt5-tools dconf glibc - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); debian-sid: name: on Debian Sid runs-on: ubuntu-20.04 container: docker.io/library/debian:sid env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Update apt repository run: apt-get update -y - name: Install build dependcies run: apt-get install -y build-essential qttools5-dev-tools debhelper-compat pkg-kde-tools libglib2.0-dev libqt5x11extras5-dev libkf5windowsystem-dev libgsettings-qt-dev pkg-config qt5-qmake qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qtchooser qttools5-dev-tools - name: QMake configure & Make run: | mkdir build; cd build; qmake ..; make -j$(nproc); fedora-latest: name: on Fedora Latest runs-on: ubuntu-20.04 container: docker.io/library/fedora:latest steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Install build dependencies run: dnf install -y which gcc gcc-c++ make cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros glib2-devel qt5-qtx11extras-devel kf5-kwindowsystem-devel gsettings-desktop-schemas-devel qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtbase-static qt5-qttools-devel gsettings-qt-devel - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); fedora-rawhide: name: on Fedora Rawhide runs-on: ubuntu-20.04 container: docker.io/library/fedora:rawhide steps: - name: Checkout peony source code uses: actions/checkout@v2 - name: Install build dependencies run: dnf install --refresh --nogpg -y make gcc gcc-c++ which cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros glib2-devel qt5-qtx11extras-devel kf5-kwindowsystem-devel gsettings-desktop-schemas-devel qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtbase-static qt5-qttools-devel gsettings-qt-devel - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); ubuntu-latest: name: on Ubuntu Latest runs-on: ubuntu-20.04 container: docker.io/library/ubuntu:latest env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Update apt repository run: apt-get update -y - name: Install build dependcies run: apt-get install -y build-essential qt5-default qttools5-dev-tools qtmultimedia5-dev debhelper-compat pkg-kde-tools libglib2.0-dev libqt5x11extras5-dev libkf5windowsystem-dev libgsettings-qt-dev pkg-config qt5-qmake qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qtchooser qttools5-dev-tools - name: QMake configure & Make run: | mkdir build; cd build; qmake ..; make -j$(nproc); qt5-ukui-platformtheme/qt5-ukui-platformtheme/0000755000175000017500000000000014205352717020366 5ustar fengfengqt5-ukui-platformtheme/qt5-ukui-platformtheme/qt5-ukui-platformtheme_global.h0000644000175000017500000000215314205314371026403 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef QT5UKUIPLATFORMTHEME_GLOBAL_H #define QT5UKUIPLATFORMTHEME_GLOBAL_H #include #if defined(QT5UKUIPLATFORMTHEME_LIBRARY) # define QT5UKUIPLATFORMTHEMESHARED_EXPORT Q_DECL_EXPORT #else # define QT5UKUIPLATFORMTHEMESHARED_EXPORT Q_DECL_IMPORT #endif #endif // QT5UKUIPLATFORMTHEME_GLOBAL_H qt5-ukui-platformtheme/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp0000644000175000017500000001774314205352717025514 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include #include #include "qt5-ukui-platform-theme.h" #include "ukui-style-settings.h" #include "highlight-effect.h" #include #include #include //#include //#include #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #include #include #endif #include #include #include #include #include "widget/message-box.h" Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args) { //FIXME: Q_UNUSED(args) if (QGSettings::isSchemaInstalled("org.ukui.style")) { auto settings = UKUIStyleSettings::globalInstance(); //set font auto fontName = settings->get("systemFont").toString(); auto fontSize = settings->get("systemFontSize").toString().toDouble(); if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool()) fontSize = 11; m_system_font.setFamily(fontName); m_system_font.setPointSizeF(fontSize); m_fixed_font.setFamily(fontName); m_fixed_font.setPointSizeF(fontSize*1.2); /*! * \bug * if we set app font, qwizard title's font will * become very small. I handle the wizard title * in ProxyStyle::polish(). */ QApplication::setFont(m_system_font); connect(settings, &QGSettings::changed, this, [=](const QString &key){ if (key == "iconThemeName") { QString icontheme = settings->get("icon-theme-name").toString(); if (icontheme == "ukui-icon-theme-default" || icontheme == "ukui") icontheme = "ukui"; else if (icontheme == "ukui-icon-theme-classical" || icontheme == "ukui-classical") icontheme = "ukui-classical"; QIcon::setThemeName(icontheme); QIcon icon = qApp->windowIcon(); qApp->setWindowIcon(QIcon::fromTheme(icon.name())); // update all widgets for repaint new themed icons. for (auto widget : QApplication::allWidgets()) { widget->update(); } } if (key == "systemFont") { QString font = settings->get("system-font").toString(); QFontDatabase db; if (db.families().contains(font)) { QFont oldFont = QApplication::font(); m_system_font.setFamily(font); m_fixed_font.setFamily(font); oldFont.setFamily(font); QApplication::setFont(oldFont); } } if (key == "systemFontSize") { if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool()) return; double fontSize = settings->get("system-font-size").toString().toDouble(); if (fontSize > 0) { QFont oldFont = QApplication::font(); m_system_font.setPointSize(fontSize); m_fixed_font.setPointSize(fontSize*1.2); oldFont.setPointSizeF(fontSize); QApplication::setFont(oldFont); } } }); } } Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme() { } const QPalette *Qt5UKUIPlatformTheme::palette(Palette type) const { //FIXME: return QPlatformTheme::palette(type); } const QFont *Qt5UKUIPlatformTheme::font(Font type) const { //FIXME: if (type == FixedFont) return &m_fixed_font; return &m_system_font; switch (type) { case SystemFont: return &m_system_font; case TitleBarFont: case FixedFont: case GroupBoxTitleFont: return &m_fixed_font; default: return &m_system_font; } return QPlatformTheme::font(type); } QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const { //FIXME: //qDebug()<<"theme hint"<get("icon-theme-name").toString(); if (icontheme == "ukui-icon-theme-default" || icontheme == "ukui") return QStringList()<<"ukui"; else if (icontheme == "ukui-icon-theme-classical" || icontheme == "ukui-classical") return QStringList()<<"ukui-classical"; return QStringList()<(l.instance()); // auto engine = p->create(); // return engine; // } else { // return QPlatformTheme::createIconEngine(iconName); // } // //return new XdgIconLoaderEngine(iconName); return QPlatformTheme::createIconEngine(iconName); } #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) bool Qt5UKUIPlatformTheme::usePlatformNativeDialog(DialogType type) const { return true; switch (type) { case QPlatformTheme::FileDialog: case QPlatformTheme::FontDialog: case QPlatformTheme::ColorDialog: return false; case QPlatformTheme::MessageDialog: if (qAppName() == "ukui-control-center" || qAppName() == "kybackup") return false; return true; default: break; } return false; } QPlatformDialogHelper *Qt5UKUIPlatformTheme::createPlatformDialogHelper(DialogType type) const { switch (type) { case QPlatformTheme::FileDialog: case QPlatformTheme::FontDialog: case QPlatformTheme::ColorDialog: return QPlatformTheme::createPlatformDialogHelper(type); case QPlatformTheme::MessageDialog: if (qAppName() == "kybackup") return nullptr; return new MessageBoxHelper; default: break; } return nullptr; } #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) QIcon Qt5UKUIPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const { //FIXME: return QPlatformTheme::fileIcon(fileInfo, iconOptions); } #endif #ifdef GLOBAL_MENU QPlatformMenuBar *Qt5UKUIPlatformTheme::createPlatformMenuBar() const { return QPlatformTheme::createPlatformMenuBar(); } #endif #ifdef DBUS_TRAY QPlatformSystemTrayIcon *Qt5UKUIPlatformTheme::createPlatformSystemTrayIcon() const { QGnomeTheme *gnomeTheme = new QGnomeTheme(); return gnomeTheme->createPlatformSystemTrayIcon(); } #endif qt5-ukui-platformtheme/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro0000644000175000017500000000324314205352000025424 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2019-12-31T14:19:01 # #------------------------------------------------- QT += widgets dbus gui-private widgets-private x11extras greaterThan(QT_MAJOR_VERSION, 5)|greaterThan(QT_MINOR_VERSION, 7): \ QT += theme_support-private else: \ QT += platformsupport-private TARGET = qt5-ukui-platformtheme TEMPLATE = lib CONFIG += plugin CONFIG += c++11 link_pkgconfig PKGCONFIG += gsettings-qt Qt5XdgIconLoader include(../libqt5-ukui-style/libqt5-ukui-style.pri) DEFINES += QT5UKUIPLATFORMTHEME_LIBRARY XDG_ICON_ENGINE = $$[QT_INSTALL_PLUGINS]/iconengines/libQt5XdgIconPlugin.so DEFINES += XDG_ICON_ENGINE_PATH='\\"$${XDG_ICON_ENGINE}\\"' # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_NO_DEBUG_OUTPUT # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 include(widget/widget.pri) SOURCES += \ qt5-ukui-platform-theme.cpp \ main.cpp HEADERS += \ qt5-ukui-platform-theme.h \ qt5-ukui-platformtheme_global.h unix { target.path = $$[QT_INSTALL_PLUGINS]/platformthemes INSTALLS += target } DISTFILES += \ ukui.json qt5-ukui-platformtheme/qt5-ukui-platformtheme/qt5-ukui-platform-theme.h0000644000175000017500000000530014205314371025135 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef QT5UKUIPLATFORMTHEME_H #define QT5UKUIPLATFORMTHEME_H #include "qt5-ukui-platformtheme_global.h" #include #include #include #if !defined(QT_NO_DBUS) && defined(QT_DBUS_LIB) #if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) && !defined(QT_NO_SYSTEMTRAYICON) #define DBUS_TRAY #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) #define GLOBAL_MENU #endif #endif class QPalette; #ifdef DBUS_TRAY class QPlatformSystemTrayIcon; #endif #ifdef GLOBAL_MENU class QPlatformMenuBar; #endif /*! * \brief The Qt5UKUIPlatformTheme class * \details * In UKUI desktop environment, we have our own platform to manage the qt applications' style. * This class is used to take over the theme and preferences of those applications. * The platform theme will effect globally. */ class QT5UKUIPLATFORMTHEMESHARED_EXPORT Qt5UKUIPlatformTheme : public QObject, public QPlatformTheme { Q_OBJECT public: Qt5UKUIPlatformTheme(const QStringList &args); ~Qt5UKUIPlatformTheme(); virtual const QPalette *palette(Palette type = SystemPalette) const; virtual const QFont *font(Font type = SystemFont) const; virtual QVariant themeHint(ThemeHint hint) const; virtual QIconEngine *createIconEngine(const QString &iconName) const; #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) virtual bool usePlatformNativeDialog(DialogType type) const; virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const; #endif #ifdef GLOBAL_MENU virtual QPlatformMenuBar* createPlatformMenuBar() const; #endif #ifdef DBUS_TRAY QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif private: QFont m_system_font; QFont m_fixed_font; }; #endif // QT5UKUIPLATFORMTHEME_H qt5-ukui-platformtheme/qt5-ukui-platformtheme/ukui.json0000644000175000017500000000003314205314371022224 0ustar fengfeng{ "Keys": [ "ukui" ] } qt5-ukui-platformtheme/qt5-ukui-platformtheme/main.cpp0000644000175000017500000000257014205314371022014 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include #include "qt5-ukui-platform-theme.h" #include #include #define UKUI_PLATFORMTHEME QT_BEGIN_NAMESPACE class Qt5UKUIPlatformThemePlugin : public QPlatformThemePlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "ukui.json") public: virtual QPlatformTheme *create(const QString &key, const QStringList ¶ms) { if (key.toLower() == "ukui") { return new Qt5UKUIPlatformTheme(params); } return nullptr; } }; QT_END_NAMESPACE #include "main.moc" qt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/0000755000175000017500000000000014205314452021643 5ustar fengfengqt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/message-box.h0000644000175000017500000001442014205314371024227 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2020, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Ding Jing * */ #ifndef MESSAGEBOX_H #define MESSAGEBOX_H #include #include #include #include #include #include #include #include #include class QLabel; class QAbstractButton; class MessageBoxHelper; class MessageBoxPrivate; class MessageBoxOptionsPrivate; typedef QMessageBox::Icon Icon; typedef QMessageBox::StandardButtons StandardButtons; class MessageBox : public QDialog { Q_OBJECT Q_PROPERTY(Icon mIcon READ icon WRITE setIcon) Q_PROPERTY(QString mText READ text WRITE setText) Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) Q_PROPERTY(QPixmap mIconPixmap READ iconPixmap WRITE setIconPixmap) Q_PROPERTY(QString mInformativeText READ informativeText WRITE setInformativeText) Q_PROPERTY(StandardButtons mStandardButtons READ standardButtons WRITE setStandardButtons) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) friend MessageBoxHelper; public: explicit MessageBox(QWidget *parent = nullptr); ~MessageBox(); void setCheckBox(QCheckBox *cb); QCheckBox* checkBox() const; QMessageBox::Icon icon (); void setIcon (QMessageBox::Icon icon); QPixmap iconPixmap() const; void setIconPixmap(const QPixmap &pixmap); QString text(); void setText (const QString& text); QString informativeText() const; void setInformativeText(const QString &text); QString detailedText() const; void setDetailedText(const QString &text); QString buttonText(int button) const; void setButtonText(int button, const QString &text); Qt::TextFormat textFormat() const; void setTextFormat(Qt::TextFormat format); void setTextInteractionFlags(Qt::TextInteractionFlags flags); Qt::TextInteractionFlags textInteractionFlags() const; void addButton(QAbstractButton *button, QMessageBox::ButtonRole role); QPushButton* addButton(const QString &text, QMessageBox::ButtonRole role); QPushButton* addButton(QMessageBox::StandardButton button); void removeButton(QAbstractButton *button); QAbstractButton* button (QMessageBox::StandardButton which) const; QList buttons() const; QMessageBox::ButtonRole buttonRole(QAbstractButton *button) const; QMessageBox::StandardButtons standardButtons() const; void setStandardButtons(QMessageBox::StandardButtons buttons); QMessageBox::StandardButton standardButton(QAbstractButton *button) const; QPushButton* defaultButton() const; void setDefaultButton(QPushButton *button); void setDefaultButton(QMessageBox::StandardButton button); QAbstractButton* escapeButton() const; void setEscapeButton(QAbstractButton *button); void setEscapeButton(QMessageBox::StandardButton button); QAbstractButton* clickedButton() const; void setWindowTitle(const QString &title); void setWindowModality(Qt::WindowModality windowModality); static QPixmap standardIcon(QMessageBox::Icon icon); protected: bool event(QEvent *e) override; void changeEvent(QEvent *event) override; void showEvent(QShowEvent *event) override; virtual void closeEvent(QCloseEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void paintEvent (QPaintEvent *event) override; void resizeEvent(QResizeEvent *event) override; private: void initHelper(QPlatformMessageDialogHelper*); void setuplayout(); Q_SIGNALS: void buttonClicked(QAbstractButton* button); private: Q_DISABLE_COPY(MessageBox) Q_DECLARE_PRIVATE(MessageBox) Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton*)) Q_PRIVATE_SLOT(d_func(), void _q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)) }; class MessageBoxHelper : public QPlatformMessageDialogHelper { Q_OBJECT public: explicit MessageBoxHelper(); ~MessageBoxHelper() override; virtual void exec() override; virtual void hide() override; virtual bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override; Q_SIGNALS: void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); private: void initDialog (); private: MessageBox* mMessageBox = nullptr; }; class TextEdit : public QTextEdit { public: TextEdit(QWidget *parent=0) : QTextEdit(parent) { } void contextMenuEvent(QContextMenuEvent * e) override { QMenu *menu = createStandardContextMenu(); menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(e->globalPos()); } }; #endif // MESSAGEBOX_H #define QT_REQUIRE_VERSION(argc, argv, str) { QString s = QString::fromLatin1(str);\ QString sq = QString::fromLatin1(qVersion()); \ if ((sq.section(QChar::fromLatin1('.'),0,0).toInt()<<16)+\ (sq.section(QChar::fromLatin1('.'),1,1).toInt()<<8)+\ sq.section(QChar::fromLatin1('.'),2,2).toInt()<(s.section(QChar::fromLatin1('.'),0,0).toInt()<<16)+\ (s.section(QChar::fromLatin1('.'),1,1).toInt()<<8)+\ s.section(QChar::fromLatin1('.'),2,2).toInt()) { \ if (!qApp){ \ new QApplication(argc,argv); \ } \ QString s = QApplication::tr("Executable '%1' requires Qt "\ "%2, found Qt %3.").arg(qAppName()).arg(QString::fromLatin1(\ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\ "Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }} qt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/widget.pri0000644000175000017500000000020514205314371023637 0ustar fengfengHEADERS += \ $$PWD/message-box.h \ $$PWD/xatom-helper.h SOURCES += \ $$PWD/message-box.cpp \ $$PWD/xatom-helper.cpp qt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/xatom-helper.cpp0000644000175000017500000001377614205314371024772 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2020, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "xatom-helper.h" #include #include #include #include #include static XAtomHelper *global_instance = nullptr; XAtomHelper *XAtomHelper::getInstance() { if (!global_instance) global_instance = new XAtomHelper; return global_instance; } bool XAtomHelper::isFrameLessWindow(int winId) { auto hints = getInstance()->getWindowMotifHint(winId); if (hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) { return true; } return false; } bool XAtomHelper::isWindowDecorateBorderOnly(int winId) { return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId)); } bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint) { bool isDeco = false; if (hint.flags & MWM_HINTS_DECORATIONS && hint.flags != MWM_HINTS_DECORATIONS) { if (hint.decorations == MWM_DECOR_BORDER) isDeco = true; } return isDeco; } bool XAtomHelper::isUKUICsdSupported() { // fixme: return false; } bool XAtomHelper::isUKUIDecorationWindow(int winId) { if (m_ukuiDecorationAtion == None) return false; Atom type; int format; ulong nitems; ulong bytes_after; uchar *data; bool isUKUIDecoration = false; XGetWindowProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, 0, LONG_MAX, false, m_ukuiDecorationAtion, &type, &format, &nitems, &bytes_after, &data); if (type == m_ukuiDecorationAtion) { if (nitems == 1) { isUKUIDecoration = data[0]; } } return isUKUIDecoration; } UnityCorners XAtomHelper::getWindowBorderRadius(int winId) { UnityCorners corners; Atom type; int format; ulong nitems; ulong bytes_after; uchar *data; if (m_unityBorderRadiusAtom != None) { XGetWindowProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, 0, LONG_MAX, false, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &data); if (type == XA_CARDINAL) { if (nitems == 4) { corners.topLeft = static_cast(data[0]); corners.topRight = static_cast(data[1*sizeof (ulong)]); corners.bottomLeft = static_cast(data[2*sizeof (ulong)]); corners.bottomRight = static_cast(data[3*sizeof (ulong)]); } XFree(data); } } return corners; } void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data) { if (m_unityBorderRadiusAtom == None) return; ulong corners[4] = {data.topLeft, data.topRight, data.bottomLeft, data.bottomRight}; XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0])); } void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight) { if (m_unityBorderRadiusAtom == None) return; ulong corners[4] = {(ulong)topLeft, (ulong)topRight, (ulong)bottomLeft, (ulong)bottomRight}; XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0])); } void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set) { if (m_ukuiDecorationAtion == None) return; XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1); } void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints) { if (m_unityBorderRadiusAtom == None) return; XChangeProperty(QX11Info::display(), winId, m_motifWMHintsAtom, m_motifWMHintsAtom, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof (MotifWmHints)/ sizeof (ulong)); } MotifWmHints XAtomHelper::getWindowMotifHint(int winId) { MotifWmHints hints; if (m_unityBorderRadiusAtom == None) return hints; uchar *data; Atom type; int format; ulong nitems; ulong bytes_after; XGetWindowProperty(QX11Info::display(), winId, m_motifWMHintsAtom, 0, sizeof (MotifWmHints)/sizeof (long), false, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); if (type == None) { return hints; } else { hints = *(MotifWmHints *)data; XFree(data); } return hints; } XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent) { if (!QX11Info::isPlatformX11()) return; m_motifWMHintsAtom = XInternAtom(QX11Info::display(), "_MOTIF_WM_HINTS", true); m_unityBorderRadiusAtom = XInternAtom(QX11Info::display(), "_UNITY_GTK_BORDER_RADIUS", false); m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false); } Atom XAtomHelper::registerUKUICsdNetWmSupportAtom() { // fixme: return None; } void XAtomHelper::unregisterUKUICsdNetWmSupportAtom() { // fixme: } qt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/xatom-helper.h0000644000175000017500000000621314205314371024423 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2020, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef XATOMHELPER_H #define XATOMHELPER_H #include struct UnityCorners { ulong topLeft = 0; ulong topRight = 0; ulong bottomLeft = 0; ulong bottomRight = 0; }; typedef struct { ulong flags = 0; ulong functions = 0; ulong decorations = 0; long input_mode = 0; ulong status = 0; } MotifWmHints, MwmHints; #define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_DECORATIONS (1L << 1) #define MWM_HINTS_INPUT_MODE (1L << 2) #define MWM_HINTS_STATUS (1L << 3) #define MWM_FUNC_ALL (1L << 0) #define MWM_FUNC_RESIZE (1L << 1) #define MWM_FUNC_MOVE (1L << 2) #define MWM_FUNC_MINIMIZE (1L << 3) #define MWM_FUNC_MAXIMIZE (1L << 4) #define MWM_FUNC_CLOSE (1L << 5) #define MWM_DECOR_ALL (1L << 0) #define MWM_DECOR_BORDER (1L << 1) #define MWM_DECOR_RESIZEH (1L << 2) #define MWM_DECOR_TITLE (1L << 3) #define MWM_DECOR_MENU (1L << 4) #define MWM_DECOR_MINIMIZE (1L << 5) #define MWM_DECOR_MAXIMIZE (1L << 6) #define MWM_INPUT_MODELESS 0 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 #define MWM_INPUT_SYSTEM_MODAL 2 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL #define MWM_TEAROFF_WINDOW (1L<<0) namespace UKUI { class Decoration; } class XAtomHelper : public QObject { friend class UKUI::Decoration; Q_OBJECT public: static XAtomHelper *getInstance(); static bool isFrameLessWindow(int winId); bool isWindowDecorateBorderOnly(int winId); bool isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint); bool isUKUICsdSupported(); bool isUKUIDecorationWindow(int winId); UnityCorners getWindowBorderRadius(int winId); void setWindowBorderRadius(int winId, const UnityCorners &data); void setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight); void setUKUIDecoraiontHint(int winId, bool set = true); void setWindowMotifHint(int winId, const MotifWmHints &hints); MotifWmHints getWindowMotifHint(int winId); private: explicit XAtomHelper(QObject *parent = nullptr); ulong registerUKUICsdNetWmSupportAtom(); void unregisterUKUICsdNetWmSupportAtom(); ulong m_motifWMHintsAtom = 0l; ulong m_unityBorderRadiusAtom = 0l; ulong m_ukuiDecorationAtion = 0l; }; #endif // XATOMHELPER_H qt5-ukui-platformtheme/qt5-ukui-platformtheme/widget/message-box.cpp0000644000175000017500000011725314205314452024572 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2020, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Ding Jing * */ #include "message-box.h" #include "xatom-helper.h" #include #include #include #include #include #include #include #include #include #include "private/qlabel_p.h" #include "private/qdialog_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6, Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF, NewButtonMask = 0xFFFFFC00 }; static QMessageBox::StandardButton newButton(int button); static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i); static QPlatformDialogHelper::StandardButtons helperStandardButtons(MessageBox * q); class MessageBoxPrivate : public QDialogPrivate { Q_DECLARE_PUBLIC(MessageBox) public: MessageBoxPrivate (); ~MessageBoxPrivate (); void init (const QString &title = QString(), const QString &text = QString()); void setupLayout (); void _q_buttonClicked(QAbstractButton*); void _q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); void setClickedButton(QAbstractButton *button); QAbstractButton* findButton(int button0, int button1, int button2, int flags); void addOldButtons(int button0, int button1, int button2); QAbstractButton *abstractButtonForId(int id) const; int execReturnCode(QAbstractButton *button); int dialogCodeForButton(QAbstractButton *button) const; void updateSize(); int layoutMinimumWidth(); void detectEscapeButton(); static QMessageBox::StandardButton newButton(int button); static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &btn0Text, const QString &btn1Text, const QString &btn2Text, int defBtnNum, int espBtnNum); static QPixmap standardIcon(QMessageBox::Icon icon, MessageBox *mb); static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons btn, QMessageBox::StandardButton defBtn); private: void initHelper(QPlatformDialogHelper*) override; void helperPrepareShow(QPlatformDialogHelper*) override; void helperDone(QDialog::DialogCode, QPlatformDialogHelper*) override; public: QLabel* mLabel; QLabel* mInformativeLabel; TextEdit* mDetail; // qt 显示 label 暂定使用富文本框 QCheckBox* mCheckbox; // qt checkbox QLabel* mIconLabel; // qt 显示图标 QDialogButtonBox* mButtonBox; // qt 按钮框 QPushButton* mDetailButton; // 详细情况按钮 QPushButton *mCloseButtton; QByteArray mMemberToDisconnectOnClose; QByteArray mSignalToDisconnectOnClose; QPointer mReceiverToDisconnectOnClose; QString mTipString; // 原始的需要展示的文本 QMessageBox::Icon mIcon; QList mCustomButtonList; // 自定义按钮 QAbstractButton* mEscapeButton; QPushButton* mDefaultButton; QAbstractButton* mClickedButton; // 复选框按钮 bool mCompatMode; bool mShowDetail; // 是否显示详细信息 bool mAutoAddOkButton; // QTextEdit* informativeTextEdit; QAbstractButton* mDetectedEscapeButton; QSharedPointer mOptions; private: int mRadius = 0; int mIconSize = 24; }; MessageBox::MessageBox(QWidget *parent) : QDialog(*new MessageBoxPrivate, parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) { Q_D(MessageBox); setBackgroundRole(QPalette::Base); setAutoFillBackground(true); d->init(); setContentsMargins(0, 0, 0, 0); setAttribute(Qt::WA_TranslucentBackground); } MessageBox::~MessageBox() { } void MessageBox::setCheckBox(QCheckBox *cb) { Q_D(MessageBox); if (cb == d->mCheckbox) { return; } d->mCheckbox = cb; } QMessageBox::Icon MessageBox::icon() { Q_D(const MessageBox); return d->mIcon; } void MessageBox::setIcon(QMessageBox::Icon icon) { Q_D(MessageBox); setIconPixmap(MessageBoxPrivate::standardIcon((QMessageBox::Icon)icon, this)); d->mIcon = icon; } QPixmap MessageBox::iconPixmap() const { Q_D(const MessageBox); if (d->mIconLabel && d->mIconLabel->pixmap()) return *d->mIconLabel->pixmap(); return QPixmap(); } void MessageBox::setIconPixmap(const QPixmap &pixmap) { Q_D(MessageBox); if (!pixmap.isNull()) d->mIconLabel->setPixmap(pixmap.scaled(d->mIconSize, d->mIconSize)); d->mIcon = QMessageBox::NoIcon; } QString MessageBox::text() { Q_D(const MessageBox); return d->mLabel->text(); } void MessageBox::setText(const QString& text) { Q_D(MessageBox); d->mLabel->setText(text); } Qt::TextFormat MessageBox::textFormat() const { Q_D(const MessageBox); return d->mLabel->textFormat(); } void MessageBox::setTextFormat(Qt::TextFormat format) { Q_D(MessageBox); d->mLabel->setTextFormat(format); } Qt::TextInteractionFlags MessageBox::textInteractionFlags() const { Q_D(const MessageBox); return d->mLabel->textInteractionFlags(); } void MessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags) { Q_D(MessageBox); d->mLabel->setTextInteractionFlags(flags); } void MessageBox::addButton(QAbstractButton *button, QMessageBox::ButtonRole role) { Q_D(MessageBox); if (!button) { return; } if (d->mButtonBox->buttons().contains(button)) return; removeButton(button); d->mButtonBox->addButton(button, (QDialogButtonBox::ButtonRole)role); d->mCustomButtonList.append(button); d->mAutoAddOkButton = false; } QPushButton* MessageBox::addButton(const QString &text, QMessageBox::ButtonRole role) { Q_D(MessageBox); QPushButton* pushButton = new QPushButton(text); addButton(pushButton, role); return pushButton; } QPushButton *MessageBox::addButton(QMessageBox::StandardButton button) { Q_D(MessageBox); if (d->mButtonBox->standardButtons() & button) { return nullptr; } QPushButton *pushButton = d->mButtonBox->addButton((QDialogButtonBox::StandardButton)button); if (pushButton) { d->mAutoAddOkButton = false; } pushButton->setIcon(QIcon()); return pushButton; } void MessageBox::removeButton(QAbstractButton *button) { Q_D(MessageBox); d->mCustomButtonList.removeAll(button); if (d->mEscapeButton == button) { d->mEscapeButton = nullptr; } if (d->mDefaultButton == button) { d->mDefaultButton = nullptr; } d->mButtonBox->removeButton(button); } QAbstractButton *MessageBox::button(QMessageBox::StandardButton which) const { Q_D(const MessageBox); return d->mButtonBox->button(QDialogButtonBox::StandardButton(which)); } QList MessageBox::buttons() const { Q_D(const MessageBox); return d->mButtonBox->buttons(); } QMessageBox::ButtonRole MessageBox::buttonRole(QAbstractButton *button) const { Q_D(const MessageBox); return QMessageBox::ButtonRole(d->mButtonBox->buttonRole(button)); } void MessageBox::setStandardButtons(QMessageBox::StandardButtons buttons) { Q_D(MessageBox); d->mButtonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons))); QList buttonList = d->mButtonBox->buttons(); if (!buttonList.contains(d->mEscapeButton)) { d->mEscapeButton = nullptr; } if (!buttonList.contains(d->mDefaultButton)) { d->mDefaultButton = nullptr; } d->mAutoAddOkButton = false; } QMessageBox::StandardButtons MessageBox::standardButtons() const { Q_D(const MessageBox); return QMessageBox::StandardButtons(int(d->mButtonBox->standardButtons())); } QMessageBox::StandardButton MessageBox::standardButton(QAbstractButton *button) const { Q_D(const MessageBox); return (QMessageBox::StandardButton)d->mButtonBox->standardButton(button); } QPushButton *MessageBox::defaultButton() const { Q_D(const MessageBox); return d->mDefaultButton; } void MessageBox::setDefaultButton(QPushButton *button) { Q_D(MessageBox); if (!d->mButtonBox->buttons().contains(button)) { return; } d->mDefaultButton = button; button->setDefault(true); button->setFocus(); } void MessageBox::setDefaultButton(QMessageBox::StandardButton button) { Q_D(MessageBox); setDefaultButton(d->mButtonBox->button(QDialogButtonBox::StandardButton(button))); } QAbstractButton* MessageBox::escapeButton() const { Q_D(const MessageBox); return d->mEscapeButton; } void MessageBox::setEscapeButton(QAbstractButton *button) { Q_D(MessageBox); if (d->mButtonBox->buttons().contains(button)) { d->mEscapeButton = button; } } void MessageBox::setEscapeButton(QMessageBox::StandardButton button) { Q_D(MessageBox); setEscapeButton(d->mButtonBox->button(QDialogButtonBox::StandardButton(button))); } QAbstractButton* MessageBox::clickedButton() const { Q_D(const MessageBox); return d->mClickedButton; } QString MessageBox::buttonText(int button) const { Q_D(const MessageBox); if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { return abstractButton->text(); } else if (d->mButtonBox->buttons().isEmpty() && (button == QMessageBox::Ok || button == Old_Ok)) { return QDialogButtonBox::tr("OK"); } return QString(); } void MessageBox::setButtonText(int button, const QString &text) { Q_D(MessageBox); if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { abstractButton->setText(text); } else if (d->mButtonBox->buttons().isEmpty() && (button == QMessageBox::Ok || button == Old_Ok)) { addButton(QMessageBox::Ok)->setText(text); } } QString MessageBox::informativeText() const { Q_D(const MessageBox); return d->mInformativeLabel ? d->mInformativeLabel->text() : QString(); } void MessageBox::setInformativeText(const QString &text) { Q_D(MessageBox); if (text.isEmpty()) { if (d->mInformativeLabel) { d->mInformativeLabel->hide(); d->mInformativeLabel->deleteLater(); } d->mInformativeLabel = nullptr; } else { if (!d->mInformativeLabel) { QLabel *label = new QLabel; label->setObjectName(QLatin1String("ukui_msgbox_informativelabel")); label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this))); label->setAlignment(Qt::AlignTop | Qt::AlignLeft); label->setOpenExternalLinks(true); QPalette palette = label->palette(); palette.setColor(QPalette::Text, palette.color(QPalette::Disabled, QPalette::Text)); label->setPalette(palette); d->mInformativeLabel = label; } d->mInformativeLabel->setText(text); } } void MessageBox::setDetailedText(const QString &text) { Q_D(MessageBox); if (!text.isEmpty()) { d->mDetail = new TextEdit; d->mDetail->setText(text); d->mDetail->hide(); if (!d->mDetailButton) { d->mDetailButton = new QPushButton(this); d->mDetailButton->setText(QMessageBox::tr("Show Details...")); } } else { d->mDetail = nullptr; d->mDefaultButton = nullptr; } } void MessageBox::setWindowTitle(const QString &title) { #ifndef Q_OS_MAC QDialog::setWindowTitle(title); #else Q_UNUSED(title); #endif } void MessageBox::setWindowModality(Qt::WindowModality windowModality) { QDialog::setWindowModality(windowModality); if (parentWidget() && windowModality == Qt::WindowModal) { setParent(parentWidget(), Qt::Sheet); } else { setParent(parentWidget(), Qt::Dialog); } setDefaultButton(d_func()->mDefaultButton); } QPixmap MessageBox::standardIcon(QMessageBox::Icon icon) { return MessageBoxPrivate::standardIcon(icon, nullptr); } bool MessageBox::event(QEvent *e) { Q_D(MessageBox); bool result = QDialog::event(e); switch (e->type()) { case QEvent::LayoutRequest: { d->updateSize(); break; } case QEvent::FontChange: d->updateSize(); break; case QEvent::ApplicationPaletteChange: { if (d->mInformativeLabel) { QPalette palette = QGuiApplication::palette(); palette.setColor(QPalette::Text, palette.color(QPalette::Disabled, QPalette::Text)); d->mInformativeLabel->setPalette(palette); } } default: break; } return result; } void MessageBox::changeEvent(QEvent *event) { Q_D(MessageBox); switch (event->type()) { case QEvent::StyleChange: { if (d->mIcon != QMessageBox::NoIcon) setIcon(d->mIcon); Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this)); d->mLabel->setTextInteractionFlags(flags); d->mButtonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, this)); if (d->mInformativeLabel) d->mInformativeLabel->setTextInteractionFlags(flags); Q_FALLTHROUGH(); } case QEvent::FontChange: case QEvent::ApplicationFontChange: Q_FALLTHROUGH(); default: break; } QDialog::changeEvent(event); } void MessageBox::showEvent(QShowEvent *event) { Q_D(MessageBox); if (d->mAutoAddOkButton) { addButton(QMessageBox::Ok); } if (d->mDetailButton) addButton(d->mDetailButton, QMessageBox::ActionRole); d->detectEscapeButton(); d->updateSize(); #ifndef QT_NO_ACCESSIBILITY QAccessibleEvent e(this, QAccessible::Alert); QAccessible::updateAccessibility(&e); #endif QDialog::showEvent(event); } void MessageBox::closeEvent(QCloseEvent *event) { Q_D(MessageBox); if (!d->mDetectedEscapeButton) { event->ignore(); return; } QDialog::closeEvent(event); d->mClickedButton = d->mDetectedEscapeButton; setResult(d->execReturnCode(d->mDetectedEscapeButton)); } void MessageBox::keyPressEvent(QKeyEvent* e) { #if QT_CONFIG(shortcut) Q_D(MessageBox); if (e->matches(QKeySequence::Cancel)) { if (d->mDetectedEscapeButton) { d->mDetectedEscapeButton->click(); } return; } #endif // QT_CONFIG(shortcut) #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) //#if QT_CONFIG(textedit) // if (e == QKeySequence::Copy) { // if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) { // e->setAccepted(true); // return; // } // } else if (e == QKeySequence::SelectAll && d->detailsText && d->detailsText->isVisible()) { // d->detailsText->selectAll(); // e->setAccepted(true); // return; // } //#endif // QT_CONFIG(textedit) #ifndef QT_NO_SHORTCUT #endif #endif // !QT_NO_CLIPBOARD && !QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT if (!(e->modifiers() & (Qt::AltModifier | Qt::ControlModifier | Qt::MetaModifier))) { int key = e->key() & ~Qt::MODIFIER_MASK; if (key) { const QList buttons = d->mButtonBox->buttons(); for (auto *pb : buttons) { QKeySequence shortcut = pb->shortcut(); if (!shortcut.isEmpty() && key == int(shortcut[0] & ~Qt::MODIFIER_MASK)) { pb->animateClick(); return; } } } } #endif QDialog::keyPressEvent(e); } void MessageBox::paintEvent(QPaintEvent *event) { Q_D(MessageBox); QPainter painter (this); QPalette palette; painter.save(); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::NoPen); painter.setBrush(palette.brush(QPalette::Base)); painter.drawRoundedRect(rect(), d->mRadius, d->mRadius); painter.restore(); Q_UNUSED(event); QDialog::paintEvent(event); } void MessageBox::resizeEvent(QResizeEvent *event) { QDialog::resizeEvent(event); Q_UNUSED(event); } void MessageBox::initHelper(QPlatformMessageDialogHelper* h) { Q_D(MessageBox); d->initHelper(h); } void MessageBox::setuplayout() { Q_D(MessageBox); d->setupLayout(); } MessageBoxPrivate::MessageBoxPrivate() : mCheckbox(nullptr), mEscapeButton(nullptr), mDefaultButton(nullptr), mClickedButton(nullptr), mCompatMode(false), mAutoAddOkButton(true), mDetectedEscapeButton(nullptr), mInformativeLabel(nullptr), mDetail(nullptr), mDetailButton(nullptr), mOptions(QMessageDialogOptions::create()) { } MessageBoxPrivate::~MessageBoxPrivate() { if (nullptr != mLabel) { delete mLabel; } if (nullptr != mIconLabel) { delete mIconLabel; } if (nullptr != mButtonBox) { delete mButtonBox; } if (nullptr != mDetail) { delete mDetail; } if (nullptr != mDetailButton) { delete mDetailButton; } } void MessageBoxPrivate::init(const QString &title, const QString &text) { Q_Q(MessageBox); mLabel = new QLabel; mLabel->setObjectName(QLatin1String("ukui_msgbox_label")); mLabel->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q))); mLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); mLabel->setOpenExternalLinks(true); mIconLabel = new QLabel; mIconLabel->setObjectName(QLatin1String("ukui_msgbox_icon_label")); mIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mIconLabel->setFixedSize(mIconSize, mIconSize); mIconLabel->setContentsMargins(0, 0, 0, 0); mButtonBox = new QDialogButtonBox; mButtonBox->setObjectName(QLatin1String("ukui_msgbox_buttonbox")); mButtonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q)); QObject::connect(mButtonBox, SIGNAL(clicked(QAbstractButton*)), q, SLOT(_q_buttonClicked(QAbstractButton*))); mCloseButtton = new QPushButton(q); mCloseButtton->setFlat(true); mCloseButtton->setFocusPolicy(Qt::NoFocus); mCloseButtton->setProperty("isWindowButton", 0x2); mCloseButtton->setIcon(QIcon::fromTheme("window-close-symbolic")); mCloseButtton->setIconSize(QSize(16, 16)); mCloseButtton->setFixedSize(32, 32); QObject::connect(mCloseButtton, &QPushButton::clicked, q, [=]() { q->close(); }); q->setModal(true); mIcon = QMessageBox::NoIcon; Q_UNUSED(title); } void MessageBoxPrivate::setupLayout() { Q_Q(MessageBox); if (q->layout()) delete q->layout(); bool hasIcon = mIconLabel->pixmap() && !mIconLabel->pixmap()->isNull(); QGridLayout *gridLayout = new QGridLayout; gridLayout->setContentsMargins(0, 0, 0, 32); gridLayout->setHorizontalSpacing(8); gridLayout->setVerticalSpacing(8); if (hasIcon) gridLayout->addWidget(mIconLabel, 0, 0, Qt::AlignTop); gridLayout->addWidget(mLabel, 0, hasIcon ? 1 : 0); if (mInformativeLabel) { gridLayout->addWidget(mInformativeLabel, 1, hasIcon ? 1 : 0); } QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->setSpacing(48); if (mDetail && !mDetail->isHidden()) { buttonLayout->setContentsMargins(0, 0, 0, 24); } else { buttonLayout->setContentsMargins(0, 0, 0, 0); } buttonLayout->setSizeConstraint(QLayout::SetNoConstraint); if (mCheckbox) { buttonLayout->addWidget(mCheckbox, 0, Qt::AlignLeft | Qt::AlignVCenter); } if (mButtonBox->layout()) { mButtonBox->layout()->setSpacing(10); } buttonLayout->addWidget(mButtonBox, 0, Qt::AlignRight | Qt::AlignVCenter); QVBoxLayout *contentLayout = new QVBoxLayout; contentLayout->setContentsMargins(20, 0 , 20, 20); contentLayout->setSpacing(0); contentLayout->addLayout(gridLayout); contentLayout->addLayout(buttonLayout); if (mDetail) { contentLayout->addWidget(mDetail); } QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(4, 4, 4, 4); layout->setSpacing(4); layout->addWidget(mCloseButtton, 0, Qt::AlignRight); layout->addLayout(contentLayout); q->setLayout(layout); updateSize(); } void MessageBoxPrivate::updateSize() { Q_Q(MessageBox); if (q->layout() == nullptr) return; if (QGuiApplication::screenAt(QCursor::pos()) == nullptr) { return; } q->layout()->activate(); while (mButtonBox->layout()->count() < mButtonBox->buttons().count() + 1) { QEvent event(QEvent::StyleChange); QGuiApplication::sendEvent(mButtonBox, &event); } QSize minSize(424, 156); QSize size; QSize screenSize = QGuiApplication::screenAt(QCursor::pos())->availableGeometry().size(); QSize maxSize(screenSize.width() * 0.8, screenSize.height() * 0.8); mLabel->setWordWrap(false); if (mInformativeLabel) { mInformativeLabel->setWordWrap(false); } q->layout()->activate(); if (q->sizeHint().width() > qMax(mButtonBox->sizeHint().width() + 24 + 24, 452)) { mLabel->setWordWrap(true); if (mInformativeLabel) { mInformativeLabel->setWordWrap(true); } } q->layout()->activate(); q->setContentsMargins(0, 0, 0, 0); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); size.setWidth(qMax(qMin(maxSize.width(), q->sizeHint().width()), minSize.width())); size.setHeight(qMax(qMin(maxSize.height(), q->layout()->hasHeightForWidth() ? q->layout()->totalHeightForWidth(size.width()) : q->layout()->totalMinimumSize().height()), minSize.height())); q->setFixedSize(size); QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } int MessageBoxPrivate::layoutMinimumWidth() { layout->activate(); return layout->totalMinimumSize().width(); } void MessageBoxPrivate::_q_buttonClicked(QAbstractButton* button) { Q_Q(MessageBox); if (mDetailButton && mDetail && button == mDetailButton) { mDetail->setHidden(!mDetail->isHidden()); mDetailButton->setText(mDetail->isHidden() ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...")); setupLayout(); } else { setClickedButton(button); if (mReceiverToDisconnectOnClose) { QObject::disconnect(q, mSignalToDisconnectOnClose, mReceiverToDisconnectOnClose, mMemberToDisconnectOnClose); mReceiverToDisconnectOnClose = nullptr; } mSignalToDisconnectOnClose.clear(); mMemberToDisconnectOnClose.clear(); } } void MessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role) { Q_Q(MessageBox); if (button > QPlatformDialogHelper::LastButton) { mClickedButton = static_cast(mOptions->customButton(button)->button); Q_ASSERT(mClickedButton); mClickedButton->click(); q->done(role); } else { q->done(button); } } // after click button void MessageBoxPrivate::setClickedButton(QAbstractButton *button) { Q_Q(MessageBox); mClickedButton = button; Q_EMIT q->buttonClicked(mClickedButton); mClickedButton = button; auto resultCode = execReturnCode(button); hide(resultCode); finalize(resultCode, dialogCodeForButton(button)); } QAbstractButton* MessageBoxPrivate::findButton(int button0, int button1, int button2, int flags) { Q_Q(MessageBox); int button = 0; if (button0 & flags) { button = button0; } else if (button1 & flags) { button = button1; } else if (button2 & flags) { button = button2; } return q->button(newButton(button)); } static bool detectedCompat(int button0, int button1, int button2) { if (button0 != 0 && !(button0 & NewButtonMask)) { return true; } if (button1 != 0 && !(button1 & NewButtonMask)) { return true; } if (button2 != 0 && !(button2 & NewButtonMask)) { return true; } return false; } void MessageBoxPrivate::addOldButtons(int button0, int button1, int button2) { Q_Q(MessageBox); q->addButton(newButton(button0)); q->addButton(newButton(button1)); q->addButton(newButton(button2)); q->setDefaultButton(static_cast(findButton(button0, button1, button2, QMessageBox::Default))); q->setEscapeButton(findButton(button0, button1, button2, QMessageBox::Escape)); mCompatMode = detectedCompat(button0, button1, button2); } QAbstractButton* MessageBoxPrivate::abstractButtonForId(int id) const { Q_Q(const MessageBox); QAbstractButton *result = mCustomButtonList.value(id); if (result) { return result; } if (id & QMessageBox::FlagMask) { return nullptr; } return q->button(newButton(id)); } int MessageBoxPrivate::execReturnCode(QAbstractButton *button) { int ret = mButtonBox->standardButton(button); if (ret == QMessageBox::NoButton) { ret = mCustomButtonList.indexOf(button); } else if (mCompatMode) { ret = -1; } return ret; } int MessageBoxPrivate::dialogCodeForButton(QAbstractButton *button) const { Q_Q(const MessageBox); switch (q->buttonRole(button)) { case QMessageBox::AcceptRole: case QMessageBox::YesRole: return QDialog::Accepted; case QMessageBox::RejectRole: case QMessageBox::NoRole: return QDialog::Rejected; default: return -1; } } void MessageBoxPrivate::detectEscapeButton() { if (mEscapeButton) { mDetectedEscapeButton = mEscapeButton; return; } mDetectedEscapeButton = mButtonBox->button(QDialogButtonBox::Cancel); if (mDetectedEscapeButton) { return; } const QList buttons = mButtonBox->buttons(); if (buttons.count() == 1) { mDetectedEscapeButton = buttons.first(); return; } if (buttons.count() == 2 && mDetailButton) { auto idx = buttons.indexOf(mDetailButton); if (idx != -1) { mDetectedEscapeButton = buttons.at(1 - idx); return; } } for (auto *button : buttons) { if (mButtonBox->buttonRole(button) == QDialogButtonBox::RejectRole) { if (mDetectedEscapeButton) { // already detected! mDetectedEscapeButton = nullptr; break; } mDetectedEscapeButton = button; } } if (mDetectedEscapeButton) { return; } for (auto *button : buttons) { if (mButtonBox->buttonRole(button) == QDialogButtonBox::NoRole) { if (mDetectedEscapeButton) { // already detected! mDetectedEscapeButton = nullptr; break; } mDetectedEscapeButton = button; } } } QMessageBox::StandardButton MessageBoxPrivate::newButton(int button) { if (button == QMessageBox::NoButton) { return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); } return QMessageBox::NoButton; } int MessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2) { MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); messageBox.d_func()->addOldButtons(button0, button1, button2); Q_UNUSED(parent); return messageBox.exec(); } int MessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButtonNumber, int escapeButtonNumber) { MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); QString myButton0Text = button0Text; if (myButton0Text.isEmpty()) { myButton0Text = QDialogButtonBox::tr("OK"); } messageBox.addButton(myButton0Text, QMessageBox::ActionRole); if (!button1Text.isEmpty()) { messageBox.addButton(button1Text, QMessageBox::ActionRole); } if (!button2Text.isEmpty()) { messageBox.addButton(button2Text, QMessageBox::ActionRole); } const QList &buttonList = messageBox.d_func()->mCustomButtonList; messageBox.setDefaultButton(static_cast(buttonList.value(defaultButtonNumber))); messageBox.setEscapeButton(buttonList.value(escapeButtonNumber)); Q_UNUSED(parent); return messageBox.exec(); } QMessageBox::StandardButton MessageBoxPrivate::showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { if (defaultButton && !(buttons & defaultButton)) { return (QMessageBox::StandardButton) MessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0); } MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); QDialogButtonBox *buttonBox = messageBox.findChild(); Q_ASSERT(buttonBox != nullptr); uint mask = QMessageBox::FirstButton; while (mask <= QMessageBox::LastButton) { uint sb = buttons & mask; mask <<= 1; if (!sb) { continue; } QPushButton *button = messageBox.addButton((QMessageBox::StandardButton)sb); if (messageBox.defaultButton()) { continue; } if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) || (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton))) { messageBox.setDefaultButton(button); } } if (messageBox.exec() == -1) { return QMessageBox::Cancel; } return messageBox.standardButton(messageBox.clickedButton()); } QPixmap MessageBoxPrivate::standardIcon(QMessageBox::Icon icon, MessageBox *mb) { QStyle *style = mb ? mb->style() : QApplication::style(); int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, mb); QIcon tmpIcon; switch (icon) { case QMessageBox::Information: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, mb); break; case QMessageBox::Warning: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, nullptr, mb); break; case QMessageBox::Critical: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, nullptr, mb); break; case QMessageBox::Question: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, mb); default: break; } if (!tmpIcon.isNull()) { return tmpIcon.pixmap (QSize(iconSize, iconSize)); } return QPixmap(); } void MessageBoxPrivate::initHelper(QPlatformDialogHelper* h) { Q_Q(MessageBox); QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)), q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole))); static_cast(h)->setOptions(mOptions); } void MessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper*) { Q_Q(MessageBox); mOptions->setWindowTitle(q->windowTitle()); mOptions->setText(q->text()); mOptions->setInformativeText(q->informativeText()); //#if QT_CONFIG(textedit) // mOptions->setDetailedText(q->detailedText()); //#endif mOptions->setIcon(helperIcon(q->icon())); mOptions->setStandardButtons(helperStandardButtons(q)); } void MessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper*) { Q_Q(MessageBox); QAbstractButton *button = q->button(QMessageBox::StandardButton(code)); if (button) { mClickedButton = button; } } static QPlatformDialogHelper::StandardButtons helperStandardButtons(MessageBox * q) { QPlatformDialogHelper::StandardButtons buttons(int(q->standardButtons())); return buttons; } static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i) { switch (i) { case QMessageBox::NoIcon: return QMessageDialogOptions::NoIcon; case QMessageBox::Information: return QMessageDialogOptions::Information; case QMessageBox::Warning: return QMessageDialogOptions::Warning; case QMessageBox::Critical: return QMessageDialogOptions::Critical; case QMessageBox::Question: return QMessageDialogOptions::Question; } return QMessageDialogOptions::NoIcon; } static QMessageBox::StandardButton newButton(int button) { // this is needed for source compatibility with Qt 4.0 and 4.1 if (button == QMessageBox::NoButton || (button & NewButtonMask)) return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); #if QT_VERSION < 0x050000 // this is needed for binary compatibility with Qt 4.0 and 4.1 switch (button & Old_ButtonMask) { case Old_Ok: return QMessageBox::Ok; case Old_Cancel: return QMessageBox::Cancel; case Old_Yes: return QMessageBox::Yes; case Old_No: return QMessageBox::No; case Old_Abort: return QMessageBox::Abort; case Old_Retry: return QMessageBox::Retry; case Old_Ignore: return QMessageBox::Ignore; case Old_YesAll: return QMessageBox::YesToAll; case Old_NoAll: return QMessageBox::NoToAll; default: return QMessageBox::NoButton; } #else return QMessageBox::NoButton; #endif } class MessageBoxOptionsPrivate : public QSharedData { public: MessageBoxOptionsPrivate() : icon(QMessageDialogOptions::NoIcon), buttons(QPlatformDialogHelper::Ok), nextCustomButtonId(QPlatformDialogHelper::LastButton + 1) { } QString windowTitle; QMessageDialogOptions::Icon icon; QString text; QString informativeText; QString detailedText; QPlatformDialogHelper::StandardButtons buttons; QList customButtons; int nextCustomButtonId; }; MessageBoxHelper::MessageBoxHelper() : QPlatformMessageDialogHelper(), mMessageBox(new MessageBox) { } MessageBoxHelper::~MessageBoxHelper() { } void MessageBoxHelper::exec() { int ret = mMessageBox->exec(); int role = mMessageBox->buttonRole(mMessageBox->clickedButton()); mMessageBox->done(ret); Q_EMIT clicked((QPlatformDialogHelper::StandardButton)ret, QPlatformDialogHelper::ButtonRole(role)); } void MessageBoxHelper::hide() { mMessageBox->hide(); } bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) { initDialog(); // mMessageBox->setWindowModality(windowModality); if (parent) { if (QWidget *p = mMessageBox->find(parent->winId())) { if (p->findChild()) { for (QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if (QCheckBox *cb = mb->findChild()) { if (mb->layout() && (mb->layout()->indexOf(cb) != -1)) { mMessageBox->setCheckBox(cb); } } } } } } } mMessageBox->setuplayout(); if (parent) { mMessageBox->move(QPoint((parent->width() - mMessageBox->width()) / 2, (parent->height() - mMessageBox->height()) / 2) + QPoint(parent->x(), parent->y())); } MotifWmHints hints; hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; hints.functions = MWM_FUNC_ALL; hints.decorations = MWM_DECOR_BORDER; XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints); foreach (QAbstractButton *ab, mMessageBox->buttons()) { if (QPushButton *pb = qobject_cast(ab)) { if (pb->isDefault()) { mMessageBox->setDefaultButton(pb); } } } mMessageBox->show(); Q_UNUSED(parent); Q_UNUSED(windowFlags); Q_UNUSED(windowModality); return true; } void MessageBoxHelper::initDialog() { mMessageBox->setIcon((QMessageBox::Icon)options()->icon()); mMessageBox->setText(options()->text()); mMessageBox->setInformativeText(options()->informativeText()); mMessageBox->setDetailedText(options()->detailedText()); mMessageBox->setWindowTitle(options()->windowTitle()); QPlatformDialogHelper::StandardButtons btns = options()->standardButtons(); uint mask = QMessageBox::FirstButton; while (mask <= QMessageBox::LastButton) { uint sb = btns & mask; mask <<= 1; if (!sb) { continue; } mMessageBox->addButton((QMessageBox::StandardButton)sb); } for (QMessageDialogOptions::CustomButton button : options()->customButtons()) { QAbstractButton *ab = static_cast(button.button); if (ab) { if (!ab->text().isEmpty() && ab->text() == QMessageBox::tr("Show Details...") || ab->text() == QMessageBox::tr("Hide Details...")) continue; ab->setIcon(QIcon()); } mMessageBox->addButton(ab, QMessageBox::ButtonRole(button.role)); } } #include "moc_message-box.cpp" qt5-ukui-platformtheme/libqt5-ukui-style/0000755000175000017500000000000014205314452017340 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/effects/0000755000175000017500000000000014205314452020757 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/effects/highlight-effect.cpp0000644000175000017500000004111614205314452024667 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "highlight-effect.h" #include #include #include #include #include #include #include #include #include #define ColorDifference 10 QColor HighLightEffect::symbolic_color = QColor(31, 32, 34, 192); void HighLightEffect::setSkipEffect(QWidget *w, bool skip) { w->setProperty("skipHighlightIconEffect", skip); } bool HighLightEffect::isPixmapPureColor(const QPixmap &pixmap) { QImage image = pixmap.toImage(); QVector vector; int total_red = 0; int total_green = 0; int total_blue = 0; bool pure = true; for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { if (image.pixelColor(x, y).alphaF() > 0.3) { QColor color = image.pixelColor(x, y); vector << color; total_red += color.red(); total_green += color.green(); total_blue += color.blue(); int dr = qAbs(color.red() - symbolic_color.red()); int dg = qAbs(color.green() - symbolic_color.green()); int db = qAbs(color.blue() - symbolic_color.blue()); if (dr > ColorDifference || dg > ColorDifference || db > ColorDifference) pure = false; } } } if (pure) return true; qreal squareRoot_red = 0; qreal squareRoot_green = 0; qreal squareRoot_blue = 0; qreal average_red = total_red / vector.count(); qreal average_green = total_green / vector.count(); qreal average_blue = total_blue / vector.count(); for (QColor color : vector) { squareRoot_red += (color.red() - average_red) * (color.red() - average_red); squareRoot_green += (color.green() - average_green) * (color.green() - average_green); squareRoot_blue += (color.blue() - average_blue) * (color.blue() - average_blue); } qreal arithmeticSquareRoot_red = qSqrt(squareRoot_red / vector.count()); qreal arithmeticSquareRoot_green = qSqrt(squareRoot_green / vector.count()); qreal arithmeticSquareRoot_blue = qSqrt(squareRoot_blue / vector.count()); return arithmeticSquareRoot_red < 2.0 && arithmeticSquareRoot_green < 2.0 && arithmeticSquareRoot_blue < 2.0; } bool HighLightEffect::setMenuIconHighlightEffect(QMenu *menu, HighLightMode hlmode, EffectMode mode) { if (!menu) return false; menu->setProperty("useIconHighlightEffect", hlmode); menu->setProperty("iconHighlightEffectMode", mode); return true; } bool HighLightEffect::setViewItemIconHighlightEffect(QAbstractItemView *view, HighLightMode hlmode, EffectMode mode) { if (!view) return false; view->viewport()->setProperty("useIconHighlightEffect", hlmode); view->viewport()->setProperty("iconHighlightEffectMode", mode); return true; } HighLightEffect::HighLightMode HighLightEffect::isWidgetIconUseHighlightEffect(const QWidget *w) { if (w) { if (w->property("useIconHighlightEffect").isValid()) return HighLightMode(w->property("useIconHighlightEffect").toInt()); } return HighLightEffect::skipHighlight; } void HighLightEffect::setSymoblicColor(const QColor &color) { qApp->setProperty("symbolicColor", color); symbolic_color = color; } void HighLightEffect::setWidgetIconFillSymbolicColor(QWidget *widget, bool fill) { widget->setProperty("fillIconSymbolicColor", fill); } const QColor HighLightEffect::getCurrentSymbolicColor() { QIcon symbolic = QIcon::fromTheme("window-new-symbolic"); QPixmap pix = symbolic.pixmap(QSize(16, 16)); QImage img = pix.toImage(); for (int x = 0; x < img.width(); x++) { for (int y = 0; y < img.height(); y++) { QColor color = img.pixelColor(x, y); if (color.alpha() > 0) { symbolic_color = color; return color; } } } return symbolic_color; } const QColor HighLightEffect::defaultStyleDark() { auto windowText = qApp->palette().windowText().color(); qreal h, s, v; windowText.getHsvF(&h, &s, &v); return QColor::fromHsvF(h, s*0.85, v, 0.7); } QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, bool force, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!(option->state & QStyle::State_Enabled)) return pixmap; if (widget && !widget->isEnabled()) return pixmap; QPixmap target = pixmap; bool isPurePixmap = isPixmapPureColor(pixmap); if (force) { if (!isPurePixmap) return pixmap; QPainter p(&target); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); if (option->state & QStyle::State_MouseOver || option->state & QStyle::State_Selected || option->state & QStyle::State_On || option->state & QStyle::State_Sunken) { p.fillRect(target.rect(), option->palette.highlightedText()); } else { p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark()); } return target; } if (!widget) return pixmap; if (widget->property("skipHighlightIconEffect").isValid()) { bool skipEffect = widget->property("skipHighlightIconEffect").toBool(); if (skipEffect) return pixmap; } if (widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } HighLightMode hlmode = isWidgetIconUseHighlightEffect(widget); if (hlmode == skipHighlight) { return pixmap; } else if (hlmode == HighlightEffect) { bool fillIconSymbolicColor = false; if (widget->property("fillIconSymbolicColor").isValid()) { fillIconSymbolicColor = widget->property("fillIconSymbolicColor").toBool(); } bool isEnable = option->state.testFlag(QStyle::State_Enabled); bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } if (isEnable && overOrDown) { if (fillIconSymbolicColor) { target = filledSymbolicColoredPixmap(pixmap, option->palette.highlightedText().color()); } if (!isPurePixmap) return target; QPainter p(&target); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), option->palette.highlightedText()); return target; } else { QPixmap target = pixmap; if (fillIconSymbolicColor) { target = filledSymbolicColoredPixmap(pixmap, option->palette.highlightedText().color()); } if (!isPurePixmap) return target; QPainter p(&target); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark()); return target; } } else if (hlmode == ordinaryHighLight) { return ordinaryGeneratePixmap(pixmap, option, widget, mode); } else if (hlmode == hoverHighLight) { return hoverGeneratePixmap(pixmap, option, widget); } else if (hlmode == defaultHighLight) { return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); } else if (hlmode == filledSymbolicColorHighLight) { if (isPurePixmap) { return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); } else { return filledSymbolicColoredGeneratePixmap(pixmap, option, widget, mode); } } else { return pixmap; } return pixmap; } QPixmap HighLightEffect::ordinaryGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap) || !(option->state & QStyle::State_Enabled)) return pixmap; QPixmap target = pixmap; QColor color; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { color = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } QPainter p(&target); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), color.isValid() ? color : (mode ? option->palette.text() : defaultStyleDark())); return target; } QPixmap HighLightEffect::hoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap) || !(option->state & QStyle::State_Enabled)) return pixmap; QPixmap target = pixmap; QColor color; if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { color = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } QPainter p(&target); if (overOrDown) { p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), color.isValid() ? color : option->palette.highlightedText()); } return target; } QPixmap HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap) || !(option->state & QStyle::State_Enabled)) return pixmap; QPixmap target = pixmap; QColor defaultColor, hoverColor; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { defaultColor = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { hoverColor = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } QPainter p(&target); if (overOrDown) { p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), hoverColor.isValid() ? hoverColor : option->palette.highlightedText()); } else { p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), defaultColor.isValid() ? defaultColor : (mode ? option->palette.text() : defaultStyleDark())); } return target; } QPixmap HighLightEffect::filledSymbolicColoredGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (isPixmapPureColor(pixmap)) return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); QPixmap target = pixmap; QColor defaultColor, hoverColor; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { defaultColor = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { hoverColor = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool isEnable = option->state.testFlag(QStyle::State_Enabled); bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } if (isEnable && overOrDown) { return filledSymbolicColoredPixmap(target, hoverColor.isValid() ? hoverColor : option->palette.color(QPalette::HighlightedText)); } else { return filledSymbolicColoredPixmap(target, defaultColor.isValid() ? defaultColor : (mode ? option->palette.color(QPalette::Text) : defaultStyleDark())); } return target; } HighLightEffect::HighLightEffect(QObject *parent) : QObject(parent) { } QPixmap HighLightEffect::filledSymbolicColoredPixmap(const QPixmap &source, const QColor &baseColor) { if (source.isNull()) return source; QImage img = source.toImage(); for (int x = 0; x < img.width(); x++) { for (int y = 0; y < img.height(); y++) { auto color = img.pixelColor(x, y); if (color.alpha() > 0.3) { if (qAbs(color.red() - symbolic_color.red()) < 10 && qAbs(color.green() - symbolic_color.green()) < 10 && qAbs(color.blue() - symbolic_color.blue()) < 10) { color.setRed(baseColor.red()); color.setGreen(baseColor.green()); color.setBlue(baseColor.blue()); img.setPixelColor(x, y, color); } } } } return QPixmap::fromImage(img); } qt5-ukui-platformtheme/libqt5-ukui-style/effects/effects.pri0000644000175000017500000000020514205314371023107 0ustar fengfengINCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/.. HEADERS += \ $$PWD/highlight-effect.h SOURCES += \ $$PWD/highlight-effect.cpp qt5-ukui-platformtheme/libqt5-ukui-style/effects/highlight-effect.h0000644000175000017500000000655614205314452024345 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef HIGHLIGHTEFFECT_H #define HIGHLIGHTEFFECT_H #include #include class QAbstractItemView; class QMenu; class HighLightEffect : public QObject { Q_OBJECT public: enum HighLightMode { skipHighlight = 0x0, HighlightEffect = 0x1, ordinaryHighLight = 0x2, hoverHighLight = 0x4, defaultHighLight = 0x8, filledSymbolicColorHighLight = 0x10, }; enum EffectMode { HighlightOnly = 0x0, BothDefaultAndHighlit = 0x1 }; Q_ENUM(EffectMode) /*! * \brief setSkipEffect * \param w * \param skip * \details * in ukui-style, some widget such as menu will be set use highlight * icon effect automaticlly, * but we might not want to compose a special pure color image. * This function is use to skip the effect. */ static QColor symbolic_color; static void setSkipEffect(QWidget *w, bool skip = true); static bool isPixmapPureColor(const QPixmap &pixmap); static bool setMenuIconHighlightEffect(QMenu *menu, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly); static bool setViewItemIconHighlightEffect(QAbstractItemView *view, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly); static HighLightMode isWidgetIconUseHighlightEffect(const QWidget *w); static void setSymoblicColor(const QColor &color); static void setWidgetIconFillSymbolicColor(QWidget *widget, bool fill); static const QColor getCurrentSymbolicColor(); static const QColor defaultStyleDark(); static QPixmap generatePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, bool force = false, EffectMode mode = HighlightOnly); static QPixmap ordinaryGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap hoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap filledSymbolicColoredGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); private: explicit HighLightEffect(QObject *parent = nullptr); static QPixmap filledSymbolicColoredPixmap(const QPixmap &source, const QColor &baseColor); }; #endif // HIGHLIGHTEFFECT_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/0000755000175000017500000000000014205314371021502 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/animations/animation-helper.cpp0000644000175000017500000000222414205314371025442 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "animation-helper.h" #include #include "animator-iface.h" AnimationHelper::AnimationHelper(QObject *parent) : QObject(parent) { m_animators = new QHash(); } AnimationHelper::~AnimationHelper() { // for (auto animator : *m_animators) { // delete animator; // } delete m_animators; } qt5-ukui-platformtheme/libqt5-ukui-style/animations/animations.pri0000644000175000017500000000041114205314371024354 0ustar fengfengINCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/.. include(tabwidget/tabwidget.pri) include(scrollbar/scrollbar.pri) HEADERS += \ $$PWD/animator-plugin-iface.h \ $$PWD/animator-iface.h \ $$PWD/animation-helper.h SOURCES += \ $$PWD/animation-helper.cpp qt5-ukui-platformtheme/libqt5-ukui-style/animations/animator-plugin-iface.h0000644000175000017500000000566014205314371026035 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef ANIMATORPLUGINIFACE_H #define ANIMATORPLUGINIFACE_H #include class UKUIAnimatorPluginIface { public: enum AnimatorPluginType { TabWidget, StackedWidget, PushButton, ItemView, ScrollBar, MenuBar, Menu, Other }; virtual ~UKUIAnimatorPluginIface() {} /*! * \brief id * \return unique plugin's id. * \details * You have to define a unique id for your animator plugin. */ virtual const QString id() = 0; /*! * \brief brief * \return a brief of animator. */ virtual const QString brief() = 0; /*! * \brief pluginType * \return animator type for indicating what kinds of widget to bind with. */ virtual AnimatorPluginType pluginType() = 0; /*! * \brief inhertKey * \return * \details * When a style polish a widget, ukui animation frameworks will bind the animator * to the widget. This value is the keyword for judgeing if the widget should be bound * with animator. For example, return this value with "QWidget", then all the widgets * will be bound. */ virtual const QString inhertKey() = 0; /*! * \brief excludeKeys * \return * \details * In contrast to inhertKey(), this list is a "blacklist" of * widgets should not be bound with the animator. */ virtual const QStringList excludeKeys() = 0; /*! * \brief isParallel * \return * \details * Indicate if the animator which plugin created is compatible with other * animators. * * \note * This variable has no practical effect, * but we hope that the animations acting on the same control * can be parallelized, although it is difficult to achieve. * * If you note the animator is not parallelized, other animator * might be invalid. For example, the default tabwidget slide animator * will hijack the paint event of current tabwidget's tab. This might * let other animator can not do a paint in current tab. */ virtual bool isParallel() = 0; }; #endif // ANIMATORPLUGINIFACE_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/0000755000175000017500000000000014205314452023454 5ustar fengfeng././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.hqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-0000644000175000017500000000406614205314371032737 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H #define UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H #include #include "ukui-tabwidget-animator-plugin-iface.h" namespace UKUI { namespace TabWidget { /*! * \brief The DefaultSlideAnimatorFactory class * \details * This class is an internal plugin. It provides a default tabwidget * switch animation for QTabWidget and its drived class. * * \note * Note that it used in ukui-style, but you can also use its api in other * desktop environment. */ class DefaultSlideAnimatorFactory : public QObject, public UKUITabWidgetAnimatorPluginIface { Q_OBJECT public: explicit DefaultSlideAnimatorFactory(QObject *parent = nullptr); const QString id() {return tr("Default Slide");} const QString brief() {return tr("Let tab widget switch with a slide animation.");} const QString key() {return "tab_slide";} const QString description() {return brief();} AnimatorPluginType pluginType() {return TabWidget;} const QString inhertKey() {return "QTabWidget";} const QStringList excludeKeys() {return QStringList()<<"Peony::DirectoryWidget";} bool isParallel() {return false;} UKUITabWidgetAnimatorIface *createAnimator(); }; } } #endif // UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-animator-plugin-iface.h0000644000175000017500000000424014205314371032723 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETANIMATORPLUGINIFACE_H #define UKUITABWIDGETANIMATORPLUGINIFACE_H #include #include "animator-plugin-iface.h" #include "ukui-tabwidget-animator-iface.h" #define UKUITabWidgetAnimatorPluginInterface_iid "org.ukui.style.animatons.TabWidgetPluginInterface" /*! * \brief The UKUITabWidgetAnimatorPluginIface class * \details * This class is used to create a tabwidget animator instace. * * UKUI Animation's frameworks is desgined to be extensiable. * And this interface is an entry of plugin. * * \see UKUITabWidgetAnimatorIface */ class UKUITabWidgetAnimatorPluginIface : public UKUIAnimatorPluginIface { public: virtual ~UKUITabWidgetAnimatorPluginIface() {} /*! * \brief key * \return * A key word of plugin, such as "slide". */ virtual const QString key() = 0; /*! * \brief description * \return * A description for animator. For example, "Animator for do a horizon slide * for tab widget." */ virtual const QString description() = 0; /*! * \brief createAnimator * \return * an animator instance, for example a UKUI::TabWidget::DefaultSlideAnimator. */ virtual UKUITabWidgetAnimatorIface *createAnimator() = 0; }; Q_DECLARE_INTERFACE(UKUITabWidgetAnimatorPluginIface, UKUITabWidgetAnimatorPluginInterface_iid) #endif // UKUITABWIDGETANIMATORPLUGINIFACE_H ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.cppqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-0000644000175000017500000000222314205314371032730 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-tabwidget-default-slide-animator-factory.h" #include "ukui-tabwidget-default-slide-animator.h" using namespace UKUI::TabWidget; DefaultSlideAnimatorFactory::DefaultSlideAnimatorFactory(QObject *parent) : QObject(parent) { } UKUITabWidgetAnimatorIface *DefaultSlideAnimatorFactory::createAnimator() { return new DefaultSlideAnimator; } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.hqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.0000644000175000017500000000701414205314371032734 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETDEFAULTSLIDEANIMATOR_H #define UKUITABWIDGETDEFAULTSLIDEANIMATOR_H #include #include #include #include "ukui-tabwidget-animator-iface.h" #include namespace UKUI { namespace TabWidget { /*! * \brief The DefaultSlideAnimator class * \details * This class is an implement of UKUITabWidgetAnimatorIface. */ class DefaultSlideAnimator : public QVariantAnimation, public UKUITabWidgetAnimatorIface { Q_OBJECT public: explicit DefaultSlideAnimator(QObject *parent = nullptr); bool bindTabWidget(QTabWidget *w); bool unboundTabWidget(); QWidget *boundedWidget() {return m_bound_widget;} bool eventFilter(QObject *obj, QEvent *e); protected: void watchSubPage(QWidget *w); bool filterTabWidget(QObject *obj, QEvent *e); bool filterStackedWidget(QObject *obj, QEvent *e); bool filterSubPage(QObject *obj, QEvent *e); bool filterTmpPage(QObject *obj, QEvent *e); void clearPixmap(); private: QTabWidget *m_bound_widget = nullptr; QStackedWidget *m_stack = nullptr; QList m_children; QPixmap m_previous_pixmap; QPixmap m_next_pixmap; /*! * \brief m_tmp_page * \note * insert a tmp tab page into tab widget directly is dangerous, * because a custom tab widget's page may be desgined different * with normal tab page, such as peony-qt's directory view. * In that case, it might lead program crashed when * application call a custom page but get a tmp page. * * for those reasons, i use a temporary widgets bound to the * stacked widget with qt's parent&child mechanism. * It can float on the top layer or hide on the lower layer of stack, * but it does not belong to the elements in the stack (no index), * which can avoid the above problems. * * However, this way might be incompatible with other animations. * Because it uses a new widget for painting, not relate with orignal * page. Another conflict is the oxygen's fade animation might force * raise current tab page when it finished. That might cause a incompleted * slide animation if slide duration is longer than fade's. */ QWidget *m_tmp_page = nullptr; /*! * \brief m_tab_resizing * \details * If a went to a resize event, the animation should handle * widget's relayout after resized. * This bool varient is used to help judege if animator's pixmaps * and template widget' states should be updated. */ bool m_tab_resizing = false; int pervIndex = -1; bool left_right = true; bool horizontal = false; QWidget *previous_widget = nullptr; }; } } #endif // UKUITABWIDGETDEFAULTSLIDEANIMATOR_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/tabwidget.pri0000644000175000017500000000061114205314371026140 0ustar fengfengINCLUDEPATH += $$PWD HEADERS += \ $$PWD/ukui-tabwidget-animator-iface.h \ $$PWD/ukui-tabwidget-animator-plugin-iface.h \ $$PWD/ukui-tabwidget-default-slide-animator-factory.h \ $$PWD/ukui-tabwidget-default-slide-animator.h SOURCES += \ $$PWD/ukui-tabwidget-default-slide-animator-factory.cpp \ $$PWD/ukui-tabwidget-default-slide-animator.cpp INCLUDEPATH += $$PWD/.. ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.cppqt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.0000644000175000017500000003516314205314452032742 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-tabwidget-default-slide-animator.h" #include #include #include #include #include #include #include #include #include #include using namespace UKUI::TabWidget; /*! * \brief DefaultSlideAnimator::DefaultSlideAnimator * \param parent * \details * This class define a slide animator for tab widget sliding animation. * Animator based on QVariantAnimation, paint on a tmp widgets when running. * The content of widget is based on animation's current value and 2 pixmap * grabbed at appropriate times. * * \note * Once an animator have bound a tab widget, it have to unbound current widget at first. * Then it can bind another tab widget again. */ DefaultSlideAnimator::DefaultSlideAnimator(QObject *parent) : QVariantAnimation (parent) { setDuration(400); setEasingCurve(QEasingCurve::OutQuad); setStartValue(0.0); setEndValue(1.0); } /*! * \brief DefaultSlideAnimator::bindTabWidget * \param w A QTabWidget instance, most passed in QStyle::polish(). * \return result if Tab widget be bound \c true for binding successed. * \details * When do a tab widget binding, animator will create a tmp child page for tab widget's * stack widget. Then it will watched their event waiting for preparing and doing a animation. */ bool DefaultSlideAnimator::bindTabWidget(QTabWidget *w) { if (w) { m_bound_widget = w; //watch tab widget w->installEventFilter(this); m_tmp_page = new QWidget; //watch tmp page; m_tmp_page->installEventFilter(this); for (auto child : w->children()) { if (child->objectName() == "qt_tabwidget_stackedwidget") { auto stack = qobject_cast(child); m_stack = stack; //watch stack widget m_tmp_page->setParent(m_stack); m_stack->installEventFilter(this); break; } } for (int i = 0; i < w->count(); i++) { //watch sub page watchSubPage(w->widget(i)); } previous_widget = m_bound_widget->currentWidget(); connect(w, &QTabWidget::currentChanged, this, [=](int index){ this->stop(); m_tmp_page->hide(); if (m_bound_widget->currentWidget() && m_bound_widget->currentWidget() != previous_widget) { left_right = m_bound_widget->currentIndex() > pervIndex; pervIndex = m_bound_widget->currentIndex(); /* * This way not suitable for 4k */ //m_next_pixmap = m_bound_widget->grab(QRect(m_bound_widget->rect().x(), m_bound_widget->tabBar()->height(), //m_bound_widget->currentWidget()->width(), m_bound_widget->currentWidget()->height())); QPixmap pixmap(m_stack->size()); /* * This way some widget such as QFrame. * QPalette::Window was used to draw the background during the screenshot, * but QWidget itself did not draw the entire area with others during the screenshot, * resulting in some areas in the screenshot that the background drawn by QPalette::Window was different from the actual drawing. */ //m_bound_widget->currentWidget()->render(&pixmap, QPoint(), m_bound_widget->currentWidget()->rect()); /* * This way by modifying the way of QPalette, get the same screenshot as the actual state */ //QPalette palette, palette_save; //palette = palette_save = m_bound_widget->currentWidget()->palette(); //palette.setBrush(QPalette::Window, palette.brush(QPalette::Base)); //m_bound_widget->currentWidget()->setPalette(palette); //m_bound_widget->currentWidget()->render(&pixmap, QPoint(), m_bound_widget->currentWidget()->rect()); //m_bound_widget->currentWidget()->setPalette(palette_save); m_bound_widget->render(&pixmap, QPoint(), m_stack->geometry()); m_next_pixmap = pixmap; if (qobject_cast(previous_widget)) { QPixmap previous_pixmap(m_stack->size()); QPalette palette = previous_widget->palette(); QPalette palette_save = previous_widget->palette(); /* * This use QPalette::Base to replace QPalette::Window, Mabey have unknow bug. */ palette.setBrush(QPalette::Window, palette.brush(QPalette::Base)); previous_widget->setPalette(palette); previous_widget->render(&previous_pixmap); previous_widget->setPalette(palette_save); m_previous_pixmap = previous_pixmap; switch (w->tabBar()->shape()) { case QTabBar::RoundedNorth: case QTabBar::TriangularNorth: case QTabBar::RoundedSouth: case QTabBar::TriangularSouth: horizontal = false; break; case QTabBar::RoundedWest: case QTabBar::TriangularWest: case QTabBar::RoundedEast: case QTabBar::TriangularEast: horizontal = true; break; default: break; } this->start(); m_tmp_page->raise(); m_tmp_page->show(); } } previous_widget = m_bound_widget->currentWidget(); }); connect(this, &QVariantAnimation::valueChanged, m_tmp_page, [=]() { m_tmp_page->repaint(); }); connect(this, &QVariantAnimation::finished, m_tmp_page, [=]() { m_tmp_page->repaint(); }); return true; } return false; } bool DefaultSlideAnimator::unboundTabWidget() { clearPixmap(); if (m_bound_widget) { disconnect(m_bound_widget, &QTabWidget::currentChanged, this, nullptr); for (auto w : m_bound_widget->children()) { w->removeEventFilter(this); } m_tmp_page->removeEventFilter(this); m_tmp_page->deleteLater(); m_tmp_page = nullptr; previous_widget = nullptr; m_bound_widget = nullptr; this->deleteLater(); return true; } return false; } bool DefaultSlideAnimator::eventFilter(QObject *obj, QEvent *e) { if (obj == m_tmp_page) { return filterTmpPage(obj, e); } if (obj == m_stack) { return filterStackedWidget(obj, e); } if (obj == m_bound_widget) { return filterTabWidget(obj, e); } return filterSubPage(obj, e); } void DefaultSlideAnimator::watchSubPage(QWidget *w) { if (w) w->installEventFilter(this); } bool DefaultSlideAnimator::filterTabWidget(QObject *obj, QEvent *e) { if (e->type() == QEvent::Close) { this->unboundTabWidget(); } return false; } bool DefaultSlideAnimator::filterStackedWidget(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::ChildAdded: case QEvent::ChildRemoved: { if (obj->objectName() == "qt_tabwidget_stackedwidget") { QChildEvent *ce = static_cast(e); if (!ce->child()->isWidgetType()) return false; if (ce->added()) { ce->child()->installEventFilter(this); } else { ce->child()->removeEventFilter(this); } } return false; } case QEvent::Resize: //qDebug()<<"resize"; m_tab_resizing = true; return false; case QEvent::LayoutRequest: { /// there a 2 case we need excute these codes. /// 1. when stacked widget created and shown, it first do resize, then do a layout request. /// 2. after stacked widget resize. /// /// This event is very suitable for the above two situations, /// both in terms of efficiency and trigger time. if (m_tab_resizing) { m_tmp_page->resize(m_stack->size()); if(m_next_pixmap.isNull()) pervIndex = m_bound_widget->currentIndex(); } m_tab_resizing = false; return false; } default: break; } return false; } bool DefaultSlideAnimator::filterSubPage(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::Show: { return false; } case QEvent::Hide: { /* * This way not suitable for 4k and multi-screen crash(Todo: get the screen change event, get the corresponding screen, * call the grabWindow method of QScreen to get the picture, * but the picture needs to be processed by 4k and orientation size) */ //if (m_bound_widget->currentWidget()) { //QScreen *screen = QGuiApplication::primaryScreen(); //m_previous_pixmap = screen->grabWindow(m_bound_widget->winId(), // m_bound_widget->tabBar()->x() + 2, // m_bound_widget->tabBar()->height(), // m_bound_widget->currentWidget()->width(), // m_bound_widget->currentWidget()->height()); //} this->stop(); return false; } case QEvent::Resize: { this->stop(); return false; } default: return false; } } bool DefaultSlideAnimator::filterTmpPage(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::Show: { return false; } case QEvent::Paint: { QWidget *w = qobject_cast(obj); if (this->state() == QAbstractAnimation::Running) { QPainter p(w); auto value = this->currentValue().toDouble(); p.setRenderHints(QPainter::Antialiasing); //do a horizon slide. auto prevSrcRect = QRectF(m_previous_pixmap.rect()); auto prevTargetRect = QRectF(m_previous_pixmap.rect()); auto nextSrcRect = QRectF(m_next_pixmap.rect()); auto nextTargetRect = QRectF(m_next_pixmap.rect()); if (left_right) { if (horizontal) { prevSrcRect.setY(m_previous_pixmap.height() * value); prevSrcRect.setHeight(m_previous_pixmap.height() * (1 - value)); prevTargetRect.setHeight(m_previous_pixmap.height() * (1 - value)); } else { prevSrcRect.setX(m_previous_pixmap.width() * value); prevSrcRect.setWidth(m_previous_pixmap.width() * (1 - value)); prevTargetRect.setWidth(m_previous_pixmap.width() * (1 - value)); } p.drawPixmap(prevTargetRect, m_previous_pixmap, prevSrcRect); if (horizontal) { nextSrcRect.setHeight(m_next_pixmap.height() * value); nextTargetRect.setY(m_next_pixmap.height() * (1 - value)); nextTargetRect.setHeight(m_next_pixmap.height() * value); } else { nextSrcRect.setWidth(m_next_pixmap.width() * value); nextTargetRect.setX(m_next_pixmap.width() * (1 - value)); nextTargetRect.setWidth(m_next_pixmap.width() * value); } p.drawPixmap(nextTargetRect, m_next_pixmap, nextSrcRect); } else { if (horizontal) { nextSrcRect.setY(m_next_pixmap.height() * (1 - value)); nextSrcRect.setHeight(m_next_pixmap.height() * value); nextTargetRect.setHeight(m_next_pixmap.height() * value); } else { nextSrcRect.setX(m_next_pixmap.width() * (1 - value)); nextSrcRect.setWidth(m_next_pixmap.width() * value); nextTargetRect.setWidth(m_next_pixmap.width() * value); } p.drawPixmap(nextTargetRect, m_next_pixmap, nextSrcRect); if (horizontal) { prevSrcRect.setHeight(m_previous_pixmap.height() * (1 - value)); prevTargetRect.setY(m_previous_pixmap.height() * value); prevTargetRect.setHeight(m_previous_pixmap.height() * (1 - value)); } else { prevSrcRect.setWidth(m_previous_pixmap.width() * (1 - value)); prevTargetRect.setX(m_previous_pixmap.width() * value); prevTargetRect.setWidth(m_previous_pixmap.width() * (1 - value)); } p.drawPixmap(prevTargetRect, m_previous_pixmap, prevSrcRect); } //eat event so that widget will not paint default items and override //our custom pixmap. return true; } m_tmp_page->hide(); if (!m_next_pixmap.isNull()) m_stack->stackUnder(m_tmp_page); return false; } default: return false; } } void DefaultSlideAnimator::clearPixmap() { m_previous_pixmap = QPixmap(); m_next_pixmap = QPixmap(); } qt5-ukui-platformtheme/libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-animator-iface.h0000644000175000017500000000443714205314371031437 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETANIMATORIFACE_H #define UKUITABWIDGETANIMATORIFACE_H #include #include "animator-iface.h" /*! * \brief The UKUITabWidgetAnimatorIface class * \details * This class define the interface for doing a QTabWidget's animation. * a tabwidget animator should bind only one tabwidget with bindTabWidget(), * and can be unbounded with unboundTabWidget(). * * Animator is created by AnimatorPlugin, which is another interface's implement * of UKUI style animation's frameworks. * * \see UKUITabWidgetAnimatorPluginIface */ class UKUITabWidgetAnimatorIface : public AnimatorIface { public: virtual ~UKUITabWidgetAnimatorIface() {} virtual bool bindWidget(QWidget *w) { return bindTabWidget(qobject_cast(w)); } virtual bool unboundWidget() { return unboundTabWidget(); } /*! * \brief bindTabWidget * \param w widget should be bound. * \return true if successed. * \details * this method is used for binding a animator instance for a tab widget. * You have to implement this function in your own implement class. */ virtual bool bindTabWidget(QTabWidget *w) = 0; /*! * \brief unboundTabWidget * \return true if successed. * \details * this method is used to unbound the animator instance and tab widget. * You have to implement this function in your own implement class. */ virtual bool unboundTabWidget() = 0; }; #endif // UKUITABWIDGETANIMATORIFACE_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/0000755000175000017500000000000014205314371023465 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/scrollbar.pri0000644000175000017500000000021514205314371026162 0ustar fengfengHEADERS += \ $$PWD/ukui-scrollbar-default-interaction-animator.h SOURCES += \ $$PWD/ukui-scrollbar-default-interaction-animator.cpp ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-animator.hqt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-ani0000644000175000017500000000427614205314371033063 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H #define UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H #include #include "animator-iface.h" class QVariantAnimation; namespace UKUI { namespace ScrollBar { class DefaultInteractionAnimator : public QParallelAnimationGroup, public AnimatorIface { Q_OBJECT public: explicit DefaultInteractionAnimator(QObject *parent = nullptr); bool bindWidget(QWidget *w); bool unboundWidget(); QWidget *boundedWidget() {return m_widget;} QVariant value(const QString &property); bool isRunning(const QString &property = nullptr); bool setAnimatorStartValue(const QString &property, const QVariant &value); bool setAnimatorEndValue(const QString &property, const QVariant &value); bool setAnimatorDuration(const QString &property, int duration); void setAnimatorDirectionForward(const QString &property = nullptr, bool forward = true); void startAnimator(const QString &property = nullptr); void stopAnimator(const QString &property = nullptr); int currentAnimatorTime(const QString &property = nullptr); int totalAnimationDuration(const QString &property); private: QWidget *m_widget = nullptr; QVariantAnimation *m_groove_width; QVariantAnimation *m_slider_opacity; QVariantAnimation *m_sunken_silder_additional_opacity; }; } } #endif // UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-animator.cppqt5-ukui-platformtheme/libqt5-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-ani0000644000175000017500000002004614205314371033054 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-scrollbar-default-interaction-animator.h" #include #include #include using namespace UKUI::ScrollBar; DefaultInteractionAnimator::DefaultInteractionAnimator(QObject *parent) : QParallelAnimationGroup (parent) { } /*! * \brief DefaultInteractionAnimator::bindWidget * \param w * \return * * \details * QObject has a feature that parent object can use findChild() method * getting a specific named child. * * I use QObject::setObjectName() set my animator and bind to a scroll bar. * So that i could not cache a hash or map to manage animators. * * \bug * Cause I use named QObject child to cache the animator for a scrollbar, * However there are some troubles for my unexcepted. * * For example, qt5 assistant's main view can not find child correctly. * I don't know if animator bind with child was been removed at some times. */ bool DefaultInteractionAnimator::bindWidget(QWidget *w) { if (w->property("doNotAnimate").toBool()) return false; if (qobject_cast(w)) { m_widget = w; } else { return false; } m_groove_width = new QVariantAnimation(this); m_groove_width->setStartValue(0.0); m_groove_width->setEndValue(1.0); m_groove_width->setDuration(150); addAnimation(m_groove_width); m_slider_opacity = new QVariantAnimation(this); m_slider_opacity->setStartValue(0.0); m_slider_opacity->setEndValue(0.10); m_slider_opacity->setDuration(150); addAnimation(m_slider_opacity); m_sunken_silder_additional_opacity = new QVariantAnimation(this); m_sunken_silder_additional_opacity->setStartValue(0.0); m_sunken_silder_additional_opacity->setEndValue(0.10); m_sunken_silder_additional_opacity->setDuration(150); addAnimation(m_sunken_silder_additional_opacity); setObjectName("ukui_scrollbar_default_interaction_animator"); connect(m_groove_width, &QVariantAnimation::valueChanged, w, [=]() { w->repaint(); }); connect(m_slider_opacity, &QVariantAnimation::valueChanged, w, [=]() { w->repaint(); }); connect(m_sunken_silder_additional_opacity, &QVariantAnimation::valueChanged, w, [=]() { w->repaint(); }); connect(m_groove_width, &QVariantAnimation::finished, w, [=]() { w->repaint(); }); connect(m_slider_opacity, &QVariantAnimation::finished, w, [=]() { w->repaint(); }); connect(m_sunken_silder_additional_opacity, &QVariantAnimation::finished, w, [=]() { w->repaint(); }); return true; } bool DefaultInteractionAnimator::unboundWidget() { this->stop(); this->setDirection(QAbstractAnimation::Forward); m_groove_width->deleteLater(); m_slider_opacity->deleteLater(); m_sunken_silder_additional_opacity->deleteLater(); if (m_widget) { this->setParent(nullptr); return true; } return false; } QVariant DefaultInteractionAnimator::value(const QString &property) { if (property == "groove_width") { return m_groove_width->currentValue(); } else if (property == "slider_opacity") { return m_slider_opacity->currentValue(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->currentValue(); } else { return QVariant(); } } bool DefaultInteractionAnimator::setAnimatorStartValue(const QString &property, const QVariant &value) { if (property == "groove_width") { m_groove_width->setStartValue(value); return true; } else if (property == "slider_opacity") { m_slider_opacity->setStartValue(value); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setStartValue(value); return true; } else { return false; } } bool DefaultInteractionAnimator::setAnimatorEndValue(const QString &property, const QVariant &value) { if (property == "groove_width") { m_groove_width->setEndValue(value); return true; } else if (property == "slider_opacity") { m_slider_opacity->setEndValue(value); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setEndValue(value); return true; } else { return false; } } bool DefaultInteractionAnimator::setAnimatorDuration(const QString &property, int duration) { if (property == "groove_width") { m_groove_width->setDuration(duration); return true; } else if (property == "slider_opacity") { m_groove_width->setDuration(duration); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setDuration(duration); return true; } else { return false; } } void DefaultInteractionAnimator::setAnimatorDirectionForward(const QString &property, bool forward) { auto d = forward? QAbstractAnimation::Forward: QAbstractAnimation::Backward; if (property == "groove_width") { m_groove_width->setDirection(d); } else if (property == "slider_opacity") { m_slider_opacity->setDirection(d); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setDirection(d); } else { return; } } bool DefaultInteractionAnimator::isRunning(const QString &property) { if (property == "groove_width") { return m_groove_width->state() == Running; } else if (property == "slider_opacity") { return m_slider_opacity->state() == Running; } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->state() == Running; } else { return this->state() == Running; } } void DefaultInteractionAnimator::startAnimator(const QString &property) { if (property == "groove_width") { m_groove_width->start(); } else if (property == "slider_opacity") { m_slider_opacity->start(); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->start(); } else { this->start(); } } void DefaultInteractionAnimator::stopAnimator(const QString &property) { if (property == "groove_width") { m_groove_width->stop(); } else if (property == "slider_opacity") { m_slider_opacity->stop(); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->stop(); } else { this->stop(); } } int DefaultInteractionAnimator::currentAnimatorTime(const QString &property) { if (property == "groove_width") { return m_groove_width->currentTime(); } else if (property == "slider_opacity") { return m_slider_opacity->currentTime(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->currentTime(); } else { return this->currentTime(); } } int DefaultInteractionAnimator::totalAnimationDuration(const QString &property) { if (property == "groove_width") { return m_groove_width->duration(); } else if (property == "slider_opacity") { return m_slider_opacity->duration(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->duration(); } else { return this->duration(); } } qt5-ukui-platformtheme/libqt5-ukui-style/animations/animator-iface.h0000644000175000017500000000414114205314371024532 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef ANIMATORIFACE_H #define ANIMATORIFACE_H #include "animator-plugin-iface.h" #include class QWidget; class AnimatorIface { public: virtual ~AnimatorIface() {} virtual bool bindWidget(QWidget *w) {return false;} virtual bool unboundWidget() {return false;} virtual QWidget *boundedWidget() {return nullptr;} virtual QVariant value(const QString &property) {return QVariant();} virtual bool setAnimatorStartValue(const QString &property, const QVariant &value) {return false;} virtual bool setAnimatorEndValue(const QString &property, const QVariant &value) {return false;} virtual bool setAnimatorDuration(const QString &property, int duration) {return false;} virtual void setAnimatorDirectionForward(const QString &property = nullptr, bool forward = true) {} virtual bool isRunning(const QString &property = nullptr) {return false;} virtual void startAnimator(const QString &property = nullptr) {} virtual void stopAnimator(const QString &property = nullptr) {} virtual int currentAnimatorTime(const QString &property = nullptr) {return 0;} virtual void setAnimatorCurrentTime(const QString &property = nullptr, const int msecs = 0) {} virtual int totalAnimationDuration(const QString &property = nullptr) {return 0;} }; #endif // ANIMATORIFACE_H qt5-ukui-platformtheme/libqt5-ukui-style/animations/animation-helper.h0000644000175000017500000000265414205314371025116 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef ANIMATIONHELPER_H #define ANIMATIONHELPER_H #include class QWidget; class AnimatorIface; class AnimationHelper : public QObject { Q_OBJECT public: explicit AnimationHelper(QObject *parent = nullptr); virtual ~AnimationHelper(); signals: public slots: virtual bool registerWidget(QWidget *) {return false;} virtual bool unregisterWidget(QWidget *) {return false;} protected: /*! * \brief m_animators * \deprecated * You should not use this member in newly-written code. */ QHash *m_animators = nullptr; }; #endif // ANIMATIONHELPER_H qt5-ukui-platformtheme/libqt5-ukui-style/development-files/0000755000175000017500000000000014205314371022762 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/development-files/qt5-ukui.pc0000644000175000017500000000046314205314371024775 0ustar fengfengName: libqt5-ukui-style Description: UKUI style API for secondary development. Home Page: https://github.com/ukui/qt5-ukui-platformtheme Requires: Qt5Widgets >= 5.12.1 glib-2.0 gio-2.0 gsettings-qt Version: 1.0.0 Libs: -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lqt5-ukui-style Cflags: -I/usr/include/qt5-ukui qt5-ukui-platformtheme/libqt5-ukui-style/settings/0000755000175000017500000000000014205314452021200 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/settings/settings.pri0000644000175000017500000000040114205314371023547 0ustar fengfengHEADERS += $$PWD/libqt5-ukui-style_global.h \ $$PWD/ukui-style-settings.h \ $$PWD/application-style-settings.h SOURCES += $$PWD/ukui-style-settings.cpp \ $$PWD/application-style-settings.cpp INCLUDEPATH += $$PWD/.. INCLUDEPATH += $$PWD qt5-ukui-platformtheme/libqt5-ukui-style/settings/org.ukui.style.gschema.xml0000644000175000017500000000725514205314452026243 0ustar fengfeng "ukui" Current Qt Style Set default style for UKUI desktop environment. "ukui" Icon Theme for Qt Applications. Icon Theme for Qt Applications. "Noto Sans CJK SC" System Font for Qt Applications. System Font for Qt Applications. "11" System Font Size for Qt Applications. System Font Size for Qt Applications. Use point size. true Enable Window Blur Effects. Globally enable or disable the window blur effects for transparent window. Setting it to "false" will disable the effects. 72 Menu's transparency. The default transparency of menu. 72 Peony::SideBar's transparency. The default transparency of the peony side bar. "[]" a list of QWidget based classes do not blur. Example: [QWidget, QWidget1, QWidget2] false Use system palette. Globally enable or disable system palette provided by ukui platform. "" System Palette Set default system palette for UKUI desktop environment. false Use custom highlight color. Globally enable or disable custom highlight color. "#3D6BE5" Custom highlight color Set custom highlight color for UKUI desktop environment. true Blink text cursor. Globally enable or disable blinking text cursor. 1200 Blink text cursor interval. The interval of text cursor blink. qt5-ukui-platformtheme/libqt5-ukui-style/settings/ukui-style-settings.cpp0000644000175000017500000000221614205314371025656 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-style-settings.h" static UKUIStyleSettings *global_instance = nullptr; UKUIStyleSettings::UKUIStyleSettings() : QGSettings ("org.ukui.style", "/org/ukui/style/") { } UKUIStyleSettings *UKUIStyleSettings::globalInstance() { if (!global_instance){ global_instance = new UKUIStyleSettings; } return global_instance; } qt5-ukui-platformtheme/libqt5-ukui-style/settings/black-list.h0000644000175000017500000000273714205314371023407 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef BLACKLIST_H #define BLACKLIST_H #include static const QStringList blackAppList() { QStringList l; //l<<"ukui-control-center"; l<<"ubuntu-kylin-software-center.py"; // l<<"kylin-burner"; l<<"assistant"; l<<"sogouIme-configtool"; l<<"Ime Setting"; // l<<"kylin-user-guide"; l<<"biometric-authentication"; return l; } static const QStringList blackAppListWithBlurHelper(){ QStringList l; l<<"youker-assistant"; l<<"kylin-assistant"; l<<"kylin-video"; // l<<"ukui-control-center"; l<<"ubuntu-kylin-software-center.py"; // l<<"kylin-burner"; l<<"ukui-clipboard"; return l; } #endif // BLACKLIST_H qt5-ukui-platformtheme/libqt5-ukui-style/settings/application-style-settings.cpp0000644000175000017500000001334714205314371027213 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "application-style-settings.h" #include #include #include #include #include static ApplicationStyleSettings *global_instance = nullptr; ApplicationStyleSettings *ApplicationStyleSettings::getInstance() { if (!global_instance) global_instance = new ApplicationStyleSettings; return global_instance; } const QString ApplicationStyleSettings::currentCustomStyleName() { if (m_style_stretagy == Default) return nullptr; return m_current_custom_style_name; } void ApplicationStyleSettings::setColor(const QPalette::ColorRole &role, const QColor &color, const QPalette::ColorGroup &group) { beginGroup(m_color_group_enum.key(group)); setValue(m_color_role_enum.key(role), color); endGroup(); QtConcurrent::run([=](){ this->sync(); }); auto palette = QApplication::palette(); palette.setColor(group, role, color); QApplication::setPalette(palette); qApp->paletteChanged(palette); } const QColor ApplicationStyleSettings::getColor(const QPalette::ColorRole &role, const QPalette::ColorGroup &group) { beginGroup(m_color_role_enum.key(group)); auto data = value(m_color_role_enum.key(role)); QColor color = qvariant_cast(data); endGroup(); if (color.isValid()) return color; return QApplication::palette().color(group, role); } void ApplicationStyleSettings::setColorStretagy(ApplicationStyleSettings::ColorStretagy stretagy) { if (m_color_stretagy != stretagy) { m_color_stretagy = stretagy; setValue("color-stretagy", stretagy); Q_EMIT colorStretageChanged(stretagy); QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::setStyleStretagy(ApplicationStyleSettings::StyleStretagy stretagy) { if (m_style_stretagy != stretagy) { m_style_stretagy = stretagy; setValue("style-stretagy", stretagy); Q_EMIT styleStretageChanged(stretagy); QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::setCustomStyle(const QString &style) { m_current_custom_style_name = style; QApplication::setStyle(style); } void ApplicationStyleSettings::refreshData(bool forceSync) { sync(); m_custom_palette = QApplication::palette(); auto color_stretagy = qvariant_cast(value("color-stretagy")); if (color_stretagy != m_color_stretagy) { m_color_stretagy = color_stretagy; Q_EMIT colorStretageChanged(m_color_stretagy); } auto style_stretagy = qvariant_cast(value("style-stretagy")); if (style_stretagy != m_style_stretagy) { m_style_stretagy = style_stretagy; Q_EMIT styleStretageChanged(m_style_stretagy); } auto current_custom_style_name = value("custom-style").toString(); if (m_current_custom_style_name != current_custom_style_name) { m_current_custom_style_name = current_custom_style_name; QApplication::setStyle(m_current_custom_style_name); } readPalleteSettings(); if (forceSync) { QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::readPalleteSettings() { for (int i = 0; i < m_color_group_enum.keyCount(); i++) { beginGroup(m_color_group_enum.key(i)); for (int j = 0; j < m_color_role_enum.keyCount(); j++) { auto data = value(m_color_role_enum.key(j)); if (data.isValid()) { m_custom_palette.setColor(QPalette::ColorGroup(i), QPalette::ColorRole(j), qvariant_cast(data)); } } } } ApplicationStyleSettings::ApplicationStyleSettings(QObject *parent) : QSettings(parent) { /*! \todo make settings together into an ini file. */ // QString configFileName = QApplication::organizationDomain() + "." + QApplication::organizationName() + "." + QApplication::applicationName(); // QString configDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + "ukui"; // QString configPath = configDir + "/" + configFileName; // setPath(QSettings::IniFormat, QSettings::UserScope, configPath); // setDefaultFormat(QSettings::IniFormat); setDefaultFormat(QSettings::IniFormat); #if (QT_VERSION >= QT_VERSION_CHECK(5,10,0)) setAtomicSyncRequired(true); #endif m_color_stretagy = qvariant_cast(value("color-stretagy")); m_style_stretagy = qvariant_cast(value("style-stretagy")); m_current_custom_style_name = value("custom-style").toString(); m_custom_palette = QApplication::palette(); readPalleteSettings(); QFileSystemWatcher *watcher = new QFileSystemWatcher(this); watcher->addPath(fileName()); connect(watcher, &QFileSystemWatcher::fileChanged, [=](){ refreshData(); }); } qt5-ukui-platformtheme/libqt5-ukui-style/settings/ukui-style-settings.h0000644000175000017500000000257414205314371025332 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef UKUISTYLESETTINGS_H #define UKUISTYLESETTINGS_H #include "libqt5-ukui-style_global.h" #include /*! * \brief The UKUIStyleSettings class * \details * To distingust with other gsettings, I derived this class form QGSettings. * It just represent the specific gsettings "org.ukui.style", and * there is no api difference from UKUIStyleSettings to QGSettings. */ class LIBQT5UKUISTYLESHARED_EXPORT UKUIStyleSettings : public QGSettings { Q_OBJECT public: UKUIStyleSettings(); static UKUIStyleSettings *globalInstance(); }; #endif // UKUISTYLESETTINGS_H qt5-ukui-platformtheme/libqt5-ukui-style/settings/libqt5-ukui-style_global.h0000644000175000017500000000211514205314371026201 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef LIBQT5UKUISTYLE_GLOBAL_H #define LIBQT5UKUISTYLE_GLOBAL_H #include #if defined(LIBQT5UKUISTYLE_LIBRARY) # define LIBQT5UKUISTYLESHARED_EXPORT Q_DECL_EXPORT #else # define LIBQT5UKUISTYLESHARED_EXPORT Q_DECL_IMPORT #endif #endif // LIBQT5UKUISTYLE_GLOBAL_H qt5-ukui-platformtheme/libqt5-ukui-style/settings/application-style-settings.h0000644000175000017500000000566214205314371026661 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef APPLICATIONSTYLESETTINGS_H #define APPLICATIONSTYLESETTINGS_H #include #include #include class QStyle; /*! * \brief The ApplicationStyleSettings class * \details * This class is used to decide the style switch stretagies for independent application. * For example, you can choose the color scheme switch stretagy of an application, hold * the color in light or dark, or follow the system's palette. * * \note * This API is unstable, if possible, do not use it. */ class ApplicationStyleSettings : public QSettings { Q_OBJECT public: enum ColorStretagy { System, Bright, Dark, Other }; Q_ENUM(ColorStretagy) enum StyleStretagy { Default, Custom }; Q_ENUM(StyleStretagy) static ApplicationStyleSettings *getInstance(); ColorStretagy currentColorStretagy() {return m_color_stretagy;} StyleStretagy currentStyleStretagy() {return m_style_stretagy;} const QString currentCustomStyleName(); void setColor(const QPalette::ColorRole &role, const QColor &color, const QPalette::ColorGroup &group = QPalette::Active); const QColor getColor(const QPalette::ColorRole &role, const QPalette::ColorGroup &group = QPalette::Active); QPalette getCustomPalette() {return m_custom_palette;} signals: void colorStretageChanged(const ColorStretagy &stretagy); void styleStretageChanged(const StyleStretagy &stretagy); public slots: void setColorStretagy(ColorStretagy stretagy); void setStyleStretagy(StyleStretagy stretagy); void setCustomStyle(const QString &style); protected: void refreshData(bool forceSync = false); void readPalleteSettings(); private: explicit ApplicationStyleSettings(QObject *parent = nullptr); ~ApplicationStyleSettings() {} ColorStretagy m_color_stretagy; StyleStretagy m_style_stretagy; QString m_current_custom_style_name; QMetaEnum m_color_role_enum = QMetaEnum::fromType(); QMetaEnum m_color_group_enum = QMetaEnum::fromType(); QPalette m_custom_palette; }; #endif // APPLICATIONSTYLESETTINGS_H qt5-ukui-platformtheme/libqt5-ukui-style/libqt5-ukui-style.pro0000644000175000017500000000257114205314452023400 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2020-01-02T12:00:35 # #------------------------------------------------- QT += widgets concurrent TARGET = qt5-ukui-style TEMPLATE = lib DEFINES += LIBQT5UKUISTYLE_LIBRARY # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_NO_DEBUG_OUTPUT # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 include(libqt5-ukui-style.pri) CONFIG += c++11 link_pkgconfig PKGCONFIG += gsettings-qt DISTFILES += \ org.ukui.style.gschema.xml unix { target.path = $$[QT_INSTALL_LIBS] INSTALLS += target gschema.path = /usr/share/glib-2.0/schemas gschema.files += $$PWD/settings/org.ukui.style.gschema.xml INSTALLS += gschema pkgconfig.path = $$[QT_INSTALL_LIBS]/pkgconfig pkgconfig.files += development-files/qt5-ukui.pc INSTALLS += pkgconfig } qt5-ukui-platformtheme/libqt5-ukui-style/gestures/0000755000175000017500000000000014205314371021201 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/gestures/ukui-two-finger-zoom-gesture.cpp0000644000175000017500000001627614205314371027413 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-two-finger-zoom-gesture.h" #include #include #include #include using namespace UKUI; TwoFingerZoomGesture::TwoFingerZoomGesture(QObject *parent) : QGesture(parent) { } UKUI::TwoFingerZoomGestureRecognizer::TwoFingerZoomGestureRecognizer() : QGestureRecognizer() { } QGesture *TwoFingerZoomGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); return new TwoFingerZoomGesture; } QGestureRecognizer::Result TwoFingerZoomGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) { if (auto touchEvent = static_cast(event)) { auto zoomGesture = static_cast(gesture); switch (touchEvent->type()) { case QEvent::TouchBegin: gesture->setHotSpot(touchEvent->touchPoints().first().screenPos()); return QGestureRecognizer::MayBeGesture; break; case QEvent::TouchUpdate: { if (touchEvent->touchPoints().count() != 2) return QGestureRecognizer::Ignore; switch (zoomGesture->zoomDirection()) { case TwoFingerZoomGesture::Invalid: { zoomGesture->m_start_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_start_points.second = touchEvent->touchPoints().last().pos().toPoint(); zoomGesture->m_last_points = zoomGesture->m_start_points; zoomGesture->m_current_points = zoomGesture->m_start_points; zoomGesture->m_start_points_distance = (zoomGesture->m_start_points.first - zoomGesture->m_start_points.second).manhattanLength(); zoomGesture->m_last_points_distance = zoomGesture->m_start_points_distance; zoomGesture->m_zoom_direction = TwoFingerZoomGesture::Unkown; return QGestureRecognizer::TriggerGesture; } case TwoFingerZoomGesture::Unkown: { zoomGesture->m_last_points = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal totalDelta = currentPointsDistance - zoomGesture->m_start_points_distance; //qDebug()<m_start_points_distance< 100) { zoomGesture->m_last_points_distance = currentPointsDistance; if (totalDelta > 0) { zoomGesture->m_zoom_direction = TwoFingerZoomGesture::ZoomIn; } else { zoomGesture->m_zoom_direction = TwoFingerZoomGesture::ZoomOut; } return QGestureRecognizer::TriggerGesture; } else { return QGestureRecognizer::MayBeGesture; } break; } case TwoFingerZoomGesture::ZoomIn: { // check if gesture should trigger or cancel auto tmp = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal distanceOffset = currentPointsDistance - zoomGesture->m_last_points_distance; if (distanceOffset > 0) { // trigger zoom in zoomGesture->m_last_points = tmp; return QGestureRecognizer::TriggerGesture; } else { if (qAbs(distanceOffset) < 100) { return QGestureRecognizer::Ignore; } else { return QGestureRecognizer::CancelGesture; } } } case TwoFingerZoomGesture::ZoomOut: { // check if gesture should trigger or cancel auto tmp = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal distanceOffset = currentPointsDistance - zoomGesture->m_last_points_distance; if (distanceOffset < 0) { // trigger zoom out zoomGesture->m_last_points = tmp; return QGestureRecognizer::TriggerGesture; } else { if (qAbs(distanceOffset) < 100) { return QGestureRecognizer::Ignore; } else { return QGestureRecognizer::CancelGesture; } } } } break; } case QEvent::TouchCancel: reset(gesture); return QGestureRecognizer::CancelGesture; case QEvent::TouchEnd: reset(gesture); return QGestureRecognizer::FinishGesture; default: break; } } return QGestureRecognizer::Ignore; } void TwoFingerZoomGestureRecognizer::reset(QGesture *gesture) { auto zoomGesture = static_cast(gesture); zoomGesture->m_start_points.first = QPoint(); zoomGesture->m_start_points.second = QPoint(); zoomGesture->m_current_points.first = QPoint(); zoomGesture->m_current_points.second = QPoint(); zoomGesture->m_zoom_direction = TwoFingerZoomGesture::Invalid; QGestureRecognizer::reset(gesture); } qt5-ukui-platformtheme/libqt5-ukui-style/gestures/ukui-two-finger-slide-gesture.h0000644000175000017500000000353714205314371027170 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef TWOFINGERSLIDEGESTURE_H #define TWOFINGERSLIDEGESTURE_H #include #include namespace UKUI { class TwoFingerSlideGesture : public QGesture { friend class TwoFingerSlideGestureRecognizer; Q_OBJECT public: enum Direction { Invalid, Horizal, Vertical }; explicit TwoFingerSlideGesture(QObject *parent = nullptr); Direction direction() {return m_direction;} const QPoint startPos() {return m_start_pos;} const QPoint currentPos() {return m_current_pos;} int delta(); int totalDelta(); private: QPoint m_start_pos; QPoint m_last_pos; QPoint m_current_pos; Direction m_direction = Invalid; }; class TwoFingerSlideGestureRecognizer : public QGestureRecognizer { public: explicit TwoFingerSlideGestureRecognizer(); QGesture *create(QObject *target) override; QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override; void reset(QGesture *gesture) override; }; } #endif // TWOFINGERSLIDEGESTURE_H qt5-ukui-platformtheme/libqt5-ukui-style/gestures/ukui-two-finger-slide-gesture.cpp0000644000175000017500000001405414205314371027517 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "ukui-two-finger-slide-gesture.h" #include #include #include #include using namespace UKUI; TwoFingerSlideGesture::TwoFingerSlideGesture(QObject *parent) : QGesture(parent) { } int TwoFingerSlideGesture::delta() { switch (m_direction) { case Horizal: return m_current_pos.x() - m_last_pos.x(); case Vertical: return m_current_pos.y() - m_last_pos.y(); case Invalid: return 0; } return 0; } int TwoFingerSlideGesture::totalDelta() { switch (m_direction) { case Horizal: return m_current_pos.x() - m_start_pos.x(); case Vertical: return m_current_pos.y() - m_start_pos.y(); case Invalid: return 0; } return 0; } TwoFingerSlideGestureRecognizer::TwoFingerSlideGestureRecognizer() : QGestureRecognizer() { } QGesture *TwoFingerSlideGestureRecognizer::create(QObject *target) { //qDebug()<<"create"; if (target && target->isWidgetType()) static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); return new TwoFingerSlideGesture; } QGestureRecognizer::Result TwoFingerSlideGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) { if (auto touchEvent = static_cast(event)) { auto slideGesture = static_cast(gesture); switch (event->type()) { case QEvent::TouchBegin: { slideGesture->m_start_pos = touchEvent->touchPoints().first().pos().toPoint(); slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); slideGesture->m_last_pos = touchEvent->touchPoints().first().pos().toPoint(); gesture->setHotSpot(touchEvent->touchPoints().first().screenPos()); return QGestureRecognizer::MayBeGesture; break; } case QEvent::TouchUpdate: { // only support 2 fingers if (touchEvent->touchPoints().count() != 2) return QGestureRecognizer::Ignore; if (touchEvent->touchPointStates() & Qt::TouchPointPressed) { if (touchEvent->touchPoints().count() == 2) { // update start point center slideGesture->m_start_pos = (touchEvent->touchPoints().first().pos().toPoint() + touchEvent->touchPoints().last().pos().toPoint())/2; //qDebug()<<"update start point"<startPos(); return QGestureRecognizer::MayBeGesture; } } if (touchEvent->touchPointStates() & Qt::TouchPointMoved) { // initial slide gesture direction, note that // once direction ensured, it will not be changed // untill the gesture finished or cancelled. if (slideGesture->direction() == TwoFingerSlideGesture::Invalid) { qreal distance = (touchEvent->touchPoints().first().pos().toPoint() - touchEvent->touchPoints().last().pos().toPoint()).manhattanLength(); // we should distinguish slide and pinch zoom gesture. if (distance > 200) return QGestureRecognizer::Ignore; QPoint offset = (touchEvent->touchPoints().first().pos().toPoint() + touchEvent->touchPoints().last().pos().toPoint())/2 - slideGesture->startPos(); //qDebug()< 50) { slideGesture->m_direction = TwoFingerSlideGesture::Vertical; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } else if (qAbs(offset.x()) > 50) { slideGesture->m_direction = TwoFingerSlideGesture::Horizal; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } else { // if offset set not enough, ignore. return QGestureRecognizer::Ignore; } } else { // update gesture slideGesture->m_last_pos = slideGesture->m_current_pos; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } } break; } case QEvent::TouchEnd: { reset(slideGesture); return QGestureRecognizer::FinishGesture; } case QEvent::TouchCancel: { reset(slideGesture); return QGestureRecognizer::CancelGesture; } default: break; } } return QGestureRecognizer::Ignore; } void TwoFingerSlideGestureRecognizer::reset(QGesture *gesture) { //qDebug()<<"reset"; auto slideGesture = static_cast(gesture); slideGesture->m_current_pos = QPoint(); slideGesture->m_last_pos = QPoint(); slideGesture->m_start_pos = QPoint(); slideGesture->m_direction = TwoFingerSlideGesture::Invalid; QGestureRecognizer::reset(gesture); } qt5-ukui-platformtheme/libqt5-ukui-style/gestures/ukui-two-finger-zoom-gesture.h0000644000175000017500000000410114205314371027040 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef TWOFINGERZOOMGESTURE_H #define TWOFINGERZOOMGESTURE_H #include #include #include namespace UKUI { class TwoFingerZoomGesture : public QGesture { friend class TwoFingerZoomGestureRecognizer; Q_OBJECT public: enum Direction { Invalid, Unkown, ZoomIn, ZoomOut }; explicit TwoFingerZoomGesture(QObject *parent = nullptr); Direction zoomDirection() {return m_zoom_direction;} QPair startPoints() {return m_start_points;} QPair lastPoints() {return m_last_points;} QPair currentPoints() {return m_current_points;} private: QPair m_start_points; QPair m_last_points; QPair m_current_points; qreal m_start_points_distance = -1; qreal m_last_points_distance = -1; Direction m_zoom_direction = Invalid; }; class TwoFingerZoomGestureRecognizer : public QGestureRecognizer { public: explicit TwoFingerZoomGestureRecognizer(); QGesture *create(QObject *target) override; QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override; void reset(QGesture *gesture) override; }; } #endif // TWOFINGERZOOMGESTURE_H qt5-ukui-platformtheme/libqt5-ukui-style/gestures/gestures.pri0000644000175000017500000000036714205314371023564 0ustar fengfengINCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/.. HEADERS += \ $$PWD/ukui-two-finger-slide-gesture.h \ $$PWD/ukui-two-finger-zoom-gesture.h SOURCES += \ $$PWD/ukui-two-finger-slide-gesture.cpp \ $$PWD/ukui-two-finger-zoom-gesture.cpp qt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/0000755000175000017500000000000014205314371022475 5ustar fengfengqt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/internal-styles.pri0000644000175000017500000000026514205314371026351 0ustar fengfengINCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/.. SOURCES += $$PWD/internal-style.cpp \ $$PWD/mps-style.cpp HEADERS += $$PWD/internal-style.h \ $$PWD/mps-style.h qt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/mps-style.h0000644000175000017500000001030314205314371024600 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef MPSSTYLE_H #define MPSSTYLE_H #include "internal-style.h" /*! * \brief The MPSStyle class * \details * M(enu)P(anel)S(idebar)Style is an internal style shared in several * UKUI desktop applications, such as UKUI Menu, UKUI Panel and UKUI Sidebar, etc. * * Usually, applications use the styles which have been installed as qstyle plugin in * UKUI desktop environment, such as ukui-white and ukui-black. However one style may * be not enough for UKUI3.0 desgin. The menu, panel and sidebar desgin is Noticeably * different from the common style which we used in peony or other qt's applications. * To integrate the unique style into the theme, I came up the idea of internal styles, * and combine them with current platform theme's frameworks. So it will Looks like a * whole style. * * \see InternalStyle */ class MPSStyle : public InternalStyle { Q_OBJECT public: explicit MPSStyle(bool dark = true); void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const; void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const; void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const; QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const; QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const; QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const; //virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget); int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const; void polish(QWidget *widget); void polish(QApplication *application); void polish(QPalette &palette); void unpolish(QWidget *widget); void unpolish(QApplication *application); QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; QPalette standardPalette() const; int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const; QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const; QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const; }; #endif // MPSSTYLE_H qt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/internal-style.h0000644000175000017500000000331214205314371025617 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #ifndef INTERNALSTYLE_H #define INTERNALSTYLE_H #include /*! * \brief The InternalStyle class * \details * This class is a interface type class. It is desgined as an extension of UKUI theme * frameworks. Applications which use internal style means that there will be no effect * when system theme switched, for example, from fusion to ukui-white. * But an internal style usually should response the palette settings changed for * keeping the unity as a desktop environment theme's extensions. * * The typical example which implement the internal style is MPSStyle. */ class InternalStyle : public QProxyStyle { Q_OBJECT public: explicit InternalStyle(QStyle *parentStyle = nullptr); explicit InternalStyle(const QString parentStyleName); signals: void useSystemStylePolicyChanged(bool use); public slots: virtual void setUseSystemStyle(bool use); }; #endif // INTERNALSTYLE_H qt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/mps-style.cpp0000644000175000017500000001143414205314371025141 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "mps-style.h" MPSStyle::MPSStyle(bool dark) : InternalStyle ("fusion") { } void MPSStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawComplexControl(control, option, painter, widget); } void MPSStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawControl(element, option, painter, widget); } void MPSStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const { //FIXME: QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap); } void MPSStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const { //FIXME: QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); } void MPSStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawPrimitive(element, option, painter, widget); } QPixmap MPSStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const { //FIXME: return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option); } QStyle::SubControl MPSStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const { //FIXME: return QProxyStyle::hitTestComplexControl(control, option, position, widget); } QRect MPSStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const { //FIXME: return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap); } QRect MPSStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const { //FIXME: return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text); } int MPSStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::pixelMetric(metric, option, widget); } void MPSStyle::polish(QWidget *widget) { //FIXME: QProxyStyle::polish(widget); } void MPSStyle::polish(QApplication *application) { //FIXME: QProxyStyle::polish(application); } void MPSStyle::polish(QPalette &palette) { //FIXME: QProxyStyle::polish(palette); } void MPSStyle::unpolish(QWidget *widget) { //FIXME: QProxyStyle::unpolish(widget); } void MPSStyle::unpolish(QApplication *application) { //FIXME: QProxyStyle::unpolish(application); } QSize MPSStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { //FIXME: return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); } QIcon MPSStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::standardIcon(standardIcon, option, widget); } QPalette MPSStyle::standardPalette() const { //FIXME: return QProxyStyle::standardPalette(); } int MPSStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const { //FIXME: return QProxyStyle::styleHint(hint, option, widget, returnData); } QRect MPSStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const { //FIXME: return QProxyStyle::subControlRect(control, option, subControl, widget); } QRect MPSStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::subElementRect(element, option, widget); } qt5-ukui-platformtheme/libqt5-ukui-style/internal-styles/internal-style.cpp0000644000175000017500000000214014205314371026150 0ustar fengfeng/* * Qt5-UKUI's Library * * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library. If not, see . * * Authors: Yue Lan * */ #include "internal-style.h" InternalStyle::InternalStyle(QStyle *parentStyle) : QProxyStyle (parentStyle) { } InternalStyle::InternalStyle(const QString parentStyleName) : QProxyStyle(parentStyleName) { } void InternalStyle::setUseSystemStyle(bool use) { Q_EMIT useSystemStylePolicyChanged(use); } qt5-ukui-platformtheme/libqt5-ukui-style/libqt5-ukui-style.pri0000644000175000017500000000030114205314371023357 0ustar fengfengINCLUDEPATH += $$PWD include(animations/animations.pri) include(settings/settings.pri) include(internal-styles/internal-styles.pri) include(effects/effects.pri) include(gestures/gestures.pri) qt5-ukui-platformtheme/doxygen/0000755000175000017500000000000014205314371015504 5ustar fengfengqt5-ukui-platformtheme/doxygen/Doxyfile.in0000644000175000017500000032407314205314371017630 0ustar fengfeng# Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv # built into libc) for the transcoding. See http://www.gnu.org/software/libiconv # for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = "Qt5 UKUI" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = out # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = YES # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = YES # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = YES # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = YES # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: # FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: # Fortran. In the later case the parser tries to guess whether the code is fixed # or free formatted code, this is the default for Fortran type files), VHDL. For # instance to make doxygen treat .inc files as Fortran files (default is PHP), # and .f files as C (default is Fortran), use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 0. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if ... \endif and \cond # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete # parameter documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = ../ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: http://www.gnu.org/software/libiconv) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.idl \ *.ddl \ *.odl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.cs \ *.d \ *.php \ *.php4 \ *.php5 \ *.phtml \ *.inc \ *.m \ *.markdown \ *.md \ *.mm \ *.dox \ *.py \ *.pyw \ *.f90 \ *.f95 \ *.f03 \ *.f08 \ *.f \ *.for \ *.tcl \ *.vhd \ *.vhdl \ *.ucf \ *.qsf # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = ../test # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # # # where is the value of the INPUT_FILTER tag, and is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see http://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the config file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the # cost of reduced performance. This can be particularly helpful with template # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse-libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. CLANG_OPTIONS = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # http://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: http://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from http://www.mathjax.org before deployment. # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use + S # (what the is depends on the OS and browser, but it is typically # , /