fix: 修复符号冲突导致的概率性崩溃问题

语音助手中使用的类TipsWidget与任务栏项目中的同名类的实现不一样,导致符号冲突
解决方法是在任务栏的代码中加上命名空间,

Log: 修复符号冲突导致的概率性崩溃问题
Bug: https://pms.uniontech.com/zentao/bug-view-35037.html
This commit is contained in:
范朋程 2020-06-29 15:35:51 +08:00
parent 7f730c867f
commit 5a15ae7f17
33 changed files with 107 additions and 57 deletions

View File

@ -21,6 +21,7 @@
#include "appsnapshot.h"
#include "previewcontainer.h"
#include "../widgets/tipswidget.h"
#include <DStyle>
@ -51,6 +52,8 @@ struct SHMInfo {
} rect;
};
using namespace Dock;
AppSnapshot::AppSnapshot(const WId wid, QWidget *parent)
: QWidget(parent)
, m_wid(wid)

View File

@ -25,7 +25,6 @@
#include <QWidget>
#include <QDebug>
#include <QTimer>
#include "../widgets/tipswidget.h"
#include <DIconButton>
#include <DWindowManagerHelper>
@ -42,6 +41,10 @@ struct SHMInfo;
struct _XImage;
typedef _XImage XImage;
namespace Dock {
class TipsWidget;
}
class AppSnapshot : public QWidget
{
Q_OBJECT
@ -89,7 +92,7 @@ private:
QImage m_snapshot;
QRectF m_snapshotSrcRect;
TipsWidget *m_title;
Dock::TipsWidget *m_title;
QTimer *m_waitLeaveTimer;
DIconButton *m_closeBtn2D;
DWindowManagerHelper *m_wmHelper;

View File

@ -50,6 +50,7 @@
#include <DPushButton>
DWIDGET_USE_NAMESPACE
using namespace Dock;
// 添加accessible
SET_FORM_ACCESSIBLE(MainWindow, "mainwindow")

View File

@ -39,6 +39,8 @@
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
using namespace Dock;
BluetoothItem::BluetoothItem(QWidget *parent)
: QWidget(parent)
, m_tipsLabel(new TipsWidget(this))

View File

@ -30,7 +30,9 @@
#define BLUETOOTH_KEY "bluetooth-item-key"
class BluetoothApplet;
namespace Dock {
class TipsWidget;
}
class BluetoothItem : public QWidget
{
Q_OBJECT
@ -59,7 +61,7 @@ signals:
void justHasAdapter();
private:
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
BluetoothApplet *m_applet;
QPixmap m_iconPixmap;

View File

@ -20,6 +20,7 @@
*/
#include "datetimeplugin.h"
#include "../../widgets/tipswidget.h"
#include <DDBusSender>
#include <QLabel>
@ -30,7 +31,7 @@
#define PLUGIN_STATE_KEY "enable"
#define TIME_FORMAT_KEY "Use24HourFormat"
using namespace Dock;
DatetimePlugin::DatetimePlugin(QObject *parent)
: QObject(parent)
, m_interface(nullptr)

View File

@ -24,12 +24,14 @@
#include "pluginsiteminterface.h"
#include "datetimewidget.h"
#include "../../widgets/tipswidget.h"
#include <QTimer>
#include <QLabel>
#include <QSettings>
namespace Dock{
class TipsWidget;
}
class QDBusInterface;
class DatetimePlugin : public QObject, PluginsItemInterface
{
@ -72,7 +74,7 @@ private:
private:
QPointer<DatetimeWidget> m_centralWidget;
QPointer<TipsWidget> m_dateTipsLabel;
QPointer<Dock::TipsWidget> m_dateTipsLabel;
QTimer *m_refershTimer;
QString m_currentTimeString;
QDBusInterface *m_interface;

View File

@ -20,11 +20,13 @@
*/
#include "multitaskingplugin.h"
#include "../widgets/tipswidget.h"
#include <QIcon>
#define PLUGIN_STATE_KEY "enable"
using namespace Dock;
MultitaskingPlugin::MultitaskingPlugin(QObject *parent)
: QObject(parent)
, m_pluginLoaded(false)

View File

@ -24,10 +24,11 @@
#include "pluginsiteminterface.h"
#include "multitaskingwidget.h"
#include "../widgets/tipswidget.h"
#include <QLabel>
namespace Dock {
class TipsWidget;
}
class MultitaskingPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -63,7 +64,7 @@ private:
bool m_pluginLoaded;
MultitaskingWidget *m_multitaskingWidget;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
};
#endif // MULTITASKINGPLUGIN_H

View File

@ -40,7 +40,7 @@ extern void initFontColor(QWidget *widget)
NetworkItem::NetworkItem(QWidget *parent)
: QWidget(parent)
, m_tipsWidget(new TipsWidget(this))
, m_tipsWidget(new Dock::TipsWidget(this))
, m_applet(new QScrollArea(this))
, m_switchWire(true)
, m_timer(new QTimer(this))

View File

@ -14,7 +14,9 @@ DGUI_USE_NAMESPACE
DWIDGET_USE_NAMESPACE
class PluginState;
namespace Dock {
class TipsWidget;
}
class WiredItem;
class WirelessItem;
class HorizontalSeperator;
@ -82,7 +84,7 @@ private:
int getStrongestAp();
private:
TipsWidget *m_tipsWidget;
Dock::TipsWidget *m_tipsWidget;
QScrollArea *m_applet;
QLabel *m_wiredTitle;

View File

@ -20,12 +20,14 @@
*/
#include "onboardplugin.h"
#include "../widgets/tipswidget.h"
#include <QIcon>
#include <QSettings>
#define PLUGIN_STATE_KEY "enable"
using namespace Dock;
OnboardPlugin::OnboardPlugin(QObject *parent)
: QObject(parent),

View File

@ -24,7 +24,6 @@
#include "pluginsiteminterface.h"
#include "onboarditem.h"
#include "../widgets/tipswidget.h"
#include <QLabel>
#include <com_deepin_dde_daemon_dock.h>
@ -32,7 +31,9 @@
using DBusDock = com::deepin::dde::daemon::Dock;
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
namespace Dock {
class TipsWidget;
}
class OnboardPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -71,7 +72,7 @@ private:
bool m_startupState;
OnboardItem *m_onboardItem;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
};
#endif // ONBOARDPLUGIN_H

View File

@ -21,6 +21,7 @@
#include "powerplugin.h"
#include "dbus/dbusaccount.h"
#include "../widgets/tipswidget.h"
#include <QIcon>
#include <QGSettings>
@ -28,6 +29,7 @@
#define PLUGIN_STATE_KEY "enable"
#define DELAYTIME (20 * 1000)
using namespace Dock;
static QGSettings *GSettingsByApp()
{
static QGSettings settings("com.deepin.dde.dock.module.power");

View File

@ -25,14 +25,15 @@
#include "pluginsiteminterface.h"
#include "powerstatuswidget.h"
#include "dbus/dbuspower.h"
#include "../widgets/tipswidget.h"
#include <com_deepin_system_systempower.h>
#include <QLabel>
using SystemPowerInter = com::deepin::system::Power;
namespace Dock {
class TipsWidget;
}
class PowerPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -70,7 +71,7 @@ private:
bool m_showTimeToFull;
PowerStatusWidget *m_powerStatusWidget;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
SystemPowerInter *m_systemPowerInter;
DBusPower *m_powerInter;

View File

@ -20,11 +20,12 @@
*/
#include "showdesktopplugin.h"
#include "../widgets/tipswidget.h"
#include <QIcon>
#define PLUGIN_STATE_KEY "enable"
using namespace Dock;
ShowDesktopPlugin::ShowDesktopPlugin(QObject *parent)
: QObject(parent)
, m_pluginLoaded(false)

View File

@ -24,10 +24,11 @@
#include "pluginsiteminterface.h"
#include "showdesktopwidget.h"
#include "../widgets/tipswidget.h"
#include <QLabel>
namespace Dock{
class TipsWidget;
}
class ShowDesktopPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -63,7 +64,7 @@ private:
bool m_pluginLoaded;
ShowDesktopWidget *m_showDesktopWidget;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
};
#endif // SHOWDESKTOPPLUGIN_H

View File

@ -21,12 +21,15 @@
#include "shutdownplugin.h"
#include "dbus/dbusaccount.h"
#include "../widgets/tipswidget.h"
#include <QIcon>
#include <QSettings>
#define PLUGIN_STATE_KEY "enable"
using namespace Dock;
ShutdownPlugin::ShutdownPlugin(QObject *parent)
: QObject(parent),

View File

@ -24,11 +24,13 @@
#include "pluginsiteminterface.h"
#include "shutdownwidget.h"
#include "../widgets/tipswidget.h"
#include "./dbus/dbuslogin1manager.h"
#include <QLabel>
namespace Dock {
class TipsWidget;
}
class ShutdownPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -108,7 +110,7 @@ private:
bool m_pluginLoaded;
ShutdownWidget *m_shutdownWidget;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
DBusLogin1Manager* m_login1Inter;
};

