Explorar el Código

版本号改好了

zhangyang hace 6 años
padre
commit
1bcef3af12

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


+ 2 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/login.xml

@@ -2,7 +2,8 @@
 <Window size="520,360" caption="0,0,0,36" roundcorner="4,4" >
 	<VerticalLayout bkimage="file='Dialog_BG2.png' corner='4,48,4,4'" >
 		<HorizontalLayout height="44">
-			<Label text="智铺子收银软件V1.0" width="150" height="44" valign="center" padding="10,0,0,0" textcolor="#FFFFFFFF"/>
+			<Label text="智铺子收银软件" width="90" height="44" valign="center" padding="10,0,0,0" textcolor="#FFFFFFFF"/>
+			<Label name="login_version" text="" width="120" height="44" valign="center" padding="10,0,0,0" textcolor="#FFFFFFFF"/>
 			<Control />
 			<Button name="closebtn" width="42" height="18" padding="0,6,0,0" tooltip="关闭收银软件" normalimage="file='frame_btn_close_normal.bmp' mask='#FFFF00FF'" hotimage="file='frame_btn_close_hot.bmp' mask='#FFFF00FF'" pushedimage="file='frame_btn_close_down.bmp' mask='#FFFF00FF'"/>
 		</HorizontalLayout>

+ 1 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting.xml

@@ -92,7 +92,7 @@
 					<Control height="300" />
 					<Label text="智铺子收银软件" align="center">
 					</Label>
-					<Label text="版本号:V1.0" align="center">
+					<Label name="setting_version" text="版本号:V1.0" align="center">
 					</Label>
 					<HorizontalLayout align="center">
 						<Control />

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 35 - 0
zhipuzi_pos_windows/helper/CSystem.h

@@ -13,6 +13,17 @@ public:
     //程序休眠X秒
     static void my_sleep(int second);
 
+	static std::wstring getExePath()
+	{
+		wchar_t exeFullPath[MAX_PATH]; // Full path
+		std::wstring strPath = L"";
+
+		GetModuleFileName(NULL, exeFullPath, MAX_PATH);
+		strPath = (wstring)exeFullPath;    // Get full path of the file
+
+		return strPath;
+	}
+
     static std::wstring GetProgramDir()
     {
         wchar_t exeFullPath[MAX_PATH]; // Full path
@@ -88,5 +99,29 @@ public:
         DWORD dwAttrib = GetFileAttributes(csPath.c_str());
         return INVALID_FILE_ATTRIBUTES != dwAttrib;
     }
+
+    static std::string GetVersion()
+    {
+        std::string r = "";
+
+        UINT sz = GetFileVersionInfoSize(getExePath().c_str(), 0);
+        if(sz != 0)
+        {
+            r.resize(sz, 0);
+            char* pBuf = NULL;
+            pBuf = new char[sz];
+            VS_FIXEDFILEINFO* pVsInfo;
+            if(GetFileVersionInfo(getExePath().c_str(), 0, sz, pBuf))
+            {
+                if(VerQueryValue(pBuf, L"\\", (void**)&pVsInfo, &sz))
+                {
+                    sprintf(pBuf, "%d.%d.%d.%d", HIWORD(pVsInfo->dwFileVersionMS), LOWORD(pVsInfo->dwFileVersionMS), HIWORD(pVsInfo->dwFileVersionLS), LOWORD(pVsInfo->dwFileVersionLS));
+                    r = pBuf;
+                }
+            }
+            delete pBuf;
+        }
+        return r;
+    }
 };
 

+ 1 - 0
zhipuzi_pos_windows/pch/pch.h

@@ -45,6 +45,7 @@ using namespace std;
  **/
 #ifdef _WIN32
 #include <windows.h>
+#include<io.h>
 #else
 #include <unistd.h>
 #include <sys/sysinfo.h>

BIN
zhipuzi_pos_windows/resource/zhipuzi_pos_windows.aps


BIN
zhipuzi_pos_windows/resource/zhipuzi_pos_windows.rc


+ 3 - 0
zhipuzi_pos_windows/wnd/CLoginWnd.cpp

@@ -3,6 +3,9 @@
 
 void CLoginWnd::Init()
 {
+	CLabelUI* version = static_cast<CLabelUI*>(m_pm.FindControl(_T("login_version")));
+	version->SetText(CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion()).c_str());
+
 	std::map<string, string> users = CSetting::getUsers();
 
 	CComboUI* pCom = static_cast<CComboUI*>(m_pm.FindControl(_T("accountcombo")));

+ 3 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -1236,6 +1236,9 @@ LRESULT CMainWnd::OnTrayIcon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
 
 void CMainWnd::InitSettingStatus()
 {
+	CLabelUI* version = static_cast<CLabelUI*>(m_pm.FindControl(_T("setting_version")));
+	version->SetText((L"版本号:" + CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion())).c_str());
+
     CCheckBoxUI* box = NULL;
     CComboUI* com = NULL;
 

+ 3 - 2
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -134,7 +134,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <AdditionalLibraryDirectories>$(SolutionDir)lib\debug</AdditionalLibraryDirectories>
-      <AdditionalDependencies>dbghelp.lib;winmm.lib;setupapi.lib;AdvAPI32.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;libcurl.lib;DuiLib_ud.lib;log4cplusUD.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dbghelp.lib;winmm.lib;setupapi.lib;AdvAPI32.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;libcurl.lib;DuiLib_ud.lib;log4cplusUD.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>
       </IgnoreSpecificDefaultLibraries>
       <Version>
@@ -189,7 +189,8 @@ copy $(SolutionDir)res\icon\ $(SolutionDir)bin\$(Platform)\$(Configuration)\$(Pr
       <OptimizeReferences>true</OptimizeReferences>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <AdditionalLibraryDirectories>$(SolutionDir)lib\release\grpc;$(SolutionDir)lib;$(SolutionDir)lib\release</AdditionalLibraryDirectories>
-      <AdditionalDependencies>log4cplus.lib;aliyun-mns.lib;libcurl.lib;libeay32.lib;ssleay32.lib;mysqlcppconn.lib;libprotobuf.lib;grpc.lib;grpc++.lib;cares.lib;gpr.lib;zlib.lib;address_sorting.lib;ssl.lib;crypto.lib</AdditionalDependencies>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
       <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
     </Link>
     <PostBuildEvent>