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

0.6.3
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)), connect(mProfileDialog->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(updateOkButton(QString))); this, SLOT(updateOkButton(QString)));
connect(mSelector, SIGNAL(signalSelectedFilesChanged(QStringList)),
this, SLOT(slotSelectedFilesChanged(QStringList)));
buildView(); buildView();
loadSettings(); 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() void Launcher::DataFilesPage::buildView()
@ -322,7 +325,11 @@ bool Launcher::DataFilesPage::showDeleteMessageBox (const QString &text)
return (msgBox.clickedButton() == deleteButton); 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 slotProfileChangedByUser(const QString &previous, const QString &current);
void slotProfileRenamed(const QString &previous, const QString &current); void slotProfileRenamed(const QString &previous, const QString &current);
void slotProfileDeleted(const QString &item); void slotProfileDeleted(const QString &item);
void slotSelectedFilesChanged (QStringList selectedFiles); void slotAddonDataChanged ();
void updateOkButton(const QString &text); void updateOkButton(const QString &text);
@ -81,7 +81,7 @@ namespace Launcher
Config::LauncherSettings &mLauncherSettings; Config::LauncherSettings &mLauncherSettings;
QString mPreviousProfile; QString mPreviousProfile;
QStringList previousSelectedFiles;
QString mDataLocal; QString mDataLocal;
void setPluginsCheckstates(Qt::CheckState state); void setPluginsCheckstates(Qt::CheckState state);

@ -216,8 +216,6 @@ void ContentSelectorView::ContentSelector::slotShowContextMenu(const QPoint& pos
{ {
QPoint globalPos = ui.addonView->viewport()->mapToGlobal(pos); QPoint globalPos = ui.addonView->viewport()->mapToGlobal(pos);
mContextMenu->exec(globalPos); 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) void ContentSelectorView::ContentSelector::setCheckStateForMultiSelectedItems(bool checked)
@ -241,15 +239,4 @@ void ContentSelectorView::ContentSelector::slotUncheckMultiSelectedItems()
void ContentSelectorView::ContentSelector::slotCheckMultiSelectedItems() void ContentSelectorView::ContentSelector::slotCheckMultiSelectedItems()
{ {
setCheckStateForMultiSelectedItems(true); 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 Q_OBJECT
QMenu *mContextMenu; QMenu *mContextMenu;
QStringList mFilePaths;
protected: protected:
@ -56,7 +55,6 @@ namespace ContentSelectorView
void buildContextMenu(); void buildContextMenu();
void setGameFileSelected(int index, bool selected); void setGameFileSelected(int index, bool selected);
void setCheckStateForMultiSelectedItems(bool checked); void setCheckStateForMultiSelectedItems(bool checked);
void emitSelectedFilesChanged();
signals: signals:
void signalCurrentGamefileIndexChanged (int); void signalCurrentGamefileIndexChanged (int);

Loading…
Cancel
Save