Changing so that data changes happen only after the addon is checked

pull/456/head
Thunderforge 7 years ago
parent d58cce9c72
commit c2fff61ccd

@ -37,11 +37,14 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config:
connect(mProfileDialog->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(updateOkButton(QString)));
connect(mSelector, SIGNAL(signalSelectedFilesChanged(QStringList)),
this, SLOT(slotSelectedFilesChanged(QStringList)));
buildView();
loadSettings();
// Connect signal and slot after the settings have been loaded. We only care about the user changing
// the addons and don't want to get signals of the system doing it during startup.
connect(mSelector, SIGNAL(signalAddonDataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotAddonDataChanged()));
}
void Launcher::DataFilesPage::buildView()
@ -322,7 +325,11 @@ bool Launcher::DataFilesPage::showDeleteMessageBox (const QString &text)
return (msgBox.clickedButton() == deleteButton);
}
void Launcher::DataFilesPage::slotSelectedFilesChanged(QStringList selectedFilesChanged)
void Launcher::DataFilesPage::slotAddonDataChanged()
{
emit signalSelectedFilesChanged(selectedFilesChanged);
QStringList selectedFiles = selectedFilePaths();
if (previousSelectedFiles != selectedFiles) {
previousSelectedFiles = selectedFiles;
emit signalSelectedFilesChanged(selectedFiles);
}
}

@ -60,7 +60,7 @@ namespace Launcher
void slotProfileChangedByUser(const QString &previous, const QString &current);
void slotProfileRenamed(const QString &previous, const QString &current);
void slotProfileDeleted(const QString &item);
void slotSelectedFilesChanged (QStringList selectedFiles);
void slotAddonDataChanged ();
void updateOkButton(const QString &text);
@ -81,7 +81,7 @@ namespace Launcher
Config::LauncherSettings &mLauncherSettings;
QString mPreviousProfile;
QStringList previousSelectedFiles;
QString mDataLocal;
void setPluginsCheckstates(Qt::CheckState state);

@ -216,8 +216,6 @@ void ContentSelectorView::ContentSelector::slotShowContextMenu(const QPoint& pos
{
QPoint globalPos = ui.addonView->viewport()->mapToGlobal(pos);
mContextMenu->exec(globalPos);
// TODO This is a temporary workaround to demonstrate that the selected files signal can be sent
emitSelectedFilesChanged();
}
void ContentSelectorView::ContentSelector::setCheckStateForMultiSelectedItems(bool checked)
@ -242,14 +240,3 @@ void ContentSelectorView::ContentSelector::slotCheckMultiSelectedItems()
{
setCheckStateForMultiSelectedItems(true);
}
void ContentSelectorView::ContentSelector::emitSelectedFilesChanged()
{
//retrieve the files selected for the profile
ContentSelectorModel::ContentFileList items = selectedFiles();
QStringList filePaths;
foreach(const ContentSelectorModel::EsmFile *item, items) {
filePaths.append(item->filePath());
}
emit signalSelectedFilesChanged(filePaths);
}

@ -15,7 +15,6 @@ namespace ContentSelectorView
Q_OBJECT
QMenu *mContextMenu;
QStringList mFilePaths;
protected:
@ -56,7 +55,6 @@ namespace ContentSelectorView
void buildContextMenu();
void setGameFileSelected(int index, bool selected);
void setCheckStateForMultiSelectedItems(bool checked);
void emitSelectedFilesChanged();
signals:
void signalCurrentGamefileIndexChanged (int);

Loading…
Cancel
Save