mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 19:57:45 +00:00
Begin work on accounts tab
This commit is contained in:
parent
feca1c8321
commit
f1cd9cee95
3 changed files with 50 additions and 9 deletions
|
@ -18,8 +18,8 @@ public:
|
||||||
void addWindow(VirtualWindow* window);
|
void addWindow(VirtualWindow* window);
|
||||||
void addDialog(VirtualDialog* dialog);
|
void addDialog(VirtualDialog* dialog);
|
||||||
|
|
||||||
bool oneWindow = true;
|
bool oneWindow = false;
|
||||||
bool isSteamDeck = true;
|
bool isSteamDeck = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMdiArea* mdiArea = nullptr;
|
QMdiArea* mdiArea = nullptr;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public slots:
|
||||||
void reloadControls();
|
void reloadControls();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupAccountsTab(QFormLayout& layout);
|
void setupAccountsTab(QGridLayout& layout);
|
||||||
|
|
||||||
// profile specific tabs
|
// profile specific tabs
|
||||||
void setupGameTab(QFormLayout& layout);
|
void setupGameTab(QFormLayout& layout);
|
||||||
|
@ -34,7 +34,10 @@ private:
|
||||||
ProfileSettings& getCurrentProfile();
|
ProfileSettings& getCurrentProfile();
|
||||||
|
|
||||||
QListWidget* profileWidget = nullptr;
|
QListWidget* profileWidget = nullptr;
|
||||||
QPushButton* deleteProfileButton = nullptr;
|
QPushButton* deleteAccountButton = nullptr;
|
||||||
|
|
||||||
|
QListWidget* accountWidget = nullptr;
|
||||||
|
QPushButton* removeAccountButton = nullptr;
|
||||||
|
|
||||||
// general
|
// general
|
||||||
QCheckBox* closeWhenLaunched = nullptr;
|
QCheckBox* closeWhenLaunched = nullptr;
|
||||||
|
|
|
@ -88,13 +88,13 @@ SettingsWindow::SettingsWindow(DesktopInterface& interface, int defaultTab, Laun
|
||||||
});
|
});
|
||||||
profileLayout->addWidget(addProfileButton, 3, 0);
|
profileLayout->addWidget(addProfileButton, 3, 0);
|
||||||
|
|
||||||
deleteProfileButton = new QPushButton("Delete Profile");
|
deleteAccountButton = new QPushButton("Delete Profile");
|
||||||
connect(deleteProfileButton, &QPushButton::pressed, [=] {
|
connect(deleteAccountButton, &QPushButton::pressed, [=] {
|
||||||
profileWidget->setCurrentRow(this->core.deleteProfile(getCurrentProfile().name));
|
profileWidget->setCurrentRow(this->core.deleteProfile(getCurrentProfile().name));
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
profileLayout->addWidget(deleteProfileButton, 0, 2);
|
profileLayout->addWidget(deleteAccountButton, 0, 2);
|
||||||
|
|
||||||
nameEdit = new QLineEdit();
|
nameEdit = new QLineEdit();
|
||||||
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
||||||
|
@ -158,6 +158,8 @@ SettingsWindow::SettingsWindow(DesktopInterface& interface, int defaultTab, Laun
|
||||||
|
|
||||||
auto accountsLayout = new QGridLayout();
|
auto accountsLayout = new QGridLayout();
|
||||||
accountsTabWidget->setLayout(accountsLayout);
|
accountsTabWidget->setLayout(accountsLayout);
|
||||||
|
|
||||||
|
setupAccountsTab(*accountsLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(defaultTab);
|
tabWidget->setCurrentIndex(defaultTab);
|
||||||
|
@ -185,7 +187,7 @@ void SettingsWindow::reloadControls() {
|
||||||
showNewsList->setChecked(core.appSettings.showNewsList);
|
showNewsList->setChecked(core.appSettings.showNewsList);
|
||||||
|
|
||||||
// deleting the main profile is unsupported behavior
|
// deleting the main profile is unsupported behavior
|
||||||
deleteProfileButton->setEnabled(profileWidget->currentRow() != 0);
|
deleteAccountButton->setEnabled(profileWidget->currentRow() != 0);
|
||||||
|
|
||||||
ProfileSettings& profile = core.getProfile(profileWidget->currentRow());
|
ProfileSettings& profile = core.getProfile(profileWidget->currentRow());
|
||||||
nameEdit->setText(profile.name);
|
nameEdit->setText(profile.name);
|
||||||
|
@ -653,4 +655,40 @@ void SettingsWindow::setupDalamudTab(QFormLayout& layout) {
|
||||||
layout.addRow("Dalamud Asset Version", dalamudAssetVersionLabel);
|
layout.addRow("Dalamud Asset Version", dalamudAssetVersionLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::setupAccountsTab(QFormLayout& layout) {}
|
void SettingsWindow::setupAccountsTab(QGridLayout& layout) {
|
||||||
|
auto profileTabs = new QTabWidget();
|
||||||
|
layout.addWidget(profileTabs, 1, 1, 3, 3);
|
||||||
|
|
||||||
|
accountWidget = new QListWidget();
|
||||||
|
accountWidget->addItem("INVALID *DEBUG*");
|
||||||
|
accountWidget->setCurrentRow(0);
|
||||||
|
|
||||||
|
connect(accountWidget, &QListWidget::currentRowChanged, this, &SettingsWindow::reloadControls);
|
||||||
|
|
||||||
|
layout.addWidget(accountWidget, 0, 0, 3, 1);
|
||||||
|
|
||||||
|
auto addAccountButton = new QPushButton("Add Account");
|
||||||
|
connect(addAccountButton, &QPushButton::pressed, [=] {
|
||||||
|
accountWidget->setCurrentRow(this->core.addProfile());
|
||||||
|
|
||||||
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
layout.addWidget(addAccountButton, 3, 0);
|
||||||
|
|
||||||
|
deleteAccountButton = new QPushButton("Remove Account");
|
||||||
|
connect(deleteAccountButton, &QPushButton::pressed, [=] {
|
||||||
|
accountWidget->setCurrentRow(this->core.deleteProfile(getCurrentProfile().name));
|
||||||
|
|
||||||
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
layout.addWidget(deleteAccountButton, 0, 2);
|
||||||
|
|
||||||
|
nameEdit = new QLineEdit();
|
||||||
|
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
||||||
|
//getCurrentProfile().name = nameEdit->text();
|
||||||
|
|
||||||
|
reloadControls();
|
||||||
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
layout.addWidget(nameEdit, 0, 1);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue