diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 45ea9dde80..80694f2796 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -163,7 +163,7 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict) { ESMReader fileReader; QStringList availableMasters; // Will contain all found masters - + fileReader.setEncoding("win1252"); fileReader.open(iter->second.string()); @@ -178,10 +178,13 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict) if (itemList.isEmpty()) // Master is not yet in the widget { - // TODO: Show warning, missing master mMastersWidget->insertRow(i); + QTableWidgetItem *item = new QTableWidgetItem(currentMaster); - mMastersWidget->setItem(i, 0, item); + item->setForeground(Qt::red); + item->setFlags(item->flags() & ~(Qt::ItemIsSelectable)); + + mMastersWidget->setItem(i, 0, item); } } @@ -190,9 +193,31 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict) // Now we put the current plugin in the mDataFilesModel under its masters QStandardItem *parent = new QStandardItem(availableMasters.join(",")); - std::string filename = boost::filesystem::path (iter->second.filename()).string(); - QStandardItem *child = new QStandardItem(QString::fromStdString(std::string(filename))); - + QString fileName = QString::fromStdString(boost::filesystem::path (iter->second.filename()).string()); + 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("Author: %1
\ + Version: %2

\ + Description:
\ + %3

\ + Created on: %4
\ + Last modified: %5") + .arg(author) + .arg(version) + .arg(description) + .arg(fi.created().toString(Qt::TextDate)) + .arg(fi.lastModified().toString(Qt::TextDate)); + + child->setToolTip(toolTip); + const QList masterList = mDataFilesModel->findItems(availableMasters.join(",")); if (masterList.isEmpty()) { // Masters node not yet in the mDataFilesModel @@ -766,6 +791,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index) if (childIndex.isValid()) { // Now we see if the pluginsmodel already contains this plugin const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString(); + const QString childIndexToolTip = QVariant(mDataFilesModel->data(childIndex, Qt::ToolTipRole)).toString(); const QList itemList = mPluginsModel->findItems(childIndexData); @@ -775,6 +801,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index) QStandardItem *item = new QStandardItem(childIndexData); item->setFlags(item->flags() & ~(Qt::ItemIsDropEnabled)); item->setCheckable(true); + item->setToolTip(childIndexToolTip); mPluginsModel->appendRow(item); } @@ -940,6 +967,11 @@ void DataFilesPage::readConfig() void DataFilesPage::writeConfig(QString profile) { + // Don't overwrite the config if no plugins are found + if (mPluginsModel->rowCount() < 1) { + return; + } + if (profile.isEmpty()) { profile = mProfilesComboBox->currentText(); }