Toggle addon files when activated or clicked on checkbox rather than clicked (Fixes #1980)

openmw-35
scrawl 10 years ago
parent 244db5cbfe
commit e413bebe99

@ -125,12 +125,16 @@ void CSVDoc::FileDialog::buildOpenFileView()
if(!mDialogBuilt)
{
connect (mSelector, SIGNAL (signalAddonFileSelected (int)), this, SLOT (slotUpdateAcceptButton (int)));
connect (mSelector, SIGNAL (signalAddonFileUnselected (int)), this, SLOT (slotUpdateAcceptButton (int)));
connect (mSelector, SIGNAL (signalAddonDataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT (slotAddonDataChanged(const QModelIndex&, const QModelIndex&)));
}
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile()));
}
void CSVDoc::FileDialog::slotAddonDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright)
{
slotUpdateAcceptButton(0);
}
void CSVDoc::FileDialog::slotUpdateAcceptButton(int)
{
QString name = "";

@ -70,6 +70,7 @@ namespace CSVDoc
void slotUpdateAcceptButton (int);
void slotUpdateAcceptButton (const QString &, bool);
void slotRejected();
void slotAddonDataChanged(const QModelIndex& topleft, const QModelIndex& bottomright);
};
}
#endif // FILEDIALOG_HPP

@ -106,7 +106,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
//game files can always be checked
if (file->isGameFile())
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
Qt::ItemFlags returnFlags;
bool allDependenciesFound = true;
@ -145,7 +145,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
if (gamefileChecked)
{
if (allDependenciesFound)
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | mDragDropFlags;
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | mDragDropFlags;
else
returnFlags = Qt::ItemIsSelectable;
}

@ -58,7 +58,8 @@ void ContentSelectorView::ContentSelector::buildAddonView()
ui.addonView->setModel(mAddonProxyModel);
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
connect(ui.addonView, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotAddonTableItemActivated(const QModelIndex&)));
connect(mContentModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(signalAddonDataChanged(QModelIndex,QModelIndex)));
}
void ContentSelectorView::ContentSelector::setProfileContent(const QStringList &fileList)
@ -181,7 +182,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
emit signalCurrentGamefileIndexChanged (index);
}
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
void ContentSelectorView::ContentSelector::slotAddonTableItemActivated(const QModelIndex &index)
{
QModelIndex sourceIndex = mAddonProxyModel->mapToSource (index);
@ -194,10 +195,4 @@ void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QMode
checkState = Qt::Checked;
mContentModel->setData(sourceIndex, checkState, Qt::CheckStateRole);
if (checkState == Qt::Checked)
emit signalAddonFileSelected (index.row());
else
emit signalAddonFileUnselected (index.row());
}

@ -55,13 +55,13 @@ namespace ContentSelectorView
signals:
void signalCurrentGamefileIndexChanged (int);
void signalAddonFileSelected (int);
void signalAddonFileUnselected (int);
void signalAddonDataChanged (const QModelIndex& topleft, const QModelIndex& bottomright);
private slots:
void slotCurrentGameFileIndexChanged(int index);
void slotAddonTableItemClicked(const QModelIndex &index);
void slotAddonTableItemActivated(const QModelIndex& index);
};
}

Loading…
Cancel
Save