mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-08-12 18:42:32 +03:00
Compare commits
1 Commits
dev
...
fix/minor-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d6d461d7b |
@@ -59,6 +59,11 @@ void ApiCountryModel::updateModel(const QJsonArray &countries, const QString &cu
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
const int previousIndex = m_currentIndex;
|
||||
if (!currentCountryCode.isEmpty()) {
|
||||
m_currentIndex = -1;
|
||||
}
|
||||
|
||||
m_countries.clear();
|
||||
for (int i = 0; i < countries.size(); i++) {
|
||||
CountryInfo countryInfo;
|
||||
@@ -67,14 +72,17 @@ void ApiCountryModel::updateModel(const QJsonArray &countries, const QString &cu
|
||||
countryInfo.countryName = countryObject.value(apiDefs::key::serverCountryName).toString();
|
||||
countryInfo.countryCode = countryObject.value(apiDefs::key::serverCountryCode).toString();
|
||||
|
||||
if (countryInfo.countryCode == currentCountryCode) {
|
||||
if (!currentCountryCode.isEmpty() && countryInfo.countryCode == currentCountryCode) {
|
||||
m_currentIndex = i;
|
||||
emit currentIndexChanged(m_currentIndex);
|
||||
}
|
||||
m_countries.push_back(countryInfo);
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
|
||||
if (m_currentIndex != previousIndex) {
|
||||
emit currentIndexChanged(m_currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiCountryModel::updateIssuedConfigsInfo(const QJsonArray &issuedConfigs)
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
QVector<CountryInfo> m_countries;
|
||||
QHash<QString, IssuedConfigInfo> m_issuedConfigs;
|
||||
int m_currentIndex;
|
||||
int m_currentIndex = -1;
|
||||
};
|
||||
|
||||
#endif // APICOUNTRYMODEL_H
|
||||
|
||||
@@ -95,10 +95,6 @@ PageType {
|
||||
|
||||
currentIndex: ApiCountryModel.currentIndex
|
||||
|
||||
ButtonGroup {
|
||||
id: containersRadioButtonGroup
|
||||
}
|
||||
|
||||
header: ColumnLayout {
|
||||
width: menuContent.width
|
||||
|
||||
@@ -197,12 +193,10 @@ PageType {
|
||||
|
||||
text: countryName
|
||||
|
||||
ButtonGroup.group: containersRadioButtonGroup
|
||||
|
||||
imageSource: "qrc:/images/controls/download.svg"
|
||||
|
||||
checkable: false
|
||||
checked: index === ApiCountryModel.currentIndex
|
||||
checkable: !ConnectionController.isConnected
|
||||
|
||||
onClicked: {
|
||||
if (ConnectionController.isConnectionInProgress) {
|
||||
@@ -217,18 +211,8 @@ PageType {
|
||||
root.selectConnectionCountry(index, countryCode, countryName)
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: {
|
||||
if (checkable) {
|
||||
checked = true
|
||||
}
|
||||
containerRadioButton.clicked()
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
if (checkable) {
|
||||
checked = true
|
||||
}
|
||||
containerRadioButton.clicked()
|
||||
}
|
||||
Keys.onEnterPressed: containerRadioButton.clicked()
|
||||
Keys.onReturnPressed: containerRadioButton.clicked()
|
||||
}
|
||||
|
||||
Image {
|
||||
|
||||
Reference in New Issue
Block a user