声音效果适配
This commit is contained in:
parent
a3a567276e
commit
9dfa1a24d1
|
@ -98,7 +98,7 @@ void LanListItem::onNetButtonClicked()
|
|||
m_netButton->startLoading();
|
||||
} else {
|
||||
qDebug() << LOG_FLAG << m_deviceName << "is not carried, so can not activate connection";
|
||||
this->showDesktopNotify(tr("Wired Device not carried"));
|
||||
this->showDesktopNotify(tr("Wired Device not carried"), "networkwrong");
|
||||
}
|
||||
} else {
|
||||
qDebug() << LOG_FLAG <<"the connection" << m_lanConnectItem.m_connectName
|
||||
|
|
|
@ -52,20 +52,27 @@ void ListItem::setConnectState(ConnectState state)
|
|||
m_connectState = state;
|
||||
}
|
||||
|
||||
void ListItem::showDesktopNotify(const QString &message)
|
||||
void ListItem::showDesktopNotify(const QString &message, QString soundName)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QStringList actions; //跳转动作
|
||||
actions.append("kylin-nm");
|
||||
actions.append("default"); //默认动作:点击消息体时打开麒麟录音
|
||||
QMap<QString, QVariant> hints;
|
||||
if (!soundName.isEmpty()) {
|
||||
hints.insert("sound-name",soundName); //添加声音
|
||||
}
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("gnome-dev-ethernet")
|
||||
<<tr("kylin network applet desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<actions
|
||||
<<hints
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void setName(const QString &name);
|
||||
void setActive(const bool &isActive);
|
||||
void setConnectState(ConnectState state);
|
||||
static void showDesktopNotify(const QString &message);
|
||||
static void showDesktopNotify(const QString &message, QString soundName);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
|
|
@ -28,20 +28,27 @@
|
|||
|
||||
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
void NetDetail::showDesktopNotify(const QString &message)
|
||||
void NetDetail::showDesktopNotify(const QString &message, QString soundName)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QStringList actions; //跳转动作
|
||||
actions.append("kylin-nm");
|
||||
actions.append("default"); //默认动作:点击消息体时打开麒麟录音
|
||||
QMap<QString, QVariant> hints;
|
||||
if (!soundName.isEmpty()) {
|
||||
hints.insert("sound-name", soundName); //添加声音
|
||||
}
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("gnome-dev-ethernet")
|
||||
<<tr("kylin network desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<actions
|
||||
<<hints
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
@ -679,7 +686,7 @@ void NetDetail::setConfirmEnable()
|
|||
|
||||
bool NetDetail::checkIpv4Conflict(QString ipv4Address)
|
||||
{
|
||||
showDesktopNotify(tr("start check ipv4 address conflict"));
|
||||
showDesktopNotify(tr("start check ipv4 address conflict"), "networkwrong");
|
||||
bool isConflict = false;
|
||||
KyIpv4Arping* ipv4Arping = new KyIpv4Arping(m_deviceName, ipv4Address);
|
||||
|
||||
|
@ -696,7 +703,7 @@ bool NetDetail::checkIpv4Conflict(QString ipv4Address)
|
|||
|
||||
bool NetDetail::checkIpv6Conflict(QString ipv6address)
|
||||
{
|
||||
showDesktopNotify(tr("start check ipv6 address conflict"));
|
||||
showDesktopNotify(tr("start check ipv6 address conflict"), "networkwrong");
|
||||
bool isConflict = false;
|
||||
KyIpv6Arping* ipv46rping = new KyIpv6Arping(m_deviceName, ipv6address);
|
||||
|
||||
|
@ -742,7 +749,7 @@ bool NetDetail::createWiredConnect()
|
|||
if (connetSetting.m_ipv4ConfigIpType != CONFIG_IP_DHCP) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
showDesktopNotify(tr("ipv4 address conflict!"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -793,7 +800,7 @@ bool NetDetail::createWirelessConnect()
|
|||
if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
showDesktopNotify(tr("ipv4 address conflict!"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -801,7 +808,7 @@ bool NetDetail::createWirelessConnect()
|
|||
if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv6 conflict";
|
||||
showDesktopNotify(tr("ipv6 address conflict!"));
|
||||
showDesktopNotify(tr("ipv6 address conflict!"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -881,7 +888,7 @@ bool NetDetail::updateConnect()
|
|||
if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
showDesktopNotify(tr("ipv4 address conflict!"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -889,7 +896,7 @@ bool NetDetail::updateConnect()
|
|||
if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv6 conflict";
|
||||
showDesktopNotify(tr("ipv6 address conflict!"));
|
||||
showDesktopNotify(tr("ipv6 address conflict!"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -925,20 +932,20 @@ bool NetDetail::checkWirelessSecurity(KySecuType secuType)
|
|||
{
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
if(m_info.strSecType.indexOf("802.1X") < 0) {
|
||||
showDesktopNotify(tr("this wifi no support enterprise type"));
|
||||
showDesktopNotify(tr("this wifi no support enterprise type"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (secuType == NONE && m_info.strSecType != tr("None")) {
|
||||
showDesktopNotify(tr("this wifi no support None type"));
|
||||
showDesktopNotify(tr("this wifi no support None type"), "networkwrong");
|
||||
return false;
|
||||
} else if (secuType == WPA_AND_WPA2_PERSONAL
|
||||
&& (m_info.strSecType.indexOf("WPA1") < 0 &&
|
||||
m_info.strSecType.indexOf("WPA2") < 0)) {
|
||||
showDesktopNotify(tr("this wifi no support WPA2 type"));
|
||||
showDesktopNotify(tr("this wifi no support WPA2 type"), "networkwrong");
|
||||
return false;
|
||||
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
|
||||
showDesktopNotify(tr("this wifi no support WPA3 type"));
|
||||
showDesktopNotify(tr("this wifi no support WPA3 type"), "networkwrong");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
bool checkWirelessSecurity(KySecuType secuType);
|
||||
|
||||
void showDesktopNotify(const QString &message);
|
||||
void showDesktopNotify(const QString &message, QString soundName);
|
||||
|
||||
void setNetdetailSomeEnable(bool on);
|
||||
private:
|
||||
|
|
|
@ -199,7 +199,7 @@ void LanPage::onLanSwitchClicked()
|
|||
<<"devices count:"<<m_devList.count();
|
||||
|
||||
if (m_devList.count() == 0) {
|
||||
this->showDesktopNotify(tr("No ethernet device avaliable"));
|
||||
this->showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong");
|
||||
} else {
|
||||
if (m_netSwitch->getSwitchStatus()) {
|
||||
//qDebug() << "[wiredSwitch]set true after clicked";
|
||||
|
@ -842,7 +842,7 @@ void LanPage::updateActivatedConnectionArea(KyConnectItem *p_newItem)
|
|||
deleteConnectionMapItem(m_activeConnectionMap, m_activatedLanListWidget, EMPTY_CONNECT_UUID);
|
||||
QListWidgetItem *p_listWidgetItem = addNewItem(p_newItem, m_activatedLanListWidget);
|
||||
m_activeConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem);
|
||||
this->showDesktopNotify(tr("LAN Connected Successfully"));
|
||||
this->showDesktopNotify(tr("LAN Connected Successfully"), "networkconnected");
|
||||
}
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
|
@ -866,7 +866,7 @@ void LanPage::updateConnectionArea(KyConnectItem *p_newItem)
|
|||
qDebug()<<"[LanPage] update connection item"<<p_newItem->m_connectName;
|
||||
QListWidgetItem *p_listWidgetItem = insertNewItem(p_newItem, m_inactivatedLanListWidget);
|
||||
m_inactiveConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem);
|
||||
this->showDesktopNotify(tr("LAN Disconnected Successfully"));
|
||||
this->showDesktopNotify(tr("LAN Disconnected Successfully"), "networkdisconnected");
|
||||
}
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
|
@ -1206,7 +1206,7 @@ void LanPage::activateWired(const QString& devName, const QString& connUuid)
|
|||
qDebug() << "[LanPage] activateWired" << devName << connUuid;
|
||||
if (!m_deviceResource->wiredDeviceIsCarriered(devName)) {
|
||||
qDebug() << LOG_FLAG << devName << "is not carried, so can not activate connection";
|
||||
this->showDesktopNotify(tr("Wired Device not carried"));
|
||||
this->showDesktopNotify(tr("Wired Device not carried"), "networkwrong");
|
||||
} else {
|
||||
m_wiredConnectOperation->activateConnection(connUuid, devName);
|
||||
}
|
||||
|
|
|
@ -138,12 +138,19 @@ void TabPage::onPaletteChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void TabPage::showDesktopNotify(const QString &message)
|
||||
void TabPage::showDesktopNotify(const QString &message, QString soundName)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QStringList actions; //跳转动作
|
||||
actions.append("kylin-nm");
|
||||
actions.append("default"); //默认动作:点击消息体时打开麒麟录音
|
||||
QMap<QString, QVariant> hints;
|
||||
if (!soundName.isEmpty()) {
|
||||
hints.insert("sound-name",soundName); //添加声音
|
||||
}
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
// void updateDefaultDevice(QString &deviceName);
|
||||
// QString getDefaultDevice();
|
||||
static void showDesktopNotify(const QString &message);
|
||||
static void showDesktopNotify(const QString &message, QString soundName);
|
||||
|
||||
void hideSetting() {
|
||||
if (nullptr != m_settingsFrame) {
|
||||
|
|
|
@ -124,7 +124,7 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key)
|
|||
void WlanPage::onWlanSwitchClicked()
|
||||
{
|
||||
if (m_devList.isEmpty()) {
|
||||
showDesktopNotify(tr("No wireless network card detected"));
|
||||
showDesktopNotify(tr("No wireless network card detected"), "networkwrong");
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setSwitchStatus(false);
|
||||
m_netSwitch->setEnabled(false);
|
||||
|
@ -551,7 +551,7 @@ void WlanPage::onWlanRemoved(QString interface, QString ssid)
|
|||
} else {
|
||||
deleteWirelessItemFormMap(m_activateConnectionItemMap,
|
||||
m_activatedNetListWidget, ssid);
|
||||
showDesktopNotify(tr("WLAN Disconnected Successfully"));
|
||||
showDesktopNotify(tr("WLAN Disconnected Successfully"), "networkdisconnected");
|
||||
|
||||
QListWidgetItem *p_listWidgetItem = addEmptyItem(m_activatedNetListWidget);
|
||||
m_activateConnectionItemMap.insert(EMPTY_SSID, p_listWidgetItem);
|
||||
|
@ -803,11 +803,11 @@ void WlanPage::wlanShowNotify(QString ssid, NetworkManager::ActiveConnection::St
|
|||
NetworkManager::ActiveConnection::Reason reason)
|
||||
{
|
||||
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||
showDesktopNotify(tr("WLAN Disconnected Successfully"));
|
||||
showDesktopNotify(tr("WLAN Disconnected Successfully"), "networkdisconnected");
|
||||
qDebug() << "[WlanPage] wlan disconnected successfully" << Q_FUNC_INFO <<__LINE__;
|
||||
} else if (state == NetworkManager::ActiveConnection::State::Activated) {
|
||||
qDebug() << "[WlanPage] wlan connected successfully" << Q_FUNC_INFO <<__LINE__;
|
||||
this->showDesktopNotify(tr("WLAN Connected Successfully"));
|
||||
this->showDesktopNotify(tr("WLAN Connected Successfully"), "networkconnected");
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue