diff options
author | David 'Digit' Turner <digit@google.com> | 2015-07-16 11:29:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-07-16 11:29:03 +0000 |
commit | 36c94b804a1956e2a70f94ee78dce4753bda266a (patch) | |
tree | f52c44e3eb175e8423605ff3f3f16cd1443938b5 | |
parent | 2bbffc5021814475d142714a5d960cf935570638 (diff) | |
parent | ddd266befe21662b2b336a62e00942c7bb588f34 (diff) | |
download | qemu-36c94b804a1956e2a70f94ee78dce4753bda266a.tar.gz |
Merge "android/build: Add support for LOCAL_QT_UI_SRC_FILES." into studio-1.4-dev
-rw-r--r-- | Makefile.common | 7 | ||||
-rw-r--r-- | android/build/binary.make | 4 | ||||
-rw-r--r-- | android/build/clear_vars.make | 1 | ||||
-rw-r--r-- | android/build/definitions.make | 30 | ||||
-rw-r--r-- | android/skin/qt/battery.ui | 261 | ||||
-rw-r--r-- | android/skin/qt/sources.mk | 3 | ||||
-rw-r--r-- | android/skin/qt/tool-window.cpp | 5 |
7 files changed, 309 insertions, 2 deletions
diff --git a/Makefile.common b/Makefile.common index 19cb1a7210..791ac7f035 100644 --- a/Makefile.common +++ b/Makefile.common @@ -293,6 +293,11 @@ ifdef EMULATOR_USE_QT QT_TOP64_DIR := $(QT_PREBUILTS_DIR)/$(HOST_OS)-x86_64 QT_MOC_TOOL := $(QT_TOP64_DIR)/bin/moc QT_RCC_TOOL := $(QT_TOP64_DIR)/bin/rcc + # Special-case: the 'uic' tool depends on Qt5Core: always ensure that the + # version that is being used is from the prebuilts directory. Otherwise + # the executable may fail to start due to dynamic linking problems. + QT_UIC_TOOL_LDPATH := $(QT_TOP64_DIR)/lib + QT_UIC_TOOL := $(QT_TOP64_DIR)/bin/uic EMULATOR_QT_LIBS := Qt5Widgets Qt5Gui Qt5Core EMULATOR_QT_LDLIBS := $(foreach lib,$(EMULATOR_QT_LIBS),-l$(lib)) @@ -354,6 +359,7 @@ LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) LOCAL_QT_MOC_SRC_FILES := $(ANDROID_SKIN_QT_MOC_SRC_FILES) LOCAL_QT_RESOURCES := $(ANDROID_SKIN_QT_RESOURCES) +LOCAL_QT_UI_SRC_FILES := $(ANDROID_SKIN_QT_UI_SRC_FILES) $(call gen-hw-config-defs) $(call end-emulator-library) @@ -363,6 +369,7 @@ LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) LOCAL_QT_MOC_SRC_FILES := $(ANDROID_SKIN_QT_MOC_SRC_FILES) LOCAL_QT_RESOURCES := $(ANDROID_SKIN_QT_RESOURCES) +LOCAL_QT_UI_SRC_FILES := $(ANDROID_SKIN_QT_UI_SRC_FILES) $(call gen-hw-config-defs) $(call end-emulator-library) diff --git a/android/build/binary.make b/android/build/binary.make index 45c67feb8e..2af36e2d70 100644 --- a/android/build/binary.make +++ b/android/build/binary.make @@ -47,6 +47,10 @@ $(foreach src,$(LOCAL_QT_RESOURCES), \ $(eval $(call compile-qt-resources,$(src))) \ ) +$(foreach src,$(LOCAL_QT_UI_SRC_FILES), \ + $(eval $(call compile-qt-uic-source,$(src))) \ +) + $(foreach src,$(LOCAL_GENERATED_C_SOURCES), \ $(eval $(call compile-generated-c-source,$(src))) \ ) diff --git a/android/build/clear_vars.make b/android/build/clear_vars.make index 13c70bc897..44ba08a86c 100644 --- a/android/build/clear_vars.make +++ b/android/build/clear_vars.make @@ -31,6 +31,7 @@ LOCAL_MODULE := LOCAL_MODULE_PATH:= LOCAL_QT_MOC_SRC_FILES := LOCAL_QT_RESOURCES := +LOCAL_QT_UI_SRC_FILES := LOCAL_STATIC_LIBRARIES := LOCAL_BUILT_MODULE := LOCAL_PREBUILT_OBJ_FILES := diff --git a/android/build/definitions.make b/android/build/definitions.make index d412655e9c..90e6e230e7 100644 --- a/android/build/definitions.make +++ b/android/build/definitions.make @@ -75,6 +75,15 @@ local-library-path = $(OBJS_DIR)/$(call local-bits-choice,libs,libs64)/$(1).a local-executable-path = $(OBJS_DIR)/$(1)$(call local-host-tool,EXEEXT) local-shared-library-path = $(OBJS_DIR)/$(call local-bits-choice,lib,lib64)/$(1)$(call local-host-tool,DLLEXT) +# Expand to a shell statement that changes the runtime library search path. +# Note that this is only used for Qt-related stuff, and on Windows, the +# Windows libraries are placed under bin/ instead of lib/ so there is no +# point in changing the PATH variable. +set-host-library-search-path = $(call set-host-library-search-path-$(HOST_OS),$1) +set-host-library-search-path-linux = LD_LIBRARY_PATH=$1 +set-host-library-search-path-darwin = DYLD_LIBRARY_PATH=$1 +set-host-library-search-path-windows = + # Toolchain control support. # It's possible to switch between the regular toolchain and the host one # in certain cases. @@ -282,3 +291,24 @@ $$(RCC_SRC): $$(SRC) $$(QT_RCC_TOOL) $$(eval $$(call compile-generated-cxx-source,$$(RCC_SRC))) endef + +# Process a Qt .ui source file through the 'uic' tool to generate a header. +# NOTE: This expects QT_UIC_TOOL and QT_UIC_TOOL_LDPATH to be defined. +define compile-qt-uic-source +SRC := $(1) +UIC_SRC := $$(LOCAL_OBJS_DIR)/ui_$$(notdir $$(SRC:%.ui=%.h)) +ifeq (,$$(strip $$(QT_UIC_TOOL))) +$$(error QT_UIC_TOOL is not defined when trying to generate $$(UIC_SRC) !!) +endif +ifeq (,$$(strip $$(QT_UIC_TOOL_LDPATH))) +$$(error QT_UIC_TOOL_LDPATH is not defined when trying to generate $$(UIC_SRC) !!) +endif +$$(UIC_SRC): PRIVATE_SRC := $$(SRC) +$$(UIC_SRC): PRIVATE_DST := $$(UIC_SRC) +$$(UIC_SRC): $$(SRC) $$(QT_UIC_TOOL) + @mkdir -p $$(dir $$(PRIVATE_DST)) + @echo "Qt uic: $$(notdir $$(PRIVATE_DST)) <-- $$(PRIVATE_SRC)" + $(hide) $$(call set-host-library-search-path,$$(QT_UIC_TOOL_LDPATH)) $$(QT_UIC_TOOL) -o $$(PRIVATE_DST) $$(PRIVATE_SRC) + +LOCAL_GENERATED_SOURCES += $$(UIC_SRC) +endef diff --git a/android/skin/qt/battery.ui b/android/skin/qt/battery.ui new file mode 100644 index 0000000000..31624aab94 --- /dev/null +++ b/android/skin/qt/battery.ui @@ -0,0 +1,261 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Frame</class> + <widget class="QFrame" name="Frame"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>287</width> + <height>268</height> + </rect> + </property> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="windowTitle"> + <string/> + </property> + <property name="accessibleName"> + <string>Battery emulation</string> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <widget class="QGroupBox" name="groupBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>251</width> + <height>251</height> + </rect> + </property> + <property name="font"> + <font> + <family>Sans Serif</family> + <pointsize>12</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="title"> + <string>Battery emulation</string> + </property> + <widget class="QGroupBox" name="groupBox_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>30</y> + <width>160</width> + <height>61</height> + </rect> + </property> + <property name="font"> + <font> + <family>Sans Serif</family> + <pointsize>9</pointsize> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="title"> + <string>Charge Level</string> + </property> + <widget class="QSlider" name="batteryLevelSlider"> + <property name="geometry"> + <rect> + <x>0</x> + <y>30</y> + <width>160</width> + <height>29</height> + </rect> + </property> + <property name="accessibleName"> + <string>Charge level</string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_3"> + <property name="geometry"> + <rect> + <x>180</x> + <y>30</y> + <width>51</width> + <height>61</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>9</pointsize> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="title"> + <string>AC On</string> + </property> + <widget class="QCheckBox" name="chargingCkBox"> + <property name="geometry"> + <rect> + <x>0</x> + <y>30</y> + <width>21</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_4"> + <property name="geometry"> + <rect> + <x>0</x> + <y>100</y> + <width>241</width> + <height>61</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>9</pointsize> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="title"> + <string>Power Health</string> + </property> + <widget class="QComboBox" name="healthBox"> + <property name="geometry"> + <rect> + <x>0</x> + <y>30</y> + <width>241</width> + <height>25</height> + </rect> + </property> + <item> + <property name="text"> + <string>Good</string> + </property> + </item> + <item> + <property name="text"> + <string>Failed</string> + </property> + </item> + <item> + <property name="text"> + <string>Dead</string> + </property> + </item> + <item> + <property name="text"> + <string>Overvoltage</string> + </property> + </item> + <item> + <property name="text"> + <string>Overheated</string> + </property> + </item> + <item> + <property name="text"> + <string>Unknown</string> + </property> + </item> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_5"> + <property name="geometry"> + <rect> + <x>0</x> + <y>180</y> + <width>251</width> + <height>71</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>9</pointsize> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="title"> + <string>Power Status</string> + </property> + <widget class="QComboBox" name="statusBox"> + <property name="geometry"> + <rect> + <x>0</x> + <y>30</y> + <width>241</width> + <height>31</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>Unknown</string> + </property> + </item> + <item> + <property name="text"> + <string>Charging</string> + </property> + </item> + <item> + <property name="text"> + <string>Discharging</string> + </property> + </item> + <item> + <property name="text"> + <string>Not charging</string> + </property> + </item> + <item> + <property name="text"> + <string>Full</string> + </property> + </item> + </widget> + </widget> + </widget> + </widget> + <tabstops> + <tabstop>batteryLevelSlider</tabstop> + <tabstop>chargingCkBox</tabstop> + <tabstop>healthBox</tabstop> + <tabstop>statusBox</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/android/skin/qt/sources.mk b/android/skin/qt/sources.mk index 0a743b27a5..31f1e79a31 100644 --- a/android/skin/qt/sources.mk +++ b/android/skin/qt/sources.mk @@ -20,3 +20,6 @@ ANDROID_SKIN_QT_MOC_SRC_FILES := \ ANDROID_SKIN_QT_RESOURCES := \ android/skin/qt/resources.qrc \ + +ANDROID_SKIN_QT_UI_SRC_FILES := \ + android/skin/qt/battery.ui \ diff --git a/android/skin/qt/tool-window.cpp b/android/skin/qt/tool-window.cpp index c223dba2c6..b7e9425155 100644 --- a/android/skin/qt/tool-window.cpp +++ b/android/skin/qt/tool-window.cpp @@ -12,10 +12,11 @@ #include <QPushButton> -#include "android/skin/qt/emulator-window.h" -#include "android/skin/qt/tool-window.h" +#include "ui_battery.h" #include "ui_tool-window.h" +#include "android/skin/qt/emulator-window.h" +#include "android/skin/qt/tool-window.h" ToolWindow::ToolWindow(EmulatorWindow *window) : QFrame(window), |