mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Merge branch 'fanpengcheng/uos_clearcompilewarning' into 'uos'
Fanpengcheng/uos clearcompilewarning See merge request dde-v20/dde-dock!589
This commit is contained in:
commit
9f45c93872
@ -56,15 +56,17 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent)
|
||||
, m_wid(wid)
|
||||
, m_title(new TipsWidget)
|
||||
, m_waitLeaveTimer(new QTimer(this))
|
||||
, m_closeBtn2D(new DImageButton)
|
||||
, m_closeBtn2D(new DIconButton(this))
|
||||
, m_wmHelper(DWindowManagerHelper::instance())
|
||||
{
|
||||
m_closeBtn2D->setFixedSize(24, 24);
|
||||
m_closeBtn2D->setIconSize(QSize(24, 24));
|
||||
m_closeBtn2D->setObjectName("closebutton-2d");
|
||||
m_closeBtn2D->setNormalPic(":/icons/resources/close_round_normal.svg");
|
||||
m_closeBtn2D->setHoverPic(":/icons/resources/close_round_hover.svg");
|
||||
m_closeBtn2D->setPressPic(":/icons/resources/close_round_press.svg");
|
||||
m_closeBtn2D->setIcon(QIcon(":/icons/resources/close_round_normal.svg"));
|
||||
m_closeBtn2D->setVisible(false);
|
||||
m_closeBtn2D->setFlat(true);
|
||||
m_closeBtn2D->installEventFilter(this);
|
||||
|
||||
m_title->setObjectName("AppSnapshotTitle");
|
||||
|
||||
QHBoxLayout *centralLayout = new QHBoxLayout;
|
||||
@ -79,7 +81,7 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent)
|
||||
setAcceptDrops(true);
|
||||
resize(SNAP_WIDTH, SNAP_HEIGHT);
|
||||
|
||||
connect(m_closeBtn2D, &DImageButton::clicked, this, &AppSnapshot::closeWindow, Qt::QueuedConnection);
|
||||
connect(m_closeBtn2D, &DIconButton::clicked, this, &AppSnapshot::closeWindow, Qt::QueuedConnection);
|
||||
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &AppSnapshot::compositeChanged, Qt::QueuedConnection);
|
||||
QTimer::singleShot(1, this, &AppSnapshot::compositeChanged);
|
||||
}
|
||||
@ -270,6 +272,23 @@ void AppSnapshot::mousePressEvent(QMouseEvent *e)
|
||||
emit clicked(m_wid);
|
||||
}
|
||||
|
||||
bool AppSnapshot::eventFilter(QObject *watched, QEvent *e)
|
||||
{
|
||||
if(watched == m_closeBtn2D) {
|
||||
if(watched == m_closeBtn2D && (e->type() == QEvent::HoverEnter || e->type() == QEvent::HoverMove)) {
|
||||
m_closeBtn2D->setIcon(QIcon(":/icons/resources/close_round_hover.svg"));
|
||||
}
|
||||
else if (watched == m_closeBtn2D && e->type() == QEvent::HoverLeave) {
|
||||
m_closeBtn2D->setIcon(QIcon(":/icons/resources/close_round_normal.svg"));
|
||||
}
|
||||
else if (watched == m_closeBtn2D && e->type() == QEvent::MouseButtonPress) {
|
||||
m_closeBtn2D->setIcon(QIcon(":/icons/resources/close_round_press.svg"));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
SHMInfo *AppSnapshot::getImageDSHM()
|
||||
{
|
||||
const auto display = QX11Info::display();
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <QTimer>
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <dimagebutton.h>
|
||||
#include <DIconButton>
|
||||
#include <DWindowManagerHelper>
|
||||
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
@ -69,14 +69,15 @@ public slots:
|
||||
void setWindowInfo(const WindowInfo &info);
|
||||
|
||||
private:
|
||||
void dragEnterEvent(QDragEnterEvent *e);
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
|
||||
void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
|
||||
void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
|
||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
bool eventFilter(QObject *watched, QEvent *e) Q_DECL_OVERRIDE;
|
||||
SHMInfo *getImageDSHM();
|
||||
XImage * getImageXlib();
|
||||
XImage *getImageXlib();
|
||||
QRect rectRemovedShadow(const QImage &qimage, unsigned char *prop_to_return_gtk);
|
||||
|
||||
private:
|
||||
@ -90,7 +91,7 @@ private:
|
||||
|
||||
TipsWidget *m_title;
|
||||
QTimer *m_waitLeaveTimer;
|
||||
DImageButton *m_closeBtn2D;
|
||||
DIconButton *m_closeBtn2D;
|
||||
DWindowManagerHelper *m_wmHelper;
|
||||
};
|
||||
|
||||
|
@ -35,14 +35,15 @@
|
||||
|
||||
FloatingPreview::FloatingPreview(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_closeBtn3D(new DImageButton)
|
||||
, m_closeBtn3D(new DIconButton(this))
|
||||
, m_titleBtn(new DPushButton)
|
||||
{
|
||||
m_closeBtn3D->setObjectName("closebutton-3d");
|
||||
m_closeBtn3D->setFixedSize(24, 24);
|
||||
m_closeBtn3D->setNormalPic(":/icons/resources/close_round_normal.svg");
|
||||
m_closeBtn3D->setHoverPic(":/icons/resources/close_round_hover.svg");
|
||||
m_closeBtn3D->setPressPic(":/icons/resources/close_round_press.svg");
|
||||
m_closeBtn3D->setIconSize(QSize(24, 24));
|
||||
m_closeBtn3D->setIcon(QIcon(":/icons/resources/close_round_normal.svg"));
|
||||
m_closeBtn3D->setFlat(true);
|
||||
m_closeBtn3D->installEventFilter(this);
|
||||
|
||||
m_titleBtn->setBackgroundRole(QPalette::Base);
|
||||
m_titleBtn->setForegroundRole(QPalette::Text);
|
||||
@ -61,7 +62,7 @@ FloatingPreview::FloatingPreview(QWidget *parent)
|
||||
setLayout(centralLayout);
|
||||
setFixedSize(SNAP_WIDTH, SNAP_HEIGHT);
|
||||
|
||||
connect(m_closeBtn3D, &DImageButton::clicked, this, &FloatingPreview::onCloseBtnClicked);
|
||||
connect(m_closeBtn3D, &DIconButton::clicked, this, &FloatingPreview::onCloseBtnClicked);
|
||||
}
|
||||
|
||||
WId FloatingPreview::trackedWid() const
|
||||
@ -163,6 +164,18 @@ void FloatingPreview::mouseReleaseEvent(QMouseEvent *e)
|
||||
|
||||
bool FloatingPreview::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_closeBtn3D) {
|
||||
if(watched == m_closeBtn3D && (event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverMove)) {
|
||||
m_closeBtn3D->setIcon(QIcon(":/icons/resources/close_round_hover.svg"));
|
||||
}
|
||||
else if (watched == m_closeBtn3D && event->type() == QEvent::HoverLeave) {
|
||||
m_closeBtn3D->setIcon(QIcon(":/icons/resources/close_round_normal.svg"));
|
||||
}
|
||||
else if (watched == m_closeBtn3D && event->type() == QEvent::MouseButtonPress) {
|
||||
m_closeBtn3D->setIcon(QIcon(":/icons/resources/close_round_press.svg"));
|
||||
}
|
||||
}
|
||||
|
||||
if (watched == m_tracked && event->type() == QEvent::Destroy)
|
||||
hide();
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
|
||||
#include <dimagebutton.h>
|
||||
#include <DIconButton>
|
||||
#include <DPushButton>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
@ -56,7 +56,7 @@ private slots:
|
||||
private:
|
||||
QPointer<AppSnapshot> m_tracked;
|
||||
|
||||
DImageButton *m_closeBtn3D;
|
||||
DIconButton *m_closeBtn3D;
|
||||
DPushButton *m_titleBtn;
|
||||
};
|
||||
|
||||
|
@ -55,4 +55,5 @@ const QPixmap ImageUtil::loadSvg(const QString &iconName, const QSize size, cons
|
||||
pixmap.setDevicePixelRatio(ratio);
|
||||
return pixmap;
|
||||
}
|
||||
return QPixmap();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QScreen>
|
||||
|
||||
namespace Utils {
|
||||
static QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) {
|
||||
inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) {
|
||||
QImageReader reader;
|
||||
QPixmap pixmap;
|
||||
reader.setFileName(path);
|
||||
@ -20,7 +20,7 @@ namespace Utils {
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
static QScreen * screenAt(const QPoint &point) {
|
||||
inline QScreen * screenAt(const QPoint &point) {
|
||||
for (QScreen *screen : qApp->screens()) {
|
||||
const QRect r { screen->geometry() };
|
||||
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
||||
@ -32,7 +32,7 @@ namespace Utils {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static QScreen * screenAtByScaled(const QPoint &point) {
|
||||
inline QScreen * screenAtByScaled(const QPoint &point) {
|
||||
for (QScreen *screen : qApp->screens()) {
|
||||
if (screen->geometry().contains(point)) {
|
||||
return screen;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "../plugins/multitasking/multitaskingwidget.h"
|
||||
#include "../plugins/overlay-warning/overlaywarningwidget.h"
|
||||
|
||||
#include <DImageButton>
|
||||
#include <DIconButton>
|
||||
#include <DSwitchButton>
|
||||
#include <DPushButton>
|
||||
|
||||
@ -91,7 +91,7 @@ SET_FORM_ACCESSIBLE(ShowDesktopWidget, "plugin-showdesktop")
|
||||
SET_FORM_ACCESSIBLE(OverlayWarningWidget, "plugin-overlaywarningwidget")
|
||||
SET_FORM_ACCESSIBLE(QWidget, m_w->objectName().isEmpty() ? "widget" : m_w->objectName())
|
||||
SET_LABEL_ACCESSIBLE(QLabel, m_w->text().isEmpty() ? m_w->objectName().isEmpty() ? "text" : m_w->objectName() : m_w->text())
|
||||
SET_BUTTON_ACCESSIBLE(DImageButton, m_w->objectName().isEmpty() ? "imagebutton" : m_w->objectName())
|
||||
SET_BUTTON_ACCESSIBLE(DIconButton, m_w->objectName().isEmpty() ? "imagebutton" : m_w->objectName())
|
||||
SET_BUTTON_ACCESSIBLE(DSwitchButton, m_w->text().isEmpty() ? "switchbutton" : m_w->text())
|
||||
SET_BUTTON_ACCESSIBLE(DesktopWidget, "desktopWidget");
|
||||
QAccessibleInterface *accessibleFactory(const QString &classname, QObject *object)
|
||||
@ -141,8 +141,8 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_app");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_tray");
|
||||
USE_ACCESSIBLE(classname, QLabel);
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DImageButton, "closebutton-2d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DImageButton, "closebutton-3d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-2d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-3d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton, "");
|
||||
|
||||
return interface;
|
||||
|
@ -468,37 +468,6 @@ void MainWindow::internalMove(const QPoint &p)
|
||||
m_mainPanel->move(0, 0);
|
||||
return QWidget::move(p);
|
||||
}
|
||||
|
||||
|
||||
QPoint rp = rawXPosition(p);
|
||||
const auto ratio = devicePixelRatioF();
|
||||
|
||||
const QRect &r = m_settings->primaryRawRect();
|
||||
switch (m_curDockPos) {
|
||||
case Left: rp.setX(r.x()); break;
|
||||
case Top: rp.setY(r.y()); break;
|
||||
case Right: rp.setX(r.right() - 1); break;
|
||||
case Bottom: rp.setY(r.bottom() - 1); break;
|
||||
}
|
||||
|
||||
int hx = height() * ratio, wx = width() * ratio;
|
||||
if (m_settings->hideMode() != HideMode::KeepShowing &&
|
||||
isHide &&
|
||||
m_panelHideAni->state() == QVariantAnimation::Stopped &&
|
||||
m_panelShowAni->state() == QVariantAnimation::Stopped) {
|
||||
switch (m_curDockPos) {
|
||||
case Top:
|
||||
case Bottom:
|
||||
hx = 2;
|
||||
break;
|
||||
case Left:
|
||||
case Right:
|
||||
wx = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// using platform window to set real window position
|
||||
// windowHandle()->handle()->setGeometry(QRect(rp.x(), rp.y(), wx, hx));
|
||||
}
|
||||
|
||||
void MainWindow::initConnections()
|
||||
|
@ -33,8 +33,8 @@
|
||||
|
||||
DatetimePlugin::DatetimePlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_interface(nullptr)
|
||||
, m_pluginLoaded(false)
|
||||
{
|
||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||
sessionBus.connect("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged()));
|
||||
|
@ -24,8 +24,6 @@
|
||||
|
||||
#include "accesspoint.h"
|
||||
|
||||
#include <DImageButton>
|
||||
|
||||
#include <NetworkDevice>
|
||||
|
||||
#include <QWidget>
|
||||
|
@ -148,6 +148,7 @@ WiredItem::WiredStatus WiredItem::getDeviceState()
|
||||
case NetworkDevice::Deactivation:
|
||||
case NetworkDevice::Failed: return Failed;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
QJsonObject WiredItem::getActiveWiredConnectionInfo()
|
||||
|
@ -131,6 +131,7 @@ WirelessItem::WirelessStatus WirelessItem::getDeviceState()
|
||||
case NetworkDevice::Deactivation:
|
||||
case NetworkDevice::Failed: return Failed;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
QJsonObject &WirelessItem::getConnectedApInfo()
|
||||
|
@ -1245,6 +1245,8 @@ bool NetworkItem::isShowControlCenter()
|
||||
case Adisabled:
|
||||
case Bdisabled:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (m_pluginState) {
|
||||
@ -1255,6 +1257,8 @@ bool NetworkItem::isShowControlCenter()
|
||||
case Disconnected:
|
||||
case Disabled:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,9 @@ void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
||||
QPixmap PowerStatusWidget::getBatteryIcon()
|
||||
{
|
||||
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
||||
const uint value = qMin(100.0, qMax(0.0, data.value("Display")));
|
||||
const int percentage = std::round(value);
|
||||
const int batteryState = m_powerInter->batteryState()["Display"];
|
||||
const uint value = uint(qMin(100.0, qMax(0.0, data.value("Display"))));
|
||||
const int percentage = int(std::round(value));
|
||||
// const int batteryState = m_powerInter->batteryState()["Display"];
|
||||
const bool plugged = !m_powerInter->onBattery();
|
||||
|
||||
/*根据新需求,电池电量显示分别是*/
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <QApplication>
|
||||
|
||||
#include <DHiDPIHelper>
|
||||
#include <DGuiApplicationHelper>
|
||||
#include <DApplication>
|
||||
@ -33,7 +34,6 @@
|
||||
#define ICON_SIZE 24
|
||||
#define APP_TITLE_SIZE 110
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
DGUI_USE_NAMESPACE
|
||||
|
||||
const QPixmap getIconFromTheme(const QString &name, const QSize &size, const qreal ratio)
|
||||
@ -47,15 +47,17 @@ const QPixmap getIconFromTheme(const QString &name, const QSize &size, const qre
|
||||
SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_inputInter(new DBusSinkInput(inputPath, this))
|
||||
, m_volumeBtnMin(new DImageButton(this))
|
||||
, m_appBtn(new DIconButton(this))
|
||||
, m_volumeBtnMin(new DIconButton(this))
|
||||
, m_volumeIconMax(new QLabel(this))
|
||||
, m_appBtn(new DImageButton(this))
|
||||
, m_volumeSlider(new VolumeSlider(this))
|
||||
, m_volumeLabel(new TipsWidget(this))
|
||||
{
|
||||
const QString iconName = m_inputInter->icon();
|
||||
m_appBtn->setAccessibleName("app-" + iconName + "-icon");
|
||||
m_appBtn->setPixmap(getIconFromTheme(iconName, QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
||||
m_appBtn->setIcon(getIconFromTheme(iconName, QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
||||
m_appBtn->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
||||
m_appBtn->setFlat(true);
|
||||
|
||||
DLabel *titleLabel = new DLabel;
|
||||
titleLabel->setForegroundRole(DPalette::TextTitle);
|
||||
@ -63,7 +65,9 @@ SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||
|
||||
m_volumeBtnMin->setAccessibleName("volume-button");
|
||||
m_volumeBtnMin->setFixedSize(ICON_SIZE, ICON_SIZE);
|
||||
m_volumeBtnMin->setPixmap(DHiDPIHelper::loadNxPixmap("://audio-volume-low-symbolic.svg"));
|
||||
m_volumeBtnMin->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
||||
m_volumeBtnMin->setIcon(DHiDPIHelper::loadNxPixmap("://audio-volume-low-symbolic.svg"));
|
||||
m_volumeBtnMin->setFlat(true);
|
||||
|
||||
m_volumeIconMax->setFixedSize(ICON_SIZE, ICON_SIZE);
|
||||
|
||||
@ -82,7 +86,6 @@ SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||
appLayout->setSpacing(0);
|
||||
appLayout->setMargin(0);
|
||||
|
||||
|
||||
// 音量图标+slider
|
||||
QHBoxLayout *volumeCtrlLayout = new QHBoxLayout;
|
||||
volumeCtrlLayout->addSpacing(2);
|
||||
@ -104,7 +107,7 @@ SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SinkInputWidget::setVolume);
|
||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SinkInputWidget::onVolumeChanged);
|
||||
// connect(m_volumeSlider, &VolumeSlider::requestPlaySoundEffect, this, &SinkInputWidget::onPlaySoundEffect);
|
||||
connect(m_volumeBtnMin, &DImageButton::clicked, this, &SinkInputWidget::setMute);
|
||||
connect(m_volumeBtnMin, &DIconButton::clicked, this, &SinkInputWidget::setMute);
|
||||
connect(m_inputInter, &DBusSinkInput::MuteChanged, this, &SinkInputWidget::setMuteIcon);
|
||||
connect(m_inputInter, &DBusSinkInput::VolumeChanged, this, [ = ] {
|
||||
m_volumeSlider->setValue(m_inputInter->volume() * 1000);
|
||||
@ -163,9 +166,9 @@ void SinkInputWidget::setMuteIcon()
|
||||
p.drawPixmap(0, 0, muteIcon);
|
||||
|
||||
appIconSource.setDevicePixelRatio(ratio);
|
||||
m_volumeBtnMin->setPixmap(appIconSource);
|
||||
m_volumeBtnMin->setIcon(appIconSource);
|
||||
} else {
|
||||
m_volumeBtnMin->setPixmap(getIconFromTheme(m_inputInter->icon(), QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
||||
m_volumeBtnMin->setIcon(getIconFromTheme(m_inputInter->icon(), QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
||||
}
|
||||
|
||||
refreshIcon();
|
||||
@ -195,7 +198,7 @@ void SinkInputWidget::refreshIcon()
|
||||
m_volumeIconMax->setPixmap(ret);
|
||||
|
||||
ret = ImageUtil::loadSvg(iconLeft, ":/", ICON_SIZE, ratio);
|
||||
m_volumeBtnMin->setPixmap(ret);
|
||||
m_volumeBtnMin->setIcon(ret);
|
||||
}
|
||||
|
||||
void SinkInputWidget:: onVolumeChanged()
|
||||
|
@ -27,10 +27,13 @@
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
#include <dimagebutton.h>
|
||||
#include <QPainter>
|
||||
|
||||
#include <DIconButton>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
class QLabel;
|
||||
class SinkInputWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -51,8 +54,8 @@ private:
|
||||
private:
|
||||
DBusSinkInput *m_inputInter;
|
||||
|
||||
Dtk::Widget::DImageButton *m_appBtn;
|
||||
Dtk::Widget::DImageButton *m_volumeBtnMin;
|
||||
DIconButton *m_appBtn;
|
||||
DIconButton *m_volumeBtnMin;
|
||||
QLabel *m_volumeIconMax;
|
||||
VolumeSlider *m_volumeSlider;
|
||||
TipsWidget *m_volumeLabel;
|
||||
|
@ -43,14 +43,13 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
: QScrollArea(parent)
|
||||
, m_centralWidget(new QWidget)
|
||||
, m_applicationTitle(new QWidget)
|
||||
, m_volumeBtn(new DImageButton)
|
||||
, m_volumeBtn(new DIconButton(this))
|
||||
, m_volumeIconMax(new QLabel)
|
||||
, m_volumeSlider(new VolumeSlider)
|
||||
, m_soundShow(new TipsWidget)
|
||||
, m_audioInter(new DBusAudio(this))
|
||||
, m_defSinkInter(nullptr)
|
||||
{
|
||||
// QIcon::setThemeName("deepin");
|
||||
m_centralWidget->setAccessibleName("volumn-centralwidget");
|
||||
m_volumeBtn->setAccessibleName("volume-button");
|
||||
m_volumeIconMax->setAccessibleName("volume-iconmax");
|
||||
@ -66,10 +65,10 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
TipsWidget *deviceLabel = new TipsWidget;
|
||||
deviceLabel->setText(tr("Device"));
|
||||
|
||||
QHBoxLayout *deviceLayout =new QHBoxLayout;
|
||||
QHBoxLayout *deviceLayout = new QHBoxLayout;
|
||||
deviceLayout->addSpacing(2);
|
||||
deviceLayout->addWidget(deviceLabel,0, Qt::AlignLeft);
|
||||
deviceLayout->addWidget(m_soundShow,0,Qt::AlignRight);
|
||||
deviceLayout->addWidget(deviceLabel, 0, Qt::AlignLeft);
|
||||
deviceLayout->addWidget(m_soundShow, 0, Qt::AlignRight);
|
||||
deviceLayout->setSpacing(0);
|
||||
deviceLayout->setMargin(0);
|
||||
|
||||
@ -110,6 +109,8 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
m_applicationTitle->setAccessibleName("applicationtitle");
|
||||
|
||||
m_volumeBtn->setFixedSize(ICON_SIZE, ICON_SIZE);
|
||||
m_volumeBtn->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
||||
m_volumeBtn->setFlat(true);
|
||||
m_volumeSlider->setMinimum(0);
|
||||
m_volumeSlider->setMaximum(m_audioInter->maxUIVolume() * 100.0f);
|
||||
|
||||
@ -131,7 +132,7 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
m_centralWidget->setAutoFillBackground(false);
|
||||
viewport()->setAutoFillBackground(false);
|
||||
|
||||
connect(m_volumeBtn, &DImageButton::clicked, this, &SoundApplet::toggleMute);
|
||||
connect(m_volumeBtn, &DIconButton::clicked, this, &SoundApplet::toggleMute);
|
||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SoundApplet::volumeSliderValueChanged);
|
||||
connect(m_volumeSlider, &VolumeSlider::requestPlaySoundEffect, this, &SoundApplet::onPlaySoundEffect);
|
||||
connect(m_audioInter, &DBusAudio::SinkInputsChanged, this, &SoundApplet::sinkInputsChanged);
|
||||
@ -259,5 +260,5 @@ void SoundApplet::refreshIcon()
|
||||
m_volumeIconMax->setPixmap(ret);
|
||||
|
||||
ret = ImageUtil::loadSvg(iconLeft, ":/", ICON_SIZE, ratio);
|
||||
m_volumeBtn->setPixmap(ret);
|
||||
m_volumeBtn->setIcon(ret);
|
||||
}
|
||||
|
@ -30,7 +30,10 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <dimagebutton.h>
|
||||
|
||||
#include <DIconButton>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
class TipsWidget;
|
||||
class SoundApplet : public QScrollArea
|
||||
@ -62,7 +65,7 @@ private:
|
||||
private:
|
||||
QWidget *m_centralWidget;
|
||||
QWidget *m_applicationTitle;
|
||||
Dtk::Widget::DImageButton *m_volumeBtn;
|
||||
DIconButton *m_volumeBtn;
|
||||
QLabel *m_volumeIconMax;
|
||||
VolumeSlider *m_volumeSlider;
|
||||
TipsWidget *m_soundShow;
|
||||
|
@ -97,21 +97,21 @@ void PopupControlWidget::clearTrashFloder()
|
||||
}
|
||||
|
||||
QDir dir(TrashDir + "/files");//QDir::homePath() + "/.local/share/Trash/files");
|
||||
uint count = dir.entryList(ItemsShouldCount).count();
|
||||
uint count = uint(dir.entryList(ItemsShouldCount).count());
|
||||
int execCode = -1;
|
||||
|
||||
if (count > 0) {
|
||||
// blumia: Workaround. There is a bug with DDialog which will let DDialog always use the smallest
|
||||
// available size of the given icon. So we create a m_dialogTrashFullIcon and leave a minimum
|
||||
// available size of the given icon. So we create a dialogTrashFullIcon and leave a minimum
|
||||
// 64*64 pixmap size icon here.
|
||||
QIcon m_dialogTrashFullIcon;
|
||||
QIcon dialogTrashFullIcon;
|
||||
QIcon trash_full_icon = QIcon::fromTheme("user-trash-full-opened");
|
||||
m_dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(64));
|
||||
m_dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(128));
|
||||
dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(64));
|
||||
dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(128));
|
||||
|
||||
d.setTitle(ClearTrashMutliple.arg(count));
|
||||
d.setMessage(qApp->translate("DialogManager", "This action cannot be restored"));
|
||||
d.setIcon(m_dialogTrashFullIcon, QSize(64, 64));
|
||||
d.setIcon(dialogTrashFullIcon);
|
||||
d.addButton(buttonTexts[0], true, DDialog::ButtonNormal);
|
||||
d.addButton(buttonTexts[1], false, DDialog::ButtonWarning);
|
||||
d.setDefaultButton(1);
|
||||
@ -128,7 +128,6 @@ void PopupControlWidget::clearTrashFloder()
|
||||
} else {
|
||||
qWarning() << "Clear trash failed";
|
||||
}
|
||||
// DFMGlobal::instance()->clearTrash();
|
||||
}
|
||||
|
||||
int PopupControlWidget::trashItemCount() const
|
||||
|
@ -159,12 +159,12 @@ int NormalContainer::itemCount()
|
||||
|
||||
void NormalContainer::setExpand(const bool expand)
|
||||
{
|
||||
int itemSize;
|
||||
// int itemSize;
|
||||
|
||||
if (dockPosition() == Dock::Position::Top || dockPosition() == Dock::Position::Bottom)
|
||||
itemSize = std::min(parentWidget()->height(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||
else
|
||||
itemSize = std::min(parentWidget()->width(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||
// if (dockPosition() == Dock::Position::Top || dockPosition() == Dock::Position::Bottom)
|
||||
// itemSize = std::min(parentWidget()->height(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||
// else
|
||||
// itemSize = std::min(parentWidget()->width(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||
|
||||
for (auto w : wrapperList()) {
|
||||
w->setAttention(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user