Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
cb53ece6
Commit
cb53ece6
authored
Oct 17, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): use make to rebuild languages when a .cpp is altered
parent
c75b1bef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
16 deletions
+48
-16
CMakeLists.txt
tests/CMakeLists.txt
+20
-16
CMakeLists.txt
tests/languages/CMakeLists.txt
+27
-0
MainWindow.qml
tests/ui/views/MainWindow/MainWindow.qml
+1
-0
No files found.
tests/CMakeLists.txt
View file @
cb53ece6
...
...
@@ -47,33 +47,37 @@ set(QRC_RESOURCES
)
set
(
LANGUAGES_DIRECTORY languages
)
set
(
I18N_FILENAME i18n.qrc
)
set
(
LANGUAGES en fr
)
# --------------------------------------------------------------------
find_package
(
Qt5 COMPONENTS
${
QT5_PACKAGES
}
)
function
(
PREPEND list prefix
)
set
(
new_list
""
)
# Build languages resource file.
set
(
TS_FILES
)
set
(
I18N_CONTENT
"<!DOCTYPE RCC>
\n
<RCC version=
\"
1.0
\"
>
\n
<qresource prefix=
\"
/
\"
>
\n
"
)
foreach
(
lang
${
LANGUAGES
}
)
list
(
APPEND TS_FILES
"
${
LANGUAGES_DIRECTORY
}
/
${
lang
}
.ts"
)
foreach
(
elem
${${
list
}}
)
list
(
APPEND new_list
"
${
prefix
}${
elem
}
"
)
endforeach
()
# Note: the below `languages/` path is not the same as the `${LANGUAGES_DIRECTORY}` value.
# It's the symbolic path used by the linphone binary in the qrc model.
set
(
I18N_CONTENT
"
${
I18N_CONTENT
}
<file alias=
\"
languages/
${
lang
}
\"
>
${
lang
}
.qm</file>
\n
"
)
endforeach
()
set
(
I18N_CONTENT
"
${
I18N_CONTENT
}
</qresource>
\n
</RCC>
\n
"
)
set
(
${
list
}
${
new_list
}
PARENT_SCOPE
)
endfunction
()
# Force absolute paths.
PREPEND
(
SOURCES
"
${
CMAKE_SOURCE_DIR
}
/"
)
PREPEND
(
HEADERS
"
${
CMAKE_SOURCE_DIR
}
/"
)
set
(
I18N_RESOURCE i18n.qrc
)
file
(
WRITE
"
${
CMAKE_BINARY_DIR
}
/
${
I18N_RESOURCE
}
"
"
${
I18N_CONTENT
}
"
)
# --------------------------------------------------------------------
find_package
(
Qt5 COMPONENTS
${
QT5_PACKAGES
}
)
# Create `qm` files from `ts` files.
qt5_create_translation
(
QM_FILES
${
TS_FILES
}
src ui
)
# Add languages support.
add_subdirectory
(
${
LANGUAGES_DIRECTORY
}
)
list
(
APPEND QRC_RESOURCES
"
${
CMAKE_BINARY_DIR
}
/
${
LANGUAGES_DIRECTORY
}
/
${
I18N_FILENAME
}
"
)
# Add qrc. (images, qml, translations...)
qt5_add_resources
(
RESOURCES
${
QRC_RESOURCES
}
"
${
CMAKE_BINARY_DIR
}
/
${
I18N_RESOURCE
}
"
)
qt5_add_resources
(
RESOURCES
${
QRC_RESOURCES
}
)
# Build.
add_executable
(
${
LINPHONE_EXEC
}
${
SOURCES
}
${
HEADERS
}
${
RESOURCES
}
)
add_dependencies
(
${
LINPHONE_EXEC
}
update_translations
)
target_link_libraries
(
${
LINPHONE_EXEC
}
${
LIBS
}
)
tests/languages/CMakeLists.txt
0 → 100644
View file @
cb53ece6
# Build languages resource file.
set
(
TS_FILES
)
set
(
I18N_CONTENT
"<!DOCTYPE RCC>
\n
<RCC version=
\"
1.0
\"
>
\n
<qresource prefix=
\"
/
\"
>
\n
"
)
foreach
(
lang
${
LANGUAGES
}
)
list
(
APPEND TS_FILES
"
${
CMAKE_SOURCE_DIR
}
/
${
LANGUAGES_DIRECTORY
}
/
${
lang
}
.ts"
)
# Note: the below `languages/` path is not the same as the `${LANGUAGES_DIRECTORY}` value.
# It's the symbolic path used by the linphone binary in the qrc model.
# This path is used in `app.cpp`.
set
(
I18N_CONTENT
"
${
I18N_CONTENT
}
<file alias=
\"
languages/
${
lang
}
\"
>
${
lang
}
.qm</file>
\n
"
)
endforeach
()
set
(
I18N_CONTENT
"
${
I18N_CONTENT
}
</qresource>
\n
</RCC>
\n
"
)
file
(
WRITE
"
${
CMAKE_BINARY_DIR
}
/
${
LANGUAGES_DIRECTORY
}
/
${
I18N_FILENAME
}
"
"
${
I18N_CONTENT
}
"
)
# --------------------------------------------------------------------
# Prevent `.ts` files deletion.
# See: https://bugreports.qt.io/browse/QTBUG-31860
#
# On October 17, 2016, this issue is marked `invalid` but it's a
# bullshit. It's not tolerated to remove sources files.
set_directory_properties
(
PROPERTIES CLEAN_NO_CUSTOM true
)
# Create `qm` files from `ts` files.
qt5_create_translation
(
QM_FILES
${
TS_FILES
}
${
SOURCES
}
${
HEADERS
}
)
add_custom_target
(
update_translations DEPENDS
${
QM_FILES
}
)
tests/ui/views/MainWindow/MainWindow.qml
View file @
cb53ece6
...
...
@@ -207,6 +207,7 @@ ApplicationWindow {
Layout.fillWidth
:
true
Layout.preferredHeight
:
80
color
:
'
#EAEAEA
'
//a: qsTr("ooo")
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment