mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 07:05:48 +00:00
style: 消除编译警告信息
将代码中的过期的不建议使用的函数或类替换成建议使用的函数或类 Log: 消除编译警告 Influence: 无 Task: https://pms.uniontech.com/task-view-96831.html Change-Id: Ie42a3eed97013adb047105bcf75e07ff8e0277a0
This commit is contained in:
parent
9985c9b239
commit
cf376ebb3f
@ -24,6 +24,7 @@
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
static QStringList getPathFromConf(const QString &key) {
|
||||
QSettings set("/etc/deepin/dde-dock.conf", QSettings::IniFormat);
|
||||
auto value = set.value(key).toString();
|
||||
@ -33,6 +34,7 @@ static QStringList getPathFromConf(const QString &key) {
|
||||
|
||||
return QStringList();
|
||||
}
|
||||
#endif
|
||||
|
||||
// 该方法用来设置所有的需要加载的插件的路径信息
|
||||
static QMap<PluginType, QStringList> getPluginPaths()
|
||||
|
@ -116,7 +116,7 @@ QStringList DBusDockAdaptors::GetLoadedPlugins()
|
||||
}
|
||||
|
||||
// 排序,保持和原先任务栏右键菜单中的插件列表顺序一致
|
||||
qSort(nameList.begin(), nameList.end(), [ = ] (const QString &name1, const QString &name2) {
|
||||
std::sort(nameList.begin(), nameList.end(), [ = ] (const QString &name1, const QString &name2) {
|
||||
return name1 > name2;
|
||||
});
|
||||
|
||||
|
@ -40,7 +40,7 @@ bool ZoneInfo::operator ==(const ZoneInfo &what) const
|
||||
QDebug operator<<(QDebug argument, const ZoneInfo & info)
|
||||
{
|
||||
argument << info.m_zoneName << ',' << info.m_zoneCity << ',' << info.m_utcOffset << ',';
|
||||
argument << info.i2 << ',' << info.i3 << ',' << info.i4 << endl;
|
||||
argument << info.i2 << ',' << info.i3 << ',' << info.i4 << Qt::endl;
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void AppSnapshot::updateTitle()
|
||||
}
|
||||
|
||||
QFontMetrics fm(m_3DtitleBtn->font());
|
||||
int textWidth = fm.width(title()) + 10 + BTN_TITLE_MARGIN;
|
||||
int textWidth = fm.horizontalAdvance(title()) + 10 + BTN_TITLE_MARGIN;
|
||||
int titleWidth = SNAP_WIDTH - (TITLE_MARGIN * 2 + BORDER_MARGIN);
|
||||
|
||||
if (textWidth < titleWidth) {
|
||||
|
@ -148,6 +148,7 @@ PluginsItemInterface::PluginType PluginAdapter::type()
|
||||
case PluginsItemInterface_V20::PluginType::Normal:
|
||||
return PluginsItemInterface::PluginType::Normal;
|
||||
}
|
||||
return PluginsItemInterface::PluginType::Normal;
|
||||
}
|
||||
|
||||
PluginsItemInterface::PluginSizePolicy PluginAdapter::pluginSizePolicy() const
|
||||
@ -158,6 +159,7 @@ PluginsItemInterface::PluginSizePolicy PluginAdapter::pluginSizePolicy() const
|
||||
case PluginsItemInterface_V20::PluginSizePolicy::System:
|
||||
return PluginsItemInterface::PluginSizePolicy::System;
|
||||
}
|
||||
return PluginsItemInterface::PluginSizePolicy::Custom;
|
||||
}
|
||||
|
||||
QIcon PluginAdapter::icon(const DockPart &dockPart)
|
||||
|
@ -33,6 +33,7 @@
|
||||
class PluginAdapter : public QObject, public PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginsItemInterface)
|
||||
|
||||
public:
|
||||
PluginAdapter(PluginsItemInterface_V20 *pluginInter);
|
||||
|
@ -253,9 +253,9 @@ protected:
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define ModuleInterface_iid "com.deepin.dock.PluginsItemInterface"
|
||||
#define ModuleInterfaceV20_iid "com.deepin.dock.PluginsItemInterface"
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginsItemInterface_V20, ModuleInterface_iid)
|
||||
Q_DECLARE_INTERFACE(PluginsItemInterface_V20, ModuleInterfaceV20_iid)
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PLUGINSITEMINTERFACE_H
|
||||
|
@ -189,8 +189,8 @@ inline int comparePluginApi(const QString &pluginApi1, const QString &pluginApi2
|
||||
return 0;
|
||||
|
||||
// 拆分版本号
|
||||
QStringList subPluginApis1 = pluginApi1.split(".", QString::SkipEmptyParts, Qt::CaseSensitive);
|
||||
QStringList subPluginApis2 = pluginApi2.split(".", QString::SkipEmptyParts, Qt::CaseSensitive);
|
||||
QStringList subPluginApis1 = pluginApi1.split(".", Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
QStringList subPluginApis2 = pluginApi2.split(".", Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
for (int i = 0; i < subPluginApis1.size(); ++i) {
|
||||
auto subPluginApi1 = subPluginApis1[i];
|
||||
if (subPluginApis2.size() > i) {
|
||||
|
@ -37,7 +37,7 @@ void DesktopWidget::enterEvent(QEvent *event)
|
||||
{
|
||||
if (checkNeedShowDesktop()) {
|
||||
m_needRecoveryWin = true;
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle", QStringList());
|
||||
}
|
||||
|
||||
m_isHover = true;
|
||||
|
@ -711,7 +711,7 @@ void TrayModel::insertRow(int index, WinInfo info)
|
||||
const WinInfo &wininfo = m_winInfos[i];
|
||||
if (wininfo.key == info.key) {
|
||||
beginResetModel();
|
||||
m_winInfos.swap(index, i);
|
||||
m_winInfos.swapItemsAt(index, i);
|
||||
endResetModel();
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +126,9 @@ void OnboardPlugin::invokedMenuItem(const QString &itemKey, const QString &menuI
|
||||
Q_UNUSED(itemKey)
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if (menuId != "onboard-settings") return;
|
||||
if (menuId != "onboard-settings")
|
||||
return;
|
||||
|
||||
if(!m_startupState) {
|
||||
QProcess *process = new QProcess;
|
||||
connect(process,&QProcess::started, this, [ = ] {
|
||||
@ -142,7 +144,7 @@ void OnboardPlugin::invokedMenuItem(const QString &itemKey, const QString &menuI
|
||||
process->close();
|
||||
process->deleteLater();
|
||||
});
|
||||
process->start("onboard-settings");
|
||||
process->start("onboard-settings", QStringList());
|
||||
}
|
||||
|
||||
DBusDock DockInter(serviceName, servicePath, QDBusConnection::sessionBus(), this);
|
||||
|
@ -192,9 +192,9 @@ void OverlayWarningPlugin::showCloseOverlayDialogPre()
|
||||
void OverlayWarningPlugin::showCloseOverlayDialog()
|
||||
{
|
||||
qDebug() << "start disable overlayroot process";
|
||||
const int result = QProcess::execute("/usr/bin/pkexec /usr/sbin/overlayroot-disable");
|
||||
const int result = QProcess::execute("/usr/bin/pkexec /usr/sbin/overlayroot-disable", QStringList());
|
||||
if (result == 0) {
|
||||
QProcess::startDetached("reboot");
|
||||
QProcess::startDetached("reboot", QStringList());
|
||||
} else {
|
||||
qDebug() << "disable overlayroot failed, the return code is" << result;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ bool ShowDesktopPlugin::pluginIsDisable()
|
||||
const QString ShowDesktopPlugin::itemCommand(const QString &itemKey)
|
||||
{
|
||||
if (itemKey == pluginName())
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle", QStringList());
|
||||
|
||||
return QString();
|
||||
}
|
||||
@ -127,7 +127,7 @@ void ShowDesktopPlugin::invokedMenuItem(const QString &itemKey, const QString &m
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if (menuId == "show-desktop") {
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle", QStringList());
|
||||
} else if (menuId == "remove") {
|
||||
pluginStateSwitched();
|
||||
}
|
||||
|
@ -368,8 +368,7 @@ bool ShutdownPlugin::checkSwap()
|
||||
QTextStream stream(body.toUtf8());
|
||||
while (!stream.atEnd()) {
|
||||
const std::pair<bool, qint64> result =
|
||||
checkIsPartitionType(stream.readLine().simplified().split(
|
||||
" ", QString::SplitBehavior::SkipEmptyParts));
|
||||
checkIsPartitionType(stream.readLine().simplified().split(" ", Qt::SkipEmptyParts));
|
||||
qint64 image_size{ get_power_image_size() };
|
||||
|
||||
if (result.first) {
|
||||
|
@ -71,8 +71,7 @@ void VolumeSlider::mouseMoveEvent(QMouseEvent *e)
|
||||
|
||||
void VolumeSlider::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
m_pressed = false;
|
||||
emit requestPlaySoundEffect();
|
||||
}
|
||||
@ -84,7 +83,7 @@ void VolumeSlider::wheelEvent(QWheelEvent *e)
|
||||
|
||||
m_timer->start();
|
||||
|
||||
DSlider::setValue(value() + (e->delta() > 0 ? 2 : -2));
|
||||
DSlider::setValue(value() + (e->angleDelta().y() > 0 ? 2 : -2));
|
||||
}
|
||||
|
||||
void VolumeSlider::onTimeout()
|
||||
|
@ -166,7 +166,7 @@ void SoundItem::resizeEvent(QResizeEvent *e)
|
||||
|
||||
void SoundItem::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
QWheelEvent *event = new QWheelEvent(e->pos(), e->delta(), e->buttons(), e->modifiers());
|
||||
QWheelEvent *event = new QWheelEvent(e->position(), e->angleDelta().y(), e->buttons(), e->modifiers());
|
||||
qApp->postEvent(m_applet->mainSlider(), event);
|
||||
|
||||
e->accept();
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "constants.h"
|
||||
#include "trashwidget.h"
|
||||
|
||||
#include <DDBusSender>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QIcon>
|
||||
#include <QApplication>
|
||||
@ -239,13 +241,12 @@ void TrashWidget::setDragging(bool state)
|
||||
|
||||
void TrashWidget::removeApp(const QString &appKey)
|
||||
{
|
||||
const QString cmd("dbus-send --print-reply --dest=org.deepin.dde.Launcher1 /org/deepin/dde/Launcher1 org.deepin.dde.Launcher1.UninstallApp string:\"" + appKey + "\"");
|
||||
|
||||
QProcess *proc = new QProcess;
|
||||
proc->start(cmd);
|
||||
proc->waitForFinished();
|
||||
|
||||
proc->deleteLater();
|
||||
DDBusSender().service("org.deepin.dde.Launcher1")
|
||||
.path("/org/deepin/dde/Launcher1")
|
||||
.interface("org.deepin.dde.Launcher1")
|
||||
.method("UninstallApp")
|
||||
.arg(appKey)
|
||||
.call();
|
||||
}
|
||||
|
||||
void TrashWidget::moveToTrash(const QUrl &url)
|
||||
|
@ -26,7 +26,7 @@ void TipsWidget::setText(const QString &text)
|
||||
m_text = "བོད་སྐད་ཡིག་གཟུགས་ཚད་ལེན་ཚོད་ལྟའི་སྐོར་གྱི་རྗོད་ཚིག";
|
||||
#endif
|
||||
|
||||
setFixedSize(fontMetrics().width(m_text) + 20, fontMetrics().boundingRect(m_text).height());
|
||||
setFixedSize(fontMetrics().horizontalAdvance(m_text) + 20, fontMetrics().boundingRect(m_text).height());
|
||||
|
||||
update();
|
||||
|
||||
@ -46,7 +46,7 @@ void TipsWidget::setTextList(const QStringList &textList)
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
for (QString text : m_textList) {
|
||||
width = qMax(width, fontMetrics().width(text) + 20);
|
||||
width = qMax(width, fontMetrics().horizontalAdvance(text) + 20);
|
||||
height += fontMetrics().boundingRect(text).height();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user