Implemented static resource initialization.

This commit is contained in:
LoRd_MuldeR 2015-01-01 21:34:24 +01:00
parent 22e2b599da
commit b58347f7eb
4 changed files with 45 additions and 8 deletions

View File

@ -15,7 +15,7 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_Resource.cpp" /> <ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_MUtilsData.cpp" />
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\MOC_UpdateChecker.cpp" /> <ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\MOC_UpdateChecker.cpp" />
<ClCompile Include="src\3rd_party\adler32\src\adler32.cpp" /> <ClCompile Include="src\3rd_party\adler32\src\adler32.cpp" />
<ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp" /> <ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp" />
@ -72,7 +72,7 @@
<ClInclude Include="src\CriticalSection_Win32.h" /> <ClInclude Include="src\CriticalSection_Win32.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="res\Resource.qrc"> <CustomBuild Include="res\MUtilsData.qrc">
<FileType>Document</FileType> <FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>

View File

@ -63,9 +63,6 @@
<ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp"> <ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp">
<Filter>Source Files\3rd Party</Filter> <Filter>Source Files\3rd Party</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_Resource.cpp">
<Filter>Source Files\Generated</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\MOC_UpdateChecker.cpp"> <ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\MOC_UpdateChecker.cpp">
<Filter>Source Files\Generated</Filter> <Filter>Source Files\Generated</Filter>
</ClCompile> </ClCompile>
@ -90,6 +87,9 @@
<ClCompile Include="src\Translation.cpp"> <ClCompile Include="src\Translation.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_MUtilsData.cpp">
<Filter>Source Files\Generated</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\CriticalSection_Win32.h"> <ClInclude Include="src\CriticalSection_Win32.h">
@ -160,7 +160,7 @@
<CustomBuild Include="include\Mutils\UpdateChecker.h"> <CustomBuild Include="include\Mutils\UpdateChecker.h">
<Filter>Public Headers</Filter> <Filter>Public Headers</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="res\Resource.qrc"> <CustomBuild Include="res\MUtilsData.qrc">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>

View File

@ -38,10 +38,11 @@
#include <QtPlugin> #include <QtPlugin>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Qt Plugin Initialization // Qt Static Initialization
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#ifdef QT_NODLL #ifdef QT_NODLL
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
Q_IMPORT_PLUGIN(qico) Q_IMPORT_PLUGIN(qico)
Q_IMPORT_PLUGIN(qsvg) Q_IMPORT_PLUGIN(qsvg)
@ -49,7 +50,43 @@ Q_IMPORT_PLUGIN(qsvg)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QICOPlugin) Q_IMPORT_PLUGIN(QICOPlugin)
#endif #endif
#endif
static void doInitializeResources(void)
{
Q_INIT_RESOURCE(MUtilsData);
}
static void doCleanupResources(void)
{
Q_CLEANUP_RESOURCE(MUtilsData);
}
namespace MUtils
{
namespace Startup
{
namespace Internal
{
class ResourceInitializer
{
public:
ResourceInitializer(void)
{
doInitializeResources();
}
~ResourceInitializer(void)
{
doCleanupResources();
}
};
static ResourceInitializer resourceInitializer;
}
}
}
#endif //QT_NODLL
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// MESSAGE HANDLER // MESSAGE HANDLER