mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:10:26 +00:00
Added tooltip with plugin info and visual indication of missing masters
This commit is contained in:
parent
b7ae31d5fe
commit
ada552ed1f
1 changed files with 38 additions and 6 deletions
|
@ -178,9 +178,12 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
|
|
||||||
if (itemList.isEmpty()) // Master is not yet in the widget
|
if (itemList.isEmpty()) // Master is not yet in the widget
|
||||||
{
|
{
|
||||||
// TODO: Show warning, missing master
|
|
||||||
mMastersWidget->insertRow(i);
|
mMastersWidget->insertRow(i);
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
|
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
|
||||||
|
item->setForeground(Qt::red);
|
||||||
|
item->setFlags(item->flags() & ~(Qt::ItemIsSelectable));
|
||||||
|
|
||||||
mMastersWidget->setItem(i, 0, item);
|
mMastersWidget->setItem(i, 0, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,8 +193,30 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
// Now we put the current plugin in the mDataFilesModel under its masters
|
// Now we put the current plugin in the mDataFilesModel under its masters
|
||||||
QStandardItem *parent = new QStandardItem(availableMasters.join(","));
|
QStandardItem *parent = new QStandardItem(availableMasters.join(","));
|
||||||
|
|
||||||
std::string filename = boost::filesystem::path (iter->second.filename()).string();
|
QString fileName = QString::fromStdString(boost::filesystem::path (iter->second.filename()).string());
|
||||||
QStandardItem *child = new QStandardItem(QString::fromStdString(std::string(filename)));
|
QStandardItem *child = new QStandardItem(fileName);
|
||||||
|
|
||||||
|
// Tooltip information
|
||||||
|
QString author = QString::fromStdString(fileReader.getAuthor());
|
||||||
|
float version = fileReader.getFVer();
|
||||||
|
QString description = QString::fromStdString(fileReader.getDesc());
|
||||||
|
|
||||||
|
// For the date created/modified
|
||||||
|
QFileInfo fi(QString::fromStdString(iter->second.string()));
|
||||||
|
|
||||||
|
QString toolTip= QString("<b>Author:</b> %1<br/> \
|
||||||
|
<b>Version:</b> %2<br/><br/> \
|
||||||
|
<b>Description:</b><br/> \
|
||||||
|
%3<br/><br/> \
|
||||||
|
<b>Created on:</b> %4<br/> \
|
||||||
|
<b>Last modified:</b> %5")
|
||||||
|
.arg(author)
|
||||||
|
.arg(version)
|
||||||
|
.arg(description)
|
||||||
|
.arg(fi.created().toString(Qt::TextDate))
|
||||||
|
.arg(fi.lastModified().toString(Qt::TextDate));
|
||||||
|
|
||||||
|
child->setToolTip(toolTip);
|
||||||
|
|
||||||
const QList<QStandardItem*> masterList = mDataFilesModel->findItems(availableMasters.join(","));
|
const QList<QStandardItem*> masterList = mDataFilesModel->findItems(availableMasters.join(","));
|
||||||
|
|
||||||
|
@ -766,6 +791,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index)
|
||||||
if (childIndex.isValid()) {
|
if (childIndex.isValid()) {
|
||||||
// Now we see if the pluginsmodel already contains this plugin
|
// Now we see if the pluginsmodel already contains this plugin
|
||||||
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
|
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
|
||||||
|
const QString childIndexToolTip = QVariant(mDataFilesModel->data(childIndex, Qt::ToolTipRole)).toString();
|
||||||
|
|
||||||
const QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
|
const QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
|
||||||
|
|
||||||
|
@ -775,6 +801,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index)
|
||||||
QStandardItem *item = new QStandardItem(childIndexData);
|
QStandardItem *item = new QStandardItem(childIndexData);
|
||||||
item->setFlags(item->flags() & ~(Qt::ItemIsDropEnabled));
|
item->setFlags(item->flags() & ~(Qt::ItemIsDropEnabled));
|
||||||
item->setCheckable(true);
|
item->setCheckable(true);
|
||||||
|
item->setToolTip(childIndexToolTip);
|
||||||
|
|
||||||
mPluginsModel->appendRow(item);
|
mPluginsModel->appendRow(item);
|
||||||
}
|
}
|
||||||
|
@ -940,6 +967,11 @@ void DataFilesPage::readConfig()
|
||||||
|
|
||||||
void DataFilesPage::writeConfig(QString profile)
|
void DataFilesPage::writeConfig(QString profile)
|
||||||
{
|
{
|
||||||
|
// Don't overwrite the config if no plugins are found
|
||||||
|
if (mPluginsModel->rowCount() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (profile.isEmpty()) {
|
if (profile.isEmpty()) {
|
||||||
profile = mProfilesComboBox->currentText();
|
profile = mProfilesComboBox->currentText();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue