diff --git a/CHANGELOG.md b/CHANGELOG.md index ccae467f8..8662715ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ Feature #4673: Weapon sheathing Feature #4675: Support for NiRollController Feature #4730: Native animated containers support + Feature #4784: Launcher: Duplicate Content Lists Feature #4812: Support NiSwitchNode Feature #4836: Daytime node switch Feature #4859: Make water reflections more configurable diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 6f2389de3..055426f30 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -39,10 +39,13 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config: const QString encoding = mGameSettings.value("encoding", "win1252"); mSelector->setEncoding(encoding); - mProfileDialog = new TextInputDialog(tr("New Content List"), tr("Content List name:"), this); + mNewProfileDialog = new TextInputDialog(tr("New Content List"), tr("Content List name:"), this); + mCloneProfileDialog = new TextInputDialog(tr("Clone Content List"), tr("Content List name:"), this); - connect(mProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateOkButton(QString))); + connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), + this, SLOT(updateNewProfileOkButton(QString))); + connect(mCloneProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), + this, SLOT(updateCloneProfileOkButton(QString))); buildView(); loadSettings(); @@ -61,6 +64,7 @@ void Launcher::DataFilesPage::buildView() //tool buttons ui.newProfileButton->setToolTip ("Create a new Content List"); + ui.cloneProfileButton->setToolTip ("Clone the current Content List"); ui.deleteProfileButton->setToolTip ("Delete an existing Content List"); //combo box @@ -70,6 +74,7 @@ void Launcher::DataFilesPage::buildView() // Add the actions to the toolbuttons ui.newProfileButton->setDefaultAction (ui.newProfileAction); + ui.cloneProfileButton->setDefaultAction (ui.cloneProfileAction); ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction); //establish connections @@ -246,10 +251,10 @@ void Launcher::DataFilesPage::slotProfileChanged(int index) void Launcher::DataFilesPage::on_newProfileAction_triggered() { - if (mProfileDialog->exec() != QDialog::Accepted) + if (mNewProfileDialog->exec() != QDialog::Accepted) return; - QString profile = mProfileDialog->lineEdit()->text(); + QString profile = mNewProfileDialog->lineEdit()->text(); if (profile.isEmpty()) return; @@ -273,6 +278,20 @@ void Launcher::DataFilesPage::addProfile (const QString &profile, bool setAsCurr setProfile (ui.profilesComboBox->findText (profile), false); } +void Launcher::DataFilesPage::on_cloneProfileAction_triggered() +{ + if (mCloneProfileDialog->exec() != QDialog::Accepted) + return; + + QString profile = mCloneProfileDialog->lineEdit()->text(); + + if (profile.isEmpty()) + return; + + mLauncherSettings.setContentList(profile, selectedFilePaths()); + addProfile(profile, true); +} + void Launcher::DataFilesPage::on_deleteProfileAction_triggered() { QString profile = ui.profilesComboBox->currentText(); @@ -295,17 +314,16 @@ void Launcher::DataFilesPage::on_deleteProfileAction_triggered() checkForDefaultProfile(); } -void Launcher::DataFilesPage::updateOkButton(const QString &text) +void Launcher::DataFilesPage::updateNewProfileOkButton(const QString &text) { // We do this here because we need the profiles combobox text - if (text.isEmpty()) { - mProfileDialog->setOkButtonEnabled(false); - return; - } + mNewProfileDialog->setOkButtonEnabled(!text.isEmpty() && ui.profilesComboBox->findText(text) == -1); +} - (ui.profilesComboBox->findText(text) == -1) - ? mProfileDialog->setOkButtonEnabled(true) - : mProfileDialog->setOkButtonEnabled(false); +void Launcher::DataFilesPage::updateCloneProfileOkButton(const QString &text) +{ + // We do this here because we need the profiles combobox text + mCloneProfileDialog->setOkButtonEnabled(!text.isEmpty() && ui.profilesComboBox->findText(text) == -1); } void Launcher::DataFilesPage::checkForDefaultProfile() diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index 2cbace38e..36a0db616 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -62,9 +62,11 @@ namespace Launcher void slotProfileDeleted(const QString &item); void slotAddonDataChanged (); - void updateOkButton(const QString &text); + void updateNewProfileOkButton(const QString &text); + void updateCloneProfileOkButton(const QString &text); void on_newProfileAction_triggered(); + void on_cloneProfileAction_triggered(); void on_deleteProfileAction_triggered(); public: @@ -73,7 +75,8 @@ namespace Launcher private: - TextInputDialog *mProfileDialog; + TextInputDialog *mNewProfileDialog; + TextInputDialog *mCloneProfileDialog; Files::ConfigurationManager &mCfgMgr; diff --git a/files/ui/datafilespage.ui b/files/ui/datafilespage.ui index 5c26e1044..8e42ee7cb 100644 --- a/files/ui/datafilespage.ui +++ b/files/ui/datafilespage.ui @@ -2,20 +2,6 @@ DataFilesPage - - - 0 - 0 - 518 - 108 - - - - - 0 - 0 - - Qt::DefaultContextMenu @@ -79,6 +65,19 @@ + + + + Clone Content List + + + Clone Content List + + + true + + + @@ -87,9 +86,6 @@ Delete Content List - - Ctrl+D - true @@ -115,6 +111,22 @@ Ctrl+N + + + + + + + + Clone Content List + + + Clone Content List + + + Ctrl+G + + false @@ -130,6 +142,9 @@ Delete Content List + + Ctrl+D +