mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix(compilewarning): 解决部分编译告警
编译过程中会由告警信息,目前绝大部分已修复,但DImageButton类因为暂无完全替代的类,还未处理 Log: 解决部分编译告警
This commit is contained in:
parent
58ca5762bc
commit
e87294f77e
@ -55,4 +55,5 @@ const QPixmap ImageUtil::loadSvg(const QString &iconName, const QSize size, cons
|
|||||||
pixmap.setDevicePixelRatio(ratio);
|
pixmap.setDevicePixelRatio(ratio);
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
return QPixmap();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
namespace Utils {
|
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;
|
QImageReader reader;
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
reader.setFileName(path);
|
reader.setFileName(path);
|
||||||
@ -20,7 +20,7 @@ namespace Utils {
|
|||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScreen * screenAt(const QPoint &point) {
|
inline QScreen * screenAt(const QPoint &point) {
|
||||||
for (QScreen *screen : qApp->screens()) {
|
for (QScreen *screen : qApp->screens()) {
|
||||||
const QRect r { screen->geometry() };
|
const QRect r { screen->geometry() };
|
||||||
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
||||||
@ -32,7 +32,7 @@ namespace Utils {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScreen * screenAtByScaled(const QPoint &point) {
|
inline QScreen * screenAtByScaled(const QPoint &point) {
|
||||||
for (QScreen *screen : qApp->screens()) {
|
for (QScreen *screen : qApp->screens()) {
|
||||||
if (screen->geometry().contains(point)) {
|
if (screen->geometry().contains(point)) {
|
||||||
return screen;
|
return screen;
|
||||||
|
@ -468,37 +468,6 @@ void MainWindow::internalMove(const QPoint &p)
|
|||||||
m_mainPanel->move(0, 0);
|
m_mainPanel->move(0, 0);
|
||||||
return QWidget::move(p);
|
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()
|
void MainWindow::initConnections()
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
DatetimePlugin::DatetimePlugin(QObject *parent)
|
DatetimePlugin::DatetimePlugin(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_pluginLoaded(false)
|
|
||||||
, m_interface(nullptr)
|
, m_interface(nullptr)
|
||||||
|
, m_pluginLoaded(false)
|
||||||
{
|
{
|
||||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||||
sessionBus.connect("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged()));
|
sessionBus.connect("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged()));
|
||||||
|
@ -148,6 +148,7 @@ WiredItem::WiredStatus WiredItem::getDeviceState()
|
|||||||
case NetworkDevice::Deactivation:
|
case NetworkDevice::Deactivation:
|
||||||
case NetworkDevice::Failed: return Failed;
|
case NetworkDevice::Failed: return Failed;
|
||||||
}
|
}
|
||||||
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject WiredItem::getActiveWiredConnectionInfo()
|
QJsonObject WiredItem::getActiveWiredConnectionInfo()
|
||||||
|
@ -131,6 +131,7 @@ WirelessItem::WirelessStatus WirelessItem::getDeviceState()
|
|||||||
case NetworkDevice::Deactivation:
|
case NetworkDevice::Deactivation:
|
||||||
case NetworkDevice::Failed: return Failed;
|
case NetworkDevice::Failed: return Failed;
|
||||||
}
|
}
|
||||||
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject &WirelessItem::getConnectedApInfo()
|
QJsonObject &WirelessItem::getConnectedApInfo()
|
||||||
|
@ -1245,6 +1245,8 @@ bool NetworkItem::isShowControlCenter()
|
|||||||
case Adisabled:
|
case Adisabled:
|
||||||
case Bdisabled:
|
case Bdisabled:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (m_pluginState) {
|
switch (m_pluginState) {
|
||||||
@ -1255,6 +1257,8 @@ bool NetworkItem::isShowControlCenter()
|
|||||||
case Disconnected:
|
case Disconnected:
|
||||||
case Disabled:
|
case Disabled:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
|||||||
QPixmap PowerStatusWidget::getBatteryIcon()
|
QPixmap PowerStatusWidget::getBatteryIcon()
|
||||||
{
|
{
|
||||||
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
||||||
const uint value = qMin(100.0, qMax(0.0, data.value("Display")));
|
const uint value = uint(qMin(100.0, qMax(0.0, data.value("Display"))));
|
||||||
const int percentage = std::round(value);
|
const int percentage = int(std::round(value));
|
||||||
const int batteryState = m_powerInter->batteryState()["Display"];
|
// const int batteryState = m_powerInter->batteryState()["Display"];
|
||||||
const bool plugged = !m_powerInter->onBattery();
|
const bool plugged = !m_powerInter->onBattery();
|
||||||
|
|
||||||
/*根据新需求,电池电量显示分别是*/
|
/*根据新需求,电池电量显示分别是*/
|
||||||
|
@ -47,9 +47,9 @@ const QPixmap getIconFromTheme(const QString &name, const QSize &size, const qre
|
|||||||
SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_inputInter(new DBusSinkInput(inputPath, this))
|
, m_inputInter(new DBusSinkInput(inputPath, this))
|
||||||
|
, m_appBtn(new DImageButton(this))
|
||||||
, m_volumeBtnMin(new DImageButton(this))
|
, m_volumeBtnMin(new DImageButton(this))
|
||||||
, m_volumeIconMax(new QLabel(this))
|
, m_volumeIconMax(new QLabel(this))
|
||||||
, m_appBtn(new DImageButton(this))
|
|
||||||
, m_volumeSlider(new VolumeSlider(this))
|
, m_volumeSlider(new VolumeSlider(this))
|
||||||
, m_volumeLabel(new TipsWidget(this))
|
, m_volumeLabel(new TipsWidget(this))
|
||||||
{
|
{
|
||||||
|
@ -97,21 +97,21 @@ void PopupControlWidget::clearTrashFloder()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(TrashDir + "/files");//QDir::homePath() + "/.local/share/Trash/files");
|
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;
|
int execCode = -1;
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
// blumia: Workaround. There is a bug with DDialog which will let DDialog always use the smallest
|
// 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.
|
// 64*64 pixmap size icon here.
|
||||||
QIcon m_dialogTrashFullIcon;
|
QIcon dialogTrashFullIcon;
|
||||||
QIcon trash_full_icon = QIcon::fromTheme("user-trash-full-opened");
|
QIcon trash_full_icon = QIcon::fromTheme("user-trash-full-opened");
|
||||||
m_dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(64));
|
dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(64));
|
||||||
m_dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(128));
|
dialogTrashFullIcon.addPixmap(trash_full_icon.pixmap(128));
|
||||||
|
|
||||||
d.setTitle(ClearTrashMutliple.arg(count));
|
d.setTitle(ClearTrashMutliple.arg(count));
|
||||||
d.setMessage(qApp->translate("DialogManager", "This action cannot be restored"));
|
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[0], true, DDialog::ButtonNormal);
|
||||||
d.addButton(buttonTexts[1], false, DDialog::ButtonWarning);
|
d.addButton(buttonTexts[1], false, DDialog::ButtonWarning);
|
||||||
d.setDefaultButton(1);
|
d.setDefaultButton(1);
|
||||||
@ -128,7 +128,6 @@ void PopupControlWidget::clearTrashFloder()
|
|||||||
} else {
|
} else {
|
||||||
qWarning() << "Clear trash failed";
|
qWarning() << "Clear trash failed";
|
||||||
}
|
}
|
||||||
// DFMGlobal::instance()->clearTrash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PopupControlWidget::trashItemCount() const
|
int PopupControlWidget::trashItemCount() const
|
||||||
|
@ -159,12 +159,12 @@ int NormalContainer::itemCount()
|
|||||||
|
|
||||||
void NormalContainer::setExpand(const bool expand)
|
void NormalContainer::setExpand(const bool expand)
|
||||||
{
|
{
|
||||||
int itemSize;
|
// int itemSize;
|
||||||
|
|
||||||
if (dockPosition() == Dock::Position::Top || dockPosition() == Dock::Position::Bottom)
|
// if (dockPosition() == Dock::Position::Top || dockPosition() == Dock::Position::Bottom)
|
||||||
itemSize = std::min(parentWidget()->height(), PLUGIN_BACKGROUND_MAX_SIZE);
|
// itemSize = std::min(parentWidget()->height(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||||
else
|
// else
|
||||||
itemSize = std::min(parentWidget()->width(), PLUGIN_BACKGROUND_MAX_SIZE);
|
// itemSize = std::min(parentWidget()->width(), PLUGIN_BACKGROUND_MAX_SIZE);
|
||||||
|
|
||||||
for (auto w : wrapperList()) {
|
for (auto w : wrapperList()) {
|
||||||
w->setAttention(false);
|
w->setAttention(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user