summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2018-03-12 17:36:01 -0500
committerGitHub <noreply@github.com>2018-03-12 17:36:01 -0500
commite0f003a9a6966b9ee228a5140074ac7ee0f66ed8 (patch)
tree89a7f16f71633efa5627140c2f017d616aec4902 /src
parent9c596ceb791a77c00bbc970b12d5b40acb43706d (diff)
parentccb5ad53e22e54f416c4cc3f33c2b57d0b1b672a (diff)
Merge pull request #273 from Al12rs/Develop
Fixed file preview bug, wrong nexus urls in csv export and reverted some ui changes from Creator
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp22
-rw-r--r--src/mainwindow.ui4
2 files changed, 19 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 83a12437..5be5cef3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3201,7 +3201,7 @@ void MainWindow::exportModListCSV()
if (nexus_ID->isChecked())
builder.setRowField("#Nexus_ID", info->getNexusID());
if (mod_Nexus_URL->isChecked())
- builder.setRowField("#Mod_Nexus_URL", info->getURL());
+ builder.setRowField("#Mod_Nexus_URL",(info->getNexusID()>0)? NexusInterface::instance()->getModURL(info->getNexusID()) : "");
if (mod_Version->isChecked())
builder.setRowField("#Mod_Version", info->getVersion().canonicalString());
if (install_Date->isChecked())
@@ -3929,10 +3929,22 @@ void MainWindow::previewDataFile()
// what we have is an absolute path to the file in its actual location (for the primary origin)
// what we want is the path relative to the virtual data directory
- // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory
- int offset = m_OrganizerCore.settings().getModDirectory().size() + 1;
- offset = fileName.indexOf("/", offset);
- fileName = fileName.mid(offset + 1);
+ // we need to look in the virtual directory for the file to make sure the info is up to date.
+
+ // check if the file comes from the actual data folder instead of a mod
+ QDir gameDirectory = m_OrganizerCore.managedGame()->dataDirectory().absolutePath();
+ QString relativePath = gameDirectory.relativeFilePath(fileName);
+ if (!relativePath.startsWith("..")) {
+ fileName = relativePath;
+ }
+ else {
+ // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory
+ int offset = m_OrganizerCore.settings().getModDirectory().size() + 1;
+ offset = fileName.indexOf("/", offset);
+ fileName = fileName.mid(offset + 1);
+ }
+
+
const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr);
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 451e3c87..0c0ac6c6 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -176,7 +176,7 @@
<number>2</number>
</property>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,1,0,0,0,0,0">
+ <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,1,0,0,0,0">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
@@ -463,7 +463,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1,1,1,0">
+ <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1,1,1">
<item>
<widget class="QPushButton" name="displayCategoriesBtn">
<property name="maximumSize">