Skip to content
Snippets Groups Projects
Commit 89a8f133 authored by jonymt's avatar jonymt
Browse files

[*] added comments

parent 3302c1e6
No related branches found
No related tags found
1 merge request!11Cellframe clone
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
Q_INVOKABLE void executeCommand(const QString& command); Q_INVOKABLE void executeCommand(const QString& command);
void getWalletInfo(const QString& asWalletName); void getWalletInfo(const QString& asWalletName);
/// Request about new netowrk list
void getNetworkList(); void getNetworkList();
signals: signals:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
DapSettingsNetworkModel::DapSettingsNetworkModel(QObject *parent) : QAbstractListModel(parent), DapSettingsNetworkModel::DapSettingsNetworkModel(QObject *parent) : QAbstractListModel(parent),
m_CurrentIndex(-1) m_CurrentIndex(-1)
{ {
m_NetworkList = QStringList() << "First" << "Second" << "Third" << "Forth";
} }
DapSettingsNetworkModel& DapSettingsNetworkModel::getInstance() DapSettingsNetworkModel& DapSettingsNetworkModel::getInstance()
......
...@@ -9,9 +9,8 @@ class DapSettingsNetworkModel : public QAbstractListModel ...@@ -9,9 +9,8 @@ class DapSettingsNetworkModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
// Q_PROPERTY(QString CurrentNetwork READ getCurrentNetwork WRITE setCurrentNetwork NOTIFY currentNetworkChanged)
public: public:
/// Enumeration display role
enum DisplayRole { enum DisplayRole {
DisplayName = Qt::UserRole DisplayName = Qt::UserRole
}; };
...@@ -23,20 +22,34 @@ private: ...@@ -23,20 +22,34 @@ private:
public: public:
explicit DapSettingsNetworkModel(QObject *parent = nullptr); explicit DapSettingsNetworkModel(QObject *parent = nullptr);
/// Get instance of this object
/// @return instance
static DapSettingsNetworkModel &getInstance(); static DapSettingsNetworkModel &getInstance();
/// Overload methods
int rowCount(const QModelIndex& parent) const; int rowCount(const QModelIndex& parent) const;
QVariant data(const QModelIndex& index, int role) const; QVariant data(const QModelIndex& index, int role) const;
QHash<int, QByteArray> roleNames() const; QHash<int, QByteArray> roleNames() const;
/// Get current network which was selected
/// @return name of current network
Q_INVOKABLE QString getCurrentNetwork() const; Q_INVOKABLE QString getCurrentNetwork() const;
/// Get current index which was selected
/// @return index of current network
Q_INVOKABLE int getCurrentIndex() const; Q_INVOKABLE int getCurrentIndex() const;
public slots: public slots:
/// Set new network list
/// @param List of network
void setNetworkList(const QStringList& aNetworkList); void setNetworkList(const QStringList& aNetworkList);
/// Set current network which was selected in combobox
/// @param name of network
/// @param index of network
void setCurrentNetwork(QString CurrentNetwork, int CurrentIndex); void setCurrentNetwork(QString CurrentNetwork, int CurrentIndex);
signals: signals:
/// Signal about changing current network
/// @param name of network which was selected
void currentNetworkChanged(QString currentNetwork); void currentNetworkChanged(QString currentNetwork);
}; };
......
...@@ -31,24 +31,6 @@ DapUiQmlScreenSettingsForm { ...@@ -31,24 +31,6 @@ DapUiQmlScreenSettingsForm {
section.property: "name" section.property: "name"
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: Component { section.delegate: DapUiQmlScreenSettingsSection {}
Rectangle {
width: parent.width
height: 30 * pt
color: "#DFE1E6"
Text {
anchors.fill: parent
anchors.leftMargin: 18 * pt
verticalAlignment: Qt.AlignVCenter
text: section
font.family: "Roboto"
font.pixelSize: 12 * pt
color: "#5F5F63"
}
}
}
} }
} }
import QtQuick 2.0
Component {
Rectangle {
width: parent.width
height: 30 * pt
color: "#DFE1E6"
Text {
anchors.fill: parent
anchors.leftMargin: 18 * pt
verticalAlignment: Qt.AlignVCenter
text: section
font.family: "Roboto"
font.pixelSize: 12 * pt
color: "#5F5F63"
}
}
}
...@@ -17,7 +17,6 @@ DapUiQmlWidgetSettingsNetworkForm { ...@@ -17,7 +17,6 @@ DapUiQmlWidgetSettingsNetworkForm {
currentIndex: dapSettingsNetworkModel.getCurrentIndex() currentIndex: dapSettingsNetworkModel.getCurrentIndex()
onCurrentTextChanged: { onCurrentTextChanged: {
console.debug(currentText);
if(dapSettingsNetworkModel.getCurrentIndex() !== currentIndex) { if(dapSettingsNetworkModel.getCurrentIndex() !== currentIndex) {
dapSettingsNetworkModel.setCurrentNetwork(currentText, currentIndex); dapSettingsNetworkModel.setCurrentNetwork(currentText, currentIndex);
} }
......
...@@ -62,5 +62,6 @@ ...@@ -62,5 +62,6 @@
<file>DapUiQmlWidgetSettingsNetworkForm.ui.qml</file> <file>DapUiQmlWidgetSettingsNetworkForm.ui.qml</file>
<file>DapUiQmlScreenSettings.qml</file> <file>DapUiQmlScreenSettings.qml</file>
<file>DapUiQmlScreenSettingsForm.ui.qml</file> <file>DapUiQmlScreenSettingsForm.ui.qml</file>
<file>DapUiQmlScreenSettingsSection.qml</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -105,9 +105,11 @@ public slots: ...@@ -105,9 +105,11 @@ public slots:
/// Get history /// Get history
/// @return QList data history /// @return QList data history
QVariant getHistory() const; QVariant getHistory() const;
/// Get network list
/// @return Network list
QStringList getNetworkList() const; QStringList getNetworkList() const;
/// Change current network
/// @param name of network whcih was selected
void changeCurrentNetwork(const QString& aNetwork); void changeCurrentNetwork(const QString& aNetwork);
private slots: private slots:
......
...@@ -17,6 +17,8 @@ private: ...@@ -17,6 +17,8 @@ private:
public: public:
explicit DapChainNetworkHandler(QObject *parent = nullptr); explicit DapChainNetworkHandler(QObject *parent = nullptr);
/// Get network list
/// @return Network list
QStringList getNetworkList(); QStringList getNetworkList();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment