diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-10-10 06:10:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-10 06:10:19 -0400 |
| commit | 0f5ecb8b78b86f309be3ef1902dbf4ee51738fc4 (patch) | |
| tree | 587093f23e31d22b24dda3ac8db1baa5c2334626 | |
| parent | c01e80a651f5e25441330ad20253bb47ad0f516c (diff) | |
| parent | dfb3020f8982e325e804f9e43b28a33b54c798f9 (diff) | |
Merge pull request #864 from isanae/show-usvfs-version
Added usvfs version in log and about dialog
| -rw-r--r-- | src/aboutdialog.cpp | 3 | ||||
| -rw-r--r-- | src/aboutdialog.ui | 7 | ||||
| -rw-r--r-- | src/main.cpp | 5 | ||||
| -rw-r--r-- | src/shared/util.cpp | 46 | ||||
| -rw-r--r-- | src/shared/util.h | 1 |
5 files changed, 60 insertions, 2 deletions
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp index 41fd24f7..6ae7f56d 100644 --- a/src/aboutdialog.cpp +++ b/src/aboutdialog.cpp @@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "aboutdialog.h"
#include "ui_aboutdialog.h"
+#include "util.h"
#include <utility.h>
#include <QApplication>
@@ -85,6 +86,8 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent) ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
+
+ ui->usvfsLabel->setText(ui->usvfsLabel->text() + " " + MOShared::getUsvfsVersionString());
ui->licenseText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
}
diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui index c72a85f8..415ce0a7 100644 --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -105,6 +105,13 @@ </widget>
</item>
<item>
+ <widget class="QLabel" name="usvfsLabel">
+ <property name="text">
+ <string>usvfs:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/main.cpp b/src/main.cpp index f08ba066..776c3775 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -504,8 +504,9 @@ int runApplication(MOApplication &application, SingleInstance &instance, const QString &splashPath) { log::info( - "starting Mod Organizer version {} revision {} in {}", - getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath()); + "starting Mod Organizer version {} revision {} in {}, usvfs: {}", + getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath(), + MOShared::getUsvfsVersionString()); preloadSsl(); if (!QSslSocket::supportsSsl()) { diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 58f4eb2b..32eb825c 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -20,6 +20,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "util.h"
#include "windows_error.h"
#include "mainwindow.h"
+#include <usvfs.h>
+#include <usvfs_version.h>
namespace MOShared
{
@@ -244,6 +246,50 @@ MOBase::VersionInfo createVersionInfo() }
}
+QString getUsvfsDLLVersion()
+{
+ // once 2.2.2 is released, this can be changed to call USVFSVersionString()
+ // directly; until then, using GetProcAddress() allows for mixing up devbuilds
+ // and usvfs dlls
+
+ using USVFSVersionStringType = const char* WINAPI ();
+
+ QString s;
+
+ const auto m = ::LoadLibraryW(L"usvfs_x64.dll");
+
+ if (m) {
+ auto* f = reinterpret_cast<USVFSVersionStringType*>(
+ ::GetProcAddress(m, "USVFSVersionString"));
+
+ if (f) {
+ s = f();
+ }
+
+ ::FreeLibrary(m);
+ }
+
+ if (s.isEmpty()) {
+ s = "?";
+ }
+
+ return s;
+}
+
+QString getUsvfsVersionString()
+{
+ const QString dll = getUsvfsDLLVersion();
+ const QString header = USVFS_VERSION_STRING;
+
+ QString usvfsVersion;
+
+ if (dll == header) {
+ return dll;
+ } else {
+ return "dll is " + dll + ", compiled against " + header;
+ }
+}
+
} // namespace MOShared
diff --git a/src/shared/util.h b/src/shared/util.h index aea6f200..e87244b6 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -45,6 +45,7 @@ std::wstring ToLower(const std::wstring &text); bool CaseInsensitiveEqual(const std::wstring &lhs, const std::wstring &rhs);
MOBase::VersionInfo createVersionInfo();
+QString getUsvfsVersionString();
} // namespace MOShared
|
