Launcher: Clone content list button (feature #4784)

pull/541/head
Capostrophic 6 years ago
parent 7023e86d19
commit 686049679c

@ -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

@ -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()

@ -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;

@ -2,20 +2,6 @@
<ui version="4.0">
<class>DataFilesPage</class>
<widget class="QWidget" name="DataFilesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>518</width>
<height>108</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
@ -79,6 +65,19 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cloneProfileButton">
<property name="toolTip">
<string>Clone Content List</string>
</property>
<property name="text">
<string>Clone Content List</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteProfileButton">
<property name="toolTip">
@ -87,9 +86,6 @@
<property name="text">
<string>Delete Content List</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
@ -115,6 +111,22 @@
<string>Ctrl+N</string>
</property>
</action>
<action name="cloneProfileAction">
<property name="icon">
<iconset theme="edit-copy">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Clone Content List</string>
</property>
<property name="toolTip">
<string>Clone Content List</string>
</property>
<property name="shortcut">
<string>Ctrl+G</string>
</property>
</action>
<action name="deleteProfileAction">
<property name="enabled">
<bool>false</bool>
@ -130,6 +142,9 @@
<property name="toolTip">
<string>Delete Content List</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
<action name="checkAction">
<property name="checkable">

Loading…
Cancel
Save