Commit db675eb7 authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

connectivity_action: replace manual ifs with code

parent 296de907
Pipeline #70217 passed with stage
in 4 minutes and 34 seconds
......@@ -51,38 +51,8 @@ void ConnectivityAction::update()
iconName += QStringLiteral("-") + QString::number(signalStrength);
}
if (m_cellularNetworkType == QStringLiteral("5G")) {
// No icon for this case!
iconName += QStringLiteral("-");
} else if (m_cellularNetworkType == QStringLiteral("LTE")) {
iconName += QStringLiteral("-lte");
} else if (m_cellularNetworkType == QStringLiteral("HSPA")) {
iconName += QStringLiteral("-hspa");
} else if (m_cellularNetworkType == QStringLiteral("UMTS")) {
iconName += QStringLiteral("-umts");
} else if (m_cellularNetworkType == QStringLiteral("CDMA2000")) {
// GSconnect just uses the 3g icon
// No icon for this case!
iconName += QStringLiteral("");
} else if (m_cellularNetworkType == QStringLiteral("EDGE")) {
iconName += QStringLiteral("-edge");
} else if (m_cellularNetworkType == QStringLiteral("GPRS")) {
iconName += QStringLiteral("-gprs");
} else if (m_cellularNetworkType == QStringLiteral("GSM")) {
// GSconnect just uses the 2g icon
// No icon for this case!
iconName += QStringLiteral("");
} else if (m_cellularNetworkType == QStringLiteral("CDMA")) {
// GSconnect just uses the 2g icon
// No icon for this case!
iconName += QStringLiteral("");
} else if (m_cellularNetworkType == QStringLiteral("iDEN")) {
// GSconnect just uses the 2g icon
// No icon for this case!
iconName += QStringLiteral("");
} else {
// We didn't recognize the network type. Don't append anything.
iconName += QStringLiteral("");
if (connectivity_action::networkTypesWithIcons.contains(m_cellularNetworkType)) {
iconName += QStringLiteral("-") + m_cellularNetworkType.toLower();
}
setIcon(QIcon::fromTheme(iconName));
......
......@@ -16,6 +16,16 @@
#include <dbushelper.h>
namespace connectivity_action {
const QStringList networkTypesWithIcons { // contains the name of network types that have an associated icon in Breeze-icons
QStringLiteral("EDGE"),
QStringLiteral("GPRS"),
QStringLiteral("HSPA"),
QStringLiteral("LTE"),
QStringLiteral("UMTS"),
};
}
class ConnectivityAction : public QAction
{
Q_OBJECT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment