Windows fixes

This commit is contained in:
Jack Andersen 2017-12-26 18:10:44 -10:00
parent a686debdcf
commit 4658c9fbc5
7 changed files with 90 additions and 38 deletions

View File

@ -14,7 +14,7 @@ if(APPLE)
endif() endif()
if(WIN32) if(WIN32)
list(APPEND PLAT_SRCS platforms/win/urde.rc) list(APPEND PLAT_SRCS platforms/win/hecl-gui.rc platforms/win/hecl-gui.manifest)
elseif(APPLE) elseif(APPLE)
list(APPEND PLAT_SRCS platforms/mac/mainicon.icns) list(APPEND PLAT_SRCS platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
@ -37,4 +37,4 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE
set_target_properties(hecl-gui PROPERTIES set_target_properties(hecl-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist")
target_link_libraries(hecl-gui ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${PLAT_LIBS} zeus) target_link_libraries(hecl-gui ${PLAT_LIBS} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} zeus)

View File

@ -721,7 +721,7 @@ void MainWindow::initSlots()
connect(m_ui->browseBtn, &QPushButton::clicked, [=]() { connect(m_ui->browseBtn, &QPushButton::clicked, [=]() {
FileDirDialog dialog(this); FileDirDialog dialog(this);
dialog.setWindowTitle("Select ISO or Directory"); dialog.setWindowTitle("Select Working Directory");
int res = dialog.exec();//QFileDialog::getOpenFileName(this, "Select ISO or Directory"); int res = dialog.exec();//QFileDialog::getOpenFileName(this, "Select ISO or Directory");
if (res == QFileDialog::Rejected) if (res == QFileDialog::Rejected)
return; return;

View File

@ -4,12 +4,34 @@
#include <QHeaderView> #include <QHeaderView>
#if _WIN32 #if _WIN32
#include <Windows.h>
#include <VersionHelpers.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
#if __APPLE__ #if __APPLE__
#include "MacOSSystemVersion.hpp" #include "MacOSSystemVersion.hpp"
#elif _WIN32
static QString GetWindowsVersionString()
{
if (IsWindows10OrGreater())
return QStringLiteral("Windows 10");
else if (IsWindows8Point1OrGreater())
return QStringLiteral("Windows 8.1");
else if (IsWindows8OrGreater())
return QStringLiteral("Windows 8");
else if (IsWindows7SP1OrGreater())
return QStringLiteral("Windows 7 SP1");
else if (IsWindows7OrGreater())
return QStringLiteral("Windows 7");
else if (IsWindowsVistaOrGreater())
return QStringLiteral("Windows Vista");
else if (IsWindowsXPOrGreater())
return QStringLiteral("Windows XP");
else
return QStringLiteral("Windows Old And Won't Work");
}
#endif #endif
SysReqTableModel::SysReqTableModel(QObject* parent) SysReqTableModel::SysReqTableModel(QObject* parent)
@ -24,6 +46,10 @@ SysReqTableModel::SysReqTableModel(QObject* parent)
} }
m_cpuSpeedStr.sprintf("%g GHz", m_cpuSpeed / 1000.f); m_cpuSpeedStr.sprintf("%g GHz", m_cpuSpeed / 1000.f);
#if _WIN32 #if _WIN32
MEMORYSTATUSEX memStat = {};
memStat.dwLength = sizeof(memStat);
GlobalMemoryStatusEx(&memStat);
m_memorySize = memStat.ullTotalPhys;
#else #else
m_memorySize = uint64_t(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE); m_memorySize = uint64_t(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE);
#endif #endif
@ -34,6 +60,9 @@ SysReqTableModel::SysReqTableModel(QObject* parent)
m_osVersion.sprintf("macOS %d.%d", m_macosMajor, m_macosMinor); m_osVersion.sprintf("macOS %d.%d", m_macosMajor, m_macosMinor);
else else
m_osVersion.sprintf("macOS %d.%d.%d", m_macosMajor, m_macosMinor, m_macosPatch); m_osVersion.sprintf("macOS %d.%d.%d", m_macosMajor, m_macosMinor, m_macosPatch);
#elif _WIN32
m_win7SP1OrGreater = IsWindows7SP1OrGreater();
m_osVersion = GetWindowsVersionString();
#endif #endif
} }
@ -67,6 +96,8 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const
case 3: case 3:
#ifdef __APPLE__ #ifdef __APPLE__
return m_macosMajor > 10 || m_macosMinor >= 9; return m_macosMajor > 10 || m_macosMinor >= 9;
#elif defined(_WIN32)
return m_win7SP1OrGreater;
#else #else
return true; return true;
#endif #endif
@ -92,6 +123,8 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const
case 3: case 3:
#ifdef __APPLE__ #ifdef __APPLE__
return QStringLiteral("macOS 10.9"); return QStringLiteral("macOS 10.9");
#elif defined(_WIN32)
return QStringLiteral("Windows 7 SP1");
#else #else
return {}; return {};
#endif #endif

View File

@ -17,6 +17,8 @@ class SysReqTableModel : public QAbstractTableModel
int m_macosMajor = 0; int m_macosMajor = 0;
int m_macosMinor = 0; int m_macosMinor = 0;
int m_macosPatch = 0; int m_macosPatch = 0;
#elif _WIN32
bool m_win7SP1OrGreater = false;
#endif #endif
QString m_osVersion; QString m_osVersion;
public: public:

View File

@ -3,8 +3,7 @@
#include "MainWindow.hpp" #include "MainWindow.hpp"
#include "Common.hpp" #include "Common.hpp"
extern const size_t MAINICON_QT_SZ; extern "C" const uint8_t MAINICON_QT[];
extern const uint8_t MAINICON_QT[];
static QIcon MakeAppIcon() static QIcon MakeAppIcon()
{ {

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<description> my exe </description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly>

View File

@ -1,33 +1,33 @@
#include "winver.h" #include "winver.h"
#define IDI_ICON1 101 #define IDI_ICON1 101
IDI_ICON1 ICON DISCARDABLE "mainicon.ico" IDI_ICON1 ICON DISCARDABLE "mainicon.ico"
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0 FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0
FILEFLAGS 0x0L FILEFLAGS 0x0L
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
FILEOS 0x00040004L FILEOS 0x00040004L
FILETYPE 0x1L FILETYPE 0x1L
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "000004b0" BLOCK "000004b0"
BEGIN BEGIN
VALUE "CompanyName", "Antidote / Jackoalan" VALUE "CompanyName", "Antidote / Jackoalan"
VALUE "FileDescription", "HECL" VALUE "FileDescription", "HECL"
VALUE "FileVersion", "BETA" VALUE "FileVersion", "BETA"
VALUE "LegalCopyright", "Copyright (C) 2015-2017 Antidote / Jackoalan" VALUE "LegalCopyright", "Copyright (C) 2015-2017 Antidote / Jackoalan"
VALUE "InternalName", "urde" VALUE "InternalName", "urde"
VALUE "OriginalFilename", "hecl.exe" VALUE "OriginalFilename", "hecl.exe"
VALUE "ProductName", "HECL" VALUE "ProductName", "HECL"
VALUE "ProductVersion", "BETA" VALUE "ProductVersion", "BETA"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
BEGIN BEGIN
VALUE "Translation", 0x0, 1200 VALUE "Translation", 0x0, 1200
END END
END END