forked from mirror/openmw-tes3mp
Reimplemented dependency selection feature
Moved more code to ContentSelector Added support for omwgame and omwaddon files
This commit is contained in:
parent
b24dd5c6ac
commit
2878f51cd3
10 changed files with 99 additions and 227 deletions
|
@ -29,29 +29,14 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
||||||
, mLauncherSettings(launcherSettings)
|
, mLauncherSettings(launcherSettings)
|
||||||
, ContentSelector(parent)
|
, ContentSelector(parent)
|
||||||
{
|
{
|
||||||
// Adjust the tableview widths inside the splitter
|
|
||||||
QList<int> sizeList;
|
|
||||||
sizeList << mLauncherSettings.value(QString("General/MastersTable/width"), QString("200")).toInt();
|
|
||||||
sizeList << mLauncherSettings.value(QString("General/PluginTable/width"), QString("340")).toInt();
|
|
||||||
|
|
||||||
splitter->setSizes(sizeList);
|
|
||||||
|
|
||||||
// Create a dialog for the new profile name input
|
// Create a dialog for the new profile name input
|
||||||
mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this);
|
mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this);
|
||||||
|
|
||||||
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
|
|
||||||
|
|
||||||
connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString)));
|
connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString)));
|
||||||
|
|
||||||
connect(pluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
|
//connect(pluginView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
||||||
//connect(mastersTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
|
//connect(masterView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
||||||
|
|
||||||
connect(pluginsTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
|
||||||
//connect(mastersTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
|
||||||
|
|
||||||
//connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
|
||||||
|
|
||||||
connect(splitter, SIGNAL(splitterMoved(int,int)), this, SLOT(updateSplitter()));
|
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
setupDataFiles();
|
setupDataFiles();
|
||||||
|
@ -193,49 +178,11 @@ void DataFilesPage::updateOkButton(const QString &text)
|
||||||
: mNewProfileDialog->setOkButtonEnabled(false);
|
: mNewProfileDialog->setOkButtonEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::updateSplitter()
|
|
||||||
{
|
|
||||||
// Sigh, update the saved splitter size in settings only when moved
|
|
||||||
// Since getting mSplitter->sizes() if page is hidden returns invalid values
|
|
||||||
QList<int> sizes = splitter->sizes();
|
|
||||||
|
|
||||||
mLauncherSettings.setValue(QString("General/MastersTable/width"), QString::number(sizes.at(0)));
|
|
||||||
mLauncherSettings.setValue(QString("General/PluginsTable/width"), QString::number(sizes.at(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::updateViews()
|
|
||||||
{
|
|
||||||
// Ensure the columns are hidden because sort() re-enables them
|
|
||||||
/*
|
|
||||||
mastersTable->setColumnHidden(1, true);
|
|
||||||
mastersTable->setColumnHidden(2, true);
|
|
||||||
mastersTable->setColumnHidden(3, true);
|
|
||||||
mastersTable->setColumnHidden(4, true);
|
|
||||||
mastersTable->setColumnHidden(5, true);
|
|
||||||
mastersTable->setColumnHidden(6, true);
|
|
||||||
mastersTable->setColumnHidden(7, true);
|
|
||||||
mastersTable->setColumnHidden(8, true);
|
|
||||||
*/
|
|
||||||
pluginsTable->setColumnHidden(1, true);
|
|
||||||
pluginsTable->setColumnHidden(2, true);
|
|
||||||
pluginsTable->setColumnHidden(3, true);
|
|
||||||
pluginsTable->setColumnHidden(4, true);
|
|
||||||
pluginsTable->setColumnHidden(5, true);
|
|
||||||
pluginsTable->setColumnHidden(6, true);
|
|
||||||
pluginsTable->setColumnHidden(7, true);
|
|
||||||
pluginsTable->setColumnHidden(8, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::setProfilesComboBoxIndex(int index)
|
void DataFilesPage::setProfilesComboBoxIndex(int index)
|
||||||
{
|
{
|
||||||
profilesComboBox->setCurrentIndex(index);
|
profilesComboBox->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::slotCurrentIndexChanged(int index)
|
|
||||||
{
|
|
||||||
emit profileChanged(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractItemModel* DataFilesPage::profilesComboBoxModel()
|
QAbstractItemModel* DataFilesPage::profilesComboBoxModel()
|
||||||
{
|
{
|
||||||
return profilesComboBox->model();
|
return profilesComboBox->model();
|
||||||
|
@ -282,54 +229,13 @@ void DataFilesPage::on_deleteProfileAction_triggered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::on_checkAction_triggered()
|
|
||||||
{
|
|
||||||
if (pluginsTable->hasFocus())
|
|
||||||
setPluginsCheckstates(Qt::Checked);
|
|
||||||
|
|
||||||
//if (mastersTable->hasFocus())
|
|
||||||
// setMastersCheckstates(Qt::Checked);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::on_uncheckAction_triggered()
|
|
||||||
{
|
|
||||||
if (pluginsTable->hasFocus())
|
|
||||||
setPluginsCheckstates(Qt::Unchecked);
|
|
||||||
|
|
||||||
//if (mastersTable->hasFocus())
|
|
||||||
// setMastersCheckstates(Qt::Unchecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::setMastersCheckstates(Qt::CheckState state)
|
|
||||||
{/*
|
|
||||||
//if (!mastersTable->selectionModel()->hasSelection()) {
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//QModelIndexList indexes = mastersTable->selectionModel()->selectedIndexes();
|
|
||||||
|
|
||||||
foreach (const QModelIndex &index, indexes)
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QModelIndex sourceIndex = mMastersProxyModel->mapToSource(index);
|
|
||||||
|
|
||||||
if (!sourceIndex.isValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
mDataFilesModel->setCheckState(sourceIndex, state);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::setPluginsCheckstates(Qt::CheckState state)
|
void DataFilesPage::setPluginsCheckstates(Qt::CheckState state)
|
||||||
{
|
{
|
||||||
if (!pluginsTable->selectionModel()->hasSelection()) {
|
if (!pluginView->selectionModel()->hasSelection()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndexList indexes = pluginsTable->selectionModel()->selectedIndexes();
|
QModelIndexList indexes = pluginView->selectionModel()->selectedIndexes();
|
||||||
|
|
||||||
foreach (const QModelIndex &index, indexes)
|
foreach (const QModelIndex &index, indexes)
|
||||||
{
|
{
|
||||||
|
@ -389,7 +295,7 @@ void DataFilesPage::profileRenamed(const QString &previous, const QString &curre
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void DataFilesPage::showContextMenu(const QPoint &point)
|
void DataFilesPage::showContextMenu(const QPoint &point)
|
||||||
{
|
{
|
||||||
QObject *object = QObject::sender();
|
QObject *object = QObject::sender();
|
||||||
|
@ -398,12 +304,12 @@ void DataFilesPage::showContextMenu(const QPoint &point)
|
||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (object->objectName() == QLatin1String("PluginsTable")) {
|
if (object->objectName() == QLatin1String("PluginView")) {
|
||||||
if (!pluginsTable->selectionModel()->hasSelection())
|
if (!pluginView->selectionModel()->hasSelection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPoint globalPos = pluginsTable->mapToGlobal(point);
|
QPoint globalPos = pluginView->mapToGlobal(point);
|
||||||
QModelIndexList indexes = pluginsTable->selectionModel()->selectedIndexes();
|
QModelIndexList indexes = pluginView->selectionModel()->selectedIndexes();
|
||||||
|
|
||||||
// Show the check/uncheck actions depending on the state of the selected items
|
// Show the check/uncheck actions depending on the state of the selected items
|
||||||
uncheckAction->setEnabled(false);
|
uncheckAction->setEnabled(false);
|
||||||
|
@ -427,13 +333,13 @@ void DataFilesPage::showContextMenu(const QPoint &point)
|
||||||
// Show menu
|
// Show menu
|
||||||
mContextMenu->exec(globalPos);
|
mContextMenu->exec(globalPos);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (object->objectName() == QLatin1String("MastersTable")) {
|
if (object->objectName() == QLatin1String("MasterView")) {
|
||||||
if (!mastersTable->selectionModel()->hasSelection())
|
if (!masterView->selectionModel()->hasSelection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPoint globalPos = mastersTable->mapToGlobal(point);
|
QPoint globalPos = masterView->mapToGlobal(point);
|
||||||
QModelIndexList indexes = mastersTable->selectionModel()->selectedIndexes();
|
QModelIndexList indexes = masterView->selectionModel()->selectedIndexes();
|
||||||
|
|
||||||
// Show the check/uncheck actions depending on the state of the selected items
|
// Show the check/uncheck actions depending on the state of the selected items
|
||||||
uncheckAction->setEnabled(false);
|
uncheckAction->setEnabled(false);
|
||||||
|
@ -456,5 +362,6 @@ void DataFilesPage::showContextMenu(const QPoint &point)
|
||||||
|
|
||||||
mContextMenu->exec(globalPos);
|
mContextMenu->exec(globalPos);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -38,21 +38,16 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void setProfilesComboBoxIndex(int index);
|
void setProfilesComboBoxIndex(int index);
|
||||||
|
|
||||||
void showContextMenu(const QPoint &point);
|
//void showContextMenu(const QPoint &point);
|
||||||
void profileChanged(const QString &previous, const QString ¤t);
|
void profileChanged(const QString &previous, const QString ¤t);
|
||||||
void profileRenamed(const QString &previous, const QString ¤t);
|
void profileRenamed(const QString &previous, const QString ¤t);
|
||||||
void updateOkButton(const QString &text);
|
void updateOkButton(const QString &text);
|
||||||
void updateSplitter();
|
|
||||||
void updateViews();
|
|
||||||
|
|
||||||
// Action slots
|
// Action slots
|
||||||
void on_newProfileAction_triggered();
|
void on_newProfileAction_triggered();
|
||||||
void on_deleteProfileAction_triggered();
|
void on_deleteProfileAction_triggered();
|
||||||
void on_checkAction_triggered();
|
|
||||||
void on_uncheckAction_triggered();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotCurrentIndexChanged(int index);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -65,7 +60,6 @@ private:
|
||||||
|
|
||||||
TextInputDialog *mNewProfileDialog;
|
TextInputDialog *mNewProfileDialog;
|
||||||
|
|
||||||
void setMastersCheckstates(Qt::CheckState state);
|
|
||||||
void setPluginsCheckstates(Qt::CheckState state);
|
void setPluginsCheckstates(Qt::CheckState state);
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|
|
@ -49,23 +49,11 @@ FileDialog::FileDialog(QWidget *parent) :
|
||||||
verticalLayout->addLayout(nameLayout);
|
verticalLayout->addLayout(nameLayout);
|
||||||
verticalLayout->addWidget(mButtonBox);
|
verticalLayout->addWidget(mButtonBox);
|
||||||
|
|
||||||
// Set sizes
|
|
||||||
QList<int> sizeList;
|
|
||||||
sizeList << 175;
|
|
||||||
sizeList << 200;
|
|
||||||
|
|
||||||
splitter->setSizes(sizeList);
|
|
||||||
|
|
||||||
resize(600, 400);
|
resize(600, 400);
|
||||||
|
|
||||||
// connect(mDataFilesModel, SIGNAL(checkedItemsChanged(QStringList)), this, SLOT(updateOpenButton(QStringList)));
|
// connect(mDataFilesModel, SIGNAL(checkedItemsChanged(QStringList)), this, SLOT(updateOpenButton(QStringList)));
|
||||||
//connect(mNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
|
//connect(mNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
|
||||||
|
|
||||||
//connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
|
||||||
|
|
||||||
// connect(pluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
|
|
||||||
//connect(mastersTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
|
|
||||||
|
|
||||||
// connect(mCreateButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()));
|
// connect(mCreateButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()));
|
||||||
|
|
||||||
// connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
// connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
@ -89,13 +77,6 @@ void FileDialog::updateCreateButton(const QString &name)
|
||||||
|
|
||||||
mCreateButton->setEnabled(!name.isEmpty());
|
mCreateButton->setEnabled(!name.isEmpty());
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void FileDialog::filterChanged(const QString &filter)
|
|
||||||
{
|
|
||||||
QRegExp filterRe(filter, Qt::CaseInsensitive, QRegExp::FixedString);
|
|
||||||
mFilterProxyModel->setFilterRegExp(filterRe);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
QString FileDialog::fileName()
|
QString FileDialog::fileName()
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,9 +42,6 @@ private slots:
|
||||||
void updateOpenButton(const QStringList &items);
|
void updateOpenButton(const QStringList &items);
|
||||||
void updateCreateButton(const QString &name);
|
void updateCreateButton(const QString &name);
|
||||||
|
|
||||||
|
|
||||||
//void filterChanged(const QString &filter);
|
|
||||||
|
|
||||||
void createButtonClicked();
|
void createButtonClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
FileOrderList::ContentSelector::ContentSelector(QWidget *parent) :
|
FileOrderList::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -22,40 +23,20 @@ void FileOrderList::ContentSelector::buildModelsAndViews()
|
||||||
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||||
|
|
||||||
masterView->setModel(mMasterProxyModel);
|
masterView->setModel(mMasterProxyModel);
|
||||||
/*
|
pluginView->setModel(mPluginsProxyModel);
|
||||||
mastersTable->setModel(mMastersProxyModel);
|
|
||||||
mastersTable->setObjectName("MastersTable");
|
|
||||||
mastersTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
||||||
mastersTable->setSortingEnabled(false);
|
|
||||||
mastersTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
mastersTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
||||||
mastersTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
mastersTable->setAlternatingRowColors(true);
|
|
||||||
mastersTable->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
|
|
||||||
// Set the row height to the size of the checkboxes
|
|
||||||
mastersTable->verticalHeader()->setDefaultSectionSize(height);
|
|
||||||
mastersTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
|
||||||
mastersTable->verticalHeader()->hide();
|
|
||||||
*/
|
|
||||||
pluginsTable->setModel(mPluginsProxyModel);
|
|
||||||
pluginsTable->setObjectName("PluginsTable");
|
|
||||||
pluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
||||||
pluginsTable->setSortingEnabled(false);
|
|
||||||
pluginsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
pluginsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
||||||
pluginsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
pluginsTable->setAlternatingRowColors(true);
|
|
||||||
pluginsTable->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
|
|
||||||
pluginsTable->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
|
|
||||||
connect(mDataFilesModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
|
connect(mDataFilesModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
|
||||||
|
connect(masterView, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentMasterIndexChanged(int)));
|
||||||
|
|
||||||
|
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentProfileIndexChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::addFiles(const QString &path)
|
void FileOrderList::ContentSelector::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
mDataFilesModel->addFiles(path);
|
mDataFilesModel->addFiles(path);
|
||||||
mDataFilesModel->sort(3); // Sort by date accessed
|
mDataFilesModel->sort(3); // Sort by date accessed
|
||||||
|
masterView->setCurrentIndex(-1);
|
||||||
|
mDataFilesModel->uncheckAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::setEncoding(const QString &encoding)
|
void FileOrderList::ContentSelector::setEncoding(const QString &encoding)
|
||||||
|
@ -63,39 +44,22 @@ void FileOrderList::ContentSelector::setEncoding(const QString &encoding)
|
||||||
mDataFilesModel->setEncoding(encoding);
|
mDataFilesModel->setEncoding(encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::setCheckState(QModelIndex index)
|
void FileOrderList::ContentSelector::setCheckState(QModelIndex index, QSortFilterProxyModel *model)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QObject *object = QObject::sender();
|
if (!model)
|
||||||
|
|
||||||
// Not a signal-slot call
|
|
||||||
if (!object)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QModelIndex sourceIndex = model->mapToSource(index);
|
||||||
|
|
||||||
if (object->objectName() == QLatin1String("PluginsTable")) {
|
if (sourceIndex.isValid())
|
||||||
QModelIndex sourceIndex = mPluginsProxyModel->mapToSource(index);
|
{
|
||||||
|
(mDataFilesModel->checkState(sourceIndex) == Qt::Checked)
|
||||||
if (sourceIndex.isValid()) {
|
? mDataFilesModel->setCheckState(sourceIndex, Qt::Unchecked)
|
||||||
(mDataFilesModel->checkState(sourceIndex) == Qt::Checked)
|
: mDataFilesModel->setCheckState(sourceIndex, Qt::Checked);
|
||||||
? mDataFilesModel->setCheckState(sourceIndex, Qt::Unchecked)
|
|
||||||
: mDataFilesModel->setCheckState(sourceIndex, Qt::Checked);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object->objectName() == QLatin1String("MastersTable")) {
|
|
||||||
QModelIndex sourceIndex = mMasterProxyModel->mapToSource(index);
|
|
||||||
|
|
||||||
if (sourceIndex.isValid()) {
|
|
||||||
(mDataFilesModel->checkState(sourceIndex) == Qt::Checked)
|
|
||||||
? mDataFilesModel->setCheckState(sourceIndex, Qt::Unchecked)
|
|
||||||
: mDataFilesModel->setCheckState(sourceIndex, Qt::Checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FileOrderList::ContentSelector::checkedItemsPaths()
|
QStringList FileOrderList::ContentSelector::checkedItemsPaths()
|
||||||
|
@ -106,13 +70,30 @@ QStringList FileOrderList::ContentSelector::checkedItemsPaths()
|
||||||
void FileOrderList::ContentSelector::updateViews()
|
void FileOrderList::ContentSelector::updateViews()
|
||||||
{
|
{
|
||||||
// Ensure the columns are hidden because sort() re-enables them
|
// Ensure the columns are hidden because sort() re-enables them
|
||||||
pluginsTable->setColumnHidden(1, true);
|
pluginView->setColumnHidden(1, true);
|
||||||
pluginsTable->setColumnHidden(3, true);
|
pluginView->setColumnHidden(3, true);
|
||||||
pluginsTable->setColumnHidden(4, true);
|
pluginView->setColumnHidden(4, true);
|
||||||
pluginsTable->setColumnHidden(5, true);
|
pluginView->setColumnHidden(5, true);
|
||||||
pluginsTable->setColumnHidden(6, true);
|
pluginView->setColumnHidden(6, true);
|
||||||
pluginsTable->setColumnHidden(7, true);
|
pluginView->setColumnHidden(7, true);
|
||||||
pluginsTable->setColumnHidden(8, true);
|
pluginView->setColumnHidden(8, true);
|
||||||
pluginsTable->resizeColumnsToContents();
|
pluginView->resizeColumnsToContents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileOrderList::ContentSelector::slotCurrentProfileIndexChanged(int index)
|
||||||
|
{
|
||||||
|
emit profileChanged(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileOrderList::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||||
|
{
|
||||||
|
qDebug() << "index Changed: " << index;
|
||||||
|
QObject *object = QObject::sender();
|
||||||
|
|
||||||
|
// Not a signal-slot call
|
||||||
|
if (!object)
|
||||||
|
return;
|
||||||
|
|
||||||
|
setCheckState(mMasterProxyModel->index(index, 0), mMasterProxyModel);
|
||||||
|
}
|
||||||
|
|
|
@ -30,11 +30,16 @@ namespace FileOrderList
|
||||||
|
|
||||||
void addFiles(const QString &path);
|
void addFiles(const QString &path);
|
||||||
void setEncoding(const QString &encoding);
|
void setEncoding(const QString &encoding);
|
||||||
void setCheckState(QModelIndex index);
|
void setCheckState(QModelIndex index, QSortFilterProxyModel *model);
|
||||||
QStringList checkedItemsPaths();
|
QStringList checkedItemsPaths();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void profileChanged(int index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateViews();
|
void updateViews();
|
||||||
|
void slotCurrentProfileIndexChanged(int index);
|
||||||
|
void slotCurrentMasterIndexChanged(int index);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ Qt::ItemFlags DataFilesModel::flags(const QModelIndex &index) const
|
||||||
if (index.column() == 0) {
|
if (index.column() == 0) {
|
||||||
return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
|
return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
|
||||||
} else {
|
} else {
|
||||||
return Qt::NoItemFlags | Qt::ItemIsSelectable;
|
return Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ void DataFilesModel::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << "*.esp" << "*.esm";
|
filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon";
|
||||||
dir.setNameFilters(filters);
|
dir.setNameFilters(filters);
|
||||||
|
|
||||||
// Create a decoder for non-latin characters in esx metadata
|
// Create a decoder for non-latin characters in esx metadata
|
||||||
|
@ -319,9 +319,10 @@ void DataFilesModel::addFiles(const QString &path)
|
||||||
// Put the file in the table
|
// Put the file in the table
|
||||||
if (findItem(path) == 0)
|
if (findItem(path) == 0)
|
||||||
addFile(file);
|
addFile(file);
|
||||||
|
|
||||||
} catch(std::runtime_error &e) {
|
} catch(std::runtime_error &e) {
|
||||||
// An error occurred while reading the .esp
|
// An error occurred while reading the .esp
|
||||||
qWarning() << "Error reading esp: " << e.what();
|
qWarning() << "Error reading addon file: " << e.what();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,14 +437,10 @@ QStringList DataFilesModel::uncheckedItems()
|
||||||
bool DataFilesModel::canBeChecked(EsmFile *file) const
|
bool DataFilesModel::canBeChecked(EsmFile *file) const
|
||||||
{
|
{
|
||||||
//element can be checked if all its dependencies are
|
//element can be checked if all its dependencies are
|
||||||
bool canBeChecked = true;
|
|
||||||
foreach (const QString &master, file->masters())
|
foreach (const QString &master, file->masters())
|
||||||
{
|
{
|
||||||
if (!mCheckStates.contains(master) || mCheckStates[master] != Qt::Checked)
|
if (!mCheckStates.contains(master) || mCheckStates[master] != Qt::Checked)
|
||||||
{
|
return false;
|
||||||
canBeChecked = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return canBeChecked;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "datafilesmodel.hpp"
|
#include "datafilesmodel.hpp"
|
||||||
|
|
||||||
PluginsProxyModel::PluginsProxyModel(QObject *parent, DataFilesModel *model) :
|
PluginsProxyModel::PluginsProxyModel(QObject *parent, DataFilesModel *model) :
|
||||||
QSortFilterProxyModel(parent), mSourceModel (model)
|
QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
setFilterRegExp (QString("addon"));
|
setFilterRegExp (QString("addon"));
|
||||||
setFilterRole (Qt::UserRole);
|
setFilterRole (Qt::UserRole);
|
||||||
|
@ -25,7 +25,7 @@ QVariant PluginsProxyModel::data(const QModelIndex &index, int role) const
|
||||||
if (index.column() != 0)
|
if (index.column() != 0)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return mSourceModel->checkState(index);
|
return static_cast<DataFilesModel *>(sourceModel())->checkState(mapToSource(index));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ class PluginsProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
DataFilesModel *mSourceModel;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit PluginsProxyModel(QObject *parent = 0, DataFilesModel *model = 0);
|
explicit PluginsProxyModel(QObject *parent = 0, DataFilesModel *model = 0);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<height>304</height>
|
<height>304</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="filterLayout">
|
<layout class="QHBoxLayout" name="filterLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -23,21 +23,33 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<widget class="QTableView" name="pluginView">
|
||||||
<horstretch>0</horstretch>
|
<property name="editTriggers">
|
||||||
<verstretch>0</verstretch>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="selectionMode">
|
||||||
<property name="orientation">
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
</property>
|
<property name="selectionBehavior">
|
||||||
<property name="childrenCollapsible">
|
<enum>QAbstractItemView::SelectItems</enum>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="textElideMode">
|
||||||
<widget class="QTableView" name="pluginsTable"/>
|
<enum>Qt::ElideLeft</enum>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
|
Loading…
Reference in a new issue