Qt4 cleanup

- Remove example application source code files which also exist in contrib
- Outsource commonly used parts from target.mk files
- Store the current Qt version only in one place
- Add run scripts for the example applications

Fixes #127.
This commit is contained in:
Christian Prochaska 2012-02-24 19:39:00 +01:00 committed by Norman Feske
parent 780507f42b
commit e085828725
52 changed files with 732 additions and 2137 deletions

View File

@ -1,214 +1,39 @@
ARORA = arora-0.11.0
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
INC_DIR += $(PRG_DIR)
HEADERS_FILTER_OUT = \
adblockschemeaccesshandler.h \
adblockrule.h \
arorawebplugin.h \
bookmarknode.h \
clicktoflashplugin.h \
networkcookiejar_p.h \
nitpickerplugin.h \
networkproxyfactory.h \
opensearchenginedelegate.h \
opensearchreader.h \
opensearchwriter.h \
schemeaccesshandler.h \
twoleveldomains_p.h \
trie_p.h \
xbelreader.h \
xbelwriter.h
###### start of editable part ######
QT_MAIN_STACK_SIZE = 768*1024
# include the qmake project file
# -> change the filename if it differs from the project dir name
LIBS += libc_lwip libc_lwip_nic_dhcp qpluginwidget
QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
#
# The following files don't need to be moc'ed,
# so exclude them from $(SOURCES) and $(HEADERS).
#
NO_MOC_SOURCES = aboutdialog.cpp \
acceptlanguagedialog.cpp \
adblockblockednetworkreply.cpp \
adblockdialog.cpp \
adblockmanager.cpp \
adblockmodel.cpp \
adblocknetwork.cpp \
adblockpage.cpp \
adblockrule.cpp \
adblockschemeaccesshandler.cpp \
adblocksubscription.cpp \
addbookmarkdialog.cpp \
arorawebplugin.cpp \
autofilldialog.cpp \
autofillmanager.cpp \
autosaver.cpp \
bookmarknode.cpp \
bookmarksdialog.cpp \
bookmarksmanager.cpp \
bookmarksmenu.cpp \
bookmarksmodel.cpp \
bookmarkstoolbar.cpp \
browserapplication.cpp \
browsermainwindow.cpp \
clearbutton.cpp \
clearprivatedata.cpp \
clicktoflash.cpp \
clicktoflashplugin.cpp \
cookiedialog.cpp \
cookieexceptionsdialog.cpp \
cookieexceptionsmodel.cpp \
cookiejar.cpp \
cookiemodel.cpp \
downloadmanager.cpp \
editlistview.cpp \
edittableview.cpp \
edittreeview.cpp \
fileaccesshandler.cpp \
history.cpp \
historycompleter.cpp \
historymanager.cpp \
languagemanager.cpp \
lineedit.cpp \
locationbar.cpp \
locationbarsiteicon.cpp \
main.cpp \
modelmenu.cpp \
modeltoolbar.cpp \
networkaccessmanager.cpp \
networkaccessmanagerproxy.cpp \
networkcookiejar.cpp \
networkdiskcache.cpp \
networkproxyfactory.cpp \
nitpickerplugin.cpp \
nitpickerpluginwidget.cpp \
opensearchdialog.cpp \
opensearchengine.cpp \
opensearchengineaction.cpp \
opensearchenginedelegate.cpp \
opensearchenginemodel.cpp \
opensearchmanager.cpp \
opensearchreader.cpp \
opensearchwriter.cpp \
plaintexteditsearch.cpp \
privacyindicator.cpp \
schemeaccesshandler.cpp \
searchbar.cpp \
searchbutton.cpp \
searchlineedit.cpp \
settings.cpp \
singleapplication.cpp \
sourcehighlighter.cpp \
sourceviewer.cpp \
squeezelabel.cpp \
tabbar.cpp \
tabwidget.cpp \
toolbarsearch.cpp \
treesortfilterproxymodel.cpp \
useragentmenu.cpp \
webactionmapper.cpp \
webpage.cpp \
webpageproxy.cpp \
webpluginfactory.cpp \
webview.cpp \
webviewsearch.cpp \
xbelreader.cpp \
xbelwriter.cpp
NO_MOC_HEADER = adblockschemeaccesshandler.h \
adblockrule.h \
arorawebplugin.h \
bookmarknode.h \
clicktoflashplugin.h \
networkcookiejar_p.h \
nitpickerplugin.h \
networkproxyfactory.h \
opensearchenginedelegate.h \
opensearchreader.h \
opensearchwriter.h \
schemeaccesshandler.h \
twoleveldomains_p.h \
trie_p.h \
xbelreader.h \
xbelwriter.h
SOURCES := $(filter-out $(NO_MOC_SOURCES), $(SOURCES))
HEADERS := $(filter-out $(NO_MOC_HEADER), $(HEADERS))
SRC_CC = $(NO_MOC_SOURCES)
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=768*1024
RESOURCES += demo_html.qrc
#
# Prevent contrib code from causing warnings with our toolchain compiler
#
CC_CXX_OPT += -Wno-unused-but-set-variable
###### end of editable part ######
LIBS += libc libc_lwip libc_lwip_nic_dhcp qpluginwidget
RESOURCES += demo_html.qrc
# static Qt plugins
ifeq ($(findstring qgif, $(QT_PLUGIN)), qgif)
LIBS += qgif
endif
ifeq ($(findstring qjpeg, $(QT_PLUGIN)), qjpeg)
LIBS += qjpeg
endif
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui dejavusans
endif
# QtNetwork stuff
ifeq ($(findstring network, $(QT)), network)
LIBS += qt_network
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
# QtWebKit stuff
ifeq ($(findstring webkit, $(QT)), webkit)
LIBS += qt_webcore
endif
#endif # $(QMAKE_PROJECT_FILE)
CC_WARN += -Wno-unused-but-set-variable
vpath % $(PRG_DIR)
vpath % $(PRG_DIR)/adblock
@ -249,3 +74,5 @@ vpath % $(REP_DIR)/contrib/$(ARORA)/src/qwebplugins/clicktoflash
vpath % $(REP_DIR)/contrib/$(ARORA)/src/qwebplugins/nitpicker
vpath % $(REP_DIR)/contrib/$(ARORA)/src/useragent
vpath % $(REP_DIR)/contrib/$(ARORA)/src/utils
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -11,8 +11,11 @@ DOWNLOAD_DIR = download
CONTRIB_DIR = contrib
PATCHES_DIR = ../../src/lib/qt4
REP_DIR := $(realpath .)
include $(REP_DIR)/lib/mk/qt_version.inc
QT4_URL = ftp://ftp.trolltech.com/qt/source
QT4 = qt-everywhere-opensource-src-4.7.4
QT4_TGZ = $(QT4).tar.gz
QTSCRIPTCLASSIC_URL = http://get.qt.nokia.com/qt/solutions/lgpl

