Skip to content

Commit 4bc2fcc

Browse files
committed
更新readme
1 parent c066da5 commit 4bc2fcc

34 files changed

+4969
-0
lines changed

DrCOM_JLU_Qt.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ RESOURCES += \
5858
# Single Application implementation
5959
include(.\singleinstance\singleapplication.pri)
6060
DEFINES += QAPPLICATION_CLASS=QApplication
61+
62+
# QtKeyChain inplementation
63+
include(.\qtkeychain\qt5keychain.pri)
64+
65+
DISTFILES +=

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
11
# drcom-jlu-qt
22
drcom for jlu in qt cross platform
3+
4+
跨平台 win linux mac
5+
linux 和 mac 还没来得及测试
6+
7+
等测试完再放release二进制包
8+
9+
已实现的功能:
10+
1. 自动识别mac地址
11+
2. 记住窗口大小
12+
3. 最小化到托盘
13+
4. 单实例
14+
5. 记住密码
15+
6. 自动登录(尚未测试
16+
7.
17+
18+
待实现的功能:
19+
1. 汉化。。。
20+
2. 密码加密保存(已引入别人的库,还不知道怎么用
21+
3. 喵喵喵?
22+
23+
感谢:
24+
jlu的drcom协议细节 https://github.com/drcoms/jlu-drcom-client/blob/master/jlu-drcom-java/jlu-drcom-protocol.md
25+
加密保存密码(待实现 https://github.com/frankosterfeld/qtkeychain
26+
唯一实例 https://github.com/itay-grudev/SingleApplication
27+
28+
特别感谢:
29+
https://github.com/mchome/dogcom
30+
提取出来jlu部分的代码改动到此项目中
31+
32+
许可证:
33+
GNU Affero General Public License v3.0

qtkeychain/.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#CMake files
2+
CMakeCache.txt
3+
CMakeFiles
4+
CMakeScripts
5+
cmake_install.cmake
6+
7+
#Keychain temporary files
8+
Qt5KeychainBuildTreeSettings.cmake
9+
Qt5KeychainConfig.cmake
10+
Qt5KeychainConfigVersion.cmake
11+
QtKeychainBuildTreeSettings.cmake
12+
QtKeychainConfig.cmake
13+
QtKeychainConfigVersion.cmake
14+
kwallet_interface.cpp
15+
kwallet_interface.h
16+
kwallet_interface.moc
17+
moc_keychain.*
18+
moc_keychain_p.*
19+
20+
#Qt files
21+
*_parameters
22+
*.qm
23+
24+
#General build files
25+
Debug
26+
Release
27+
Makefile
28+
29+
#Linux build files
30+
libqt5keychain.*
31+
testclient
32+
33+
#Windows build files
34+
install_manifest.txt
35+
*.manifest
36+
*.lib
37+
*.exe
38+
39+
#Mac build files
40+
qtkeychain.xcodeproj
41+
qtkeychain.build
42+
43+
#Temporary files
44+
*.sw?
45+
*~
46+
47+

qtkeychain/CMakeLists.txt

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
cmake_minimum_required(VERSION 2.8.11)
2+
project(qtkeychain)
3+
4+
include(FindPkgConfig)
5+
6+
###
7+
8+
set(QTKEYCHAIN_VERSION 0.9.1)
9+
set(QTKEYCHAIN_SOVERSION 1)
10+
11+
###
12+
13+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
14+
include(GNUInstallDirs)
15+
include(GenerateExportHeader)
16+
include(ECMPackageConfigHelpers)
17+
include(ECMSetupVersion)
18+
include(ECMGeneratePriFile)
19+
20+
option(BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF)
21+
option(BUILD_TEST_APPLICATION "Build test application" ON)
22+
option(BUILD_TRANSLATIONS "Build translations" ON)
23+
option(QTKEYCHAIN_STATIC "Build static library" OFF)
24+
25+
if(CMAKE_SYSTEM_NAME STREQUAL Android)
26+
set(ANDROID 1)
27+
endif()
28+
29+
if (WIN32)
30+
option(USE_CREDENTIAL_STORE "Build with windows CredentialStore support" ON)
31+
32+
if (USE_CREDENTIAL_STORE)
33+
add_definitions(-DUSE_CREDENTIAL_STORE=1)
34+
endif()
35+
endif()
36+
37+
if( NOT BUILD_WITH_QT4 )
38+
# try Qt5 first, and prefer that if found
39+
find_package(Qt5Core QUIET)
40+
endif()
41+
42+
if (Qt5Core_FOUND AND NOT BUILD_WITH_QT4)
43+
set(QTKEYCHAIN_VERSION_INFIX 5)
44+
45+
if(UNIX AND NOT APPLE AND NOT ANDROID)
46+
find_package(Qt5DBus REQUIRED)
47+
include_directories(${Qt5DBus_INCLUDE_DIRS})
48+
set(QTDBUS_LIBRARIES ${Qt5DBus_LIBRARIES})
49+
macro(qt_add_dbus_interface)
50+
qt5_add_dbus_interface(${ARGN})
51+
endmacro()
52+
endif()
53+
54+
if(BUILD_TRANSLATIONS)
55+
find_package(Qt5LinguistTools REQUIRED)
56+
macro(qt_add_translation)
57+
qt5_add_translation(${ARGN})
58+
endmacro(qt_add_translation)
59+
macro(qt_create_translation)
60+
qt5_create_translation(${ARGN})
61+
endmacro(qt_create_translation)
62+
endif()
63+
64+
macro(qt_wrap_cpp)
65+
qt5_wrap_cpp(${ARGN})
66+
endmacro()
67+
68+
set(QTCORE_LIBRARIES ${Qt5Core_LIBRARIES})
69+
include_directories(${Qt5Core_INCLUDE_DIRS})
70+
71+
if (NOT Qt5Core_VERSION VERSION_LESS "5.7.0")
72+
if (CMAKE_COMPILER_IS_GNUCXX)
73+
if ((NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.0"))
74+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
75+
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
76+
message(FATAL_ERROR "Can't build QtKeychain using g++-${CMAKE_CXX_COMPILER_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
77+
endif()
78+
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
79+
if (NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3)
80+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
81+
else()
82+
message(FATAL_ERROR "Can't build QtKeychain using clang++-${CMAKE_CXX_COMPILER_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
83+
endif()
84+
elseif ((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND (MSVC_VERSION LESS 1700))
85+
message(FATAL_ERROR "Can't build QtKeychain using VC++-${MSVC_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
86+
endif()
87+
endif()
88+
else()
89+
set(QTKEYCHAIN_VERSION_INFIX "")
90+
if(UNIX AND NOT APPLE)
91+
find_package(Qt4 COMPONENTS QtCore QtDBus REQUIRED)
92+
set(QTDBUS_LIBRARIES ${QT_QTDBUS_LIBRARY})
93+
macro(qt_add_dbus_interface)
94+
qt4_add_dbus_interface(${ARGN})
95+
endmacro()
96+
else()
97+
find_package(Qt4 COMPONENTS QtCore REQUIRED)
98+
endif()
99+
include_directories(${QT_INCLUDES})
100+
set(QTCORE_LIBRARIES ${QT_QTCORE_LIBRARY})
101+
macro(qt_add_translation)
102+
qt4_add_translation(${ARGN})
103+
endmacro(qt_add_translation)
104+
macro(qt_create_translation)
105+
qt4_create_translation(${ARGN})
106+
endmacro(qt_create_translation)
107+
macro(qt_wrap_cpp)
108+
qt4_wrap_cpp(${ARGN})
109+
endmacro()
110+
endif()
111+
112+
113+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
114+
115+
list(APPEND qtkeychain_LIBRARIES ${QTCORE_LIBRARIES})
116+
set(qtkeychain_SOURCES
117+
keychain.cpp
118+
qkeychain_export.h
119+
keychain.h
120+
)
121+
122+
add_definitions( -Wall )
123+
124+
if(WIN32)
125+
list(APPEND qtkeychain_SOURCES keychain_win.cpp)
126+
if (NOT USE_CREDENTIAL_STORE)
127+
list(APPEND qtkeychain_LIBRARIES crypt32)
128+
list(APPEND qtkeychain_SOURCES plaintextstore.cpp)
129+
endif()
130+
#FIXME: mingw bug; otherwise getting undefined refs to RtlSecureZeroMemory there
131+
if(MINGW)
132+
add_definitions( -O2 )
133+
endif()
134+
endif()
135+
136+
if(APPLE)
137+
if(IOS)
138+
list(APPEND qtkeychain_SOURCES keychain_ios.cpp)
139+
else()
140+
list(APPEND qtkeychain_SOURCES keychain_mac.cpp)
141+
endif()
142+
143+
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
144+
list(APPEND qtkeychain_LIBRARIES ${COREFOUNDATION_LIBRARY})
145+
146+
find_library(SECURITY_LIBRARY Security REQUIRED)
147+
list(APPEND qtkeychain_LIBRARIES ${SECURITY_LIBRARY})
148+
endif()
149+
150+
if(UNIX AND NOT APPLE AND NOT ANDROID)
151+
option(LIBSECRET_SUPPORT "Build with libsecret support" ON)
152+
153+
if(LIBSECRET_SUPPORT)
154+
pkg_check_modules(LIBSECRET libsecret-1)
155+
156+
if (LIBSECRET_FOUND)
157+
add_definitions(-DHAVE_LIBSECRET=1)
158+
endif()
159+
INCLUDE_DIRECTORIES(${LIBSECRET_INCLUDE_DIRS})
160+
list(APPEND qtkeychain_LIBRARIES ${LIBSECRET_LIBRARIES})
161+
endif()
162+
163+
list(APPEND qtkeychain_SOURCES keychain_unix.cpp gnomekeyring.cpp libsecret.cpp plaintextstore.cpp)
164+
qt_add_dbus_interface(qtkeychain_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.KWallet.xml kwallet_interface KWalletInterface)
165+
list(APPEND qtkeychain_LIBRARIES ${QTDBUS_LIBRARIES} )
166+
endif()
167+
168+
QT_WRAP_CPP(qtkeychain_MOC_OUTFILES keychain.h keychain_p.h gnomekeyring_p.h)
169+
170+
set(qtkeychain_TR_FILES
171+
translations/qtkeychain_de.ts
172+
translations/qtkeychain_ro.ts
173+
)
174+
175+
file(GLOB qtkeychain_TR_SOURCES *.cpp *.h *.ui)
176+
if ( BUILD_TRANSLATIONS )
177+
qt_create_translation(qtkeychain_MESSAGES ${qtkeychain_TR_SOURCES} ${qtkeychain_TR_FILES})
178+
qt_add_translation(qtkeychain_QM_FILES ${qtkeychain_TR_FILES})
179+
add_custom_target(messages DEPENDS ${qtkeychain_MESSAGES})
180+
add_custom_target(translations DEPENDS ${qtkeychain_QM_FILES})
181+
182+
if(NOT QT_TRANSLATIONS_DIR)
183+
# If this directory is missing, we are in a Qt5 environment.
184+
# Extract the qmake executable location
185+
get_target_property(QT5_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
186+
# Ask Qt5 where to put the translations
187+
execute_process( COMMAND ${QT5_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS
188+
OUTPUT_VARIABLE qt_translations_dir OUTPUT_STRIP_TRAILING_WHITESPACE )
189+
# make sure we have / and not \ as qmake gives on windows
190+
file( TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir)
191+
set( QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH
192+
"The location of the Qt translations" FORCE)
193+
endif()
194+
195+
install(FILES ${qtkeychain_QM_FILES}
196+
DESTINATION ${QT_TRANSLATIONS_DIR})
197+
endif( BUILD_TRANSLATIONS )
198+
199+
set(QTKEYCHAIN_TARGET_NAME qt${QTKEYCHAIN_VERSION_INFIX}keychain)
200+
if(NOT QTKEYCHAIN_STATIC)
201+
add_library(${QTKEYCHAIN_TARGET_NAME} SHARED ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES} ${qtkeychain_QM_FILES})
202+
else()
203+
add_library(${QTKEYCHAIN_TARGET_NAME} STATIC ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES} ${qtkeychain_QM_FILES})
204+
endif()
205+
206+
target_link_libraries(${QTKEYCHAIN_TARGET_NAME} PUBLIC ${qtkeychain_LIBRARIES})
207+
target_include_directories(${QTKEYCHAIN_TARGET_NAME} PUBLIC $<INSTALL_INTERFACE:include/>)
208+
209+
generate_export_header(${QTKEYCHAIN_TARGET_NAME}
210+
EXPORT_FILE_NAME qkeychain_export.h
211+
EXPORT_MACRO_NAME QKEYCHAIN_EXPORT
212+
)
213+
214+
set_target_properties(${QTKEYCHAIN_TARGET_NAME} PROPERTIES
215+
VERSION ${QTKEYCHAIN_VERSION}
216+
SOVERSION ${QTKEYCHAIN_SOVERSION}
217+
MACOSX_RPATH 1
218+
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
219+
INSTALL_RPATH_USE_LINK_PATH TRUE
220+
)
221+
222+
install(FILES keychain.h ${CMAKE_CURRENT_BINARY_DIR}/qkeychain_export.h
223+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qt${QTKEYCHAIN_VERSION_INFIX}keychain/
224+
)
225+
226+
install(TARGETS ${QTKEYCHAIN_TARGET_NAME}
227+
EXPORT Qt${QTKEYCHAIN_VERSION_INFIX}KeychainLibraryDepends
228+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
229+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
230+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
231+
)
232+
233+
if(BUILD_TEST_APPLICATION)
234+
add_executable( testclient testclient.cpp )
235+
target_link_libraries( testclient ${QTKEYCHAIN_TARGET_NAME})
236+
endif()
237+
238+
239+
###
240+
### CMake config file
241+
###
242+
243+
ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/QtKeychainConfig.cmake.in"
244+
"${CMAKE_CURRENT_BINARY_DIR}/Qt${QTKEYCHAIN_VERSION_INFIX}KeychainConfig.cmake"
245+
INSTALL_DESTINATION Qt${QTKEYCHAIN_VERSION_INFIX}Keychain)
246+
247+
ecm_setup_version("${QTKEYCHAIN_VERSION}" VARIABLE_PREFIX SNORE
248+
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Qt${QTKEYCHAIN_VERSION_INFIX}KeychainConfigVersion.cmake"
249+
SOVERSION ${QTKEYCHAIN_VERSION})
250+
251+
if(UNIX AND NOT APPLE AND NOT ANDROID)
252+
set(PRI_EXTRA_DEPS "dbus")
253+
endif()
254+
ecm_generate_pri_file(BASE_NAME Qt${QTKEYCHAIN_VERSION_INFIX}Keychain
255+
LIB_NAME ${QTKEYCHAIN_TARGET_NAME}
256+
DEPS "core ${PRI_EXTRA_DEPS}"
257+
INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}
258+
FILENAME_VAR pri_filename)
259+
260+
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
261+
262+
263+
install(EXPORT Qt${QTKEYCHAIN_VERSION_INFIX}KeychainLibraryDepends
264+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Qt${QTKEYCHAIN_VERSION_INFIX}Keychain"
265+
)
266+
267+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Qt${QTKEYCHAIN_VERSION_INFIX}KeychainConfig.cmake
268+
${CMAKE_CURRENT_BINARY_DIR}/Qt${QTKEYCHAIN_VERSION_INFIX}KeychainConfigVersion.cmake
269+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Qt${QTKEYCHAIN_VERSION_INFIX}Keychain
270+
)
271+

qtkeychain/COPYING

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Redistribution and use in source and binary forms, with or without
2+
modification, are permitted provided that the following conditions
3+
are met:
4+
5+
1. Redistributions of source code must retain the above copyright
6+
notice, this list of conditions and the following disclaimer.
7+
2. Redistributions in binary form must reproduce the above copyright
8+
notice, this list of conditions and the following disclaimer in the
9+
documentation and/or other materials provided with the distribution.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
12+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
13+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)