同步主线代码
This commit is contained in:
parent
99995ed11b
commit
ce07cbe576
|
@ -21,10 +21,12 @@ find_package(Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED)
|
|||
find_package(Qt5DBus REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(KF5WindowSystem REQUIRED)
|
||||
find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
|
||||
pkg_check_modules(KYSDKWAYLANDHELPER_PKG kysdk-waylandhelper)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0 udisks2)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0 udisks2 x11)
|
||||
pkg_check_modules(QGS REQUIRED gsettings-qt)
|
||||
pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
|
||||
|
||||
FILE(GLOB TS_FILES ${CMAKE_SOURCE_DIR}/translation/*.ts)
|
||||
FILE(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/kylin-device-daemon.qrc
|
||||
|
@ -68,12 +70,15 @@ FILE(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/kylin-device-daemon.qrc
|
|||
${CMAKE_SOURCE_DIR}/src/datacdrom.h
|
||||
${CMAKE_SOURCE_DIR}/src/datacdrom.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/basewidget.h
|
||||
${CMAKE_SOURCE_DIR}/src/basewidget.cpp)
|
||||
${CMAKE_SOURCE_DIR}/src/basewidget.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/config/xatom-helper.h
|
||||
${CMAKE_SOURCE_DIR}/src/config/xatom-helper.cpp)
|
||||
|
||||
QT5_CREATE_TRANSLATION(QM_FILES ${PROJECT_SOURCE_DIR} ${TS_FILES})
|
||||
|
||||
include_directories(${GLIB2_INCLUDE_DIRS})
|
||||
include_directories(${QGS_INCLUDE_DIRS})
|
||||
include_directories(${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
|
||||
|
||||
add_executable(kylin-device-daemon ${QM_FILES} ${SRC_FILES})
|
||||
|
||||
|
@ -91,13 +96,14 @@ target_link_libraries(test-repair-dialog Qt5::Widgets Qt5::DBus ${GLIB2_LIBRARIE
|
|||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
add_definitions(-DQT_MESSAGELOGCONTEXT)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::DBus Qt5::Network ${GLIB2_LIBRARIES} ${QGS_LIBRARIES} KF5::WindowSystem -lukui-log4qt)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::DBus Qt5::Network Qt5::X11Extras ${GLIB2_LIBRARIES} ${QGS_LIBRARIES} KF5::WindowSystem -lukui-log4qt X11 -lkysdk-qtwidgets)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKWAYLANDHELPER_PKG_INCLUDE_DIRS})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKWAYLANDHELPER_PKG_LIBRARY_DIRS} KF5::WindowSystem)
|
||||
target_link_libraries(${PROJECT_NAME} ${KYSDKWAYLANDHELPER_PKG_LIBRARIES})
|
||||
|
||||
install(TARGETS kylin-device-daemon DESTINATION bin)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/data/kylin-device-daemon.lock DESTINATION "/usr/share/ukui/ukui-panel" COMPONENT Runtime)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/data/kylin-device-daemon.ini DESTINATION "/usr/share/kylin-device-daemon/" COMPONENT Runtime)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/data/org.kylin.kylin-device-daemon-pkexec.policy DESTINATION "/usr/share/polkit-1/actions/" COMPONENT Runtime)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/data/kylin-device-daemon-pkexec.sh DESTINATION "/usr/bin/" COMPONENT Runtime PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/data/kylin-device-daemon.desktop DESTINATION "/etc/xdg/autostart/" COMPONENT Runtime)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Name=kylin device daemon
|
||||
Name[zh_CN]=麒麟设备管理后台
|
||||
Name[zh_CN]=U盘管理工具
|
||||
Name[bo_CN]=usb དོ་དམ་ཡོ་བྱད།
|
||||
Comment=kylin device daemon
|
||||
Comment[zh_CN]=麒麟设备管理后台
|
||||
Exec=kylin-device-daemon
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[Gparted]
|
||||
automounted=1
|
||||
|
|
@ -1,3 +1,12 @@
|
|||
kylin-device-daemon (3.20.0.5-ok4) v101; urgency=medium
|
||||
|
||||
* BUG号: 无
|
||||
* 需求号: 无
|
||||
* 其它改动说明:同步主线3.20.0.17-0k0.14版本;
|
||||
* 影响域:无
|
||||
|
||||
-- tiantian <tiantian@kylinos.cn> Mon, 27 Mar 2023 16:20:14 +0800
|
||||
|
||||
kylin-device-daemon (3.20.0.5-0k3) v101; urgency=medium
|
||||
* BUG号: 无
|
||||
* 需求号: 无
|
||||
|
|
|
@ -11,7 +11,8 @@ Build-Depends: cmake,
|
|||
libqt5x11extras5-dev,
|
||||
libudisks2-dev,
|
||||
libukui-log4qt-dev,
|
||||
libkysdk-waylandhelper-dev,
|
||||
libkysdk-qtwidgets-dev,
|
||||
libkysdk-waylandhelper-dev,
|
||||
qtbase5-dev,
|
||||
qtbase5-dev-tools,
|
||||
qttools5-dev
|
||||
|
|
|
@ -30,12 +30,14 @@ typedef enum {downPosition = 0,upPosition,leftPosition,rightPosition}Suit;
|
|||
#define DATADEVICE 1
|
||||
#define OCCUPYDEVICE 2
|
||||
#define GPARTEDINTERFACE 3
|
||||
#define DISTANCEPADDING 6
|
||||
#define DISTANCEPADDING 8
|
||||
#define DISTANCEMEND 2
|
||||
|
||||
#define FLASHDISKITEM_TITLE_HEIGHT 15
|
||||
#define FLASHDISKITEM_CONTENT_HEIGHT 45
|
||||
#define FLASHDISKITEM_HEIGHT 112
|
||||
#define FLASHDISKITEM_SPACE_HEIGHT 7
|
||||
#define FLASHDISKITEM_SHOWDISK_MAX 8
|
||||
|
||||
#define NEWINFO_DELAYSHOW_TIME 1500
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "basewidget.h"
|
||||
#include "config/xatom-helper.h"
|
||||
#include "fdframe.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
|
@ -7,27 +9,53 @@
|
|||
#include <QScreen>
|
||||
#include <QPainterPath>
|
||||
#include <QLabel>
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define THEME_UKFD_TRANS "org.ukui.control-center.personalise"
|
||||
|
||||
baseWidget::baseWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setWindowFlags(Qt::FramelessWindowHint |Qt::X11BypassWindowManagerHint); //Qt::ToolTip设置新窗口是一个提示窗口,没有标题栏和窗口边框,设置后独立与窗口存在
|
||||
initOpacityGSettings();
|
||||
// setWindowFlags(Qt::FramelessWindowHint); //Qt::ToolTip设置新窗口是一个提示窗口,没有标题栏和窗口边框,设置后独立与窗口存在
|
||||
setWindowFlags(Qt::Tool);
|
||||
|
||||
// 注释掉透明度设置,固定背景透明度,完全透明。
|
||||
// initOpacityGSettings();
|
||||
m_curTransOpacity = 0;
|
||||
installEventFilter(this);
|
||||
QLabel *tiplabel = new QLabel(this);
|
||||
tiplabel->move(16,16);
|
||||
tiplabel->setFixedWidth(200);
|
||||
tiplabel->setText(tr("removable storage device"));
|
||||
tiplabel->show();
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setProperty("useSystemStyleBlur", true);
|
||||
|
||||
// 根据新版设计说明取消底框上的文字
|
||||
// QLabel *tiplabel = new QLabel(this);
|
||||
// tiplabel->move(16,16);
|
||||
// tiplabel->setFixedWidth(200);
|
||||
// tiplabel->setText(tr("removable storage device"));
|
||||
// tiplabel->show();
|
||||
|
||||
// this->setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
setProperty("useSystemStyleBlur", true); //毛玻璃效果
|
||||
|
||||
//窗管协议,隐藏上方标题栏
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
mainWindowVboxLayout = new QVBoxLayout();
|
||||
mainWindowVboxLayout->setContentsMargins(16,52,16,16);
|
||||
mainWindowVboxLayout->setSpacing(5);
|
||||
mainWindowVboxLayout->setAlignment(Qt::AlignCenter|Qt::AlignBottom);
|
||||
mainWindowVboxLayout->setContentsMargins(0,0,0,0);
|
||||
mainWindowVboxLayout->setSpacing(7);
|
||||
this->setLayout(mainWindowVboxLayout);
|
||||
this->adjustSize();
|
||||
|
||||
m_hideTimer = new QTimer(this);
|
||||
connect(m_hideTimer, &QTimer::timeout, [=](){this->hide(); m_hideTimer->stop();});
|
||||
}
|
||||
|
||||
baseWidget::~baseWidget()
|
||||
|
@ -66,6 +94,22 @@ void baseWidget::initOpacityGSettings()
|
|||
}
|
||||
}
|
||||
|
||||
void baseWidget::showBaseWindow(){
|
||||
|
||||
//不在任务栏处显示窗口图标
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(!platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive)) {
|
||||
const KWindowInfo info(this->winId(), NET::WMState);
|
||||
if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) {
|
||||
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
}
|
||||
}
|
||||
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
this->show();
|
||||
|
||||
}
|
||||
|
||||
void baseWidget::paintEvent(QPaintEvent * event)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
@ -97,10 +141,6 @@ bool baseWidget::eventFilter(QObject *watched, QEvent *event)
|
|||
|
||||
qDebug()<<"激活外部窗口";
|
||||
this->hide();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::ActivationChange) {
|
||||
qDebug()<<"焦点变更";
|
||||
//this->hide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,10 @@ public:
|
|||
explicit baseWidget(QWidget *parent = nullptr);
|
||||
virtual ~baseWidget();
|
||||
void initOpacityGSettings();
|
||||
void showBaseWindow();
|
||||
|
||||
QVBoxLayout * mainWindowVboxLayout;
|
||||
QTimer *m_hideTimer;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent * event);
|
||||
|
@ -23,7 +25,6 @@ private:
|
|||
// QGSettings
|
||||
QGSettings *m_gsTransOpacity = nullptr;
|
||||
qreal m_curTransOpacity = 1;
|
||||
//QTimer *m_hideTimer;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
*/
|
||||
|
||||
#include "clickLabel.h"
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#define THEME_UKFD_TRANS "org.ukui.control-center.personalise"
|
||||
|
||||
ClickLabel::ClickLabel(QWidget *parent)
|
||||
{
|
||||
initOpacityGSettings();
|
||||
}
|
||||
|
||||
ClickLabel::~ClickLabel()
|
||||
|
@ -28,7 +32,49 @@ ClickLabel::~ClickLabel()
|
|||
void ClickLabel::mousePressEvent(QMouseEvent *event){
|
||||
if (event->button() == Qt::LeftButton)
|
||||
Q_EMIT clicked();
|
||||
QLabel::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void ClickLabel::initOpacityGSettings()
|
||||
{
|
||||
const QByteArray idtrans(THEME_UKFD_TRANS);
|
||||
if(QGSettings::isSchemaInstalled(idtrans)) {
|
||||
m_gsTransOpacity = new QGSettings(idtrans);
|
||||
}
|
||||
|
||||
if (!m_gsTransOpacity) {
|
||||
m_curTransOpacity = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
connect(m_gsTransOpacity, &QGSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "transparency") {
|
||||
QStringList keys = m_gsTransOpacity->keys();
|
||||
if (keys.contains("transparency")) {
|
||||
m_curTransOpacity = m_gsTransOpacity->get("transparency").toString().toDouble();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QStringList keys = m_gsTransOpacity->keys();
|
||||
if(keys.contains("transparency")) {
|
||||
m_curTransOpacity = m_gsTransOpacity->get("transparency").toString().toDouble();
|
||||
}
|
||||
QGraphicsOpacityEffect *opacityEffect=new QGraphicsOpacityEffect;
|
||||
this->setGraphicsEffect(opacityEffect);
|
||||
|
||||
//m_curTransOpacity = 0.5;
|
||||
opacityEffect->setOpacity(m_curTransOpacity);
|
||||
}
|
||||
|
||||
void ClickLabel::setFullOpacity()
|
||||
{
|
||||
QGraphicsOpacityEffect *opacityEffect=new QGraphicsOpacityEffect;
|
||||
this->setGraphicsEffect(opacityEffect);
|
||||
|
||||
m_curTransOpacity = 1;
|
||||
opacityEffect->setOpacity(m_curTransOpacity);
|
||||
|
||||
}
|
||||
|
||||
//void ClickLabel::paintEvent(QPaintEvent *event){
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
#include <QGSettings/QGSettings>
|
||||
|
||||
class ClickLabel : public QLabel
|
||||
{
|
||||
|
@ -29,8 +30,15 @@ class ClickLabel : public QLabel
|
|||
|
||||
public:
|
||||
explicit ClickLabel(QWidget *parent = 0);
|
||||
qreal m_curTransOpacity = 1;
|
||||
void setFullOpacity();
|
||||
~ClickLabel();
|
||||
|
||||
private:
|
||||
QGSettings *m_gsTransOpacity = nullptr;
|
||||
|
||||
void initOpacityGSettings();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
//virtual void paintEvent(QPaintEvent * event);
|
||||
|
|
|
@ -0,0 +1,216 @@
|
|||
/*
|
||||
* KWin Style UKUI
|
||||
*
|
||||
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yue Lan <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "xatom-helper.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <QX11Info>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <NETWM>
|
||||
|
||||
static XAtomHelper *global_instance = nullptr;
|
||||
|
||||
XAtomHelper *XAtomHelper::getInstance()
|
||||
{
|
||||
if (!global_instance)
|
||||
global_instance = new XAtomHelper;
|
||||
return global_instance;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isFrameLessWindow(int winId)
|
||||
{
|
||||
auto hints = getInstance()->getWindowMotifHint(winId);
|
||||
if (hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isWindowDecorateBorderOnly(int winId)
|
||||
{
|
||||
return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId));
|
||||
}
|
||||
|
||||
bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint)
|
||||
{
|
||||
bool isDeco = false;
|
||||
if (hint.flags & MWM_HINTS_DECORATIONS && hint.flags != MWM_HINTS_DECORATIONS) {
|
||||
if (hint.decorations == MWM_DECOR_BORDER)
|
||||
isDeco = true;
|
||||
}
|
||||
return isDeco;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isUKUICsdSupported()
|
||||
{
|
||||
// fixme:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isUKUIDecorationWindow(int winId)
|
||||
{
|
||||
if (m_ukuiDecorationAtion == None)
|
||||
return false;
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
uchar *data;
|
||||
|
||||
bool isUKUIDecoration = false;
|
||||
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_ukuiDecorationAtion,
|
||||
0, LONG_MAX, false,
|
||||
m_ukuiDecorationAtion, &type,
|
||||
&format, &nitems,
|
||||
&bytes_after, &data);
|
||||
|
||||
if (type == m_ukuiDecorationAtion) {
|
||||
if (nitems == 1) {
|
||||
isUKUIDecoration = data[0];
|
||||
}
|
||||
}
|
||||
|
||||
return isUKUIDecoration;
|
||||
}
|
||||
|
||||
UnityCorners XAtomHelper::getWindowBorderRadius(int winId)
|
||||
{
|
||||
UnityCorners corners;
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
uchar *data;
|
||||
|
||||
if (m_unityBorderRadiusAtom != None) {
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom,
|
||||
0, LONG_MAX, false,
|
||||
XA_CARDINAL, &type,
|
||||
&format, &nitems,
|
||||
&bytes_after, &data);
|
||||
|
||||
if (type == XA_CARDINAL) {
|
||||
if (nitems == 4) {
|
||||
corners.topLeft = static_cast<ulong>(data[0]);
|
||||
corners.topRight = static_cast<ulong>(data[1*sizeof (ulong)]);
|
||||
corners.bottomLeft = static_cast<ulong>(data[2*sizeof (ulong)]);
|
||||
corners.bottomRight = static_cast<ulong>(data[3*sizeof (ulong)]);
|
||||
}
|
||||
XFree(data);
|
||||
}
|
||||
}
|
||||
|
||||
return corners;
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data)
|
||||
{
|
||||
if (m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
ulong corners[4] = {data.topLeft, data.topRight, data.bottomLeft, data.bottomRight};
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0]));
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight)
|
||||
{
|
||||
if (m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
ulong corners[4] = {(ulong)topLeft, (ulong)topRight, (ulong)bottomLeft, (ulong)bottomRight};
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0]));
|
||||
}
|
||||
|
||||
void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set)
|
||||
{
|
||||
if (m_ukuiDecorationAtion == None)
|
||||
return;
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1);
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints)
|
||||
{
|
||||
if (m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_motifWMHintsAtom, m_motifWMHintsAtom,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof (MotifWmHints)/ sizeof (ulong));
|
||||
}
|
||||
|
||||
MotifWmHints XAtomHelper::getWindowMotifHint(int winId)
|
||||
{
|
||||
MotifWmHints hints;
|
||||
|
||||
if (m_unityBorderRadiusAtom == None)
|
||||
return hints;
|
||||
|
||||
uchar *data;
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_motifWMHintsAtom,
|
||||
0, sizeof (MotifWmHints)/sizeof (long), false, AnyPropertyType, &type,
|
||||
&format, &nitems, &bytes_after, &data);
|
||||
|
||||
if (type == None) {
|
||||
return hints;
|
||||
} else {
|
||||
hints = *(MotifWmHints *)data;
|
||||
XFree(data);
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
|
||||
XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent)
|
||||
{
|
||||
if (!QX11Info::isPlatformX11())
|
||||
return;
|
||||
|
||||
m_motifWMHintsAtom = XInternAtom(QX11Info::display(), "_MOTIF_WM_HINTS", true);
|
||||
m_unityBorderRadiusAtom = XInternAtom(QX11Info::display(), "_UNITY_GTK_BORDER_RADIUS", false);
|
||||
m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false);
|
||||
}
|
||||
|
||||
Atom XAtomHelper::registerUKUICsdNetWmSupportAtom()
|
||||
{
|
||||
// fixme:
|
||||
return None;
|
||||
}
|
||||
|
||||
void XAtomHelper::unregisterUKUICsdNetWmSupportAtom()
|
||||
{
|
||||
// fixme:
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* KWin Style UKUI
|
||||
*
|
||||
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yue Lan <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef XATOMHELPER_H
|
||||
#define XATOMHELPER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
//#include <X11/Xlib.h>
|
||||
//#include <NETWM>
|
||||
|
||||
struct UnityCorners {
|
||||
ulong topLeft = 0;
|
||||
ulong topRight = 0;
|
||||
ulong bottomLeft = 0;
|
||||
ulong bottomRight = 0;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ulong flags = 0;
|
||||
ulong functions = 0;
|
||||
ulong decorations = 0;
|
||||
long input_mode = 0;
|
||||
ulong status = 0;
|
||||
} MotifWmHints, MwmHints;
|
||||
|
||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||
#define MWM_HINTS_STATUS (1L << 3)
|
||||
|
||||
#define MWM_FUNC_ALL (1L << 0)
|
||||
#define MWM_FUNC_RESIZE (1L << 1)
|
||||
#define MWM_FUNC_MOVE (1L << 2)
|
||||
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||
#define MWM_FUNC_CLOSE (1L << 5)
|
||||
|
||||
#define MWM_DECOR_ALL (1L << 0)
|
||||
#define MWM_DECOR_BORDER (1L << 1)
|
||||
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||
#define MWM_DECOR_TITLE (1L << 3)
|
||||
#define MWM_DECOR_MENU (1L << 4)
|
||||
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||
|
||||
#define MWM_INPUT_MODELESS 0
|
||||
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
|
||||
|
||||
#define MWM_TEAROFF_WINDOW (1L<<0)
|
||||
|
||||
namespace UKUI {
|
||||
class Decoration;
|
||||
}
|
||||
|
||||
class XAtomHelper : public QObject
|
||||
{
|
||||
friend class UKUI::Decoration;
|
||||
Q_OBJECT
|
||||
public:
|
||||
static XAtomHelper *getInstance();
|
||||
|
||||
static bool isFrameLessWindow(int winId);
|
||||
|
||||
bool isWindowDecorateBorderOnly(int winId);
|
||||
bool isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint);
|
||||
bool isUKUICsdSupported();
|
||||
bool isUKUIDecorationWindow(int winId);
|
||||
|
||||
UnityCorners getWindowBorderRadius(int winId);
|
||||
void setWindowBorderRadius(int winId, const UnityCorners &data);
|
||||
void setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight);
|
||||
void setUKUIDecoraiontHint(int winId, bool set = true);
|
||||
|
||||
void setWindowMotifHint(int winId, const MotifWmHints &hints);
|
||||
MotifWmHints getWindowMotifHint(int winId);
|
||||
|
||||
private:
|
||||
explicit XAtomHelper(QObject *parent = nullptr);
|
||||
|
||||
ulong registerUKUICsdNetWmSupportAtom();
|
||||
void unregisterUKUICsdNetWmSupportAtom();
|
||||
|
||||
ulong m_motifWMHintsAtom = 0l;
|
||||
ulong m_unityBorderRadiusAtom = 0l;
|
||||
ulong m_ukuiDecorationAtion = 0l;
|
||||
};
|
||||
|
||||
#endif // XATOMHELPER_H
|
|
@ -450,6 +450,13 @@ int DataCDROM::checkMediumType()
|
|||
}
|
||||
qWarning("CDROM cannot support to read DVD+R medium");
|
||||
break;
|
||||
case 0x002B: // DVD+R DL
|
||||
if (m_u32MediumRSupport & MEDIUM_DVD_PLUS_R_DL) {
|
||||
m_oMediumType = "DVD+R DL";
|
||||
break;
|
||||
}
|
||||
qWarning("CDROM cannot support to read DVD+R DL medium");
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"the type" << profile << "undefined";
|
||||
return -1;
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
#include <QtDBus/QDBusObjectPath>
|
||||
#include <QDBusReply>
|
||||
#include <qgsettings.h>
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
|
||||
#include "MacroFile.h"
|
||||
#include "UnionVariable.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class ejectInterface; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2021 KylinSoft Co., Ltd.
|
||||
*
|
||||
* Authors:
|
||||
|
@ -35,7 +35,8 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
QString driveName,
|
||||
QString volumeName,
|
||||
quint64 capacityDis,
|
||||
QString strMountUri)
|
||||
QString strMountUri,
|
||||
int uVolumeSum)
|
||||
: m_frame(parent),
|
||||
m_uDiskNo(diskNo),
|
||||
m_driveName(driveName),
|
||||
|
@ -85,13 +86,21 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
#else
|
||||
imgIcon = QIcon::fromTheme("media-removable-symbolic");
|
||||
#endif
|
||||
QPixmap pixmap = imgIcon.pixmap(QSize(18, 18));
|
||||
QPixmap pixmap = imgIcon.pixmap(QSize(16, 16));
|
||||
image_show_label->setPixmap(pixmap);
|
||||
image_show_label->setProperty("useIconHighlightEffect", 0x2);
|
||||
image_show_label->setFixedSize(30,30);
|
||||
image_show_label->move(26,27);
|
||||
if(uVolumeSum == 1)
|
||||
image_show_label->move(26,39);
|
||||
else
|
||||
image_show_label->move(26,27);
|
||||
|
||||
|
||||
|
||||
m_driveName_label = new QLabel(this);
|
||||
m_driveName_label->setFont(QFont("Noto Sans CJK SC",fontSize));
|
||||
QFont font = m_driveName_label->font();
|
||||
font.setPointSize(fontSize);
|
||||
m_driveName_label->setFont(font);
|
||||
QString DriveName = getElidedText(m_driveName_label->font(), m_driveName, 180);
|
||||
m_driveName_label->setText(DriveName);
|
||||
if (DriveName != m_driveName) {
|
||||
|
@ -107,26 +116,27 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
//m_eject_button->setFlat(true); //this property set that when the mouse is hovering in the icon the icon will move up a litte
|
||||
m_eject_button->move(m_eject_button->x()+320,m_eject_button->y()+10);
|
||||
m_eject_button->installEventFilter(this);
|
||||
//m_eject_button->setPixmap(QIcon::fromTheme("media-eject-symbolic").pixmap(16,16)); //setIcon(QIcon::fromTheme("media-eject-symbolic"));
|
||||
m_eject_button->setFixedSize(60,100);
|
||||
m_eject_button->setParent(this);
|
||||
m_eject_button->setToolTip(tr("Eject"));
|
||||
m_eject_button->setToolTip(tr("eject"));
|
||||
m_eject_button->show();
|
||||
connect(m_eject_button,SIGNAL(clicked()),SLOT(switchWidgetClicked())); // this signal-slot function is to emit a signal which
|
||||
//is to trigger a slot in mainwindow
|
||||
drivename_H_BoxLayout->setContentsMargins(0,0,0,0);
|
||||
drivename_H_BoxLayout->addSpacing(45);
|
||||
//drivename_H_BoxLayout->addWidget(image_show_label);
|
||||
drivename_H_BoxLayout->addWidget(m_driveName_label);
|
||||
drivename_H_BoxLayout->addWidget(m_driveName_label); //2209 xiu gai hou shebeiming yu tu biao fen li
|
||||
drivename_H_BoxLayout->addStretch();
|
||||
}
|
||||
}
|
||||
|
||||
disWidgetNumOne = new QWidget(this);
|
||||
disWidgetNumOne->setFixedSize(288,23);
|
||||
//disWidgetNumOne->setStyleSheet("border:1px solid red;");//for test
|
||||
m_nameDis1_label = new ClickLabel(disWidgetNumOne);
|
||||
m_nameDis1_label->setFont(QFont("Microsoft YaHei",fontSize-2));
|
||||
QFont font1 = m_nameDis1_label->font();
|
||||
font1.setPointSize(fontSize-2);
|
||||
m_nameDis1_label->setFont(font1);
|
||||
m_nameDis1_label->setFixedSize(288,23);
|
||||
m_nameDis1_label->setFullOpacity();
|
||||
handleVolumeLabelForFat32Me(m_volumeName, m_volumeId);
|
||||
QString VolumeName = getElidedText(m_nameDis1_label->font(), m_volumeName, 120); //超出一定宽度后显示省略号
|
||||
m_nameDis1_label->adjustSize(); //根据内容自动调整控件大小
|
||||
|
@ -137,9 +147,10 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
m_capacityDis1_label = new QLabel();
|
||||
|
||||
QString str_capacityDis1 = size_human(m_capacityDis); //将容量转换为XXGB形式
|
||||
m_capacityDis1_label->setFont(QFont("Microsoft YaHei",fontSize-2));
|
||||
font1 = m_capacityDis1_label->font();
|
||||
font1.setPointSize(fontSize-2);
|
||||
m_capacityDis1_label->setFont(font1);
|
||||
m_capacityDis1_label->setText("("+str_capacityDis1+")");
|
||||
//m_capacityDis1_label->setObjectName("capacityLabel");
|
||||
|
||||
//卷名标签的横向布局
|
||||
QHBoxLayout *onevolume_h_BoxLayout = new QHBoxLayout();
|
||||
|
@ -147,25 +158,33 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
onevolume_h_BoxLayout->addSpacing(50);
|
||||
onevolume_h_BoxLayout->setMargin(0); //使得widget上的label得以居中显示
|
||||
onevolume_h_BoxLayout->addWidget(m_nameDis1_label);
|
||||
//onevolume_h_BoxLayout->addWidget(m_capacityDis1_label);
|
||||
onevolume_h_BoxLayout->addSpacing(20);
|
||||
onevolume_h_BoxLayout->addStretch();
|
||||
|
||||
disWidgetNumOne->setObjectName("OriginObjectOnly");
|
||||
disWidgetNumOne->setStyleSheet("QLabel{color: palette(Mid);}"
|
||||
"QLabel:hover{color:rgba(55,144,250,1);}");
|
||||
disWidgetNumOne->setStyleSheet("QLabel{color: palette(PlaceholderText);}"
|
||||
"QLabel:hover{color: palette(Highlight);}");
|
||||
disWidgetNumOne->setLayout(onevolume_h_BoxLayout);
|
||||
disWidgetNumOne->installEventFilter(this);
|
||||
|
||||
//设置主页面布局
|
||||
main_V_BoxLayout = new QVBoxLayout(this);
|
||||
if(m_uDiskNo <= 1){
|
||||
main_V_BoxLayout->setContentsMargins(15, 0, 6, 20);
|
||||
if (uVolumeSum == 1)
|
||||
main_V_BoxLayout->setContentsMargins(15, 10, 6, 20);
|
||||
else
|
||||
main_V_BoxLayout->setContentsMargins(15, 0, 6, 20);
|
||||
main_V_BoxLayout->setSpacing(0);
|
||||
main_V_BoxLayout->addSpacing(20);
|
||||
main_V_BoxLayout->addLayout(drivename_H_BoxLayout);
|
||||
|
||||
}
|
||||
if (uVolumeSum == 1){
|
||||
main_V_BoxLayout->setContentsMargins(15, 10, 6, 20);
|
||||
}
|
||||
else{
|
||||
main_V_BoxLayout->setContentsMargins(15, 0, 6, 20);
|
||||
}
|
||||
main_V_BoxLayout->setContentsMargins(15, 0, 6, 20);
|
||||
main_V_BoxLayout->addSpacing(0);
|
||||
main_V_BoxLayout->addWidget(disWidgetNumOne);
|
||||
main_V_BoxLayout->addSpacing(0);
|
||||
|
@ -181,7 +200,7 @@ FDClickWidget::FDClickWidget(FDFrame *parent,
|
|||
} else {
|
||||
this->setFixedSize(288,22);
|
||||
}
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true); //设置顶层面板背景透明
|
||||
//this->setAttribute(Qt::WA_TranslucentBackground, true); //设置顶层面板背景透明
|
||||
|
||||
// check capacity lable width
|
||||
m_strCapacityDis = m_capacityDis1_label->text(); //获取qlabel中的字符串
|
||||
|
@ -266,11 +285,37 @@ FDClickWidget::~FDClickWidget()
|
|||
void FDClickWidget::mousePressEvent(QMouseEvent *ev)
|
||||
{
|
||||
mousePos = QPoint(ev->x(), ev->y());
|
||||
this->m_fristClickWidget->m_mousePressFlag = true;
|
||||
this->m_fristClickWidget->disWidgetNumOne->setStyleSheet("QLabel{color: palette(Highlight);}"
|
||||
"QLabel:hover{color: palette(Highlight);}");
|
||||
this->m_fristClickWidget->repaint();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FDClickWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||
{
|
||||
if(mousePos == QPoint(ev->x(), ev->y())) Q_EMIT clicked();
|
||||
|
||||
qDebug()<<"mousePos is x:"<<ev->x()<<"y:"<<ev->y();
|
||||
this->m_fristClickWidget->m_mousePressFlag = false;
|
||||
this->m_fristClickWidget->disWidgetNumOne->setStyleSheet("QLabel{color: palette(PlaceholderText);}"
|
||||
"QLabel:hover{color: palette(Highlight);}");
|
||||
this->m_fristClickWidget->repaint();
|
||||
if(ev->x()<=65)
|
||||
openFirstVolume();
|
||||
else if(ev->x()<=330)
|
||||
on_volume_clicked();
|
||||
}
|
||||
|
||||
void FDClickWidget::openFirstVolume()
|
||||
{
|
||||
if (!this->m_fristClickWidget->m_mountUri.isEmpty()) {
|
||||
qDebug()<<"----uri is "<<this->m_fristClickWidget->m_mountUri;
|
||||
QString aaa = "peony "+this->m_fristClickWidget->m_mountUri;
|
||||
QProcess::startDetached(aaa.toUtf8().data());
|
||||
this->topLevelWidget()->hide();
|
||||
}
|
||||
}
|
||||
|
||||
//click the first area to show the interface
|
||||
|
@ -360,26 +405,6 @@ QPixmap FDClickWidget::drawSymbolicColoredPixmap(const QPixmap &source)
|
|||
}
|
||||
}
|
||||
|
||||
void FDClickWidget::ejectBottonAnim()
|
||||
{
|
||||
m_ejectAnimation = new QPropertyAnimation(m_eject_button,"geometry");
|
||||
m_ejectAnimation->setDuration(500);
|
||||
m_ejectAnimation->setStartValue(QRect(330,3, 50, 64));
|
||||
m_ejectAnimation->setEndValue(QRect(310,3, 50, 64));
|
||||
m_ejectAnimation->start();
|
||||
|
||||
}
|
||||
|
||||
void FDClickWidget::ejectBottonLeaveAnim()
|
||||
{
|
||||
m_ejectAnimation1 = new QPropertyAnimation(m_eject_button,"geometry");
|
||||
m_ejectAnimation1->setDuration(500);
|
||||
m_ejectAnimation1->setStartValue(QRect(310,3, 50, 64));
|
||||
m_ejectAnimation1->setEndValue(QRect(330,3, 50, 64));
|
||||
m_ejectAnimation1->start();
|
||||
|
||||
}
|
||||
|
||||
//to convert the capacity by another type
|
||||
QString FDClickWidget::size_human(qlonglong capacity)
|
||||
{
|
||||
|
@ -437,102 +462,28 @@ QString FDClickWidget::size_human(qlonglong capacity)
|
|||
return str_capacity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//set the style of the eject button and label when the mouse doing some different operations
|
||||
bool FDClickWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if(obj == m_eject_button)
|
||||
{
|
||||
if(event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
if(currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black" || currentThemeMode == "ukui-default")
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(14,14));
|
||||
// m_eject_button->setFixedSize(38,38);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(14,14));
|
||||
// m_eject_button->setFixedSize(38,38);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event->type() == QEvent::Enter)
|
||||
{
|
||||
|
||||
Q_EMIT hoverEjectBotton();
|
||||
//update();
|
||||
ejectBottonAnim();
|
||||
if(currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black" || currentThemeMode == "ukui-default")
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(16,16));
|
||||
// m_eject_button->setFixedSize(40,40);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(16,16));
|
||||
// m_eject_button->setFixedSize(40,40);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event->type() == QEvent::Leave)
|
||||
{
|
||||
qDebug()<<"------leave";
|
||||
|
||||
Q_EMIT leaveEjectBotton();
|
||||
ejectBottonLeaveAnim();
|
||||
if(currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black")
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(16,16));
|
||||
// m_eject_button->setFixedSize(40,40);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_eject_button->setIconSize(QSize(16,16));
|
||||
// m_eject_button->setFixedSize(40,40);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(obj == disWidgetNumOne)
|
||||
{
|
||||
if(event->type() == QEvent::Enter)
|
||||
{
|
||||
if(currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black" || currentThemeMode == "ukui-default"
|
||||
|| currentThemeMode == "ukui")
|
||||
{
|
||||
// disWidgetNumOne->setStyleSheet(
|
||||
// "QWidget#OriginObjectOnly{background:rgba(255,255,255,0.12);"
|
||||
// "border-radius: 6px;}");
|
||||
// disWidgetNumOne->setStyleSheet("QLabel:hover{color:rgba(55,144,250,1);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// disWidgetNumOne->setStyleSheet(
|
||||
// "QWidget#OriginObjectOnly{background:rgba(0,0,0,0.12);"
|
||||
// "border-radius: 6px;}");
|
||||
// disWidgetNumOne->setStyleSheet("QLabel:hover{color:rgba(55,144,250,1);}");
|
||||
}
|
||||
}
|
||||
|
||||
if(event->type() == QEvent::Leave)
|
||||
{
|
||||
qDebug()<<"------------ClickWidget-leave----";
|
||||
// disWidgetNumOne->setStyleSheet("");
|
||||
// m_hideTime->start(2000);
|
||||
}
|
||||
if(event->type() == QEvent::Enter)
|
||||
{
|
||||
qDebug()<<"------------ClickWidget-Enter----";
|
||||
// if (m_hideTime->isActive()) {
|
||||
// m_hideTime->stop();
|
||||
// }
|
||||
}
|
||||
|
||||
if(event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
on_volume_clicked();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -546,9 +497,22 @@ void FDClickWidget::paintEvent(QPaintEvent * event)
|
|||
if(image_show_label != nullptr){
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
painter.setClipping(true); //
|
||||
painter.setClipping(true);
|
||||
painter.setPen(Qt::transparent);
|
||||
painter.setBrush(this->palette().color(QPalette::Button));
|
||||
painter.drawEllipse((image_show_label->pos().x()-9),(image_show_label->pos().y()-3),36,36);
|
||||
if(m_mousePressFlag == false ){
|
||||
painter.setBrush(QColor(this->palette().color(QPalette::BrightText).red(),
|
||||
this->palette().color(QPalette::BrightText).green(),
|
||||
this->palette().color(QPalette::BrightText).blue(),
|
||||
(0.1*255))
|
||||
);
|
||||
}
|
||||
else{
|
||||
painter.setBrush(QColor(this->palette().color(QPalette::BrightText).red(),
|
||||
this->palette().color(QPalette::BrightText).green(),
|
||||
this->palette().color(QPalette::BrightText).blue(),
|
||||
(0.3*255))
|
||||
);
|
||||
}
|
||||
painter.drawEllipse((image_show_label->pos().x()-10),(image_show_label->pos().y()-3),36,36);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ public:
|
|||
QString driveName = "",
|
||||
QString volumeName = "",
|
||||
quint64 capacityDis = 0,
|
||||
QString strMountUri = "");
|
||||
QString strMountUri = "",
|
||||
int uVolumeSum = 0);
|
||||
~FDClickWidget();
|
||||
|
||||
protected:
|
||||
|
@ -91,10 +92,10 @@ private:
|
|||
QLabel *m_driveName_label;
|
||||
ClickLabel *m_nameDis1_label;
|
||||
QLabel *m_capacityDis1_label;
|
||||
QLabel *m_animLabel;
|
||||
QTimer *m_hideTime;
|
||||
QWidget *disWidgetNumOne;
|
||||
QVBoxLayout *main_V_BoxLayout = nullptr;
|
||||
bool m_mousePressFlag = false;
|
||||
|
||||
QGSettings *fontSettings = nullptr;
|
||||
QGSettings *qtSettings = nullptr;
|
||||
|
@ -105,13 +106,13 @@ private:
|
|||
|
||||
FDFrame *m_frame;
|
||||
int m_width = 320;
|
||||
QPropertyAnimation *m_ejectAnimation;
|
||||
QPropertyAnimation *m_ejectAnimation1;
|
||||
|
||||
public:
|
||||
ClickLabel *m_eject_button = nullptr;
|
||||
interactiveDialog *chooseDialog = nullptr;
|
||||
gpartedInterface *gpartedface = nullptr;
|
||||
bool ifSucess = false;
|
||||
FDClickWidget * m_fristClickWidget = nullptr;
|
||||
Q_SIGNALS:
|
||||
void clicked();
|
||||
void clickedEject(EjectDeviceInfo eDeviceInfo);
|
||||
|
@ -129,8 +130,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
QString size_human(qlonglong capacity);
|
||||
QPixmap drawSymbolicColoredPixmap(const QPixmap &source);
|
||||
void ejectBottonAnim();
|
||||
void ejectBottonLeaveAnim();
|
||||
void openFirstVolume();
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
|
100
src/fdframe.cpp
100
src/fdframe.cpp
|
@ -29,7 +29,11 @@
|
|||
#include <QGSettings>
|
||||
#include <QPixmap>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
|
||||
#include "config/xatom-helper.h"
|
||||
#include "fdframe.h"
|
||||
|
||||
#define THEME_UKFD_TRANS "org.ukui.control-center.personalise"
|
||||
|
@ -37,25 +41,26 @@
|
|||
|
||||
FDFrame::FDFrame(QWidget* parent) : QFrame(parent)
|
||||
{
|
||||
setWindowFlags(Qt::FramelessWindowHint |Qt::ToolTip);
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
//setWindowOpacity(0.8);
|
||||
initOpacityGSettings();
|
||||
installEventFilter(this);
|
||||
|
||||
//窗管协议
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
m_animLabel = new ClickLabel(this);
|
||||
m_animLabel->move(0,0);
|
||||
m_animLabel->setFixedSize(320,112);
|
||||
m_animLabel->setAutoFillBackground(true);
|
||||
//m_animLabel->setBackgroundRole(QPalette::Base);
|
||||
setanimColor();
|
||||
m_animLabel->palette().color(QPalette::Base);
|
||||
m_animLabel->installEventFilter(this);
|
||||
//m_animLabel->setPalette(QPalette::Base);
|
||||
|
||||
m_animLabel->setParent(this);
|
||||
m_animLabel->show();
|
||||
|
||||
m_ejectLabel = new QLabel(this);
|
||||
m_ejectLabel->setText(tr("eject"));
|
||||
m_ejectLabel->setStyleSheet("QLabel{color: palette(Text);}");
|
||||
|
@ -69,7 +74,7 @@ FDFrame::FDFrame(QWidget* parent) : QFrame(parent)
|
|||
m_ejectIcon->setProperty("useButtonPalette", true);
|
||||
QPixmap ejectpixmap =QIcon::fromTheme("media-eject-symbolic").pixmap(16,16);
|
||||
m_ejectIcon->setPixmap(ejectpixmap);
|
||||
m_ejectIcon->setStyleSheet("QLabel{color: rgba(140, 140, 140, 1);}");
|
||||
m_ejectIcon->setStyleSheet("QLabel{color: palette(PlaceholderText);}");
|
||||
m_ejectIcon->move(343,47);
|
||||
m_ejectIcon->setFixedSize(16,16);
|
||||
m_ejectIcon->show();
|
||||
|
@ -77,6 +82,7 @@ FDFrame::FDFrame(QWidget* parent) : QFrame(parent)
|
|||
m_hideFrameTime = new QTimer(this);
|
||||
connect(m_hideFrameTime, SIGNAL(timeout()), this,SLOT(on_hideframe()));
|
||||
KWindowEffects::enableBlurBehind(winId(), true);
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
}
|
||||
|
||||
FDFrame::~FDFrame()
|
||||
|
@ -132,7 +138,7 @@ void FDFrame::setlabeltWidth(int width)
|
|||
m_ejectIcon->setProperty("useIconHighlightEffect", 0x2);
|
||||
m_ejectLabel->show();
|
||||
}else {
|
||||
m_ejectIcon->setStyleSheet("QLabel{color: rgba(140, 140, 140, 1);}");
|
||||
m_ejectIcon->setStyleSheet("QLabel{color: palette(PlaceholderText);}");
|
||||
m_ejectLabel->hide();
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +155,7 @@ void FDFrame::setanimColor()
|
|||
connect(gSettings,&QGSettings::changed,this,[=](const QString &key) {
|
||||
if((m_currentThemeMode != nullptr)&&(m_animLabel != nullptr)){
|
||||
m_currentThemeMode = gSettings->get("styleName").toString();
|
||||
if (("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)||("ukui-default" == m_currentThemeMode)){
|
||||
if (("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)){
|
||||
m_animLabel->setStyleSheet("background-color:rgb(255,255,255); border-radius:12px; ");
|
||||
}else {
|
||||
m_animLabel->setStyleSheet("background-color:rgb(13,13,13); border-radius:12px;");
|
||||
|
@ -161,7 +167,7 @@ void FDFrame::setanimColor()
|
|||
|
||||
|
||||
style()->unpolish(this->m_animLabel);
|
||||
if (("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)||("ukui-default" == m_currentThemeMode)){
|
||||
if (("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)){
|
||||
m_animLabel->setStyleSheet("background-color:rgb(255,255,255); border-radius:12px; ");
|
||||
}else {
|
||||
m_animLabel->setStyleSheet("background-color:rgb(13,13,13); border-radius:12px;");
|
||||
|
@ -185,9 +191,8 @@ void FDFrame::paintEvent(QPaintEvent * event)
|
|||
|
||||
path.addRoundedRect(this->rect(), 12, 12);
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
painter.setBrush(this->palette().color(QPalette::Base));
|
||||
painter.setBrush(this->palette().color(QPalette::Window));
|
||||
painter.setPen(Qt::transparent);
|
||||
|
||||
painter.drawPath(path);
|
||||
#if !IN_THEME_BLACKLIST
|
||||
//setanimColor();
|
||||
|
@ -197,6 +202,7 @@ void FDFrame::paintEvent(QPaintEvent * event)
|
|||
|
||||
bool FDFrame::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
static bool bIsEnterFlag = false;
|
||||
if(obj == m_animLabel)
|
||||
{
|
||||
if(event->type() == QEvent::MouseButtonPress)
|
||||
|
@ -207,30 +213,6 @@ bool FDFrame::eventFilter(QObject *obj, QEvent *event)
|
|||
if(event->type() == QEvent::MouseButtonRelease)
|
||||
{
|
||||
qDebug()<<"-----MouseButtonRelease------";
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
if(event->type() == QEvent::Leave)
|
||||
{
|
||||
qDebug()<<"-----Leave------";
|
||||
|
||||
return true;
|
||||
}
|
||||
if(event->type() == QEvent::Enter)
|
||||
{
|
||||
qDebug()<<"-----Enter------";
|
||||
if(("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)||("ukui-default" == m_currentThemeMode))
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(240,240,240); border-radius:12px;");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(38,38,38); border-radius:12px;");
|
||||
|
||||
}
|
||||
repaint();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -239,31 +221,28 @@ bool FDFrame::eventFilter(QObject *obj, QEvent *event)
|
|||
|
||||
if(event->type() == QEvent::Leave)
|
||||
{
|
||||
m_hideFrameTime->start(2000);
|
||||
|
||||
if(("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)||("ukui-default" == m_currentThemeMode))
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(255,255,255); border-radius:12px;");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(18,18,18); border-radius:12px;");
|
||||
if(bIsEnterFlag){
|
||||
m_curTransOpacity-=0.1;
|
||||
bIsEnterFlag = false;
|
||||
}else{
|
||||
bIsEnterFlag = true;
|
||||
}
|
||||
|
||||
repaint();
|
||||
return true;
|
||||
|
||||
}
|
||||
if(event->type() == QEvent::Enter)
|
||||
{
|
||||
if(("ukui-white" == m_currentThemeMode)||("ukui-light" == m_currentThemeMode)||("ukui-default" == m_currentThemeMode))
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(240,240,240); border-radius:12px;");
|
||||
//由于从底部或左侧进入会重复出现两次ENTER事件导致透明度设置异常,故暂先使用以下手段规避问题
|
||||
if(!bIsEnterFlag){
|
||||
m_curTransOpacity+=0.1;
|
||||
bIsEnterFlag = true;
|
||||
}else{
|
||||
bIsEnterFlag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_animLabel->setStyleSheet("background-color:rgb(38,38,38); border-radius:12px;");
|
||||
|
||||
}
|
||||
repaint();
|
||||
|
||||
if (m_hideFrameTime->isActive()) {
|
||||
|
@ -278,7 +257,7 @@ bool FDFrame::eventFilter(QObject *obj, QEvent *event)
|
|||
void FDFrame::on_updateSize()
|
||||
{
|
||||
QPropertyAnimation * m_enterAnimation = new QPropertyAnimation(this, "labeltWidth");
|
||||
m_enterAnimation->setDuration(500);
|
||||
m_enterAnimation->setDuration(300);
|
||||
m_enterAnimation->setStartValue(320);
|
||||
m_enterAnimation->setEndValue(288);
|
||||
m_enterAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
|
@ -287,15 +266,26 @@ void FDFrame::on_updateSize()
|
|||
void FDFrame::on_cursorLeave()
|
||||
{
|
||||
QPropertyAnimation * m_leaveAnimation = new QPropertyAnimation(this, "labeltWidth");
|
||||
m_leaveAnimation->setDuration(500);
|
||||
m_leaveAnimation->setDuration(300);
|
||||
m_leaveAnimation->setStartValue(288);
|
||||
m_leaveAnimation->setEndValue(320);
|
||||
m_leaveAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
void FDFrame::showNoIcon(){
|
||||
|
||||
//不在任务栏处显示窗口图标
|
||||
const KWindowInfo info(this->winId(), NET::WMState);
|
||||
if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) {
|
||||
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
}
|
||||
|
||||
this->show();
|
||||
}
|
||||
|
||||
void FDFrame::on_hideframe()
|
||||
{
|
||||
m_hideFrameTime->stop();
|
||||
//m_hideFrameTime->stop();
|
||||
//this->hide();
|
||||
|
||||
}
|
||||
|
|
|
@ -37,10 +37,11 @@ class FDFrame : public QFrame
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(int labeltWidth READ readlabeltWidth WRITE setlabeltWidth)
|
||||
public:
|
||||
explicit FDFrame(QWidget* parent);
|
||||
explicit FDFrame(QWidget* parent = nullptr);
|
||||
virtual ~FDFrame();
|
||||
|
||||
void initOpacityGSettings();
|
||||
void showNoIcon();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -190,6 +190,11 @@ int FlashDiskData::removeDriveInfo(FDDriveInfo driveInfo)
|
|||
return -1;
|
||||
}
|
||||
if (m_devInfoWithDrive.find(driveInfo.strId) != m_devInfoWithDrive.end()) {
|
||||
map<string, FDDriveInfo>::iterator itDriveInfo = m_devInfoWithDrive.find(driveInfo.strId);
|
||||
if(((itDriveInfo->second.islocalUsr == true)||(g_str_has_prefix (driveInfo.strId.c_str(), "/dev/sr")))||m_clickToEject == false){
|
||||
Q_EMIT notifyDeviceRemoved(QString::fromStdString(driveInfo.strId));
|
||||
m_clickToEject = false;
|
||||
}
|
||||
if (getAttachedVolumeCount(driveInfo.strId) > 0) {
|
||||
//Q_EMIT notifyDeviceRemoved(QString::fromStdString(driveInfo.strId));
|
||||
}
|
||||
|
@ -270,6 +275,9 @@ int FlashDiskData::removeMountInfo(FDMountInfo mountInfo)
|
|||
itDriveInfo->second.listVolumes.erase(itVolumeInfo);
|
||||
}
|
||||
#else
|
||||
if(itVolumeInfo->second.mountInfo.lluTotalSize >= 1){
|
||||
itDriveInfo->second.islocalUsr = true;
|
||||
}
|
||||
// if (getAttachedVolumeCount(itVolumeInfo->second.strId) == 1) {
|
||||
// Q_EMIT notifyDeviceRemoved(QString::fromStdString(itVolumeInfo->second.strId));
|
||||
// }
|
||||
|
@ -520,6 +528,11 @@ void FlashDiskData::clearAllData()
|
|||
|
||||
}
|
||||
|
||||
void FlashDiskData::setClickToEject()
|
||||
{
|
||||
m_clickToEject = true;
|
||||
}
|
||||
|
||||
void FlashDiskData::OutputInfos()
|
||||
{
|
||||
#if 0
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef struct FDDriveInfo_s {
|
|||
bool isRemovable = false;
|
||||
bool isCanStart = false;
|
||||
bool isCanStop = false;
|
||||
bool islocalUsr = false;
|
||||
map<string, FDVolumeInfo> listVolumes;
|
||||
string strIconPath = "";
|
||||
}FDDriveInfo;
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
int removeMountInfo(FDMountInfo mountInfo);
|
||||
unsigned getValidInfoCount();
|
||||
void clearAllData();
|
||||
void setClickToEject();
|
||||
bool isMountInfoExist(FDMountInfo mountInfo);
|
||||
void resetAllNewState();
|
||||
quint64 getMountTickDiff(FDMountInfo mountInfo);
|
||||
|
@ -106,6 +108,8 @@ Q_SIGNALS:
|
|||
private:
|
||||
FlashDiskData();
|
||||
|
||||
bool m_clickToEject = false;
|
||||
|
||||
static FlashDiskData *m_instance;
|
||||
static QMutex m_mutex;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define GPARTEDINTERFACE_H
|
||||
|
||||
#include "MacroFile.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtWidgets>
|
||||
|
@ -39,6 +38,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <qgsettings.h>
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class gpartedInterface; }
|
||||
|
|
|
@ -17,28 +17,37 @@
|
|||
*/
|
||||
|
||||
#include "interactivedialog.h"
|
||||
#include "config/xatom-helper.h"
|
||||
#include <KWindowEffects>
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
|
||||
interactiveDialog::interactiveDialog(QString strDevId, QWidget *parent):QWidget(parent)
|
||||
{
|
||||
this->setFixedSize(300,86);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
this->setWindowFlags(Qt::Dialog|Qt::WindowStaysOnTopHint);
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
installEventFilter(this);
|
||||
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
rect.adjust(1, 1, -1, -1);
|
||||
path.addRoundedRect(rect, 6, 6);
|
||||
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
||||
//窗管协议
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
setProperty("useSystemStyleBlur", true); //毛玻璃效果
|
||||
const QByteArray idd(THEME_QT_SCHEMA);
|
||||
if(QGSettings::isSchemaInstalled(idd))
|
||||
{
|
||||
m_themeSettings = new QGSettings(idd);
|
||||
}
|
||||
initThemeMode();
|
||||
initWidgets(strDevId);
|
||||
connect(chooseBtnCancle,SIGNAL(clicked()),this,SLOT(close()));
|
||||
connect(chooseBtnContinue,SIGNAL(clicked()),this,SLOT(convert()));
|
||||
moveChooseDialogRight();
|
||||
initTransparentState();
|
||||
getTransparentData();
|
||||
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
||||
}
|
||||
|
||||
void interactiveDialog::initTransparentState()
|
||||
|
@ -59,6 +68,17 @@ void interactiveDialog::getTransparentData()
|
|||
return;
|
||||
}
|
||||
|
||||
connect(m_transparency_gsettings, &QGSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "transparency") {
|
||||
QStringList keys = m_transparency_gsettings->keys();
|
||||
if (keys.contains("transparency")) {
|
||||
m_transparency = m_transparency_gsettings->get("transparency").toString().toDouble();
|
||||
//setWindowOpacity(m_transparency);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QStringList keys = m_transparency_gsettings->keys();
|
||||
if (keys.contains("transparency"))
|
||||
{
|
||||
|
@ -89,12 +109,13 @@ void interactiveDialog::initWidgets(QString strDevId)
|
|||
chooseBtn_H_BoxLayout->addWidget(chooseBtnCancle);
|
||||
chooseBtn_H_BoxLayout->addWidget(chooseBtnContinue);
|
||||
chooseBtn_H_BoxLayout->setSpacing(0);
|
||||
#else
|
||||
chooseBtnCancle = new QPushButton();
|
||||
chooseBtnCancle->setText(tr("yes"));
|
||||
chooseBtnCancle->setFlat(true);
|
||||
#else
|
||||
|
||||
chooseBtnContinue = new QPushButton();
|
||||
chooseBtnCancle = new QPushButton;
|
||||
chooseBtnCancle->setText(tr("yes"));
|
||||
chooseBtnCancle->setProperty("needTranslucent",true);
|
||||
|
||||
chooseBtnContinue = new QPushButton;
|
||||
chooseBtnContinue->hide();
|
||||
|
||||
chooseBtn_H_BoxLayout = new QHBoxLayout();
|
||||
|
@ -174,16 +195,69 @@ void interactiveDialog::moveChooseDialogRight()
|
|||
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x+QApplication::primaryScreen()->geometry().width()-panelSize-this->width() - DISTANCEPADDING,y + QApplication::primaryScreen()->geometry().height() - this->height() - DISTANCEPADDING,this->width(),this->height()));
|
||||
}
|
||||
|
||||
void interactiveDialog::initThemeMode()
|
||||
{
|
||||
if(!m_themeSettings)
|
||||
{
|
||||
currentThemeMode = "ukui-white";
|
||||
}else{
|
||||
QStringList keys = m_themeSettings->keys();
|
||||
if(keys.contains("styleName"))
|
||||
{
|
||||
currentThemeMode = m_themeSettings->get("style-name").toString();
|
||||
}
|
||||
connect(m_themeSettings, &QGSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "styleName") {
|
||||
QStringList keys = m_themeSettings->keys();
|
||||
if (keys.contains("styleName")) {
|
||||
currentThemeMode = m_themeSettings->get("styleName").toString();
|
||||
setBackgroundColor();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
setBackgroundColor();
|
||||
|
||||
}
|
||||
|
||||
void interactiveDialog::setBackgroundColor()
|
||||
{
|
||||
if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-white")
|
||||
m_backgroundColor.setRgb(255,255,255);
|
||||
else
|
||||
m_backgroundColor.setRgb(13,13,13);
|
||||
}
|
||||
|
||||
void interactiveDialog::showInteractivDialog()
|
||||
{
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
this->show();
|
||||
this->moveChooseDialogRight(); //使用SDK接口替换setgeometry后需要在show后重新设置位置
|
||||
this->setFocus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interactiveDialog::~interactiveDialog()
|
||||
{
|
||||
if (m_transparency_gsettings) {
|
||||
delete m_transparency_gsettings;
|
||||
m_transparency_gsettings = nullptr;
|
||||
}
|
||||
if (gsetting) {
|
||||
delete gsetting;
|
||||
gsetting = nullptr;
|
||||
}
|
||||
|
||||
bool interactiveDialog::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == this)
|
||||
{
|
||||
if (event->type() == QEvent::WindowDeactivate) {
|
||||
this->hide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void interactiveDialog::paintEvent(QPaintEvent *event)
|
||||
|
@ -236,18 +310,29 @@ void interactiveDialog::paintEvent(QPaintEvent *event)
|
|||
// path.drawRoundedRect
|
||||
// QRegion region(path.toFillPolygon().toPolygon());
|
||||
//// this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明
|
||||
// KWindowEffects::enableBlurBehind(this->winId(),true,region);
|
||||
// QWidget::paintEvent(event);
|
||||
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
QRect rect = this->rect();
|
||||
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
p.setBrush(opt.palette.color(QPalette::Base));
|
||||
p.setOpacity(m_transparency);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(rect, 6, 6);
|
||||
QWidget::paintEvent(event);
|
||||
// QStyleOption opt;
|
||||
// opt.init(this);
|
||||
// QPainter p(this);
|
||||
// QPainterPath path;
|
||||
// QRect rect = this->rect();
|
||||
// p.setOpacity(0);
|
||||
// p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
// p.setClipping(true);
|
||||
// p.setPen(Qt::transparent);
|
||||
// qInfo()<<"----透明度-"<<m_transparency;
|
||||
|
||||
// path.addRoundedRect(rect, 12, 12);
|
||||
// path.setFillRule(Qt::WindingFill);
|
||||
// p.setBrush(this->palette().color(QPalette::Base));
|
||||
// p.setPen(Qt::transparent);
|
||||
// p.drawPath(path); //绘制底色
|
||||
// QWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setPen(Qt::transparent);
|
||||
painter.setBrush(m_backgroundColor);
|
||||
painter.drawRect(this->rect());
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define INTERACTIVEDIALOG_H
|
||||
|
||||
#include "MacroFile.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtWidgets>
|
||||
|
@ -38,6 +37,8 @@
|
|||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
#include <qgsettings.h>
|
||||
#include <windowmanager/windowmanager.h>
|
||||
#include <kysdk/applications/kborderbutton.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class interactiveDialog; }
|
||||
|
@ -50,9 +51,11 @@ public:
|
|||
interactiveDialog(QString strDevId, QWidget *parent);
|
||||
~interactiveDialog();
|
||||
void updateContentLable(QString strDevId);
|
||||
void moveChooseDialogRight();
|
||||
void showInteractivDialog();
|
||||
private:
|
||||
QPushButton *chooseBtnContinue = nullptr;
|
||||
QPushButton *chooseBtnCancle = nullptr;
|
||||
QPushButton *chooseBtnContinue = nullptr;
|
||||
QLabel *contentLable = nullptr;
|
||||
QHBoxLayout *content_H_BoxLayout = nullptr;
|
||||
QHBoxLayout *chooseBtn_H_BoxLayout = nullptr;
|
||||
|
@ -60,17 +63,21 @@ private:
|
|||
|
||||
double m_transparency;
|
||||
int fontSize;
|
||||
QString currentThemeMode;
|
||||
QGSettings *m_themeSettings = nullptr;
|
||||
QGSettings *m_transparency_gsettings = nullptr;
|
||||
QGSettings *gsetting = nullptr;
|
||||
QColor m_backgroundColor;
|
||||
|
||||
private:
|
||||
void initWidgets(QString strDevId);
|
||||
void moveChooseDialogRight();
|
||||
void initTransparentState();
|
||||
void initThemeMode();
|
||||
void getTransparentData();
|
||||
void setBackgroundColor();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
public Q_SLOTS:
|
||||
void convert();
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -47,6 +47,7 @@ int main(int argc, char *argv[])
|
|||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QString id = QString("kylin-device-daemon_%1_%2").arg(getuid()).arg(QLatin1String(getenv("DISPLAY")));
|
||||
FDApplication a(id, argc, argv);
|
||||
a.setWindowIcon(QIcon::fromTheme("system-file-manager"));
|
||||
|
||||
// Process does not exit implicitly
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
|
|
|
@ -31,10 +31,14 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <QDebug>
|
||||
#include <windowmanager/windowmanager.h>
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
|
||||
#include "clickLabel.h"
|
||||
#include "MacroFile.h"
|
||||
#include "datacdrom.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#if UDFAUTOMOUNT
|
||||
static void mount_cdrom (GDrive* drive, gpointer u);
|
||||
|
@ -47,6 +51,7 @@ static QMap<QString, QString>* gMountCdromMountPoint = nullptr;
|
|||
// ukey
|
||||
static char const* const gSpecialUSB[] = {
|
||||
"FT ePass3000GM",
|
||||
"GASEC GAUKEY",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -83,9 +88,10 @@ MainWindow::~MainWindow()
|
|||
delete ifsettings;
|
||||
ifsettings = nullptr;
|
||||
}
|
||||
for(int i = 1;i<=5;i++){
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (centralWidgetList[i] ) {
|
||||
centralWidgetList[i] = 0;
|
||||
delete centralWidgetList[i];
|
||||
centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,16 +105,17 @@ void MainWindow::initFlashDisk()
|
|||
interfaceHideTime = new QTimer(this);
|
||||
|
||||
initTransparentState();
|
||||
ui->centralWidget = new FDFrame();
|
||||
ui->centralWidget->setObjectName("centralWidget");
|
||||
vboxlayout = new QVBoxLayout(this);
|
||||
ui->centralWidget->setLayout(vboxlayout);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
//this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
#else
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
//this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
#endif
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
//this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
||||
m_systray = new QSystemTrayIcon(this);
|
||||
m_systray->setIcon(QIcon::fromTheme("drive-removable-media-usb-symbolic"));
|
||||
|
@ -143,20 +150,22 @@ void MainWindow::initSlots()
|
|||
connect(interfaceHideTime, SIGNAL(timeout()), this, SLOT(onMaininterfacehide()));
|
||||
}
|
||||
|
||||
void MainWindow::onRequestSendDesktopNotify(QString message, QString strIcon)
|
||||
void MainWindow::onRequestSendDesktopNotify(QString message, QString strIcon, QString notifySound)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
QMap <QString,QVariant> hint;
|
||||
hint.insert("sound-name",notifySound);
|
||||
args << (tr("kylin device daemon"))
|
||||
<< ((unsigned int) 0)
|
||||
<< strIcon
|
||||
<< tr("kindly reminder") //显示的是什么类型的信息
|
||||
<< message //显示的具体信息
|
||||
<< QStringList()
|
||||
<< QVariantMap()
|
||||
<< hint
|
||||
<< (int)-1;
|
||||
iface.callWithArgumentList(QDBus::NoBlock,"Notify",args);
|
||||
}
|
||||
|
@ -277,8 +286,8 @@ bool MainWindow::getDevInterface(QString strDev)
|
|||
QStringList infoList = str.split('-');
|
||||
QStringList::Iterator it = infoList.begin();
|
||||
for (; it != infoList.end(); it++){
|
||||
if((*it==("ata"))&&(!g_str_has_prefix(chDev,"/dev/sr"))){
|
||||
qDebug()<<"---tt-is sata-"<<(*it);
|
||||
if((*it=="ata")&&(*it=="nvme")&&(!g_str_has_prefix(chDev,"/dev/sr"))){
|
||||
qDebug()<<"---is sata or nvme-"<<(*it);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +300,7 @@ bool MainWindow::getDevInterface(QString strDev)
|
|||
QStringList::Iterator it = infoList.begin();
|
||||
for (; it != infoList.end(); it++){
|
||||
if(*it==("E: ID_FS_TYPE")){
|
||||
//qDebug()<<"---"<<strDev<<"have FS type-"<<(*it);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -752,7 +762,7 @@ void MainWindow::onConvertShowWindow(QString strDriveId, QString strMountUri)
|
|||
#if IFDISTINCT_DEVICON
|
||||
QString strIcon = m_dataFlashDisk->getVolumeIcon(strDriveId);
|
||||
onRequestSendDesktopNotify(tr("Please do not pull out the storage device when reading or writing"),
|
||||
strIcon);
|
||||
strIcon,"devconnectionsucceeded");
|
||||
#else
|
||||
if (strDriveId.startsWith("/dev/sr")) {
|
||||
onRequestSendDesktopNotify(tr("Please do not pull out the CDROM when reading or writing"),
|
||||
|
@ -776,7 +786,7 @@ void MainWindow::onNotifyDeviceRemoved(QString strDevId)
|
|||
}
|
||||
#if IFDISTINCT_DEVICON
|
||||
QString strIcon = m_dataFlashDisk->getVolumeIcon(strDevId);
|
||||
onRequestSendDesktopNotify(tr("Storage device removed"), strIcon);
|
||||
onRequestSendDesktopNotify(tr("Storage device removed"), strIcon, "devconnectionbreak");
|
||||
#else
|
||||
if (strDevId.startsWith("/dev/sr")) {
|
||||
onRequestSendDesktopNotify(tr("Storage device removed"),
|
||||
|
@ -794,10 +804,13 @@ void MainWindow::onNotifyDeviceRemoved(QString strDevId)
|
|||
void MainWindow::onConvertUpdateWindow(QString strDevName, unsigned uDevType)
|
||||
{
|
||||
// uDevType: 0 drive , 1 volume, 2 mount
|
||||
if (uDevType != 0) { // not drive detached
|
||||
if (uDevType == 1) { // not drive detached
|
||||
qDebug()<<"----------MainWindowShow----------";
|
||||
insertorclick = true;
|
||||
insertorclick = false;
|
||||
MainWindowShow(true);
|
||||
}else if(uDevType ==2){
|
||||
if(!(m_basewidget->isHidden()))
|
||||
m_basewidget->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -806,13 +819,13 @@ void MainWindow::drive_connected_callback(GVolumeMonitor *monitor, GDrive *drive
|
|||
{
|
||||
// ukey
|
||||
g_autofree char* deviceName = g_drive_get_name (G_DRIVE(drive));
|
||||
qInfo() << "drive add"<<deviceName;
|
||||
for (int i = 0; gSpecialUSB[i]; ++i) {
|
||||
if (deviceName && g_strrstr(deviceName, gSpecialUSB[i])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
qInfo() << "drive add";
|
||||
if(p_this->ifsettings->get(IFAUTOLOAD).toBool()) {
|
||||
GList *lVolume = NULL;
|
||||
FDDriveInfo driveInfo;
|
||||
|
@ -831,6 +844,8 @@ void MainWindow::drive_connected_callback(GVolumeMonitor *monitor, GDrive *drive
|
|||
driveInfo.isCanStart = g_drive_can_start(gdrive);
|
||||
driveInfo.isRemovable = g_drive_is_removable(gdrive);
|
||||
g_free(devPath);
|
||||
}else{
|
||||
qInfo() << "devpath is empty ";
|
||||
}
|
||||
|
||||
if (!g_drive_has_volumes(gdrive)) {
|
||||
|
@ -916,24 +931,27 @@ void MainWindow::drive_disconnected_callback (GVolumeMonitor *monitor, GDrive *d
|
|||
}
|
||||
}
|
||||
p_this->m_dataFlashDisk->removeDriveInfo(driveInfo);
|
||||
Q_EMIT p_this->notifyDeviceRemoved(QString::fromStdString(driveInfo.strId));
|
||||
//Q_EMIT p_this->notifyDeviceRemoved(QString::fromStdString(driveInfo.strId));
|
||||
if(p_this->m_dataFlashDisk->getValidInfoCount() == 0) {
|
||||
for(int i = 1;i<=5;i++){
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (p_this->centralWidgetList[i] && !p_this->centralWidgetList[i]->isHidden()) {
|
||||
p_this->centralWidgetList[i]->hide();
|
||||
p_this->centralWidgetList[i] = 0;
|
||||
delete p_this->centralWidgetList[i];
|
||||
p_this->centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
p_this->ui->centralWidget->hide();
|
||||
p_this->m_systray->hide();
|
||||
}
|
||||
if(!p_this->m_basewidget->isHidden())
|
||||
p_this->m_basewidget->hide();
|
||||
p_this->m_dataFlashDisk->OutputInfos();
|
||||
}
|
||||
|
||||
// when the usb device is identified, we should mount every partition
|
||||
void MainWindow::volume_added_callback(GVolumeMonitor *monitor, GVolume *volume, MainWindow *p_this)
|
||||
{
|
||||
qDebug() << "volume add";
|
||||
qInfo() << "volume add";
|
||||
GDrive* gdrive = g_volume_get_drive(volume);
|
||||
|
||||
FILE *fp = NULL;
|
||||
|
@ -959,7 +977,8 @@ void MainWindow::volume_added_callback(GVolumeMonitor *monitor, GVolume *volume,
|
|||
}
|
||||
|
||||
bool isNewMount = false;
|
||||
if(!gdrive) {
|
||||
char *devPath = g_drive_get_identifier(gdrive,G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE);
|
||||
if((!gdrive)||(devPath == NULL)) {
|
||||
FDVolumeInfo volumeInfo;
|
||||
bool isValidMount = true;
|
||||
char *devPath = g_volume_get_identifier(volume,G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
|
||||
|
@ -1151,7 +1170,8 @@ void MainWindow::volume_added_callback(GVolumeMonitor *monitor, GVolume *volume,
|
|||
}
|
||||
g_object_unref(mount);
|
||||
} else {
|
||||
if(p_this->ifsettings->get(IFAUTOLOAD).toBool()) {
|
||||
qInfo()<<"ifGpartedBusy"<<p_this->ifGpartedBusy();
|
||||
if(p_this->ifsettings->get(IFAUTOLOAD).toBool()&&p_this->ifGpartedBusy()) {
|
||||
p_this->m_ismountadd = true;
|
||||
if (p_this->getDevInterface(volumeInfo.strId.c_str())){
|
||||
p_this->m_ismountadd = false;
|
||||
|
@ -1172,7 +1192,9 @@ void MainWindow::volume_added_callback(GVolumeMonitor *monitor, GVolume *volume,
|
|||
volumeInfo.isNewInsert = true;
|
||||
p_this->m_dataFlashDisk->addVolumeInfoWithDrive(driveInfo, volumeInfo);
|
||||
string strDevId = driveInfo.strId.empty()?volumeInfo.strId:driveInfo.strId;
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), volumeInfo.mountInfo.strUri.c_str());
|
||||
if(volumeInfo.mountInfo.lluTotalSize >= 1){
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), volumeInfo.mountInfo.strUri.c_str());
|
||||
}
|
||||
} else {
|
||||
p_this->m_dataFlashDisk->addVolumeInfoWithDrive(driveInfo, volumeInfo);
|
||||
}
|
||||
|
@ -1216,7 +1238,8 @@ void MainWindow::volume_removed_callback(GVolumeMonitor *monitor, GVolume *volum
|
|||
p_this->m_systray->hide();
|
||||
}
|
||||
p_this->m_dataFlashDisk->OutputInfos();
|
||||
Q_EMIT p_this->convertUpdateWindow(QString::fromStdString(volumeInfo.strName), 1); //emit a signal to update the MainMainShow slot
|
||||
if (!(p_this->getDevInterface(volumeInfo.strId.c_str())))
|
||||
Q_EMIT p_this->convertUpdateWindow(QString::fromStdString(volumeInfo.strName), 1); //emit a signal to update the MainMainShow slot
|
||||
}
|
||||
|
||||
// when the volumes were mounted we add its mounts number
|
||||
|
@ -1288,6 +1311,7 @@ void MainWindow::mount_added_callback(GVolumeMonitor *monitor, GMount *mount, Ma
|
|||
}
|
||||
g_object_unref(gvolume);
|
||||
}
|
||||
|
||||
mountInfo.isCanEject = g_mount_can_eject(mount);
|
||||
char *mountId = g_mount_get_uuid(mount);
|
||||
if (mountId) {
|
||||
|
@ -1359,8 +1383,10 @@ void MainWindow::mount_added_callback(GVolumeMonitor *monitor, GMount *mount, Ma
|
|||
// 没有卷信息的挂载不处理(ftp等)
|
||||
isValidMount = false;
|
||||
}
|
||||
|
||||
if(isValidMount && (mountInfo.isCanUnmount || g_str_has_prefix(strVolumePath.c_str(),"/dev/bus")
|
||||
|| g_str_has_prefix(strVolumePath.c_str(),"/dev/sr") || g_str_has_prefix(strVolumePath.c_str(),"/dev/mmcblk"))) {
|
||||
|| g_str_has_prefix(strVolumePath.c_str(),"/dev/sr") || g_str_has_prefix(strVolumePath.c_str(),"/dev/mmcblk"))
|
||||
&&!g_str_has_prefix(strVolumePath.c_str(),"/dev/loop")) {
|
||||
qInfo() << "real mount loaded";
|
||||
mountInfo.isNewInsert = true;
|
||||
if (!driveInfo.strId.empty()) {
|
||||
|
@ -1385,7 +1411,9 @@ void MainWindow::mount_added_callback(GVolumeMonitor *monitor, GMount *mount, Ma
|
|||
if (isValidMount && isNewMount) {
|
||||
//qInfo()<<"cd data disk has mounted!";
|
||||
string strDevId = driveInfo.strId.empty()?volumeInfo.strId:driveInfo.strId;
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), mountInfo.strUri.c_str());
|
||||
if(volumeInfo.mountInfo.lluTotalSize >= 1){
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), mountInfo.strUri.c_str());
|
||||
}
|
||||
}
|
||||
p_this->m_systray->show();
|
||||
}
|
||||
|
@ -1589,7 +1617,9 @@ void MainWindow::frobnitz_result_func_volume(GVolume *source_object,GAsyncResult
|
|||
if (isNewMount) {
|
||||
qInfo()<<"sig has emitted";
|
||||
string strDevId = driveInfo.strId.empty()?volumeInfo.strId:driveInfo.strId;
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), mountInfo.strUri.c_str()); //emit a signal to trigger the MainMainShow slot
|
||||
if(volumeInfo.mountInfo.lluTotalSize >= 1){
|
||||
Q_EMIT p_this->convertShowWindow(strDevId.c_str(), mountInfo.strUri.c_str()); //emit a signal to trigger the MainMainShow slot
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (G_IO_ERROR_ALREADY_MOUNTED == err->code) {
|
||||
|
@ -1610,11 +1640,12 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
|
|||
triggerType = 1; //It represents how we open the interface
|
||||
|
||||
qDebug()<<"------iconActivated-------";
|
||||
for(int i = 1;i<=5;i++){
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (centralWidgetList[i] && !centralWidgetList[i]->isHidden() && !insertorclick) {
|
||||
qDebug()<<"------清除centralWidgetList-------";
|
||||
centralWidgetList[i]->hide();
|
||||
centralWidgetList[i] = 0;
|
||||
delete centralWidgetList[i];
|
||||
centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1712,17 +1743,24 @@ void MainWindow::newarea(unsigned uDiskNo,
|
|||
QString volumeName,
|
||||
quint64 capacityDis,
|
||||
QString strMountUri,
|
||||
int linestatus)
|
||||
int uVolumeSum)
|
||||
{
|
||||
qDebug()<<"---newarea-"<<"-strDriveId"<<strDriveId<<"-strVolumeId"<<strVolumeId<<"-strMountId"<<strMountId;
|
||||
m_fdClickWidget = new FDClickWidget(ui->centralWidget,uDiskNo,strDriveId,strVolumeId,strMountId,
|
||||
driveName,volumeName,capacityDis,strMountUri);
|
||||
driveName,volumeName,capacityDis,strMountUri,uVolumeSum);
|
||||
connect(m_fdClickWidget, &FDClickWidget::clickedEject,this,&MainWindow::onClickedEject);
|
||||
|
||||
if(uDiskNo<=2){
|
||||
if(uDiskNo == 1){
|
||||
this->m_iconClickWidget = m_fdClickWidget;
|
||||
m_fdClickWidget->m_fristClickWidget = m_fdClickWidget;
|
||||
}else{
|
||||
m_fdClickWidget->m_fristClickWidget = this->m_iconClickWidget;
|
||||
}
|
||||
this->vboxlayout->setContentsMargins(5,0,2,20);
|
||||
this->vboxlayout->addWidget(m_fdClickWidget);
|
||||
}else{
|
||||
m_fdClickWidget->m_fristClickWidget = this->m_iconClickWidget;
|
||||
m_fdClickWidget->setParent(ui->centralWidget);
|
||||
m_fdClickWidget->move(5,25+uDiskNo*15);
|
||||
m_fdClickWidget->show();
|
||||
|
@ -1742,7 +1780,7 @@ void MainWindow::showFristWindow(quint64 uVolumeSum,
|
|||
{
|
||||
qDebug()<<"显示第一个设备,卷总数为"<<uVolumeSum;
|
||||
newarea(uVolumeNum, strDriveId,strVolumeId,strMountId,driveName,
|
||||
volumeName, capacityDis,strMountUri,1);
|
||||
volumeName, capacityDis,strMountUri,uVolumeSum);
|
||||
hign = 112;
|
||||
if(uVolumeSum >=3 ){
|
||||
hign = hign+(uVolumeSum-2)*FLASHDISKITEM_TITLE_HEIGHT;
|
||||
|
@ -1750,12 +1788,21 @@ void MainWindow::showFristWindow(quint64 uVolumeSum,
|
|||
|
||||
ui->centralWidget->setFixedSize(388, hign);
|
||||
ui->centralWidget->m_animLabel->setFixedSize(320, hign);
|
||||
ui->centralWidget->m_mainWindowHigh = hign;
|
||||
moveBottomNoBase();
|
||||
qDebug()<<"首窗口高度为"<<ui->centralWidget->height();
|
||||
if(!m_basewidget->isHidden()){
|
||||
m_basewidget->hide();
|
||||
}
|
||||
ui->centralWidget->show();
|
||||
|
||||
if((uVolumeNum == uVolumeSum)&&(ui->centralWidget->isHidden()==true)){
|
||||
m_basewidget->mainWindowVboxLayout->addWidget(ui->centralWidget);
|
||||
m_basewidget->setFixedSize(388, hign);
|
||||
m_basewidget->m_hideTimer->start(3000);
|
||||
ui->centralWidget->show();
|
||||
m_basewidget->showBaseWindow();
|
||||
moveBaseWidgetGeo();
|
||||
qDebug()<<"在basewindow中显示第一个设备"<<uVolumeSum<<ui->centralWidget->isHidden();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1772,16 +1819,15 @@ void MainWindow::showMainWindow(int uVolumeNum,
|
|||
QString strMountUri)
|
||||
{
|
||||
qDebug()<<"遍历第"<<uDiskCount<<"个设备的第"<<uVolumeNum<<"个卷";
|
||||
int uPositonY = 0;
|
||||
if(centralWidgetList[uDiskCount] == NULL){
|
||||
qDebug()<<"--new fdframe";
|
||||
centralWidgetList[uDiskCount] = new FDFrame(this);
|
||||
centralWidgetList[uDiskCount%FLASHDISKITEM_SHOWDISK_MAX] = new FDFrame(this);
|
||||
}
|
||||
|
||||
m_fdClickWidget = new FDClickWidget(centralWidgetList[uDiskCount],uVolumeNum, strDriveId,strVolumeId,strMountId,driveName,
|
||||
volumeName, capacityDis,strMountUri);
|
||||
volumeName, capacityDis,strMountUri, uVolumeSum);
|
||||
connect(m_fdClickWidget, &FDClickWidget::clickedEject,this,&MainWindow::onClickedEject);
|
||||
if (uDiskCount > 0) {
|
||||
qDebug()<<"----------set centralWidget2"<<uDiskCount<<"-uVolumeNum"<<uVolumeNum;
|
||||
hign = 112;
|
||||
if(uVolumeSum >=3 ){
|
||||
hign = hign+(uVolumeSum-2)*FLASHDISKITEM_TITLE_HEIGHT;
|
||||
|
@ -1793,12 +1839,26 @@ void MainWindow::showMainWindow(int uVolumeNum,
|
|||
}
|
||||
centralWidgetList[uDiskCount]->setFixedSize(388, hign);
|
||||
centralWidgetList[uDiskCount]->m_animLabel->setFixedSize(320, hign);
|
||||
centralWidgetList[uDiskCount]->move(ui->centralWidget->x(),ui->centralWidget->y()-((hign*(uDiskCount-1))+8));
|
||||
|
||||
if (uDiskCount>2){
|
||||
for (int i=2; i<=uDiskCount ;i++){
|
||||
uPositonY += centralWidgetList[i]->height();
|
||||
}
|
||||
centralWidgetList[uDiskCount]->move(ui->centralWidget->x(),ui->centralWidget->y()-((uDiskCount-1)*FLASHDISKITEM_SPACE_HEIGHT)-uPositonY);
|
||||
}else{
|
||||
centralWidgetList[uDiskCount]->move(ui->centralWidget->x(),ui->centralWidget->y()-((uDiskCount-1)*(hign+FLASHDISKITEM_SPACE_HEIGHT)));
|
||||
}
|
||||
|
||||
if(uVolumeNum<=2){
|
||||
if(uVolumeNum == 1){
|
||||
this->m_iconClickWidget = m_fdClickWidget;
|
||||
m_fdClickWidget->m_fristClickWidget = m_fdClickWidget;
|
||||
}
|
||||
m_fdClickWidget->m_fristClickWidget = this->m_iconClickWidget;
|
||||
vboxLayout1->setContentsMargins(5,0,2,20);
|
||||
vboxLayout1->addWidget(m_fdClickWidget);
|
||||
}else{
|
||||
m_fdClickWidget->m_fristClickWidget = this->m_iconClickWidget;
|
||||
m_fdClickWidget->setParent(centralWidgetList[uDiskCount]);
|
||||
m_fdClickWidget->move(5,25+uVolumeNum*15);
|
||||
m_fdClickWidget->show();
|
||||
|
@ -1807,16 +1867,30 @@ void MainWindow::showMainWindow(int uVolumeNum,
|
|||
if(uVolumeNum == uVolumeSum){
|
||||
centralWidgetList[uDiskCount]->m_mainWindowHigh = hign;
|
||||
}
|
||||
qDebug()<<"窗口高度为:"<<centralWidgetList[uDiskCount]->height();
|
||||
centralWidgetList[uDiskCount]->show();
|
||||
|
||||
if ((insertorclick)&&(uVolumeSum == uVolumeNum)){
|
||||
if(ui->centralWidget!=NULL&&(ui->centralWidget->isHidden()==false)){
|
||||
m_basewidget->mainWindowVboxLayout->addWidget(ui->centralWidget);
|
||||
}
|
||||
for(int i = 0; i<7; i++){
|
||||
if(centralWidgetList[i]!=NULL){
|
||||
centralWidgetList[i]->setProperty("useSystemStyleBlur", true);
|
||||
m_basewidget->mainWindowVboxLayout->addWidget(centralWidgetList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
m_basewidget->setFixedSize(388, 0);
|
||||
m_basewidget->showBaseWindow();
|
||||
m_basewidget->m_hideTimer->start(3000);
|
||||
moveBaseWidgetGeo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::moveBottomRight()
|
||||
{
|
||||
//MARGIN 为到任务栏或屏幕边缘的间隔
|
||||
#define MARGIN 4
|
||||
#define MARGIN 8
|
||||
QDBusInterface iface("org.ukui.panel",
|
||||
"/panel/position",
|
||||
"org.ukui.panel",
|
||||
|
@ -1893,6 +1967,39 @@ void MainWindow::moveBottomDirect(GDrive *drive)
|
|||
{
|
||||
}
|
||||
|
||||
bool MainWindow::ifNewInsertVol()
|
||||
{
|
||||
map<string, FDDriveInfo>& listDriveInfo = m_dataFlashDisk->getDevInfoWithDrive();
|
||||
map<string, FDDriveInfo>::iterator itDriveInfo = listDriveInfo.begin();
|
||||
for ( ;itDriveInfo != listDriveInfo.end(); itDriveInfo++) {
|
||||
map<string, FDVolumeInfo>::iterator itVolumeInfo = itDriveInfo->second.listVolumes.begin();
|
||||
for ( ;itVolumeInfo != itDriveInfo->second.listVolumes.end(); itVolumeInfo++) {
|
||||
if ((itVolumeInfo->second.strId.empty() && itVolumeInfo->second.mountInfo.strId.empty())
|
||||
|| (!itVolumeInfo->second.isNewInsert && !itVolumeInfo->second.mountInfo.isNewInsert)) {
|
||||
// is not new insert device
|
||||
qInfo()<<"---------循环便利退出-----------";
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::hideAllWidget(){
|
||||
|
||||
if(!ui->centralWidget->isHidden()){
|
||||
ui->centralWidget->hide();
|
||||
}
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (centralWidgetList[i] && !centralWidgetList[i]->isHidden()) {
|
||||
centralWidgetList[i]->hide();
|
||||
delete centralWidgetList[i];
|
||||
centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::MainWindowShow(bool isUpdate)
|
||||
{
|
||||
this->getTransparentData();
|
||||
|
@ -1948,6 +2055,7 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
//Convenient interface layout for all drives
|
||||
map<string, FDDriveInfo>& listDriveInfo = m_dataFlashDisk->getDevInfoWithDrive();
|
||||
if (!listDriveInfo.empty()) {
|
||||
hideAllWidget();
|
||||
map<string, FDDriveInfo>::iterator itDriveInfo = listDriveInfo.begin();
|
||||
for ( ;itDriveInfo != listDriveInfo.end(); itDriveInfo++) {
|
||||
unsigned uVolumeNum = 0;
|
||||
|
@ -1959,7 +2067,7 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
uVolumeSum = itDriveInfo->second.listVolumes.size();
|
||||
}
|
||||
QVBoxLayout *vboxLayout1 = new QVBoxLayout();
|
||||
qDebug()<<"-------首次插入显示窗口-strDriveName"<<strDriveName<<"-uDiskCount"<<uDiskCount;
|
||||
qDebug()<<"-------遍历设备-DriveName"<<strDriveName<<"-DiskCount"<<uDiskCount<<"卷总数:"<<uVolumeSum;
|
||||
map<string, FDVolumeInfo>::iterator itVolumeInfo = itDriveInfo->second.listVolumes.begin();
|
||||
for ( ;itVolumeInfo != itDriveInfo->second.listVolumes.end(); itVolumeInfo++) {
|
||||
QString strApiName;
|
||||
|
@ -1969,6 +2077,8 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
QString strVolumeId = QString::fromStdString(itVolumeInfo->second.strId);
|
||||
QString strMountId = QString::fromStdString(itVolumeInfo->second.mountInfo.strId);
|
||||
unsigned uVolumeType = 0; // 0:normal file volume, 1: cddata, 2:tele dev
|
||||
|
||||
qDebug()<<"---------遍历卷-----------DriveId:"<<strDriveId<<"VolumeId:"<<strVolumeId;
|
||||
if ((itVolumeInfo->second.strId.empty() && itVolumeInfo->second.mountInfo.strId.empty())
|
||||
|| (!itVolumeInfo->second.isNewInsert && !itVolumeInfo->second.mountInfo.isNewInsert)) {
|
||||
// is not new insert device
|
||||
|
@ -2021,7 +2131,7 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
strApiName, lluTotalSize, strMountUri);
|
||||
}
|
||||
} else {
|
||||
qDebug()<<"-----处理U盘设备弹窗页面"<<"-uDiskCount"<<uDiskCount<<"-uVolumeNum"<<uVolumeNum;
|
||||
//qDebug()<<"-----处理U盘设备弹窗页面"<<"-uDiskCount"<<uDiskCount<<"-uVolumeNum"<<uVolumeNum;
|
||||
if(uDiskCount == 1 ) {
|
||||
showFristWindow(uVolumeSum,uVolumeNum,strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
|
@ -2236,33 +2346,17 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
//如果设备数大于0
|
||||
if (uDiskCount > 0) {
|
||||
if (uVolumeType == 1) { // deal with cd info
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(uVolumeSum,uVolumeNum, strDriveId,strVolumeId,strMountId,strDriveName,
|
||||
// strApiName, 1, "burn:///");
|
||||
// } else {
|
||||
showMainWindow(uVolumeNum, uDiskCount, uVolumeSum,vboxLayout2, strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
strApiName, 1, "burn:///");
|
||||
|
||||
// }
|
||||
showMainWindow(uVolumeNum, uDiskCount, uVolumeSum,vboxLayout2, strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
strApiName, 1, "burn:///");
|
||||
} else if (uVolumeType == 2) {
|
||||
QString telephoneName = tr("telephone device");
|
||||
QByteArray strTelePhone = telephoneName.toLocal8Bit();
|
||||
char *realTele = strTelePhone.data();
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(uVolumeSum,uVolumeNum, strDriveId,strVolumeId,strMountId,realTele,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// } else {
|
||||
showMainWindow(uVolumeNum, uDiskCount, uVolumeSum,vboxLayout2, strDriveId, strVolumeId, strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
//}
|
||||
showMainWindow(uVolumeNum, uDiskCount, uVolumeSum,vboxLayout2, strDriveId, strVolumeId, strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
} else {
|
||||
// if(uDiskCount == 1 ) {
|
||||
// showFristWindow(uVolumeSum,uVolumeNum,strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// }else {
|
||||
showMainWindow(uVolumeNum, uDiskCount,uVolumeSum ,vboxLayout2, strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
// }
|
||||
showMainWindow(uVolumeNum, uDiskCount,uVolumeSum ,vboxLayout2, strDriveId, strVolumeId, strMountId, strDriveName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2283,7 +2377,6 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
QString strVolumeId = QString::fromStdString(itVolumeInfo->second.strId);
|
||||
QString strMountId = QString::fromStdString(itVolumeInfo->second.mountInfo.strId);
|
||||
unsigned uVolumeType = 0; // 0:normal file volume, 1: cddata, 2:tele dev
|
||||
unsigned uVolumeSum = listVolumeInfo.size();
|
||||
if (!itVolumeInfo->second.mountInfo.strId.empty()) {
|
||||
string strMountUri = itVolumeInfo->second.mountInfo.strUri;
|
||||
if(g_str_has_prefix(strMountUri.c_str(),"file:///")) {
|
||||
|
@ -2311,32 +2404,17 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
}
|
||||
if (uDiskCount > 0) {
|
||||
if (uVolumeType == 1) { // deal with cd info
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(uVolumeSum, 1, "",strVolumeId,strMountId,strMainName,
|
||||
// strApiName, 1, "burn:///");
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, uVolumeSum, vboxLayout2, "", strVolumeId, strMountId, strMainName,
|
||||
strApiName, 1, "burn:///");
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1, vboxLayout2, "", strVolumeId, strMountId, strMainName,
|
||||
strApiName, 1, "burn:///");
|
||||
} else if (uVolumeType == 2) {
|
||||
QString telephoneName = tr("telephone device");
|
||||
QByteArray strTelePhone = telephoneName.toLocal8Bit();
|
||||
char *realTele = strTelePhone.data();
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(uVolumeSum,1, "",strVolumeId,strMountId,realTele,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, uVolumeSum,vboxLayout2, "", strVolumeId, strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", strVolumeId, strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
} else {
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(uVolumeSum, 1, "", strVolumeId, strMountId, strMainName,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, uVolumeSum,vboxLayout2, "", strVolumeId, strMountId, strMainName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", strVolumeId, strMountId, strMainName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2375,52 +2453,33 @@ void MainWindow::MainWindowShow(bool isUpdate)
|
|||
}
|
||||
if (uDiskCount > 0) {
|
||||
if (uMountType == 1) { // deal with cd info
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(1, 1, "","",strMountId,strMainName,
|
||||
// strApiName, 1, "burn:///");
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, 1, vboxLayout2, "", "", strMountId, strMainName,
|
||||
strApiName, 1, "burn:///");
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1, vboxLayout2, "", "", strMountId, strMainName,
|
||||
strApiName, 1, "burn:///");
|
||||
} else if (uMountType == 2) {
|
||||
QString telephoneName = tr("telephone device");
|
||||
QByteArray strTelePhone = telephoneName.toLocal8Bit();
|
||||
char *realTele = strTelePhone.data();
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(1,1, "", "",strMountId,realTele,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", "", strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", "", strMountId, realTele,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
|
||||
} else {
|
||||
// if(uDiskCount == 1) {
|
||||
// showFristWindow(1, 1, "", "", strMountId, strMainName,
|
||||
// strApiName, lluTotalSize, strMountUri);
|
||||
// } else {
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", "", strMountId, strMainName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
// }
|
||||
showMainWindow(1, uDiskCount, 1,vboxLayout2, "", "", strMountId, strMainName,
|
||||
strApiName, lluTotalSize, strMountUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!insertorclick){
|
||||
qDebug()<<"-----------tt show main -------------";
|
||||
int uhign = 0;
|
||||
for(int i = 0; i<6; i++){
|
||||
for(int i = 0; i<7; i++){
|
||||
if(centralWidgetList[i]!=NULL){
|
||||
centralWidgetList[i]->setParent(m_basewidget);
|
||||
centralWidgetList[i]->setProperty("useSystemStyleBlur", true);
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(centralWidgetList[i]);
|
||||
m_basewidget->mainWindowVboxLayout->addWidget(centralWidgetList[i]);
|
||||
qDebug()<<"--------窗口高度"<<centralWidgetList[i]->m_mainWindowHigh;
|
||||
uhign += centralWidgetList[i]->m_mainWindowHigh;
|
||||
centralWidgetList[i]->show();
|
||||
}
|
||||
}
|
||||
m_basewidget->setFixedSize(420, uhign+80);
|
||||
//onMaininterfacehide();
|
||||
m_basewidget->setFixedSize(388, 0); //height自动适配高度
|
||||
ui->centralWidget->hide();
|
||||
m_basewidget->show();
|
||||
m_basewidget->showBaseWindow();
|
||||
moveBaseWidgetGeo();
|
||||
}
|
||||
}
|
||||
|
@ -2454,10 +2513,11 @@ void MainWindow::ifgetPinitMount()
|
|||
void MainWindow::onMaininterfacehide()
|
||||
{
|
||||
ui->centralWidget->hide();
|
||||
for(int i = 1;i<=5;i++){
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (centralWidgetList[i] && !centralWidgetList[i]->isHidden()) {
|
||||
centralWidgetList[i]->hide();
|
||||
centralWidgetList[i] = 0;
|
||||
delete centralWidgetList[i];
|
||||
centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
this->driveVolumeNum = 0;
|
||||
|
@ -2503,7 +2563,7 @@ void MainWindow::moveBottomNoBase()
|
|||
|
||||
#endif
|
||||
// MARGIN 为到任务栏或屏幕边缘的间隔
|
||||
#define MARGIN 4
|
||||
#define MARGIN 8
|
||||
QDBusInterface iface("org.ukui.panel",
|
||||
"/panel/position",
|
||||
"org.ukui.panel",
|
||||
|
@ -2551,7 +2611,7 @@ void MainWindow::moveBottomNoBase()
|
|||
void MainWindow::moveBaseWidgetGeo()
|
||||
{
|
||||
// MARGIN 为到任务栏或屏幕边缘的间隔
|
||||
#define MARGIN 4
|
||||
#define MARGIN 8
|
||||
QDBusInterface iface("org.ukui.panel",
|
||||
"/panel/position",
|
||||
"org.ukui.panel",
|
||||
|
@ -2560,7 +2620,7 @@ void MainWindow::moveBaseWidgetGeo()
|
|||
|
||||
if (!iface.isValid() || !iface.isValid() || reply.value().size()<5) {
|
||||
qCritical() << QDBusConnection::sessionBus().lastError().message();
|
||||
ui->centralWidget->setGeometry(0,0,ui->centralWidget->width(),ui->centralWidget->height());
|
||||
m_basewidget->setGeometry(0,0,m_basewidget->width(),m_basewidget->height());
|
||||
} else {
|
||||
// reply获取的参数共5个,分别是 主屏可用区域的起点x坐标,主屏可用区域的起点y坐标,主屏可用区域的宽度,主屏可用区域高度,任务栏位置
|
||||
QVariantList position_list=reply.value();
|
||||
|
@ -2663,24 +2723,24 @@ void MainWindow::getTransparentData()
|
|||
|
||||
void MainWindow::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
rect.adjust(1, 1, -1, -1);
|
||||
path.addRoundedRect(rect, 4, 4);
|
||||
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
||||
// QPainterPath path;
|
||||
// auto rect = this->rect();
|
||||
// rect.adjust(1, 1, -1, -1);
|
||||
// path.addRoundedRect(rect, 4, 4);
|
||||
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
||||
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
QRect rectReal = this->rect();
|
||||
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
p.setBrush(opt.palette.color(QPalette::Base));
|
||||
p.setOpacity(m_transparency);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(rectReal, 4, 4);
|
||||
QWidget::paintEvent(event);
|
||||
// QStyleOption opt;
|
||||
// opt.init(this);
|
||||
// QPainter p(this);
|
||||
// QRect rectReal = this->rect();
|
||||
// p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
// p.setBrush(opt.palette.color(QPalette::Base));
|
||||
// p.setOpacity(m_transparency);
|
||||
// p.setPen(Qt::NoPen);
|
||||
// p.drawRoundedRect(rectReal, 4, 4);
|
||||
// QWidget::paintEvent(event);
|
||||
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
||||
// KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
||||
}
|
||||
|
||||
void MainWindow::onEjectVolumeForce(GVolume *v)
|
||||
|
@ -2806,8 +2866,7 @@ void MainWindow::frobnitz_result_func(GDrive *source_object,GAsyncResult *res,Ma
|
|||
}else{
|
||||
p_this->chooseDialog->updateContentLable(QString::fromStdString(driveInfo.strId));
|
||||
}
|
||||
p_this->chooseDialog->show();
|
||||
p_this->chooseDialog->setFocus();
|
||||
p_this->chooseDialog->showInteractivDialog();
|
||||
p_this->connect(p_this->chooseDialog,&interactiveDialog::FORCESIG,p_this,[=]() {
|
||||
g_drive_eject_with_operation(source_object,
|
||||
G_MOUNT_UNMOUNT_FORCE,
|
||||
|
@ -2882,14 +2941,16 @@ void MainWindow::onClickedEject(EjectDeviceInfo eDeviceInfo)
|
|||
m_curEjectDeviceInfo.pVoid = this;
|
||||
m_curEjectDeviceInfo.uFlag = G_MOUNT_UNMOUNT_NONE;
|
||||
qDebug()<<"-------- eject !----";
|
||||
for(int i = 1;i<=5;i++){
|
||||
for(int i = 1;i<=7;i++){
|
||||
if (centralWidgetList[i]) {
|
||||
qDebug()<<"-------- eject clean -----";
|
||||
centralWidgetList[i]->hide();
|
||||
centralWidgetList[i] = 0;
|
||||
delete centralWidgetList[i];
|
||||
centralWidgetList[i] = nullptr;
|
||||
}
|
||||
}
|
||||
m_basewidget->hide();
|
||||
FlashDiskData::getInstance()->setClickToEject();
|
||||
doRealEject(&m_curEjectDeviceInfo, G_MOUNT_UNMOUNT_NONE);
|
||||
}
|
||||
|
||||
|
@ -3004,6 +3065,16 @@ bool MainWindow::doRealEject(EjectDeviceInfo* peDeviceInfo, GMountUnmountFlags f
|
|||
g_free(devPath);
|
||||
}
|
||||
}
|
||||
if((devName.startsWith ("/dev/sr"))&&ifBurnerBusy(devName)){
|
||||
qInfo()<<"the devname is"<<devName;
|
||||
if (this->chooseDialog == nullptr) {
|
||||
this->chooseDialog = new interactiveDialog(devName, this->ui->centralWidget);
|
||||
}else{
|
||||
this->chooseDialog->updateContentLable(devName);
|
||||
}
|
||||
this->chooseDialog->showInteractivDialog();
|
||||
return true;
|
||||
}
|
||||
if (devDrive != NULL) {
|
||||
if (devDrive != NULL) {
|
||||
if (peDeviceInfo->strMountUri.isEmpty()) {
|
||||
|
@ -3057,29 +3128,78 @@ bool MainWindow::doRealEject(EjectDeviceInfo* peDeviceInfo, GMountUnmountFlags f
|
|||
}
|
||||
}
|
||||
|
||||
//about mount not associated with a volume
|
||||
if (!isDone && !peDeviceInfo->strMountId.isEmpty()) {
|
||||
current_mount_list = g_volume_monitor_get_mounts(g_volume_monitor);
|
||||
if (current_mount_list) {
|
||||
for (lMount = current_mount_list; lMount != NULL; lMount = lMount->next) {
|
||||
GMount *gmount = (GMount *)lMount->data;
|
||||
QString strId = "";
|
||||
char *mountId = g_mount_get_uuid(gmount);
|
||||
if (mountId) {
|
||||
strId = mountId;
|
||||
g_free(mountId);
|
||||
}
|
||||
// get mount uri
|
||||
GFile *root = g_mount_get_default_location(gmount);
|
||||
if (root) {
|
||||
char *mountUri = g_file_get_uri(root); //get挂载点的uri路径
|
||||
if (mountUri) {
|
||||
if (strId.isEmpty()) {
|
||||
strId = mountUri;
|
||||
}
|
||||
g_free(mountUri);
|
||||
}
|
||||
g_object_unref(root);
|
||||
}
|
||||
if (peDeviceInfo->strMountId == strId) {
|
||||
devMount = gmount;
|
||||
devDrive = g_mount_get_drive(gmount); //bug146099在各别云桌面上可能存在无法通过volume找到gdrive的问题,增加通过Mount查找Gdrive移除设备
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (devMount != NULL) {
|
||||
if(devDrive!= NULL){
|
||||
QString devNamefromDev = g_drive_get_identifier(devDrive,G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE);
|
||||
if(!devNamefromDev.startsWith("/dev/sr")&& (g_drive_can_stop(devDrive) || g_drive_is_removable(devDrive))){
|
||||
g_drive_stop(devDrive, flag, NULL, NULL, GAsyncReadyCallback(driveStopCb), peDeviceInfo);
|
||||
isDone = true;
|
||||
}else{
|
||||
qInfo()<<"can_stop:"<<g_drive_can_stop(devDrive)<<"is remove:"<<g_drive_is_removable(devDrive);
|
||||
}
|
||||
}else{
|
||||
g_mount_unmount_with_operation(devMount,
|
||||
flag,
|
||||
NULL,
|
||||
NULL,
|
||||
GAsyncReadyCallback(&MainWindow::frobnitz_force_result_unmount),
|
||||
peDeviceInfo->pVoid);
|
||||
isDone = true;
|
||||
}
|
||||
}
|
||||
g_list_free(current_mount_list);
|
||||
current_mount_list = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//about volume not associated with a drive
|
||||
if (!isDone && !peDeviceInfo->strVolumeId.isEmpty()) {
|
||||
current_volume_list = g_volume_monitor_get_volumes(g_volume_monitor);
|
||||
if (current_volume_list) {
|
||||
for (lVolume = current_volume_list; lVolume != NULL; lVolume = lVolume->next) {
|
||||
GVolume *volume = (GVolume *)lVolume->data;
|
||||
GDrive *gdrive = g_volume_get_drive(volume);
|
||||
if (!gdrive) {
|
||||
char *volumeId = g_volume_get_identifier(volume,G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
|
||||
if (volumeId) {
|
||||
if (peDeviceInfo->strVolumeId != volumeId) {
|
||||
g_free(volumeId);
|
||||
continue;
|
||||
}
|
||||
char *volumeId = g_volume_get_identifier(volume,G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
|
||||
if (volumeId) {
|
||||
if (peDeviceInfo->strVolumeId != volumeId) {
|
||||
g_free(volumeId);
|
||||
} else {
|
||||
continue ;
|
||||
continue;
|
||||
}
|
||||
devVolume = volume;
|
||||
break;
|
||||
g_free(volumeId);
|
||||
} else {
|
||||
g_object_unref(gdrive);
|
||||
continue ;
|
||||
}
|
||||
devVolume = volume;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (devVolume != NULL) {
|
||||
|
@ -3101,53 +3221,6 @@ bool MainWindow::doRealEject(EjectDeviceInfo* peDeviceInfo, GMountUnmountFlags f
|
|||
}
|
||||
}
|
||||
|
||||
//about mount not associated with a volume
|
||||
if (!isDone && !peDeviceInfo->strMountId.isEmpty()) {
|
||||
current_mount_list = g_volume_monitor_get_mounts(g_volume_monitor);
|
||||
if (current_mount_list) {
|
||||
for (lMount = current_mount_list; lMount != NULL; lMount = lMount->next) {
|
||||
GMount *gmount = (GMount *)lMount->data;
|
||||
GVolume *gvolume = g_mount_get_volume(gmount);
|
||||
if (!gvolume) {
|
||||
QString strId = "";
|
||||
char *mountId = g_mount_get_uuid(gmount);
|
||||
if (mountId) {
|
||||
strId = mountId;
|
||||
g_free(mountId);
|
||||
}
|
||||
// get mount uri
|
||||
GFile *root = g_mount_get_default_location(gmount);
|
||||
if (root) {
|
||||
char *mountUri = g_file_get_uri(root); //get挂载点的uri路径
|
||||
if (mountUri) {
|
||||
if (strId.isEmpty()) {
|
||||
strId = mountUri;
|
||||
}
|
||||
g_free(mountUri);
|
||||
}
|
||||
g_object_unref(root);
|
||||
}
|
||||
if (peDeviceInfo->strMountId == strId) {
|
||||
devMount = gmount;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
g_object_unref(gvolume);
|
||||
}
|
||||
}
|
||||
if (devMount != NULL) {
|
||||
g_mount_unmount_with_operation(devMount,
|
||||
flag,
|
||||
NULL,
|
||||
NULL,
|
||||
GAsyncReadyCallback(&MainWindow::frobnitz_force_result_unmount),
|
||||
peDeviceInfo->pVoid);
|
||||
isDone = true;
|
||||
}
|
||||
g_list_free(current_mount_list);
|
||||
current_mount_list = NULL;
|
||||
}
|
||||
}
|
||||
if (!isDone) {
|
||||
FDMountInfo mountInfo;
|
||||
FDVolumeInfo volumeInfo;
|
||||
|
@ -3193,8 +3266,7 @@ GAsyncReadyCallback MainWindow::fileEjectMountableCB(GFile *file, GAsyncResult *
|
|||
if (pThis->chooseDialog == nullptr) {
|
||||
pThis->chooseDialog = new interactiveDialog(QString::fromStdString(driveInfo.strId), pThis->ui->centralWidget);
|
||||
}
|
||||
pThis->chooseDialog->show();
|
||||
pThis->chooseDialog->setFocus();
|
||||
pThis->chooseDialog->showInteractivDialog();
|
||||
pThis->connect(pThis->chooseDialog,&interactiveDialog::FORCESIG,pThis,[=]() {
|
||||
pThis->chooseDialog->close();
|
||||
peDeviceInfo->uFlag = G_MOUNT_UNMOUNT_FORCE;
|
||||
|
@ -3234,8 +3306,7 @@ void MainWindow::driveStopCb(GObject* object, GAsyncResult* res, EjectDeviceInfo
|
|||
if (pThis->chooseDialog == nullptr) {
|
||||
pThis->chooseDialog = new interactiveDialog(QString::fromStdString(driveInfo.strId), pThis->ui->centralWidget);
|
||||
}
|
||||
pThis->chooseDialog->show();
|
||||
pThis->chooseDialog->setFocus();
|
||||
pThis->chooseDialog->showInteractivDialog();
|
||||
pThis->connect(pThis->chooseDialog,&interactiveDialog::FORCESIG,pThis,[=]() {
|
||||
pThis->chooseDialog->close();
|
||||
peDeviceInfo->uFlag = G_MOUNT_UNMOUNT_FORCE;
|
||||
|
@ -3433,6 +3504,7 @@ bool MainWindow::getDataCDRomCapacity(QString strDevId, quint64 &totalCapacity)
|
|||
totalCapacity = uTotalCapacity;
|
||||
return true;
|
||||
} else {
|
||||
qInfo()<<"the CD/DVD's capacicy is 0";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3488,6 +3560,53 @@ void MainWindow::getMountIconsInfo(GMount* mount, FDMountInfo& mountInfo)
|
|||
}
|
||||
}
|
||||
|
||||
//check if burner is busy
|
||||
bool MainWindow::ifBurnerBusy(QString strDev){
|
||||
|
||||
bool ret = false;
|
||||
QDBusInterface interface( "com.kylin.burner.manager",
|
||||
"/com/kylin/burner/manager",
|
||||
"com.kylin.burner.manager",
|
||||
QDBusConnection::sessionBus() );
|
||||
if(interface.isValid()){
|
||||
QDBusReply<bool> reply = interface.call("isBusyDevice", strDev);
|
||||
ret = reply;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//check if gparted is busy
|
||||
bool MainWindow::ifGpartedBusy(){
|
||||
|
||||
QString filename = "/usr/share/kylin-device-daemon/kylin-device-daemon.ini";
|
||||
QSettings m_settings(filename, QSettings::IniFormat);
|
||||
bool ret = true;
|
||||
bool ifmounted = true;
|
||||
m_settings.setIniCodec("UTF-8");
|
||||
m_settings.beginGroup("Gparted");
|
||||
ifmounted = m_settings.value("automounted").toBool();
|
||||
|
||||
//判断分区编辑器进程是否存在
|
||||
FILE* fp;
|
||||
char szbuffer[16] = {0};
|
||||
fp = popen("ps -ef|grep gpartedbin | grep -v grep |wc -l", "r");
|
||||
//1:存在 0:不存在
|
||||
size_t sizeread = fread(szbuffer, 1, 1, fp); //第一个字节就是fp读取出来的结果 0或1,一个字节就可以,sizeof(szbuffer)会有空格补齐,strcmp对比时有误
|
||||
if (sizeread > 0){
|
||||
if(strcmp(szbuffer, "1") == 0){
|
||||
qInfo()<<"gparted is exist.";
|
||||
if(!ifmounted)
|
||||
ret = false;
|
||||
}
|
||||
}else{
|
||||
qInfo()<<"read false";
|
||||
}
|
||||
|
||||
pclose(fp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if UDFAUTOMOUNT
|
||||
static void eject_cdrom (GDrive* drive, gpointer u)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
int driveMountNum;
|
||||
vector<string> m_vtDeviveId;
|
||||
EjectDeviceInfo m_curEjectDeviceInfo;
|
||||
FDClickWidget *m_iconClickWidget;
|
||||
|
||||
void MainWindowShow(bool isUpdate = false);
|
||||
void initTransparentState();
|
||||
|
@ -123,7 +124,7 @@ private:
|
|||
bool m_bIsMouseInCentral = false;
|
||||
qint64 m_nAppStartTimestamp = 0; // 进程启动时的时间戳
|
||||
QString m_strSysRootDev;
|
||||
FDFrame *centralWidgetList[6] = {0};
|
||||
FDFrame *centralWidgetList[FLASHDISKITEM_SHOWDISK_MAX] = {0};
|
||||
baseWidget * m_basewidget;
|
||||
|
||||
bool mIsrunning = false;
|
||||
|
@ -157,7 +158,7 @@ private:
|
|||
QString volumeName,
|
||||
quint64 capacityDis,
|
||||
QString strMountUri,
|
||||
int linestatus);
|
||||
int uVolumeSum);
|
||||
void showMainWindow(int uVolumeNum,
|
||||
int uDiskCount,
|
||||
quint64 uVolumeSum,
|
||||
|
@ -213,6 +214,10 @@ private:
|
|||
void getVolumeIconsInfo(GVolume* volume, FDVolumeInfo& volumeInfo);
|
||||
void getMountIconsInfo(GMount* mount, FDMountInfo& mountInfo);
|
||||
bool getDevInterface(QString strDev);
|
||||
bool ifBurnerBusy(QString strDev);
|
||||
bool ifGpartedBusy();
|
||||
bool ifNewInsertVol();
|
||||
void hideAllWidget();
|
||||
|
||||
public Q_SLOTS:
|
||||
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
|
@ -220,7 +225,7 @@ public Q_SLOTS:
|
|||
void onConvertUpdateWindow(QString strDevName, unsigned uDevType);
|
||||
void onMaininterfacehide();
|
||||
void on_clickPanelToHideInterface();
|
||||
void onRequestSendDesktopNotify(QString message, QString strIcon);
|
||||
void onRequestSendDesktopNotify(QString message, QString strIcon, QString notifySound);
|
||||
void onInsertAbnormalDiskNotify(QString message);
|
||||
void onNotifyWnd(QObject* obj, QEvent *event);
|
||||
void onClickedEject(EjectDeviceInfo eDeviceInfo);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <QPainterPath>
|
||||
#include <QAction>
|
||||
#include <QAbstractItemView>
|
||||
#include <QRadioButton>
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
|
@ -137,6 +138,7 @@ RepairDialogBox::~RepairDialogBox()
|
|||
{
|
||||
if (mDrive) g_object_unref(mDrive);
|
||||
if (mVolume) g_object_unref(mVolume);
|
||||
if (mfontSettings) delete mfontSettings;
|
||||
}
|
||||
|
||||
void RepairDialogBox::initUI()
|
||||
|
@ -146,32 +148,31 @@ void RepairDialogBox::initUI()
|
|||
setBackgroundRole(QPalette::Base);
|
||||
setContentsMargins(24, 24, 24, 24);
|
||||
|
||||
setWindowIcon(QIcon::fromTheme("system-file-manager"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
//setWindowIcon(QIcon::fromTheme("system-file-manager"));
|
||||
//setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
|
||||
QGSettings* fontSettings = nullptr;
|
||||
const QByteArray id1(THEME_QT_SCHEMA);
|
||||
static int fontSize;
|
||||
static float fontSize;
|
||||
|
||||
if(QGSettings::isSchemaInstalled(id1))
|
||||
{
|
||||
fontSettings = new QGSettings(id1);
|
||||
mfontSettings = new QGSettings(id1);
|
||||
}
|
||||
|
||||
fontSize = fontSettings->get(FONT_SIZE).toString().toFloat();
|
||||
if((fontSize>=14)&&(qgetenv ("GDM_LANG") == "en"))
|
||||
fontSize = mfontSettings->get(FONT_SIZE).toString().toFloat();
|
||||
if((fontSize>=13)&&(qgetenv ("GDM_LANG") == "en"))
|
||||
{
|
||||
setFixedSize(mFixWidth, mFixHeight+55);
|
||||
setFixedSize(mFixWidth, mFixHeight+75);
|
||||
}else{
|
||||
setFixedSize(mFixWidth, mFixHeight);
|
||||
}
|
||||
QObject::connect(fontSettings,&QGSettings::changed,[=](QString key)
|
||||
QObject::connect(mfontSettings,&QGSettings::changed,[=](QString key)
|
||||
{
|
||||
if(mshowflag){
|
||||
fontSize = fontSettings->get(FONT_SIZE).toString().toFloat();
|
||||
if((fontSize>=14)&&(qgetenv ("GDM_LANG") == "en"))
|
||||
fontSize = mfontSettings->get(FONT_SIZE).toString().toFloat();
|
||||
if((fontSize>=13)&&(qgetenv ("GDM_LANG") == "en"))
|
||||
{
|
||||
setFixedSize(mFixWidth, mFixHeight+55);
|
||||
setFixedSize(mFixWidth, mFixHeight+75);
|
||||
}
|
||||
else{
|
||||
setFixedSize(mFixWidth, mFixHeight);
|
||||
|
@ -339,7 +340,7 @@ void RepairProgressBar::initUI()
|
|||
setBackgroundRole(QPalette::Base);
|
||||
setContentsMargins(24, 24, 24, 24);
|
||||
setFixedSize(mFixWidth, mFixHeight);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
//setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
|
||||
mTimer = new QTimer;
|
||||
mTimer->setInterval(1000);
|
||||
|
@ -488,8 +489,8 @@ void FormateDialog::initUI()
|
|||
setBackgroundRole(QPalette::Base);
|
||||
setContentsMargins(24, 24, 24, 24);
|
||||
setFixedSize(mFixWidth, mFixHeight);
|
||||
setWindowIcon(QIcon::fromTheme("system-file-manager"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
//setWindowIcon(QIcon::fromTheme("system-file-manager"));
|
||||
//setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||
|
||||
QGridLayout* mainLayout = new QGridLayout(this);
|
||||
|
||||
|
@ -522,10 +523,16 @@ void FormateDialog::initUI()
|
|||
mainLayout->addWidget(mNameEdit, 3, 3, 1, 6);
|
||||
|
||||
QLabel* eraseLabel = new QLabel;
|
||||
eraseLabel->setWordWrap(true);
|
||||
eraseLabel->setText(tr("Completely erase(Time is longer, please confirm!)"));
|
||||
mEraseCkbox = new QCheckBox;
|
||||
|
||||
QPalette * Boxpalette = new QPalette();
|
||||
Boxpalette->setBrush(QPalette::Base, QColor(100,100,100));
|
||||
mEraseCkbox->setPalette(*Boxpalette);
|
||||
|
||||
mainLayout->addWidget(mEraseCkbox, 4, 1, 1, 1, Qt::AlignRight);
|
||||
mainLayout->addWidget(eraseLabel, 4, 2, 1, 6, Qt::AlignLeft);
|
||||
mainLayout->addWidget(eraseLabel, 4, 2, 1, 8, Qt::AlignLeft);
|
||||
|
||||
mProgress = new QProgressBar;
|
||||
mProgress->setMinimum(0);
|
||||
|
@ -533,7 +540,7 @@ void FormateDialog::initUI()
|
|||
mainLayout->addWidget(mProgress, 5, 1, 1, 8);
|
||||
|
||||
mCancelBtn = new QPushButton(tr("Cancel"));
|
||||
mFormatBtn = new QPushButton(tr("Format disk"));
|
||||
mFormatBtn = new QPushButton(tr("Format"));
|
||||
|
||||
mainLayout->addWidget(mCancelBtn, 6, 5, 1, 2, Qt::AlignRight);
|
||||
mainLayout->addWidget(mFormatBtn, 6, 7, 1, 2, Qt::AlignRight);
|
||||
|
@ -599,6 +606,11 @@ BaseDialog::BaseDialog(QWidget *parent) : QDialog(parent)
|
|||
popuView->setPalette(p);
|
||||
popuView->update();
|
||||
}
|
||||
if (QCheckBox * checkbo = qobject_cast<QCheckBox*>(obj)) {
|
||||
QPalette * Boxpalette = new QPalette();
|
||||
Boxpalette->setBrush(QPalette::Base, QColor(100,100,100));
|
||||
checkbo->setPalette(*Boxpalette);
|
||||
}
|
||||
}
|
||||
}
|
||||
setPalette(p);
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
QString mDeviceName = nullptr;
|
||||
GDrive* mDrive = nullptr;
|
||||
GVolume* mVolume = nullptr;
|
||||
QGSettings* mfontSettings = nullptr;
|
||||
};
|
||||
|
||||
class RepairProgressBar : public BaseDialog
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
if (MainWindow->objectName().isEmpty())
|
||||
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
||||
MainWindow->resize(400, 300);
|
||||
centralWidget = new FDFrame(MainWindow);
|
||||
centralWidget = new FDFrame();
|
||||
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
|
||||
MainWindow->setCentralWidget(centralWidget);
|
||||
|
||||
|
|
|
@ -35,12 +35,16 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Eject</source>
|
||||
<translation>འཕར་ཐོན།</translation>
|
||||
<translation type="vanished">འཕར་ཐོན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unmounted</source>
|
||||
<translation>མ་རྩ་ཅན་དུ་འགྱུར་བར་བྱ་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>eject</source>
|
||||
<translation type="unfinished">ཕྱིར་འབུད་བྱེད་པ།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FDFrame</name>
|
||||
|
@ -85,7 +89,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Format disk</source>
|
||||
<translation>རྣམ་གཞག་གི་ཁབ་ལེན་སྡེར་མ</translation>
|
||||
<translation type="vanished">རྣམ་གཞག་གི་ཁབ་ལེན་སྡེར་མ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Formatting this volume will erase all data on it. Please back up all retained data before formatting. Do you want to continue?</source>
|
||||
|
@ -267,13 +271,6 @@
|
|||
<translation>ཞིག་གསོ་བྱེད་མ་ཐུབ་པ་རེད། གལ་ཏེ་ཨ་སྒོར་གྱི་གློག་འཁྱུག་སྡེར་མ་སྒྲིག་སྦྱོར་མ་བྱས་ན། སྒྲིག་ཆས་འདི་ཚོད་ལྟ་ཞིག་བྱེད་རོགས།!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>baseWidget</name>
|
||||
<message>
|
||||
<source>removable storage device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ejectInterface</name>
|
||||
<message>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<translation type="obsolete">another device</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Eject</source>
|
||||
<source>eject</source>
|
||||
<translation>Çıkar</translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -83,10 +83,6 @@
|
|||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format disk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Formatting this volume will erase all data on it. Please back up all retained data before formatting. Do you want to continue?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -235,13 +231,6 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>baseWidget</name>
|
||||
<message>
|
||||
<source>removable storage device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ejectInterface</name>
|
||||
<message>
|
||||
|
|
|
@ -35,12 +35,16 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Eject</source>
|
||||
<translation>弹出</translation>
|
||||
<translation type="vanished">弹出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unmounted</source>
|
||||
<translation>未装载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>eject</source>
|
||||
<translation type="unfinished">弹出</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FDFrame</name>
|
||||
|
@ -85,7 +89,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Format disk</source>
|
||||
<translation>格式化</translation>
|
||||
<translation type="vanished">格式化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Formatting this volume will erase all data on it. Please back up all retained data before formatting. Do you want to continue?</source>
|
||||
|
@ -271,7 +275,7 @@
|
|||
<name>baseWidget</name>
|
||||
<message>
|
||||
<source>removable storage device</source>
|
||||
<translation>可移动存储设备</translation>
|
||||
<translation type="vanished">可移动存储设备</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
Loading…
Reference in New Issue