View File

@ -21,6 +21,7 @@
#include "sinkinputwidget.h"
#include "../frame/util/imageutil.h"
#include "../widgets/tipswidget.h"
#include <QHBoxLayout>
#include <QIcon>
@ -35,6 +36,7 @@
#define APP_TITLE_SIZE 110
DGUI_USE_NAMESPACE
using namespace Dock;
const QPixmap getIconFromTheme(const QString &name, const QSize &size, const qreal ratio)
{

View File

@ -24,7 +24,6 @@
#include "dbus/dbussinkinput.h"
#include "componments/volumeslider.h"
#include "../widgets/tipswidget.h"
#include <QFrame>
#include <QPainter>
@ -32,14 +31,16 @@
#include <DIconButton>
DWIDGET_USE_NAMESPACE
namespace Dock {
class TipsWidget;
}
class QLabel;
class SinkInputWidget : public QWidget
{
Q_OBJECT
public:
explicit SinkInputWidget(const QString &inputPath, QWidget *parent = 0);
explicit SinkInputWidget(const QString &inputPath, QWidget *parent = nullptr);
private slots:
void setVolume(const int value);
@ -58,7 +59,7 @@ private:
DIconButton *m_volumeBtnMin;
QLabel *m_volumeIconMax;
VolumeSlider *m_volumeSlider;
TipsWidget *m_volumeLabel;
Dock::TipsWidget *m_volumeLabel;
};
#endif // SINKINPUTWIDGET_H

View File

@ -38,7 +38,7 @@
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
using namespace Dock;
SoundApplet::SoundApplet(QWidget *parent)
: QScrollArea(parent)
, m_centralWidget(new QWidget)

View File

@ -34,8 +34,9 @@
#include <DIconButton>
DWIDGET_USE_NAMESPACE
namespace Dock{
class TipsWidget;
}
class SoundApplet : public QScrollArea
{
Q_OBJECT
@ -68,7 +69,7 @@ private:
DIconButton *m_volumeBtn;
QLabel *m_volumeIconMax;
VolumeSlider *m_volumeSlider;
TipsWidget *m_soundShow;
Dock::TipsWidget *m_soundShow;
QVBoxLayout *m_centralLayout;
DBusAudio *m_audioInter;

View File

@ -39,12 +39,12 @@
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
using namespace Dock;
SoundItem::SoundItem(QWidget *parent)
: QWidget(parent),
m_tipsLabel(new TipsWidget(this)),
m_applet(new SoundApplet(this)),
m_sinkInter(nullptr)
: QWidget(parent)
, m_tipsLabel(new TipsWidget(this))
, m_applet(new SoundApplet(this))
, m_sinkInter(nullptr)
{
m_tipsLabel->setObjectName("sound");
m_tipsLabel->setAccessibleName("soundtips");

View File

@ -30,7 +30,9 @@
#define SOUND_KEY "sound-item-key"
namespace Dock {
class TipsWidget;
}
class SoundItem : public QWidget
{
Q_OBJECT
@ -59,7 +61,7 @@ private slots:
void sinkChanged(DBusSink *sink);
private:
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
SoundApplet *m_applet;
DBusSink *m_sinkInter;
QPixmap m_iconPixmap;

View File

@ -25,6 +25,7 @@
*/
#include "trashplugin.h"
#include "../../widgets/tipswidget.h"
#include <DApplication>
@ -32,6 +33,8 @@
DWIDGET_USE_NAMESPACE
using namespace Dock;
TrashPlugin::TrashPlugin(QObject *parent)
: QObject(parent)
, m_trashWidget(nullptr)

View File

@ -29,11 +29,12 @@
#include "pluginsiteminterface.h"
#include "trashwidget.h"
#include "../../widgets/tipswidget.h"
#include <QLabel>
#include <QSettings>
namespace Dock{
class TipsWidget;
}
class TrashPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -66,7 +67,7 @@ private:
void refreshPluginItemsVisible();
TrashWidget *m_trashWidget;
QPointer<TipsWidget> m_tipsLabel;
QPointer<Dock::TipsWidget> m_tipsLabel;
};
#endif // TRASHPLUGIN_H

View File

@ -21,7 +21,10 @@
#include "snitraywidget.h"
#include "util/themeappicon.h"
#include "../../widgets/tipswidget.h"
#include <dbusmenu-qt5/dbusmenuimporter.h>
#include <QPainter>
#include <QApplication>
@ -34,7 +37,7 @@ const QStringList ItemStatusList {"Passive", "Active", "NeedsAttention"};
const QStringList LeftClickInvalidIdList {"sogou-qimpanel",};
QPointer<DockPopupWindow> SNITrayWidget::PopupWindow = nullptr;
Dock::Position SNITrayWidget::DockPosition = Dock::Position::Top;
using namespace Dock;
SNITrayWidget::SNITrayWidget(const QString &sniServicePath, QWidget *parent)
: AbstractTrayWidget(parent),
m_dbusMenuImporter(nullptr),

View File

@ -25,7 +25,6 @@
#include "constants.h"
#include "abstracttraywidget.h"
#include "util/dockpopupwindow.h"
#include "../../widgets/tipswidget.h"
#include <org_kde_statusnotifieritem.h>
@ -34,7 +33,9 @@
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
class DBusMenuImporter;
namespace Dock {
class TipsWidget;
}
//using namespace com::deepin::dde;
using namespace org::kde;
@ -67,7 +68,7 @@ public:
void showHoverTips();
const QPoint topleftPoint() const;
void showPopupWindow(QWidget * const content, const bool model = false);
void showPopupWindow(QWidget *const content, const bool model = false);
const QPoint popupMarkPoint() const;
static void setDockPostion(const Dock::Position pos) { DockPosition = pos; }
@ -83,18 +84,18 @@ private Q_SLOTS:
void refreshAttentionIcon();
void showContextMenu(int x, int y);
// SNI property change slot
void onSNIAttentionIconNameChanged(const QString & value);
void onSNIAttentionIconNameChanged(const QString &value);
void onSNIAttentionIconPixmapChanged(DBusImageList value);
void onSNIAttentionMovieNameChanged(const QString & value);
void onSNICategoryChanged(const QString & value);
void onSNIIconNameChanged(const QString & value);
void onSNIAttentionMovieNameChanged(const QString &value);
void onSNICategoryChanged(const QString &value);
void onSNIIconNameChanged(const QString &value);
void onSNIIconPixmapChanged(DBusImageList value);
void onSNIIconThemePathChanged(const QString & value);
void onSNIIdChanged(const QString & value);
void onSNIMenuChanged(const QDBusObjectPath & value);
void onSNIOverlayIconNameChanged(const QString & value);
void onSNIIconThemePathChanged(const QString &value);
void onSNIIdChanged(const QString &value);
void onSNIMenuChanged(const QDBusObjectPath &value);
void onSNIOverlayIconNameChanged(const QString &value);
void onSNIOverlayIconPixmapChanged(DBusImageList value);
void onSNIStatusChanged(const QString & value);
void onSNIStatusChanged(const QString &value);
void hidePopup();
void hideNonModel();
void popupWindowAccept();
@ -138,7 +139,7 @@ private:
QTimer *m_popupTipsDelayTimer;
static Dock::Position DockPosition;
static QPointer<DockPopupWindow> PopupWindow;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
bool m_popupShown;
};

View File

@ -40,7 +40,7 @@
#define SNI_WATCHER_PATH "/StatusNotifierWatcher"
using org::kde::StatusNotifierWatcher;
using namespace Dock;
TrayPlugin::TrayPlugin(QObject *parent)
: QObject(parent)
, m_pluginLoaded(false)

View File

@ -36,7 +36,9 @@
#include <QLabel>
class FashionTrayItem;
namespace Dock {
class TipsWidget;
}
class TrayPlugin : public QObject, PluginsItemInterface
{
Q_OBJECT
@ -98,7 +100,7 @@ private:
QMap<QString, SNITrayWidget *> m_passiveSNITrayMap;
QMap<QString, IndicatorTray*> m_indicatorMap;
TipsWidget *m_tipsLabel;
Dock::TipsWidget *m_tipsLabel;
bool m_pluginLoaded;
};

View File

@ -3,7 +3,7 @@
#include <QPainter>
#include <QAccessible>
#include <QTextDocument>
namespace Dock{
TipsWidget::TipsWidget(QWidget *parent)
: QFrame(parent)
, m_width(0)
@ -103,3 +103,4 @@ bool TipsWidget::event(QEvent *event)
}
return QFrame::event(event);
}
}

View File

@ -2,7 +2,7 @@
#define TIPSWIDGET_H
#include <QFrame>
namespace Dock {
class TipsWidget : public QFrame
{
Q_OBJECT
@ -29,5 +29,6 @@ private:
int m_width;
ShowType m_type;
};
}
#endif // TIPSWIDGET_H