Commit 5be0a7f8 authored by Jan Grulich's avatar Jan Grulich
Browse files

Coding style and minor improvements

parent 553bbb98
......@@ -22,7 +22,7 @@
#include "networkmodel.h"
#include "uiutils.h"
AppletProxyModel::AppletProxyModel(QObject* parent)
AppletProxyModel::AppletProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
setDynamicSortFilter(true);
......@@ -33,7 +33,7 @@ AppletProxyModel::~AppletProxyModel()
{
}
bool AppletProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
bool AppletProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
......@@ -58,7 +58,7 @@ bool AppletProxyModel::filterAcceptsRow(int source_row, const QModelIndex& sourc
return false;
}
bool AppletProxyModel::lessThan(const QModelIndex& left, const QModelIndex& right) const
bool AppletProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
const bool leftAvailable = (NetworkModelItem::ItemType)sourceModel()->data(left, NetworkModel::ItemTypeRole).toUInt() != NetworkModelItem::UnavailableConnection;
const bool leftConnected = sourceModel()->data(left, NetworkModel::ConnectionStateRole).toUInt() == NetworkManager::ActiveConnection::Activated;
......
......@@ -30,12 +30,12 @@ class Q_DECL_EXPORT AppletProxyModel : public QSortFilterProxyModel
Q_OBJECT
Q_PROPERTY(QAbstractItemModel * sourceModel READ sourceModel WRITE setSourceModel)
public:
explicit AppletProxyModel(QObject* parent = 0);
explicit AppletProxyModel(QObject *parent = 0);
virtual ~AppletProxyModel();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const Q_DECL_OVERRIDE;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const Q_DECL_OVERRIDE;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
};
......
/*
Copyright 2016 Jan Grulich <jgrulich@redhat.com>
Copyright 2016-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -208,7 +208,7 @@ CreatableConnectionsModel::CreatableConnectionsModel(QObject *parent)
return QString::localeAwareCompare(left->name(), right->name()) <= 0;
});
Q_FOREACH (const KService::Ptr & service, services) {
for (const KService::Ptr &service : services) {
const QString vpnType = service->property("X-NetworkManager-Services", QVariant::String).toString();
const QString vpnSubType = service->property("X-NetworkManager-Services-Subtype", QVariant::String).toString();
const QString vpnDescription = service->property("Comment", QVariant::String).toString();
......@@ -237,7 +237,7 @@ QVariant CreatableConnectionsModel::data(const QModelIndex &index, int role) con
const int row = index.row();
if (row >= 0 && row < m_list.count()) {
CreatableConnectionItem * item = m_list.at(row);
CreatableConnectionItem *item = m_list.at(row);
switch (role) {
case ConnectionDescription:
......
/*
Copyright 2016 Jan Grulich <jgrulich@redhat.com>
Copyright 2016-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -93,8 +93,8 @@ public:
ConnectionVpnType
};
int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
virtual QHash< int, QByteArray > roleNames() const Q_DECL_OVERRIDE;
private:
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -21,7 +21,7 @@
#include "editorproxymodel.h"
#include "uiutils.h"
EditorProxyModel::EditorProxyModel(QObject* parent)
EditorProxyModel::EditorProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
setDynamicSortFilter(true);
......@@ -34,7 +34,7 @@ EditorProxyModel::~EditorProxyModel()
{
}
bool EditorProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
bool EditorProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -30,11 +30,11 @@ class Q_DECL_EXPORT EditorProxyModel : public QSortFilterProxyModel
Q_OBJECT
Q_PROPERTY(QAbstractItemModel * sourceModel READ sourceModel WRITE setSourceModel)
public:
explicit EditorProxyModel(QObject* parent = 0);
explicit EditorProxyModel(QObject *parent = 0);
virtual ~EditorProxyModel();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const Q_DECL_OVERRIDE;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
};
......
/*
Copyright 2016 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......
/*
Copyright 2016 Jan Grulich <jgrulich@redhat.com>
Copyright 2016-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -21,7 +21,7 @@
#include "networkitemslist.h"
#include "networkmodelitem.h"
NetworkItemsList::NetworkItemsList(QObject* parent)
NetworkItemsList::NetworkItemsList(QObject *parent)
: QObject(parent)
{
}
......@@ -31,9 +31,9 @@ NetworkItemsList::~NetworkItemsList()
qDeleteAll(m_items);
}
bool NetworkItemsList::contains(const NetworkItemsList::FilterType type, const QString& parameter) const
bool NetworkItemsList::contains(const NetworkItemsList::FilterType type, const QString &parameter) const
{
Q_FOREACH (NetworkModelItem * item, m_items) {
for (NetworkModelItem *item : m_items) {
switch (type) {
case NetworkItemsList::ActiveConnection:
if (item->activeConnectionPath() == parameter) {
......@@ -79,36 +79,36 @@ int NetworkItemsList::count() const
return m_items.count();
}
int NetworkItemsList::indexOf(NetworkModelItem* item) const
int NetworkItemsList::indexOf(NetworkModelItem *item) const
{
return m_items.indexOf(item);
}
void NetworkItemsList::insertItem(NetworkModelItem* item)
void NetworkItemsList::insertItem(NetworkModelItem *item)
{
m_items << item;
}
NetworkModelItem* NetworkItemsList::itemAt(int index) const
NetworkModelItem *NetworkItemsList::itemAt(int index) const
{
return m_items.at(index);
}
QList< NetworkModelItem* > NetworkItemsList::items() const
QList< NetworkModelItem*> NetworkItemsList::items() const
{
return m_items;
}
void NetworkItemsList::removeItem(NetworkModelItem* item)
void NetworkItemsList::removeItem(NetworkModelItem *item)
{
m_items.removeAll(item);
}
QList< NetworkModelItem* > NetworkItemsList::returnItems(const NetworkItemsList::FilterType type, const QString& parameter, const QString& additionalParameter) const
QList< NetworkModelItem*> NetworkItemsList::returnItems(const NetworkItemsList::FilterType type, const QString &parameter, const QString &additionalParameter) const
{
QList<NetworkModelItem*> result;
Q_FOREACH (NetworkModelItem * item, m_items) {
for (NetworkModelItem *item : m_items) {
switch (type) {
case NetworkItemsList::ActiveConnection:
if (item->activeConnectionPath() == parameter) {
......@@ -160,11 +160,11 @@ QList< NetworkModelItem* > NetworkItemsList::returnItems(const NetworkItemsList:
return result;
}
QList< NetworkModelItem* > NetworkItemsList::returnItems(const NetworkItemsList::FilterType type, NetworkManager::ConnectionSettings::ConnectionType typeParameter) const
QList<NetworkModelItem*> NetworkItemsList::returnItems(const NetworkItemsList::FilterType type, NetworkManager::ConnectionSettings::ConnectionType typeParameter) const
{
QList<NetworkModelItem*> result;
Q_FOREACH (NetworkModelItem * item, m_items) {
for (NetworkModelItem *item : m_items) {
if (type == NetworkItemsList::Type) {
if (item->type() == typeParameter) {
result << item;
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -41,19 +41,19 @@ public:
Type
};
explicit NetworkItemsList(QObject* parent = 0);
explicit NetworkItemsList(QObject *parent = 0);
virtual ~NetworkItemsList();
bool contains(const FilterType type, const QString& parameter) const;
bool contains(const FilterType type, const QString &parameter) const;
int count() const;
int indexOf(NetworkModelItem * item) const;
NetworkModelItem * itemAt(int index) const;
int indexOf(NetworkModelItem *item) const;
NetworkModelItem *itemAt(int index) const;
QList<NetworkModelItem*> items() const;
QList<NetworkModelItem*> returnItems(const FilterType type, const QString& parameter, const QString& additionalParameter = QString()) const;
QList<NetworkModelItem*> returnItems(const FilterType type, const QString &parameter, const QString &additionalParameter = QString()) const;
QList<NetworkModelItem*> returnItems(const FilterType type, NetworkManager::ConnectionSettings::ConnectionType typeParameter) const;
void insertItem(NetworkModelItem * item);
void removeItem(NetworkModelItem * item);
void insertItem(NetworkModelItem *item);
void removeItem(NetworkModelItem *item);
private:
QList<NetworkModelItem*> m_items;
};
......
This diff is collapsed.
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -38,7 +38,7 @@ class Q_DECL_EXPORT NetworkModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit NetworkModel(QObject* parent = 0);
explicit NetworkModel(QObject *parent = 0);
virtual ~NetworkModel();
enum ItemRole {
......@@ -70,26 +70,26 @@ public:
VpnType
};
int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE;
virtual QHash< int, QByteArray > roleNames() const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
virtual QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
public Q_SLOTS:
void onItemUpdated();
private Q_SLOTS:
void accessPointSignalStrengthChanged(int signal);
void activeConnectionAdded(const QString& activeConnection);
void activeConnectionRemoved(const QString& activeConnection);
void activeConnectionAdded(const QString &activeConnection);
void activeConnectionRemoved(const QString &activeConnection);
void activeConnectionStateChanged(NetworkManager::ActiveConnection::State state);
void activeVpnConnectionStateChanged(NetworkManager::VpnConnection::State state,NetworkManager::VpnConnection::StateChangeReason reason);
void availableConnectionAppeared(const QString& connection);
void availableConnectionDisappeared(const QString& connection);
void connectionAdded(const QString& connection);
void connectionRemoved(const QString& connection);
void availableConnectionAppeared(const QString &connection);
void availableConnectionDisappeared(const QString &connection);
void connectionAdded(const QString &connection);
void connectionRemoved(const QString &connection);
void connectionUpdated();
void deviceAdded(const QString& device);
void deviceRemoved(const QString& device);
void deviceAdded(const QString &device);
void deviceRemoved(const QString &device);
void deviceStateChanged(NetworkManager::Device::State state, NetworkManager::Device::State oldState, NetworkManager::Device::StateChangeReason reason);
#if WITH_MODEMMANAGER_SUPPORT
void gsmNetworkAccessTechnologiesChanged(QFlags<MMModemAccessTechnology> accessTechnologies);
......@@ -99,28 +99,28 @@ private Q_SLOTS:
void ipConfigChanged();
void ipInterfaceChanged();
void statusChanged(NetworkManager::Status status);
void wirelessNetworkAppeared(const QString& ssid);
void wirelessNetworkDisappeared(const QString& ssid);
void wirelessNetworkAppeared(const QString &ssid);
void wirelessNetworkDisappeared(const QString &ssid);
void wirelessNetworkSignalChanged(int signal);
void wirelessNetworkReferenceApChanged(const QString& accessPoint);
void wirelessNetworkReferenceApChanged(const QString &accessPoint);
void initialize();
private:
NetworkItemsList m_list;
void addActiveConnection(const NetworkManager::ActiveConnection::Ptr& activeConnection);
void addAvailableConnection(const QString& connection, const NetworkManager::Device::Ptr& device);
void addConnection(const NetworkManager::Connection::Ptr& connection);
void addDevice(const NetworkManager::Device::Ptr& device);
void addWirelessNetwork(const NetworkManager::WirelessNetwork::Ptr& network, const NetworkManager::WirelessDevice::Ptr& device);
void checkAndCreateDuplicate(const QString& connection, const NetworkManager::Device::Ptr& device);
void addActiveConnection(const NetworkManager::ActiveConnection::Ptr &activeConnection);
void addAvailableConnection(const QString &connection, const NetworkManager::Device::Ptr &device);
void addConnection(const NetworkManager::Connection::Ptr &connection);
void addDevice(const NetworkManager::Device::Ptr &device);
void addWirelessNetwork(const NetworkManager::WirelessNetwork::Ptr &network, const NetworkManager::WirelessDevice::Ptr &device);
void checkAndCreateDuplicate(const QString &connection, const NetworkManager::Device::Ptr &device);
void initializeSignals();
void initializeSignals(const NetworkManager::ActiveConnection::Ptr& activeConnection);
void initializeSignals(const NetworkManager::Connection::Ptr& connection);
void initializeSignals(const NetworkManager::Device::Ptr& device);
void initializeSignals(const NetworkManager::WirelessNetwork::Ptr& network);
void updateItem(NetworkModelItem * item);
void updateFromWirelessNetwork(NetworkModelItem * item, const NetworkManager::WirelessNetwork::Ptr& network, const NetworkManager::WirelessDevice::Ptr& device);
void initializeSignals(const NetworkManager::ActiveConnection::Ptr &activeConnection);
void initializeSignals(const NetworkManager::Connection::Ptr &connection);
void initializeSignals(const NetworkManager::Device::Ptr &device);
void initializeSignals(const NetworkManager::WirelessNetwork::Ptr &network);
void updateItem(NetworkModelItem *item);
void updateFromWirelessNetwork(NetworkModelItem *item, const NetworkManager::WirelessNetwork::Ptr &network, const NetworkManager::WirelessDevice::Ptr &device);
NetworkManager::WirelessSecurityType alternativeWirelessSecurity(const NetworkManager::WirelessSecurityType type);
};
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -50,7 +50,7 @@
#include <ModemManagerQt/modemcdma.h>
#endif
NetworkModelItem::NetworkModelItem(QObject* parent)
NetworkModelItem::NetworkModelItem(QObject *parent)
: QObject(parent)
, m_connectionState(NetworkManager::ActiveConnection::Deactivated)
, m_deviceState(NetworkManager::Device::UnknownState)
......@@ -64,7 +64,7 @@ NetworkModelItem::NetworkModelItem(QObject* parent)
{
}
NetworkModelItem::NetworkModelItem(const NetworkModelItem* item, QObject* parent)
NetworkModelItem::NetworkModelItem(const NetworkModelItem *item, QObject *parent)
: QObject(parent)
, m_connectionPath(item->connectionPath())
, m_connectionState(NetworkManager::ActiveConnection::Deactivated)
......@@ -90,7 +90,7 @@ QString NetworkModelItem::activeConnectionPath() const
return m_activeConnectionPath;
}
void NetworkModelItem::setActiveConnectionPath(const QString& path)
void NetworkModelItem::setActiveConnectionPath(const QString &path)
{
m_activeConnectionPath = path;
}
......@@ -100,7 +100,7 @@ QString NetworkModelItem::connectionPath() const
return m_connectionPath;
}
void NetworkModelItem::setConnectionPath(const QString& path)
void NetworkModelItem::setConnectionPath(const QString &path)
{
m_connectionPath = path;
}
......@@ -130,12 +130,12 @@ QString NetworkModelItem::deviceName() const
return m_deviceName;
}
void NetworkModelItem::setDeviceName(const QString& name)
void NetworkModelItem::setDeviceName(const QString &name)
{
m_deviceName = name;
}
void NetworkModelItem::setDevicePath(const QString& path)
void NetworkModelItem::setDevicePath(const QString &path)
{
m_devicePath = path;
}
......@@ -272,7 +272,7 @@ QString NetworkModelItem::name() const
return m_name;
}
void NetworkModelItem::setName(const QString& name)
void NetworkModelItem::setName(const QString &name)
{
m_name = name;
}
......@@ -329,7 +329,7 @@ QString NetworkModelItem::specificPath() const
return m_specificPath;
}
void NetworkModelItem::setSpecificPath(const QString& path)
void NetworkModelItem::setSpecificPath(const QString &path)
{
m_specificPath = path;
}
......@@ -339,7 +339,7 @@ QString NetworkModelItem::ssid() const
return m_ssid;
}
void NetworkModelItem::setSsid(const QString& ssid)
void NetworkModelItem::setSsid(const QString &ssid)
{
m_ssid = ssid;
}
......@@ -354,7 +354,7 @@ QDateTime NetworkModelItem::timestamp() const
return m_timestamp;
}
void NetworkModelItem::setTimestamp(const QDateTime& date)
void NetworkModelItem::setTimestamp(const QDateTime &date)
{
m_timestamp = date;
}
......@@ -378,7 +378,7 @@ QString NetworkModelItem::uuid() const
return m_uuid;
}
void NetworkModelItem::setUuid(const QString& uuid)
void NetworkModelItem::setUuid(const QString &uuid)
{
m_uuid = uuid;
}
......@@ -403,7 +403,7 @@ void NetworkModelItem::setVpnType(const QString &type)
m_vpnType = type;
}
bool NetworkModelItem::operator==(const NetworkModelItem* item) const
bool NetworkModelItem::operator==(const NetworkModelItem *item) const
{
if (!item->uuid().isEmpty() && !uuid().isEmpty()) {
if (item->devicePath() == devicePath() && item->uuid() == uuid()) {
......
/*
Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
Copyright 2013-2018 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -36,15 +36,15 @@ public:
enum ItemType { UnavailableConnection, AvailableConnection, AvailableAccessPoint };
explicit NetworkModelItem(QObject * parent = 0);
explicit NetworkModelItem(const NetworkModelItem * item, QObject* parent = 0);
explicit NetworkModelItem(QObject *parent = 0);
explicit NetworkModelItem(const NetworkModelItem *item, QObject *parent = 0);
virtual ~NetworkModelItem();
QString activeConnectionPath() const;
void setActiveConnectionPath(const QString& path);
void setActiveConnectionPath(const QString &path);
QString connectionPath() const;
void setConnectionPath(const QString& path);
void setConnectionPath(const QString &path);
NetworkManager::ActiveConnection::State connectionState() const;
void setConnectionState(NetworkManager::ActiveConnection::State state);
......@@ -52,10 +52,10 @@ public:
QStringList details() const;
QString deviceName() const;
void setDeviceName(const QString& name);
void setDeviceName(const QString &name);
QString devicePath() const;
void setDevicePath(const QString& path);
void setDevicePath(const QString &path);
QString deviceState() const;
void setDeviceState(const NetworkManager::Device::State state);
......@@ -70,7 +70,7 @@ public:
void setMode(const NetworkManager::WirelessSetting::NetworkMode mode);
QString name() const;
void setName(const QString& name);
void setName(const QString &name);
QString originalName() const;
......@@ -86,13 +86,13 @@ public:
void setSlave(bool slave);
QString specificPath() const;
void setSpecificPath(const QString& path);
void setSpecificPath(const QString &path);
QString ssid() const;
void setSsid(const QString& ssid);
void setSsid(const QString &ssid);
QDateTime timestamp() const;
void setTimestamp(const QDateTime& date);
void setTimestamp(const QDateTime &date);
NetworkManager::ConnectionSettings::ConnectionType type() const;
void setType(NetworkManager::ConnectionSettings::ConnectionType type);
......@@ -100,7 +100,7 @@ public:
QString uni() const;
QString uuid() const;
void setUuid(const QString& uuid);
void setUuid(const QString &uuid);
QString vpnState() const;
void setVpnState(NetworkManager::VpnConnection::State state);
......@@ -108,7 +108,7 @@ public:
QString vpnType() const;
void setVpnType(const QString &type);
bool operator==(const NetworkModelItem * item) const;
bool operator==(const NetworkModelItem *item) const;
public Q_SLOTS:
void updateDetails();
......
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