View File

@ -0,0 +1,3 @@
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_INC)

View File

@ -0,0 +1,3 @@
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_INC)

View File

@ -1,15 +1,15 @@
# prevent import file to be included twice, for example via import-qt_gui.mk
# and import-QtCore.mk
# and import-qt_core.mk
ifeq ($(QT4_IMPORTED),)
QT4_IMPORTED = true
QT4 = qt-everywhere-opensource-src-4.7.4
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.mk)
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
include $(QT4_REP_DIR)/lib/mk/qt_version.inc
QT4_INC_DIR := $(QT4_REP_DIR)/src/lib/qt4/mkspecs/qws/genode-x86-g++ \
$(QT4_REP_DIR)/include/qt4 \
$(QT4_REP_DIR)/contrib/$(QT4)/include \
@ -56,14 +56,16 @@ QT_DEFINES += -U__linux__
CC_CXX_OPT += $(QT_DEFINES)
SOURCES_FILTERED = $(filter-out $(SOURCES_FILTER_OUT), $(SOURCES))
HEADERS_FILTERED = $(filter-out $(HEADERS_FILTER_OUT), $(HEADERS))
# add sources defined in qmake project files
SRC_CC += $(SOURCES)
SRC_CC += $(SOURCES_FILTERED)
# handle moc-headers, resources and ui descriptions
$(SRC_CC:.cpp=.o): $(SOURCES:.cpp=.moc) \
$(addprefix ui_,$(FORMS:.ui=.h))
$(SRC_CC:.cpp=.o): $(addprefix ui_,$(FORMS:.ui=.h))
SRC_CC_QT_GENERATED = $(addprefix moc_,$(HEADERS:.h=.cpp)) \
SRC_CC_QT_GENERATED = $(addprefix moc_,$(HEADERS_FILTERED:.h=.cpp)) \
$(addprefix qrc_,$(RESOURCES:.qrc=.cpp))
.SECONDARY: $(SRC_CC_QT_GENERATED)
@ -138,6 +140,6 @@ endif
clean cleanall: clean_rule
clean_rule:
$(VERBOSE)$(RM) -f $(SRC_CC_QT_GENERATED)
$(VERBOSE)$(RM) -f $(SOURCES:.cpp=.moc)
$(VERBOSE)$(RM) -f $(SOURCES_FILTERED:.cpp=.moc)
$(VERBOSE)$(RM) -f $(addprefix ui_,$(FORMS:.ui=.h))
endif

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,3 +1,3 @@
IMPORT_QT4_MK=$(call select_from_repositories,lib/import/import-qt4.mk)
IMPORT_QT4_INC=$(call select_from_repositories,lib/import/import-qt4.inc)
include $(IMPORT_QT4_MK)
include $(IMPORT_QT4_INC)

View File

@ -1,4 +1,4 @@
include $(REP_DIR)/lib/import/import-qt4.mk
include $(REP_DIR)/lib/import/import-qgif.mk
SRC_CC = main.cpp qgifhandler.cpp

View File

@ -1,4 +1,4 @@
include $(REP_DIR)/lib/import/import-qt4.mk
include $(REP_DIR)/lib/import/import-qjpeg.mk
SRC_CC = main.cpp qjpeghandler.cpp

View File

@ -0,0 +1 @@
QT4 := qt-everywhere-opensource-src-4.7.4

125
qt4/run/calculatorform.run Normal file
View File

@ -0,0 +1,125 @@
#
# Build
#
build {
core
init
drivers/input/ps2
drivers/pci
drivers/framebuffer
drivers/timer
server/nitpicker
app/examples/calculatorform
}
create_boot_directory
#
# Generate config
#
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route> }
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec pl11x] config {
<start name="pl11x_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<provides><service name="Nitpicker"/></provides>
</start>
<start name="calculatorform">
<resource name="RAM" quantum="80M"/>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core
init
timer
nitpicker
calculatorform
dejavusans.lib.so
freetype.lib.so
ld.lib.so
libc.lib.so
libc_lock_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
qt_core.lib.so
qt_gui.lib.so
zlib.lib.so
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec vesa] boot_modules vesa_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules pl11x_drv
build_boot_image $boot_modules
append qemu_args " -m 128"
run_genode_until forever

128
qt4/run/previewer.run Normal file
View File

@ -0,0 +1,128 @@
#
# Build
#
build {
core
init
drivers/input/ps2
drivers/pci
drivers/framebuffer
drivers/timer
server/nitpicker
app/examples/previewer
}
create_boot_directory
#
# Generate config
#
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route> }
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec pl11x] config {
<start name="pl11x_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<provides><service name="Nitpicker"/></provides>
</start>
<start name="previewer">
<resource name="RAM" quantum="80M"/>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core
init
timer
nitpicker
previewer
dejavusans.lib.so
freetype.lib.so
ld.lib.so
libc.lib.so
libc_lock_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
qt_core.lib.so
qt_gui.lib.so
qt_jscore.lib.so
qt_network.lib.so
qt_webcore.lib.so
zlib.lib.so
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec vesa] boot_modules vesa_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules pl11x_drv
build_boot_image $boot_modules
append qemu_args " -m 128"
run_genode_until forever

128
qt4/run/tetrix.run Normal file
View File

@ -0,0 +1,128 @@
#
# Build
#
build {
core
init
drivers/input/ps2
drivers/pci
drivers/framebuffer
drivers/timer
server/nitpicker
app/examples/tetrix
}
create_boot_directory
#
# Generate config
#
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route> }
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec pl11x] config {
<start name="pl11x_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<provides><service name="Nitpicker"/></provides>
</start>
<start name="tetrix">
<resource name="RAM" quantum="80M"/>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core
init
timer
nitpicker
tetrix
dejavusans.lib.so
freetype.lib.so
ld.lib.so
libc.lib.so
libc_lock_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
qt_core.lib.so
qt_gui.lib.so
qt_script.lib.so
qt_ui_tools.lib.so
qt_xml.lib.so
zlib.lib.so
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec vesa] boot_modules vesa_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules pl11x_drv
build_boot_image $boot_modules
append qemu_args " -m 128"
run_genode_until forever

125
qt4/run/textedit.run Normal file
View File

@ -0,0 +1,125 @@
#
# Build
#
build {
core
init
drivers/input/ps2
drivers/pci
drivers/framebuffer
drivers/timer
server/nitpicker
app/examples/textedit
}
create_boot_directory
#
# Generate config
#
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route> }
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec pl11x] config {
<start name="pl11x_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<provides><service name="Nitpicker"/></provides>
</start>
<start name="textedit">
<resource name="RAM" quantum="80M"/>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core
init
timer
nitpicker
textedit
dejavusans.lib.so
freetype.lib.so
ld.lib.so
libc.lib.so
libc_lock_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
qt_core.lib.so
qt_gui.lib.so
zlib.lib.so
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec vesa] boot_modules vesa_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules pl11x_drv
build_boot_image $boot_modules
append qemu_args " -m 128"
run_genode_until forever

View File

@ -1,57 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.0, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** In addition, as a special exception, Trolltech, as the sole copyright
** holder for Qt Designer, grants users of the Qt/Eclipse Integration
** plug-in the right for the Qt/Eclipse Integration to link to
** functionality provided by Qt Designer and its related libraries.
**
** Trolltech reserves all rights not expressly granted herein.
**
** Trolltech ASA (c) 2007
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QtGui>
#include "calculatorform.h"
CalculatorForm::CalculatorForm(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
}
void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
{
ui.outputWidget->setText(QString::number(value + ui.inputSpinBox2->value()));
}
void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
{
ui.outputWidget->setText(QString::number(value + ui.inputSpinBox1->value()));
}

View File

@ -1,59 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.0, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** In addition, as a special exception, Trolltech, as the sole copyright
** holder for Qt Designer, grants users of the Qt/Eclipse Integration
** plug-in the right for the Qt/Eclipse Integration to link to
** functionality provided by Qt Designer and its related libraries.
**
** Trolltech reserves all rights not expressly granted herein.
**
** Trolltech ASA (c) 2007
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef CALCULATORFORM_H
#define CALCULATORFORM_H
#include "ui_calculatorform.h"
class CalculatorForm : public QWidget
{
Q_OBJECT
public:
CalculatorForm(QWidget *parent = 0);
private slots:
void on_inputSpinBox1_valueChanged(int value);
void on_inputSpinBox2_valueChanged(int value);
private:
Ui::CalculatorForm ui;
};
#endif

View File

@ -1,8 +0,0 @@
HEADERS = calculatorform.h
FORMS = calculatorform.ui
# install
target.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform
INSTALLS += target sources

View File

@ -1,284 +0,0 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>CalculatorForm</class>
<widget class="QWidget" name="CalculatorForm" >
<property name="objectName" >
<string notr="true" >CalculatorForm</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Calculator Form</string>
</property>
<layout class="QGridLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="6" >
<spacer>
<property name="objectName" >
<string notr="true" >horizontalSpacer</string>
</property>
<property name="geometry" >
<rect>
<x>239</x>
<y>9</y>
<width>152</width>
<height>52</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4" >
<widget class="QLabel" name="label_3_2" >
<property name="objectName" >
<string notr="true" >label_3_2</string>
</property>
<property name="geometry" >
<rect>
<x>169</x>
<y>9</y>
<width>20</width>
<height>52</height>
</rect>
</property>
<property name="text" >
<string>=</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="5" >
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2_2_2" >
<property name="objectName" >
<string notr="true" >label_2_2_2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>36</width>
<height>17</height>
</rect>
</property>
<property name="text" >
<string>Output</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="outputWidget" >
<property name="objectName" >
<string notr="true" >outputWidget</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>24</y>
<width>36</width>
<height>27</height>
</rect>
</property>
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2" >
<spacer>
<property name="objectName" >
<string notr="true" >verticalSpacer</string>
</property>
<property name="geometry" >
<rect>
<x>89</x>
<y>67</y>
<width>20</width>
<height>224</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" >
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="objectName" >
<string notr="true" >label_2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>46</width>
<height>19</height>
</rect>
</property>
<property name="text" >
<string>Input 2</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="inputSpinBox2" >
<property name="objectName" >
<string notr="true" >inputSpinBox2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>26</y>
<width>46</width>
<height>25</height>
</rect>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_3" >
<property name="objectName" >
<string notr="true" >label_3</string>
</property>
<property name="geometry" >
<rect>
<x>63</x>
<y>9</y>
<width>20</width>
<height>52</height>
</rect>
</property>
<property name="text" >
<string>+</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="objectName" >
<string notr="true" >label</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>46</width>
<height>19</height>
</rect>
</property>
<property name="text" >
<string>Input 1</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="inputSpinBox1" >
<property name="objectName" >
<string notr="true" >inputSpinBox1</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>26</y>
<width>46</width>
<height>25</height>
</rect>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>

View File

@ -1,6 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/qt/fonts">
<file alias="helvetica_120_50.qpf">../../../../contrib/qt-everywhere-opensource-src-4.7.4/lib/fonts/helvetica_120_50.qpf</file>
</qresource>
</RCC>

View File

@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.0, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** In addition, as a special exception, Trolltech, as the sole copyright
** holder for Qt Designer, grants users of the Qt/Eclipse Integration
** plug-in the right for the Qt/Eclipse Integration to link to
** functionality provided by Qt Designer and its related libraries.
**
** Trolltech reserves all rights not expressly granted herein.
**
** Trolltech ASA (c) 2007
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QApplication>
#include "calculatorform.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
CalculatorForm calculator;
calculator.show();
return app.exec();
}

View File

@ -1,77 +1,14 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/lib/mk/qt_version.inc
INC_DIR += $(PRG_DIR)
QMAKE_PROJECT_PATH = $(realpath $(QT4_REP_DIR)/contrib/$(QT4)/examples/designer/calculatorform)
QMAKE_PROJECT_FILE = $(QMAKE_PROJECT_PATH)/calculatorform.pro
SRC_CC = calculatorform.cpp main.cpp
vpath % $(QMAKE_PROJECT_PATH)
###### start of editable part ######
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
# include the qmake project file
# -> change the filename if it differs from the project dir name
QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
###### end of editable part ######
LIBS += libc libm cxx
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui
ifneq ($(findstring font.qrc, $(RESOURCES)), font.qrc)
RESOURCES += font.qrc
endif
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -1,101 +1,14 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/lib/mk/qt_version.inc
INC_DIR += $(PRG_DIR)
QMAKE_PROJECT_PATH = $(realpath $(QT4_REP_DIR)/contrib/$(QT4)/examples/webkit/previewer)
QMAKE_PROJECT_FILE = $(QMAKE_PROJECT_PATH)/previewer.pro
###### start of editable part ######
vpath % $(QMAKE_PROJECT_PATH)
# include the qmake project file
# -> change the filename if it differs from the project dir name
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
QT4 = qt-everywhere-opensource-src-4.7.4
#QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
QMAKE_PROJECT_FILE = $(realpath $(REP_DIR)/contrib/$(QT4)/examples/webkit/previewer/previewer.pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
#
# The following files don't need to be moc'ed,
# so exclude them from $(SOURCES) and $(HEADERS).
#
NO_MOC_SOURCES = previewer.cpp main.cpp mainwindow.cpp
SOURCES := $(filter-out $(NO_MOC_SOURCES), $(SOURCES))
SRC_CC = $(NO_MOC_SOURCES)
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
vpath % $(REP_DIR)/contrib/$(QT4)/examples/webkit/previewer
###### end of editable part ######
LIBS += cxx libc
# static Qt plugins
ifeq ($(findstring qjpeg, $(QT_PLUGIN)), qjpeg)
LIBS += qjpeg
endif
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui dejavusans
endif
# QtNetwork stuff
ifeq ($(findstring network, $(QT)), network)
LIBS += qt_network
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
# QtWebKit stuff
ifeq ($(findstring webkit, $(QT)), webkit)
LIBS += qt_webcore
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -1,6 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/qt/fonts">
<file alias="helvetica_120_50.qpf">../../../../contrib/qt-everywhere-opensource-src-4.7.4/lib/fonts/helvetica_120_50.qpf</file>
</qresource>
</RCC>

View File

@ -1,117 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2007-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "tetrixboard.h"
#include <QtGui>
#include <QtScript>
#include <QUiLoader>
struct QtMetaObject : private QObject
{
public:
static const QMetaObject *get()
{ return &static_cast<QtMetaObject*>(0)->staticQtMetaObject; }
};
//! [0]
class TetrixUiLoader : public QUiLoader
{
public:
TetrixUiLoader(QObject *parent = 0)
: QUiLoader(parent)
{ }
virtual QWidget *createWidget(const QString &className, QWidget *parent = 0,
const QString &name = QString())
{
if (className == QLatin1String("TetrixBoard")) {
QWidget *board = new TetrixBoard(parent);
board->setObjectName(name);
return board;
}
return QUiLoader::createWidget(className, parent, name);
}
};
//! [0]
static QScriptValue evaluateFile(QScriptEngine &engine, const QString &fileName)
{
QFile file(fileName);
file.open(QIODevice::ReadOnly);
return engine.evaluate(file.readAll(), fileName);
}
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(tetrix);
//! [1]
QApplication app(argc, argv);
QScriptEngine engine;
QScriptValue Qt = engine.newQMetaObject(QtMetaObject::get());
Qt.setProperty("App", engine.newQObject(&app));
engine.globalObject().setProperty("Qt", Qt);
//! [1]
//! [2]
evaluateFile(engine, ":/tetrixpiece.js");
evaluateFile(engine, ":/tetrixboard.js");
evaluateFile(engine, ":/tetrixwindow.js");
//! [2]
//! [3]
TetrixUiLoader loader;
QFile uiFile(":/tetrixwindow.ui");
uiFile.open(QIODevice::ReadOnly);
QWidget *ui = loader.load(&uiFile);
uiFile.close();
QScriptValue ctor = engine.evaluate("TetrixWindow");
QScriptValue scriptUi = engine.newQObject(ui, QScriptEngine::ScriptOwnership);
QScriptValue tetrix = ctor.construct(QScriptValueList() << scriptUi);
//! [3]
//! [4]
ui->move(250, 250);
ui->resize(550, 370);
ui->show();
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
return app.exec();
//! [4]
}

View File

@ -1,77 +1,16 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/lib/mk/qt_version.inc
INC_DIR += $(PRG_DIR)
QMAKE_PROJECT_PATH = $(realpath $(QT4_REP_DIR)/contrib/$(QT4)/examples/script/qstetrix)
QMAKE_PROJECT_FILE = $(QMAKE_PROJECT_PATH)/qstetrix.pro
SRC_CC = main.cpp tetrixboard.cpp
vpath % $(QMAKE_PROJECT_PATH)
###### start of editable part ######
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
# include the qmake project file
# -> change the filename if it differs from the project dir name
CC_CXX_OPT += -DQT_NO_SCRIPTTOOLS
QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
###### end of editable part ######
LIBS += libc libm cxx
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui
ifneq ($(findstring font.qrc, $(RESOURCES)), font.qrc)
RESOURCES += font.qrc
endif
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -1,11 +0,0 @@
QT += script
CONFIG += uitools
FORMS = tetrixwindow.ui
RESOURCES = tetrix.qrc
HEADERS = tetrixboard.h
# install
target.path = $$[QT_INSTALL_EXAMPLES]/script/tetrix
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS tetrix.pro *.js
sources.path = $$[QT_INSTALL_EXAMPLES]/script/tetrix
INSTALLS += target sources

View File

@ -1,8 +0,0 @@
<RCC>
<qresource prefix="/" >
<file>tetrixwindow.js</file>
<file>tetrixwindow.ui</file>
<file>tetrixboard.js</file>
<file>tetrixpiece.js</file>
</qresource>
</RCC>

View File

@ -1,127 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2007-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "tetrixboard.h"
#include <QtGui>
Q_DECLARE_METATYPE(QPainter*)
TetrixBoard::TetrixBoard(QWidget *parent)
: QFrame(parent)
{
timer = new QTimer(this);
qMetaTypeId<QPainter*>();
}
void TetrixBoard::setNextPieceLabel(QWidget *label)
{
nextPieceLabel = qobject_cast<QLabel*>(label);
}
QObject *TetrixBoard::getTimer()
{
return timer;
}
QSize TetrixBoard::minimumSizeHint() const
{
return QSize(BoardWidth * 5 + frameWidth() * 2,
BoardHeight * 5 + frameWidth() * 2);
}
void TetrixBoard::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
QPainter painter(this);
QRect rect = contentsRect();
int boardTop = rect.bottom() - BoardHeight*squareHeight();
painter.translate(rect.left(), boardTop);
emit paintRequested(&painter);
}
void TetrixBoard::keyPressEvent(QKeyEvent *event)
{
emit keyPressed(event->key());
}
void TetrixBoard::showNextPiece(int width, int height)
{
if (!nextPieceLabel)
return;
QPixmap pixmap(width * squareWidth(), height * squareHeight());
QPainter painter(&pixmap);
painter.fillRect(pixmap.rect(), nextPieceLabel->palette().background());
emit paintNextPieceRequested(&painter);
nextPieceLabel->setPixmap(pixmap);
}
void TetrixBoard::drawPauseScreen(QPainter *painter)
{
painter->drawText(contentsRect(), Qt::AlignCenter, tr("Pause"));
}
void TetrixBoard::drawSquare(QPainter *painter, int x, int y, int shape)
{
static const QRgb colorTable[8] = {
0x000000, 0xCC6666, 0x66CC66, 0x6666CC,
0xCCCC66, 0xCC66CC, 0x66CCCC, 0xDAAA00
};
x = x*squareWidth();
y = y*squareHeight();
QColor color = colorTable[shape];
painter->fillRect(x + 1, y + 1, squareWidth() - 2, squareHeight() - 2,
color);
painter->setPen(color.light());
painter->drawLine(x, y + squareHeight() - 1, x, y);
painter->drawLine(x, y, x + squareWidth() - 1, y);
painter->setPen(color.dark());
painter->drawLine(x + 1, y + squareHeight() - 1,
x + squareWidth() - 1, y + squareHeight() - 1);
painter->drawLine(x + squareWidth() - 1, y + squareHeight() - 1,
x + squareWidth() - 1, y + 1);
}

View File

@ -1,96 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2007-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef TETRIXBOARD_H
#define TETRIXBOARD_H
#include <QTimer>
#include <QFrame>
#include <QPointer>
QT_BEGIN_NAMESPACE
class QLabel;
QT_END_NAMESPACE
class TetrixBoard : public QFrame
{
Q_OBJECT
Q_PROPERTY(QObject* timer READ getTimer)
public:
TetrixBoard(QWidget *parent = 0);
void setNextPieceLabel(QWidget *label);
void setBoardWidth(int width);
void setBoardHeight(int height);
QSize minimumSizeHint() const;
QObject *getTimer();
signals:
void scoreChanged(int score);
void levelChanged(int level);
void linesRemovedChanged(int numLines);
#if !defined(Q_MOC_RUN)
private: // can only be emitted by TetrixBoard
#endif
void keyPressed(int key);
void paintRequested(QPainter *painter);
void paintNextPieceRequested(QPainter *painter);
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
protected slots:
void showNextPiece(int width, int height);
void drawPauseScreen(QPainter *painter);
void drawSquare(QPainter *painter, int x, int y, int shape);
private:
enum { BoardWidth = 10, BoardHeight = 22 };
int squareWidth() { return contentsRect().width() / BoardWidth; }
int squareHeight() { return contentsRect().height() / BoardHeight; }
QTimer *timer;
QPointer<QLabel> nextPieceLabel;
};
#endif

View File

