Implemented static resource initialization.
This commit is contained in:
parent
22e2b599da
commit
b58347f7eb
@ -15,7 +15,7 @@
|
||||
</ProjectConfiguration>
|
||||
</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="src\3rd_party\adler32\src\adler32.cpp" />
|
||||
<ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp" />
|
||||
@ -72,7 +72,7 @@
|
||||
<ClInclude Include="src\CriticalSection_Win32.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="res\Resource.qrc">
|
||||
<CustomBuild Include="res\MUtilsData.qrc">
|
||||
<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)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
|
||||
|
@ -63,9 +63,6 @@
|
||||
<ClCompile Include="src\3rd_party\strnatcmp\src\strnatcmp.cpp">
|
||||
<Filter>Source Files\3rd Party</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_Resource.cpp">
|
||||
<Filter>Source Files\Generated</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\MOC_UpdateChecker.cpp">
|
||||
<Filter>Source Files\Generated</Filter>
|
||||
</ClCompile>
|
||||
@ -90,6 +87,9 @@
|
||||
<ClCompile Include="src\Translation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(SolutionDir)\tmp\$(ProjectName)\QRC_MUtilsData.cpp">
|
||||
<Filter>Source Files\Generated</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\CriticalSection_Win32.h">
|
||||
@ -160,7 +160,7 @@
|
||||
<CustomBuild Include="include\Mutils\UpdateChecker.h">
|
||||
<Filter>Public Headers</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\Resource.qrc">
|
||||
<CustomBuild Include="res\MUtilsData.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
|
@ -38,10 +38,11 @@
|
||||
#include <QtPlugin>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Qt Plugin Initialization
|
||||
// Qt Static Initialization
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef QT_NODLL
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
Q_IMPORT_PLUGIN(qico)
|
||||
Q_IMPORT_PLUGIN(qsvg)
|
||||
@ -49,7 +50,43 @@ Q_IMPORT_PLUGIN(qsvg)
|
||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
|
||||
Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user