diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp index 3cc4ebbce5..2c7a762593 100644 --- a/src/mumble/ConfigDialog.cpp +++ b/src/mumble/ConfigDialog.cpp @@ -84,6 +84,19 @@ ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) { restoreGeometry(Global::get().s.qbaConfigGeometry); } + qcbProfiles->addItem(Profiles::s_default_profile_name); + + QStringList profiles = Global::get().s.profiles.allProfiles.keys(); + profiles.sort(); + for (const QString &profile : profiles) { + if (profile == Profiles::s_default_profile_name) { + continue; + } + qcbProfiles->addItem(profile); + } + + qcbProfiles->setCurrentIndex(qcbProfiles->findText(Global::get().s.profiles.activeProfileName)); + updateTabOrder(); qlwIcons->setFocus(); } @@ -205,6 +218,34 @@ void ConfigDialog::on_qlwIcons_currentItemChanged(QListWidgetItem *current, QLis } } +void ConfigDialog::on_qcbProfiles_currentIndexChanged(int) { + QString selectedProfile = qcbProfiles->currentText(); + bool isDefault = selectedProfile == Profiles::s_default_profile_name; + qpbProfileRename->setEnabled(!isDefault); + qpbProfileDelete->setEnabled(!isDefault); + + Profiles profilesCopy = s.profiles; + + if (!profilesCopy.allProfiles.contains(selectedProfile)) { + return; + } + + s = profilesCopy.allProfiles[selectedProfile] s.profiles = profilesCopy; + s.profiles.activeProfileName = selectedProfile; + for (const ConfigWidget *cw : s_existingWidgets.values()) { + cw->load(s); + } +} + +void ConfigDialog::on_qpbProfileAdd_clicked() { +} + +void ConfigDialog::on_qpbProfileRename_clicked() { +} + +void ConfigDialog::on_qpbProfileDelete_clicked() { +} + void ConfigDialog::updateTabOrder() { QPushButton *okButton = dialogButtonBox->button(QDialogButtonBox::Ok); QPushButton *cancelButton = dialogButtonBox->button(QDialogButtonBox::Cancel); @@ -230,13 +271,17 @@ void ConfigDialog::updateTabOrder() { setTabOrder(cancelButton, okButton); setTabOrder(okButton, qlwIcons); setTabOrder(qlwIcons, contentFocusWidget); + setTabOrder(contentFocusWidget, qcbProfiles); + setTabOrder(qcbProfiles, qpbProfileAdd); + setTabOrder(qpbProfileAdd, qpbProfileRename); + setTabOrder(qpbProfileRename, qpbProfileDelete); if (resetButton && restoreButton && restoreAllButton) { - setTabOrder(contentFocusWidget, resetButton); + setTabOrder(qpbProfileDelete, resetButton); setTabOrder(resetButton, restoreButton); setTabOrder(restoreButton, restoreAllButton); setTabOrder(restoreAllButton, applyButton); } else { - setTabOrder(contentFocusWidget, applyButton); + setTabOrder(qpbProfileDelete, applyButton); } setTabOrder(applyButton, cancelButton); } diff --git a/src/mumble/ConfigDialog.h b/src/mumble/ConfigDialog.h index 5613482803..9c118b35c6 100644 --- a/src/mumble/ConfigDialog.h +++ b/src/mumble/ConfigDialog.h @@ -46,6 +46,10 @@ public slots: void on_pageButtonBox_clicked(QAbstractButton *); void on_dialogButtonBox_clicked(QAbstractButton *); void on_qlwIcons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + void on_qcbProfiles_currentIndexChanged(int); + void on_qpbProfileAdd_clicked(); + void on_qpbProfileRename_clicked(); + void on_qpbProfileDelete_clicked(); void apply(); void accept() Q_DECL_OVERRIDE; }; diff --git a/src/mumble/ConfigDialog.ui b/src/mumble/ConfigDialog.ui index 2cbe3f2c0e..50e37707ea 100644 --- a/src/mumble/ConfigDialog.ui +++ b/src/mumble/ConfigDialog.ui @@ -35,34 +35,79 @@ - QListView::Adjust + QListView::ResizeMode::Adjust - QListView::Batched + QListView::LayoutMode::Batched true - + + + + Profile + + + + 0 + + + 9 + + + 0 + + + 0 + + + + + + + + Add + + + + + + + Rename + + + + + + + Delete + + + + + + + - Qt::Horizontal + Qt::Orientation::Horizontal - + - Qt::Horizontal + Qt::Orientation::Horizontal - 474 - 22 + 40 + 20 @@ -70,16 +115,16 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Apply|QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok - +