Allow adding custom main views in the overlay

The STYLES_PATH qmake argument is replaces with OVERLAY_PATH now
This commit is contained in:
Michael Zanetti 2020-09-18 00:54:20 +02:00
parent 61c2cb70f0
commit fbbe8c53c8
3 changed files with 31 additions and 11 deletions

View File

@ -15,8 +15,8 @@ withtests: {
# $ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
# $ make wininstaller
wininstaller.depends = nymea-app
!equals(STYLES_PATH, ""):!equals(BRANDING, "") {
PACKAGE_BASE_DIR = $${STYLES_PATH}\packaging
!equals(OVERLAY_PATH, ""):!equals(BRANDING, "") {
PACKAGE_BASE_DIR = $${OVERLAY_PATH}\packaging
} else {
PACKAGE_BASE_DIR = $$shell_path($$PWD)\packaging
}

View File

@ -34,12 +34,12 @@ SOURCES += main.cpp \
RESOURCES += resources.qrc \
ruletemplates.qrc \
images.qrc \
translations.qrc
equals(STYLES_PATH, "") {
RESOURCES += styles.qrc
} else {
message("Style override enabled. Will be using styles from $${STYLES_PATH}")
RESOURCES += $${STYLES_PATH}/styles.qrc
translations.qrc \
styles.qrc
!equals(OVERLAY_PATH, "") {
message("Resource overlay enabled. Will be using overlay from $${OVERLAY_PATH}")
RESOURCES += $${OVERLAY_PATH}/overlay.qrc
}
win32 {

View File

@ -131,6 +131,21 @@ Page {
var configList = {}
var newList = {}
var newItems = 0
// Add extra views first to make them appear first in the list unless the config says otherwise
if (app.hasOwnProperty("additionalMainViews")) {
for (var i = 0; i < app.additionalMainViews.count; i++) {
var item = app.additionalMainViews.get(i);
var idx = mainViewSettings.sortOrder.indexOf(item.name);
if (idx === -1) {
newList[newItems++] = item;
} else {
configList[idx] = item;
}
}
}
for (var i = 0; i < mainMenuBaseModel.count; i++) {
var item = mainMenuBaseModel.get(i);
var idx = mainViewSettings.sortOrder.indexOf(item.name);
@ -140,16 +155,21 @@ Page {
configList[idx] = item;
}
}
clear();
var brandingFilter = app.hasOwnProperty("mainViewsFilter") ? app.mainViewsFilter : []
for (idx in configList) {
item = configList[idx];
mainMenuModel.append(item)
if (brandingFilter.length === 0 || brandingFilter.indexOf(item.name) >= 0) {
mainMenuModel.append(item)
}
}
for (idx in newList) {
item = newList[idx];
mainMenuModel.append(item)
if (brandingFilter.length === 0 || brandingFilter.indexOf(item.name) >= 0) {
mainMenuModel.append(item)
}
}
tabBar.currentIndex = Qt.binding(function() { return mainViewSettings.currentIndex; })