mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:29:55 +00:00
Merge remote-tracking branch 'scrawl/contentselector'
This commit is contained in:
commit
fa4718283d
5 changed files with 16 additions and 16 deletions
|
@ -125,13 +125,17 @@ void CSVDoc::FileDialog::buildOpenFileView()
|
||||||
|
|
||||||
if(!mDialogBuilt)
|
if(!mDialogBuilt)
|
||||||
{
|
{
|
||||||
connect (mSelector, SIGNAL (signalAddonFileSelected (int)), this, SLOT (slotUpdateAcceptButton (int)));
|
connect (mSelector, SIGNAL (signalAddonDataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT (slotAddonDataChanged(const QModelIndex&, const QModelIndex&)));
|
||||||
connect (mSelector, SIGNAL (signalAddonFileUnselected (int)), this, SLOT (slotUpdateAcceptButton (int)));
|
|
||||||
}
|
}
|
||||||
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile()));
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::slotUpdateAcceptButton (int)
|
void CSVDoc::FileDialog::slotAddonDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright)
|
||||||
|
{
|
||||||
|
slotUpdateAcceptButton(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVDoc::FileDialog::slotUpdateAcceptButton(int)
|
||||||
{
|
{
|
||||||
QString name = "";
|
QString name = "";
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace CSVDoc
|
||||||
void slotUpdateAcceptButton (int);
|
void slotUpdateAcceptButton (int);
|
||||||
void slotUpdateAcceptButton (const QString &, bool);
|
void slotUpdateAcceptButton (const QString &, bool);
|
||||||
void slotRejected();
|
void slotRejected();
|
||||||
|
void slotAddonDataChanged(const QModelIndex& topleft, const QModelIndex& bottomright);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // FILEDIALOG_HPP
|
#endif // FILEDIALOG_HPP
|
||||||
|
|
|
@ -113,7 +113,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
||||||
|
|
||||||
//game files can always be checked
|
//game files can always be checked
|
||||||
if (file->isGameFile())
|
if (file->isGameFile())
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
||||||
|
|
||||||
Qt::ItemFlags returnFlags;
|
Qt::ItemFlags returnFlags;
|
||||||
bool allDependenciesFound = true;
|
bool allDependenciesFound = true;
|
||||||
|
@ -152,7 +152,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
||||||
if (gamefileChecked)
|
if (gamefileChecked)
|
||||||
{
|
{
|
||||||
if (allDependenciesFound)
|
if (allDependenciesFound)
|
||||||
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | mDragDropFlags;
|
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | mDragDropFlags;
|
||||||
else
|
else
|
||||||
returnFlags = Qt::ItemIsSelectable;
|
returnFlags = Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ void ContentSelectorView::ContentSelector::buildAddonView()
|
||||||
|
|
||||||
ui.addonView->setModel(mAddonProxyModel);
|
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)
|
void ContentSelectorView::ContentSelector::setProfileContent(const QStringList &fileList)
|
||||||
|
@ -171,7 +172,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
|
||||||
emit signalCurrentGamefileIndexChanged (index);
|
emit signalCurrentGamefileIndexChanged (index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
|
void ContentSelectorView::ContentSelector::slotAddonTableItemActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QModelIndex sourceIndex = mAddonProxyModel->mapToSource (index);
|
QModelIndex sourceIndex = mAddonProxyModel->mapToSource (index);
|
||||||
|
|
||||||
|
@ -184,10 +185,4 @@ void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QMode
|
||||||
checkState = Qt::Checked;
|
checkState = Qt::Checked;
|
||||||
|
|
||||||
mContentModel->setData(sourceIndex, checkState, Qt::CheckStateRole);
|
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:
|
signals:
|
||||||
void signalCurrentGamefileIndexChanged (int);
|
void signalCurrentGamefileIndexChanged (int);
|
||||||
void signalAddonFileSelected (int);
|
|
||||||
void signalAddonFileUnselected (int);
|
void signalAddonDataChanged (const QModelIndex& topleft, const QModelIndex& bottomright);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void slotCurrentGameFileIndexChanged(int index);
|
void slotCurrentGameFileIndexChanged(int index);
|
||||||
void slotAddonTableItemClicked(const QModelIndex &index);
|
void slotAddonTableItemActivated(const QModelIndex& index);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue