forked from openkylin/qt5-ukui-platformtheme
New upstream version 3.22.0.0
This commit is contained in:
parent
48f635f205
commit
ca8cd9f37f
|
@ -28,6 +28,7 @@
|
|||
static const QStringList blackAppList() {
|
||||
QStringList l;
|
||||
//l<<"ukui-control-center";
|
||||
l<<"kylin-software-center.py";
|
||||
l<<"ubuntu-kylin-software-center.py";
|
||||
// l<<"kylin-burner";
|
||||
l<<"assistant";
|
||||
|
@ -59,8 +60,12 @@ static const QStringList useDarkPaletteList() {
|
|||
// l<<"ukui-panel";
|
||||
// l<<"ukui-sidebar";
|
||||
// l<<"ukui-volume-control-applet-qt";
|
||||
// l<<"kylin-nm"; //网络
|
||||
// l<<"panelukui-panel"; //日历
|
||||
// l<<"ukui-power-manager-tray";
|
||||
// l<<"kylin-nm";
|
||||
//// l<<"ukui-bluetooth";
|
||||
// l<<"sogouimebs"; //输入法
|
||||
// l<<"kylin-device-daemon"; //U盘
|
||||
l<<"ukui-flash-disk";
|
||||
// l<<"ukui-bluetooth";
|
||||
l<<"mktip";
|
||||
|
|
|
@ -150,7 +150,9 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
|
|||
// if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) {
|
||||
// QQuickStyle::setStyle("org.kylin.style");
|
||||
// }
|
||||
QQuickStyle::setStyle("org.ukui.style");
|
||||
if(qApp->inherits("QApplication") == true) {
|
||||
QQuickStyle::setStyle("org.ukui.style");
|
||||
}
|
||||
}
|
||||
|
||||
Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme()
|
||||
|
@ -246,8 +248,8 @@ bool Qt5UKUIPlatformTheme::usePlatformNativeDialog(DialogType type) const
|
|||
case QPlatformTheme::ColorDialog:
|
||||
return false;
|
||||
case QPlatformTheme::MessageDialog:
|
||||
if (qAppName() == "ukui-control-center")
|
||||
return false;
|
||||
// if (qAppName() == "ukui-control-center")
|
||||
// return false;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,7 @@ TARGET = qt5-ukui-platformtheme
|
|||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
CONFIG += c++11 link_pkgconfig lrelease
|
||||
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony
|
||||
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony kysdk-waylandhelper
|
||||
LIBS += -lX11
|
||||
|
||||
include(../libqt5-ukui-style/libqt5-ukui-style.pri)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="159"/>
|
||||
<source>Cd Up</source>
|
||||
<translation>འོད་སྡེར་གྱི་འོད་ཆེ</translation>
|
||||
<translation>གོང་ཕྱོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="166"/>
|
||||
|
@ -26,17 +26,17 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="174"/>
|
||||
<source>View Type</source>
|
||||
<translation>ལྟ་ཀློག་གི་རིགས་དབྱིབས</translation>
|
||||
<translation>མཐོང་རིས་ཀྱི་རིགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="184"/>
|
||||
<source>Sort Type</source>
|
||||
<translation>རིགས་དབྱིབས་རིགས་དབྱེ།</translation>
|
||||
<translation>གོ་རིམ་གྱི་རིགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="777"/>
|
||||
<source>Name</source>
|
||||
<translation>མིང་།</translation>
|
||||
<translation>ཡིག་ཆའི་མིང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="780"/>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="785"/>
|
||||
<source>Save as</source>
|
||||
<translation>གྲོན་ཆུང་བྱ་རྒྱུ།</translation>
|
||||
<translation>ཉར་ཚགས་གཞན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="787"/>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1608"/>
|
||||
<source>Redo</source>
|
||||
<translation>ཡང་བསྐྱར་ཐེངས་གཅིག་ལ་བསྐྱར</translation>
|
||||
<translation>ཡང་བསྐྱར་ལས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1805"/>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1805"/>
|
||||
<source>This operation is not supported.</source>
|
||||
<translation>གཤགས་བཅོས་འདི་ལ་རྒྱབ་སྐྱོར་མི་བྱེད།</translation>
|
||||
<translation>བཀོལ་སྤྱོད་འདི་ལ་རྒྱབ་སྐྱོར་མི་བྱེད།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -126,7 +126,7 @@
|
|||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1925"/>
|
||||
<source>Save File</source>
|
||||
<translation>ཡིག་ཆ་ཉར་ཚགས་བྱེད་པ</translation>
|
||||
<translation>ཡིག་ཆ་ཉར་ཚགས་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1938"/>
|
||||
|
@ -305,17 +305,17 @@
|
|||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="49"/>
|
||||
<source>Ascending</source>
|
||||
<translation>རིམ་པ་ཇེ་མང་དུ་འགྲོ་བཞིན</translation>
|
||||
<translation>རིམ་པ་ཇེ་མང་དུ་འགྲོ་བཞིན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="55"/>
|
||||
<source>Use global sorting</source>
|
||||
<translation>གོ་ལ་ཧྲིལ་པོའི་རིགས་འབྱེད་</translation>
|
||||
<translation>ཁྱོན་ཡོངས་ཀྱི་གོ་རིམ་བེད་སྤྱོད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="75"/>
|
||||
<source>List View</source>
|
||||
<translation>མིང་ཐོའི་ལྟ་ཚུལ།</translation>
|
||||
<translation>མཐོང་རིས་རེའུ་མིག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="76"/>
|
||||
|
|
|
@ -0,0 +1,339 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="mn">
|
||||
<context>
|
||||
<name>KyFileDialog</name>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="146"/>
|
||||
<source>Go Back</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="153"/>
|
||||
<source>Go Forward</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="159"/>
|
||||
<source>Cd Up</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="166"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="174"/>
|
||||
<source>View Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="184"/>
|
||||
<source>Sort Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="777"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="780"/>
|
||||
<source>Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="781"/>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="790"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="785"/>
|
||||
<source>Save as</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="787"/>
|
||||
<source>New Folder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="789"/>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="824"/>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="826"/>
|
||||
<source>Directories</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1010"/>
|
||||
<source>Warning</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1010"/>
|
||||
<source>exist, are you sure replace?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1013"/>
|
||||
<source>ok</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1022"/>
|
||||
<source>no</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1452"/>
|
||||
<source>NewFolder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1601"/>
|
||||
<source>Undo</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1608"/>
|
||||
<source>Redo</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1805"/>
|
||||
<source>warn</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1805"/>
|
||||
<source>This operation is not supported.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KyFileDialogHelper</name>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1924"/>
|
||||
<source>Open File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1925"/>
|
||||
<source>Save File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/kyfiledialog.cpp" line="1938"/>
|
||||
<source>All Files (*)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<location filename="../../test/mps-style-application/mainwindow.ui"/>
|
||||
<location filename="../../test/system-settings/mainwindow.ui"/>
|
||||
<source>MainWindow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>test open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>selected uri</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>test show</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>test exec</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>test save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/filedialog/mainwindow.ui"/>
|
||||
<source>test static open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<location filename="../../test/mps-style-application/mainwindow.ui"/>
|
||||
<source>PushButton</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<source>use auto highlight icon</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<location filename="../../test/mps-style-application/mainwindow.ui"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<source>highlightOnly</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/highlighted-icon-button/mainwindow.ui"/>
|
||||
<source>bothDefaultAndHighlight</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/mps-style-application/mainwindow.ui"/>
|
||||
<source>RadioButton</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/system-settings/mainwindow.ui"/>
|
||||
<source>style</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/system-settings/mainwindow.ui"/>
|
||||
<source>icon</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/system-settings/mainwindow.ui"/>
|
||||
<source>menu opacity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../test/system-settings/mainwindow.ui"/>
|
||||
<source>font</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../widget/message-box.h" line="190"/>
|
||||
<source>Executable '%1' requires Qt %2, found Qt %3.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/message-box.h" line="192"/>
|
||||
<source>Incompatible Qt Library Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QDialogButtonBox</name>
|
||||
<message>
|
||||
<location filename="../widget/message-box.cpp" line="405"/>
|
||||
<location filename="../widget/message-box.cpp" line="1075"/>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QMessageBox</name>
|
||||
<message>
|
||||
<location filename="../widget/message-box.cpp" line="461"/>
|
||||
<location filename="../widget/message-box.cpp" line="866"/>
|
||||
<location filename="../widget/message-box.cpp" line="1376"/>
|
||||
<source>Show Details...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/message-box.cpp" line="866"/>
|
||||
<location filename="../widget/message-box.cpp" line="1376"/>
|
||||
<source>Hide Details...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="19"/>
|
||||
<source>File Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="23"/>
|
||||
<source>Modified Date</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="27"/>
|
||||
<source>File Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="31"/>
|
||||
<source>File Size</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="35"/>
|
||||
<source>Original Path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="44"/>
|
||||
<source>Descending</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="49"/>
|
||||
<source>Ascending</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="55"/>
|
||||
<source>Use global sorting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="75"/>
|
||||
<source>List View</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widget/ui_kyfiledialog.cpp" line="76"/>
|
||||
<source>Icon View</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UKUI::TabWidget::DefaultSlideAnimatorFactory</name>
|
||||
<message>
|
||||
<location filename="../../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.h" line="49"/>
|
||||
<source>Default Slide</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.h" line="50"/>
|
||||
<source>Let tab widget switch with a slide animation.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -6,6 +6,9 @@
|
|||
//#define UseNativeFileDialog
|
||||
//#endif
|
||||
|
||||
#define SERVICE "com.kylin.statusmanager.interface"
|
||||
#define PATH "/"
|
||||
#define INTERFACE "com.kylin.statusmanager.interface"
|
||||
class NullDebug
|
||||
|
||||
{
|
||||
|
@ -21,7 +24,7 @@ NullDebug & operator <<(const T&){return *this;}
|
|||
inline NullDebug nullDebug(){return NullDebug();}
|
||||
|
||||
|
||||
#define LOG_TIMI
|
||||
//#define LOG_TIMI
|
||||
|
||||
#ifdef LOG_TIMI
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <PeonyFileItemModel>
|
||||
#include <QDebug>
|
||||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <KWindowEffects>
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
|
@ -76,9 +77,9 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
mKyFileDialogUi->setupUi(this);
|
||||
d_ptr.get()->m_container = mKyFileDialogUi->m_container;
|
||||
|
||||
QString path = "file://" + QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
pDebug << "initialDirPath:" << path << selectedUrls();
|
||||
goToUri(path, false);
|
||||
// QString path = "file://" + QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
// pDebug << "initialDirPath:" << path << selectedUrls();
|
||||
// goToUri(path, false);
|
||||
getCurrentPage()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
connect(mKyFileDialogUi->m_sider, &FileDialogSideBar::goToUriRequest, this, [this](const QString &uri, bool addToHistory, bool forceUpdate){
|
||||
|
@ -91,7 +92,7 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
connect(getCurrentPage(), &Peony::DirectoryViewContainer::directoryChanged, this, &KyNativeFileDialog::updateWindowState);
|
||||
|
||||
connect(getCurrentPage(), &Peony::DirectoryViewContainer::directoryChanged, this, [=](){
|
||||
pDebug << "directoryChanged........";
|
||||
pDebug << "directoryChanged........" << getCurrentUri();
|
||||
|
||||
Q_EMIT directoryEntered(QUrl(getCurrentUri()));
|
||||
pDebug << "locationChangeEnd....";
|
||||
|
@ -103,12 +104,13 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
if(m_fileDialogHelper->isViewInitialFinished())
|
||||
intiContainerSort();
|
||||
|
||||
mKyFileDialogUi->m_fileNameEdit->setText("");
|
||||
// mKyFileDialogUi->m_fileNameEdit->setText("");
|
||||
setShortCuts();
|
||||
});
|
||||
|
||||
connect(getCurrentPage(), &Peony::DirectoryViewContainer::viewDoubleClicked, this, [=](const QString &uri){
|
||||
auto info = Peony::FileInfo::fromUri(uri);
|
||||
pDebug << "viewDoubleClicked....." << uri << info->isDir() << info->isVolume();
|
||||
if (info->isDir() || info->isVolume()) {
|
||||
pDebug << "goToUrixxxxxxx....";
|
||||
goToUri(uri);
|
||||
|
@ -148,7 +150,7 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
if(key == "")
|
||||
{
|
||||
forceStopLoading();
|
||||
pDebug << "key is null";
|
||||
pDebug << "key is null m_lastSearchPath:" << m_lastSearchPath;
|
||||
m_isClearSearchKey = true;
|
||||
goToUri(m_lastSearchPath, true);
|
||||
}
|
||||
|
@ -156,6 +158,8 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
{
|
||||
auto targetUri = Peony::SearchVFSUriParser::parseSearchKey(path, key, true, false, "", true);
|
||||
pDebug << "updateSearch targetUri:" <<targetUri;
|
||||
pDebug << "updateSearch path:" <<path;
|
||||
|
||||
goToUri(targetUri, true);
|
||||
}
|
||||
});
|
||||
|
@ -280,10 +284,13 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent)
|
|||
updateMaximizeState();
|
||||
onSwitchView();
|
||||
|
||||
m_model = new QStringListModel();
|
||||
m_completer = new QCompleter(mKyFileDialogUi->m_fileNameEdit);
|
||||
m_completer->setModel(m_model);
|
||||
m_completer->setMaxVisibleItems(10);
|
||||
m_completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
|
||||
m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
// m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
mKyFileDialogUi->m_fileNameEdit->setCompleter(m_completer);
|
||||
|
||||
int number = QApplication::desktop()->screenNumber(QCursor::pos());
|
||||
if(number<0){
|
||||
|
@ -352,6 +359,16 @@ const QList<std::shared_ptr<Peony::FileInfo>> KyNativeFileDialog::getCurrentSele
|
|||
return infos;
|
||||
}
|
||||
|
||||
void KyNativeFileDialog::setCurrentSelections(QStringList selections)
|
||||
{
|
||||
QStringList list;
|
||||
foreach (QString str, selections) {
|
||||
list.append(Peony::FileUtils::urlEncode(str));
|
||||
}
|
||||
containerView()->setSelections(list);
|
||||
pDebug << "get setCurrentSelections....:" << containerView()->getSelections();
|
||||
}
|
||||
|
||||
Qt::SortOrder KyNativeFileDialog::getCurrentSortOrder()
|
||||
{
|
||||
return getCurrentPage()->getSortOrder();
|
||||
|
@ -505,7 +522,7 @@ void KyNativeFileDialog::beginSwitchView(const QString &viewId)
|
|||
if (internalViews.contains(viewId))
|
||||
Peony::GlobalSettings::getInstance()->setValue(DEFAULT_VIEW_ID, viewId);
|
||||
|
||||
getCurrentPage()->getView()->setSelections(selection);
|
||||
setCurrentSelections(selection);
|
||||
if (selection.count() >0)
|
||||
getCurrentPage()->getView()->scrollToSelection(selection.first());
|
||||
|
||||
|
@ -565,7 +582,10 @@ void KyNativeFileDialog::goToUri(const QString &uri, bool addToHistory, bool for
|
|||
if(isInitialGoToUriNum || (m_fileDialogHelper != nullptr && m_fileDialogHelper->isShow()))
|
||||
{
|
||||
isInitialGoToUriNum = false;
|
||||
getCurrentPage()->goToUri(uri, addToHistory, forceUpdate);
|
||||
if(uri.startsWith("search:///search_uris="))
|
||||
getCurrentPage()->goToUri(uri, addToHistory, forceUpdate);
|
||||
else
|
||||
getCurrentPage()->goToUri(Peony::FileUtils::urlEncode(uri), addToHistory, forceUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,14 +671,25 @@ QList<QUrl> KyNativeFileDialog::selectedUrls() const
|
|||
QStringList urlStrList = getCurrentPage()->getCurrentSelections();
|
||||
QList<QUrl> urls;
|
||||
for (auto uri : urlStrList) {
|
||||
pDebug << "selectedUrls urlDecode....:" << Peony::FileUtils::urlDecode(uri) << Peony::FileUtils::getTargetUri(uri);
|
||||
pDebug << "selectedUrls urlDecode....:" << Peony::FileUtils::urlDecode(uri) << QUrl(Peony::FileUtils::urlDecode(uri)) << Peony::FileUtils::getTargetUri(uri);
|
||||
if (uri.startsWith("trash://") || uri.startsWith("recent://")
|
||||
|| uri.startsWith("computer://") || uri.startsWith("favorite://")
|
||||
|| uri.startsWith("filesafe://"))
|
||||
urls << Peony::FileUtils::getTargetUri(uri);
|
||||
else
|
||||
urls << Peony::FileUtils::urlDecode(uri);
|
||||
else{
|
||||
// pDebug << "1123456789...." << Peony::FileUtils::getUriBaseName(uri) << Peony::FileUtils::getFileDisplayName(uri) <<
|
||||
// Peony::FileUtils::toDisplayUris(QStringList() << uri) << Peony::FileUtils::getParentUri(uri) << Peony::FileUtils::getOriginalUri(uri);
|
||||
// pDebug << "4567545678...." << QUrl(Peony::FileUtils::urlDecode(uri)).path() << QUrl(Peony::FileUtils::urlDecode(uri)).toDisplayString() <<
|
||||
// QUrl(Peony::FileUtils::urlDecode(uri)).toLocalFile();
|
||||
// pDebug << "4567545678...." << QUrl(uri).path() << QUrl(uri).toDisplayString() <<
|
||||
// QUrl(uri).toLocalFile();
|
||||
uri = uri.remove(0, 7);
|
||||
pDebug << "target uri...." << Peony::FileUtils::getTargetUri(uri) << Peony::FileUtils::urlDecode(uri);
|
||||
urls << QUrl::fromLocalFile(Peony::FileUtils::urlDecode(uri));//Peony::FileUtils::urlDecode(uri);
|
||||
}
|
||||
pDebug << "selectedUrls uri test......." << uri << urls;
|
||||
}
|
||||
pDebug << "selectedUrls..." << urls;
|
||||
return urls;
|
||||
}
|
||||
|
||||
|
@ -688,12 +719,13 @@ void KyNativeFileDialog::setNameFilters(const QStringList &filters)
|
|||
{
|
||||
Q_D(KyNativeFileDialog);
|
||||
d->nameFilters = filters;
|
||||
pDebug << "setNameFilters filters.....:" << filters;
|
||||
pDebug << "setNameFilters filters..... :" << filters;
|
||||
if (testOption(QFileDialog::HideNameFilterDetails)) {
|
||||
setComBoxItems(qt_strip_filters(filters));
|
||||
} else {
|
||||
setComBoxItems(filters);
|
||||
}
|
||||
|
||||
int index = mKyFileDialogUi->m_fileTypeCombo->currentIndex();
|
||||
pDebug << "setNameFilters index.....:" << index;
|
||||
selectNameFilterCurrentIndex(index);
|
||||
|
@ -743,9 +775,31 @@ void KyNativeFileDialog::selectNameFilterByIndex(int index)
|
|||
}
|
||||
QString nameFilter = nameFilters.at(index);
|
||||
QStringList newNameFilters = QPlatformFileDialogHelper::cleanFilterList(nameFilter);
|
||||
if (d->acceptMode == QFileDialog::AcceptSave && !newNameFilters.isEmpty()) {
|
||||
pDebug << "selectNameFilterByIndex00000000000";
|
||||
if (/*d->acceptMode == QFileDialog::AcceptSave &&*/ !newNameFilters.isEmpty() && (d->fileMode != QFileDialog::DirectoryOnly && d->fileMode != QFileDialog::Directory)) {
|
||||
QMimeDatabase db;
|
||||
QString fileName = mKyFileDialogUi->m_fileNameEdit->text();
|
||||
QString text = mKyFileDialogUi->m_fileNameEdit->text();
|
||||
pDebug << "selectNameFilterByIndex text...." << text;
|
||||
pDebug << "selectNameFilterByIndex newNameFilters...." << newNameFilters;
|
||||
QStringList list = text.split(".");
|
||||
pDebug << "selectNameFilterByIndex11111111 list" << list;
|
||||
if(list.length() > 1)
|
||||
{
|
||||
if("." + list[list.length() - 1] != newNameFilters[0])
|
||||
{
|
||||
int m = list[list.length() - 1].length();
|
||||
int n = text.length() - m;
|
||||
pDebug << "mmmmmmmmmm..." << m << " nnnnnnnn.... " << n;
|
||||
QString s = text.remove(n, m);
|
||||
pDebug << "s000000....." << s;
|
||||
QStringList filters = newNameFilters[0].split(".");
|
||||
s = s + filters[filters.length() - 1];
|
||||
pDebug << "s11111111....." << s;
|
||||
mKyFileDialogUi->m_fileNameEdit->setText(s);
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
if ((d->fileMode == QFileDialog::DirectoryOnly || d->fileMode == QFileDialog::Directory) && QStringList("/") != newNameFilters) {
|
||||
newNameFilters = QStringList("/");
|
||||
|
@ -770,8 +824,10 @@ void KyNativeFileDialog::selectNameFilterCurrentIndex(int index)
|
|||
}
|
||||
else
|
||||
getCurrentPage()->addFileDialogFiltersCondition(mimeTypeFilterList, filterList, filter(), Qt::CaseInsensitive);
|
||||
if(m_fileDialogHelper->isViewInitialFinished())
|
||||
if(m_fileDialogHelper->isViewInitialFinished()){
|
||||
refreshContainerSort();
|
||||
refreshCompleter();
|
||||
}
|
||||
}
|
||||
|
||||
int KyNativeFileDialog::selectNameFilterIndex() const
|
||||
|
@ -992,12 +1048,11 @@ void KyNativeFileDialog::onAcceptButtonClicked()
|
|||
|
||||
if(d->fileMode == QFileDialog::ExistingFile || d->fileMode == QFileDialog::ExistingFiles || (d->acceptMode == QFileDialog::AcceptOpen && d->fileMode == QFileDialog::AnyFile))
|
||||
{
|
||||
if(sFiles.length() >= 1)
|
||||
{
|
||||
if(isDir(sFiles[0]))
|
||||
for (int i = 0; i < sFiles.length(); ++i) {
|
||||
if(isDir(sFiles[i]))
|
||||
{
|
||||
pDebug << "gotouri666666" << "file://" + sFiles[0];
|
||||
goToUri(sFiles[0], true);
|
||||
pDebug << "gotouri666666" << "file://" + sFiles[i];
|
||||
goToUri(sFiles[i], true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1157,8 +1212,10 @@ bool KyNativeFileDialog::doOpen(QStringList sFiles)
|
|||
pDebug << "isfiles:" << isfiles << "isDirctory:" << isDirctory;
|
||||
if((isfiles > 0 && isDirctory > 0) || (isDirctory > 1) || (isfiles <= 0 && isDirctory <= 0))
|
||||
return false;
|
||||
else
|
||||
else{
|
||||
pDebug << "open setSelected...";
|
||||
Q_EMIT filesSelected(selectedUrls());
|
||||
}
|
||||
}
|
||||
else if(d->fileMode == QFileDialog::AnyFile)
|
||||
{
|
||||
|
@ -1204,7 +1261,7 @@ bool KyNativeFileDialog::doOpen(QStringList sFiles)
|
|||
}
|
||||
else
|
||||
{
|
||||
urls << Peony::FileUtils::urlDecode(uri);
|
||||
urls << QUrl::fromLocalFile(Peony::FileUtils::urlDecode(uri));
|
||||
}
|
||||
pDebug << "select uri....:" << containerView()->getSelections();
|
||||
|
||||
|
@ -1224,13 +1281,14 @@ void KyNativeFileDialog::onRejectButtonClicked()
|
|||
|
||||
bool KyNativeFileDialog::isDir(QString path)
|
||||
{
|
||||
path = Peony::FileUtils::urlEncode(path);
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
pDebug << "isDir path:" << path << fileInfo.isDir() << Peony::FileUtils::isFileDirectory(path) << Peony::FileUtils::getFileIsFolder(path);;
|
||||
pDebug << "isDir path1111:" << path << fileInfo.isDir() << Peony::FileUtils::isFileDirectory(path) << Peony::FileUtils::getFileIsFolder(path);;
|
||||
if(fileInfo.isDir())
|
||||
return true;
|
||||
|
||||
pDebug << "isDir path..:" << path << Peony::FileUtils::isFileDirectory(path) << Peony::FileUtils::getFileIsFolder(path);
|
||||
pDebug << "isDir path2222222..:" << path << Peony::FileUtils::isFileDirectory(path) << Peony::FileUtils::getFileIsFolder(path);
|
||||
return Peony::FileUtils::isFileDirectory(path);;
|
||||
}
|
||||
|
||||
|
@ -1291,30 +1349,32 @@ void KyNativeFileDialog::updateWindowState()
|
|||
// searchButtonClicked();
|
||||
// }
|
||||
|
||||
const QStringList list = getCurrentPage()->getAllFileUris();
|
||||
pDebug << "getAllFileUris:" << list;
|
||||
pDebug << "getselectUris:" << getCurrentSelectionsList();
|
||||
refreshCompleter();
|
||||
// const QStringList list = getCurrentPage()->getAllFileUris();
|
||||
// pDebug << "getAllFileUris:" << list;
|
||||
// pDebug << "getselectUris:" << getCurrentSelectionsList();
|
||||
|
||||
m_CurrentPathAllFiles.clear();
|
||||
// m_CurrentPathAllFiles.clear();
|
||||
|
||||
foreach (QString str, list) {
|
||||
str = Peony::FileUtils::urlDecode(str);
|
||||
m_CurrentPathAllFiles.append(str.split("/").last());
|
||||
}
|
||||
if(m_CurrentPathAllFiles.length() > 0){
|
||||
pDebug << "updateWindowState 1111111111111";
|
||||
m_completer = new QCompleter(m_CurrentPathAllFiles, mKyFileDialogUi->m_fileNameEdit);
|
||||
pDebug << "updateWindowState 2222222222222";
|
||||
}
|
||||
// foreach (QString str, list) {
|
||||
// str = Peony::FileUtils::urlDecode(str);
|
||||
// m_CurrentPathAllFiles.append(str.split("/").last());
|
||||
// }
|
||||
|
||||
// pDebug << "updateWindowState 1111111111111";
|
||||
// QStringListModel *model = (QStringListModel *)(m_completer->model());
|
||||
// model->setStringList(m_CurrentPathAllFiles);
|
||||
// pDebug << "updateWindowState 2222222222222";
|
||||
|
||||
auto uri = getCurrentUri();
|
||||
pDebug << "updateWindowState uri updatePath....." << uri;
|
||||
mKyFileDialogUi->m_pathbarWidget->updatePath(uri);
|
||||
mKyFileDialogUi->m_backButton->setEnabled(getCurrentPage()->canGoBack());
|
||||
mKyFileDialogUi->m_forwardButton->setEnabled(getCurrentPage()->canGoForward());
|
||||
mKyFileDialogUi->m_toParentButton->setEnabled(getCurrentPage()->canCdUp());
|
||||
updateStatusBar();
|
||||
pDebug << "updateWindowState 44444";
|
||||
//lineEditTextChange(mKyFileDialogUi->m_fileNameEdit->text());
|
||||
lineEditTextChange(mKyFileDialogUi->m_fileNameEdit->text());
|
||||
pDebug << "updateWindowState 55555555555555555555" << uri;
|
||||
|
||||
}
|
||||
|
@ -1524,12 +1584,12 @@ void KyNativeFileDialog::updateAcceptButtonState()
|
|||
{
|
||||
QString text = mKyFileDialogUi->m_fileNameEdit->text();
|
||||
QStringList list = text.split("\"");
|
||||
pDebug << "list............" << list;
|
||||
pDebug << "list234565432............" << list;
|
||||
for (int i = list.length() - 1; i >= 0; i--) {
|
||||
if(list[i] == "" || list[i] == " ")
|
||||
list.removeAt(i);
|
||||
}
|
||||
pDebug << "list..............:" << list;
|
||||
pDebug << "list testtttttt..............:" << list;
|
||||
|
||||
foreach (QString str, list) {
|
||||
if(str.length() > 0 && str[0] == "\"")
|
||||
|
@ -1540,11 +1600,34 @@ void KyNativeFileDialog::updateAcceptButtonState()
|
|||
|
||||
if(parentPath.endsWith("/"))
|
||||
parentPath.remove(parentPath.length() - 1, 1);
|
||||
pDebug << "updateAcceptButtonState str0000:" << (parentPath + "/" + str);
|
||||
if(Peony::FileUtils::isFileExsit(parentPath + "/" + str))
|
||||
pDebug << "updateAcceptButtonState str0000:" << (parentPath + "/" + str);//parentPath.startsWith("recent://")
|
||||
|
||||
if ((parentPath.startsWith("trash://") || parentPath.startsWith("recent://")
|
||||
|| parentPath.startsWith("computer://") || parentPath.startsWith("favorite://")
|
||||
|| parentPath.startsWith("filesafe://")) && getCurrentSelections().length() > 0)
|
||||
{
|
||||
isSelectFile = true;
|
||||
pDebug << "isSelectFile...." << isSelectFile;
|
||||
QString targetUri = Peony::FileUtils::getTargetUri(getCurrentSelections()[0]);
|
||||
QString targetPath = Peony::FileUtils::urlDecode(targetUri);
|
||||
pDebug << "getTargetUri uri....." << targetUri;
|
||||
pDebug << "uriiiiii...." << targetPath;
|
||||
if(Peony::FileUtils::isFileExsit(targetPath))
|
||||
{
|
||||
isSelectFile = true;
|
||||
pDebug << "isSelectFileeeeeeee11111...." << isSelectFile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString targetPath = Peony::FileUtils::urlDecode(parentPath + "/" + str);
|
||||
pDebug << "targetPath11111 uri....." << targetPath << Peony::FileUtils::isFileExsit(targetPath);
|
||||
|
||||
QString targetPath1 = Peony::FileUtils::urlEncode(parentPath + "/" + str);
|
||||
pDebug << "targetPath123432 uri....." << targetPath1 << Peony::FileUtils::isFileExsit(targetPath1);
|
||||
|
||||
if(Peony::FileUtils::isFileExsit(parentPath + "/" + str))
|
||||
isSelectFile = true;
|
||||
pDebug << "isSelectFileeeeeee22222...." << isSelectFile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1559,20 +1642,22 @@ void KyNativeFileDialog::updateAcceptButtonState()
|
|||
{
|
||||
QString text = mKyFileDialogUi->m_fileNameEdit->text();
|
||||
QStringList list = text.split("\"");
|
||||
pDebug << "list............" << list;
|
||||
pDebug << "list0000............" << list;
|
||||
for (int i = list.length() - 1; i >= 0; i--) {
|
||||
if(list[i] == "" || list[i] == " ")
|
||||
list.removeAt(i);
|
||||
}
|
||||
pDebug << "list..............:" << list;
|
||||
pDebug << "list1111..............:" << list;
|
||||
|
||||
foreach (QString str, list) {
|
||||
pDebug << "strrrrrrrrr....." << str;
|
||||
if(str.length() > 0 && str[0] == "\"")
|
||||
str = str.remove(0, 1);
|
||||
if(str.length() > 0 && str[str.length() - 1] == "\"")
|
||||
str = str.remove(str.length() - 1, 1);
|
||||
QString parentPath = getCurrentUri();
|
||||
|
||||
pDebug << "parentPath......" << parentPath;
|
||||
if(parentPath.endsWith("/"))
|
||||
parentPath.remove(parentPath.length() - 1, 1);
|
||||
pDebug << "updateAcceptButtonState str,,,,,,:" << (parentPath + "/" + str) << Peony::FileUtils::isFileExsit(parentPath + "/" + str);
|
||||
|
@ -1664,6 +1749,25 @@ void KyNativeFileDialog::refreshContainerSort()
|
|||
setSortFolderFirst(getWindowSortFolderFirst());
|
||||
}
|
||||
|
||||
void KyNativeFileDialog::refreshCompleter()
|
||||
{
|
||||
const QStringList list = getCurrentPage()->getAllFileUris();
|
||||
pDebug << "getAllFileUris:" << list;
|
||||
pDebug << "getselectUris:" << getCurrentSelectionsList();
|
||||
|
||||
m_CurrentPathAllFiles.clear();
|
||||
|
||||
foreach (QString str, list) {
|
||||
str = Peony::FileUtils::urlDecode(str);
|
||||
m_CurrentPathAllFiles.append(str.split("/").last());
|
||||
}
|
||||
|
||||
pDebug << "updateWindowState 1111111111111";
|
||||
QStringListModel *model = (QStringListModel *)(m_completer->model());
|
||||
model->setStringList(m_CurrentPathAllFiles);
|
||||
pDebug << "updateWindowState 2222222222222";
|
||||
}
|
||||
|
||||
void KyNativeFileDialog::searchButtonClicked()
|
||||
{
|
||||
m_searchMode = ! m_searchMode;
|
||||
|
@ -1671,7 +1775,7 @@ void KyNativeFileDialog::searchButtonClicked()
|
|||
{
|
||||
mKyFileDialogUi->m_fileNameEdit->setText("");
|
||||
mKyFileDialogUi->m_fileNameEdit->setReadOnly(true);
|
||||
containerView()->setSelections(QStringList());
|
||||
setCurrentSelections(QStringList());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1709,11 +1813,6 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
url.remove(url.length() - 1, 1);
|
||||
|
||||
pDebug << "parentPath:" << parentPath;
|
||||
if(m_CurrentPathAllFiles.length() > 0 ){
|
||||
pDebug << "completer666666666666666..........";
|
||||
mKyFileDialogUi->m_fileNameEdit->setCompleter(m_completer);
|
||||
pDebug << "completer 7777777777777.........." << m_completer->currentRow() << m_completer->currentCompletion();
|
||||
}
|
||||
|
||||
if(!text.contains("\""))
|
||||
{
|
||||
|
@ -1730,7 +1829,7 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
QStringList selectList;
|
||||
selectList.append(getCurrentSelections()[0]);
|
||||
pDebug << "selectList...000000" << selectList;
|
||||
containerView()->setSelections(selectList);
|
||||
setCurrentSelections(selectList);
|
||||
updateAcceptButtonState();
|
||||
return;
|
||||
}
|
||||
|
@ -1745,7 +1844,8 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
QStringList selectList;
|
||||
selectList.append(parentPath + "/" + text);
|
||||
pDebug << "selectList...1111111" << selectList;
|
||||
containerView()->setSelections(selectList);
|
||||
setCurrentSelections(selectList);
|
||||
pDebug << "selectList...22222222222" << containerView()->getSelections();
|
||||
updateAcceptButtonState();
|
||||
return;
|
||||
}
|
||||
|
@ -1753,7 +1853,7 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
{
|
||||
QString path = parentPath + "/" + text;
|
||||
pDebug << path << "not exists!";
|
||||
containerView()->setSelections(QStringList());
|
||||
setCurrentSelections(QStringList());
|
||||
updateAcceptButtonState();
|
||||
return;
|
||||
}
|
||||
|
@ -1778,19 +1878,19 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
}
|
||||
}
|
||||
pDebug << "selectList...222222222" << selectList;
|
||||
containerView()->setSelections(selectList);
|
||||
setCurrentSelections(selectList);
|
||||
updateAcceptButtonState();
|
||||
return;
|
||||
}
|
||||
else{
|
||||
QStringList selectList;
|
||||
QStringList list = text.split("\"");
|
||||
pDebug << "list............" << list;
|
||||
pDebug << "listttt1111............" << list;
|
||||
for (int i = list.length() - 1; i >= 0; i--) {
|
||||
if(list[i] == "" || list[i] == " ")
|
||||
list.removeAt(i);
|
||||
}
|
||||
pDebug << "list..............:" << list;
|
||||
pDebug << "listtttt22222222..............:" << list;
|
||||
|
||||
foreach (QString str, list) {
|
||||
if(str.length() > 0 && str[0] == "\"")
|
||||
|
@ -1804,7 +1904,7 @@ void KyNativeFileDialog::lineEditTextChange(QString text)
|
|||
selectList.append(parentPath + "/" + str);
|
||||
}
|
||||
pDebug << "selectList...333333" << selectList;
|
||||
containerView()->setSelections(selectList);
|
||||
setCurrentSelections(selectList);
|
||||
updateAcceptButtonState();
|
||||
}
|
||||
return;
|
||||
|
@ -1982,7 +2082,7 @@ void KyNativeFileDialog::setShortCuts()
|
|||
/// 所以这里使用现有的反选接口实现高效的全选,这个方法在mainwindow中也有用到
|
||||
//auto allFiles = this->getCurrentPage()->getView()->getAllFileUris();
|
||||
//this->getCurrentPage()->getView()->setSelections(allFiles);
|
||||
this->getCurrentPage()->getView()->setSelections(QStringList());
|
||||
setCurrentSelections(QStringList());
|
||||
this->getCurrentPage()->getView()->invertSelections();
|
||||
}
|
||||
});
|
||||
|
@ -2144,6 +2244,25 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
|
|||
mKyFileDialog->setWindowFlags(windowFlags);
|
||||
mKyFileDialog->setWindowModality(windowModality);
|
||||
|
||||
if(parent){
|
||||
if(QWidget *p = mKyFileDialog->find(parent->winId())){
|
||||
for(QFileDialog *fd : p->findChildren<QFileDialog *>()){
|
||||
if(options()->windowTitle() == fd->windowTitle()){
|
||||
pDebug << "filedoalog set parent...." << fd->geometry();
|
||||
mKyFileDialog->setParent(fd, windowFlags);
|
||||
// for(QPushButton *btn : mKyFileDialog->findChildren<QPushButton*>())
|
||||
// {
|
||||
// if(btn->objectName() == "acceptButton")
|
||||
// {
|
||||
// pDebug << "mydialog find object acceptButton";
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
|
@ -2151,11 +2270,6 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
|
|||
XAtomHelper::getInstance()->setWindowMotifHint(mKyFileDialog->winId(), hints);
|
||||
|
||||
mKyFileDialog->delayShow();
|
||||
|
||||
Q_UNUSED(parent);
|
||||
Q_UNUSED(windowFlags);
|
||||
Q_UNUSED(windowModality);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2174,13 +2288,13 @@ void KyFileDialogHelper::initDialog()
|
|||
nameFilters.append(QPlatformFileDialogHelper::cleanFilterList(nameFilter));
|
||||
}
|
||||
pDebug << "nameFilters....:" << nameFilters;
|
||||
// if(!nameFilters.contains("*"))
|
||||
// {
|
||||
// pDebug << "contains *....";
|
||||
// QStringList list = options()->nameFilters();
|
||||
// list.append(tr("All Files (*)"));
|
||||
// options()->setNameFilters(list);
|
||||
// }
|
||||
if(nameFilters.length() < 1)
|
||||
{
|
||||
pDebug << "contains *....";
|
||||
QStringList list = options()->nameFilters();
|
||||
list.append(tr("All Files (*)"));
|
||||
options()->setNameFilters(list);
|
||||
}
|
||||
pDebug << "option NameFilters:" << options()->nameFilters();
|
||||
pDebug << "option mode:" << options()->acceptMode() << options()->fileMode() << options()->viewMode();
|
||||
mKyFileDialog->setFilter(options()->filter());
|
||||
|
@ -2200,7 +2314,9 @@ void KyFileDialogHelper::initDialog()
|
|||
mKyFileDialog->setLabelText(static_cast<QFileDialog::DialogLabel>(label), options()->labelText(label));
|
||||
}
|
||||
}
|
||||
// pDebug << "initiallySelectedMimeTypeFilter,,,,:" << options()->initiallySelectedMimeTypeFilter() << options()->initiallySelectedNameFilter();
|
||||
auto filter = options()->initiallySelectedMimeTypeFilter();
|
||||
pDebug << "filter.........." << filter;
|
||||
if(!filter.isEmpty()) {
|
||||
selectMimeTypeFilter(filter);
|
||||
}
|
||||
|
@ -2265,7 +2381,7 @@ void KyFileDialogHelper::viewInitialFinished()
|
|||
|
||||
pDebug << "setSelections...." << strList << (mKyFileDialog->containerView() == nullptr);
|
||||
|
||||
mKyFileDialog->containerView()->setSelections(strList);
|
||||
mKyFileDialog->setCurrentSelections(strList);
|
||||
pDebug << "initial getselections:" << mKyFileDialog->getCurrentSelectionsList();
|
||||
//mKyFileDialog->containerView()->scrollToSelection(strList[0]);
|
||||
QString selectName = mKyFileDialog->selectName();
|
||||
|
@ -2355,7 +2471,10 @@ QList<QUrl> KyFileDialogHelper::selectedFiles() const
|
|||
}
|
||||
else
|
||||
{
|
||||
urls << Peony::FileUtils::urlDecode(uri);
|
||||
if(uri.startsWith("file:///"))
|
||||
uri = uri.remove(0,7);
|
||||
pDebug << "open selectedFiles00000..........:" << uri;
|
||||
urls << QUrl::fromLocalFile(Peony::FileUtils::urlDecode(uri));
|
||||
}
|
||||
|
||||
return urls;
|
||||
|
@ -2379,9 +2498,11 @@ QList<QUrl> KyFileDialogHelper::selectedFiles() const
|
|||
if(!path.endsWith("/"))
|
||||
path += "/";
|
||||
path += mKyFileDialog->mKyFileDialogUi->m_fileNameEdit->text();
|
||||
QUrl url(path);
|
||||
pDebug << "selectedFiles1111..........:" << url.toString();
|
||||
urls.append(url);
|
||||
if(path.startsWith("file:///"))
|
||||
path = path.remove(0,7);
|
||||
pDebug << "save selectedFiles00000..........:" << path;
|
||||
urls << QUrl::fromLocalFile(Peony::FileUtils::urlDecode(path));
|
||||
pDebug << "save selectedFiles2222..........:" << urls;
|
||||
return urls;
|
||||
}
|
||||
}
|
||||
|
@ -2392,11 +2513,18 @@ void KyFileDialogHelper::setFilter()
|
|||
|
||||
void KyFileDialogHelper::selectNameFilter(const QString &filter)
|
||||
{
|
||||
pDebug << "helper selectNameFilter......" << filter;
|
||||
mKyFileDialog->selectNameFilter(filter);
|
||||
}
|
||||
|
||||
void KyFileDialogHelper::selectMimeTypeFilter(const QString &filter)
|
||||
{
|
||||
pDebug << "selectMimeTypeFilter0000001111....." << filter;
|
||||
QMimeDatabase db;
|
||||
QMimeType mimetype = db.mimeTypeForName(filter);
|
||||
if(!mimetype.isValid())
|
||||
return;
|
||||
mKyFileDialog->selectNameFilter(mimetype.filterString());
|
||||
}
|
||||
|
||||
QString KyFileDialogHelper::selectedNameFilter() const
|
||||
|
@ -2406,7 +2534,8 @@ QString KyFileDialogHelper::selectedNameFilter() const
|
|||
|
||||
QString KyFileDialogHelper::selectedMimeTypeFilter() const
|
||||
{
|
||||
|
||||
pDebug << "selectMimeTypeFilter0000002222222......";
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool KyFileDialogHelper::isSupportedUrl(const QUrl &url) const
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QFileSystemModel>
|
||||
#include <QCompleter>
|
||||
#include <QListView>
|
||||
#include <QStringListModel>
|
||||
#include "qpa/qplatformdialoghelper.h"
|
||||
#include <peony-qt/FMWindowIface.h>
|
||||
|
||||
|
@ -46,6 +47,8 @@ public:
|
|||
const QStringList getCurrentSelectionsList();
|
||||
const QList<std::shared_ptr<Peony::FileInfo>> getCurrentSelectionFileInfos();
|
||||
|
||||
void setCurrentSelections(QStringList selections);
|
||||
|
||||
Qt::SortOrder getCurrentSortOrder();
|
||||
int getCurrentSortColumn();
|
||||
|
||||
|
@ -133,6 +136,8 @@ public:
|
|||
|
||||
void refreshContainerSort();
|
||||
|
||||
void refreshCompleter();
|
||||
|
||||
bool doSave(QStringList sFiles);
|
||||
|
||||
bool doOpen(QStringList sFiles);
|
||||
|
@ -202,6 +207,8 @@ private:
|
|||
bool m_shortcutsSet = false;
|
||||
QString m_lastSearchPath;
|
||||
bool m_isClearSearchKey = false;
|
||||
QStringListModel *m_model = nullptr;
|
||||
|
||||
};
|
||||
|
||||
class KyFileDialogHelper : public QPlatformFileDialogHelper
|
||||
|
|
|
@ -3,11 +3,23 @@
|
|||
|
||||
#include "menutoolbutoon.h"
|
||||
#include <QApplication>
|
||||
#include <QDBusInterface>
|
||||
static ToolButtonStyle *global_instance = nullptr;
|
||||
|
||||
MenuToolButton::MenuToolButton(QWidget *parent) : QToolButton(parent)
|
||||
{
|
||||
setStyle(ToolButtonStyle::getStyle());
|
||||
|
||||
QDBusInterface *interFace = new QDBusInterface(SERVICE, PATH, INTERFACE, QDBusConnection::sessionBus());
|
||||
if(interFace->isValid()){
|
||||
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(tableModeChanged(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
void MenuToolButton::tableModeChanged(bool isTableMode)
|
||||
{
|
||||
qDebug() << "tableModeChanged......" << isTableMode;
|
||||
setStyle(ToolButtonStyle::getStyle());
|
||||
}
|
||||
|
||||
ToolButtonStyle *ToolButtonStyle::getStyle()
|
||||
|
|
|
@ -18,6 +18,7 @@ Q_SIGNALS:
|
|||
|
||||
|
||||
public Q_SLOTS:
|
||||
void tableModeChanged(bool isTableMode);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -6,20 +6,45 @@
|
|||
#include <PeonyPathBarModel>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
#include <peony-qt/file-utils.h>
|
||||
#include "debug.h"
|
||||
#include "ukui-style-settings.h"
|
||||
|
||||
FileDialogPathBar::FileDialogPathBar(QWidget *parent) : QWidget(parent)//Peony::AdvancedLocationBar(parent)//QLineEdit(parent)//
|
||||
{
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setContentsMargins(0,0,0,0);
|
||||
m_pathBar = new Peony::AdvancedLocationBar(this);
|
||||
m_pathBar->setFixedWidth(this->width());
|
||||
m_pathBar->setGeometry(0, (this->height() - m_pathBar->height()) / 2, this->width(), m_pathBar->height());
|
||||
|
||||
QDBusInterface *interFace = new QDBusInterface(SERVICE, PATH, INTERFACE, QDBusConnection::sessionBus());
|
||||
if(interFace->isValid()){
|
||||
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(updateTableModel(bool)));
|
||||
}
|
||||
|
||||
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.statusmanager.interface",
|
||||
"/",
|
||||
"com.kylin.statusmanager.interface",
|
||||
"get_current_tabletmode");
|
||||
QDBusMessage ret = QDBusConnection::sessionBus().call(message);
|
||||
if (ret.type() != QDBusMessage::ReplyMessage)
|
||||
{
|
||||
//从返回参数获取返回值
|
||||
pDebug << "complex type failed!";
|
||||
updateTableModel(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateTableModel(ret.arguments()[0].value<bool>());
|
||||
}
|
||||
}
|
||||
|
||||
void FileDialogPathBar::updatePath(const QString &uri)
|
||||
{
|
||||
pDebug << "m_pathBar........ updatePath:" << uri;
|
||||
m_pathBar->updateLocation(uri);
|
||||
pDebug << "m_pathBar........ updatePath:" << uri << Peony::FileUtils::getEncodedUri(uri);
|
||||
m_pathBar->updateLocation(Peony::FileUtils::urlEncode(uri));
|
||||
// setText(uri);
|
||||
// clearFocus();
|
||||
}
|
||||
|
@ -34,4 +59,19 @@ Peony::AdvancedLocationBar *FileDialogPathBar::getPathBar()
|
|||
{
|
||||
return m_pathBar;
|
||||
}
|
||||
|
||||
void FileDialogPathBar::updateTableModel(bool isTable)
|
||||
{
|
||||
pDebug << "updateTableModel...." << isTable;
|
||||
// m_pathBar->updateTabletModeValue(isTable);
|
||||
if(isTable){
|
||||
m_pathBar->setFixedHeight(48);
|
||||
this->setFixedHeight(48);
|
||||
}
|
||||
else{
|
||||
m_pathBar->setFixedHeight(36);
|
||||
this->setFixedHeight(36);
|
||||
}
|
||||
pDebug << "m_pathBar height1111:" << m_pathBar->height() << this->height();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,7 @@ Q_SIGNALS:
|
|||
void searchRequest(const QString &path, const QString &key);
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateTableModel(bool isTable);
|
||||
void updatePath(const QString &uri);
|
||||
private:
|
||||
Peony::AdvancedLocationBar *m_pathBar = nullptr;
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
#include <QMessageBox>
|
||||
#include <QToolTip>
|
||||
#include <QScreen>
|
||||
#include <QDBusInterface>
|
||||
#include "kyfiledialog.h"
|
||||
#include "peony-qt/controls/menu/side-bar-menu/side-bar-menu.h"
|
||||
#include "peony-qt/side-bar-abstract-item.h"
|
||||
#include "peony-qt/controls/directory-view/delegate/side-bar-delegate.h"
|
||||
#include "peony-qt/volume-manager.h"
|
||||
#include "peony-qt/file-enumerator.h"
|
||||
#include "peony-qt/file-utils.h"
|
||||
|
@ -39,7 +39,17 @@ FileDialogComboBox::FileDialogComboBox(QWidget *parent):QComboBox(parent)
|
|||
pDebug << "setStyleChanged m_styleChanged:" << change;
|
||||
m_styleChanged = change;
|
||||
});
|
||||
QDBusInterface *interFace = new QDBusInterface(SERVICE, PATH, INTERFACE, QDBusConnection::sessionBus());
|
||||
if(interFace->isValid()){
|
||||
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(tableModeChanged(bool)));
|
||||
}
|
||||
m_minSize = this->minimumSize();
|
||||
pDebug << "combobox minsize...." << m_minSize;
|
||||
}
|
||||
|
||||
void FileDialogComboBox::tableModeChanged(bool isTableMode)
|
||||
{
|
||||
m_styleChanged = true;
|
||||
}
|
||||
|
||||
QSize FileDialogComboBox::minimumSizeHint() const
|
||||
|
@ -52,13 +62,14 @@ QSize FileDialogComboBox::minimumSizeHint() const
|
|||
}
|
||||
QSize size = QComboBox::minimumSizeHint();
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
FileDialogSideBar::FileDialogSideBar(QWidget *parent) : QTreeView(parent)
|
||||
{
|
||||
static SideBarStyle *global_style = new SideBarStyle;
|
||||
setStyle(SideBarStyle::getStyle());
|
||||
|
||||
setIconSize(QSize(16, 16));
|
||||
|
||||
|
@ -189,6 +200,11 @@ FileDialogSideBar::FileDialogSideBar(QWidget *parent) : QTreeView(parent)
|
|||
}
|
||||
});
|
||||
|
||||
QDBusInterface *interFace = new QDBusInterface(SERVICE, PATH, INTERFACE, QDBusConnection::sessionBus());
|
||||
if(interFace->isValid()){
|
||||
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(tableModeChanged(bool)));
|
||||
}
|
||||
|
||||
// if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
// auto settings = UKUIStyleSettings::globalInstance();
|
||||
// connect(settings, &QGSettings::changed, this, [=](const QString &key){
|
||||
|
@ -199,13 +215,18 @@ FileDialogSideBar::FileDialogSideBar(QWidget *parent) : QTreeView(parent)
|
|||
// });
|
||||
// }
|
||||
expandToDepth(1);
|
||||
setStyle(global_style);
|
||||
setViewportMargins(4, 4, 0, 0);
|
||||
|
||||
pDebug << "columndffffffffffffffff";
|
||||
// setColumnHidden(1, true);
|
||||
}
|
||||
|
||||
void FileDialogSideBar::tableModeChanged(bool isTableMode)
|
||||
{
|
||||
pDebug << "tableModeChanged........";
|
||||
setStyle(SideBarStyle::getStyle());
|
||||
}
|
||||
|
||||
void FileDialogSideBar::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
setViewportMargins(4, 4, 0, 0);
|
||||
|
@ -219,11 +240,6 @@ void FileDialogSideBar::resizeEvent(QResizeEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
QSize FileDialogSideBar::sizeHint() const
|
||||
{
|
||||
return QTreeView::sizeHint();
|
||||
}
|
||||
|
||||
void FileDialogSideBar::menuRequest(const QPoint &pos)
|
||||
{
|
||||
// auto index = indexAt(pos);
|
||||
|
@ -297,12 +313,12 @@ SideBarItemDelegate::SideBarItemDelegate(QObject *parent)
|
|||
// }
|
||||
}
|
||||
|
||||
QSize SideBarItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
auto size = QStyledItemDelegate::sizeHint(option, index);
|
||||
size.setHeight(36);
|
||||
return size;
|
||||
}
|
||||
//QSize SideBarItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
//{
|
||||
// auto size = QStyledItemDelegate::sizeHint(option, index);
|
||||
// size.setHeight(36);
|
||||
// return size;
|
||||
//}
|
||||
|
||||
|
||||
void SideBarItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
|
@ -326,11 +342,20 @@ void SideBarItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
static SideBarStyle *global_instance = nullptr;
|
||||
SideBarStyle::SideBarStyle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SideBarStyle* SideBarStyle::getStyle()
|
||||
{
|
||||
if (!global_instance) {
|
||||
global_instance = new SideBarStyle;
|
||||
}
|
||||
return global_instance;
|
||||
}
|
||||
|
||||
void SideBarStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
painter->save();
|
||||
|
|
|
@ -22,6 +22,9 @@ public:
|
|||
explicit FileDialogComboBox(QWidget *parent = nullptr);
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void tableModeChanged(bool isTableMode);
|
||||
|
||||
Q_SIGNALS:
|
||||
void setStyleChanged(bool change) const;
|
||||
|
||||
|
@ -40,10 +43,9 @@ public:
|
|||
void resizeEvent(QResizeEvent *e);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void menuRequest(const QPoint &pos);
|
||||
void tableModeChanged(bool isTableMode);
|
||||
|
||||
Q_SIGNALS:
|
||||
void goToUriRequest(const QString &uri, bool addToHistory = true, bool forceUpdate = false);
|
||||
|
@ -56,7 +58,7 @@ class SideBarItemDelegate : public QStyledItemDelegate
|
|||
friend class FileDialogSideBar;
|
||||
explicit SideBarItemDelegate(QObject *parent = nullptr);
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
// QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
|
@ -65,6 +67,7 @@ class SideBarStyle : public QProxyStyle
|
|||
{
|
||||
public:
|
||||
explicit SideBarStyle();
|
||||
static SideBarStyle* getStyle();
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
|
||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ void Ui_KyFileDialog::initSortMenu(QDialog *mKyFileDialog)
|
|||
m_sortButton->setMenu(m_sortMenu);
|
||||
m_sortButton->setPopupMode(QToolButton::InstantPopup);
|
||||
m_sortButton->setAutoRaise(true);
|
||||
m_sortButton->setFixedSize(QSize(57, 40));
|
||||
m_sortButton->setFixedWidth(57);
|
||||
m_sortButton->setIconSize(QSize(16, 16));
|
||||
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ void Ui_KyFileDialog::initModeMenu(QDialog *mKyFileDialog)
|
|||
m_modeButton = new MenuToolButton();
|
||||
m_modeButton->setPopupMode(QToolButton::InstantPopup);
|
||||
m_modeButton->setAutoRaise(true);
|
||||
m_modeButton->setFixedSize(QSize(57, 40));
|
||||
m_modeButton->setFixedWidth(57);
|
||||
m_modeButton->setIconSize(QSize(16, 16));
|
||||
|
||||
m_modeMenu = new QMenu(m_modeButton);
|
||||
|
@ -104,6 +104,9 @@ void Ui_KyFileDialog::initHeaderBar(QDialog *mKyFileDialog)
|
|||
m_backButton = new QToolButton();
|
||||
m_forwardButton = new QToolButton();
|
||||
m_toParentButton = new QToolButton();
|
||||
m_backButton->setObjectName("m_backButton");
|
||||
m_forwardButton->setObjectName("m_forwardButton");
|
||||
m_toParentButton->setObjectName("m_toParentButton");
|
||||
|
||||
m_pathbarWidget = new FileDialogPathBar();//new Peony::AdvancedLocationBar(mKyFileDialog);//
|
||||
m_pathbar = m_pathbarWidget->getPathBar();
|
||||
|
@ -143,7 +146,7 @@ void Ui_KyFileDialog::initLineEditLayout(QDialog *mKyFileDialog)
|
|||
m_fileNameLabel->setMinimumSize(QSize(0, 0));
|
||||
qDebug() << "3333333333333333333";
|
||||
|
||||
m_fileNameEdit = new QLineEdit();
|
||||
m_fileNameEdit = new QLineEdit(mKyFileDialog);
|
||||
m_fileNameEdit->setObjectName("fileNameEdit");
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
sizePolicy3.setHorizontalStretch(1);
|
||||
|
@ -172,18 +175,22 @@ void Ui_KyFileDialog::intiBtnLayout(QDialog *mKyFileDialog)
|
|||
m_hBtnLayout = new QHBoxLayout();
|
||||
m_hBtnLayout->addSpacing(20);
|
||||
m_hBtnLayout->setContentsMargins(0,0,24,0);
|
||||
m_newFolderButton =new QPushButton();
|
||||
m_newFolderButton =new QPushButton(mKyFileDialog);
|
||||
m_newFolderButton->setObjectName(QString::fromUtf8("newFolderButton"));
|
||||
m_hBtnLayout->addWidget(m_newFolderButton);
|
||||
|
||||
|
||||
m_acceptButton = new QPushButton();
|
||||
m_rejectButton = new QPushButton();
|
||||
m_acceptButton = new QPushButton(mKyFileDialog);
|
||||
m_rejectButton = new QPushButton(mKyFileDialog);
|
||||
m_acceptButton->setEnabled(false);
|
||||
m_hBtnLayout->addStretch();
|
||||
m_hBtnLayout->addWidget(m_rejectButton, 0, Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_hBtnLayout->addSpacing(15);
|
||||
m_hBtnLayout->addWidget(m_acceptButton, 0, Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
m_acceptButton->setObjectName(QString::fromUtf8("acceptButton"));
|
||||
m_rejectButton->setObjectName(QString::fromUtf8("rejectButton"));
|
||||
|
||||
qDebug() << "6666666666666666";
|
||||
}
|
||||
|
||||
|
@ -201,7 +208,8 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog)
|
|||
m_gridLayout = new QGridLayout(mKyFileDialog);
|
||||
m_gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
|
||||
m_container = new Peony::DirectoryViewContainer();
|
||||
m_container = new Peony::DirectoryViewContainer(mKyFileDialog);
|
||||
m_container->setObjectName("container");
|
||||
m_frame = new QFrame();
|
||||
vboxLayout = new QVBoxLayout();
|
||||
|
||||
|
@ -216,7 +224,7 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog)
|
|||
vboxLayout->setContentsMargins(0, 0, 8, 0);
|
||||
|
||||
vboxLayout->addLayout(m_hHeaderLayout);
|
||||
vboxLayout->addSpacing(6);
|
||||
vboxLayout->addSpacing(12);
|
||||
m_upSeperate = new QFrame();
|
||||
m_upSeperate->setFrameShape(QFrame::HLine);
|
||||
vboxLayout->addWidget(m_upSeperate);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <QStyleOption>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
#include <QtWidgets/qdialogbuttonbox.h>
|
||||
#include "ukuistylehelper/ukuistylehelper.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#include "private/qlabel_p.h"
|
||||
#include "private/qdialog_p.h"
|
||||
|
@ -120,6 +122,7 @@ public:
|
|||
QPushButton* mDetailButton; // 详细情况按钮
|
||||
QPushButton* mCloseButtton; //标题栏关闭按钮
|
||||
QLabel* mTitleText; //标题文本
|
||||
QLabel* mTitleIcon; //标题icon
|
||||
|
||||
QByteArray mMemberToDisconnectOnClose;
|
||||
QByteArray mSignalToDisconnectOnClose;
|
||||
|
@ -502,11 +505,26 @@ QPixmap MessageBox::standardIcon(QMessageBox::Icon icon)
|
|||
return MessageBoxPrivate::standardIcon(icon, nullptr);
|
||||
}
|
||||
|
||||
void MessageBox::setWindowIcon(const QIcon &icon)
|
||||
{
|
||||
Q_D(MessageBox);
|
||||
d->mTitleIcon->setPixmap(icon.pixmap(QSize(22, 22)));
|
||||
QDialog::setWindowIcon(icon);
|
||||
}
|
||||
|
||||
bool MessageBox::event(QEvent *e)
|
||||
{
|
||||
Q_D(MessageBox);
|
||||
bool result = QDialog::event(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::ApplicationWindowIconChange:
|
||||
// qDebug() << "Application window icon change.....";
|
||||
if(icon() != QMessageBox::NoIcon)
|
||||
setIcon(icon());
|
||||
if(!windowIcon().isNull())
|
||||
setWindowIcon(windowIcon());
|
||||
break;
|
||||
|
||||
case QEvent::LayoutRequest:
|
||||
{
|
||||
d->updateSize();
|
||||
|
@ -765,6 +783,12 @@ void MessageBoxPrivate::init(const QString &title, const QString &text)
|
|||
|
||||
mTitleText = new QLabel(q);
|
||||
mTitleText->setText(title);
|
||||
mTitleIcon = new QLabel();
|
||||
mTitleIcon->setPixmap(QIcon(qApp->windowIcon()).pixmap(QSize(22, 22)));
|
||||
mTitleIcon->setFixedSize(22, 22);
|
||||
|
||||
//qDebug() << "windowicon...." << QApplication::windowIcon().name();
|
||||
|
||||
q->setModal(true);
|
||||
mIcon = QMessageBox::NoIcon;
|
||||
}
|
||||
|
@ -824,9 +848,14 @@ void MessageBoxPrivate::setupLayout()
|
|||
}
|
||||
|
||||
QHBoxLayout *titleLayout = new QHBoxLayout;
|
||||
titleLayout->setContentsMargins(20,0,4,0);
|
||||
titleLayout->addWidget(mTitleText, Qt::AlignLeft);
|
||||
titleLayout->addWidget(mCloseButtton, Qt::AlignRight);
|
||||
titleLayout->setContentsMargins(6,0,4,0);
|
||||
if(!mTitleIcon->pixmap()->isNull()){
|
||||
titleLayout->addWidget(mTitleIcon, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
titleLayout->addSpacing(5);
|
||||
}
|
||||
titleLayout->addWidget(mTitleText, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
titleLayout->addWidget(mCloseButtton, Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setContentsMargins(4, 4, 4, 4);
|
||||
|
@ -1341,6 +1370,16 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
|
|||
|
||||
if (parent) {
|
||||
if (QWidget *p = mMessageBox->find(parent->winId())) {
|
||||
for(QMessageBox *mb : p->findChildren<QMessageBox *>())
|
||||
{
|
||||
if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text()
|
||||
&& mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) {
|
||||
if(!mb->windowIcon().isNull()){
|
||||
mMessageBox->setWindowIcon(mb->windowIcon());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//QMessageBox checkbox
|
||||
if (p->findChild<QCheckBox *>()) {
|
||||
|
@ -1378,11 +1417,17 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
|
|||
+ 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);
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
|
||||
{
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox);
|
||||
} else {
|
||||
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<QPushButton *>(ab)) {
|
||||
|
|
|
@ -114,6 +114,8 @@ public:
|
|||
|
||||
static QPixmap standardIcon(QMessageBox::Icon icon);
|
||||
|
||||
void setWindowIcon(const QIcon &icon);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override;
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <KSharedConfig>
|
||||
#include <KConfigGroup>
|
||||
#include <QGSettings/QGSettings>
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
QStyle *KyQuickStyleItem::s_style = nullptr;
|
||||
|
@ -1474,7 +1475,6 @@ void KyQuickStyleItem::paint(QPainter *painter)
|
|||
switch (m_itemType) {
|
||||
case Button:{
|
||||
QWidget wid;
|
||||
|
||||
if(m_buttonType=="MaxButton" || m_buttonType=="MinButton" ){
|
||||
wid.setProperty("isWindowButton", QVariant(0x01));
|
||||
}
|
||||
|
|
|
@ -40,13 +40,15 @@
|
|||
|
||||
using namespace UKUI;
|
||||
|
||||
#define blackStyleChangeApp "kylin-software-center"
|
||||
|
||||
ProxyStylePlugin::ProxyStylePlugin()
|
||||
{
|
||||
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
connect(settings, &UKUIStyleSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "styleName" || key == "widgetThemeName" || key == "themeColor") {
|
||||
if (blackList().contains(qAppName()) || qAppName() == "kylin-software-center.py")
|
||||
if (blackList().contains(qAppName()))
|
||||
return;
|
||||
|
||||
//We should not swich a application theme which use internal style.
|
||||
|
@ -58,7 +60,6 @@ ProxyStylePlugin::ProxyStylePlugin()
|
|||
return;
|
||||
|
||||
auto styleName = settings->get("styleName").toString();
|
||||
auto themeName = settings->get("widget-theme-name").toString();
|
||||
|
||||
if (styleName == "ukui-default" || styleName == "ukui-dark" || styleName == "ukui-white"
|
||||
|| styleName == "ukui-black" || styleName == "ukui-light" || styleName == "ukui") {
|
||||
|
@ -71,15 +72,17 @@ ProxyStylePlugin::ProxyStylePlugin()
|
|||
styleName = "ukui-light";
|
||||
|
||||
|
||||
if (themeName == "default" || themeName == "classical" || themeName == "fashion") {
|
||||
qApp->setProperty("widgetThemeName", themeName);
|
||||
} else {
|
||||
qApp->setProperty("widgetThemeName", "default");
|
||||
if (qApp->property("customStyleName").isValid()) {
|
||||
if (qApp->property("customStyleName").toString() == "ukui-light") {
|
||||
styleName = "ukui-light";
|
||||
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
|
||||
styleName = "ukui-dark";
|
||||
}
|
||||
}
|
||||
// tableModeChanged(false);
|
||||
qApp->setStyle(new ProxyStyle(styleName));
|
||||
return;
|
||||
|
||||
if(qAppName() != blackStyleChangeApp)
|
||||
qApp->setStyle(new ProxyStyle(styleName));
|
||||
return;
|
||||
}
|
||||
|
||||
//other style
|
||||
|
@ -111,12 +114,6 @@ ProxyStylePlugin::ProxyStylePlugin()
|
|||
QDBusConnection::sessionBus());
|
||||
if(interFace->isValid()){
|
||||
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(tableModeChanged(bool)));
|
||||
// {
|
||||
// auto settings = UKUIStyleSettings::globalInstance();
|
||||
// auto styleName = settings->get("styleName").toString();
|
||||
// qApp->setStyle(new ProxyStyle(styleName));
|
||||
// return;
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,36 +123,36 @@ QStyle *ProxyStylePlugin::create(const QString &key)
|
|||
return new QProxyStyle("fusion");
|
||||
if (key == "ukui") {
|
||||
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
m_current_style_name = UKUIStyleSettings::globalInstance()->get("styleName").toString();
|
||||
m_current_theme_name = UKUIStyleSettings::globalInstance()->get("widgetThemeName").toString();
|
||||
auto styleName = UKUIStyleSettings::globalInstance()->get("styleName").toString();
|
||||
|
||||
if (m_current_style_name == "ukui-default" || m_current_style_name == "ukui-dark"
|
||||
|| m_current_style_name == "ukui-white" || m_current_style_name == "ukui-black"
|
||||
|| m_current_style_name == "ukui-light" || m_current_style_name == "ukui") {
|
||||
if (styleName == "ukui-default" || styleName == "ukui-dark"
|
||||
|| styleName == "ukui-white" || styleName == "ukui-black"
|
||||
|| styleName == "ukui-light" || styleName == "ukui") {
|
||||
|
||||
if (m_current_style_name == "ukui")
|
||||
m_current_style_name = "ukui-default";
|
||||
else if (m_current_style_name == "ukui-black")
|
||||
m_current_style_name = "ukui-dark";
|
||||
else if (m_current_style_name == "ukui-white")
|
||||
m_current_style_name = "ukui-light";
|
||||
if (styleName == "ukui")
|
||||
styleName = "ukui-default";
|
||||
else if (styleName == "ukui-black")
|
||||
styleName = "ukui-dark";
|
||||
else if (styleName == "ukui-white")
|
||||
styleName = "ukui-light";
|
||||
|
||||
if (m_current_theme_name == "default" ||
|
||||
m_current_theme_name == "classical" ||
|
||||
m_current_theme_name == "fashion") {
|
||||
qApp->setProperty("widgetThemeName", m_current_theme_name);
|
||||
} else {
|
||||
qApp->setProperty("widgetThemeName", "default");
|
||||
if (qApp->property("customStyleName").isValid()) {
|
||||
if (qApp->property("customStyleName").toString() == "ukui-light") {
|
||||
styleName = "ukui-light";
|
||||
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
|
||||
styleName = "ukui-dark";
|
||||
}
|
||||
}
|
||||
|
||||
return new ProxyStyle(m_current_style_name);
|
||||
return new ProxyStyle(styleName);
|
||||
}
|
||||
|
||||
for (auto styleName : QStyleFactory::keys()) {
|
||||
if (styleName.toLower() == m_current_style_name.toLower())
|
||||
return new QProxyStyle(m_current_style_name);
|
||||
if (styleName.toLower() == styleName.toLower())
|
||||
return new QProxyStyle(styleName);
|
||||
}
|
||||
}
|
||||
|
||||
return new QProxyStyle("fusion");
|
||||
}
|
||||
return new QProxyStyle("fusion");
|
||||
|
@ -183,11 +180,40 @@ void ProxyStylePlugin::onSystemPaletteChanged()
|
|||
|
||||
void ProxyStylePlugin::tableModeChanged(bool isTableMode)
|
||||
{
|
||||
if (blackList().contains(qAppName()))
|
||||
return;
|
||||
|
||||
//We should not swich a application theme which use internal style.
|
||||
if (QApplication::style()->inherits("InternalStyle"))
|
||||
return;
|
||||
|
||||
auto appStyleSettings = ApplicationStyleSettings::getInstance();
|
||||
if (appStyleSettings->currentStyleStretagy() != ApplicationStyleSettings::Default)
|
||||
return;
|
||||
|
||||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
auto styleName = settings->get("styleName").toString();
|
||||
qApp->setProperty("isInitial", false);
|
||||
qApp->setStyle(new ProxyStyle(styleName));
|
||||
/*
|
||||
|
||||
if (styleName == "ukui-default" || styleName == "ukui-dark" || styleName == "ukui-white"
|
||||
|| styleName == "ukui-black" || styleName == "ukui-light" || styleName == "ukui")
|
||||
|
||||
{
|
||||
if (qApp->property("customStyleName").isValid()) {
|
||||
if (qApp->property("customStyleName").toString() == "ukui-light") {
|
||||
styleName = "ukui-light";
|
||||
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
|
||||
styleName = "ukui-dark";
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QWidget *widget, qApp->allWidgets()) {
|
||||
widget->updateGeometry();
|
||||
}
|
||||
qApp->setProperty("isInitial", false);
|
||||
if(qAppName() != blackStyleChangeApp)
|
||||
qApp->setStyle(new ProxyStyle(styleName));
|
||||
}
|
||||
/*
|
||||
foreach (QObject *obj, qApp->children()) {
|
||||
if(qobject_cast<const QVBoxLayout*>(obj))//obj->inherits("QVBoxLayout"))
|
||||
{
|
||||
|
|
|
@ -47,8 +47,7 @@ public slots:
|
|||
void tableModeChanged(bool isTableMode);
|
||||
|
||||
private:
|
||||
QString m_current_style_name;
|
||||
QString m_current_theme_name;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -58,53 +58,10 @@ KAbstractStyleParameters::KAbstractStyleParameters(QObject *parent, bool isDark)
|
|||
m_isTableMode = ret.arguments()[0].value<bool>();
|
||||
}
|
||||
|
||||
updateParameters(m_isTableMode);
|
||||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
auto styleName = settings->get("styleName").toString();
|
||||
if(m_isTableMode){//styleName == "ukui-dark"){//
|
||||
m_scaleRatio4_3 = (4 * 1.0) / 3.0;
|
||||
m_scaleRatio3_2 = (3 * 1.0) / 2.0;
|
||||
m_scaleRatio2_1 = (2 * 1.0) / 1.0;
|
||||
m_scaleSliderDefaultLength = (241 * 1.0) / (94 * 1.0);
|
||||
m_ScaleComboBoxDefaultLength = (49 * 1.0) / (40 * 1.0);
|
||||
m_ScaleLineEditDefaultLength = (49 * 1.0) / (40 * 1.0);
|
||||
m_scaleTabBarHeight6_5 = (6 *1.0) / (5 * 1.0);
|
||||
|
||||
m_isTableMode = true;
|
||||
m_spinBoxControlLayout = SpinBoxControlLayout::Horizontal;
|
||||
m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical4_3;
|
||||
}
|
||||
else{
|
||||
m_scaleRatio4_3 = 1.0;
|
||||
m_scaleRatio3_2 = 1.0;
|
||||
m_scaleRatio2_1 = 1.0;
|
||||
m_scaleSliderDefaultLength = 1.0;
|
||||
m_ScaleComboBoxDefaultLength = 1.0;
|
||||
m_ScaleLineEditDefaultLength = 1.0;
|
||||
m_scaleTabBarHeight6_5 = 1.0;
|
||||
|
||||
m_isTableMode = false;
|
||||
m_spinBoxControlLayout = SpinBoxControlLayout::Vertical;
|
||||
m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical1_1;
|
||||
}
|
||||
|
||||
ComboBox_DefaultMenuItemHeight = ComboBox_DefaultMenuItemHeight * m_scaleRatio4_3;
|
||||
MenuItem_DefaultHeight = MenuItem_DefaultHeight * m_scaleRatio4_3;
|
||||
MenuItemSeparator_MarginHeight = MenuItemSeparator_MarginHeight * m_scaleRatio4_3;
|
||||
LineEdit_DefaultHeight = LineEdit_DefaultHeight * m_scaleRatio4_3;
|
||||
IconButton_DefaultWidth = IconButton_DefaultWidth * m_scaleRatio4_3;
|
||||
Button_DefaultHeight = Button_DefaultHeight * m_scaleRatio4_3;
|
||||
SpinBox_DefaultHeight = SpinBox_DefaultHeight * m_scaleRatio4_3;
|
||||
ComboBox_DefaultHeight = ComboBox_DefaultHeight * m_scaleRatio4_3;
|
||||
RadioButton_DefaultHeight = RadioButton_DefaultHeight * m_scaleRatio4_3;
|
||||
CheckBox_DefaultHeight = CheckBox_DefaultHeight * m_scaleRatio4_3;
|
||||
Table_HeaderHeight = Table_HeaderHeight * m_scaleRatio4_3;
|
||||
ScroolBar_Width = ScroolBar_Width * m_scaleRatio3_2;
|
||||
Slider_Length = Slider_Length * m_scaleRatio2_1;
|
||||
Slider_GrooveLength = Slider_GrooveLength * m_scaleRatio2_1;
|
||||
Slider_DefaultLength = Slider_DefaultLength * m_scaleSliderDefaultLength;
|
||||
LineEdit_DefaultWidth = LineEdit_DefaultWidth * m_ScaleLineEditDefaultLength;
|
||||
TabBar_DefaultHeight = TabBar_DefaultHeight * m_scaleTabBarHeight6_5;
|
||||
ViewItem_DefaultHeight = ViewItem_DefaultHeight * m_scaleRatio4_3;
|
||||
}
|
||||
|
||||
QPalette KAbstractStyleParameters::setPalette(QPalette &palette)
|
||||
|
@ -203,6 +160,57 @@ int KAbstractStyleParameters::getSpinBoxControlLayout()
|
|||
return m_spinBoxControlLayout;
|
||||
}
|
||||
|
||||
void KAbstractStyleParameters::updateParameters(bool isTabletMode)
|
||||
{
|
||||
if(isTabletMode){//styleName == "ukui-dark"){//
|
||||
m_scaleRatio4_3 = (4 * 1.0) / 3.0;
|
||||
m_scaleRatio3_2 = (3 * 1.0) / 2.0;
|
||||
m_scaleRatio2_1 = (2 * 1.0) / 1.0;
|
||||
m_scaleSliderDefaultLength = (241 * 1.0) / (94 * 1.0);
|
||||
m_ScaleComboBoxDefaultLength = (49 * 1.0) / (40 * 1.0);
|
||||
m_ScaleLineEditDefaultLength = (49 * 1.0) / (40 * 1.0);
|
||||
m_scaleTabBarHeight6_5 = (6 *1.0) / (5 * 1.0);
|
||||
|
||||
m_isTableMode = true;
|
||||
m_spinBoxControlLayout = SpinBoxControlLayout::Horizontal;
|
||||
m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical4_3;
|
||||
}
|
||||
else{
|
||||
m_scaleRatio4_3 = 1.0;
|
||||
m_scaleRatio3_2 = 1.0;
|
||||
m_scaleRatio2_1 = 1.0;
|
||||
m_scaleSliderDefaultLength = 1.0;
|
||||
m_ScaleComboBoxDefaultLength = 1.0;
|
||||
m_ScaleLineEditDefaultLength = 1.0;
|
||||
m_scaleTabBarHeight6_5 = 1.0;
|
||||
|
||||
m_isTableMode = false;
|
||||
m_spinBoxControlLayout = SpinBoxControlLayout::Vertical;
|
||||
m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical1_1;
|
||||
}
|
||||
|
||||
ComboBox_DefaultMenuItemHeight = ComboBox_DefaultMenuItemHeight_original * m_scaleRatio4_3;
|
||||
MenuItem_DefaultHeight = MenuItem_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
MenuItemSeparator_MarginHeight = MenuItemSeparator_MarginHeight_origin * m_scaleRatio4_3;
|
||||
LineEdit_DefaultHeight = LineEdit_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
IconButton_DefaultWidth = IconButton_DefaultWidth_origin * m_scaleRatio4_3;
|
||||
Button_DefaultHeight = Button_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
SpinBox_DefaultHeight = SpinBox_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
ComboBox_DefaultHeight = ComboBox_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
RadioButton_DefaultHeight = RadioButton_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
CheckBox_DefaultHeight = CheckBox_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
Table_HeaderHeight = Table_HeaderHeight_origin * m_scaleRatio4_3;
|
||||
ScroolBar_Width = ScroolBar_Width_origin * m_scaleRatio3_2;
|
||||
Slider_Length = Slider_Length_origin * m_scaleRatio2_1;
|
||||
Slider_GrooveLength = Slider_GrooveLength_origin * m_scaleRatio2_1;
|
||||
Slider_DefaultLength = Slider_DefaultLength_origin * m_scaleSliderDefaultLength;
|
||||
LineEdit_DefaultWidth = LineEdit_DefaultWidth_origin * m_ScaleLineEditDefaultLength;
|
||||
TabBar_DefaultHeight = TabBar_DefaultHeight_origin * m_scaleTabBarHeight6_5;
|
||||
ViewItem_DefaultHeight = ViewItem_DefaultHeight_origin * m_scaleRatio4_3;
|
||||
ToolTip_Height = ToolTip_Height_origin * m_scaleRatio4_3;
|
||||
qDebug() << "updateParameters......... ";
|
||||
}
|
||||
|
||||
//Default widget theme
|
||||
KDefaultStyleParameters::KDefaultStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark)
|
||||
{
|
||||
|
@ -292,9 +300,9 @@ void KDefaultStyleParameters::initPalette(bool isDark)
|
|||
button_at.setRgb(55, 55, 59);
|
||||
button_iat.setRgb(55, 55, 59);
|
||||
button_dis.setRgb(46, 46, 46);
|
||||
light_at.setRgb(255, 255, 255),
|
||||
light_iat.setRgb(255, 255, 255),
|
||||
light_dis.setRgb(242, 242, 242),
|
||||
light_at.setRgb(255, 255, 255);
|
||||
light_iat.setRgb(255, 255, 255);
|
||||
light_dis.setRgb(242, 242, 242);
|
||||
midlight_at.setRgb(95, 95, 98);
|
||||
midlight_iat.setRgb(95, 95, 98);
|
||||
midlight_dis.setRgb(79, 79, 82);
|
||||
|
@ -319,9 +327,9 @@ void KDefaultStyleParameters::initPalette(bool isDark)
|
|||
window_at.setRgb(35, 36, 38);
|
||||
window_iat.setRgb(26, 26, 26);
|
||||
window_dis.setRgb(18, 18, 18);
|
||||
shadow_at.setRgb(0, 0, 0, 255 * 0.16),
|
||||
shadow_iat.setRgb(0, 0, 0, 255 * 0.16),
|
||||
shadow_dis.setRgb(0, 0, 0, 255 * 0.21),
|
||||
shadow_at.setRgb(0, 0, 0, 255 * 0.16);
|
||||
shadow_iat.setRgb(0, 0, 0, 255 * 0.16);
|
||||
shadow_dis.setRgb(0, 0, 0, 255 * 0.21);
|
||||
// shadow_at.setRgb(214, 214, 214);
|
||||
// shadow_iat.setRgb(214, 214, 214);
|
||||
// shadow_dis.setRgb(201, 201, 201);
|
||||
|
@ -482,7 +490,7 @@ void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
|
||||
focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (qobject_cast<const QPushButton *>(widget)) {
|
||||
if (widget) {
|
||||
bool isWindowButton = false;
|
||||
bool isWindowColoseButton = false;
|
||||
bool isImportant = false;
|
||||
|
@ -534,19 +542,8 @@ void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
clickBrush = QBrush(mix);
|
||||
}
|
||||
} else if (useButtonPalette || isWindowButton) {
|
||||
if(needTranslucent)
|
||||
if (needTranslucent)
|
||||
{
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::BrightText);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::BrightText);
|
||||
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.1);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
|
||||
QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
hoverColor.setAlphaF(isDark ? 0.20 : 0.16);
|
||||
hoverBrush.setColor(hoverColor);
|
||||
|
@ -569,6 +566,15 @@ void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
}
|
||||
}
|
||||
|
||||
if (needTranslucent) {
|
||||
QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
defaultColor.setAlphaF(0.1);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = option->palette.color(QPalette::Disabled, QPalette::BrightText);
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
}
|
||||
|
||||
if (isImportant) {
|
||||
defaultBrush = highlight;
|
||||
|
@ -622,7 +628,7 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
|
||||
focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (qobject_cast<const QToolButton *>(widget)) {
|
||||
if (widget) {
|
||||
bool isWindowButton = false;
|
||||
bool isWindowColoseButton = false;
|
||||
bool useButtonPalette = false;
|
||||
|
@ -672,17 +678,6 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
} else if (useButtonPalette || isWindowButton) {
|
||||
if(needTranslucent)
|
||||
{
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::BrightText);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::BrightText);
|
||||
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.1);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
|
||||
QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
hoverColor.setAlphaF(isDark ? 0.20 : 0.16);
|
||||
hoverBrush.setColor(hoverColor);
|
||||
|
@ -704,6 +699,16 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needTranslucent) {
|
||||
QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
defaultColor.setAlphaF(0.1);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = option->palette.color(QPalette::Disabled, QPalette::BrightText);
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
}
|
||||
}
|
||||
|
||||
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
|
||||
|
@ -733,7 +738,7 @@ void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -996,7 +1001,7 @@ void KDefaultStyleParameters::initListParameters(bool isDark, const QStyleOption
|
|||
QPen textHoverPen = QPen(Qt::NoPen);
|
||||
QPen textSelectPen = QPen(Qt::NoPen);
|
||||
bool needTranslucent = false;
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -1139,7 +1144,7 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
QBrush onClickBrush;
|
||||
|
||||
bool needTranslucent = false;
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -1147,10 +1152,11 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
|
||||
//default
|
||||
if (isDark) {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
col.setAlphaF(0.15);
|
||||
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText),
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200));
|
||||
|
@ -1202,7 +1208,7 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
|
||||
//disable
|
||||
disablePen = defaultPen;
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
|
||||
|
||||
//on default
|
||||
onDefaultPen = QPen(Qt::NoPen);
|
||||
|
@ -1286,10 +1292,11 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
|
|||
|
||||
//default
|
||||
if (isDark) {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
col.setAlphaF(0.15);
|
||||
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText),
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200));
|
||||
|
@ -1312,7 +1319,7 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
|
|||
|
||||
//disable
|
||||
disablePen = defaultPen;
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
|
||||
|
||||
//on default
|
||||
onDefaultPen = QPen(Qt::NoPen);
|
||||
|
@ -1421,7 +1428,7 @@ void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -1446,10 +1453,14 @@ void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
|
|||
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
|
||||
|
||||
//groove value default
|
||||
grooveValueDefaultBrush = QBrush(highlight);
|
||||
if (isDark) {
|
||||
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05));
|
||||
} else {
|
||||
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2));
|
||||
}
|
||||
|
||||
//groove value hover
|
||||
grooveValueHoverBrush = QBrush(highlight);
|
||||
grooveValueHoverBrush = grooveValueDefaultBrush;
|
||||
|
||||
//groove value disable
|
||||
grooveValueDisableBrush = handleDisableBrush;
|
||||
|
@ -1492,7 +1503,7 @@ void KDefaultStyleParameters::initProgressBarParameters(bool isDark, const QStyl
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -1559,7 +1570,7 @@ void KDefaultStyleParameters::initScrollBarParameters(bool isDark, const QStyleO
|
|||
QBrush sliderDisableBrush;
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -2133,9 +2144,9 @@ void KFashionStyleParameters::initPalette(bool isDark)
|
|||
button_at.setRgb(55, 55, 59);
|
||||
button_iat.setRgb(55, 55, 59);
|
||||
button_dis.setRgb(46, 46, 46);
|
||||
light_at.setRgb(255, 255, 255),
|
||||
light_iat.setRgb(255, 255, 255),
|
||||
light_dis.setRgb(242, 242, 242),
|
||||
light_at.setRgb(255, 255, 255);
|
||||
light_iat.setRgb(255, 255, 255);
|
||||
light_dis.setRgb(242, 242, 242);
|
||||
midlight_at.setRgb(95, 95, 98);
|
||||
midlight_iat.setRgb(95, 95, 98);
|
||||
midlight_dis.setRgb(79, 79, 82);
|
||||
|
@ -2160,9 +2171,9 @@ void KFashionStyleParameters::initPalette(bool isDark)
|
|||
window_at.setRgb(35, 36, 38);
|
||||
window_iat.setRgb(26, 26, 26);
|
||||
window_dis.setRgb(18, 18, 18);
|
||||
shadow_at.setRgb(0, 0, 0, 255 * 0.16),
|
||||
shadow_iat.setRgb(0, 0, 0, 255 * 0.16),
|
||||
shadow_dis.setRgb(0, 0, 0, 255 * 0.21),
|
||||
shadow_at.setRgb(0, 0, 0, 255 * 0.16);
|
||||
shadow_iat.setRgb(0, 0, 0, 255 * 0.16);
|
||||
shadow_dis.setRgb(0, 0, 0, 255 * 0.21);
|
||||
// shadow_at.setRgb(214, 214, 214);
|
||||
// shadow_iat.setRgb(214, 214, 214);
|
||||
// shadow_dis.setRgb(201, 201, 201);
|
||||
|
@ -2331,7 +2342,7 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
|
||||
focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (qobject_cast<const QPushButton *>(widget)) {
|
||||
if (widget) {
|
||||
bool isWindowButton = false;
|
||||
bool isWindowColoseButton = false;
|
||||
bool isImportant = false;
|
||||
|
@ -2394,21 +2405,6 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
} else if (useButtonPalette || isWindowButton) {
|
||||
if(needTranslucent)
|
||||
{
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
|
||||
if(isDark){
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
}
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.15);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
|
||||
if (isDark) {
|
||||
startColor = option->palette.color(QPalette::Active, QPalette::Light);
|
||||
endColor = option->palette.color(QPalette::Active, QPalette::Text);
|
||||
|
@ -2450,6 +2446,23 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
|
|||
}
|
||||
}
|
||||
|
||||
if (needTranslucent) {
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
|
||||
if(isDark){
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
}
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.15);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
}
|
||||
|
||||
if (isImportant) {
|
||||
defaultBrush = highlight;
|
||||
}
|
||||
|
@ -2515,7 +2528,7 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
|
||||
focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (qobject_cast<const QToolButton *>(widget)) {
|
||||
if (widget) {
|
||||
bool isWindowButton = false;
|
||||
bool isWindowColoseButton = false;
|
||||
bool useButtonPalette = false;
|
||||
|
@ -2574,21 +2587,6 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
} else if (useButtonPalette || isWindowButton) {
|
||||
if(needTranslucent)
|
||||
{
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
|
||||
if(isDark){
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
}
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.15);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
|
||||
if (isDark) {
|
||||
startColor = option->palette.color(QPalette::Active, QPalette::Light);
|
||||
endColor = option->palette.color(QPalette::Active, QPalette::Text);
|
||||
|
@ -2609,8 +2607,7 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
clickColor = option->palette.color(QPalette::Active, QPalette::Light);
|
||||
clickColor.setAlphaF(isDark ? 0.30 : 0.30);
|
||||
clickBrush.setColor(clickColor);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
QColor button = option->palette.color(QPalette::Active, QPalette::Button);
|
||||
|
||||
//hover
|
||||
|
@ -2629,6 +2626,23 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
|
|||
clickBrush = QBrush(mixColor(button, mix, 0.2));
|
||||
}
|
||||
}
|
||||
|
||||
if (needTranslucent) {
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid);
|
||||
|
||||
if(isDark){
|
||||
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
disableBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
}
|
||||
QColor defaultColor = defaultBrush.color();
|
||||
defaultColor.setAlphaF(0.15);
|
||||
defaultBrush.setColor(defaultColor);
|
||||
|
||||
QColor disableColor = disableBrush.color();
|
||||
disableColor.setAlphaF(0.1);
|
||||
disableBrush.setColor(disableColor);
|
||||
}
|
||||
}
|
||||
|
||||
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
|
||||
|
@ -2658,7 +2672,7 @@ void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -2740,9 +2754,11 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
|
|||
QBrush upHoverBrush;
|
||||
QBrush upFocusHoverBrush;
|
||||
QBrush upClickBrush;
|
||||
QBrush upDefaultBrush;
|
||||
QBrush downHoverBrush;
|
||||
QBrush downFocusHoverBrush;
|
||||
QBrush downClickBrush;
|
||||
QBrush downDefaultBrush;
|
||||
|
||||
//default state
|
||||
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
|
||||
|
@ -2752,6 +2768,8 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
|
|||
//hover state
|
||||
hoverBrush = defaultBrush;
|
||||
hoverPen = defaultPen;
|
||||
if(isHorizonLayout)
|
||||
hoverPen.setWidth(2);
|
||||
|
||||
//focus state
|
||||
focusBrush = option->palette.brush(QPalette::Active, QPalette::Base);
|
||||
|
@ -2763,6 +2781,16 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
|
|||
disablePen = QPen(Qt::NoPen);
|
||||
disablePen.setWidth(0);
|
||||
|
||||
if(isHorizonLayout)
|
||||
{
|
||||
upDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
|
||||
downDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
|
||||
}
|
||||
else
|
||||
{
|
||||
upDefaultBrush = QBrush(Qt::NoBrush);
|
||||
downDefaultBrush = QBrush(Qt::NoBrush);
|
||||
}
|
||||
|
||||
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
|
||||
QColor button = option->palette.color(QPalette::Active, QPalette::Button);
|
||||
|
@ -2843,12 +2871,14 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
|
|||
spinBoxParameters.spinBoxFocusPen = focusPen;
|
||||
spinBoxParameters.spinBoxDisablePen = disablePen;
|
||||
|
||||
spinBoxParameters.spinBoxUpDefaultBrush = upDefaultBrush;
|
||||
spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush;
|
||||
spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush;
|
||||
spinBoxParameters.spinBoxUpClickBrush = upClickBrush;
|
||||
spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush;
|
||||
spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush;
|
||||
spinBoxParameters.spinBoxDownClickBrush = downClickBrush;
|
||||
spinBoxParameters.spinBoxDownDefaultBrush = downDefaultBrush;
|
||||
}
|
||||
|
||||
void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
|
||||
|
@ -2928,7 +2958,7 @@ void KFashionStyleParameters::initListParameters(bool isDark, const QStyleOption
|
|||
QPen textHoverPen = QPen(Qt::NoPen);
|
||||
QPen textSelectPen = QPen(Qt::NoPen);
|
||||
bool needTranslucent = false;
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -3128,7 +3158,7 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
QBrush onClickBrush;
|
||||
|
||||
bool needTranslucent = false;
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -3136,8 +3166,9 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
|
||||
//default
|
||||
if (isDark) {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
col.setAlphaF(0.15);
|
||||
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
@ -3202,7 +3233,7 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
|
|||
|
||||
//disable
|
||||
disablePen = defaultPen;
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
|
||||
|
||||
//on default
|
||||
onDefaultPen = QPen(Qt::NoPen);
|
||||
|
@ -3292,8 +3323,9 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
|
|||
|
||||
//default
|
||||
if (isDark) {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
col.setAlphaF(0.15);
|
||||
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
|
||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
@ -3318,7 +3350,7 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
|
|||
|
||||
//disable
|
||||
disablePen = defaultPen;
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
|
||||
|
||||
//on default
|
||||
onDefaultPen = QPen(Qt::NoPen);
|
||||
|
@ -3424,7 +3456,7 @@ void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -3466,10 +3498,14 @@ void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
|
|||
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
|
||||
|
||||
//groove value default
|
||||
grooveValueDefaultBrush = QBrush(highlight);
|
||||
if (isDark) {
|
||||
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05));
|
||||
} else {
|
||||
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2));
|
||||
}
|
||||
|
||||
//groove value hover
|
||||
grooveValueHoverBrush = QBrush(highlight);
|
||||
grooveValueHoverBrush = grooveValueDefaultBrush;
|
||||
|
||||
//groove value disable
|
||||
grooveValueDisableBrush = handleDisableBrush;
|
||||
|
@ -3512,7 +3548,7 @@ void KFashionStyleParameters::initProgressBarParameters(bool isDark, const QStyl
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
@ -3580,7 +3616,7 @@ void KFashionStyleParameters::initScrollBarParameters(bool isDark, const QStyleO
|
|||
|
||||
bool needTranslucent = false;
|
||||
|
||||
if (widget->property("needTranslucent").isValid()) {
|
||||
if (widget && widget->property("needTranslucent").isValid()) {
|
||||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
};
|
||||
Q_ENUM(SpinBoxControlLayout)
|
||||
|
||||
void updateParameters(bool isTabletMode);
|
||||
|
||||
// radius
|
||||
int radius = 6;
|
||||
|
||||
|
@ -74,8 +76,10 @@ public:
|
|||
int Button_DefaultIndicatorSize = 0;
|
||||
int Button_DefaultWidth = 96;
|
||||
int Button_DefaultHeight = 36;
|
||||
int Button_DefaultHeight_origin = 36;
|
||||
int ToolButton_DefaultWidth = 60;
|
||||
int IconButton_DefaultWidth = 36;
|
||||
int IconButton_DefaultWidth_origin = 36;
|
||||
QColor ColoseButtonColor = QColor(243, 34, 45);
|
||||
|
||||
// menu
|
||||
|
@ -88,12 +92,15 @@ public:
|
|||
int MenuItem_MarginHeight = 2;
|
||||
int MenuItem_MarginWidth = 12 + 4;
|
||||
int MenuItemSeparator_MarginHeight = 4;
|
||||
int MenuItemSeparator_MarginHeight_origin = 4;
|
||||
int MenuItemSeparator_MarginWidth = 4;
|
||||
int MenuItem_DefaultHeight = 36;
|
||||
int MenuItem_DefaultHeight_origin = 36;
|
||||
int MenuItem_DefaultWidght = 152;
|
||||
|
||||
// scrollbar
|
||||
int ScroolBar_Width = 16;
|
||||
int ScroolBar_Width_origin = 16;
|
||||
int ScroolBar_Height = 68;
|
||||
|
||||
// progressbar
|
||||
|
@ -102,51 +109,66 @@ public:
|
|||
|
||||
// slider
|
||||
int Slider_DefaultLength = 94;
|
||||
int Slider_DefaultLength_origin = 94;
|
||||
int Slider_Length = 20;
|
||||
int Slider_Length_origin = 20;
|
||||
int Slider_GrooveLength = 4;
|
||||
int Slider_GrooveLength_origin = 4;
|
||||
|
||||
// radiobutton
|
||||
int ExclusiveIndicator_Width = 16;
|
||||
int ExclusiveIndicator_Height = 16;
|
||||
int RadioButtonLabel_Spacing = 8;
|
||||
int RadioButton_DefaultHeight = 36;
|
||||
int RadioButton_DefaultHeight_origin = 36;
|
||||
|
||||
// checkbox
|
||||
int Indicator_Width = 16;
|
||||
int Indicator_Height = 16;
|
||||
int CheckBox_DefaultHeight = 36;
|
||||
int CheckBox_DefaultHeight_origin = 36;
|
||||
int CheckBox_Radius = 4;
|
||||
|
||||
// lineedit
|
||||
int LineEdit_DefaultWidth = 160;
|
||||
int LineEdit_DefaultWidth_origin = 160;
|
||||
int LineEdit_DefaultHeight = 36;
|
||||
int LineEdit_DefaultHeight_origin = 36;
|
||||
|
||||
// combobox
|
||||
int ComboBox_DefaultWidth = 160;
|
||||
int ComboBox_DefaultHeight = 36;
|
||||
int ComboBox_DefaultHeight_origin = 36;
|
||||
int ComboBox_DefaultMenuItemHeight = 36;
|
||||
int ComboBox_DefaultMenuItemHeight_original = 36;
|
||||
int ComboBox_FrameWidth = 2;
|
||||
|
||||
// spinbox
|
||||
int SpinBox_DefaultWidth = 160;
|
||||
int SpinBox_DefaultHeight = 36;
|
||||
int SpinBox_DefaultHeight_origin = 36;
|
||||
int SpinBox_FrameWidth = 2;
|
||||
|
||||
// tabbar
|
||||
int TabBar_DefaultMinWidth = 168;
|
||||
int TabBar_DefaultMaxWidth = 248;
|
||||
int TabBar_DefaultHeight = 40;
|
||||
int TabBar_DefaultHeight_origin = 40;
|
||||
int TabBar_ScrollButtonWidth = 16;
|
||||
int TabBar_ScrollButtonOverlap = 2;
|
||||
|
||||
// tooltip
|
||||
int ToolTip_DefaultMargin = 8;
|
||||
int ToolTip_Height = 36;
|
||||
int ToolTip_Height_origin = 36;
|
||||
|
||||
//viewItem
|
||||
//viewitem FIX:Separate to list,tree and table after
|
||||
int ViewItem_DefaultHeight = 36;
|
||||
int ViewItem_DefaultHeight_origin = 36;
|
||||
|
||||
//table
|
||||
int Table_HeaderHeight = 36;
|
||||
int Table_HeaderHeight_origin = 36;
|
||||
|
||||
float m_scaleRatio4_3 = 1.0;
|
||||
float m_scaleRatio3_2 = 1.0;
|
||||
|
@ -183,6 +205,8 @@ public:
|
|||
TabWidgetParameters tabWidgetParameters;
|
||||
MenuParameters menuParameters;
|
||||
|
||||
|
||||
|
||||
QPalette setPalette(QPalette &palette);
|
||||
int getSpinBoxControlLayout();
|
||||
|
||||
|
|
|
@ -74,12 +74,7 @@ QStyle *Qt5UKUIStylePlugin::create(const QString &key)
|
|||
useDefault = true;
|
||||
}
|
||||
|
||||
|
||||
if (qApp->property("widgetThemeName").isValid()) {
|
||||
type = qApp->property("widgetThemeName").toString();
|
||||
}
|
||||
|
||||
return new Qt5UKUIStyle(dark, useDefault, type);
|
||||
return new Qt5UKUIStyle(dark, useDefault);
|
||||
}
|
||||
|
||||
const QStringList Qt5UKUIStylePlugin::blackList()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,7 +59,7 @@ class Qt5UKUIStyle : public Style
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Qt5UKUIStyle(bool dark = false, bool useDefault = true, QString type = "fashion");
|
||||
explicit Qt5UKUIStyle(bool dark = false, bool useDefault = true);
|
||||
|
||||
bool shouldBeTransparent(const QWidget *w) const;
|
||||
|
||||
|
@ -133,7 +133,7 @@ private:
|
|||
|
||||
bool m_drak_palette = false;
|
||||
bool m_default_palette = false;
|
||||
QString m_type = "fashion";
|
||||
QString m_widget_theme = "default";
|
||||
|
||||
bool m_is_tablet_mode = false;
|
||||
QDBusInterface *m_statusManagerDBus = nullptr;
|
||||
|
|
Loading…
Reference in New Issue