forked from mirror/openmw-tes3mp
Fixed filter issue (all addons for a gamefile are enabled for checking).
Note: Other dependencies are not yet automatically selected when an addon is checked.
This commit is contained in:
parent
513f0c4b3e
commit
d7cff6361e
4 changed files with 26 additions and 13 deletions
|
@ -25,7 +25,6 @@ namespace CSVDoc
|
||||||
|
|
||||||
void setLocalData (const boost::filesystem::path& localData);
|
void setLocalData (const boost::filesystem::path& localData);
|
||||||
|
|
||||||
QString getText() const;
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
boost::filesystem::path getPath() const;
|
boost::filesystem::path getPath() const;
|
||||||
|
|
|
@ -67,7 +67,6 @@ void CSVDoc::FileDialog::slotEnableCreateButton(bool enable, int widgetNumber)
|
||||||
if (widgetNumber == 2)
|
if (widgetNumber == 2)
|
||||||
mEnable_2 = enable;
|
mEnable_2 = enable;
|
||||||
|
|
||||||
qDebug() << "update enabled" << mEnable_1 << mEnable_2 << enable;
|
|
||||||
projectCreateButton->setEnabled(mEnable_1 && mEnable_2);
|
projectCreateButton->setEnabled(mEnable_1 && mEnable_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,5 +112,5 @@ void CSVDoc::FileDialog::slotAdjusterChanged(bool value)
|
||||||
|
|
||||||
void CSVDoc::FileDialog::slotGameFileSelected(int value)
|
void CSVDoc::FileDialog::slotGameFileSelected(int value)
|
||||||
{
|
{
|
||||||
emit signalUpdateCreateButton(value > -1, 1);
|
emit signalUpdateCreateButton(value > -1, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(int row)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::findItem(const QString &name) const
|
const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(const QString &name) const
|
||||||
{
|
{
|
||||||
foreach (const EsmFile *file, mFiles)
|
foreach (const EsmFile *file, mFiles)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
||||||
if (canBeChecked(file))
|
if (canBeChecked(file))
|
||||||
return Qt::ItemIsEnabled | mDragDropFlags | mDefaultFlags;
|
return Qt::ItemIsEnabled | mDragDropFlags | mDefaultFlags;
|
||||||
|
|
||||||
return mDefaultFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int role) const
|
QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int role) const
|
||||||
|
@ -167,7 +167,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
if (file->isGameFile())
|
if (file->isGameFile())
|
||||||
return ContentType_GameFile;
|
return ContentType_GameFile;
|
||||||
else
|
else
|
||||||
if (flags(index) & Qt::ItemIsEnabled)
|
if (flags(index) & mDefaultFlags)
|
||||||
return ContentType_Addon;
|
return ContentType_Addon;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -373,12 +373,26 @@ bool ContentSelectorModel::ContentModel::dropMimeData(const QMimeData *data, Qt:
|
||||||
|
|
||||||
bool ContentSelectorModel::ContentModel::canBeChecked(const EsmFile *file) const
|
bool ContentSelectorModel::ContentModel::canBeChecked(const EsmFile *file) const
|
||||||
{
|
{
|
||||||
//element can be checked if all its dependencies are
|
//game files can always be checked
|
||||||
foreach (const QString &gamefile, file->gameFiles())
|
if (file->isGameFile())
|
||||||
if (!isChecked(gamefile))
|
return true;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
//addon can be checked if its gamefile is
|
||||||
|
foreach (const QString &fileName, file->gameFiles())
|
||||||
|
{
|
||||||
|
const EsmFile *dependency = item(fileName);
|
||||||
|
|
||||||
|
if (!dependency)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (dependency->isGameFile())
|
||||||
|
{
|
||||||
|
if (isChecked(fileName))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorModel::ContentModel::addFile(EsmFile *file)
|
void ContentSelectorModel::ContentModel::addFile(EsmFile *file)
|
||||||
|
@ -422,7 +436,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
|
|
||||||
|
|
||||||
// Put the file in the table
|
// Put the file in the table
|
||||||
if (findItem(path) == 0)
|
if (item(path) == 0)
|
||||||
addFile(file);
|
addFile(file);
|
||||||
|
|
||||||
} catch(std::runtime_error &e) {
|
} catch(std::runtime_error &e) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ContentSelectorModel
|
||||||
void addFiles(const QString &path);
|
void addFiles(const QString &path);
|
||||||
|
|
||||||
QModelIndex indexFromItem(const EsmFile *item) const;
|
QModelIndex indexFromItem(const EsmFile *item) const;
|
||||||
const EsmFile *findItem(const QString &name) const;
|
const EsmFile *item(const QString &name) const;
|
||||||
|
|
||||||
bool isChecked(const QString &name) const;
|
bool isChecked(const QString &name) const;
|
||||||
void setCheckState(const QString &name, bool isChecked);
|
void setCheckState(const QString &name, bool isChecked);
|
||||||
|
@ -54,6 +54,7 @@ namespace ContentSelectorModel
|
||||||
void addFile(EsmFile *file);
|
void addFile(EsmFile *file);
|
||||||
const EsmFile *item(int row) const;
|
const EsmFile *item(int row) const;
|
||||||
EsmFile *item(int row);
|
EsmFile *item(int row);
|
||||||
|
|
||||||
bool canBeChecked(const EsmFile *file) const;
|
bool canBeChecked(const EsmFile *file) const;
|
||||||
|
|
||||||
ContentFileList mFiles;
|
ContentFileList mFiles;
|
||||||
|
|
Loading…
Reference in a new issue