介绍
LidarView软件定制开发需要关注几点:1.应用程序名称;2.程序logo;3.Application版本号;4.安装包版本号
应用程序名称
在项目的顶层cmake里边可以指定程序名称
project(LidarView)
需要指定跟Superbuild一样的编译类型
set(CMAKE_BUILD_TYPE "Release")
程序logo
Application\SoftwareInformation
目录下的logo.ico文件可以指定应用程序的logo,打包exe的logo也可以在iss脚本里边声明,启动页面的logo也是位于Application\SoftwareInformation
目录下(Splash.jpg)
Application版本号
改变LV_VERSION_FULL
可达到改变软件版本号的目的
SET(LV_VERSION_FULL "V1.3.0")
标题栏版本号
关于对话框
安装包版本号
在Inno Setup Compiler iss脚本里边通过指定宏MyAppVersion
改变安装包版本号
#define MyAppName "LidarViewer"
#define MyAppVersion "V1.3.0"
#define MyAppPublisher "Copyright @2023 lidarviwer"
#define MyAppURL ""
#define MyAppExeName "LidarViewer.exe"
#define MyAppAssocName MyAppName + " File"
#define MyAppAssocExt ".myp"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
代码分析
① ParaViewClient.cmake
里边定义了paraview_client_add
函数,该函数在Application目录下的CMakeLists.txt文件里边调用,需要给LV_VERSION_FULL
赋值传递软件版本号信息,APPLICATION_ICON
传递软件图标信息
paraview_client_add(
NAME ${SOFTWARE_NAME} #Name of the Target
NAMESPACE "LidarView"
VERSION ${LV_VERSION_FULL}
APPLICATION_NAME "${SOFTWARE_NAME}"
ORGANIZATION "${SOFTWARE_VENDOR}"
TITLE "${SOFTWARE_NAME} ${LV_VERSION_FULL} ${LV_BUILD_PLATFORM}"
SPLASH_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/SoftwareInformation/Splash.jpg"
BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/logo.icns"
APPLICATION_ICON "${CMAKE_CURRENT_SOURCE_DIR}/SoftwareInformation/logo.ico"
REQUIRED_PLUGINS LidarPlugin VelodynePlugin
MAIN_WINDOW_CLASS vvMainWindow
MAIN_WINDOW_INCLUDE vvMainWindow.h
SOURCES ${source_files}
APPLICATION_XMLS
${CMAKE_CURRENT_SOURCE_DIR}/vvSources.xml
${CMAKE_CURRENT_SOURCE_DIR}/vvFilters.xml
RUNTIME_DESTINATION ${LV_INSTALL_RUNTIME_DIR}
LIBRARY_DESTINATION ${LV_INSTALL_LIBRARY_DIR}
)
② 然后paraview_client_add
根据软件名词、版本号、应用logo等信息自动生成pqLidarViewInitializer
对象,软件版本会在Initialize
成员函数里边调用
#if _paraview_client_TITLE
this->MainWindow->setWindowTitle("LidarView V1.3.0 Windows-AMD64");
#endif
③ aboutDialog.py
里边的showDialog
函数会对about对话框的版本号进行设置
def showDialog(mainWindow):
loader = QtUiTools.QUiLoader()
uifile = QtCore.QFile(':/vvResources/vvAboutDialog.ui')
if not uifile.open(uifile.ReadOnly):
print("Canno't open the ui for the about dialog.")
return
dialog = loader.load(uifile, mainWindow)
uifile.close()
dialog.setModal(True)
def w(name):
for widget in dialog.children():
if widget.objectName == name:
return widget
image = w('splashLabel')
splash = image.pixmap.scaled(image.pixmap.width()/2.0, image.pixmap.height()/2.0)
image.setPixmap(splash)
image.adjustSize()
appName = mainWindow.windowTitle.split(" ")[0]
appVersionTag = mainWindow.windowTitle.split(" ")[1]
appBitTag = mainWindow.windowTitle.split(" ")[2]
dialog.windowTitle = "About " + appName + " ..."
copyrightText = '''<h1>{0} {1} {2}</h1><br/>
Provided by <a href=""></a><br />
<br />
'''.format(appName, appVersionTag, appBitTag)
w('copyrightLabel').setText(copyrightText)
textBoxContent = '''<h4>License</h4>
LidarViewer is provided under the Apache License 2.0.<br /><br />
The initial developer of some parts of the framework, which are
copied from, derived from, or inspired by LidarView open source project.
<br />
'''
w('detailsLabel').setText(textBoxContent)
button = w('closeButton')
closeIcon = QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_DialogCloseButton)
button.setIcon(closeIcon)
button.connect(button, QtCore.SIGNAL('clicked()'), dialog, QtCore.SLOT('close()'))
dialog.adjustSize()
dialog.setFixedSize(dialog.size)
dialog.exec_()