@ -1,249 +0,0 @@
function TetrixBoard(ui)
{
this.ui = ui;
this.isStarted = false;
this.isPaused = false;
this._board = new Array(TetrixBoard.BoardWidth * TetrixBoard.BoardHeight);
this.clearBoard();
this.curPiece = new TetrixPiece();
this.nextPiece = new TetrixPiece();
this.nextPiece.setRandomShape();
ui.timer.timeout.connect(this, this.onTimer);
ui.keyPressed.connect(this, this.onKeyPress);
ui.paintRequested.connect(this, this.onPaint);
ui.paintNextPieceRequested.connect(this, this.onPaintNextPiece);
}
TetrixBoard.BoardWidth = 10;
TetrixBoard.BoardHeight = 22;
TetrixBoard.prototype.start = function() {
if (this.isPaused)
return;
this.isStarted = true;
this.isWaitingAfterLine = false;
this.numLinesRemoved = 0;
this.numPiecesDropped = 0;
this.score = 0;
this.level = 1;
this.clearBoard();
this.ui.linesRemovedChanged(this.numLinesRemoved);
this.ui.scoreChanged(this.score);
this.ui.levelChanged(this.level);
this.newPiece();
this.ui.timer.start(this.timeoutTime());
}
TetrixBoard.prototype.pause = function() {
if (!this.isStarted)
return;
this.isPaused = !this.isPaused;
if (this.isPaused) {
this.ui.timer.stop();
} else {
this.ui.timer.start(this.timeoutTime());
}
this.ui.update();
}
TetrixBoard.prototype.getShapeAt = function(x, y) {
return this._board[(y * TetrixBoard.BoardWidth) + x];
}
TetrixBoard.prototype.setShapeAt = function(x, y, newShape) {
this._board[(y * TetrixBoard.BoardWidth) + x] = newShape;
}
TetrixBoard.prototype.clearBoard = function() {
for (var i = 0; i < TetrixBoard.BoardHeight * TetrixBoard.BoardWidth; ++i)
this._board[i] = TetrixShape.NoShape;
}
TetrixBoard.prototype.dropDown = function() {
var dropHeight = 0;
var newY = this.curY;
while (newY > 0) {
if (!this.tryMove(this.curPiece, this.curX, newY - 1))
break;
--newY;
++dropHeight;
}
this.pieceDropped(dropHeight);
}
TetrixBoard.prototype.oneLineDown = function() {
if (!this.tryMove(this.curPiece, this.curX, this.curY - 1))
this.pieceDropped(0);
}
TetrixBoard.prototype.pieceDropped = function(dropHeight) {
for (var i = 0; i < 4; ++i) {
var x = this.curX + this.curPiece.getX(i);
var y = this.curY - this.curPiece.getY(i);
this.setShapeAt(x, y, this.curPiece.shape);
}
++this.numPiecesDropped;
if ((this.numPiecesDropped % 25) == 0) {
++this.level;
this.ui.timer.start(this.timeoutTime());
this.ui.levelChanged(this.level);
}
this.score += dropHeight + 7;
this.ui.scoreChanged(this.score);
this.removeFullLines();
if (!this.isWaitingAfterLine)
this.newPiece();
}
TetrixBoard.prototype.removeFullLines = function() {
var numFullLines = 0;
for (var i = TetrixBoard.BoardHeight - 1; i >= 0; --i) {
var lineIsFull = true;
for (var j = 0; j < TetrixBoard.BoardWidth; ++j) {
if (this.getShapeAt(j, i) == TetrixShape.NoShape) {
lineIsFull = false;
break;
}
}
if (lineIsFull) {
++numFullLines;
for (var k = i; k < TetrixBoard.BoardHeight - 1; ++k) {
for (var j = 0; j < TetrixBoard.BoardWidth; ++j)
this.setShapeAt(j, k, this.getShapeAt(j, k + 1));
}
for (var j = 0; j < TetrixBoard.BoardWidth; ++j)
this.setShapeAt(j, TetrixBoard.BoardHeight - 1, TetrixShape.NoShape);
}
}
if (numFullLines > 0) {
this.numLinesRemoved += numFullLines;
this.score += 10 * numFullLines;
this.ui.linesRemovedChanged(this.numLinesRemoved);
this.ui.scoreChanged(this.score);
this.ui.timer.start(500);
this.isWaitingAfterLine = true;
this.curPiece.shape = TetrixShape.NoShape;
this.ui.update();
}
}
TetrixBoard.prototype.newPiece = function() {
this.curPiece = this.nextPiece;
this.nextPiece = new TetrixPiece();
this.nextPiece.setRandomShape();
this.ui.showNextPiece(this.nextPiece.maxX - this.nextPiece.minX + 1,
this.nextPiece.maxY - this.nextPiece.minY + 1);
this.curX = TetrixBoard.BoardWidth / 2 + 1;
this.curY = TetrixBoard.BoardHeight - 1 + this.curPiece.minY;
if (!this.tryMove(this.curPiece, this.curX, this.curY)) {
this.curPiece.shape = TetrixShape.NoShape;
this.ui.timer.stop();
this.isStarted = false;
}
}
TetrixBoard.prototype.tryMove = function(newPiece, newX, newY) {
for (var i = 0; i < 4; ++i) {
var x = newX + newPiece.getX(i);
var y = newY - newPiece.getY(i);
if ((x < 0) || (x >= TetrixBoard.BoardWidth) || (y < 0) || (y >= TetrixBoard.BoardHeight))
return false;
if (this.getShapeAt(x, y) != TetrixShape.NoShape)
return false;
}
this.curPiece = newPiece;
this.curX = newX;
this.curY = newY;
this.ui.update();
return true;
}
TetrixBoard.prototype.onPaint = function(painter) {
if (this.isPaused) {
this.ui.drawPauseScreen(painter);
return;
}
for (var i = 0; i < TetrixBoard.BoardHeight; ++i) {
for (var j = 0; j < TetrixBoard.BoardWidth; ++j) {
var shape = this.getShapeAt(j, TetrixBoard.BoardHeight - i - 1);
if (shape != TetrixShape.NoShape)
this.ui.drawSquare(painter, j, i, shape);
}
}
if (this.curPiece.shape != TetrixShape.NoShape) {
for (var i = 0; i < 4; ++i) {
var x = this.curX + this.curPiece.getX(i);
var y = this.curY - this.curPiece.getY(i);
this.ui.drawSquare(painter, x, TetrixBoard.BoardHeight - y - 1,
this.curPiece.shape);
}
}
}
TetrixBoard.prototype.onPaintNextPiece = function(painter) {
for (var i = 0; i < 4; ++i) {
var x = this.nextPiece.getX(i) - this.nextPiece.minX;
var y = this.nextPiece.getY(i) - this.nextPiece.minY;
this.ui.drawSquare(painter, x, y, this.nextPiece.shape);
}
}
TetrixBoard.prototype.onKeyPress = function(key) {
if (!this.isStarted || this.isPaused || (this.curPiece.shape == TetrixShape.NoShape))
return;
switch (key) {
case Qt.Key_Left:
this.tryMove(this.curPiece, this.curX - 1, this.curY);
break;
case Qt.Key_Right:
this.tryMove(this.curPiece, this.curX + 1, this.curY);
break;
case Qt.Key_Down:
this.tryMove(this.curPiece.rotatedRight(), this.curX, this.curY);
break;
case Qt.Key_Up:
this.tryMove(this.curPiece.rotatedLeft(), this.curX, this.curY);
break;
case Qt.Key_Space:
this.dropDown();
break;
case Qt.Key_D:
this.oneLineDown();
break;
}
}
TetrixBoard.prototype.onTimer = function() {
if (this.isWaitingAfterLine) {
this.isWaitingAfterLine = false;
this.newPiece();
this.ui.timer.start(this.timeoutTime());
} else {
this.oneLineDown();
}
}
TetrixBoard.prototype.timeoutTime = function() {
return 1000 / (1 + this.level);
}

View File

