Merge branch 'qt_migration' into qmake-to-cmake-migration
This commit is contained in:
commit
9c188e0acd
41 changed files with 778 additions and 833 deletions
|
@ -83,8 +83,8 @@ void AppSettingsLogic::onPushButtonBackupAppConfigClicked()
|
|||
|
||||
void AppSettingsLogic::onPushButtonRestoreAppConfigClicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open backup"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.backup");
|
||||
QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open backup"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.backup");
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
|
|||
{
|
||||
m_settings->setDefaultServer(index);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
emit currServerIdxChanged();
|
||||
}
|
||||
|
||||
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||
|
@ -23,6 +24,11 @@ void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
|||
uiLogic()->goToPage(Page::ServerSettings);
|
||||
}
|
||||
|
||||
int ServerListLogic::currServerIdx() const
|
||||
{
|
||||
return m_settings->defaultServerIndex();
|
||||
}
|
||||
|
||||
void ServerListLogic::onUpdatePage()
|
||||
{
|
||||
const QJsonArray &servers = m_settings->serversArray();
|
||||
|
|
|
@ -10,8 +10,11 @@ class ServerListLogic : public PageLogicBase
|
|||
Q_OBJECT
|
||||
|
||||
READONLY_PROPERTY(QObject *, serverListModel)
|
||||
Q_PROPERTY(int currServerIdx READ currServerIdx NOTIFY currServerIdxChanged)
|
||||
|
||||
public:
|
||||
int currServerIdx() const;
|
||||
|
||||
Q_INVOKABLE void onUpdatePage() override;
|
||||
Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
|
||||
Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
|
||||
|
@ -20,5 +23,8 @@ public:
|
|||
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ServerListLogic() = default;
|
||||
|
||||
signals:
|
||||
void currServerIdxChanged();
|
||||
|
||||
};
|
||||
#endif // SERVER_LIST_LOGIC_H
|
||||
|
|
|
@ -135,9 +135,8 @@ void StartPageLogic::onPushButtonImport()
|
|||
|
||||
void StartPageLogic::onPushButtonImportOpenFile()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open profile"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.vpn");
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open profile"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), tr("*.vpn"));
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
QFile file(fileName);
|
||||
|
@ -166,14 +165,6 @@ bool StartPageLogic::importConnection(const QJsonObject &profile)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!profile.contains(config_key::containers)) {
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
|
||||
emit uiLogic()->goToPage(Page::ServerContainers);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,17 @@ void ViewConfigLogic::importConfig()
|
|||
m_settings->addServer(configJson());
|
||||
m_settings->setDefaultServer(m_settings->serversCount() - 1);
|
||||
|
||||
emit uiLogic()->goToPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
|
||||
if (!configJson().contains(config_key::containers) || configJson().value(config_key::containers).toArray().isEmpty()) {
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
emit uiLogic()->goToPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
emit uiLogic()->goToPage(Page::ServerContainers);
|
||||
} else {
|
||||
emit uiLogic()->goToPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue