commit 7506cadc8d243931a745a50ff4a83c89af95a19f Author: Timothy Pearson Date: Sat Mar 10 16:08:00 2012 -0600 Initial import diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..780c5e8 --- /dev/null +++ b/Makefile @@ -0,0 +1,178 @@ +############################################################################# +# Makefile for building: styleplugin +# Generated by qmake (2.01a) (Qt 4.7.0) on: Sat Mar 10 16:06:16 2012 +# Project: styleplugin.pro +# Template: subdirs +# Command: /usr/bin/qmake-qt4 -o Makefile styleplugin.pro +############################################################################# + +first: make_default +MAKEFILE = Makefile +QMAKE = /usr/bin/qmake-qt4 +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = $(COPY_DIR) +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +SUBTARGETS = \ + sub-stylewindow \ + sub-plugin \ + sub-unstyledwindow + +stylewindow//$(MAKEFILE): + @$(CHK_DIR_EXISTS) stylewindow/ || $(MKDIR) stylewindow/ + cd stylewindow/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/stylewindow.pro -o $(MAKEFILE) +sub-stylewindow-qmake_all: FORCE + @$(CHK_DIR_EXISTS) stylewindow/ || $(MKDIR) stylewindow/ + cd stylewindow/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/stylewindow.pro -o $(MAKEFILE) +sub-stylewindow: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) +sub-stylewindow-make_default: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) +sub-stylewindow-make_first: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) first +sub-stylewindow-all: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) all +sub-stylewindow-clean: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) clean +sub-stylewindow-distclean: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) distclean +sub-stylewindow-install_subtargets: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) install +sub-stylewindow-uninstall_subtargets: stylewindow//$(MAKEFILE) FORCE + cd stylewindow/ && $(MAKE) -f $(MAKEFILE) uninstall +plugin//$(MAKEFILE): + @$(CHK_DIR_EXISTS) plugin/ || $(MKDIR) plugin/ + cd plugin/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/plugin.pro -o $(MAKEFILE) +sub-plugin-qmake_all: FORCE + @$(CHK_DIR_EXISTS) plugin/ || $(MKDIR) plugin/ + cd plugin/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/plugin.pro -o $(MAKEFILE) +sub-plugin: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) +sub-plugin-make_default: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) +sub-plugin-make_first: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) first +sub-plugin-all: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) all +sub-plugin-clean: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) clean +sub-plugin-distclean: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) distclean +sub-plugin-install_subtargets: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) install +sub-plugin-uninstall_subtargets: plugin//$(MAKEFILE) FORCE + cd plugin/ && $(MAKE) -f $(MAKEFILE) uninstall +unstyledwindow//$(MAKEFILE): + @$(CHK_DIR_EXISTS) unstyledwindow/ || $(MKDIR) unstyledwindow/ + cd unstyledwindow/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/unstyledwindow.pro -o $(MAKEFILE) +sub-unstyledwindow-qmake_all: FORCE + @$(CHK_DIR_EXISTS) unstyledwindow/ || $(MKDIR) unstyledwindow/ + cd unstyledwindow/ && $(QMAKE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/unstyledwindow.pro -o $(MAKEFILE) +sub-unstyledwindow: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) +sub-unstyledwindow-make_default: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) +sub-unstyledwindow-make_first: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) first +sub-unstyledwindow-all: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) all +sub-unstyledwindow-clean: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) clean +sub-unstyledwindow-distclean: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) distclean +sub-unstyledwindow-install_subtargets: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) install +sub-unstyledwindow-uninstall_subtargets: unstyledwindow//$(MAKEFILE) FORCE + cd unstyledwindow/ && $(MAKE) -f $(MAKEFILE) uninstall + +Makefile: styleplugin.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf + $(QMAKE) -o Makefile styleplugin.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +qmake: qmake_all FORCE + @$(QMAKE) -o Makefile styleplugin.pro + +qmake_all: sub-stylewindow-qmake_all sub-plugin-qmake_all sub-unstyledwindow-qmake_all FORCE + +make_default: sub-stylewindow-make_default sub-plugin-make_default sub-unstyledwindow-make_default FORCE +make_first: sub-stylewindow-make_first sub-plugin-make_first sub-unstyledwindow-make_first FORCE +all: sub-stylewindow-all sub-plugin-all sub-unstyledwindow-all FORCE +clean: sub-stylewindow-clean sub-plugin-clean sub-unstyledwindow-clean FORCE +distclean: sub-stylewindow-distclean sub-plugin-distclean sub-unstyledwindow-distclean FORCE + -$(DEL_FILE) Makefile +install_subtargets: sub-stylewindow-install_subtargets sub-plugin-install_subtargets sub-unstyledwindow-install_subtargets FORCE +uninstall_subtargets: sub-stylewindow-uninstall_subtargets sub-plugin-uninstall_subtargets sub-unstyledwindow-uninstall_subtargets FORCE + +sub-stylewindow-check: stylewindow/$(MAKEFILE) + cd stylewindow/ && $(MAKE) check +sub-plugin-check: plugin/$(MAKEFILE) + cd plugin/ && $(MAKE) check +sub-unstyledwindow-check: unstyledwindow/$(MAKEFILE) + cd unstyledwindow/ && $(MAKE) check +check: sub-stylewindow-check sub-plugin-check sub-unstyledwindow-check + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all +install_sources: FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/styleplugin.pro $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ + + +uninstall_sources: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styleplugin.pro + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ + + +install: install_subtargets install_sources FORCE + +uninstall: uninstall_sources uninstall_subtargets FORCE + +FORCE: + diff --git a/plugin/Makefile b/plugin/Makefile new file mode 100644 index 0000000..a128159 --- /dev/null +++ b/plugin/Makefile @@ -0,0 +1,271 @@ +############################################################################# +# Makefile for building: libsimplestyleplugin.so +# Generated by qmake (2.01a) (Qt 4.7.0) on: Sat Mar 10 16:06:19 2012 +# Project: plugin.pro +# Template: lib +# Command: /usr/bin/qmake-qt4 -o Makefile plugin.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/tqt3 -I/usr/include/tqt -I/opt/trinity/include -I. +LINK = g++ +LFLAGS = -Wl,-O1 -shared +LIBS = $(SUBLIBS) -L/usr/lib -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore -lQtGui -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = simplestyle.cpp \ + simplestyleplugin.cpp \ + tdeqt4painter.cpp moc_simplestyle.cpp \ + moc_simplestyleplugin.cpp +OBJECTS = simplestyle.o \ + simplestyleplugin.o \ + tdeqt4painter.o \ + moc_simplestyle.o \ + moc_simplestyleplugin.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + plugin.pro +QMAKE_TARGET = simplestyleplugin +DESTDIR = ../styles/ +TARGET = libsimplestyleplugin.so +TARGETD = libsimplestyleplugin.so + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile ../styles/$(TARGET) + +../styles/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @$(CHK_DIR_EXISTS) ../styles/ || $(MKDIR) ../styles/ + -$(DEL_FILE) $(TARGET) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -$(MOVE) $(TARGET) ../styles/ + + + +Makefile: plugin.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -o Makefile plugin.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile plugin.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/simplestyleplugin1.0.0 || $(MKDIR) .tmp/simplestyleplugin1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/simplestyleplugin1.0.0/ && $(COPY_FILE) --parents simplestyle.h simplestyleplugin.h tdeqt4painter.h .tmp/simplestyleplugin1.0.0/ && $(COPY_FILE) --parents simplestyle.cpp simplestyleplugin.cpp tdeqt4painter.cpp .tmp/simplestyleplugin1.0.0/ && (cd `dirname .tmp/simplestyleplugin1.0.0` && $(TAR) simplestyleplugin1.0.0.tar simplestyleplugin1.0.0 && $(COMPRESS) simplestyleplugin1.0.0.tar) && $(MOVE) `dirname .tmp/simplestyleplugin1.0.0`/simplestyleplugin1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/simplestyleplugin1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_simplestyle.cpp moc_simplestyleplugin.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_simplestyle.cpp moc_simplestyleplugin.cpp +moc_simplestyle.cpp: simplestyle.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) simplestyle.h -o moc_simplestyle.cpp + +moc_simplestyleplugin.cpp: simplestyleplugin.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) simplestyleplugin.h -o moc_simplestyleplugin.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: simplestyle.moc +compiler_moc_source_clean: + -$(DEL_FILE) simplestyle.moc +simplestyle.moc: simplestyle.h \ + tdeqt4painter.h \ + simplestyle.cpp + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) simplestyle.cpp -o simplestyle.moc + +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_moc_source_clean + +####### Compile + +simplestyle.o: simplestyle.cpp simplestyle.h \ + tdeqt4painter.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o simplestyle.o simplestyle.cpp + +simplestyleplugin.o: simplestyleplugin.cpp simplestyleplugin.h \ + simplestyle.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o simplestyleplugin.o simplestyleplugin.cpp + +tdeqt4painter.o: tdeqt4painter.cpp tdeqt4painter.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tdeqt4painter.o tdeqt4painter.cpp + +moc_simplestyle.o: moc_simplestyle.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_simplestyle.o moc_simplestyle.cpp + +moc_simplestyleplugin.o: moc_simplestyleplugin.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_simplestyleplugin.o moc_simplestyleplugin.cpp + +####### Install + +install_target: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/ + -$(INSTALL_PROGRAM) "../styles/$(TARGET)" "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/$(TARGET)" + -$(STRIP) --strip-unneeded "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/$(TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/$(TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/styles/ + + +install_sources: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/simplestyle.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/simplestyleplugin.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/tdeqt4painter.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/simplestyle.h $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/simplestyleplugin.h $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/tdeqt4painter.h $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/plugin/plugin.pro $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + + +uninstall_sources: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/simplestyle.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/simplestyleplugin.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/tdeqt4painter.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/simplestyle.h + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/simplestyleplugin.h + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/tdeqt4painter.h + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/plugin.pro + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/plugin/ + + +install: install_target install_sources FORCE + +uninstall: uninstall_target uninstall_sources FORCE + +FORCE: + diff --git a/plugin/plugin.pro b/plugin/plugin.pro new file mode 100644 index 0000000..26e8615 --- /dev/null +++ b/plugin/plugin.pro @@ -0,0 +1,28 @@ +#! [0] +TEMPLATE = lib +CONFIG += plugin +HEADERS = simplestyle.h \ + simplestyleplugin.h \ + tdeqt4painter.h +SOURCES = simplestyle.cpp \ + simplestyleplugin.cpp \ + tdeqt4painter.cpp +TARGET = simplestyleplugin + +INCLUDEPATH += /usr/include/tqt3 +INCLUDEPATH += /usr/include/tqt +INCLUDEPATH += /opt/trinity/include +LIBS += -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore + +#! [0] +DESTDIR = ../styles/ + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/styles +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS plugin.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/plugin +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + +symbian:TARGET.EPOCALLOWDLLDATA = 1 diff --git a/plugin/simplestyle.cpp b/plugin/simplestyle.cpp new file mode 100644 index 0000000..08299dc --- /dev/null +++ b/plugin/simplestyle.cpp @@ -0,0 +1,1586 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Timothy Pearson. All rights reserved. +** +** This file is part of the TDE Qt4 style interface +** +** 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. +** +** 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 granted +** herein. +** +**********************************************************************/ + +#define TQT_NO_COMPAT_NAMES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef Qt + +#include +#include + +#include "simplestyle.h" +#include "tdeqt4painter.h" + +#define INTEGRATE_WITH_TDE 1 + +#ifdef INTEGRATE_WITH_TDE +#undef Q_OBJECT +#define Q_OBJECT TQ_OBJECT +#include +#include +#include +#include +#endif + +#define DEBUG_WARNINGS 1 +// #define DEBUG_SPEW 1 + +inline QColor convertTQt3ToQt4Color(TQColor tqt3color) +{ + return QColor(tqt3color.red(), tqt3color.green(), tqt3color.blue()); +} + +inline TQColor convertQt4ToTQt3Color(QColor qt4color) +{ + return TQColor(qt4color.red(), qt4color.green(), qt4color.blue()); +} + +inline QString convertTQt3ToQt4String(TQString tqt3string) +{ + return QString::fromUtf8(tqt3string.utf8().data()); +} + +inline TQString convertQt4ToTQt3String(QString qt4string) +{ + return TQString::fromUtf8(qt4string.toUtf8().data()); +} + +inline TQIconSet convertQt4ToTQt3IconSet(QIcon qt4icon) +{ + int i=0; + int j=0; + QIcon::Mode qt4iconmode; + TQIconSet::Mode tqt3iconmode; + QIcon::State qt4iconstate; + TQIconSet::State tqt3iconstate; + + TQIconSet tqt3iconset; + + // Get the maximum icon size stored in the QIcon and generate a pixmap of that size + QSize qt4size = qt4icon.actualSize(QSize(32768,32768)); + + for (i=0;i<3;i++) { + for (j=0;j<2;j++) { + if (i==0) { + qt4iconmode = QIcon::Normal; + tqt3iconmode = TQIconSet::Normal; + } + if (i==1) { + qt4iconmode = QIcon::Disabled; + tqt3iconmode = TQIconSet::Disabled; + } + if (i==2) { + qt4iconmode = QIcon::Active; + tqt3iconmode = TQIconSet::Active; + } + if (j==0) { + qt4iconstate = QIcon::On; + tqt3iconstate = TQIconSet::On; + } + if (j==1) { + qt4iconstate = QIcon::Off; + tqt3iconstate = TQIconSet::Off; + } + QPixmap qt4iconpm = qt4icon.pixmap(qt4size, qt4iconmode, qt4iconstate); + TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), qt4iconpm.depth()); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared); + QPainter qt4painter(&qtPM); + qt4painter.drawPixmap(0, 0, qt4iconpm); + qt4painter.end(); + + tqt3iconset.setPixmap(tqtPM, TQIconSet::Automatic, tqt3iconmode, tqt3iconstate); + } + } + + return tqt3iconset; +} + +inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon) +{ + // Get the maximum icon size stored in the QIcon and generate a pixmap of that size + QSize qt4size = qt4icon.actualSize(QSize(32768,32768)); + + QPixmap qt4iconpm = qt4icon.pixmap(qt4size); + TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), qt4iconpm.depth()); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared); + QPainter qt4painter(&qtPM); + qt4painter.drawPixmap(0, 0, qt4iconpm); + qt4painter.end(); + + return tqtPM; +} + +inline QRect convertTQt3ToQt4Rect(TQRect tqt3rect) +{ + return QRect(tqt3rect.x(), tqt3rect.y(), tqt3rect.width(), tqt3rect.height()); +} + +inline QBrush convertTQt3ToQt4Brush(TQBrush tqt3brush) +{ + QBrush qt4brush; + TQt::BrushStyle tqt3brushstyle = tqt3brush.style(); + Qt::BrushStyle qt4brushstyle; + + switch ( tqt3brushstyle ) { + case TQt::NoBrush: + qt4brushstyle = Qt::NoBrush; + break; + case TQt::SolidPattern: + qt4brushstyle = Qt::SolidPattern; + break; + case TQt::Dense1Pattern: + qt4brushstyle = Qt::Dense1Pattern; + break; + case TQt::Dense2Pattern: + qt4brushstyle = Qt::Dense2Pattern; + break; + case TQt::Dense3Pattern: + qt4brushstyle = Qt::Dense3Pattern; + break; + case TQt::Dense4Pattern: + qt4brushstyle = Qt::Dense4Pattern; + break; + case TQt::Dense5Pattern: + qt4brushstyle = Qt::Dense5Pattern; + break; + case TQt::Dense6Pattern: + qt4brushstyle = Qt::Dense6Pattern; + break; + case TQt::Dense7Pattern: + qt4brushstyle = Qt::Dense7Pattern; + break; + case TQt::HorPattern: + qt4brushstyle = Qt::HorPattern; + break; + case TQt::VerPattern: + qt4brushstyle = Qt::VerPattern; + break; + case TQt::CrossPattern: + qt4brushstyle = Qt::CrossPattern; + break; + case TQt::BDiagPattern: + qt4brushstyle = Qt::BDiagPattern; + break; + case TQt::FDiagPattern: + qt4brushstyle = Qt::FDiagPattern; + break; + case TQt::DiagCrossPattern: + qt4brushstyle = Qt::DiagCrossPattern; + break; + case TQt::CustomPattern: + qt4brushstyle = Qt::TexturePattern; + break; + default: + qt4brushstyle = Qt::NoBrush; +#if defined(QT_CHECK_RANGE) + tqWarning( "convertTQt3ToQt4Brush: Invalid brush style %d", tqt3brushstyle ); +#endif + } + qt4brush.setStyle(qt4brushstyle); + TQColor qt3color = tqt3brush.color(); + qt4brush.setColor(QColor(qt3color.red(), qt3color.green(), qt3color.blue(), 255)); + if (qt4brushstyle == Qt::TexturePattern) { + TQPixmap tqtPM = *tqt3brush.pixmap(); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ImplicitlyShared); + qt4brush.setTexture(qtPM); + } + + return qt4brush; +} + +inline TQBrush convertQt4ToTQt3Brush(QBrush qt4brush) +{ + TQBrush tqt3brush; + Qt::BrushStyle qt4brushstyle = qt4brush.style(); + TQt::BrushStyle tqt3brushstyle; + + switch ( qt4brushstyle ) { + case Qt::NoBrush: + tqt3brushstyle = TQt::NoBrush; + break; + case Qt::SolidPattern: + tqt3brushstyle = TQt::SolidPattern; + break; + case Qt::Dense1Pattern: + tqt3brushstyle = TQt::Dense1Pattern; + break; + case Qt::Dense2Pattern: + tqt3brushstyle = TQt::Dense2Pattern; + break; + case Qt::Dense3Pattern: + tqt3brushstyle = TQt::Dense3Pattern; + break; + case Qt::Dense4Pattern: + tqt3brushstyle = TQt::Dense4Pattern; + break; + case Qt::Dense5Pattern: + tqt3brushstyle = TQt::Dense5Pattern; + break; + case Qt::Dense6Pattern: + tqt3brushstyle = TQt::Dense6Pattern; + break; + case Qt::Dense7Pattern: + tqt3brushstyle = TQt::Dense7Pattern; + break; + case Qt::HorPattern: + tqt3brushstyle = TQt::HorPattern; + break; + case Qt::VerPattern: + tqt3brushstyle = TQt::VerPattern; + break; + case Qt::CrossPattern: + tqt3brushstyle = TQt::CrossPattern; + break; + case Qt::BDiagPattern: + tqt3brushstyle = TQt::BDiagPattern; + break; + case Qt::FDiagPattern: + tqt3brushstyle = TQt::FDiagPattern; + break; + case Qt::DiagCrossPattern: + tqt3brushstyle = TQt::DiagCrossPattern; + break; + case Qt::TexturePattern: + tqt3brushstyle = TQt::CustomPattern; + break; + default: + tqt3brushstyle = TQt::NoBrush; +#if defined(QT_CHECK_RANGE) + tqWarning( "convertQt4ToTQt3Brush: Invalid brush style %d", tqt3brushstyle ); +#endif + } + tqt3brush.setStyle(tqt3brushstyle); + QColor qt4color = qt4brush.color(); + tqt3brush.setColor(TQColor(qt4color.red(), qt4color.green(), qt4color.blue())); + if (tqt3brushstyle == TQt::CustomPattern) { + QPixmap qt4texture = qt4brush.texture(); + TQPixmap tqtPM(qt4texture.width(), qt4texture.height(), qt4texture.depth()); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared); + QPainter qt4painter(&qtPM); + qt4painter.drawPixmap(0, 0, qt4texture); + qt4painter.end(); + tqt3brush.setPixmap(tqtPM); + } + + return tqt3brush; +} + +inline QPalette convertTQt3ToQt4Palette(TQPalette tqt3palette) +{ + int i; + QPalette qt4palette; + + // Color groups + TQPalette::ColorGroup tqt3cgroup; + QPalette::ColorGroup qt4cgroup; + TQColor tqt3color; + for (i=0;i<3;i++) { + if (i == 0) { + tqt3cgroup = TQPalette::Disabled; + qt4cgroup = QPalette::Disabled; + } + if (i == 1) { + tqt3cgroup = TQPalette::Active; + qt4cgroup = QPalette::Active; + } + if (i == 2) { + tqt3cgroup = TQPalette::Inactive; + qt4cgroup = QPalette::Inactive; + } + + // Brushes + qt4palette.setBrush(qt4cgroup, QPalette::Background, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Background))); + qt4palette.setBrush(qt4cgroup, QPalette::Foreground, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Foreground))); + qt4palette.setBrush(qt4cgroup, QPalette::Base, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Base))); + qt4palette.setBrush(qt4cgroup, QPalette::Text, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Text))); + qt4palette.setBrush(qt4cgroup, QPalette::Button, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Button))); + qt4palette.setBrush(qt4cgroup, QPalette::ButtonText, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::ButtonText))); + qt4palette.setBrush(qt4cgroup, QPalette::Light, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Light))); + qt4palette.setBrush(qt4cgroup, QPalette::Midlight, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Midlight))); + qt4palette.setBrush(qt4cgroup, QPalette::Dark, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Dark))); + qt4palette.setBrush(qt4cgroup, QPalette::Mid, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Mid))); + qt4palette.setBrush(qt4cgroup, QPalette::Shadow, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Shadow))); + qt4palette.setBrush(qt4cgroup, QPalette::Highlight, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Highlight))); + qt4palette.setBrush(qt4cgroup, QPalette::HighlightedText, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::HighlightedText))); + qt4palette.setBrush(qt4cgroup, QPalette::BrightText, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::BrightText))); + qt4palette.setBrush(qt4cgroup, QPalette::Link, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::Link))); + qt4palette.setBrush(qt4cgroup, QPalette::LinkVisited, convertTQt3ToQt4Brush(tqt3palette.brush(tqt3cgroup, TQColorGroup::LinkVisited))); + + // Colors + qt4palette.setColor(qt4cgroup, QPalette::Background, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Background))); + qt4palette.setColor(qt4cgroup, QPalette::Foreground, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Foreground))); + qt4palette.setColor(qt4cgroup, QPalette::Base, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Base))); + qt4palette.setColor(qt4cgroup, QPalette::Text, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Text))); + qt4palette.setColor(qt4cgroup, QPalette::Button, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Button))); + qt4palette.setColor(qt4cgroup, QPalette::ButtonText, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::ButtonText))); + qt4palette.setColor(qt4cgroup, QPalette::Light, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Light))); + qt4palette.setColor(qt4cgroup, QPalette::Midlight, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Midlight))); + qt4palette.setColor(qt4cgroup, QPalette::Dark, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Dark))); + qt4palette.setColor(qt4cgroup, QPalette::Mid, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Mid))); + qt4palette.setColor(qt4cgroup, QPalette::Shadow, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Shadow))); + qt4palette.setColor(qt4cgroup, QPalette::Highlight, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Highlight))); + qt4palette.setColor(qt4cgroup, QPalette::HighlightedText, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::HighlightedText))); + qt4palette.setColor(qt4cgroup, QPalette::BrightText, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::BrightText))); + qt4palette.setColor(qt4cgroup, QPalette::Link, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::Link))); + qt4palette.setColor(qt4cgroup, QPalette::LinkVisited, convertTQt3ToQt4Color(tqt3palette.color(tqt3cgroup, TQColorGroup::LinkVisited))); + } + + return qt4palette; +} + +inline TQPalette convertQt4ToTQt3Palette(QPalette qt4palette) +{ + int i; + TQPalette tqt3palette; + + // Color groups + TQPalette::ColorGroup tqt3cgroup; + QPalette::ColorGroup qt4cgroup; + TQColor tqt3color; + for (i=0;i<3;i++) { + if (i == 0) { + tqt3cgroup = TQPalette::Disabled; + qt4cgroup = QPalette::Disabled; + } + if (i == 1) { + tqt3cgroup = TQPalette::Active; + qt4cgroup = QPalette::Active; + } + if (i == 2) { + tqt3cgroup = TQPalette::Inactive; + qt4cgroup = QPalette::Inactive; + } + + // Brushes + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Background, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Background))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Foreground, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Foreground))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Base, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Base))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Text, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Text))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Button, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Button))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::ButtonText, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::ButtonText))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Light, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Light))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Midlight, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Midlight))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Dark, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Dark))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Mid, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Mid))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Shadow, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Shadow))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Highlight, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Highlight))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::HighlightedText, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::HighlightedText))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::BrightText, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::BrightText))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::Link, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::Link))); + tqt3palette.setBrush(tqt3cgroup, TQColorGroup::LinkVisited, convertQt4ToTQt3Brush(qt4palette.brush(qt4cgroup, QPalette::LinkVisited))); + + // Colors + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Background, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Background))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Foreground, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Foreground))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Base, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Base))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Text, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Text))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Button, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Button))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::ButtonText, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::ButtonText))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Light, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Light))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Midlight, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Midlight))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Dark, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Dark))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Mid, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Mid))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Shadow, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Shadow))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Highlight, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Highlight))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::HighlightedText, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::HighlightedText))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::BrightText, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::BrightText))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::Link, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::Link))); + tqt3palette.setColor(tqt3cgroup, TQColorGroup::LinkVisited, convertQt4ToTQt3Color(qt4palette.color(qt4cgroup, QPalette::LinkVisited))); + } + + return tqt3palette; +} + +inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3WidgetType wt) +{ + // Convert sflags + TQStyle::SFlags sflags = 0; + + if (qt4stateflags & QStyle::State_Active) { + if (wt != TQT3WT_TQPopupMenu) { + sflags = sflags | TQStyle::Style_Active; + } + } + if (qt4stateflags & QStyle::State_AutoRaise) { + sflags = sflags | TQStyle::Style_AutoRaise; + } +// if (qt4stateflags & QStyle::State_Children) { +// sflags = sflags | TQStyle::; +// } + if (qt4stateflags & QStyle::State_DownArrow) { + sflags = sflags | TQStyle::Style_Down; + } +// if (qt4stateflags & QStyle::State_Editing) { +// sflags = sflags | TQStyle::; +// } + if (qt4stateflags & QStyle::State_Enabled) { + sflags = sflags | TQStyle::Style_Enabled; + } +// if (qt4stateflags & QStyle::State_HasEditFocus) { +// sflags = sflags | TQStyle::Style_HasFocus; +// } + if (qt4stateflags & QStyle::State_HasFocus) { + sflags = sflags | TQStyle::Style_HasFocus; + } + if (qt4stateflags & QStyle::State_Horizontal) { + sflags = sflags | TQStyle::Style_Horizontal; + } +// if (qt4stateflags & QStyle::State_KeyboardFocusChange) { +// sflags = sflags | TQStyle::; +// } + if (qt4stateflags & QStyle::State_MouseOver) { + sflags = sflags | TQStyle::Style_MouseOver; + } + if (qt4stateflags & QStyle::State_NoChange) { + sflags = sflags | TQStyle::Style_NoChange; + } + if (qt4stateflags & QStyle::State_Off) { + sflags = sflags | TQStyle::Style_Off; + } + if (qt4stateflags & QStyle::State_On) { + sflags = sflags | TQStyle::Style_On; + } + if (qt4stateflags & QStyle::State_Raised) { + sflags = sflags | TQStyle::Style_Raised; + } +// if (qt4stateflags & QStyle::State_ReadOnly) { +// sflags = sflags | TQStyle::; +// } + if (qt4stateflags & QStyle::State_Selected) { + if (wt == TQT3WT_TQPopupMenu) { + sflags = sflags | TQStyle::Style_Active; + } + sflags = sflags | TQStyle::Style_Selected; + } +// if (qt4stateflags & QStyle::State_Item) { +// sflags = sflags | TQStyle::; +// } +// if (qt4stateflags & QStyle::State_Open) { +// sflags = sflags | TQStyle::; +// } +// if (qt4stateflags & QStyle::State_Sibling) { +// sflags = sflags | TQStyle::; +// } + if (qt4stateflags & QStyle::State_Sunken) { + sflags = sflags | TQStyle::Style_Sunken; + } + if (qt4stateflags & QStyle::State_UpArrow) { + sflags = sflags | TQStyle::Style_Up; + } +// if (qt4stateflags & QStyle::State_Mini) { +// sflags = sflags | TQStyle::; +// } +// if (qt4stateflags & QStyle::State_Small) { +// sflags = sflags | TQStyle::; +// } + + return sflags; +} + +SimpleStyle::SimpleStyle() +{ +#ifdef INTEGRATE_WITH_TDE + if (!tqApp) { + // Initialize KApplication required data structures + int argc = 1; + char** argv; + // Supply it with fake data to keep KApplication happy + argv = (char**) malloc(sizeof(char*)); + argv[0] = (char*) malloc(sizeof(char) * 19); + strncpy(argv[0], "SimpleStyle", 19); + + KAboutData aboutData("SimpleStyle", I18N_NOOP("SimpleStyle"), "v0.1", + "TDE Qt4 theme engine", KAboutData::License_GPL, + "(c) 2012, Timothy Pearson", + "message goes here", 0 /* TODO: Website */, "kb9vqf@pearsoncomputing.net"); + KCmdLineArgs::init(argc, argv, &aboutData); + + // Qt4 can be SO STUPID sometimes...why can't I get the X11 display directly from qApp?!?!?? + QWidget myhackedwidget; + new KApplication(myhackedwidget.x11Info().display()); + } + + // Set the Qt4 icon set to the TDE icon set + QIcon::setThemeName(convertTQt3ToQt4String(KIconTheme::current())); +#else // INTEGRATE_WITH_TDE + if (!tqApp) { + // Qt4 can be SO STUPID sometimes...why can't I get the X11 display directly from qApp?!?!?? + QWidget myhackedwidget; + new TQApplication(myhackedwidget.x11Info().display()); + } +#endif // INTEGRATE_WITH_TDE + + // Set the Qt4 palette to the TQt3 palette + qApp->setPalette(convertTQt3ToQt4Palette(tqApp->palette())); + + // Create interface widgets + m_tqt3parent_widget = new TQWidget(); + + m_tqt3progressbar_widget = new TQProgressBar(m_tqt3parent_widget); + m_tqt3tabbar_widget = new TQTabBar(m_tqt3parent_widget); + m_tqt3radiobutton_widget = new TQRadioButton(m_tqt3parent_widget); + m_tqt3popupmenu_widget = new TQPopupMenu(m_tqt3parent_widget); + m_tqt3combobox_widget = new TQComboBox(m_tqt3parent_widget); +} + +SimpleStyle::~SimpleStyle() +{ +// delete tqApp; + + // Delete interface widgets + // Widgets are deleted when their parent is deleted...these lines will cause a crash on exit +// delete m_tqt3progressbar_widget; +// delete m_tqt3tabbar_widget; +// delete m_tqt3radiobutton_widget; +// delete m_tqt3popupmenu_widget; +// delete m_tqt3combobox_widget; + + // FIXME + // Verify I'm not leaking memory like a sieve when this is commented out!!! +// delete m_tqt3parent_widget; +} + +void SimpleStyle::polish(QPalette &palette) +{ + // FIXME + // Figure out some way to polish the Qt4 widgets with the Qt3 polish method + // This probably involves modifying Qt3 to specify a painter... +} + +void SimpleStyle::polish(QWidget *widget) +{ + // HACK + // Many TQt3 styles need to be notified when their widgets are moused over + // The only way we can really do that here is to force a repaint on mouse entry/mouse exit + // I figure if Qt4 programmers and users can put up with Qt4's overall poor raster graphics + // performance, they can also put up with this hack... + widget->setMouseTracking(true); + widget->installEventFilter(this); +} + +void SimpleStyle::unpolish(QWidget *widget) +{ + // HACK + // See SimpleStyle::polish + widget->setMouseTracking(false); + widget->removeEventFilter(this); +} + +bool SimpleStyle::eventFilter(QObject *obj, QEvent *ev) +{ + // HACK + // See SimpleStyle::polish + if (!obj->isWidgetType() ) { + return false; + } + + QWidget* widget = static_cast(obj); + + if ((ev->type() == QEvent::FocusIn) || (ev->type() == QEvent::FocusOut) + || (ev->type() == QEvent::Enter) || (ev->type() == QEvent::Leave) || (ev->type() == QEvent::Wheel)) { + widget->repaint(); + } + else { +// if (dynamic_cast(obj)) { + if (ev->type() == QEvent::MouseMove) { + QTabBar *tabbar = dynamic_cast(obj); + QMouseEvent *me = dynamic_cast(ev); + if (tabbar && me) { + // FIXME + // Avoid unnecessary repaints (which otherwise would occour on every + // MouseMove event causing high cpu load). + // FIXME + // Tab highlighting won't work unless we keep the same tabbar object, + // and specifically tab objects, while the mouse is being moved within + // the tabbar...also the eventFilter method of the style needs to be called... + + bool repaint = true; + +// QTab *tab = tabbar->selectTab(me->pos() ); +// if (hoverTab == tab) +// repaint = false; +// hoverTab = tab; + + if (repaint) + tabbar->repaint(); + } + } +// } + } + + // Transparently pass the event on to any other handlers + return false; +} + +int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *w ) const +{ + int retval = 0; + TQWidget* interfaceWidget = 0; + + char retswitch = 0; + TQStyle::PixelMetric tqt3pixelmetric = TQStyle::PM_CustomBase; + switch (metric) { + case QStyle::PM_ButtonMargin: + tqt3pixelmetric = TQStyle::PM_ButtonMargin; + retswitch = 1; + break; +// case QStyle::PM_DockWidgetTitleBarButtonMargin: +// tqt3pixelmetric = TQStyle::; +// retswitch = 1; +// break; + case QStyle::PM_ButtonDefaultIndicator: + tqt3pixelmetric = TQStyle::PM_ButtonDefaultIndicator; + retswitch = 1; + break; + case QStyle::PM_MenuButtonIndicator: + tqt3pixelmetric = TQStyle::PM_MenuButtonIndicator; + retswitch = 1; + break; + case QStyle::PM_ButtonShiftHorizontal: + tqt3pixelmetric = TQStyle::PM_ButtonShiftHorizontal; + retswitch = 1; + break; + case QStyle::PM_ButtonShiftVertical: + tqt3pixelmetric = TQStyle::PM_ButtonShiftVertical; + retswitch = 1; + break; + case QStyle::PM_DefaultFrameWidth: + tqt3pixelmetric = TQStyle::PM_DefaultFrameWidth; + retswitch = 1; + break; + case QStyle::PM_SpinBoxFrameWidth: + tqt3pixelmetric = TQStyle::PM_SpinBoxFrameWidth; + retswitch = 1; + break; +// case QStyle::PM_ComboBoxFrameWidth: +// tqt3pixelmetric = TQStyle::PM_ComboBoxFrameWidth; +// retswitch = 1; +// break; + case QStyle::PM_MDIFrameWidth: + tqt3pixelmetric = TQStyle::PM_MDIFrameWidth; + retswitch = 1; + break; +// case QStyle::PM_MdiSubWindowFrameWidth: +// tqt3pixelmetric = TQStyle::PM_MdiSubWindowFrameWidth; +// retswitch = 1; +// break; + case QStyle::PM_MDIMinimizedWidth: + tqt3pixelmetric = TQStyle::PM_MDIMinimizedWidth; + retswitch = 1; + break; +// case QStyle::PM_MdiSubWindowMinimizedWidth: +// tqt3pixelmetric = TQStyle::PM_MdiSubWindowMinimizedWidth; +// retswitch = 1; +// break; + case QStyle::PM_LayoutLeftMargin: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_LayoutTopMargin: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_LayoutRightMargin: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_LayoutBottomMargin: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_LayoutHorizontalSpacing: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_LayoutVerticalSpacing: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_MaximumDragDistance: + tqt3pixelmetric = TQStyle::PM_MaximumDragDistance; + retswitch = 1; + break; + case QStyle::PM_ScrollBarExtent: + tqt3pixelmetric = TQStyle::PM_ScrollBarExtent; + retswitch = 1; + break; + case QStyle::PM_ScrollBarSliderMin: + tqt3pixelmetric = TQStyle::PM_ScrollBarSliderMin; + retswitch = 1; + break; + case QStyle::PM_SliderThickness: + tqt3pixelmetric = TQStyle::PM_SliderThickness; + retswitch = 1; + break; + case QStyle::PM_SliderControlThickness: + tqt3pixelmetric = TQStyle::PM_SliderControlThickness; + retswitch = 1; + break; + case QStyle::PM_SliderLength: + tqt3pixelmetric = TQStyle::PM_SliderLength; + retswitch = 1; + break; + case QStyle::PM_SliderTickmarkOffset: + tqt3pixelmetric = TQStyle::PM_SliderTickmarkOffset; + retswitch = 1; + break; + case QStyle::PM_SliderSpaceAvailable: + tqt3pixelmetric = TQStyle::PM_SliderSpaceAvailable; + retswitch = 1; + break; + case QStyle::PM_DockWidgetSeparatorExtent: + tqt3pixelmetric = TQStyle::PM_DockWindowSeparatorExtent; + retswitch = 1; + break; + case QStyle::PM_DockWidgetHandleExtent: + tqt3pixelmetric = TQStyle::PM_DockWindowHandleExtent; + retswitch = 1; + break; + case QStyle::PM_DockWidgetFrameWidth: + tqt3pixelmetric = TQStyle::PM_DockWindowFrameWidth; + retswitch = 1; + break; +// case QStyle::PM_DockWidgetTitleMargin: +// tqt3pixelmetric = TQStyle::PM_DockWindowTitleMargin; +// retswitch = 1; +// break; + case QStyle::PM_MenuBarPanelWidth: + tqt3pixelmetric = TQStyle::PM_MenuBarFrameWidth; + retswitch = 1; + break; + case QStyle::PM_MenuBarItemSpacing: + tqt3pixelmetric = TQStyle::PM_MenuBarItemSpacing; + retswitch = 1; + break; +// case QStyle::PM_MenuBarHMargin: +// tqt3pixelmetric = TQStyle::PM_MenuBarHMargin; +// retswitch = 1; +// break; +// case QStyle::PM_MenuBarVMargin: +// tqt3pixelmetric = TQStyle::PM_MenuBarVMargin; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarFrameWidth: +// tqt3pixelmetric = TQStyle::PM_ToolBarFrameWidth; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarHandleExtent: +// tqt3pixelmetric = TQStyle::PM_ToolBarHandleExtent; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarItemMargin: +// tqt3pixelmetric = TQStyle::PM_ToolBarItemMargin; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarItemSpacing: +// tqt3pixelmetric = TQStyle::PM_ToolBarItemSpacing; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarSeparatorExtent: +// tqt3pixelmetric = TQStyle::PM_ToolBarSeparatorExtent; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarExtensionExtent: +// tqt3pixelmetric = TQStyle::PM_ToolBarExtensionExtent; +// retswitch = 1; +// break; + case QStyle::PM_TabBarTabOverlap: + tqt3pixelmetric = TQStyle::PM_TabBarTabOverlap; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarTabHSpace: + tqt3pixelmetric = TQStyle::PM_TabBarTabHSpace; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarTabVSpace: + tqt3pixelmetric = TQStyle::PM_TabBarTabVSpace; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarBaseHeight: + tqt3pixelmetric = TQStyle::PM_TabBarBaseHeight; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarBaseOverlap: + tqt3pixelmetric = TQStyle::PM_TabBarBaseOverlap; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarScrollButtonWidth: + tqt3pixelmetric = TQStyle::PM_TabBarScrollButtonWidth; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarTabShiftHorizontal: + tqt3pixelmetric = TQStyle::PM_TabBarTabShiftHorizontal; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_TabBarTabShiftVertical: + tqt3pixelmetric = TQStyle::PM_TabBarTabShiftVertical; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + retswitch = 1; + break; + case QStyle::PM_ProgressBarChunkWidth: + tqt3pixelmetric = TQStyle::PM_ProgressBarChunkWidth; + retswitch = 1; + break; + case QStyle::PM_SplitterWidth: + tqt3pixelmetric = TQStyle::PM_SplitterWidth; + retswitch = 1; + break; + case QStyle::PM_TitleBarHeight: + tqt3pixelmetric = TQStyle::PM_TitleBarHeight; + retswitch = 1; + break; + case QStyle::PM_IndicatorWidth: + tqt3pixelmetric = TQStyle::PM_IndicatorWidth; + retswitch = 1; + break; + case QStyle::PM_IndicatorHeight: + tqt3pixelmetric = TQStyle::PM_IndicatorHeight; + retswitch = 1; + break; + case QStyle::PM_ExclusiveIndicatorWidth: + tqt3pixelmetric = TQStyle::PM_ExclusiveIndicatorWidth; + retswitch = 1; + break; + case QStyle::PM_ExclusiveIndicatorHeight: + tqt3pixelmetric = TQStyle::PM_ExclusiveIndicatorHeight; + retswitch = 1; + break; +// case QStyle::PM_MenuPanelWidth: +// retval = 0; +// retswitch = 2; +// break; + case QStyle::PM_MenuHMargin: + retval = 0; + retswitch = 2; + break; + case QStyle::PM_MenuVMargin: + retval = 0; + retswitch = 2; + break; +// case QStyle::PM_MenuScrollerHeight: +// tqt3pixelmetric = TQStyle::PM_MenuScrollerHeight; +// retswitch = 1; +// break; +// case QStyle::PM_MenuTearoffHeight: +// tqt3pixelmetric = TQStyle::PM_MenuTearoffHeight; +// retswitch = 1; +// break; +// case QStyle::PM_MenuDesktopFrameWidth: +// tqt3pixelmetric = TQStyle::PM_MenuDesktopFrameWidth; +// retswitch = 1; +// break; + case QStyle::PM_CheckListButtonSize: + tqt3pixelmetric = TQStyle::PM_CheckListButtonSize; + retswitch = 1; + break; + case QStyle::PM_CheckListControllerSize: + tqt3pixelmetric = TQStyle::PM_CheckListControllerSize; + retswitch = 1; + break; + case QStyle::PM_HeaderMarkSize: + tqt3pixelmetric = TQStyle::PM_HeaderMarkSize; + retswitch = 1; + break; + case QStyle::PM_HeaderGripMargin: + tqt3pixelmetric = TQStyle::PM_HeaderGripMargin; + retswitch = 1; + break; + case QStyle::PM_HeaderMargin: + tqt3pixelmetric = TQStyle::PM_HeaderMargin; + retswitch = 1; + break; +// case QStyle::PM_SpinBoxSliderHeight: +// tqt3pixelmetric = TQStyle::PM_SpinBoxSliderHeight; +// retswitch = 1; +// break; +// case QStyle::PM_ToolBarIconSize: +// tqt3pixelmetric = TQStyle::PM_ToolBarIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_SmallIconSize: +// tqt3pixelmetric = TQStyle::PM_SmallIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_LargeIconSize: +// tqt3pixelmetric = TQStyle::PM_LargeIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_FocusFrameHMargin: +// tqt3pixelmetric = TQStyle::PM_FocusFrameHMargin; +// retswitch = 1; +// break; +// case QStyle::PM_FocusFrameVMargin: +// tqt3pixelmetric = TQStyle::PM_FocusFrameVMargin; +// retswitch = 1; +// break; +// case QStyle::PM_IconViewIconSize: +// tqt3pixelmetric = TQStyle::PM_IconViewIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_ListViewIconSize: +// tqt3pixelmetric = TQStyle::PM_ListViewIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_ToolTipLabelFrameWidth: +// tqt3pixelmetric = TQStyle::PM_ToolTipLabelFrameWidth; +// retswitch = 1; +// break; +// case QStyle::PM_CheckBoxLabelSpacing: +// tqt3pixelmetric = TQStyle::PM_CheckBoxLabelSpacing; +// retswitch = 1; +// break; +// case QStyle::PM_RadioButtonLabelSpacing: +// tqt3pixelmetric = TQStyle::PM_RadioButtonLabelSpacing; +// retswitch = 1; +// break; +// case QStyle::PM_TabBarIconSize: +// tqt3pixelmetric = TQStyle::PM_TabBarIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_SizeGripSize: +// tqt3pixelmetric = TQStyle::PM_SizeGripSize; +// retswitch = 1; +// break; +// case QStyle::PM_MessageBoxIconSize: +// tqt3pixelmetric = TQStyle::PM_MessageBoxIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_ButtonIconSize: +// tqt3pixelmetric = TQStyle::PM_ButtonIconSize; +// retswitch = 1; +// break; +// case QStyle::PM_TextCursorWidth: +// tqt3pixelmetric = TQStyle::PM_TextCursorWidth; +// retswitch = 1; +// break; +// case QStyle::PM_TabBar_ScrollButtonOverlap: +// tqt3pixelmetric = TQStyle::PM_TabBar_ScrollButtonOverlap; +// retswitch = 1; +// break; +// case QStyle::PM_TabCloseIndicatorWidth: +// tqt3pixelmetric = TQStyle::PM_TabCloseIndicatorWidth; +// retswitch = 1; +// break; +// case QStyle::PM_TabCloseIndicatorHeight: +// tqt3pixelmetric = TQStyle::PM_TabCloseIndicatorHeight; +// retswitch = 1; +// break; + default: +#ifdef DEBUG_WARNINGS + printf("No metrics for Qt4 element %d\n\r", metric); fflush(stdout); +#endif + retval = 0; + } + + if (retswitch == 1) { + retval = tqApp->style().pixelMetric(tqt3pixelmetric, interfaceWidget); + } + else { +// if (retswitch == 2) { +// // retval was already set +// } +// else { + // Tell Qt4 to get the information + retval = QCommonStyle::pixelMetric(metric, opt, w); +// } + } + + return retval; +} + +TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidget* w) const +{ + int i; + TQWidget* interfaceWidget = 0; + + // Qt4 interface widget pointers + const QTabBar* qt4tabbar_widget = 0; + const QRadioButton* qt4radiobutton_widget = 0; + const QMenu* qt4menu_widget = 0; + const QProgressBar* qt4progressbar_widget = 0; + const QComboBox* qt4combobox_widget = 0; + + TQTabBar::Shape tqt3tbshape = TQTabBar::RoundedAbove; + + switch (wt) { + case TQT3WT_TQProgressBar: + interfaceWidget = m_tqt3progressbar_widget; + // Copy over all widget attributes + qt4progressbar_widget = static_cast(w); + m_tqt3progressbar_widget->setGeometry(0, 0, qt4progressbar_widget->width(), qt4progressbar_widget->height()); + m_tqt3progressbar_widget->setProgress(qt4progressbar_widget->value()-qt4progressbar_widget->minimum(),qt4progressbar_widget->maximum()-qt4progressbar_widget->minimum()); + if (qt4progressbar_widget->orientation() != Qt::Horizontal) { + // Qt3 cannot draw vertical progress bars +#ifdef DEBUG_WARNINGS + printf("No rules to draw vertical Qt4 progress bar\n\r"); fflush(stdout); + interfaceWidget = 0; +#endif + } + break; + case TQT3WT_TQTabBar: + interfaceWidget = m_tqt3tabbar_widget; + // Copy over all widget attributes + qt4tabbar_widget = static_cast(w); + m_tqt3tabbar_widget->setGeometry(0, 0, qt4tabbar_widget->width(), qt4tabbar_widget->height()); + // Clear out tabbar + for (i=0;icount();i++) { + m_tqt3tabbar_widget->removeTab(m_tqt3tabbar_widget->tabAt(i)); + } + // Copy over all tabs + for (i=0;icount();i++) { + if (qt4tabbar_widget->tabIcon(i).isNull()) { + TQTab* newTab = new TQTab(convertQt4ToTQt3String(qt4tabbar_widget->tabText(i))); + m_tqt3tabbar_widget->insertTab(newTab, i); + newTab->setIdentifier(i); + } + else { + TQTab* newTab = new TQTab(convertQt4ToTQt3IconSet(qt4tabbar_widget->tabIcon(i)), convertQt4ToTQt3String(qt4tabbar_widget->tabText(i))); + m_tqt3tabbar_widget->insertTab(newTab, i); + newTab->setIdentifier(i); + } + } + m_tqt3tabbar_widget->setCurrentTab(qt4tabbar_widget->currentIndex()); + switch (qt4tabbar_widget->shape()) { + case QTabBar::RoundedNorth: + tqt3tbshape = TQTabBar::RoundedAbove; + break; + case QTabBar::RoundedSouth: + tqt3tbshape = TQTabBar::RoundedBelow; + break; + case QTabBar::TriangularNorth: + tqt3tbshape = TQTabBar::TriangularAbove; + break; + case QTabBar::TriangularSouth: + tqt3tbshape = TQTabBar::TriangularBelow; + break; + default: + // Qt3 cannot draw other tab shapes +#ifdef DEBUG_WARNINGS + printf("No rules to draw Qt4 tab shape %d\n\r", qt4tabbar_widget->shape()); fflush(stdout); + interfaceWidget = 0; +#endif + } + m_tqt3tabbar_widget->setShape(tqt3tbshape); + break; + case TQT3WT_TQRadioButton: + interfaceWidget = m_tqt3radiobutton_widget; + // Copy over all widget attributes + qt4radiobutton_widget = static_cast(w); + m_tqt3radiobutton_widget->setGeometry(0, 0, qt4radiobutton_widget->width(), qt4radiobutton_widget->height()); + m_tqt3radiobutton_widget->setText(convertQt4ToTQt3String(qt4radiobutton_widget->text())); + m_tqt3radiobutton_widget->setDown(qt4radiobutton_widget->isDown()); + break; + case TQT3WT_TQComboBox: + interfaceWidget = m_tqt3combobox_widget; + // Copy over all widget attributes + qt4combobox_widget = static_cast(w); + m_tqt3combobox_widget->setGeometry(0, 0, qt4combobox_widget->width(), qt4combobox_widget->height()); + // Clear out all combobox items + m_tqt3combobox_widget->clear(); + + for (i=0;icount();i++) { + if (qt4combobox_widget->itemIcon(i).isNull()) { + m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); + } + else { + m_tqt3combobox_widget->insertItem(convertQt4ToTQt3Pixmap(qt4combobox_widget->itemIcon(i)), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); + } + } + m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable()); + break; + case TQT3WT_TQPopupMenu: + interfaceWidget = m_tqt3popupmenu_widget; + // Copy over all widget attributes + qt4menu_widget = static_cast(w); + m_tqt3popupmenu_widget->setGeometry(0, 0, qt4menu_widget->width(), qt4menu_widget->height()); + // Clear out menu + m_tqt3popupmenu_widget->clear(); + m_tqt3popupmenu_widget->setCheckable(false); + // Copy over all menu items + QList qt4menuactions = qt4menu_widget->actions(); + QAction* currentAction = 0; + for (i=0; iisSeparator()) { + m_tqt3popupmenu_widget->insertSeparator(i); + } + else { + if (currentAction->icon().isNull()) { + m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i); + } + else { + m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon()), convertQt4ToTQt3String(currentAction->text()), i, i); + } + // FIXME + // Handle pixmaps, etc. + } + m_tqt3popupmenu_widget->setItemEnabled(i, currentAction->isEnabled()); + m_tqt3popupmenu_widget->setItemChecked(i, currentAction->isChecked()); + m_tqt3popupmenu_widget->setItemVisible(i, currentAction->isVisible()); + if (currentAction->isCheckable()) { + m_tqt3popupmenu_widget->setCheckable(true); + } + } + } + break; + } + + return interfaceWidget; +} + +QRect SimpleStyle::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *w) const +{ + TQStyle::SFlags sflags = 0; + + bool can_override = true; + TQStyle::SubRect tqtSR; + + TQWidget* interfaceWidget = 0; + QRect retRect; + + switch (element) { + case SE_ComboBoxFocusRect: + tqtSR = TQStyle::SR_ComboBoxFocusRect; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQComboBox, w); + if (interfaceWidget == 0) { + can_override = false; + } + break; + default: +#ifdef DEBUG_WARNINGS + printf("No rules to obtain Qt4 subelement rect %d\n\r", element); fflush(stdout); +#endif + can_override = false; + } + + if (can_override) { + // Instruct TQt3 to obtain the subelement rect information + retRect = convertTQt3ToQt4Rect(tqApp->style().subRect(tqtSR, interfaceWidget)); + +#ifdef DEBUG_WARNINGS +#ifdef DEBUG_SPEW + printf("Used Qt3 subelement rect %d to handle Qt4 subelement rect %d\n\r", tqtSR, control); fflush(stdout); +#endif +#endif + } + else { + // Tell Qt4 to obtain the subelement rect information + retRect = QCommonStyle::subElementRect(element, opt, w); + } + + return retRect; +} + +void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w) const +{ + TQStyle::SFlags sflags = 0; + + bool can_override = true; + TQStyle::ComplexControl tqtCC; + TQStyle::SCFlags subControl = TQStyle::SC_All; + TQStyle::SCFlags subControlActive = TQStyle::SC_None; + + TQWidget* interfaceWidget = 0; + TQStyleOption tqt3opt(TQStyleOption::Default); + + // Determine the correct color group + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_NONE); + TQPalette tqt3palette = convertQt4ToTQt3Palette(opt->palette); + TQColorGroup tqt3colorgroup; + if (sflags & TQStyle::Style_Enabled) { + if (sflags & TQStyle::Style_Active) { + tqt3colorgroup = tqt3palette.active(); + } + else { + tqt3colorgroup = tqt3palette.inactive(); + } + } + else { + tqt3colorgroup = tqt3palette.disabled(); + } + + switch (control) { + case CC_ComboBox: + tqtCC = TQStyle::CC_ComboBox; + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQComboBox, w); + if (interfaceWidget == 0) { + can_override = false; + } + break; + default: +#ifdef DEBUG_WARNINGS + printf("No rules to draw Qt4 complex control %d\n\r", control); fflush(stdout); +#endif + can_override = false; + } + + if (can_override) { + // Construct a Qt3 paint device on the Qt4 painter + TDEQt4PaintDevice qt4pd(p); + + TQPainter tqtPainter(&qt4pd); + + // Instruct TQt3 to draw the complex control + tqApp->style().drawComplexControl(tqtCC, &tqtPainter, interfaceWidget, TQRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height()), tqt3colorgroup, sflags, subControl, subControlActive, tqt3opt); + + tqtPainter.end(); + +#ifdef DEBUG_WARNINGS +#ifdef DEBUG_SPEW + printf("Used Qt3 complex control %d to draw Qt4 complex control %d\n\r", tqtCE, control); fflush(stdout); +#endif +#endif + } + else { + // Tell Qt4 to draw it + QCommonStyle::drawComplexControl(control, opt, p, w); + } +} + +void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const +{ + int i; + TQStyle::SFlags sflags = 0; + + bool can_override = true; + TQStyle::ControlElement tqtCE; + + bool draw_second_element = false; + TQStyle::ControlElement tqtCE_element2; + + bool draw_third_element = false; + TQStyle::ControlElement tqtCE_element3; + + TQWidget* interfaceWidget = 0; + TQStyleOption tqt3opt(TQStyleOption::Default); + TQStyleOption tqt3opt_element2(TQStyleOption::Default); + TQStyleOption tqt3opt_element3(TQStyleOption::Default); + + TQTab* drawingTab = 0; + int estimated_tab_index; + + TQMenuItem* drawingItem = 0; + QAction* drawingAction = 0; + QList qt4menuactions; + int tqt3tabwidth = 0; + int tqt3iconwidth = 0; + + TQRect tqt3elementrect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height()); + TQRect tqt3element2rect = tqt3elementrect; + TQRect tqt3element3rect = tqt3elementrect; + + // Determine the correct color group + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_NONE); + TQPalette tqt3palette = convertQt4ToTQt3Palette(opt->palette); + TQColorGroup tqt3colorgroup; + if (sflags & TQStyle::Style_Enabled) { + if (sflags & TQStyle::Style_Active) { + tqt3colorgroup = tqt3palette.active(); + } + else { + tqt3colorgroup = tqt3palette.inactive(); + } + } + else { + tqt3colorgroup = tqt3palette.disabled(); + } + + switch (element) { + case QStyle::CE_ProgressBar: + // Unlike Qt3, QStyle::CE_ProgressBar draws the bar, the groove, and the label + tqtCE = TQStyle::CE_ProgressBarContents; + draw_second_element = true; + tqtCE_element2 = TQStyle::CE_ProgressBarGroove; + draw_third_element = true; + tqtCE_element3 = TQStyle::CE_ProgressBarLabel; + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar); + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w); + if (interfaceWidget == 0) { + can_override = false; + } + break; + case QStyle::CE_ProgressBarContents: + tqtCE = TQStyle::CE_ProgressBarContents; + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar); + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w); + if (interfaceWidget == 0) { + can_override = false; + } + break; + case QStyle::CE_TabBarTab: + // Unlike Qt3, QStyle::CE_TabBarTab draws both the tab and the label + tqtCE = TQStyle::CE_TabBarTab; + draw_second_element = true; + tqtCE_element2 = TQStyle::CE_TabBarLabel; + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQTabBar); + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); + if (interfaceWidget == 0) { + can_override = false; + } + else { + // Convert the QStyleOption to the proper TQStyleOption + // In other words, figure out which TQt3 tab is currently being drawn + // Qt4 makes this really, really hard... + // I have to guess based on the Qt4 position of the tab in the tab bar, which may or may not work 100% in all cases + drawingTab = 0; + estimated_tab_index = static_cast(w)->tabAt(QPoint(opt->rect.x(), opt->rect.y())); + drawingTab = m_tqt3tabbar_widget->tabAt(estimated_tab_index); + + if (drawingTab) { + tqt3opt = TQStyleOption(drawingTab); + tqt3opt_element2 = TQStyleOption(drawingTab); + } + + // HACK + // Qt4 is BUSTED YET AGAIN + // Grrrrr.... + // The PM_TabBarTabOverlap enum is present, BUT IS NOT IMPLEMENTED, in Qt4 (!??!?) + // Many TDE styles use overlapping tabs, and expect to draw outside their horizontal boundaries by PM_TabBarTabOverlap pixels + // At the very least we need to expand the drawing rect by that amount, even if the drawing gets clipped, otherwise + // those styles will show badly broken tabs with missing chunks and added lines. + tqt3tabwidth = tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap, interfaceWidget); + if (tqt3tabwidth > 0) { + tqt3elementrect = TQRect(tqt3elementrect.x()-tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()+(tqt3tabwidth*1), tqt3elementrect.height()); + } + } + break; +#if 0 + case CE_RadioButton: + // Unlike Qt3, QStyle::CE_RadioButton draws the button, the label, and the focus rectangle + tqtCE = TQStyle::CE_RadioButton; + draw_second_element = true; + tqtCE_element2 = TQStyle::CE_RadioButtonLabel; + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQRadioButton); + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQRadioButton, w); + if (interfaceWidget == 0) { + can_override = false; + } + break; +#endif + case CE_MenuItem: + tqtCE = TQStyle::CE_PopupMenuItem; + sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQPopupMenu); + interfaceWidget = initializeInterfaceWidget(TQT3WT_TQPopupMenu, w); + if (interfaceWidget == 0) { + can_override = false; + } + else { + // Convert the QStyleOption to the proper TQStyleOption + // In other words, figure out which TQt3 menu item is currently being drawn + // Qt4 makes this really, really hard... + // I have to guess based on the Qt4 position of the item in the menu, which may or may not work 100% in all cases + drawingItem = 0; + drawingAction = static_cast(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y())); + qt4menuactions = static_cast(w)->actions(); + for (i=0; ifindItem(m_tqt3popupmenu_widget->idAt(i)); + } + } + + if (drawingItem) { + tqt3tabwidth = static_cast(opt)->tabWidth; + tqt3iconwidth = static_cast(opt)->maxIconWidth; + tqt3opt = TQStyleOption(drawingItem, tqt3iconwidth, tqt3tabwidth); + } + } + break; + case QStyle::CE_TabBarTabShape: + // Ignore request as Qt3 has no equivalent + can_override = false; + break; + default: +#ifdef DEBUG_WARNINGS + printf("No rules to draw Qt4 control %d\n\r", element); fflush(stdout); +#endif + can_override = false; + } + + if (can_override) { + // Construct a Qt3 paint device on the Qt4 painter + TDEQt4PaintDevice qt4pd(p); + + TQPainter tqtPainter(&qt4pd); + + // Instruct TQt3 to draw the control + // FIXME + // Implement sflags and QStyleOption + tqApp->style().drawControl(tqtCE, &tqtPainter, interfaceWidget, tqt3elementrect, tqt3colorgroup, sflags, tqt3opt); + if (draw_second_element == true) { + tqApp->style().drawControl(tqtCE_element2, &tqtPainter, interfaceWidget, tqt3element2rect, tqt3colorgroup, sflags, tqt3opt_element2); + } + if (draw_third_element == true) { + tqApp->style().drawControl(tqtCE_element3, &tqtPainter, interfaceWidget, tqt3element3rect, tqt3colorgroup, sflags, tqt3opt_element3); + } + + tqtPainter.end(); + +#ifdef DEBUG_WARNINGS +#ifdef DEBUG_SPEW + printf("Used Qt3 control %d to draw Qt4 control %d\n\r", tqtCE, element); fflush(stdout); +#endif +#endif + } + else { + // Tell Qt4 to draw it + QCommonStyle::drawControl(element, opt, p, w); + } +} + +#define NO_QT3_EQUIVALENT can_override = false; + +void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const +{ + // Construct a Qt3 paint device translator on the Qt4 painter + TDEQt4PaintDevice qt4pd(p); + + // Open a painter on the paint device translator + TQPainter tqtPainter(&qt4pd); + + bool can_override = true; + TQStyle::PrimitiveElement tqtPE; + TQStyleOption tqt3opt(TQStyleOption::Default); + + // NOTE: Qt3 seems to combine PE_FrameMenu and PE_PanelMenu into PE_PanelPopup + + switch (pe) { + case QStyle::PE_Frame: + tqtPE = TQStyle::PE_Panel; + tqt3opt = TQStyleOption(static_cast(opt)->lineWidth, static_cast(opt)->midLineWidth); + break; + case QStyle::PE_FrameMenu: + tqtPE = TQStyle::PE_PanelPopup; + tqt3opt = TQStyleOption(static_cast(opt)->lineWidth, static_cast(opt)->midLineWidth); + break; + case QStyle::PE_PanelButtonBevel: + tqtPE = TQStyle::PE_ButtonBevel; + break; + case QStyle::PE_FrameGroupBox: + tqtPE = TQStyle::PE_GroupBoxFrame; + tqt3opt = TQStyleOption(static_cast(opt)->lineWidth, static_cast(opt)->midLineWidth); + break; + case QStyle::PE_FrameFocusRect: + tqtPE = TQStyle::PE_FocusRect; + break; + case QStyle::PE_FrameButtonTool: + tqtPE = TQStyle::PE_ButtonTool; + break; + case QStyle::PE_FrameTabBarBase: + NO_QT3_EQUIVALENT + break; + case QStyle::PE_FrameTabWidget: + tqtPE = TQStyle::PE_PanelTabWidget; + break; + case QStyle::PE_PanelButtonCommand: + tqtPE = TQStyle::PE_ButtonCommand; + break; + case QStyle::PE_IndicatorProgressChunk: + tqtPE = TQStyle::PE_ProgressBarChunk; + break; + case QStyle::PE_IndicatorArrowDown: + tqtPE = TQStyle::PE_ArrowDown; + break; + case QStyle::PE_IndicatorArrowLeft: + tqtPE = TQStyle::PE_ArrowLeft; + break; + case QStyle::PE_IndicatorArrowRight: + tqtPE = TQStyle::PE_ArrowRight; + break; + case QStyle::PE_IndicatorArrowUp: + tqtPE = TQStyle::PE_ArrowUp; + break; + case QStyle::PE_IndicatorCheckBox: + tqtPE = TQStyle::PE_Indicator; + break; + case QStyle::PE_IndicatorRadioButton: + tqtPE = TQStyle::PE_ExclusiveIndicator; + break; + case QStyle::PE_PanelMenu: + tqtPE = TQStyle::PE_PanelPopup; + break; + case QStyle::PE_PanelButtonTool: + tqtPE = TQStyle::PE_ButtonTool; + break; + case QStyle::PE_IndicatorTabTear: + NO_QT3_EQUIVALENT + break; + default: +#ifdef DEBUG_WARNINGS + printf("No rules to draw Qt4 element %d\n\r", pe); fflush(stdout); +#endif + can_override = false; + } + + // Convert the style flags + TQStyle::SFlags sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_NONE); + + // Determine the correct color group + TQPalette tqt3palette = convertQt4ToTQt3Palette(opt->palette); + TQColorGroup tqt3colorgroup; + if (sflags & TQStyle::Style_Enabled) { + if (sflags & TQStyle::Style_Active) { + tqt3colorgroup = tqt3palette.active(); + } + else { + tqt3colorgroup = tqt3palette.inactive(); + } + } + else { + tqt3colorgroup = tqt3palette.disabled(); + } + + + if (can_override) { + // Construct a Qt3 paint device on the Qt4 painter + TDEQt4PaintDevice qt4pd(p); + + TQPainter tqtPainter(&qt4pd); + + // Instruct TQt3 to draw the primitive + tqApp->style().drawPrimitive(tqtPE, &tqtPainter, TQRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height()), tqt3colorgroup, sflags, tqt3opt); + tqtPainter.end(); + +#ifdef DEBUG_WARNINGS +#ifdef DEBUG_SPEW + printf("Used Qt3 element %d to draw Qt4 element %d\n\r", tqtPE, pe); fflush(stdout); +#endif +#endif + } + else { + // Tell Qt4 to draw it + QCommonStyle::drawPrimitive(pe, opt, p, w); + } +} diff --git a/plugin/simplestyle.h b/plugin/simplestyle.h new file mode 100644 index 0000000..0b067b2 --- /dev/null +++ b/plugin/simplestyle.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Timothy Pearson. All rights reserved. +** +** This file is part of the TDE Qt4 style interface +** +** 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. +** +** 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 granted +** herein. +** +**********************************************************************/ + +#ifndef SIMPLESTYLE_H +#define SIMPLESTYLE_H + +#include + +QT_BEGIN_NAMESPACE +class QPalette; +QT_END_NAMESPACE + +class TQWidget; +class TQTabBar; +class TQRadioButton; +class TQProgressBar; +class TQPopupMenu; +class TQComboBox; + +enum TQt3WidgetType { + TQT3WT_NONE, + TQT3WT_TQProgressBar, + TQT3WT_TQTabBar, + TQT3WT_TQRadioButton, + TQT3WT_TQPopupMenu, + TQT3WT_TQComboBox +}; + +class SimpleStyle : public QWindowsStyle +{ + Q_OBJECT + +public: + SimpleStyle(); + ~SimpleStyle(); + + void polish(QPalette &palette); + void polish(QWidget *widget); + void unpolish(QWidget *widget); + bool eventFilter(QObject *obj, QEvent *ev); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const; + void drawControl(ControlElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex * option, QPainter * painter, const QWidget * widget = 0) const; + QRect subElementRect(SubElement element, const QStyleOption * option, const QWidget * widget = 0) const; + + int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0) const; + +private: + TQWidget* initializeInterfaceWidget(TQt3WidgetType wt, const QWidget * widget) const; + + TQWidget* m_tqt3parent_widget; + TQTabBar* m_tqt3tabbar_widget; + TQRadioButton* m_tqt3radiobutton_widget; + TQProgressBar* m_tqt3progressbar_widget; + TQPopupMenu* m_tqt3popupmenu_widget; + TQComboBox* m_tqt3combobox_widget; +}; + +#endif diff --git a/plugin/simplestyleplugin.cpp b/plugin/simplestyleplugin.cpp new file mode 100644 index 0000000..a474217 --- /dev/null +++ b/plugin/simplestyleplugin.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "simplestyleplugin.h" +#include "simplestyle.h" + +//! [0] +QStringList SimpleStylePlugin::keys() const +{ + return QStringList() << "SimpleStyle"; +} +//! [0] + +//! [1] +QStyle *SimpleStylePlugin::create(const QString &key) +{ + if (key.toLower() == "simplestyle") + return new SimpleStyle; + return 0; +} +//! [1] + +QT_BEGIN_NAMESPACE +Q_EXPORT_PLUGIN2(simplestyleplugin, SimpleStylePlugin) +QT_END_NAMESPACE diff --git a/plugin/simplestyleplugin.h b/plugin/simplestyleplugin.h new file mode 100644 index 0000000..e7616dd --- /dev/null +++ b/plugin/simplestyleplugin.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SIMPLESTYLEPLUGIN_H +#define SIMPLESTYLEPLUGIN_H + +#include + +QT_BEGIN_NAMESPACE +class QStringList; +class QStyle; +QT_END_NAMESPACE + +//! [0] +class SimpleStylePlugin : public QStylePlugin +{ + Q_OBJECT + +public: + SimpleStylePlugin() {}; + + QStringList keys() const; + QStyle *create(const QString &key); +}; +//! [0] + +#endif diff --git a/plugin/tdeqt4painter.cpp b/plugin/tdeqt4painter.cpp new file mode 100644 index 0000000..6c8d4c0 --- /dev/null +++ b/plugin/tdeqt4painter.cpp @@ -0,0 +1,772 @@ +/**************************************************************************** +** +** Implementation of TDEQt4PaintDevice class +** +** Copyright (C) 2012 Timothy Pearson. All rights reserved. +** +** This file is part of the TDE Qt4 style interface +** +** 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. +** +** 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 granted +** herein. +** +**********************************************************************/ + +#include "tdeqt4painter.h" + +#define TQT_NO_COMPAT_NAMES +#include "tqpainter.h" +#include "tqpixmap.h" +#include "tqbitmap.h" +#include "tqimage.h" +#include "tqfile.h" +#include "tqpaintdevicemetrics.h" +#undef Qt + +/*! + \class TDEQt4PaintDevice ntqpicture.h + \brief The TDEQt4PaintDevice class is a paint device that records and + replays TQPainter commands. + + \ingroup graphics + \ingroup images + \ingroup shared + + A picture serializes painter commands to an IO device in a + platform-independent format. For example, a picture created under + Windows can be read on a Sun SPARC. + + Pictures are called meta-files on some platforms. + + TQt pictures use a proprietary binary format. Unlike native picture + (meta-file) formats on many window systems, TQt pictures have no + limitations regarding their contents. Everything that can be + painted can also be stored in a picture, e.g. fonts, pixmaps, + regions, transformed graphics, etc. + + TDEQt4PaintDevice is an \link shclass.html implicitly shared\endlink class. + + Example of how to record a picture: + \code + TDEQt4PaintDevice pic; + TQPainter p; + p.begin( &pic ); // paint in picture + p.drawEllipse( 10,20, 80,70 ); // draw an ellipse + p.end(); // painting done + pic.save( "drawing.pic" ); // save picture + \endcode + + Example of how to replay a picture: + \code + TDEQt4PaintDevice pic; + pic.load( "drawing.pic" ); // load picture + TQPainter p; + p.begin( &myWidget ); // paint in myWidget + p.drawPicture( pic ); // draw the picture + p.end(); // painting done + \endcode + + Pictures can also be drawn using play(). Some basic data about a + picture is available, for example, size(), isNull() and + boundingRect(). + +*/ + + +/*! + Constructs an empty picture. + + The \a formatVersion parameter may be used to \e create a TDEQt4PaintDevice + that can be read by applications that are compiled with earlier + versions of TQt. + \list + \i \a formatVersion == 1 is binary compatible with TQt 1.x and later. + \i \a formatVersion == 2 is binary compatible with TQt 2.0.x and later. + \i \a formatVersion == 3 is binary compatible with TQt 2.1.x and later. + \i \a formatVersion == 4 is binary compatible with TQt 3.0.x and later. + \i \a formatVersion == 5 is binary compatible with TQt 3.1. + \endlist + + Note that the default formatVersion is -1 which signifies the + current release, i.e. for TQt 3.1 a formatVersion of 5 is the same + as the default formatVersion of -1. + + Reading pictures generated by earlier versions of TQt is supported + and needs no special coding; the format is automatically detected. +*/ + +TDEQt4PaintDevice::TDEQt4PaintDevice( QPainter *qt4painter ) + : TQPaintDevice( TQInternal::Picture | TQInternal::ExternalDevice ) +{ + m_qt4painter = qt4painter; +} + +/*! + Destroys the picture. +*/ +TDEQt4PaintDevice::~TDEQt4PaintDevice() +{ +} + +/*! + \internal + Implementation of the function forwarded above to the internal data struct. +*/ + +bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) +{ + Q_UNUSED(pt); + + unsigned int i; + int x; + int y; + QPen qt4pen; + QRect qt4rect; + QBrush qt4brush; + QPoint qt4point1; + QPoint qt4point2; + QPolygon qt4polygon; + QFont qt4font; + QPixmap qt4pixmap; + QString qt4string; + QMatrix qt4matrix; + QRegion qt4region; + Qt::BGMode qt4bkmode = Qt::TransparentMode; + QPainter::CompositionMode qt4compositionmode = QPainter::CompositionMode_SourceOver; + int qt4formattedtextflags = 0; + + if (p) { + if (c == PdcSetClipRegion) { + // FIXME + // Ellipses are not being handle correctly AT ALL + // Look at the Lipstik progress bar for an example of this... +#if 0 + // IMPRECISE + const TQMemArray rects = p[0].rgn->rects(); + for ( uint i = 0; i < rects.count(); i++ ) { + TQRect r = rects[(int)i]; + qt4region = qt4region.united(QRegion(QRect(r.x(), r.y(), r.width(), r.height()))); + } +#else + // SLOW + TQRect tqt3br = p[0].rgn->boundingRect(); + TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height()); + regionMask.fill(TQt::color0); + TQPainter tqt3brpainter(®ionMask); + tqt3brpainter.setClipRegion(*p[0].rgn); + tqt3brpainter.fillRect(0,0,regionMask.width(),regionMask.height(),TQt::color1); + tqt3brpainter.end(); + QBitmap qt4RegionMask = QPixmap::fromX11Pixmap(regionMask.handle(), QPixmap::ImplicitlyShared); + qt4region = QRegion(qt4RegionMask); +#endif + TQPainter::CoordinateMode tqt3coordmode = (TQPainter::CoordinateMode)p[1].ival; + if ( tqt3coordmode == TQPainter::CoordDevice ) { + qt4region = qt4region; + } + else { + qt4region = m_qt4painter->transform().map(qt4region); + } + } + if (c == PdcSetWMatrix) { + const TQWMatrix* tqt3matrix = p[0].matrix; + qt4matrix = QMatrix(tqt3matrix->m11(), tqt3matrix->m12(), tqt3matrix->m21(), tqt3matrix->m22(), tqt3matrix->dx(), tqt3matrix->dy()); + } + if (c == PdcSetROP) { + TQt::RasterOp rop = (TQt::RasterOp)p[0].ival; + switch (rop) { + case TQPainter::CopyROP: + qt4compositionmode=QPainter::CompositionMode_SourceOver; + break; + case TQPainter::OrROP: + qt4compositionmode=QPainter::RasterOp_SourceOrDestination; + break; + case TQPainter::XorROP: + qt4compositionmode=QPainter::RasterOp_SourceXorDestination; + break; + case TQPainter::NotAndROP: + qt4compositionmode=QPainter::RasterOp_NotSourceAndDestination; + break; +// case TQPainter::EraseROP: +// qt4compositionmode=QPainter::RasterOp_NotSourceAndDestination; +// break; + case TQPainter::NotCopyROP: + qt4compositionmode=QPainter::RasterOp_NotSource; + break; + case TQPainter::NotOrROP: + tqWarning("TDEQt4PaintDevice::cmd: Unhandled raster operation [Was attempting to use raster operation %d\n\r", rop); + break; + case TQPainter::NotXorROP: + qt4compositionmode=QPainter::RasterOp_NotSourceXorDestination; + break; + case TQPainter::AndROP: + qt4compositionmode=QPainter::RasterOp_SourceAndDestination; + break; +// case TQPainter::NotEraseROP: +// qt4compositionmode=QPainter::RasterOp_SourceAndDestination; +// break; + case TQPainter::NotROP: + qt4compositionmode=QPainter::RasterOp_SourceAndNotDestination; // [WARNING] This may not be a correct substitute for NotROP! + break; + case TQPainter::ClearROP: + qt4compositionmode=QPainter::CompositionMode_Clear; + break; + case TQPainter::SetROP: + tqWarning("TDEQt4PaintDevice::cmd: Unhandled raster operation [Was attempting to use raster operation %d\n\r", rop); + break; + case TQPainter::NopROP: + qt4compositionmode=QPainter::CompositionMode_Destination; + break; + case TQPainter::AndNotROP: + qt4compositionmode=QPainter::RasterOp_SourceAndNotDestination; + break; + case TQPainter::OrNotROP: + tqWarning("TDEQt4PaintDevice::cmd: Unhandled raster operation [Was attempting to use raster operation %d\n\r", rop); + break; + case TQPainter::NandROP: + qt4compositionmode=QPainter::RasterOp_NotSourceOrNotDestination; + break; + case TQPainter::NorROP: + qt4compositionmode=QPainter::RasterOp_NotSourceAndNotDestination; + break; + default: + qt4compositionmode=QPainter::CompositionMode_SourceOver; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Unhandled raster operation %d", rop ); +#endif + } + } + if (( c== PdcDrawTextFormatted) || (c == PdcDrawText2Formatted)) { + qt4rect = QRect(p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); + qt4formattedtextflags = 0; +// if (p[1].ival & TQt::AlignAuto) { +// qt4formattedtextflags = qt4formattedtextflags | Qt::AlignAuto; +// } + if ((p[1].ival & TQt::AlignLeft) == TQt::AlignLeft) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignLeft; + } + if ((p[1].ival & TQt::AlignRight) == TQt::AlignRight) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignRight; + } + if ((p[1].ival & TQt::AlignHCenter) == TQt::AlignHCenter) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignHCenter; + } + if ((p[1].ival & TQt::AlignJustify) == TQt::AlignJustify) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignJustify; + } + if ((p[1].ival & TQt::AlignTop) == TQt::AlignTop) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignTop; + } + if ((p[1].ival & TQt::AlignBottom) == TQt::AlignBottom) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignBottom; + } + if ((p[1].ival & TQt::AlignVCenter) == TQt::AlignVCenter) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignVCenter; + } + if ((p[1].ival & TQt::AlignCenter) == TQt::AlignCenter) { + qt4formattedtextflags = qt4formattedtextflags | Qt::AlignCenter; + } + if ((p[1].ival & TQt::SingleLine) == TQt::SingleLine) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextSingleLine; + } + if ((p[1].ival & TQt::DontClip) == TQt::DontClip) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextDontClip; + } + if ((p[1].ival & TQt::ExpandTabs) == TQt::ExpandTabs) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextExpandTabs; + } + if ((p[1].ival & TQt::ShowPrefix) == TQt::ShowPrefix) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextShowMnemonic; + } + if ((p[1].ival & TQt::WordBreak) == TQt::WordBreak) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextWordWrap; + } + if ((p[1].ival & TQt::BreakAnywhere) == TQt::BreakAnywhere) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextWrapAnywhere; + } + if ((p[1].ival & TQt::NoAccel) == TQt::NoAccel) { + qt4formattedtextflags = qt4formattedtextflags | Qt::TextHideMnemonic; + } + qt4string = QString::fromUtf8(p[2].str->utf8().data()); + } + if ((c == PdcDrawPoint) || (c == PdcMoveTo) || (c == PdcLineTo) || (c == PdcSetBrushOrigin)) { + qt4point1 = QPoint(p[0].point->x(), p[0].point->y()); + } + if (c == PdcDrawLine) { + qt4point1 = QPoint(p[0].point->x(), p[0].point->y()); + qt4point2 = QPoint(p[1].point->x(), p[1].point->y()); + } + if ((c == PdcDrawPolyline) || (c == PdcDrawPolygon) || (c == PdcDrawLineSegments) || (c == PdcDrawCubicBezier)) { + TQPointArray qt3parray = *p[0].ptarr; + qt4polygon.resize(qt3parray.count()); + for (i=0;ix(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); + } + if (c == PdcSetBrush) { + TQt::BrushStyle tqt3brushstyle = p[0].brush->style(); + Qt::BrushStyle qt4brushstyle; + switch ( tqt3brushstyle ) { + case TQt::NoBrush: + qt4brushstyle = Qt::NoBrush; + break; + case TQt::SolidPattern: + qt4brushstyle = Qt::SolidPattern; + break; + case TQt::Dense1Pattern: + qt4brushstyle = Qt::Dense1Pattern; + break; + case TQt::Dense2Pattern: + qt4brushstyle = Qt::Dense2Pattern; + break; + case TQt::Dense3Pattern: + qt4brushstyle = Qt::Dense3Pattern; + break; + case TQt::Dense4Pattern: + qt4brushstyle = Qt::Dense4Pattern; + break; + case TQt::Dense5Pattern: + qt4brushstyle = Qt::Dense5Pattern; + break; + case TQt::Dense6Pattern: + qt4brushstyle = Qt::Dense6Pattern; + break; + case TQt::Dense7Pattern: + qt4brushstyle = Qt::Dense7Pattern; + break; + case TQt::HorPattern: + qt4brushstyle = Qt::HorPattern; + break; + case TQt::VerPattern: + qt4brushstyle = Qt::VerPattern; + break; + case TQt::CrossPattern: + qt4brushstyle = Qt::CrossPattern; + break; + case TQt::BDiagPattern: + qt4brushstyle = Qt::BDiagPattern; + break; + case TQt::FDiagPattern: + qt4brushstyle = Qt::FDiagPattern; + break; + case TQt::DiagCrossPattern: + qt4brushstyle = Qt::DiagCrossPattern; + break; + case TQt::CustomPattern: + qt4brushstyle = Qt::TexturePattern; + break; + default: + qt4brushstyle = Qt::NoBrush; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid brush style %d", tqt3brushstyle ); +#endif + } + qt4brush.setStyle(qt4brushstyle); + TQColor qt3color = p[0].brush->color(); + qt4brush.setColor(QColor(qt3color.red(), qt3color.green(), qt3color.blue(), 255)); + if (qt4brushstyle == Qt::TexturePattern) { + TQPixmap tqtPM = *p[0].brush->pixmap(); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ImplicitlyShared); + qt4brush.setTexture(qtPM); + } + } + if (c == PdcSetPen) { + bool customPenStyle = false; + TQt::PenStyle tqt3penstyle = p[0].pen->style(); + Qt::PenStyle qt4penstyle; + QVector dashes; + qreal mark; + qreal space; + switch ( tqt3penstyle ) { + case TQt::NoPen: + qt4penstyle = Qt::NoPen; + break; + case TQt::SolidLine: + qt4penstyle = Qt::SolidLine; + break; + case TQt::DashLine: + qt4penstyle = Qt::DashLine; + break; + case TQt::DotLine: + qt4penstyle = Qt::DotLine; + break; + case TQt::DashDotLine: + qt4penstyle = Qt::DashDotLine; + break; + case TQt::DashDotDotLine: + qt4penstyle = Qt::DashDotDotLine; + break; + case TQt::FineDotLine: + customPenStyle = true; + mark = 1; + space = 1; + dashes << mark << space; + qt4pen.setDashPattern(dashes); + break; + case TQt::MPenStyle: + qt4penstyle = Qt::MPenStyle; + break; + default: + qt4penstyle = Qt::NoPen; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid pen style %d", tqt3penstyle ); +#endif + } + if (customPenStyle == false) { + qt4pen.setStyle(qt4penstyle); + } + TQt::PenCapStyle tqt3pencapstyle = p[0].pen->capStyle(); + Qt::PenCapStyle qt4pencapstyle; + switch ( tqt3pencapstyle ) { + case TQt::FlatCap: + qt4pencapstyle = Qt::FlatCap; + break; + case TQt::SquareCap: + qt4pencapstyle = Qt::SquareCap; + break; + case TQt::RoundCap: + qt4pencapstyle = Qt::RoundCap; + break; + case TQt::MPenCapStyle: + qt4pencapstyle = Qt::MPenCapStyle; + default: + qt4pencapstyle = Qt::FlatCap; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid pen cap style %d", tqt3pencapstyle ); +#endif + } + qt4pen.setCapStyle(qt4pencapstyle); + TQt::PenJoinStyle tqt3penjoinstyle = p[0].pen->joinStyle(); + Qt::PenJoinStyle qt4penjoinstyle; + switch ( tqt3penjoinstyle ) { + case TQt::MiterJoin: + qt4penjoinstyle = Qt::MiterJoin; + break; + case TQt::BevelJoin: + qt4penjoinstyle = Qt::BevelJoin; + break; + case TQt::RoundJoin: + qt4penjoinstyle = Qt::RoundJoin; + break; + case TQt::MPenJoinStyle: + qt4penjoinstyle = Qt::MPenJoinStyle; + default: + qt4penjoinstyle = Qt::MiterJoin; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid pen join style %d", tqt3penjoinstyle ); +#endif + } + qt4pen.setJoinStyle(qt4penjoinstyle); + TQColor qt3color = p[0].pen->color(); + qt4pen.setColor(QColor(qt3color.red(), qt3color.green(), qt3color.blue(), 255)); + qt4pen.setWidth(p[0].pen->width()); + } + if (c == PdcSetBkMode) { + TQt::BGMode qt3bkmode = (TQt::BGMode)p[0].ival; + switch ( qt3bkmode ) { + case TQt::TransparentMode: + qt4bkmode = Qt::TransparentMode; + break; + case TQt::OpaqueMode: + qt4bkmode = Qt::OpaqueMode; + break; + default: + qt4bkmode = Qt::TransparentMode; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid background mode %d", qt3bkmode ); +#endif + } + } + if (c == PdcSetFont) { + // FIXME + printf("[WARNING] QFont conversion is NOT COMPLETE\n\r"); fflush(stdout); + + TQFont qt3font = *p[0].font; + qt4font = QFont(QString::fromUtf8(qt3font.family().utf8().data()), qt3font.pointSize(), qt3font.weight(), qt3font.italic()); + } + if (c == PdcDrawPixmap) { + qt4rect = QRect(p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); + TQPixmap qt3pixmap = *p[1].pixmap; + qt4pixmap = QPixmap::fromX11Pixmap(qt3pixmap.handle(), QPixmap::ImplicitlyShared); + } + if (c == PdcDrawText2) { + qt4point1 = QPoint(p[0].point->x(), p[0].point->y()); + qt4string = QString::fromUtf8(p[1].str->utf8().data()); + } + } + + int index; + int count; + int lineCount; + QPainterPath path; + + switch ( c ) { // exec cmd + case PdcNOP: + break; + case PdcDrawPoint: + m_qt4painter->drawPoint( qt4point1 ); + break; + case PdcMoveTo: + curPt = qt4point1; + break; + case PdcLineTo: + prevPt = curPt; + curPt = qt4point1; + m_qt4painter->drawLine( prevPt, curPt ); + break; + case PdcDrawLine: + m_qt4painter->drawLine( qt4point1, qt4point2 ); + break; + case PdcDrawRect: + m_qt4painter->drawRect( qt4rect ); + break; + case PdcDrawRoundRect: + m_qt4painter->drawRoundedRect( qt4rect, p[1].ival, p[2].ival ); + break; + case PdcDrawEllipse: + m_qt4painter->drawEllipse( qt4rect ); + break; + case PdcDrawArc: + m_qt4painter->drawArc( qt4rect, p[1].ival, p[2].ival ); + break; + case PdcDrawPie: + m_qt4painter->drawPie( qt4rect, p[1].ival, p[2].ival ); + break; + case PdcDrawChord: + m_qt4painter->drawChord( qt4rect, p[1].ival, p[2].ival ); + break; + case PdcDrawLineSegments: + index = 0; + count = -1; + lineCount = (count == -1) ? (qt4polygon.size() - index) / 2 : count; + m_qt4painter->drawLines(qt4polygon.constData() + index * 2, lineCount); + break; + case PdcDrawPolyline: + m_qt4painter->drawPolyline( qt4polygon ); + break; + case PdcDrawPolygon: + m_qt4painter->drawPolygon( qt4polygon, (p[1].ival == 0)?Qt::OddEvenFill:Qt::WindingFill ); + break; + case PdcDrawCubicBezier: + index = 0; + path.moveTo(qt4polygon.at(index)); + path.cubicTo(qt4polygon.at(index+1), qt4polygon.at(index+2), qt4polygon.at(index+3)); + m_qt4painter->strokePath(path, m_qt4painter->pen()); + break; + case PdcDrawText: + m_qt4painter->drawText( qt4point1, qt4string ); + break; + case PdcDrawTextFormatted: + m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string ); + break; + case PdcDrawText2: + m_qt4painter->drawText( qt4point1, qt4string ); + break; + case PdcDrawText2Formatted: + m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string ); + break; + case PdcDrawPixmap: + m_qt4painter->drawPixmap( qt4rect, qt4pixmap ); + break; +#if 0 + case PdcDrawImage: { + TQImage image; + if ( d->formatMajor < 4 ) { + s >> p >> image; + painter->drawImage( p, image ); + } else { + s >> r >> image; + painter->drawImage( r, image ); + } + } + break; +#endif + case PdcBegin: + if (m_qt4painter->isActive()) { + // KEEP THIS DEACTIVATED +// QPaintDevice* pd = m_qt4painter->device(); +// m_qt4painter->end(); +// m_qt4painter->begin(pd); + } +#if defined(QT_CHECK_RANGE) + else { + tqWarning( "TDEQt4PaintDevice::cmd: Painter has no paint device available" ); + } +#endif + break; + case PdcEnd: + // KEEP THIS DEACTIVATED +// m_qt4painter->end(); + break; + case PdcSave: + m_qt4painter->save(); + break; + case PdcRestore: + m_qt4painter->restore(); + break; + case PdcSetBkColor: + m_qt4painter->setBackground( QBrush(QColor(p[0].color->red(), p[0].color->green(), p[0].color->blue())) ); + break; + case PdcSetBkMode: + m_qt4painter->setBackgroundMode( qt4bkmode ); + break; + case PdcSetROP: + m_qt4painter->setCompositionMode(qt4compositionmode); + break; + case PdcSetBrushOrigin: + m_qt4painter->setBrushOrigin( qt4point1 ); + break; + case PdcSetFont: + m_qt4painter->setFont( qt4font ); + break; + case PdcSetPen: + m_qt4painter->setPen( qt4pen ); + break; + case PdcSetBrush: + m_qt4painter->setBrush( qt4brush ); + break; +#if 0 + case PdcSetTabStops: + s >> i_16; + painter->setTabStops( i_16 ); + break; + case PdcSetTabArray: + s >> i_16; + if ( i_16 == 0 ) { + painter->setTabArray( 0 ); + } else { + int *ta = new int[i_16]; + TQ_CHECK_PTR( ta ); + for ( int i=0; i> i1_16; + ta[i] = i1_16; + } + painter->setTabArray( ta ); + delete [] ta; + } + break; + case PdcSetVXform: + s >> i_8; +#ifndef QT_NO_TRANSFORMATIONS + painter->setViewXForm( i_8 ); +#endif + break; + case PdcSetWindow: + s >> r; +#ifndef QT_NO_TRANSFORMATIONS + painter->setWindow( r ); +#endif + break; + case PdcSetViewport: + s >> r; +#ifndef QT_NO_TRANSFORMATIONS + painter->setViewport( r ); +#endif + break; +#endif + case PdcSetWXform: + m_qt4painter->setWorldMatrixEnabled( p[0].ival ); + break; + case PdcSetWMatrix: + m_qt4painter->setWorldMatrix( qt4matrix, p[1].ival ); + break; +#if 0 +#ifndef QT_NO_TRANSFORMATIONS + case PdcSaveWMatrix: + painter->saveWorldMatrix(); + break; + case PdcRestoreWMatrix: + painter->restoreWorldMatrix(); + break; +#endif +#endif + case PdcSetClip: + m_qt4painter->setClipping( p[0].ival ); + break; + case PdcSetClipRegion: + m_qt4painter->setClipRegion( qt4region, Qt::ReplaceClip ); + break; + default: +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::cmd: Invalid command %d", c ); +#endif + } + + return TRUE; +} + + +/*! + Internal implementation of the virtual TQPaintDevice::metric() + function. + + Use the TQPaintDeviceMetrics class instead. + + A picture has the following hard-coded values: dpi=72, + numcolors=16777216 and depth=24. + + \a m is the metric to get. +*/ + +int TDEQt4PaintDevice::metric( int m ) const +{ + int val; + QPaintDevice* qt4pd = m_qt4painter->device(); + if (qt4pd) { + switch ( m ) { + // ### hard coded dpi and color depth values ! + case TQPaintDeviceMetrics::PdmWidth: + val = qt4pd->width(); + break; + case TQPaintDeviceMetrics::PdmHeight: + val = qt4pd->height(); + break; + case TQPaintDeviceMetrics::PdmWidthMM: + val = qt4pd->widthMM(); + break; + case TQPaintDeviceMetrics::PdmHeightMM: + val = qt4pd->heightMM(); + break; + case TQPaintDeviceMetrics::PdmDpiX: + val = qt4pd->logicalDpiX(); + break; + case TQPaintDeviceMetrics::PdmPhysicalDpiX: + val = qt4pd->physicalDpiX(); + break; + case TQPaintDeviceMetrics::PdmDpiY: + val = qt4pd->logicalDpiY(); + break; + case TQPaintDeviceMetrics::PdmPhysicalDpiY: + val = qt4pd->physicalDpiY(); + break; + case TQPaintDeviceMetrics::PdmNumColors: + val = qt4pd->colorCount(); + break; + case TQPaintDeviceMetrics::PdmDepth: + val = qt4pd->depth(); + break; + default: + val = 0; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::metric: Invalid metric command" ); +#endif + } + } + else { + val = 0; +#if defined(QT_CHECK_RANGE) + tqWarning( "TDEQt4PaintDevice::metric: No Qt4 paint device available" ); +#endif + } + return val; +} + diff --git a/plugin/tdeqt4painter.h b/plugin/tdeqt4painter.h new file mode 100644 index 0000000..ccb5f70 --- /dev/null +++ b/plugin/tdeqt4painter.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Definition of TDEQt4PaintDevice class +** +** Copyright (C) 2012 Timothy Pearson. All rights reserved. +** +** This file is part of the TDE Qt4 style interface +** +** 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. +** +** 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 granted +** herein. +** +**********************************************************************/ + +#ifndef TDEQT4PAINTER_H +#define TDEQT4PAINTER_H + +#define TQT_NO_COMPAT_NAMES +#include "ntqpaintdevice.h" +#include "ntqbuffer.h" +#undef Qt + +#include +#include + +class Q_EXPORT TDEQt4PaintDevice : public TQPaintDevice // picture class +{ +public: + TDEQt4PaintDevice( QPainter * ); + ~TDEQt4PaintDevice(); + +protected: + bool cmd( int, TQPainter *, TQPDevCmdParam * ); + int metric( int ) const; + +private: + QPainter *m_qt4painter; + + QPoint prevPt; + QPoint curPt; +}; + +#endif // TDEQT4PAINTER_H diff --git a/styleplugin.pro b/styleplugin.pro new file mode 100644 index 0000000..74ae208 --- /dev/null +++ b/styleplugin.pro @@ -0,0 +1,13 @@ +TEMPLATE = subdirs +SUBDIRS = stylewindow \ + plugin \ + unstyledwindow + + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS styleplugin.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/styles/libsimplestyleplugin.so b/styles/libsimplestyleplugin.so new file mode 100755 index 0000000..38b6bbe Binary files /dev/null and b/styles/libsimplestyleplugin.so differ diff --git a/stylewindow/Makefile b/stylewindow/Makefile new file mode 100644 index 0000000..a6a8849 --- /dev/null +++ b/stylewindow/Makefile @@ -0,0 +1,239 @@ +############################################################################# +# Makefile for building: ../styleplugin +# Generated by qmake (2.01a) (Qt 4.7.0) on: Sat Mar 10 16:06:19 2012 +# Project: stylewindow.pro +# Template: app +# Command: /usr/bin/qmake-qt4 -o Makefile stylewindow.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. +LINK = g++ +LFLAGS = -Wl,-O1 +LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = stylewindow.cpp \ + main.cpp moc_stylewindow.cpp +OBJECTS = stylewindow.o \ + main.o \ + moc_stylewindow.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + stylewindow.pro +QMAKE_TARGET = styleplugin +DESTDIR = ../ +TARGET = ../styleplugin + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + @$(CHK_DIR_EXISTS) ../ || $(MKDIR) ../ + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: stylewindow.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -o Makefile stylewindow.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile stylewindow.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/styleplugin1.0.0 || $(MKDIR) .tmp/styleplugin1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/styleplugin1.0.0/ && $(COPY_FILE) --parents stylewindow.h .tmp/styleplugin1.0.0/ && $(COPY_FILE) --parents stylewindow.cpp main.cpp .tmp/styleplugin1.0.0/ && (cd `dirname .tmp/styleplugin1.0.0` && $(TAR) styleplugin1.0.0.tar styleplugin1.0.0 && $(COMPRESS) styleplugin1.0.0.tar) && $(MOVE) `dirname .tmp/styleplugin1.0.0`/styleplugin1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/styleplugin1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_stylewindow.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_stylewindow.cpp +moc_stylewindow.cpp: stylewindow.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) stylewindow.h -o moc_stylewindow.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +stylewindow.o: stylewindow.cpp stylewindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o stylewindow.o stylewindow.cpp + +main.o: main.cpp stylewindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +moc_stylewindow.o: moc_stylewindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_stylewindow.o moc_stylewindow.cpp + +####### Install + +install_target: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ + -$(INSTALL_PROGRAM) "../$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/$(QMAKE_TARGET)" + -$(STRIP) "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/$(QMAKE_TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/$(QMAKE_TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/ + + +install_sources: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/stylewindow.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/main.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/stylewindow.h $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/stylewindow/stylewindow.pro $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + + +uninstall_sources: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/stylewindow.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/main.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/stylewindow.h + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/stylewindow.pro + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/styleplugin/stylewindow/ + + +install: install_target install_sources FORCE + +uninstall: uninstall_target uninstall_sources FORCE + +FORCE: + diff --git a/stylewindow/main.cpp b/stylewindow/main.cpp new file mode 100644 index 0000000..1cf42aa --- /dev/null +++ b/stylewindow/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "stylewindow.h" + +//! [0] +int main(int argv, char *args[]) +{ + QApplication app(argv, args); + QApplication::setStyle(QStyleFactory::create("simplestyle")); + + StyleWindow window; + window.resize(200, 50); + window.show(); + + return app.exec(); +} +//! [0] diff --git a/stylewindow/stylewindow.cpp b/stylewindow/stylewindow.cpp new file mode 100644 index 0000000..7ede04c --- /dev/null +++ b/stylewindow/stylewindow.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "stylewindow.h" + +StyleWindow::StyleWindow() +{ + QPushButton *styledButton = new QPushButton(tr("Big Red Button")); + QRadioButton *styledRadioButton = new QRadioButton(tr("Little Radio Button")); + QCheckBox *styledCheckBox = new QCheckBox(tr("Little Check Box")); + QComboBox *styledComboBox = new QComboBox(); + QTextEdit *styledTextEdit = new QTextEdit(); + QProgressBar *styledProgressBar = new QProgressBar(); + QTabBar *styledTabBar = new QTabBar(); + QToolBar *styledToolBar = new QToolBar(); + + QGridLayout *layout = new QGridLayout; + layout->addWidget(styledButton); + layout->addWidget(styledRadioButton); + layout->addWidget(styledCheckBox); + layout->addWidget(styledComboBox); + layout->addWidget(styledTextEdit); + layout->addWidget(styledProgressBar); + layout->addWidget(styledTabBar); + layout->addWidget(styledToolBar); + + styledComboBox->addItem("Hello"); + styledComboBox->addItem("There"); + styledComboBox->addItem("Raja!"); + styledTextEdit->setText("TEST"); + styledProgressBar->setMaximum(100); + styledProgressBar->setValue(50); + styledTabBar->addTab("Tab 1"); + styledTabBar->addTab("Tab 2"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab 3"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + + styledToolBar->addAction("Save"); + + QGroupBox *styleBox = new QGroupBox(tr("A simple style button")); + styleBox->setLayout(layout); + + QGridLayout *outerLayout = new QGridLayout; + outerLayout->addWidget(styleBox, 0, 0); + setLayout(outerLayout); + + setWindowTitle(tr("Style Plugin Example")); +} diff --git a/stylewindow/stylewindow.h b/stylewindow/stylewindow.h new file mode 100644 index 0000000..aed21c7 --- /dev/null +++ b/stylewindow/stylewindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLEWINDOW_H +#define STYLEWINDOW_H + +#include + +class StyleWindow : public QWidget +{ + Q_OBJECT + +public: + StyleWindow(); +}; + +#endif diff --git a/stylewindow/stylewindow.pro b/stylewindow/stylewindow.pro new file mode 100644 index 0000000..8ed1541 --- /dev/null +++ b/stylewindow/stylewindow.pro @@ -0,0 +1,19 @@ +HEADERS = stylewindow.h +SOURCES = stylewindow.cpp \ + main.cpp + +TARGET = styleplugin +win32 { + debug:DESTDIR = ../debug/ + release:DESTDIR = ../release/ +} else { + DESTDIR = ../ +} + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS stylewindow.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/stylewindow +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/thingstofix.txt b/thingstofix.txt new file mode 100644 index 0000000..f33e5ee --- /dev/null +++ b/thingstofix.txt @@ -0,0 +1,47 @@ +find ./ -type f -iname "*" -exec sed -i 's/TTQ/TQ/g' {} \; + +find ./ -type f -iname "*" -exec sed -i 's/QT_VERSION_STR/TQT_VERSION_STR/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_VERSION/TQT_VERSION/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_BUILD_KEY/TQT_BUILD_KEY/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_PACKED/TQ_PACKED/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_INT64_C/TQ_INT64_C/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_UINT64_C/TQ_UINT64_C/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_CHECK_PTR/TQ_CHECK_PTR/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_DISABLE_COPY/TQ_DISABLE_COPY/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_MODULE_NETWORK/TQT_MODULE_NETWORK/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_MODULE_OPENGL/TQT_MODULE_OPENGL/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_MODULE_SQL/TQT_MODULE_SQL/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_MODULE_XML/TQT_MODULE_XML/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/QT_TR_FUNCTIONS/TQT_TR_FUNCTIONS/g' {} \; + +# Q_OBJECT + +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qRound/\1tqRound/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qSwap/\1tqSwap/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qstrlen/\1tqstrlen/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qstrncmp/\1tqstrncmp/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qUncompress/\1tqUncompress/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qCopy/\1tqCopy/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qCopyBackward/\1tqCopyBackward/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qEqual/\1tqEqual/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qFill/\1tqFill/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qFind/\1tqFind/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qCount/\1tqCount/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qHash/\1tqHash/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ \t]\)qAppName/\1tqAppName/g' {} \; + +qint8 +quint8 +qint16 +quint16 +qint32 +quint32 +qint64 +quint64 +qlonglong +qulonglong + +QTypeInfo +QTextStream +QDebug +QMetaTypeId2 \ No newline at end of file diff --git a/tqt3reference/Makefile b/tqt3reference/Makefile new file mode 100644 index 0000000..b3caed5 --- /dev/null +++ b/tqt3reference/Makefile @@ -0,0 +1,167 @@ +############################################################################# +# Makefile for building: ../tqt3referencewindow +# Generated by qmake (1.07a) (TQt 3.4.0) on: Tue Mar 6 12:56:29 2012 +# Project: stylewindow.pro +# Template: app +# Command: $(QMAKE) -o Makefile stylewindow.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +LEX = flex +YACC = yacc +CFLAGS = -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT +CXXFLAGS = -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT +LEXFLAGS = +YACCFLAGS= -d +INCPATH = -I/usr/share/tqt3/mkspecs/default -I. -I/usr/include/tqt3 -I/usr/include/tqt -I/opt/trinity/include -I/usr/include/tqt3 +LINK = g++ +LFLAGS = +LIBS = $(SUBLIBS) -L/usr/share/tqt3/lib -L/usr/X11R6/lib -L/usr/lib -ltqt -L /opt/trinity/lib -lDCOP -ltdecore -ltqt-mt -lXext -lX11 -lm -lpthread +AR = ar cqs +RANLIB = +MOC = /usr/share/tqt3/bin/moc +UIC = /usr/share/tqt3/bin/uic +QMAKE = qmake +TAR = tar -cf +GZIP = gzip -9f +COPY = cp -f +COPY_FILE= $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE= $(COPY_FILE) +INSTALL_DIR = $(COPY_DIR) +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +HEADERS = stylewindow.h +SOURCES = stylewindow.cpp \ + main.cpp +OBJECTS = stylewindow.o \ + main.o +FORMS = +UICDECLS = +UICIMPLS = +SRCMOC = moc_stylewindow.cpp +OBJMOC = moc_stylewindow.o +DIST = stylewindow.pro +QMAKE_TARGET = tqt3referencewindow +DESTDIR = ../ +TARGET = ../tqt3referencewindow + +first: all +####### Implicit rules + +.SUFFIXES: .c .o .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) + test -d ../ || mkdir -p ../ + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS) + +mocables: $(SRCMOC) +uicables: $(UICDECLS) $(UICIMPLS) + +$(MOC): + ( cd $(QTDIR)/src/moc && $(MAKE) ) + +Makefile: stylewindow.pro /usr/share/tqt3/mkspecs/default/qmake.conf /usr/share/tqt3/lib/libtqt-mt.prl + $(QMAKE) -o Makefile stylewindow.pro +qmake: + @$(QMAKE) -o Makefile stylewindow.pro + +dist: + @mkdir -p .tmp/tqt3referencewindow && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/tqt3referencewindow/ && ( cd `dirname .tmp/tqt3referencewindow` && $(TAR) tqt3referencewindow.tar tqt3referencewindow && $(GZIP) tqt3referencewindow.tar ) && $(MOVE) `dirname .tmp/tqt3referencewindow`/tqt3referencewindow.tar.gz . && $(DEL_FILE) -r .tmp/tqt3referencewindow + +mocclean: + -$(DEL_FILE) $(OBJMOC) + -$(DEL_FILE) $(SRCMOC) + +uiclean: + +yaccclean: +lexclean: +clean: mocclean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) ../$(TARGET) $(TARGET) + + +FORCE: + +####### Compile + +stylewindow.o: stylewindow.cpp stylewindow.h + +main.o: main.cpp stylewindow.h + +moc_stylewindow.o: moc_stylewindow.cpp stylewindow.h + +moc_stylewindow.cpp: $(MOC) stylewindow.h + $(MOC) stylewindow.h -o moc_stylewindow.cpp + +####### Install + +install_target: all + @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/tools/tqt3reference/" || $(MKDIR) "$(INSTALL_ROOT)/tools/tqt3reference/" + -$(INSTALL_FILE) "../$(QMAKE_TARGET)" "$(INSTALL_ROOT)/tools/tqt3reference/$(QMAKE_TARGET)" + +uninstall_target: + -$(DEL_FILE) "$(INSTALL_ROOT)/tools/tqt3reference/$(QMAKE_TARGET)" + -$(DEL_DIR) "$(INSTALL_ROOT)/tools/tqt3reference/" + + +install_sources: all + @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" || $(MKDIR) "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + -$(INSTALL_FILE) "stylewindow.cpp" "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + -$(INSTALL_FILE) "main.cpp" "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + -$(INSTALL_FILE) "stylewindow.h" "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + -$(INSTALL_FILE) "stylewindow.pro" "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + + +uninstall_sources: + -$(DEL_FILE) -r "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/stylewindow.cpp" + -$(DEL_FILE) -r "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/main.cpp" + -$(DEL_FILE) -r "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/stylewindow.h" + -$(DEL_FILE) -r "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/stylewindow.pro" + -$(DEL_DIR) "$(INSTALL_ROOT)/tools/styleplugin/tqt3reference/" + + +install: install_target install_sources + +uninstall: uninstall_target uninstall_sources + diff --git a/tqt3reference/main.cpp b/tqt3reference/main.cpp new file mode 100644 index 0000000..9ce35a8 --- /dev/null +++ b/tqt3reference/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "stylewindow.h" + +//! [0] +int main(int argv, char *args[]) +{ + TQApplication app(argv, args); + + StyleWindow window; + window.resize(200, 200); + window.show(); + + return app.exec(); +} +//! [0] diff --git a/tqt3reference/stylewindow.cpp b/tqt3reference/stylewindow.cpp new file mode 100644 index 0000000..0a5ca48 --- /dev/null +++ b/tqt3reference/stylewindow.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stylewindow.h" + +StyleWindow::StyleWindow() +{ + TQGroupBox *styleBox = new TQGroupBox(10,TQt::Vertical,tr("A simple style button"),this); +// styleBox->resize(200,200); + + TQPushButton *styledButton = new TQPushButton(tr("Big Red Button"),styleBox); + TQRadioButton *styledRadioButton = new TQRadioButton(tr("Little Radio Button"),styleBox); + TQCheckBox *styledCheckBox = new TQCheckBox(tr("Little Check Box"),styleBox); + TQComboBox *styledComboBox = new TQComboBox(styleBox); + TQTextEdit *styledTextEdit = new TQTextEdit(styleBox); + TQProgressBar *styledProgressBar = new TQProgressBar(styleBox); + TQTabBar *styledTabBar = new TQTabBar(styleBox); + TQMainWindow *styledMainWindow = new TQMainWindow(this); + +// TQGridLayout *layout = new TQGridLayout(styleBox); +// layout->addWidget(styledButton,0,0); +// layout->addWidget(styledRadioButton,1,0); +// layout->addWidget(styledCheckBox,2,0); +// layout->addWidget(styledComboBox,3,0); +// layout->addWidget(styledTextEdit,4,0); +// layout->addWidget(styledProgressBar,5,0); +// layout->addWidget(styledTabBar,6,0); + + styledComboBox->insertItem("Hello"); + styledComboBox->insertItem("There"); + styledComboBox->insertItem("Raja!"); + styledTextEdit->setText("TEST"); + styledProgressBar->setTotalSteps(100); + styledProgressBar->setProgress(50); + + TQTab* tab1 = new TQTab("Tab 1"); + TQTab* tab2 = new TQTab("Tab 2"); + TQTab* tab3 = new TQTab("Tab Duplicate"); + TQTab* tab4 = new TQTab("Tab Duplicate"); + TQTab* tab5 = new TQTab("Tab Duplicate"); + TQTab* tab6 = new TQTab("Tab 3"); + TQTab* tab7 = new TQTab("Tab Duplicate"); + TQTab* tab8 = new TQTab("Tab Duplicate"); + + styledTabBar->addTab(tab1); + styledTabBar->addTab(tab2); + styledTabBar->addTab(tab3); + styledTabBar->addTab(tab4); + styledTabBar->addTab(tab5); + styledTabBar->addTab(tab6); + styledTabBar->addTab(tab7); + styledTabBar->addTab(tab8); + + TQToolBar *styledToolBar = new TQToolBar(styledMainWindow); + TQAction* toolbutton1 = new TQAction(styledToolBar); + toolbutton1->setText("Save"); + toolbutton1->addTo(styledToolBar); + + TQGridLayout *outerLayout = new TQGridLayout(this); + outerLayout->addWidget(styleBox, 0, 0); + +// setWindowTitle(tr("Style Plugin Example")); +} diff --git a/tqt3reference/stylewindow.h b/tqt3reference/stylewindow.h new file mode 100644 index 0000000..cd35077 --- /dev/null +++ b/tqt3reference/stylewindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLEWINDOW_H +#define STYLEWINDOW_H + +#include + +class StyleWindow : public TQWidget +{ + TQ_OBJECT + +public: + StyleWindow(); +}; + +#endif diff --git a/tqt3reference/stylewindow.pro b/tqt3reference/stylewindow.pro new file mode 100644 index 0000000..880e672 --- /dev/null +++ b/tqt3reference/stylewindow.pro @@ -0,0 +1,24 @@ +HEADERS = stylewindow.h +SOURCES = stylewindow.cpp \ + main.cpp + +TARGET = tqt3referencewindow +win32 { + debug:DESTDIR = ../debug/ + release:DESTDIR = ../release/ +} else { + DESTDIR = ../ +} + +INCLUDEPATH += /usr/include/tqt3 +INCLUDEPATH += /usr/include/tqt +INCLUDEPATH += /opt/trinity/include +LIBS += -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/tqt3reference +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS stylewindow.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/tqt3reference +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/unstyledwindow/Makefile b/unstyledwindow/Makefile new file mode 100644 index 0000000..f7cca12 --- /dev/null +++ b/unstyledwindow/Makefile @@ -0,0 +1,239 @@ +############################################################################# +# Makefile for building: ../unstyledplugin +# Generated by qmake (2.01a) (Qt 4.7.0) on: Sat Mar 10 16:06:19 2012 +# Project: unstyledwindow.pro +# Template: app +# Command: /usr/bin/qmake-qt4 -o Makefile unstyledwindow.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. +LINK = g++ +LFLAGS = -Wl,-O1 +LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = stylewindow.cpp \ + main.cpp moc_stylewindow.cpp +OBJECTS = stylewindow.o \ + main.o \ + moc_stylewindow.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + unstyledwindow.pro +QMAKE_TARGET = unstyledplugin +DESTDIR = ../ +TARGET = ../unstyledplugin + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + @$(CHK_DIR_EXISTS) ../ || $(MKDIR) ../ + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: unstyledwindow.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -o Makefile unstyledwindow.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile unstyledwindow.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/unstyledplugin1.0.0 || $(MKDIR) .tmp/unstyledplugin1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/unstyledplugin1.0.0/ && $(COPY_FILE) --parents stylewindow.h .tmp/unstyledplugin1.0.0/ && $(COPY_FILE) --parents stylewindow.cpp main.cpp .tmp/unstyledplugin1.0.0/ && (cd `dirname .tmp/unstyledplugin1.0.0` && $(TAR) unstyledplugin1.0.0.tar unstyledplugin1.0.0 && $(COMPRESS) unstyledplugin1.0.0.tar) && $(MOVE) `dirname .tmp/unstyledplugin1.0.0`/unstyledplugin1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/unstyledplugin1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_stylewindow.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_stylewindow.cpp +moc_stylewindow.cpp: stylewindow.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) stylewindow.h -o moc_stylewindow.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +stylewindow.o: stylewindow.cpp stylewindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o stylewindow.o stylewindow.cpp + +main.o: main.cpp stylewindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +moc_stylewindow.o: moc_stylewindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_stylewindow.o moc_stylewindow.cpp + +####### Install + +install_target: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/ + -$(INSTALL_PROGRAM) "../$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/$(QMAKE_TARGET)" + -$(STRIP) "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/$(QMAKE_TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/$(QMAKE_TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/ + + +install_sources: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/stylewindow.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/main.cpp $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/stylewindow.h $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + -$(INSTALL_FILE) /home/eldarion/experimental/qt4-tqt-theme-engine/unstyledwindow/unstyledwindow.pro $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + + +uninstall_sources: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/stylewindow.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/main.cpp + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/stylewindow.h + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/unstyledwindow.pro + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/examples/tools/unstyledplugin/unstyledwindow/ + + +install: install_target install_sources FORCE + +uninstall: uninstall_target uninstall_sources FORCE + +FORCE: + diff --git a/unstyledwindow/main.cpp b/unstyledwindow/main.cpp new file mode 100644 index 0000000..6e2ad29 --- /dev/null +++ b/unstyledwindow/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "stylewindow.h" + +//! [0] +int main(int argv, char *args[]) +{ + QApplication app(argv, args); + QApplication::setStyle(QStyleFactory::create("plastique")); + + StyleWindow window; + window.resize(200, 50); + window.show(); + + return app.exec(); +} +//! [0] diff --git a/unstyledwindow/stylewindow.cpp b/unstyledwindow/stylewindow.cpp new file mode 100644 index 0000000..7d3f5f1 --- /dev/null +++ b/unstyledwindow/stylewindow.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "stylewindow.h" + +StyleWindow::StyleWindow() +{ + QPushButton *styledButton = new QPushButton(tr("Big Red Button")); + QRadioButton *styledRadioButton = new QRadioButton(tr("Little Radio Button")); + QCheckBox *styledCheckBox = new QCheckBox(tr("Little Check Box")); + QComboBox *styledComboBox = new QComboBox(); + QTextEdit *styledTextEdit = new QTextEdit(); + QProgressBar *styledProgressBar = new QProgressBar(); + QTabBar *styledTabBar = new QTabBar(); + + QGridLayout *layout = new QGridLayout; + layout->addWidget(styledButton); + layout->addWidget(styledRadioButton); + layout->addWidget(styledCheckBox); + layout->addWidget(styledComboBox); + layout->addWidget(styledTextEdit); + layout->addWidget(styledProgressBar); + layout->addWidget(styledTabBar); + + styledComboBox->addItem("Hello"); + styledComboBox->addItem("There"); + styledComboBox->addItem("Raja!"); + styledTextEdit->setText("TEST"); + styledProgressBar->setMaximum(100); + styledProgressBar->setValue(50); + styledTabBar->addTab("Tab 1"); + styledTabBar->addTab("Tab 2"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab 3"); + styledTabBar->addTab("Tab Duplicate"); + styledTabBar->addTab("Tab Duplicate"); + + QGroupBox *styleBox = new QGroupBox(tr("A simple style button")); + styleBox->setLayout(layout); + + QGridLayout *outerLayout = new QGridLayout; + outerLayout->addWidget(styleBox, 0, 0); + setLayout(outerLayout); + + setWindowTitle(tr("Style Plugin Example")); +} diff --git a/unstyledwindow/stylewindow.h b/unstyledwindow/stylewindow.h new file mode 100644 index 0000000..aed21c7 --- /dev/null +++ b/unstyledwindow/stylewindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLEWINDOW_H +#define STYLEWINDOW_H + +#include + +class StyleWindow : public QWidget +{ + Q_OBJECT + +public: + StyleWindow(); +}; + +#endif diff --git a/unstyledwindow/unstyledwindow.pro b/unstyledwindow/unstyledwindow.pro new file mode 100644 index 0000000..e7a2ef4 --- /dev/null +++ b/unstyledwindow/unstyledwindow.pro @@ -0,0 +1,19 @@ +HEADERS = stylewindow.h +SOURCES = stylewindow.cpp \ + main.cpp + +TARGET = unstyledplugin +win32 { + debug:DESTDIR = ../debug/ + release:DESTDIR = ../release/ +} else { + DESTDIR = ../ +} + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/unstyledplugin +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS unstyledwindow.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/unstyledplugin/unstyledwindow +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)