@ -1,131 +0,0 @@
TetrixShape = {
NoShape:0,
ZShape:1,
SShape:2,
LineShape:3,
TShape:4,
SquareShape:5,
LShape:6,
MirroredLShape:7
}
TetrixCoordsTable = [
[ [ 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ],
[ [ 0, -1 ], [ 0, 0 ], [ -1, 0 ], [ -1, 1 ] ],
[ [ 0, -1 ], [ 0, 0 ], [ 1, 0 ], [ 1, 1 ] ],
[ [ 0, -1 ], [ 0, 0 ], [ 0, 1 ], [ 0, 2 ] ],
[ [ -1, 0 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ] ],
[ [ 0, 0 ], [ 1, 0 ], [ 0, 1 ], [ 1, 1 ] ],
[ [ -1, -1 ], [ 0, -1 ], [ 0, 0 ], [ 0, 1 ] ],
[ [ 1, -1 ], [ 0, -1 ], [ 0, 0 ], [ 0, 1 ] ]
]
function TetrixPiece()
{
this.shape = TetrixShape.NoShape;
}
TetrixPiece.prototype.__defineGetter__(
"shape",
function() {
return this._shape;
}
);
TetrixPiece.prototype.__defineSetter__(
"shape",
function(shape) {
this._shape = shape;
this._coords = new Array(4);
for (var i = 0; i < 4; ++i)
this._coords[i] = TetrixCoordsTable[shape][i].slice();
}
);
TetrixPiece.prototype.setRandomShape = function() {
this.shape = Math.floor(((Math.random() * 100000) % 7) + 1);
}
TetrixPiece.prototype.getX = function(index) {
return this._coords[index][0];
}
TetrixPiece.prototype.getY = function(index) {
return this._coords[index][1];
}
TetrixPiece.prototype._setX = function(index, x) {
this._coords[index][0] = x;
}
TetrixPiece.prototype._setY = function(index, y) {
this._coords[index][1] = y;
}
TetrixPiece.prototype.__defineGetter__(
"minX",
function() {
var min = this._coords[0][0];
for (var i = 1; i < 4; ++i)
min = Math.min(min, this._coords[i][0]);
return min;
}
);
TetrixPiece.prototype.__defineGetter__(
"maxX",
function() {
var max = this._coords[0][0];
for (var i = 1; i < 4; ++i)
max = Math.max(max, this._coords[i][0]);
return max;
}
);
TetrixPiece.prototype.__defineGetter__(
"minY",
function() {
var min = this._coords[0][1];
for (var i = 1; i < 4; ++i)
min = Math.min(min, this._coords[i][1]);
return min;
}
);
TetrixPiece.prototype.__defineGetter__(
"maxY",
function() {
var max = this._coords[0][1];
for (var i = 1; i < 4; ++i)
max = Math.max(max, this._coords[i][1]);
return max;
}
);
TetrixPiece.prototype.rotatedLeft = function() {
var result = new TetrixPiece();
if (this._shape == TetrixShape.SquareShape) {
result.shape = this._shape;
return result;
}
result._shape = this._shape;
for (var i = 0; i < 4; ++i) {
result._setX(i, this.getY(i));
result._setY(i, -this.getX(i));
}
return result;
}
TetrixPiece.prototype.rotatedRight = function() {
var result = new TetrixPiece();
if (this._shape == TetrixShape.SquareShape) {
result.shape = this._shape;
return result;
}
result._shape = this._shape;
for (var i = 0; i < 4; ++i) {
result._setX(i, -this.getY(i));
result._setY(i, this.getX(i));
}
return result;
}

View File

@ -1,16 +0,0 @@
function TetrixWindow(ui)
{
this.ui = ui;
var boardUi = ui.findChild("board");
boardUi.nextPieceLabel = ui.findChild("nextPieceLabel");
this.board = new TetrixBoard(boardUi);
ui.findChild("startButton").clicked.connect(this.board, this.board.start);
ui.findChild("quitButton").clicked.connect(Qt.App.quit);
ui.findChild("pauseButton").clicked.connect(this.board, this.board.pause);
boardUi.scoreChanged.connect(ui.findChild("scoreLcd")["display(int)"]);
boardUi.levelChanged.connect(ui.findChild("levelLcd")["display(int)"]);
boardUi.linesRemovedChanged.connect(ui.findChild("linesLcd")["display(int)"]);
}

View File

@ -1,164 +0,0 @@
<ui version="4.0" >
<class>TetrixWindow</class>
<widget class="QWidget" name="TetrixWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>537</width>
<height>475</height>
</rect>
</property>
<property name="windowTitle" >
<string>Tetrix</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="4" column="0" >
<widget class="QPushButton" name="startButton" >
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<string>&amp;Start</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QLCDNumber" name="linesLcd" >
<property name="segmentStyle" >
<enum>QLCDNumber::Filled</enum>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLabel" name="linesRemovedLabel" >
<property name="text" >
<string>LINES REMOVED</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QPushButton" name="pauseButton" >
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<string>&amp;Pause</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLCDNumber" name="scoreLcd" >
<property name="segmentStyle" >
<enum>QLCDNumber::Filled</enum>
</property>
</widget>
</item>
<item rowspan="6" row="0" column="1" >
<widget class="TetrixBoard" name="board" >
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
<property name="frameShape" >
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="levelLabel" >
<property name="text" >
<string>LEVEL</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="nextLabel" >
<property name="text" >
<string>NEXT</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLCDNumber" name="levelLcd" >
<property name="segmentStyle" >
<enum>QLCDNumber::Filled</enum>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="scoreLabel" >
<property name="text" >
<string>SCORE</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="nextPieceLabel" >
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="text" >
<string/>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="quitButton" >
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<string>&amp;Quit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TetrixBoard</class>
<extends>QFrame</extends>
<header>tetrixboard.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,100 +1,14 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/lib/mk/qt_version.inc
INC_DIR += $(PRG_DIR)
QMAKE_PROJECT_PATH = $(realpath $(QT4_REP_DIR)/contrib/$(QT4)/demos/textedit)
QMAKE_PROJECT_FILE = $(QMAKE_PROJECT_PATH)/textedit.pro
###### start of editable part ######
vpath % $(QMAKE_PROJECT_PATH)
# include the qmake project file
# -> change the filename if it differs from the project dir name
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
QT4 = qt-everywhere-opensource-src-4.7.4
#QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
QMAKE_PROJECT_FILE = $(realpath $(REP_DIR)/contrib/$(QT4)/demos/textedit/textedit.pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
#
# The following files don't need to be moc'ed,
# so exclude them from $(SOURCES) and $(HEADERS).
#
NO_MOC_SOURCES = main.cpp textedit.cpp
SOURCES := $(filter-out $(NO_MOC_SOURCES), $(SOURCES))
SRC_CC = $(NO_MOC_SOURCES)
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
vpath % $(REP_DIR)/contrib/$(QT4)/demos/textedit
###### end of editable part ######
LIBS += cxx libc
# static Qt plugins
ifeq ($(findstring qjpeg, $(QT_PLUGIN)), qjpeg)
LIBS += qjpeg
endif
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui dejavusans
endif
# QtNetwork stuff
ifeq ($(findstring network, $(QT)), network)
LIBS += qt_network
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
# QtWebKit stuff
ifeq ($(findstring webkit, $(QT)), webkit)
LIBS += qt_webcore
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -1,6 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/qt/fonts">
<file alias="helvetica_120_50.qpf">../../../contrib/qt-everywhere-opensource-src-4.7.4/lib/fonts/helvetica_120_50.qpf</file>
</qresource>
</RCC>

View File

@ -1,11 +1,15 @@
TEMPLATE = app
TARGET = qt_launchpad
QT += core gui
HEADERS += kbyte_loadbar.h \
child_entry.h \
QT = core gui
HEADERS += child_entry.h \
kbyte_loadbar.h \
launch_entry.h \
qt_launchpad.h
SOURCES += child_entry.cpp \
kbyte_loadbar.cpp \
launch_entry.cpp \
main.cpp \
qt_launchpad.cpp
FORMS += child_entry.ui \
launch_entry.ui \
qt_launchpad.ui
RESOURCES += font.qrc

View File

@ -1,83 +1,7 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
INC_DIR += $(PRG_DIR)
SRC_CC = child_entry.cpp \
kbyte_loadbar.cpp \
launch_entry.cpp \
main.cpp \
qt_launchpad.cpp
###### start of editable part ######
# include the qmake project file
# -> change the filename if it differs from the project dir name
QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
LIBS += cxx server process launchpad
###### end of editable part ######
LIBS += libc
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui
ifneq ($(findstring font.qrc, $(RESOURCES)), font.qrc)
RESOURCES += font.qrc
endif
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -1,85 +1,7 @@
# build with QtCore and QtGui support by default
# (can be overridden in the qmake project file)
QT = core gui
# identify the qt4 repository by searching for a file that is unique for qt4
QT4_REP_DIR := $(call select_from_repositories,lib/import/import-qt4.inc)
QT4_REP_DIR := $(realpath $(dir $(QT4_REP_DIR))../..)
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
include $(QT4_REP_DIR)/src/app/tmpl/target_defaults.inc
INC_DIR += $(PRG_DIR)
###### start of editable part ######
# include the qmake project file
# -> change the filename if it differs from the project dir name
QMAKE_PROJECT_FILE = $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
# how to name the generated executable
# (if not already defined in the qmake project file)
# -> change if it shall not be the name of the project dir
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=512*1024
###### end of editable part ######
LIBS += libc
# static Qt plugins
ifeq ($(findstring qgif, $(QT_PLUGIN)), qgif)
LIBS += qgif
endif
ifeq ($(findstring qjpeg, $(QT_PLUGIN)), qjpeg)
LIBS += qjpeg
endif
# QtCore stuff
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui stuff
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui dejavusans
endif
# QtNetwork stuff
ifeq ($(findstring network, $(QT)), network)
LIBS += qt_network
endif
# QtScript stuff
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools stuff
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg stuff
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml stuff
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools stuff
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
#endif # $(QMAKE_PROJECT_FILE)
include $(QT4_REP_DIR)/src/app/tmpl/target_final.inc

View File

@ -0,0 +1,31 @@
# build with QtCore and QtGui support by default
# - can be overridden in the qmake project file
QT = core gui
# find out the name of the project directory
PROJECT_DIR_NAME = $(notdir $(abspath $(PRG_DIR)))
# include the qmake project file
# - if the qmake project file has a different name than the project directory,
# set QMAKE_PROJECT_FILE in target.mk before the inclusion of this file
QMAKE_PROJECT_FILE ?= $(realpath $(PRG_DIR)/$(PROJECT_DIR_NAME).pro)
ifneq ($(strip $(QMAKE_PROJECT_FILE)),)
include $(QMAKE_PROJECT_FILE)
endif
# how to name the generated executable
# (if not already defined in the qmake project file)
# - can be overridden in target.mk after inclusion of this file
ifndef TARGET
TARGET = $(PROJECT_DIR_NAME)
endif
# default stack size of the main thread
# - can be overridden anywhere in target.mk
QT_MAIN_STACK_SIZE ?= 512*1024

View File

@ -0,0 +1,61 @@
INC_DIR += $(PRG_DIR)
LIBS += libc
# set the stack size of the main thread
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=$(QT_MAIN_STACK_SIZE)
# static Qt plugins
ifeq ($(findstring qgif, $(QT_PLUGIN)), qgif)
LIBS += qgif
endif
ifeq ($(findstring qjpeg, $(QT_PLUGIN)), qjpeg)
LIBS += qjpeg
endif
# QtCore
ifeq ($(findstring core, $(QT)), core)
QT_DEFINES += -DQT_CORE_LIB
LIBS += qt_core
endif
# QtGui
ifeq ($(findstring gui, $(QT)), gui)
QT_DEFINES += -DQT_GUI_LIB
LIBS += qt_gui dejavusans
endif
# QtNetwork
ifeq ($(findstring network, $(QT)), network)
LIBS += qt_network
endif
# QtScript
ifeq ($(findstring script, $(QT)), script)
LIBS += qt_script
endif
# QtScriptTools
ifeq ($(findstring scripttools, $(QT)), scripttools)
LIBS += qt_scripttools
endif
# QtSvg
ifeq ($(findstring svg, $(QT)), svg)
LIBS += qt_svg
endif
# QtXml
ifeq ($(findstring xml, $(QT)), xml)
LIBS += qt_xml
endif
# QtUiTools
ifeq ($(findstring uitools, $(CONFIG)), uitools)
LIBS += qt_ui_tools
endif
# QtWebKit
ifeq ($(findstring webkit, $(QT)), webkit)
LIBS += qt_webcore
endif

View File

@ -5,10 +5,10 @@
# \date 2009-05-15
#
QT4 = qt-everywhere-opensource-src-4.7.4
REP_DIR := $(realpath ..)
include $(REP_DIR)/lib/mk/qt_version.inc
#
# Compound rule for building the tools in the right order
#

View File

@ -7,8 +7,6 @@
# This file is based on the generated Makefile created by qt4's configure.
#
QT4 = qt-everywhere-opensource-src-4.7.4
CC_1 = gcc
CC = $(CC_1)
CXX_1 = g++
@ -23,6 +21,8 @@ QMAKE_LFLAGS = $(QMAKE_LFLAGS_1)
# Genode repository
REP_DIR := ../..
include $(REP_DIR)/lib/mk/qt_version.inc
# root of Qt4 source tree
CONTRIB_DIR := $(REP_DIR)/contrib/$(QT4)