diff options
Diffstat (limited to 'src')
118 files changed, 1579 insertions, 1455 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index ce5518f..711beb4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -521,7 +521,7 @@ PassRefPtr<LabelScope> BytecodeGenerator::newLabelScope(LabelScope::Type type, c m_labelScopes.removeLast(); // Allocate new label scope. - LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>()); // Only loops have continue targets. + LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>(0)); // Only loops have continue targets. m_labelScopes.append(scope); return &m_labelScopes.last(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 06ddefc..29a13ca 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -34,7 +34,7 @@ namespace JSC { RegisterFile::~RegisterFile() { #if HAVE(MMAP) - munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); + munmap(reinterpret_cast<char*>(m_buffer), ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); #elif HAVE(VIRTUALALLOC) VirtualFree(m_buffer, 0, MEM_RELEASE); #else diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h index 5a34d11..14e189e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h @@ -105,7 +105,7 @@ namespace JSC { ReturnValueRegister = -4, ArgumentCount = -3, Callee = -2, - OptionalCalleeArguments = -1, + OptionalCalleeArguments = -1 }; enum { ProgramCodeThisRegister = -CallFrameHeaderSize - 1 }; @@ -174,7 +174,7 @@ namespace JSC { size_t bufferLength = (capacity + maxGlobals) * sizeof(Register); #if HAVE(MMAP) - m_buffer = static_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, VM_TAG_FOR_REGISTERFILE_MEMORY, 0)); + m_buffer = reinterpret_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, VM_TAG_FOR_REGISTERFILE_MEMORY, 0)); if (m_buffer == MAP_FAILED) { #if PLATFORM(WINCE) fprintf(stderr, "Could not allocate register file: %d\n", GetLastError()); diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h index c256190..a4374d3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h +++ b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h @@ -27,23 +27,6 @@ namespace JSC { - inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData) - { - ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size)); - globalData->parser->arena().deleteWithArena(deletable); - return deletable; - } - - inline void* ParserArenaDeletable::operator new(size_t size) - { - return fastMalloc(size); - } - - inline void ParserArenaDeletable::operator delete(void* p) - { - fastFree(p); - } - inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData) { globalData->parser->arena().derefWithArena(adoptRef(this)); diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp index 2617506..78c5196 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "Parser.h" #include "ParserArena.h" #include "Nodes.h" @@ -57,4 +58,21 @@ void ParserArena::reset() m_refCountedObjects.shrink(0); } +void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData) +{ + ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size)); + globalData->parser->arena().deleteWithArena(deletable); + return deletable; +} + +void* ParserArenaDeletable::operator new(size_t size) +{ + return fastMalloc(size); +} + +void ParserArenaDeletable::operator delete(void* p) +{ + fastFree(p); +} + } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index dddd83d..1268d3d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -506,6 +506,49 @@ static void* getStackBase(void* previousFrame) } } #endif +#if PLATFORM(HPUX) +struct hpux_get_stack_base_data +{ + pthread_t thread; + _pthread_stack_info info; +}; + +static void *hpux_get_stack_base_internal(void *d) +{ + hpux_get_stack_base_data *data = static_cast<hpux_get_stack_base_data *>(d); + + // _pthread_stack_info_np requires the target thread to be suspended + // in order to get information about it + pthread_suspend(data->thread); + + // _pthread_stack_info_np returns an errno code in case of failure + // or zero on success + if (_pthread_stack_info_np(data->thread, &data->info)) { + // failed + return 0; + } + + pthread_continue(data->thread); + return data; +} + +static void *hpux_get_stack_base() +{ + hpux_get_stack_base_data data; + data.thread = pthread_self(); + + // We cannot get the stack information for the current thread + // So we start a new thread to get that information and return it to us + pthread_t other; + pthread_create(&other, 0, hpux_get_stack_base_internal, &data); + + void *result; + pthread_join(other, &result); + if (result) + return data.info.stk_stack_base; + return 0; +} +#endif static inline void* currentThreadStackBase() { @@ -532,10 +575,24 @@ static inline void* currentThreadStackBase() : "=r" (pTib) ); return static_cast<void*>(pTib->StackBase); +#elif PLATFORM(HPUX) + return hpux_get_stack_base(); #elif PLATFORM(SOLARIS) stack_t s; thr_stksegment(&s); return s.ss_sp; +#elif PLATFORM(AIX) + pthread_t thread = pthread_self(); + struct __pthrdsinfo threadinfo; + char regbuf[256]; + int regbufsize = sizeof regbuf; + + if (pthread_getthrds_np(&thread, PTHRDSINFO_QUERY_ALL, + &threadinfo, sizeof threadinfo, + ®buf, ®bufsize) == 0) + return threadinfo.__pi_stackaddr; + + return 0; #elif PLATFORM(OPENBSD) pthread_t thread = pthread_self(); stack_t stack; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h index 224164d..6e7984c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h @@ -98,7 +98,7 @@ namespace JSC { JSValue get() const { return m_value; } operator JSValue() const { return m_value; } - JSValue operator->() const { return m_value; } + //JSValue operator->() const { return m_value; } operator bool() const { return m_value; } bool operator!() const { return !m_value; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 9f6b0c3..38c086e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -160,7 +160,7 @@ Structure::~Structure() m_previous->m_transitions.singleTransition = 0; } else { ASSERT(m_previous->m_transitions.table->contains(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious)))); - m_previous->m_transitions.table->remove(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious))); + m_previous->m_transitions.table->remove(make_pair<RefPtr<UString::Rep>, std::pair<unsigned,JSCell*> >(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious))); } } @@ -394,7 +394,7 @@ PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Struct return existingTransition; } } else { - if (Structure* existingTransition = structure->m_transitions.table->get(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)))) { + if (Structure* existingTransition = structure->m_transitions.table->get(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(propertyName.ustring().rep(), make_pair(attributes, specificValue)))) { ASSERT(existingTransition->m_offset != noOffset); offset = existingTransition->m_offset; return existingTransition; @@ -459,9 +459,9 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con structure->m_usingSingleTransitionSlot = false; StructureTransitionTable* transitionTable = new StructureTransitionTable; structure->m_transitions.table = transitionTable; - transitionTable->add(make_pair(existingTransition->m_nameInPrevious.get(), make_pair(existingTransition->m_attributesInPrevious, existingTransition->m_specificValueInPrevious)), existingTransition); + transitionTable->add(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(existingTransition->m_nameInPrevious.get(), make_pair(existingTransition->m_attributesInPrevious, existingTransition->m_specificValueInPrevious)), existingTransition); } - structure->m_transitions.table->add(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)), transition.get()); + structure->m_transitions.table->add(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(propertyName.ustring().rep(), make_pair(attributes, specificValue)), transition.get()); return transition.release(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h index 3de5ee6..8ff9170 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h @@ -178,7 +178,10 @@ namespace WTF { HashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + typename HashMap<T, U, V, W, X>::iterator temp = p.first; + return make_pair<typename HashMap<T, U, V, W, X>::iterator, bool>(temp, p.second); +// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h index 990670d..ec809e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h @@ -204,7 +204,12 @@ namespace WTF { template<typename T, typename U, typename V> pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value) { - return m_impl.add(value); + pair<typename HashTable<T, T, IdentityExtractor<T>, U, V, V>::iterator, bool> p = m_impl.add(value); + typename HashSet<T, U, V>::iterator temp = p.first; + pair<typename HashSet<T, U, V>::iterator, bool> p2 = make_pair<typename HashSet<T, U, V>::iterator, bool>(temp, p.second); + // p2.first = p.first; + // p2.second = p.second; + return p2; } template<typename Value, typename HashFunctions, typename Traits> @@ -213,7 +218,8 @@ namespace WTF { HashSet<Value, HashFunctions, Traits>::add(const T& value) { typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter; - return m_impl.template addPassingHashCode<T, T, Adapter>(value, value); + pair<typename HashTableType::iterator, bool> p = m_impl.template addPassingHashCode<T, T, Adapter>(value, value); + return make_pair<iterator, bool>(p.first, p.second); } template<typename T, typename U, typename V> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h index 01ce804..b8305b5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h @@ -34,7 +34,9 @@ namespace WTF { class Mutex; -typedef void MainThreadFunction(void*); +extern "C" { + typedef void MainThreadFunction(void*); +} void callOnMainThread(MainThreadFunction*, void* context); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 12291cc..070b76c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -41,7 +41,7 @@ namespace WTF { enum MessageQueueWaitResult { MessageQueueTerminated, // Queue was destroyed while waiting for message. MessageQueueTimeout, // Timeout was specified and it expired. - MessageQueueMessageReceived, // A message was successfully received and returned. + MessageQueueMessageReceived // A message was successfully received and returned. }; template<typename DataType> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index e531a63..e1e4ba3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -106,6 +106,9 @@ /* regardless of operating environment */ #if defined(hpux) || defined(__hpux) #define WTF_PLATFORM_HPUX 1 +#ifndef MAP_ANON +#define MAP_ANON MAP_ANONYMOUS +#endif #endif #if defined (__SYMBIAN32__) @@ -301,6 +304,30 @@ #define WTF_PLATFORM_BIG_ENDIAN 1 #endif +/* PLATFORM(HPPA) */ +/* a.k.a. PA-RISC */ +#if defined(__hppa) || defined(__hppa__) +#define WTF_PLATFORM_HPPA 1 +#define WTF_PLATFORM_BIG_ENDIAN 1 +#endif + +/* PLATFORM(IA64) */ +/* a.k.a. Itanium Processor Family, IPF */ +#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) +#define WTF_PLATFORM_IA64 1 + +/* Itanium can be both big- and little-endian + we need to determine at compile time which one it is. + - HP's aCC compiler only compiles big-endian (so HP-UXi is always big-endian) + - GCC defines __BIG_ENDIAN__ for us (default on HP-UX) + - Linux is usually little-endian + - I've never seen AIX or Windows on IA-64, but they should be little-endian too +*/ +#if defined(__BIG_ENDIAN__) || defined(__HP_aCC) +# define WTF_PLATFORM_BIG_ENDIAN 1 +#endif +#endif + /* PLATFORM(WINCE) && PLATFORM(QT) We can not determine the endianess at compile time. For Qt for Windows CE the endianess is specified in the @@ -474,7 +501,7 @@ #endif #if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) + && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h index 1cbebb4..b3ccd3a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h @@ -42,7 +42,7 @@ namespace WTF { }; template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> { + class RefPtrHashMap { private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; @@ -67,7 +67,7 @@ namespace WTF { typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator; - void swap(HashMap&); + void swap(RefPtrHashMap&); int size() const; int capacity() const; @@ -115,109 +115,123 @@ namespace WTF { HashTableType m_impl; }; + template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> + class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : + public RefPtrHashMap<T, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> + { + }; template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other) + inline void RefPtrHashMap<T, U, V, W, X>::swap(RefPtrHashMap& other) { m_impl.swap(other.m_impl); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::size() const + inline int RefPtrHashMap<T, U, V, W, X>::size() const { return m_impl.size(); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const + inline int RefPtrHashMap<T, U, V, W, X>::capacity() const { return m_impl.capacity(); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const + inline bool RefPtrHashMap<T, U, V, W, X>::isEmpty() const { return m_impl.isEmpty(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::begin() { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::end() { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::begin() const { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::end() const { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) const { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) const { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(const KeyType& key) const { return m_impl.contains(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(RawKeyType key) const { return m_impl.template contains<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); +// typename RefPtrHashMap<T, U, V, W, X>::iterator temp = p.first; + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); + +// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) { - return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); + + // return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -228,8 +242,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -240,22 +254,22 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key); if (!entry) @@ -264,8 +278,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + inline RefPtrHashMap<T, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<RawKeyType, RawKeyTranslator>(key); if (!entry) @@ -274,14 +288,14 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(RawKeyType key) const { return inlineGet(key); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it) + inline void RefPtrHashMap<T, U, V, W, X>::remove(iterator it) { if (it.m_impl == m_impl.end()) return; @@ -290,45 +304,45 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(const KeyType& key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(RawKeyType key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::clear() + inline void RefPtrHashMap<T, U, V, W, X>::clear() { m_impl.clear(); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(RawKeyType key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 6ce6a3e..56659a8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -70,30 +70,30 @@ namespace WTF { template <> struct IsPod<long double> { static const bool value = true; }; template <typename P> struct IsPod<P*> { static const bool value = true; }; - template<typename T> class IsConvertibleToInteger { - // Avoid "possible loss of data" warning when using Microsoft's C++ compiler - // by not converting int's to doubles. - template<bool performCheck, typename U> class IsConvertibleToDouble; - template<typename U> class IsConvertibleToDouble<false, U> { - public: - static const bool value = false; - }; + // Avoid "possible loss of data" warning when using Microsoft's C++ compiler + // by not converting int's to doubles. + template<bool performCheck, typename U> class CheckedIsConvertibleToDouble; + template<typename U> class CheckedIsConvertibleToDouble<false, U> { + public: + static const bool value = false; + }; - template<typename U> class IsConvertibleToDouble<true, U> { - typedef char YesType; - struct NoType { - char padding[8]; - }; - - static YesType floatCheck(long double); - static NoType floatCheck(...); - static T& t; - public: - static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); + template<typename U> class CheckedIsConvertibleToDouble<true, U> { + typedef char YesType; + struct NoType { + char padding[8]; }; + static YesType floatCheck(long double); + static NoType floatCheck(...); + static U& t; + public: + static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); + }; + + template<typename T> class IsConvertibleToInteger { public: - static const bool value = IsInteger<T>::value || IsConvertibleToDouble<!IsInteger<T>::value, T>::value; + static const bool value = IsInteger<T>::value || CheckedIsConvertibleToDouble<!IsInteger<T>::value, T>::value; }; template <typename T, typename U> struct IsSameType { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index e3cb718..7decc4a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -67,10 +67,11 @@ namespace WTF { template <size_t size, size_t> struct AlignedBuffer { AlignedBufferChar oversizebuffer[size + 64]; - AlignedBufferChar *buffer; - inline AlignedBuffer() : buffer(oversizebuffer) + AlignedBufferChar *buffer() { - buffer += 64 - (reinterpret_cast<size_t>(buffer) & 0x3f); + AlignedBufferChar *ptr = oversizebuffer; + ptr += 64 - (reinterpret_cast<size_t>(ptr) & 0x3f); + return ptr; } }; #endif @@ -128,7 +129,7 @@ namespace WTF { template<typename T> struct VectorMover<false, T> { - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { while (src != srcEnd) { new (dst) T(*src); @@ -137,7 +138,7 @@ namespace WTF { ++src; } } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { if (src > dst) move(src, srcEnd, dst); @@ -156,11 +157,11 @@ namespace WTF { template<typename T> struct VectorMover<true, T> { - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } @@ -253,12 +254,12 @@ namespace WTF { VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end); } - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst); } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst); } @@ -440,7 +441,11 @@ namespace WTF { using Base::m_capacity; static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); + #ifdef WTF_ALIGNED T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer); } + #else + T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer()); } + #endif AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 07fed86..2ff657e 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -350,9 +350,10 @@ typedef enum { NPPVpluginWantsAllNetworkStreams = 18, /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ - NPPVpluginCancelSrcStream = 20, + NPPVpluginCancelSrcStream = 20 #ifdef XP_MACOSX + , /* Used for negotiating drawing models */ NPPVpluginDrawingModel = 1000, /* Used for negotiating event models */ diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h index 58b18e2..08bffa6 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h @@ -57,7 +57,7 @@ namespace WebCore { NETWORK_ERR = 19, ABORT_ERR = 20, URL_MISMATCH_ERR = 21, - QUOTA_EXCEEDED_ERR = 22, + QUOTA_EXCEEDED_ERR = 22 }; enum ExceptionType { diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h index 3f8febc..f95f0045 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h @@ -45,7 +45,7 @@ namespace WebCore { enum MessageDestination { InspectorControllerDestination, - ConsoleDestination, + ConsoleDestination }; class ScriptExecutionContext { diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp index 9737e92..dcb3326 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp @@ -795,7 +795,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It // shouldn't matter though, since moved paragraphs will usually be quite small. - RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : 0; + RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : PassRefPtr<DocumentFragment>(0); // A non-empty paragraph's style is moved when we copy and move it. We don't move // anything if we're given an empty paragraph, but an empty paragraph can have style diff --git a/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h b/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h index 5b732dc..b8b137d 100644 --- a/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h +++ b/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h @@ -32,7 +32,7 @@ namespace WebCore { enum EditorInsertAction { EditorInsertActionTyped, EditorInsertActionPasted, - EditorInsertActionDropped, + EditorInsertActionDropped }; } // namespace diff --git a/src/3rdparty/webkit/WebCore/editing/markup.cpp b/src/3rdparty/webkit/WebCore/editing/markup.cpp index 6b6d326..1c737a0 100644 --- a/src/3rdparty/webkit/WebCore/editing/markup.cpp +++ b/src/3rdparty/webkit/WebCore/editing/markup.cpp @@ -970,7 +970,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc Node* body = enclosingNodeWithTag(Position(commonAncestor, 0), bodyTag); // FIXME: Do this for all fully selected blocks, not just the body. Node* fullySelectedRoot = body && *VisibleSelection::selectionFromContentsOfNode(body).toNormalizedRange() == *updatedRange ? body : 0; - RefPtr<CSSMutableStyleDeclaration> fullySelectedRootStyle = fullySelectedRoot ? styleFromMatchedRulesAndInlineDecl(fullySelectedRoot) : 0; + RefPtr<CSSMutableStyleDeclaration> fullySelectedRootStyle = fullySelectedRoot ? styleFromMatchedRulesAndInlineDecl(fullySelectedRoot) : PassRefPtr<CSSMutableStyleDeclaration>(0); if (annotate && fullySelectedRoot) { if (shouldIncludeWrapperForFullySelectedRoot(fullySelectedRoot, fullySelectedRootStyle.get())) specialCommonAncestor = fullySelectedRoot; diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h index cc3627d..fdd854c 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h @@ -275,7 +275,7 @@ enum CSSPropertyID { CSSPropertyGlyphOrientationVertical = 1268, CSSPropertyKerning = 1269, CSSPropertyTextAnchor = 1270, - CSSPropertyWritingMode = 1271, + CSSPropertyWritingMode = 1271 }; const int firstCSSProperty = 1001; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp index 722f4e2..928a1bf 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp @@ -137,7 +137,7 @@ HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors) , m_reportErrors(reportErrors) , m_handlingResidualStyleAcrossBlocks(false) , m_inStrayTableContent(0) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : PassOwnPtr<HTMLParserQuirks>(0)) { } @@ -155,7 +155,7 @@ HTMLParser::HTMLParser(DocumentFragment* frag) , m_reportErrors(false) , m_handlingResidualStyleAcrossBlocks(false) , m_inStrayTableContent(0) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : PassOwnPtr<HTMLParserQuirks>(0)) { if (frag) frag->ref(); diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp index 87cb725..812d17b 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp @@ -519,7 +519,7 @@ ArchiveResource* DocumentLoader::archiveResourceForURL(const KURL& url) const PassRefPtr<Archive> DocumentLoader::popArchiveForSubframe(const String& frameName) { - return m_archiveResourceCollection ? m_archiveResourceCollection->popSubframeArchive(frameName) : 0; + return m_archiveResourceCollection ? m_archiveResourceCollection->popSubframeArchive(frameName) : PassRefPtr<Archive>(0); } void DocumentLoader::clearArchiveResources() diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index 58bf2c0..c41e491 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -355,7 +355,7 @@ namespace WebCore { enum LocalLoadPolicy { AllowLocalLoadsForAll, // No restriction on local loads. AllowLocalLoadsForLocalAndSubstituteData, - AllowLocalLoadsForLocalOnly, + AllowLocalLoadsForLocalOnly }; static void setLocalLoadPolicy(LocalLoadPolicy); static bool restrictAccessToLocal(); diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h index c264b47..b3823ba 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h @@ -42,7 +42,7 @@ namespace WebCore { enum PolicyAction { PolicyUse, PolicyDownload, - PolicyIgnore, + PolicyIgnore }; enum FrameLoadType { diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp index dc73353..fd6a8b4 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -772,7 +772,7 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize); } - RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; + RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>(0) : m_newestCache; setNewestCache(m_cacheBeingUpdated.release()); if (cacheStorage().storeNewestCache(this)) { diff --git a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp index 1322dbb..753c3c3 100644 --- a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp +++ b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp @@ -75,7 +75,7 @@ bool ArchiveFactory::isArchiveMimeType(const String& mimeType) PassRefPtr<Archive> ArchiveFactory::create(SharedBuffer* data, const String& mimeType) { RawDataCreationFunction* function = archiveMIMETypes().get(mimeType); - return function ? function(data) : 0; + return function ? function(data) : PassRefPtr<Archive>(0); } void ArchiveFactory::registerKnownArchiveMIMETypes() diff --git a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp index 691f66a..b6317da 100644 --- a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp +++ b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp @@ -35,17 +35,17 @@ namespace WebCore { PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) { - return data ? adoptRef(new ArchiveResource(data, url, response)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, response)) : PassRefPtr<ArchiveResource>(0); } PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName) { - return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName)) : PassRefPtr<ArchiveResource>(0); } PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse& resourceResponse) { - return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse)) : PassRefPtr<ArchiveResource>(0); } ArchiveResource::ArchiveResource(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp index b78291d..7201661 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp @@ -511,7 +511,7 @@ void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, if (!isOpen() || iconURLOriginal.isEmpty()) return; - RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : 0; + RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0); String iconURL = iconURLOriginal.copy(); Vector<String> pageURLs; diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp index e8f9004..c54aab2 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp @@ -582,7 +582,7 @@ Storage* DOMWindow::localStorage() const return 0; StorageNamespace* localStorage = page->group().localStorage(); - RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : 0; + RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : PassRefPtr<StorageArea>(0); if (storageArea) { page->inspectorController()->didUseDOMStorage(storageArea.get(), true, m_frame); m_localStorage = Storage::create(m_frame, storageArea.release()); diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp index dad763c..8769a59 100644 --- a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp +++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp @@ -144,7 +144,7 @@ static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra for (unsigned i = 0; i < size; i++) { RefPtr<TransformOperation> fromOp = (i < fromSize) ? from.operations()[i].get() : 0; RefPtr<TransformOperation> toOp = (i < toSize) ? to.operations()[i].get() : 0; - RefPtr<TransformOperation> blendedOp = toOp ? toOp->blend(fromOp.get(), progress) : (fromOp ? fromOp->blend(0, progress, true) : 0); + RefPtr<TransformOperation> blendedOp = toOp ? toOp->blend(fromOp.get(), progress) : (fromOp ? fromOp->blend(0, progress, true) : PassRefPtr<TransformOperation>(0)); if (blendedOp) result.operations().append(blendedOp); else { diff --git a/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h b/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h index 4a6bc9e..d9701b7 100644 --- a/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h +++ b/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h @@ -81,7 +81,7 @@ namespace WebCore { AltKey = 1 << 0, CtrlKey = 1 << 1, MetaKey = 1 << 2, - ShiftKey = 1 << 3, + ShiftKey = 1 << 3 }; Type type() const { return m_type; } diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h b/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h index eba9055..b0df470 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h @@ -53,7 +53,7 @@ namespace WebCore { enum ScrollbarControlStateMask { ActiveScrollbarState = 1, EnabledScrollbarState = 1 << 1, - PressedScrollbarState = 1 << 2, + PressedScrollbarState = 1 << 2 }; enum ScrollbarPart { @@ -67,7 +67,7 @@ namespace WebCore { ForwardButtonEndPart = 1 << 6, ScrollbarBGPart = 1 << 7, TrackBGPart = 1 << 8, - AllParts = 0xffffffff, + AllParts = 0xffffffff }; enum ScrollbarButtonsPlacement { diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h index 8b770a1..a3a0493 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h @@ -150,7 +150,7 @@ protected: enum RepetitionCountStatus { Unknown, // We haven't checked the source's repetition count. Uncertain, // We have a repetition count, but it might be wrong (some GIFs have a count after the image data, and will report "loop once" until all data has been decoded). - Certain, // The repetition count is known to be correct. + Certain // The repetition count is known to be correct. }; BitmapImage(NativeImagePtr, ImageObserver* = 0); diff --git a/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h b/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h index 9c2a9d7..494e2bb 100644 --- a/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h +++ b/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h @@ -52,7 +52,7 @@ namespace WebCore { DisposeNotSpecified, // Leave frame in framebuffer DisposeKeep, // Leave frame in framebuffer DisposeOverwriteBgcolor, // Clear frame to transparent - DisposeOverwritePrevious, // Clear frame to previous framebuffer contents + DisposeOverwritePrevious // Clear frame to previous framebuffer contents }; #if PLATFORM(SKIA) typedef uint32_t PixelData; diff --git a/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h b/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h index 9a73cff..b7d4574 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h @@ -46,7 +46,7 @@ enum ProtectionSpaceAuthenticationScheme { ProtectionSpaceAuthenticationSchemeHTTPDigest = 3, ProtectionSpaceAuthenticationSchemeHTMLForm = 4, ProtectionSpaceAuthenticationSchemeNTLM = 5, - ProtectionSpaceAuthenticationSchemeNegotiate = 6, + ProtectionSpaceAuthenticationSchemeNegotiate = 6 }; class ProtectionSpace { diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h index c99be54..b8a8cbb 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h @@ -56,7 +56,7 @@ namespace WebCore { enum CacheStoragePolicy { StorageAllowed, StorageAllowedInMemoryOnly, - StorageNotAllowed, + StorageNotAllowed }; class ResourceHandleClient { diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h index 2d87d6e..740ebed 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h @@ -41,7 +41,7 @@ namespace WebCore { UseProtocolCachePolicy, // normal load ReloadIgnoringCacheData, // reload ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data - ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache + ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache }; const int unspecifiedTimeoutInterval = INT_MAX; diff --git a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h index 38439ed..4325925 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h +++ b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h @@ -199,7 +199,7 @@ private: enum StringImplFlags { HasTerminatingNullCharacter, - InTable, + InTable }; unsigned m_length; diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h index 3c74165..36d7c6e 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h +++ b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h @@ -51,7 +51,7 @@ namespace WebCore { // Encodes the character as en entity as above, but escaped // non-alphanumeric characters. This is used in URLs. // For example, U+6DE would be "%26%231758%3B". - URLEncodedEntitiesForUnencodables, + URLEncodedEntitiesForUnencodables }; typedef char UnencodableReplacementArray[32]; diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h b/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h index b652c6e..8183050 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h @@ -45,7 +45,7 @@ namespace WebCore { PluginQuirkDontClipToZeroRectWhenScrolling = 1 << 9, PluginQuirkDontSetNullWindowHandleOnDestroy = 1 << 10, PluginQuirkDontAllowMultipleInstances = 1 << 11, - PluginQuirkRequiresGtkToolKit = 1 << 12, + PluginQuirkRequiresGtkToolKit = 1 << 12 }; class PluginQuirkSet { diff --git a/src/3rdparty/webkit/WebCore/plugins/npapi.cpp b/src/3rdparty/webkit/WebCore/plugins/npapi.cpp index 4135b64..d275a39 100644 --- a/src/3rdparty/webkit/WebCore/plugins/npapi.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/npapi.cpp @@ -171,7 +171,9 @@ void NPN_PopPopupsEnabledState(NPP instance) pluginViewForInstance(instance)->popPopupsEnabledState(); } +extern "C" { void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData) { PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData); } +} diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp index 4b6d291..d92746b 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp @@ -3211,7 +3211,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*) void RenderLayer::updateScrollCornerStyle() { RenderObject* actualRenderer = renderer()->node() ? renderer()->node()->shadowAncestorNode()->renderer() : renderer(); - RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, actualRenderer->style()) : 0; + RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0); if (corner) { if (!m_scrollCorner) { m_scrollCorner = new (renderer()->renderArena()) RenderScrollbarPart(renderer()->document()); @@ -3227,7 +3227,7 @@ void RenderLayer::updateScrollCornerStyle() void RenderLayer::updateResizerStyle() { RenderObject* actualRenderer = renderer()->node() ? renderer()->node()->shadowAncestorNode()->renderer() : renderer(); - RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(RESIZER, actualRenderer->style()) : 0; + RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(RESIZER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0); if (resizer) { if (!m_resizer) { m_resizer = new (renderer()->renderArena()) RenderScrollbarPart(renderer()->document()); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h index 1772c66..541002f 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h @@ -298,7 +298,7 @@ public: enum UpdateLayerPositionsFlag { DoFullRepaint = 1, CheckForRepaint = 1 << 1, - UpdateCompositingLayers = 1 << 2, + UpdateCompositingLayers = 1 << 2 }; typedef unsigned UpdateLayerPositionsFlags; void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | UpdateCompositingLayers); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp index db24a06..32cea92 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp @@ -183,7 +183,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) if (partType == NoPart) return; - RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : 0; + RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(0); bool needRenderer = !destroy && partStyle && partStyle->display() != NONE && partStyle->visibility() == VISIBLE; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp index 7da9e5a..1d8fca6 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp @@ -28,7 +28,7 @@ namespace WebCore { RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str, int startOffset, int length) - : RenderText(node, str ? str->substring(startOffset, length) : 0) + : RenderText(node, str ? str->substring(startOffset, length) : PassRefPtr<StringImpl>(0)) , m_start(startOffset) , m_end(length) , m_firstLetter(0) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp index 3a7d3d4..a04b095 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp @@ -214,7 +214,7 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents) event->setTarget(currentTarget); currentTarget->dispatchGenericEvent(event.release()); } - currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : 0; + currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>(0); } } diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.cpp b/src/3rdparty/webkit/WebCore/workers/Worker.cpp index 866687f..22c7d71 100644 --- a/src/3rdparty/webkit/WebCore/workers/Worker.cpp +++ b/src/3rdparty/webkit/WebCore/workers/Worker.cpp @@ -74,7 +74,7 @@ void Worker::postMessage(const String& message, ExceptionCode& ec) void Worker::postMessage(const String& message, MessagePort* messagePort, ExceptionCode& ec) { // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : 0; + OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : PassOwnPtr<MessagePortChannel>(0); if (ec) return; m_contextProxy->postMessageToWorkerContext(message, channel.release()); diff --git a/src/corelib/arch/i386/qatomic_i386.s b/src/corelib/arch/i386/qatomic_i386.s index 63facc1..08158f9 100644 --- a/src/corelib/arch/i386/qatomic_i386.s +++ b/src/corelib/arch/i386/qatomic_i386.s @@ -1,43 +1,3 @@ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! -!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -!! Contact: Nokia Corporation (qt-info@nokia.com) -!! -!! This file is part of the QtGui module of the Qt Toolkit. -!! -!! $QT_BEGIN_LICENSE:LGPL$ -!! No Commercial Usage -!! This file contains pre-release code and may not be distributed. -!! You may use this file in accordance with the terms and conditions -!! contained in the Technology Preview License Agreement accompanying -!! this package. -!! -!! GNU Lesser General Public License Usage -!! Alternatively, this file may be used under the terms of the GNU Lesser -!! General Public License version 2.1 as published by the Free Software -!! Foundation and appearing in the file LICENSE.LGPL included in the -!! packaging of this file. Please review the following information to -!! ensure the GNU Lesser General Public License version 2.1 requirements -!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -!! -!! In addition, as a special exception, Nokia gives you certain -!! additional rights. These rights are described in the Nokia Qt LGPL -!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -!! package. -!! -!! If you have questions regarding the use of this file, please contact -!! Nokia at qt-info@nokia.com. -!! -!! -!! -!! -!! -!! -!! -!! -!! $QT_END_LICENSE$ -!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .text .align 4,0x90 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d279891..a2c532f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1364,7 +1364,7 @@ inline void qt_noop() {} #ifdef QT_BOOTSTRAPPED # define QT_NO_EXCEPTIONS #endif -#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS) +#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) # define QT_NO_EXCEPTIONS #endif diff --git a/src/gui/dialogs/qdialog_p.h b/src/gui/dialogs/qdialog_p.h index 5239d09..a90d6e6 100644 --- a/src/gui/dialogs/qdialog_p.h +++ b/src/gui/dialogs/qdialog_p.h @@ -98,7 +98,7 @@ public: #endif #ifdef Q_WS_MAC - virtual void mac_nativeDialogModalHelp(){}; + virtual void mac_nativeDialogModalHelp() {} #endif int rescode; diff --git a/src/gui/dialogs/qfiledialog_embedded.ui b/src/gui/dialogs/qfiledialog_embedded.ui index 1bd189e..f134f64 100644 --- a/src/gui/dialogs/qfiledialog_embedded.ui +++ b/src/gui/dialogs/qfiledialog_embedded.ui @@ -2,6 +2,7 @@ <comment>********************************************************************* ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 54e0046..cb19511 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -193,12 +193,12 @@ public: description(desc), selected(-1), selDescription(0), - parentItem(pi) {}; + parentItem(pi) {} ~QOptionTreeItem() { while (!childItems.isEmpty()) delete childItems.takeFirst(); - }; + } ItemType type; int index; @@ -238,8 +238,8 @@ class QPPDOptionsEditor : public QStyledItemDelegate { Q_OBJECT public: - QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {}; - ~QPPDOptionsEditor() {}; + QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {} + ~QPPDOptionsEditor() {} QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const; void setEditorData(QWidget* editor, const QModelIndex& index) const; diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index aee7834..61aa21a 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -292,7 +292,7 @@ class QGraphicsOpacityEffectPrivate; class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect { Q_OBJECT - Q_PROPERTY(int opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged) public: QGraphicsOpacityEffect(QObject *parent = 0); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index b64f787..098407c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -170,7 +170,7 @@ struct AnchorData : public QSimplexVariable { skipInPreferred(0), type(Normal), hasSize(false), isLayoutAnchor(false) {} - virtual void updateChildrenSizes() { }; + virtual void updateChildrenSizes() {} virtual void refreshSizeHints(qreal effectiveSpacing); virtual ~AnchorData() {} @@ -299,7 +299,7 @@ struct ParallelAnchorData : public AnchorData class GraphPath { public: - GraphPath() {}; + GraphPath() {} QSimplexConstraint *constraint(const GraphPath &path) const; #ifdef QT_DEBUG diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b7c2e26..cdcb0c4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -303,13 +303,17 @@ drop shadow effects and for decoration objects that follow the parent item's geometry without drawing on top of it. - \value ItemUsesExtendedStyleOption The item makes use of either the - exposedRect or matrix member of the QStyleOptionGraphicsItem. Implementers - of QGraphicsItem subclasses should set that flag if this data is required. - By default, the exposedRect is initialized to the item's boundingRect and - the matrix is untransformed. Enable this flag for more fine-grained values. - Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() for a more - fine-grained value. + \value ItemUsesExtendedStyleOption The item makes use of either + \l{QStyleOptionGraphicsItem::}{exposedRect} or + \l{QStyleOptionGraphicsItem::}{matrix} in QStyleOptionGraphicsItem. By default, + the \l{QStyleOptionGraphicsItem::}{exposedRect} is initialized to the item's + boundingRect() and the \l{QStyleOptionGraphicsItem::}{matrix} is untransformed. + You can enable this flag for the style options to be set up with more + fine-grained values. + Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag + and always initialized to 1. Use + QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need a higher + value. \value ItemHasNoContents The item does not paint anything (i.e., calling paint() on the item has no effect). You should set this flag on items that diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 2ac1dca..5dd71e2 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4616,7 +4616,8 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b return; } - bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; + bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents + && !item->d_ptr->graphicsEffect; if (!hasNoContents) { item->d_ptr->dirty = 1; if (fullItemUpdate) @@ -4706,11 +4707,15 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool return; } - const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); + bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); const bool itemHasChildren = !item->d_ptr->children.isEmpty(); - if (!itemHasContents && !itemHasChildren) { - resetDirtyItem(item); - return; // Item has neither contents nor children!(?) + if (!itemHasContents) { + if (!itemHasChildren) { + resetDirtyItem(item); + return; // Item has neither contents nor children!(?) + } + if (item->d_ptr->graphicsEffect) + itemHasContents = true; } const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index 9ee3863..eac74ac 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE struct QSimplexVariable { - QSimplexVariable() : result(0), index(0) {}; + QSimplexVariable() : result(0), index(0) {} qreal result; uint index; @@ -80,7 +80,7 @@ struct QSimplexVariable */ struct QSimplexConstraint { - QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {}; + QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {} enum Ratio { LessOrEqual = 0, diff --git a/src/gui/gui.pro b/src/gui/gui.pro index eb3a33f..7c24002 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -17,7 +17,10 @@ x11:include(kernel/x11.pri) mac:include(kernel/mac.pri) win32:include(kernel/win.pri) embedded:include(embedded/embedded.pri) -symbian:include(kernel/symbian.pri) +symbian { + include(kernel/symbian.pri) + include(s60framework/s60framework.pri) +} #modules include(animation/animation.pri) diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h index ba05a54..8c1cd4e 100644 --- a/src/gui/image/qiconloader_p.h +++ b/src/gui/image/qiconloader_p.h @@ -139,7 +139,7 @@ class QIconTheme { public: QIconTheme(const QString &name); - QIconTheme() : m_valid(false) {}; + QIconTheme() : m_valid(false) {} QStringList parents() { return m_parents; } QList <QIconDirInfo> keyList() { return m_keyList; } QString contentDir() { return m_contentDir; } diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h index 97def07..ca1d334 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/gui/itemviews/qcolumnview_p.h @@ -174,8 +174,8 @@ class QColumnViewDelegate : public QItemDelegate { public: - explicit QColumnViewDelegate(QObject *parent = 0) : QItemDelegate(parent) {}; - ~QColumnViewDelegate() {}; + explicit QColumnViewDelegate(QObject *parent = 0) : QItemDelegate(parent) {} + ~QColumnViewDelegate() {} void paint(QPainter *painter, const QStyleOptionViewItem &option, diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 92cf0f8..f1e3cb0 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -327,7 +327,7 @@ public: { if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); } # endif inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;} - inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {}; + inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {} inline static QT3_SUPPORT void flushX() { flush(); } static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) { QPalette p(palette()); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 8561045..220b222 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -63,10 +63,13 @@ #include "apgwgnam.h" // For CApaWindowGroupName #include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility -#if !defined(QT_NO_IM) && defined(Q_WS_S60) -#include "qinputcontext.h" -#include <private/qcoefepinputcontext_p.h> -#endif // !defined(QT_NO_IM) && defined(Q_WS_S60) +#if defined(Q_WS_S60) +# if !defined(QT_NO_IM) +# include "qinputcontext.h" +# include <private/qcoefepinputcontext_p.h> +# endif +# include <private/qs60mainapplication_p.h> +#endif #include "private/qstylesheetstyle_p.h" @@ -715,6 +718,22 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) void qt_init(QApplicationPrivate * /* priv */, int) { + if (!CCoeEnv::Static()) { + // The S60 framework has not been initalized. We need to do it. + TApaApplicationFactory factory(NewApplication); + CApaCommandLine* commandLine = 0; + TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); + // After this construction, CEikonEnv will be available from CEikonEnv::Static(). + // (much like our qApp). + CEikonEnv* coe = new CEikonEnv; + QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine)); + delete commandLine; + + S60->qtOwnsS60Environment = true; + } else { + S60->qtOwnsS60Environment = false; + } + #ifdef QT_NO_DEBUG if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty()) #endif @@ -766,6 +785,13 @@ void qt_cleanup() // it dies. delete QApplicationPrivate::inputContext; QApplicationPrivate::inputContext = 0; + + if (S60->qtOwnsS60Environment) { + CEikonEnv* coe = CEikonEnv::Static(); + coe->PrepareToExit(); + // The CEikonEnv itself is destroyed in here. + coe->DestroyEnvironment(); + } } void QApplicationPrivate::initializeWidgetPaletteHash() diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 84edf1f..729b791 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2035,7 +2035,6 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam #endif // Ignore the activate message send by WindowsXP to a minimized window #ifdef Q_WS_WINCE_WM - { if (widget->windowState() & Qt::WindowFullScreen) qt_wince_hide_taskbar(widget->winId()); #endif diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a61b6fa..0b282bc 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3648,13 +3648,13 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) \i As mentioned above, enabling touch events means multiple widgets can be receiving touch events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, this gives you great flexibility in designing multi-touch user interfaces. Be aware of the - implications. For example, is is possible that the user is moving a QSlider with one finger and + implications. For example, it is possible that the user is moving a QSlider with one finger and pressing a QPushButton with another. The signals emitted by these widgets will be interleaved. \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event - recipients, unexpected recursion may cause problems, including but not limited to lost events + recipients, recursion may cause problems, including but not limited to lost events and unexpected infinite recursion. \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 78301af..ea1ca69 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -95,6 +95,7 @@ public: int screenHeightInTwips; int defaultDpiX; int defaultDpiY; + int qtOwnsS60Environment : 1; static inline void updateScreenSize(); static inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index f398dbd..284558f 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -830,7 +830,7 @@ public: inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); } inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); } enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin }; - inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin){}; + inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {} inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; } inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); } inline QT3_SUPPORT void repaint(bool) { repaint(); } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 6da35d8..d630143 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -722,7 +722,9 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // The API to get title_pane graphics size is not public -> assume square space based // on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since // then title pane would automatically scale the bitmap. Unfortunately it is not public API - const CFont * font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont); + // Also this function is leaving, although it is not named as such. + const CFont * font; + QT_TRAP_THROWING(font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont)); TSize iconSize(font->HeightInPixels(), font->HeightInPixels()); QIcon icon = q->windowIcon(); diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index 290c9c2..b5d8824 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -50,19 +50,14 @@ QT_BEGIN_NAMESPACE \ingroup painting \ingroup painting-3D - The QGenericMatrix template has four parameters: + The QGenericMatrix template has three parameters: \table \row \i N \i Number of columns. \row \i M \i Number of rows. \row \i T \i Element type that is visible to users of the class. - \row \i InnerT \i Element type that is used inside the class. \endtable - Normally T and InnerT are the same type; e.g. float or double. - But they can be different if the user wants to store elements - internally in a fixed-point format for the underlying hardware. - \sa QMatrix4x4 */ @@ -73,7 +68,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix<N, M, T, InnerT>& other) + \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix<N, M, T>& other) Constructs a copy of \a other. */ @@ -89,13 +84,14 @@ QT_BEGIN_NAMESPACE */ /*! - \fn T QGenericMatrix::operator()(int row, int column) const + \fn const T& QGenericMatrix::operator()(int row, int column) const - Returns the element at position (\a row, \a column) in this matrix. + Returns a constant reference to the element at position + (\a row, \a column) in this matrix. */ /*! - \fn InnerT& QGenericMatrix::operator()(int row, int column) + \fn T& QGenericMatrix::operator()(int row, int column) Returns a reference to the element at position (\a row, \a column) in this matrix so that the element can be assigned to. @@ -130,57 +126,57 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QGenericMatrix<N, M, T, InnerT>& QGenericMatrix::operator+=(const QGenericMatrix<N, M, T, InnerT>& other) + \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator+=(const QGenericMatrix<N, M, T>& other) Adds the contents of \a other to this matrix. */ /*! - \fn QGenericMatrix<N, M, T, InnerT>& QGenericMatrix::operator-=(const QGenericMatrix<N, M, T, InnerT>& other) + \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator-=(const QGenericMatrix<N, M, T>& other) Subtracts the contents of \a other from this matrix. */ /*! - \fn QGenericMatrix<N, M, T, InnerT>& QGenericMatrix::operator*=(T factor) + \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator*=(T factor) Multiplies all elements of this matrix by \a factor. */ /*! - \fn QGenericMatrix<N, M, T, InnerT>& QGenericMatrix::operator/=(T divisor) + \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator/=(T divisor) Divides all elements of this matrix by \a divisor. */ /*! - \fn bool QGenericMatrix::operator==(const QGenericMatrix<N, M, T, InnerT>& other) const + \fn bool QGenericMatrix::operator==(const QGenericMatrix<N, M, T>& other) const Returns true if this matrix is identical to \a other; false otherwise. */ /*! - \fn bool QGenericMatrix::operator!=(const QGenericMatrix<N, M, T, InnerT>& other) const + \fn bool QGenericMatrix::operator!=(const QGenericMatrix<N, M, T>& other) const Returns true if this matrix is not identical to \a other; false otherwise. */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator+(const QGenericMatrix<N, M, T, InnerT>& m1, const QGenericMatrix<N, M, T, InnerT>& m2) + \fn QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) \relates QGenericMatrix Returns the sum of \a m1 and \a m2. */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator-(const QGenericMatrix<N, M, T, InnerT>& m1, const QGenericMatrix<N, M, T, InnerT>& m2) + \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) \relates QGenericMatrix Returns the difference of \a m1 and \a m2. */ /*! - \fn QGenericMatrix<M1, M2, T, InnerT> operator*(const QGenericMatrix<N, M2, T, InnerT>& m1, const QGenericMatrix<M1, N, T, InnerT>& m2) + \fn QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2) \relates QGenericMatrix Returns the product of the NxM2 matrix \a m1 and the M1xN matrix \a m2 @@ -188,7 +184,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator-(const QGenericMatrix<N, M, T, InnerT>& matrix) + \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix) \overload \relates QGenericMatrix @@ -196,21 +192,21 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator*(T factor, const QGenericMatrix<N, M, T, InnerT>& matrix) + \fn QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix) \relates QGenericMatrix Returns the result of multiplying all elements of \a matrix by \a factor. */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator*(const QGenericMatrix<N, M, T, InnerT>& matrix, T factor) + \fn QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor) \relates QGenericMatrix Returns the result of multiplying all elements of \a matrix by \a factor. */ /*! - \fn QGenericMatrix<N, M, T, InnerT> operator/(const QGenericMatrix<N, M, T, InnerT>& matrix, T divisor) + \fn QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor) \relates QGenericMatrix Returns the result of dividing all elements of \a matrix by \a divisor. @@ -224,28 +220,25 @@ QT_BEGIN_NAMESPACE */ /*! - \fn InnerT *QGenericMatrix::data() + \fn T *QGenericMatrix::data() - Returns a pointer to the raw data of this matrix. This is intended - for use with raw GL functions. + Returns a pointer to the raw data of this matrix. \sa constData() */ /*! - \fn const InnerT *QGenericMatrix::data() const + \fn const T *QGenericMatrix::data() const Returns a constant pointer to the raw data of this matrix. - This is intended for use with raw GL functions. \sa constData() */ /*! - \fn const InnerT *QGenericMatrix::constData() const + \fn const T *QGenericMatrix::constData() const Returns a constant pointer to the raw data of this matrix. - This is intended for use with raw GL functions. \sa data() */ diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index fe7ba5f..39c4ed8 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -51,103 +51,103 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -template <int N, int M, typename T, typename InnerT = T> +template <int N, int M, typename T> class QGenericMatrix { public: QGenericMatrix(); - QGenericMatrix(const QGenericMatrix<N, M, T, InnerT>& other); + QGenericMatrix(const QGenericMatrix<N, M, T>& other); explicit QGenericMatrix(const T *values); - T operator()(int row, int column) const; - InnerT& operator()(int row, int column); + const T& operator()(int row, int column) const; + T& operator()(int row, int column); bool isIdentity() const; void setIdentity(); void fill(T value); - QGenericMatrix<M, N, T, InnerT> transposed() const; + QGenericMatrix<M, N, T> transposed() const; - QGenericMatrix<N, M, T, InnerT>& operator+=(const QGenericMatrix<N, M, T, InnerT>& other); - QGenericMatrix<N, M, T, InnerT>& operator-=(const QGenericMatrix<N, M, T, InnerT>& other); - QGenericMatrix<N, M, T, InnerT>& operator*=(T factor); - QGenericMatrix<N, M, T, InnerT>& operator/=(T divisor); - bool operator==(const QGenericMatrix<N, M, T, InnerT>& other) const; - bool operator!=(const QGenericMatrix<N, M, T, InnerT>& other) const; + QGenericMatrix<N, M, T>& operator+=(const QGenericMatrix<N, M, T>& other); + QGenericMatrix<N, M, T>& operator-=(const QGenericMatrix<N, M, T>& other); + QGenericMatrix<N, M, T>& operator*=(T factor); + QGenericMatrix<N, M, T>& operator/=(T divisor); + bool operator==(const QGenericMatrix<N, M, T>& other) const; + bool operator!=(const QGenericMatrix<N, M, T>& other) const; void toValueArray(T *values); - InnerT *data() { return m[0]; } - const InnerT *data() const { return m[0]; } - const InnerT *constData() const { return m[0]; } + T *data() { return m[0]; } + const T *data() const { return m[0]; } + const T *constData() const { return m[0]; } #if !defined(Q_NO_TEMPLATE_FRIENDS) - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator+(const QGenericMatrix<NN, MM, TT, ITT>& m1, const QGenericMatrix<NN, MM, TT, ITT>& m2); - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator-(const QGenericMatrix<NN, MM, TT, ITT>& m1, const QGenericMatrix<NN, MM, TT, ITT>& m2); - template<int NN, int M1, int M2, typename TT, typename ITT> - friend QGenericMatrix<M1, M2, TT, ITT> operator*(const QGenericMatrix<NN, M2, TT, ITT>& m1, const QGenericMatrix<M1, NN, TT, ITT>& m2); - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator-(const QGenericMatrix<NN, MM, TT, ITT>& matrix); - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator*(TT factor, const QGenericMatrix<NN, MM, TT, ITT>& matrix); - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator*(const QGenericMatrix<NN, MM, TT, ITT>& matrix, TT factor); - template<int NN, int MM, typename TT, typename ITT> - friend QGenericMatrix<NN, MM, TT, ITT> operator/(const QGenericMatrix<NN, MM, TT, ITT>& matrix, TT divisor); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator+(const QGenericMatrix<NN, MM, TT>& m1, const QGenericMatrix<NN, MM, TT>& m2); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator-(const QGenericMatrix<NN, MM, TT>& m1, const QGenericMatrix<NN, MM, TT>& m2); + template<int NN, int M1, int M2, typename TT> + friend QGenericMatrix<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator-(const QGenericMatrix<NN, MM, TT>& matrix); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator*(TT factor, const QGenericMatrix<NN, MM, TT>& matrix); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator*(const QGenericMatrix<NN, MM, TT>& matrix, TT factor); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator/(const QGenericMatrix<NN, MM, TT>& matrix, TT divisor); private: #endif - InnerT m[N][M]; // Column-major order to match OpenGL. + T m[N][M]; // Column-major order to match OpenGL. QGenericMatrix(int) {} // Construct without initializing identity matrix. #if !defined(Q_NO_TEMPLATE_FRIENDS) - template <int NN, int MM, typename TT, typename ITT> + template <int NN, int MM, typename TT> friend class QGenericMatrix; #endif }; -template <int N, int M, typename T, typename InnerT> -Q_INLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>::QGenericMatrix() +template <int N, int M, typename T> +Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix() { setIdentity(); } -template <int N, int M, typename T, typename InnerT> -Q_INLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>::QGenericMatrix(const QGenericMatrix<N, M, T, InnerT>& other) +template <int N, int M, typename T> +Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const QGenericMatrix<N, M, T>& other) { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) m[col][row] = other.m[col][row]; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>::QGenericMatrix(const T *values) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const T *values) { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) m[col][row] = values[row * N + col]; } -template <int N, int M, typename T, typename InnerT> -Q_INLINE_TEMPLATE T QGenericMatrix<N, M, T, InnerT>::operator()(int row, int column) const +template <int N, int M, typename T> +Q_INLINE_TEMPLATE const T& QGenericMatrix<N, M, T>::operator()(int row, int column) const { Q_ASSERT(row >= 0 && row < M && column >= 0 && column < N); - return T(m[column][row]); + return m[column][row]; } -template <int N, int M, typename T, typename InnerT> -Q_INLINE_TEMPLATE InnerT& QGenericMatrix<N, M, T, InnerT>::operator()(int row, int column) +template <int N, int M, typename T> +Q_INLINE_TEMPLATE T& QGenericMatrix<N, M, T>::operator()(int row, int column) { Q_ASSERT(row >= 0 && row < M && column >= 0 && column < N); return m[column][row]; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::isIdentity() const +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::isIdentity() const { for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { @@ -163,8 +163,8 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::isIdentity() const return true; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T, InnerT>::setIdentity() +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::setIdentity() { for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { @@ -176,51 +176,50 @@ Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T, InnerT>::setIdentity() } } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T, InnerT>::fill(T value) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::fill(T value) { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) m[col][row] = value; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<M, N, T, InnerT> QGenericMatrix<N, M, T, InnerT>::transposed() const +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<M, N, T> QGenericMatrix<N, M, T>::transposed() const { - QGenericMatrix<M, N, T, InnerT> result(1); + QGenericMatrix<M, N, T> result(1); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[row][col] = m[col][row]; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>& QGenericMatrix<N, M, T, InnerT>::operator+=(const QGenericMatrix<N, M, T, InnerT>& other) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other) { for (int index = 0; index < N * M; ++index) m[0][index] += other.m[0][index]; return *this; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>& QGenericMatrix<N, M, T, InnerT>::operator-=(const QGenericMatrix<N, M, T, InnerT>& other) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other) { for (int index = 0; index < N * M; ++index) m[0][index] -= other.m[0][index]; return *this; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>& QGenericMatrix<N, M, T, InnerT>::operator*=(T factor) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor) { - InnerT f(factor); for (int index = 0; index < N * M; ++index) - m[0][index] *= f; + m[0][index] *= factor; return *this; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::operator==(const QGenericMatrix<N, M, T, InnerT>& other) const +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const { for (int index = 0; index < N * M; ++index) { if (m[0][index] != other.m[0][index]) @@ -229,8 +228,8 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::operator==(const QGen return true; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::operator!=(const QGenericMatrix<N, M, T, InnerT>& other) const +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const { for (int index = 0; index < N * M; ++index) { if (m[0][index] != other.m[0][index]) @@ -239,40 +238,39 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T, InnerT>::operator!=(const QGen return false; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>& QGenericMatrix<N, M, T, InnerT>::operator/=(T divisor) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor) { - InnerT d(divisor); for (int index = 0; index < N * M; ++index) - m[0][index] /= d; + m[0][index] /= divisor; return *this; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator+(const QGenericMatrix<N, M, T, InnerT>& m1, const QGenericMatrix<N, M, T, InnerT>& m2) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) { - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) result.m[0][index] = m1.m[0][index] + m2.m[0][index]; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator-(const QGenericMatrix<N, M, T, InnerT>& m1, const QGenericMatrix<N, M, T, InnerT>& m2) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) { - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) result.m[0][index] = m1.m[0][index] - m2.m[0][index]; return result; } -template <int N, int M1, int M2, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T, InnerT> operator*(const QGenericMatrix<N, M2, T, InnerT>& m1, const QGenericMatrix<M1, N, T, InnerT>& m2) +template <int N, int M1, int M2, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2) { - QGenericMatrix<M1, M2, T, InnerT> result(1); + QGenericMatrix<M1, M2, T> result(1); for (int row = 0; row < M2; ++row) { for (int col = 0; col < M1; ++col) { - InnerT sum(0.0f); + T sum(0.0f); for (int j = 0; j < N; ++j) sum += m1.m[j][row] * m2.m[col][j]; result.m[col][row] = sum; @@ -281,47 +279,44 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T, InnerT> operator*(const QGenericM return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator-(const QGenericMatrix<N, M, T, InnerT>& matrix) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix) { - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) result.m[0][index] = -matrix.m[0][index]; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator*(T factor, const QGenericMatrix<N, M, T, InnerT>& matrix) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix) { - InnerT f(factor); - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] * f; + result.m[0][index] = matrix.m[0][index] * factor; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator*(const QGenericMatrix<N, M, T, InnerT>& matrix, T factor) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor) { - InnerT f(factor); - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] * f; + result.m[0][index] = matrix.m[0][index] * factor; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT> operator/(const QGenericMatrix<N, M, T, InnerT>& matrix, T divisor) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor) { - InnerT d(divisor); - QGenericMatrix<N, M, T, InnerT> result(1); + QGenericMatrix<N, M, T> result(1); for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] / d; + result.m[0][index] = matrix.m[0][index] / divisor; return result; } -template <int N, int M, typename T, typename InnerT> -Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T, InnerT>::toValueArray(T *values) +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::toValueArray(T *values) { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) @@ -329,22 +324,22 @@ Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T, InnerT>::toValueArray(T *value } // Define aliases for the useful variants of QGenericMatrix. -typedef QGenericMatrix<2, 2, qreal, float> QMatrix2x2; -typedef QGenericMatrix<2, 3, qreal, float> QMatrix2x3; -typedef QGenericMatrix<2, 4, qreal, float> QMatrix2x4; -typedef QGenericMatrix<3, 2, qreal, float> QMatrix3x2; -typedef QGenericMatrix<3, 3, qreal, float> QMatrix3x3; -typedef QGenericMatrix<3, 4, qreal, float> QMatrix3x4; -typedef QGenericMatrix<4, 2, qreal, float> QMatrix4x2; -typedef QGenericMatrix<4, 3, qreal, float> QMatrix4x3; +typedef QGenericMatrix<2, 2, qreal> QMatrix2x2; +typedef QGenericMatrix<2, 3, qreal> QMatrix2x3; +typedef QGenericMatrix<2, 4, qreal> QMatrix2x4; +typedef QGenericMatrix<3, 2, qreal> QMatrix3x2; +typedef QGenericMatrix<3, 3, qreal> QMatrix3x3; +typedef QGenericMatrix<3, 4, qreal> QMatrix3x4; +typedef QGenericMatrix<4, 2, qreal> QMatrix4x2; +typedef QGenericMatrix<4, 3, qreal> QMatrix4x3; #ifndef QT_NO_DEBUG_STREAM -template <int N, int M, typename T, typename InnerT> -QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T, InnerT> &m) +template <int N, int M, typename T> +QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m) { dbg.nospace() << "QGenericMatrix<" << N << ", " << M - << ", " << QTypeInfo<T>::name() << ", " << QTypeInfo<InnerT>::name() + << ", " << QTypeInfo<T>::name() << ">(" << endl << qSetFieldWidth(10); for (int row = 0; row < M; ++row) { for (int col = 0; col < N; ++col) diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index eb5858c..2164aca 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -103,7 +103,7 @@ QMatrix4x4::QMatrix4x4(const qreal *values) #if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) /*! - \fn QMatrix4x4::QMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix) + \fn QMatrix4x4::QMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix) Constructs a 4x4 matrix from the left-most 4 columns and top-most 4 rows of \a matrix. If \a matrix has less than 4 columns or rows, @@ -114,7 +114,7 @@ QMatrix4x4::QMatrix4x4(const qreal *values) */ /*! - \fn QGenericMatrix<N, M, qreal, float> QMatrix4x4::toGenericMatrix() const + \fn QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const Constructs a NxM generic matrix from the left-most N columns and top-most M rows of this 4x4 matrix. If N or M is greater than 4, @@ -127,7 +127,7 @@ QMatrix4x4::QMatrix4x4(const qreal *values) #endif /*! - \fn QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix) + \fn QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix) \relates QMatrix4x4 Returns a 4x4 matrix constructed from the left-most 4 columns and @@ -139,7 +139,7 @@ QMatrix4x4::QMatrix4x4(const qreal *values) */ /*! - \fn QGenericMatrix<N, M, qreal, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix) + \fn QGenericMatrix<N, M, qreal> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix) \relates QMatrix4x4 Returns a NxM generic matrix constructed from the left-most N columns @@ -153,7 +153,7 @@ QMatrix4x4::QMatrix4x4(const qreal *values) /*! \internal */ -QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows) +QMatrix4x4::QMatrix4x4(const qreal *values, int cols, int rows) { for (int col = 0; col < 4; ++col) { for (int row = 0; row < 4; ++row) { @@ -233,15 +233,16 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) } /*! - \fn qreal QMatrix4x4::operator()(int row, int column) const + \fn const qreal& QMatrix4x4::operator()(int row, int column) const - Returns the element at position (\a row, \a column) in this matrix. + Returns a constant reference to the element at position + (\a row, \a column) in this matrix. \sa column(), row() */ /*! - \fn float& QMatrix4x4::operator()(int row, int column) + \fn qreal& QMatrix4x4::operator()(int row, int column) Returns a reference to the element at position (\a row, \a column) in this matrix so that the element can be assigned to. @@ -312,8 +313,8 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) // | A B C | // M = | D E F | det(M) = A * (EI - HF) - B * (DI - GF) + C * (DH - GE) // | G H I | -static inline float matrixDet3 - (const float m[4][4], int col0, int col1, int col2, +static inline qreal matrixDet3 + (const qreal m[4][4], int col0, int col1, int col2, int row0, int row1, int row2) { return m[col0][row0] * @@ -328,9 +329,9 @@ static inline float matrixDet3 } // Calculate the determinant of a 4x4 matrix. -static inline float matrixDet4(const float m[4][4]) +static inline qreal matrixDet4(const qreal m[4][4]) { - float det; + qreal det; det = m[0][0] * matrixDet3(m, 1, 2, 3, 1, 2, 3); det -= m[1][0] * matrixDet3(m, 0, 2, 3, 1, 2, 3); det += m[2][0] * matrixDet3(m, 0, 1, 3, 1, 2, 3); @@ -382,7 +383,7 @@ QMatrix4x4 QMatrix4x4::inverted(bool *invertible) const QMatrix4x4 inv(1); // The "1" says to not load the identity. - float det = matrixDet4(m); + qreal det = matrixDet4(m); if (det == 0.0f) { if (invertible) *invertible = false; @@ -436,12 +437,12 @@ QMatrix3x3 QMatrix4x4::normalMatrix() const return inv; } - float det = matrixDet3(m, 0, 1, 2, 0, 1, 2); + qreal det = matrixDet3(m, 0, 1, 2, 0, 1, 2); if (det == 0.0f) return inv; det = 1.0f / det; - float *invm = inv.data(); + qreal *invm = inv.data(); // Invert and transpose in a single step. invm[0 + 0 * 3] = (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * det; @@ -697,9 +698,9 @@ QMatrix4x4 operator/(const QMatrix4x4& matrix, qreal divisor) */ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) { - float vx = vector.xp; - float vy = vector.yp; - float vz = vector.zp; + qreal vx = vector.x(); + qreal vy = vector.y(); + qreal vz = vector.z(); if (flagBits == Identity) { m[0][0] = vx; m[1][1] = vy; @@ -743,28 +744,26 @@ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) */ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) { - float vx(x); - float vy(y); if (flagBits == Identity) { - m[0][0] = vx; - m[1][1] = vy; + m[0][0] = x; + m[1][1] = y; flagBits = Scale; } else if (flagBits == Scale || flagBits == (Scale | Translation)) { - m[0][0] *= vx; - m[1][1] *= vy; + m[0][0] *= x; + m[1][1] *= y; } else if (flagBits == Translation) { - m[0][0] = vx; - m[1][1] = vy; + m[0][0] = x; + m[1][1] = y; flagBits |= Scale; } else { - m[0][0] *= vx; - m[0][1] *= vx; - m[0][2] *= vx; - m[0][3] *= vx; - m[1][0] *= vy; - m[1][1] *= vy; - m[1][2] *= vy; - m[1][3] *= vy; + m[0][0] *= x; + m[0][1] *= x; + m[0][2] *= x; + m[0][3] *= x; + m[1][0] *= y; + m[1][1] *= y; + m[1][2] *= y; + m[1][3] *= y; flagBits = General; } return *this; @@ -780,36 +779,33 @@ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) */ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y, qreal z) { - float vx(x); - float vy(y); - float vz(z); if (flagBits == Identity) { - m[0][0] = vx; - m[1][1] = vy; - m[2][2] = vz; + m[0][0] = x; + m[1][1] = y; + m[2][2] = z; flagBits = Scale; } else if (flagBits == Scale || flagBits == (Scale | Translation)) { - m[0][0] *= vx; - m[1][1] *= vy; - m[2][2] *= vz; + m[0][0] *= x; + m[1][1] *= y; + m[2][2] *= z; } else if (flagBits == Translation) { - m[0][0] = vx; - m[1][1] = vy; - m[2][2] = vz; + m[0][0] = x; + m[1][1] = y; + m[2][2] = z; flagBits |= Scale; } else { - m[0][0] *= vx; - m[0][1] *= vx; - m[0][2] *= vx; - m[0][3] *= vx; - m[1][0] *= vy; - m[1][1] *= vy; - m[1][2] *= vy; - m[1][3] *= vy; - m[2][0] *= vz; - m[2][1] *= vz; - m[2][2] *= vz; - m[2][3] *= vz; + m[0][0] *= x; + m[0][1] *= x; + m[0][2] *= x; + m[0][3] *= x; + m[1][0] *= y; + m[1][1] *= y; + m[1][2] *= y; + m[1][3] *= y; + m[2][0] *= z; + m[2][1] *= z; + m[2][2] *= z; + m[2][3] *= z; flagBits = General; } return *this; @@ -866,9 +862,9 @@ QMatrix4x4& QMatrix4x4::scale(qreal factor) */ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) { - float vx = vector.xp; - float vy = vector.yp; - float vz = vector.zp; + qreal vx = vector.x(); + qreal vy = vector.y(); + qreal vz = vector.z(); if (flagBits == Identity) { m[3][0] = vx; m[3][1] = vy; @@ -912,28 +908,26 @@ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) */ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) { - float vx(x); - float vy(y); if (flagBits == Identity) { - m[3][0] = vx; - m[3][1] = vy; + m[3][0] = x; + m[3][1] = y; flagBits = Translation; } else if (flagBits == Translation) { - m[3][0] += vx; - m[3][1] += vy; + m[3][0] += x; + m[3][1] += y; } else if (flagBits == Scale) { - m[3][0] = m[0][0] * vx; - m[3][1] = m[1][1] * vy; + m[3][0] = m[0][0] * x; + m[3][1] = m[1][1] * y; m[3][2] = 0.; flagBits |= Translation; } else if (flagBits == (Scale | Translation)) { - m[3][0] += m[0][0] * vx; - m[3][1] += m[1][1] * vy; + m[3][0] += m[0][0] * x; + m[3][1] += m[1][1] * y; } else { - m[3][0] += m[0][0] * vx + m[1][0] * vy; - m[3][1] += m[0][1] * vx + m[1][1] * vy; - m[3][2] += m[0][2] * vx + m[1][2] * vy; - m[3][3] += m[0][3] * vx + m[1][3] * vy; + m[3][0] += m[0][0] * x + m[1][0] * y; + m[3][1] += m[0][1] * x + m[1][1] * y; + m[3][2] += m[0][2] * x + m[1][2] * y; + m[3][3] += m[0][3] * x + m[1][3] * y; if (flagBits == Rotation) flagBits |= Translation; else if (flagBits != (Rotation | Translation)) @@ -952,32 +946,29 @@ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) */ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y, qreal z) { - float vx(x); - float vy(y); - float vz(z); if (flagBits == Identity) { - m[3][0] = vx; - m[3][1] = vy; - m[3][2] = vz; + m[3][0] = x; + m[3][1] = y; + m[3][2] = z; flagBits = Translation; } else if (flagBits == Translation) { - m[3][0] += vx; - m[3][1] += vy; - m[3][2] += vz; + m[3][0] += x; + m[3][1] += y; + m[3][2] += z; } else if (flagBits == Scale) { - m[3][0] = m[0][0] * vx; - m[3][1] = m[1][1] * vy; - m[3][2] = m[2][2] * vz; + m[3][0] = m[0][0] * x; + m[3][1] = m[1][1] * y; + m[3][2] = m[2][2] * z; flagBits |= Translation; } else if (flagBits == (Scale | Translation)) { - m[3][0] += m[0][0] * vx; - m[3][1] += m[1][1] * vy; - m[3][2] += m[2][2] * vz; + m[3][0] += m[0][0] * x; + m[3][1] += m[1][1] * y; + m[3][2] += m[2][2] * z; } else { - m[3][0] += m[0][0] * vx + m[1][0] * vy + m[2][0] * vz; - m[3][1] += m[0][1] * vx + m[1][1] * vy + m[2][1] * vz; - m[3][2] += m[0][2] * vx + m[1][2] * vy + m[2][2] * vz; - m[3][3] += m[0][3] * vx + m[1][3] * vy + m[2][3] * vz; + m[3][0] += m[0][0] * x + m[1][0] * y + m[2][0] * z; + m[3][1] += m[0][1] * x + m[1][1] * y + m[2][1] * z; + m[3][2] += m[0][2] * x + m[1][2] * y + m[2][2] * z; + m[3][3] += m[0][3] * x + m[1][3] * y + m[2][3] * z; if (flagBits == Rotation) flagBits |= Translation; else if (flagBits != (Rotation | Translation)) @@ -1126,15 +1117,15 @@ QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) // Algorithm from: // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 QMatrix4x4 m(1); - float xx = quaternion.xp * quaternion.xp; - float xy = quaternion.xp * quaternion.yp; - float xz = quaternion.xp * quaternion.zp; - float xw = quaternion.xp * quaternion.wp; - float yy = quaternion.yp * quaternion.yp; - float yz = quaternion.yp * quaternion.zp; - float yw = quaternion.yp * quaternion.wp; - float zz = quaternion.zp * quaternion.zp; - float zw = quaternion.zp * quaternion.wp; + qreal xx = quaternion.x() * quaternion.x(); + qreal xy = quaternion.x() * quaternion.y(); + qreal xz = quaternion.x() * quaternion.z(); + qreal xw = quaternion.x() * quaternion.scalar(); + qreal yy = quaternion.y() * quaternion.y(); + qreal yz = quaternion.y() * quaternion.z(); + qreal yw = quaternion.y() * quaternion.scalar(); + qreal zz = quaternion.z() * quaternion.z(); + qreal zw = quaternion.z() * quaternion.scalar(); m.m[0][0] = 1.0f - 2 * (yy + zz); m.m[1][0] = 2 * (xy - zw); m.m[2][0] = 2 * (xz + yw); @@ -1222,11 +1213,11 @@ QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, translate(QVector3D (-(left + right) / width, -(top + bottom) / invheight, - 0.0f, 1)); + 0.0f)); scale(QVector3D (2.0f / width, 2.0f / invheight, - -1.0f, 1)); + -1.0f)); return *this; } #endif @@ -1356,17 +1347,17 @@ QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, co QMatrix4x4 m(1); - m.m[0][0] = side.xp; - m.m[1][0] = side.yp; - m.m[2][0] = side.zp; + m.m[0][0] = side.x(); + m.m[1][0] = side.y(); + m.m[2][0] = side.z(); m.m[3][0] = 0.0f; - m.m[0][1] = upVector.xp; - m.m[1][1] = upVector.yp; - m.m[2][1] = upVector.zp; + m.m[0][1] = upVector.x(); + m.m[1][1] = upVector.y(); + m.m[2][1] = upVector.z(); m.m[3][1] = 0.0f; - m.m[0][2] = -forward.xp; - m.m[1][2] = -forward.yp; - m.m[2][2] = -forward.zp; + m.m[0][2] = -forward.x(); + m.m[1][2] = -forward.y(); + m.m[2][2] = -forward.z(); m.m[3][2] = 0.0f; m.m[0][3] = 0.0f; m.m[1][3] = 0.0f; @@ -1434,9 +1425,9 @@ void QMatrix4x4::toValueArray(qreal *values) const */ QMatrix QMatrix4x4::toAffine() const { - return QMatrix(qreal(m[0][0]), qreal(m[0][1]), - qreal(m[1][0]), qreal(m[1][1]), - qreal(m[3][0]), qreal(m[3][1])); + return QMatrix(m[0][0], m[0][1], + m[1][0], m[1][1], + m[3][0], m[3][1]); } static const qreal inv_dist_to_plane = 1. / 1024.; @@ -1462,15 +1453,12 @@ QTransform QMatrix4x4::toTransform(qreal distanceToPlane) const { if (distanceToPlane == 1024.0f) { // Optimize the common case with constants. - return QTransform(qreal(m[0][0]), qreal(m[0][1]), - qreal(m[0][3]) - qreal(m[0][2]) * - inv_dist_to_plane, - qreal(m[1][0]), qreal(m[1][1]), - qreal(m[1][3]) - qreal(m[1][2]) * - inv_dist_to_plane, - qreal(m[3][0]), qreal(m[3][1]), - qreal(m[3][3]) - qreal(m[3][2]) * - inv_dist_to_plane); + return QTransform(m[0][0], m[0][1], + m[0][3] - m[0][2] * inv_dist_to_plane, + m[1][0], m[1][1], + m[1][3] - m[1][2] * inv_dist_to_plane, + m[3][0], m[3][1], + m[3][3] - m[3][2] * inv_dist_to_plane); } else if (distanceToPlane != 0.0f) { // The following projection matrix is pre-multiplied with "matrix": // | 1 0 0 0 | @@ -1480,17 +1468,14 @@ QTransform QMatrix4x4::toTransform(qreal distanceToPlane) const // where d = -1 / distanceToPlane. After projection, row 3 and // column 3 are dropped to form the final QTransform. qreal d = 1.0f / distanceToPlane; - return QTransform(qreal(m[0][0]), qreal(m[0][1]), - qreal(m[0][3]) - qreal(m[0][2]) * d, - qreal(m[1][0]), qreal(m[1][1]), - qreal(m[1][3]) - qreal(m[1][2]) * d, - qreal(m[3][0]), qreal(m[3][1]), - qreal(m[3][3]) - qreal(m[3][2]) * d); + return QTransform(m[0][0], m[0][1], m[0][3] - m[0][2] * d, + m[1][0], m[1][1], m[1][3] - m[1][2] * d, + m[3][0], m[3][1], m[3][3] - m[3][2] * d); } else { // Orthographic projection: drop row 3 and column 3. - return QTransform(qreal(m[0][0]), qreal(m[0][1]), qreal(m[0][3]), - qreal(m[1][0]), qreal(m[1][1]), qreal(m[1][3]), - qreal(m[3][0]), qreal(m[3][1]), qreal(m[3][3])); + return QTransform(m[0][0], m[0][1], m[0][3], + m[1][0], m[1][1], m[1][3], + m[3][0], m[3][1], m[3][3]); } } @@ -1618,28 +1603,25 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const } /*! - \fn float *QMatrix4x4::data() + \fn qreal *QMatrix4x4::data() - Returns a pointer to the raw data of this matrix. This is intended - for use with raw GL functions. + Returns a pointer to the raw data of this matrix. \sa constData(), inferSpecialType() */ /*! - \fn const float *QMatrix4x4::data() const + \fn const qreal *QMatrix4x4::data() const Returns a constant pointer to the raw data of this matrix. - This is intended for use with raw GL functions. \sa constData() */ /*! - \fn const float *QMatrix4x4::constData() const + \fn const qreal *QMatrix4x4::constData() const Returns a constant pointer to the raw data of this matrix. - This is intended for use with raw GL functions. \sa data() */ @@ -1695,7 +1677,7 @@ void QMatrix4x4::extractAxisRotation(qreal &angle, QVector3D &axis) const { // Orientation is dependent on the upper 3x3 matrix; subtract the // homogeneous scaling element from the trace of the 4x4 matrix - float tr = m[0][0] + m[1][1] + m[2][2]; + qreal tr = m[0][0] + m[1][1] + m[2][2]; qreal cosa = qreal(0.5f * (tr - 1.0f)); angle = acos(cosa) * 180.0f / M_PI; @@ -1708,38 +1690,38 @@ void QMatrix4x4::extractAxisRotation(qreal &angle, QVector3D &axis) const } if (angle < 180.0f) { - axis.xp = m[1][2] - m[2][1]; - axis.yp = m[2][0] - m[0][2]; - axis.zp = m[0][1] - m[1][0]; + axis.setX(m[1][2] - m[2][1]); + axis.setY(m[2][0] - m[0][2]); + axis.setZ(m[0][1] - m[1][0]); axis.normalize(); return; } // rads == PI - float tmp; + qreal tmp; // r00 is maximum if ((m[0][0] >= m[2][2]) && (m[0][0] >= m[1][1])) { - axis.xp = 0.5f * qSqrt(m[0][0] - m[1][1] - m[2][2] + 1.0f); + axis.setX(0.5f * qSqrt(m[0][0] - m[1][1] - m[2][2] + 1.0f)); tmp = 0.5f / axis.x(); - axis.yp = m[1][0] * tmp; - axis.zp = m[2][0] * tmp; + axis.setY(m[1][0] * tmp); + axis.setZ(m[2][0] * tmp); } // r11 is maximum if ((m[1][1] >= m[2][2]) && (m[1][1] >= m[0][0])) { - axis.yp = 0.5f * qSqrt(m[1][1] - m[0][0] - m[2][2] + 1.0f); + axis.setY(0.5f * qSqrt(m[1][1] - m[0][0] - m[2][2] + 1.0f)); tmp = 0.5f / axis.y(); - axis.xp = tmp * m[1][0]; - axis.zp = tmp * m[2][1]; + axis.setX(tmp * m[1][0]); + axis.setZ(tmp * m[2][1]); } // r22 is maximum if ((m[2][2] >= m[1][1]) && (m[2][2] >= m[0][0])) { - axis.zp = 0.5f * qSqrt(m[2][2] - m[0][0] - m[1][1] + 1.0f); + axis.setZ(0.5f * qSqrt(m[2][2] - m[0][0] - m[1][1] + 1.0f)); tmp = 0.5f / axis.z(); - axis.xp = m[2][0]*tmp; - axis.yp = m[2][1]*tmp; + axis.setX(m[2][0]*tmp); + axis.setY(m[2][1]*tmp); } } @@ -1756,7 +1738,7 @@ QVector3D QMatrix4x4::extractTranslation() const return QVector3D (m[0][0] * m[3][0] + m[0][1] * m[3][1] + m[0][2] * m[3][2], m[1][0] * m[3][0] + m[1][1] * m[3][1] + m[1][2] * m[3][2], - m[2][0] * m[3][0] + m[2][1] * m[3][1] + m[2][2] * m[3][2], 1); + m[2][0] * m[3][0] + m[2][1] * m[3][1] + m[2][2] * m[3][2]); } #endif @@ -1894,7 +1876,7 @@ QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix) for (int row = 0; row < 4; ++row) { for (int col = 0; col < 4; ++col) { stream >> x; - matrix(row, col) = float(x); + matrix(row, col) = qreal(x); } } matrix.inferSpecialType(); diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 4207bdf..8811027 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -71,14 +71,14 @@ public: qreal m41, qreal m42, qreal m43, qreal m44); #if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) template <int N, int M> - explicit QMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix); + explicit QMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix); #endif - QMatrix4x4(const float *values, int cols, int rows); + QMatrix4x4(const qreal *values, int cols, int rows); QMatrix4x4(const QTransform& transform); QMatrix4x4(const QMatrix& matrix); - inline qreal operator()(int row, int column) const; - inline float& operator()(int row, int column); + inline const qreal& operator()(int row, int column) const; + inline qreal& operator()(int row, int column); inline QVector4D column(int index) const; inline void setColumn(int index, const QVector4D& value); @@ -174,12 +174,12 @@ public: #if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) template <int N, int M> - QGenericMatrix<N, M, qreal, float> toGenericMatrix() const; + QGenericMatrix<N, M, qreal> toGenericMatrix() const; #endif - inline float *data(); - inline const float *data() const { return m[0]; } - inline const float *constData() const { return m[0]; } + inline qreal *data(); + inline const qreal *data() const { return m[0]; } + inline const qreal *constData() const { return m[0]; } void inferSpecialType(); @@ -190,7 +190,7 @@ public: #endif private: - float m[4][4]; // Column-major order to match OpenGL. + qreal m[4][4]; // Column-major order to match OpenGL. int flagBits; // Flag bits from the enum below. enum { @@ -224,9 +224,9 @@ inline QMatrix4x4::QMatrix4x4 template <int N, int M> Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 - (const QGenericMatrix<N, M, qreal, float>& matrix) + (const QGenericMatrix<N, M, qreal>& matrix) { - const float *values = matrix.constData(); + const qreal *values = matrix.constData(); for (int col = 0; col < 4; ++col) { for (int row = 0; row < 4; ++row) { if (col < N && row < M) @@ -241,10 +241,10 @@ Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 } template <int N, int M> -QGenericMatrix<N, M, qreal, float> QMatrix4x4::toGenericMatrix() const +QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const { - QGenericMatrix<N, M, qreal, float> result; - float *values = result.data(); + QGenericMatrix<N, M, qreal> result; + qreal *values = result.data(); for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { if (col < 4 && row < 4) @@ -260,13 +260,13 @@ QGenericMatrix<N, M, qreal, float> QMatrix4x4::toGenericMatrix() const #endif -inline qreal QMatrix4x4::operator()(int row, int column) const +inline const qreal& QMatrix4x4::operator()(int row, int column) const { Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4); - return qreal(m[column][row]); + return m[column][row]; } -inline float& QMatrix4x4::operator()(int row, int column) +inline qreal& QMatrix4x4::operator()(int row, int column) { Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4); flagBits = General; @@ -276,32 +276,32 @@ inline float& QMatrix4x4::operator()(int row, int column) inline QVector4D QMatrix4x4::column(int index) const { Q_ASSERT(index >= 0 && index < 4); - return QVector4D(m[index][0], m[index][1], m[index][2], m[index][3], 1); + return QVector4D(m[index][0], m[index][1], m[index][2], m[index][3]); } inline void QMatrix4x4::setColumn(int index, const QVector4D& value) { Q_ASSERT(index >= 0 && index < 4); - m[index][0] = value.xp; - m[index][1] = value.yp; - m[index][2] = value.zp; - m[index][3] = value.wp; + m[index][0] = value.x(); + m[index][1] = value.y(); + m[index][2] = value.z(); + m[index][3] = value.w(); flagBits = General; } inline QVector4D QMatrix4x4::row(int index) const { Q_ASSERT(index >= 0 && index < 4); - return QVector4D(m[0][index], m[1][index], m[2][index], m[3][index], 1); + return QVector4D(m[0][index], m[1][index], m[2][index], m[3][index]); } inline void QMatrix4x4::setRow(int index, const QVector4D& value) { Q_ASSERT(index >= 0 && index < 4); - m[0][index] = value.xp; - m[1][index] = value.yp; - m[2][index] = value.zp; - m[3][index] = value.wp; + m[0][index] = value.x(); + m[1][index] = value.y(); + m[2][index] = value.z(); + m[3][index] = value.w(); flagBits = General; } @@ -608,68 +608,68 @@ inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2) inline QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix) { - float x, y, z, w; - x = vector.xp * matrix.m[0][0] + - vector.yp * matrix.m[0][1] + - vector.zp * matrix.m[0][2] + + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[0][1] + + vector.z() * matrix.m[0][2] + matrix.m[0][3]; - y = vector.xp * matrix.m[1][0] + - vector.yp * matrix.m[1][1] + - vector.zp * matrix.m[1][2] + + y = vector.x() * matrix.m[1][0] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[1][2] + matrix.m[1][3]; - z = vector.xp * matrix.m[2][0] + - vector.yp * matrix.m[2][1] + - vector.zp * matrix.m[2][2] + + z = vector.x() * matrix.m[2][0] + + vector.y() * matrix.m[2][1] + + vector.z() * matrix.m[2][2] + matrix.m[2][3]; - w = vector.xp * matrix.m[3][0] + - vector.yp * matrix.m[3][1] + - vector.zp * matrix.m[3][2] + + w = vector.x() * matrix.m[3][0] + + vector.y() * matrix.m[3][1] + + vector.z() * matrix.m[3][2] + matrix.m[3][3]; if (w == 1.0f) - return QVector3D(x, y, z, 1); + return QVector3D(x, y, z); else - return QVector3D(x / w, y / w, z / w, 1); + return QVector3D(x / w, y / w, z / w); } inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector) { - float x, y, z, w; + qreal x, y, z, w; if (matrix.flagBits == QMatrix4x4::Identity) { return vector; } else if (matrix.flagBits == QMatrix4x4::Translation) { - return QVector3D(vector.xp + matrix.m[3][0], - vector.yp + matrix.m[3][1], - vector.zp + matrix.m[3][2], 1); + return QVector3D(vector.x() + matrix.m[3][0], + vector.y() + matrix.m[3][1], + vector.z() + matrix.m[3][2]); } else if (matrix.flagBits == (QMatrix4x4::Translation | QMatrix4x4::Scale)) { - return QVector3D(vector.xp * matrix.m[0][0] + matrix.m[3][0], - vector.yp * matrix.m[1][1] + matrix.m[3][1], - vector.zp * matrix.m[2][2] + matrix.m[3][2], 1); + return QVector3D(vector.x() * matrix.m[0][0] + matrix.m[3][0], + vector.y() * matrix.m[1][1] + matrix.m[3][1], + vector.z() * matrix.m[2][2] + matrix.m[3][2]); } else if (matrix.flagBits == QMatrix4x4::Scale) { - return QVector3D(vector.xp * matrix.m[0][0], - vector.yp * matrix.m[1][1], - vector.zp * matrix.m[2][2], 1); + return QVector3D(vector.x() * matrix.m[0][0], + vector.y() * matrix.m[1][1], + vector.z() * matrix.m[2][2]); } else { - x = vector.xp * matrix.m[0][0] + - vector.yp * matrix.m[1][0] + - vector.zp * matrix.m[2][0] + + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[1][0] + + vector.z() * matrix.m[2][0] + matrix.m[3][0]; - y = vector.xp * matrix.m[0][1] + - vector.yp * matrix.m[1][1] + - vector.zp * matrix.m[2][1] + + y = vector.x() * matrix.m[0][1] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[2][1] + matrix.m[3][1]; - z = vector.xp * matrix.m[0][2] + - vector.yp * matrix.m[1][2] + - vector.zp * matrix.m[2][2] + + z = vector.x() * matrix.m[0][2] + + vector.y() * matrix.m[1][2] + + vector.z() * matrix.m[2][2] + matrix.m[3][2]; - w = vector.xp * matrix.m[0][3] + - vector.yp * matrix.m[1][3] + - vector.zp * matrix.m[2][3] + + w = vector.x() * matrix.m[0][3] + + vector.y() * matrix.m[1][3] + + vector.z() * matrix.m[2][3] + matrix.m[3][3]; if (w == 1.0f) - return QVector3D(x, y, z, 1); + return QVector3D(x, y, z); else - return QVector3D(x / w, y / w, z / w, 1); + return QVector3D(x / w, y / w, z / w); } } @@ -679,54 +679,54 @@ inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector) inline QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix) { - float x, y, z, w; - x = vector.xp * matrix.m[0][0] + - vector.yp * matrix.m[0][1] + - vector.zp * matrix.m[0][2] + - vector.wp * matrix.m[0][3]; - y = vector.xp * matrix.m[1][0] + - vector.yp * matrix.m[1][1] + - vector.zp * matrix.m[1][2] + - vector.wp * matrix.m[1][3]; - z = vector.xp * matrix.m[2][0] + - vector.yp * matrix.m[2][1] + - vector.zp * matrix.m[2][2] + - vector.wp * matrix.m[2][3]; - w = vector.xp * matrix.m[3][0] + - vector.yp * matrix.m[3][1] + - vector.zp * matrix.m[3][2] + - vector.wp * matrix.m[3][3]; - return QVector4D(x, y, z, w, 1); + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[0][1] + + vector.z() * matrix.m[0][2] + + vector.w() * matrix.m[0][3]; + y = vector.x() * matrix.m[1][0] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[1][2] + + vector.w() * matrix.m[1][3]; + z = vector.x() * matrix.m[2][0] + + vector.y() * matrix.m[2][1] + + vector.z() * matrix.m[2][2] + + vector.w() * matrix.m[2][3]; + w = vector.x() * matrix.m[3][0] + + vector.y() * matrix.m[3][1] + + vector.z() * matrix.m[3][2] + + vector.w() * matrix.m[3][3]; + return QVector4D(x, y, z, w); } inline QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector) { - float x, y, z, w; - x = vector.xp * matrix.m[0][0] + - vector.yp * matrix.m[1][0] + - vector.zp * matrix.m[2][0] + - vector.wp * matrix.m[3][0]; - y = vector.xp * matrix.m[0][1] + - vector.yp * matrix.m[1][1] + - vector.zp * matrix.m[2][1] + - vector.wp * matrix.m[3][1]; - z = vector.xp * matrix.m[0][2] + - vector.yp * matrix.m[1][2] + - vector.zp * matrix.m[2][2] + - vector.wp * matrix.m[3][2]; - w = vector.xp * matrix.m[0][3] + - vector.yp * matrix.m[1][3] + - vector.zp * matrix.m[2][3] + - vector.wp * matrix.m[3][3]; - return QVector4D(x, y, z, w, 1); + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[1][0] + + vector.z() * matrix.m[2][0] + + vector.w() * matrix.m[3][0]; + y = vector.x() * matrix.m[0][1] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[2][1] + + vector.w() * matrix.m[3][1]; + z = vector.x() * matrix.m[0][2] + + vector.y() * matrix.m[1][2] + + vector.z() * matrix.m[2][2] + + vector.w() * matrix.m[3][2]; + w = vector.x() * matrix.m[0][3] + + vector.y() * matrix.m[1][3] + + vector.z() * matrix.m[2][3] + + vector.w() * matrix.m[3][3]; + return QVector4D(x, y, z, w); } #endif inline QPoint operator*(const QPoint& point, const QMatrix4x4& matrix) { - float xin, yin; - float x, y, w; + qreal xin, yin; + qreal x, y, w; xin = point.x(); yin = point.y(); x = xin * matrix.m[0][0] + @@ -746,8 +746,8 @@ inline QPoint operator*(const QPoint& point, const QMatrix4x4& matrix) inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix) { - float xin, yin; - float x, y, w; + qreal xin, yin; + qreal x, y, w; xin = point.x(); yin = point.y(); x = xin * matrix.m[0][0] + @@ -768,8 +768,8 @@ inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix) inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point) { - float xin, yin; - float x, y, w; + qreal xin, yin; + qreal x, y, w; xin = point.x(); yin = point.y(); if (matrix.flagBits == QMatrix4x4::Identity) { @@ -803,8 +803,8 @@ inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point) inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point) { - float xin, yin; - float x, y, w; + qreal xin, yin; + qreal x, y, w; xin = point.x(); yin = point.y(); if (matrix.flagBits == QMatrix4x4::Identity) { @@ -951,7 +951,7 @@ inline QVector4D QMatrix4x4::map(const QVector4D& point) const #endif -inline float *QMatrix4x4::data() +inline qreal *QMatrix4x4::data() { // We have to assume that the caller will modify the matrix elements, // so we flip it over to "General" mode. @@ -969,17 +969,17 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &); #endif template <int N, int M> -QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix) +QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix) { return QMatrix4x4(matrix.constData(), N, M); } template <int N, int M> -QGenericMatrix<N, M, qreal, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix) +QGenericMatrix<N, M, qreal> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix) { - QGenericMatrix<N, M, qreal, float> result; - const float *m = matrix.constData(); - float *values = result.data(); + QGenericMatrix<N, M, qreal> result; + const qreal *m = matrix.constData(); + qreal *values = result.data(); for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { if (col < 4 && row < 4) diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index ece4482..7206e9a 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -353,7 +353,7 @@ QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D& axis, qreal angle) qreal s = qSin(a); qreal c = qCos(a); QVector3D ax = axis.normalized(); - return QQuaternion(c, ax.xp * s, ax.yp * s, ax.zp * s, 1).normalized(); + return QQuaternion(c, ax.x() * s, ax.y() * s, ax.z() * s).normalized(); } #endif @@ -365,19 +365,16 @@ QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D& axis, qreal angle) QQuaternion QQuaternion::fromAxisAndAngle (qreal x, qreal y, qreal z, qreal angle) { - float xp = x; - float yp = y; - float zp = z; - qreal length = qSqrt(xp * xp + yp * yp + zp * zp); - if (!qIsNull(length)) { - xp /= length; - yp /= length; - zp /= length; + qreal length = qSqrt(x * x + y * y + z * z); + if (!qFuzzyIsNull(length - 1.0f) && !qFuzzyIsNull(length)) { + x /= length; + y /= length; + z /= length; } qreal a = (angle / 2.0f) * M_PI / 180.0f; qreal s = qSin(a); qreal c = qCos(a); - return QQuaternion(c, xp * s, yp * s, zp * s, 1).normalized(); + return QQuaternion(c, x * s, y * s, z * s).normalized(); } /*! diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 12576d2..f243c42 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -133,11 +133,7 @@ public: (const QQuaternion& q1, const QQuaternion& q2, qreal t); private: - float wp, xp, yp, zp; - - friend class QMatrix4x4; - - QQuaternion(float scalar, float xpos, float ypos, float zpos, int dummy); + qreal wp, xp, yp, zp; }; inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {} @@ -145,8 +141,6 @@ inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {} inline QQuaternion::QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos) : wp(scalar), xp(xpos), yp(ypos), zp(zpos) {} -inline QQuaternion::QQuaternion(float scalar, float xpos, float ypos, float zpos, int) : wp(scalar), xp(xpos), yp(ypos), zp(zpos) {} - inline bool QQuaternion::isNull() const { return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp); @@ -169,7 +163,7 @@ inline void QQuaternion::setScalar(qreal scalar) { wp = scalar; } inline QQuaternion QQuaternion::conjugate() const { - return QQuaternion(wp, -xp, -yp, -zp, 1); + return QQuaternion(wp, -xp, -yp, -zp); } inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion) @@ -201,18 +195,18 @@ inline QQuaternion &QQuaternion::operator*=(qreal factor) inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2) { - float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp); - float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp); - float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp); - float xx = ww + yy + zz; - float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); - - float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp); - float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp); - float y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp); - float z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp); - - return QQuaternion(w, x, y, z, 1); + qreal ww = (q1.zp + q1.xp) * (q2.xp + q2.yp); + qreal yy = (q1.wp - q1.yp) * (q2.wp + q2.zp); + qreal zz = (q1.wp + q1.yp) * (q2.wp - q2.zp); + qreal xx = ww + yy + zz; + qreal qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); + + qreal w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp); + qreal x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp); + qreal y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp); + qreal z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp); + + return QQuaternion(w, x, y, z); } inline QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion) @@ -242,32 +236,32 @@ inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2) inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) { - return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp, 1); + return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp); } inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2) { - return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp, 1); + return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp); } inline const QQuaternion operator*(qreal factor, const QQuaternion &quaternion) { - return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor, 1); + return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor); } inline const QQuaternion operator*(const QQuaternion &quaternion, qreal factor) { - return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor, 1); + return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor); } inline const QQuaternion operator-(const QQuaternion &quaternion) { - return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp, 1); + return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp); } inline const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor) { - return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor, 1); + return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor); } inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2) @@ -281,18 +275,18 @@ inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2) #ifndef QT_NO_VECTOR3D inline QQuaternion::QQuaternion(qreal scalar, const QVector3D& vector) - : wp(scalar), xp(vector.xp), yp(vector.yp), zp(vector.zp) {} + : wp(scalar), xp(vector.x()), yp(vector.y()), zp(vector.z()) {} inline void QQuaternion::setVector(const QVector3D& vector) { - xp = vector.xp; - yp = vector.yp; - zp = vector.zp; + xp = vector.x(); + yp = vector.y(); + zp = vector.z(); } inline QVector3D QQuaternion::vector() const { - return QVector3D(xp, yp, zp, 1); + return QVector3D(xp, yp, zp); } #endif @@ -307,11 +301,11 @@ inline void QQuaternion::setVector(qreal x, qreal y, qreal z) #ifndef QT_NO_VECTOR4D inline QQuaternion::QQuaternion(const QVector4D& vector) - : wp(vector.wp), xp(vector.xp), yp(vector.yp), zp(vector.zp) {} + : wp(vector.w()), xp(vector.x()), yp(vector.y()), zp(vector.z()) {} inline QVector4D QQuaternion::toVector4D() const { - return QVector4D(xp, yp, zp, wp, 1); + return QVector4D(xp, yp, zp, wp); } #endif diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h index 767517e..1e95865 100644 --- a/src/gui/math3d/qvector3d.h +++ b/src/gui/math3d/qvector3d.h @@ -54,7 +54,6 @@ QT_MODULE(Gui) class QMatrix4x4; class QVector2D; class QVector4D; -class QQuaternion; #ifndef QT_NO_VECTOR3D @@ -136,8 +135,6 @@ private: friend class QVector2D; friend class QVector4D; - friend class QQuaternion; - friend class QMatrix4x4; #ifndef QT_NO_MATRIX4X4 friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix); friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector); diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h index 4bd6639..520319a 100644 --- a/src/gui/math3d/qvector4d.h +++ b/src/gui/math3d/qvector4d.h @@ -54,7 +54,6 @@ QT_MODULE(Gui) class QMatrix4x4; class QVector2D; class QVector3D; -class QQuaternion; #ifndef QT_NO_VECTOR4D @@ -133,8 +132,6 @@ private: friend class QVector2D; friend class QVector3D; - friend class QQuaternion; - friend class QMatrix4x4; #ifndef QT_NO_MATRIX4X4 friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix); friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector); diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 216b8c6..8d04a84 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qoutlinemapper_p.h" - +#include <private/qpainterpath_p.h> #include "qmath.h" #include <stdlib.h> diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 934b385..249bcfa 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -116,11 +116,15 @@ QMacCGContext::QMacCGContext(QPainter *p) if (devType == QInternal::Widget) { QRegion clip = p->paintEngine()->systemClip(); + QTransform native = p->deviceTransform(); + QTransform logical = p->combinedTransform(); if (p->hasClipping()) { + QRegion r = p->clipRegion(); + r.translate(native.dx() - logical.dx(), native.dy() - logical.dy()); if (clip.isEmpty()) - clip = p->clipRegion(); + clip = r; else - clip &= p->clipRegion(); + clip &= r; } qt_mac_clip_cg(context, clip, 0); diff --git a/src/s60main/qts60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index f4e7def..45a1a3d 100644 --- a/src/s60main/qts60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -41,44 +41,54 @@ // INCLUDE FILES #include <exception> -#include "qts60maindocument_p.h" -#include "qts60mainapplication_p.h" +#include "qs60maindocument_p.h" +#include "qs60mainapplication_p.h" #include <bautils.h> #include <coemain.h> +QT_BEGIN_NAMESPACE + +/** + * factory function to create the QtS60Main application class + */ +CApaApplication* NewApplication() +{ + return new QS60MainApplication; +} + // ============================ MEMBER FUNCTIONS =============================== _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); // ----------------------------------------------------------------------------- -// CQtS60MainApplication::CreateDocumentL() +// QS60MainApplication::CreateDocumentL() // Creates CApaDocument object // ----------------------------------------------------------------------------- // -CApaDocument* CQtS60MainApplication::CreateDocumentL() +CApaDocument* QS60MainApplication::CreateDocumentL() { // Create an QtS60Main document, and return a pointer to it - return (static_cast<CApaDocument*>(CQtS60MainDocument::NewL(*this))); + return (static_cast<CApaDocument*>(QS60MainDocument::NewL(*this))); } // ----------------------------------------------------------------------------- -// CQtS60MainApplication::AppDllUid() +// QS60MainApplication::AppDllUid() // Returns application UID // ----------------------------------------------------------------------------- // -TUid CQtS60MainApplication::AppDllUid() const +TUid QS60MainApplication::AppDllUid() const { // Return the UID for the QtS60Main application return ProcessUid(); } // ----------------------------------------------------------------------------- -// CQtS60MainApplication::ResourceFileName() +// QS60MainApplication::ResourceFileName() // Returns application resource filename // ----------------------------------------------------------------------------- // -TFileName CQtS60MainApplication::ResourceFileName() const +TFileName QS60MainApplication::ResourceFileName() const { TFindFile finder(iCoeEnv->FsSession()); TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC); @@ -87,5 +97,6 @@ TFileName CQtS60MainApplication::ResourceFileName() const return KNullDesC(); } +QT_END_NAMESPACE // End of File diff --git a/src/s60main/qts60mainapplication_p.h b/src/gui/s60framework/qs60mainapplication_p.h index f9d2ebb..572bbd3 100644 --- a/src/s60main/qts60mainapplication_p.h +++ b/src/gui/s60framework/qs60mainapplication_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef __QtS60MainAPPLICATION_H__ -#define __QtS60MainAPPLICATION_H__ +#ifndef QS60MAINAPPLICATION_P_H +#define QS60MAINAPPLICATION_P_H // // W A R N I N G @@ -56,49 +56,57 @@ // INCLUDES #include <aknapp.h> +#include <qglobal.h> + // CLASS DECLARATION +QT_BEGIN_NAMESPACE + +CApaApplication* NewApplication(); + static TUid ProcessUid() - { +{ RProcess me; TSecureId securId = me.SecureId(); me.Close(); return securId.operator TUid(); - } +} /** -* CQtS60MainApplication application class. +* QS60MainApplication application class. * Provides factory to create concrete document object. -* An instance of CQtS60MainApplication is the application part of the +* An instance of QS60MainApplication is the application part of the * AVKON application framework for the QtS60Main example application. */ -class CQtS60MainApplication : public CAknApplication - { - public: // Functions from base classes - - /** - * From CApaApplication, AppDllUid. - * @return Application's UID (KUidQtS60MainApp). - */ - TUid AppDllUid() const; - - /** - * From CApaApplication, ResourceFileName - * @return Application's resource filename (KUidQtS60MainApp). - */ - TFileName ResourceFileName() const; - - protected: // Functions from base classes - - /** - * From CApaApplication, CreateDocumentL. - * Creates CQtS60MainDocument document object. The returned - * pointer in not owned by the CQtS60MainApplication object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - }; - -#endif // __QtS60MainAPPLICATION_H__ +class QS60MainApplication : public CAknApplication +{ +public: // Functions from base classes + + /** + * From CApaApplication, AppDllUid. + * @return Application's UID (KUidQtS60MainApp). + */ + TUid AppDllUid() const; + + /** + * From CApaApplication, ResourceFileName + * @return Application's resource filename (KUidQtS60MainApp). + */ + TFileName ResourceFileName() const; + +protected: // Functions from base classes + + /** + * From CApaApplication, CreateDocumentL. + * Creates QS60MainDocument document object. The returned + * pointer in not owned by the QS60MainApplication object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); +}; + +QT_END_NAMESPACE + +#endif // QS60MAINAPPLICATION_P_H // End of File diff --git a/src/s60main/qts60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index eb3b62a..7b5ea1d 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -48,20 +48,22 @@ #include <s60main.rsg> #include <avkon.rsg> -#include "qts60mainappui_p.h" +#include "qs60mainappui_p.h" #include <QtGui/qapplication.h> #include <QtGui/qmenu.h> #include <QtGui/private/qt_s60_p.h> +QT_BEGIN_NAMESPACE + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- -// CQtS60MainAppUi::ConstructL() +// QS60MainAppUi::ConstructL() // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CQtS60MainAppUi::ConstructL() +void QS60MainAppUi::ConstructL() { // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many // objects can still exist in static data at that point. Instead we will print relevant information @@ -76,51 +78,44 @@ void CQtS60MainAppUi::ConstructL() CEikButtonGroupContainer* nativeContainer = Cba(); nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - - // Create async callback to call Qt main, - // this is required to give S60 app FW to finish starting correctly - TCallBack callBack(OpenCMainStaticCallBack, this); - iAsyncCallBack = new(ELeave) CAsyncCallBack(callBack, CActive::EPriorityIdle); - iAsyncCallBack->Call(); } // ----------------------------------------------------------------------------- -// CQtS60MainAppUi::CQtS60MainAppUi() +// QS60MainAppUi::QS60MainAppUi() // C++ default constructor can NOT contain any code, that might leave. // ----------------------------------------------------------------------------- // -CQtS60MainAppUi::CQtS60MainAppUi() +QS60MainAppUi::QS60MainAppUi() { // No implementation required } // ----------------------------------------------------------------------------- -// CQtS60MainAppUi::~CQtS60MainAppUi() +// QS60MainAppUi::~QS60MainAppUi() // Destructor. // ----------------------------------------------------------------------------- // -CQtS60MainAppUi::~CQtS60MainAppUi() +QS60MainAppUi::~QS60MainAppUi() { - delete iAsyncCallBack; } // ----------------------------------------------------------------------------- -// CQtS60MainAppUi::HandleCommandL() +// QS60MainAppUi::HandleCommandL() // Takes care of command handling. // ----------------------------------------------------------------------------- // -void CQtS60MainAppUi::HandleCommandL(TInt aCommand) +void QS60MainAppUi::HandleCommandL(TInt aCommand) { if (qApp) qApp->symbianHandleCommand(aCommand); } // ----------------------------------------------------------------------------- -// CQtS60MainAppUi::HandleResourceChangeL() +// QS60MainAppUi::HandleResourceChangeL() // Takes care of event handling. // ----------------------------------------------------------------------------- // -void CQtS60MainAppUi::HandleResourceChangeL(TInt aType) +void QS60MainAppUi::HandleResourceChangeL(TInt aType) { CAknAppUi::HandleResourceChangeL(aType); @@ -128,7 +123,7 @@ void CQtS60MainAppUi::HandleResourceChangeL(TInt aType) qApp->symbianResourceChange(aType); } -void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control) +void QS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control) { int result = 0; if (qApp) @@ -147,44 +142,17 @@ void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *contro // AppView // ----------------------------------------------------------------------------- // -void CQtS60MainAppUi::HandleStatusPaneSizeChange() +void QS60MainAppUi::HandleStatusPaneSizeChange() { HandleResourceChangeL(KInternalStatusPaneChange); HandleStackedControlsResourceChange(KInternalStatusPaneChange); } -// ----------------------------------------------------------------------------- -// Called asynchronously from ConstructL() - passes call to nan static method -// ----------------------------------------------------------------------------- -// -TInt CQtS60MainAppUi::OpenCMainStaticCallBack(TAny* aObject) -{ - CQtS60MainAppUi* myObj = static_cast<CQtS60MainAppUi*>(aObject); - myObj->OpenCMainCallBack(); - return 0; -} - -#include "qtS60main_mcrt0.cpp" - -// ----------------------------------------------------------------------------- -// Invokes Qt main, the Qt main will block and when we return from there -// application should be closed. -> Call Exit(); -// ----------------------------------------------------------------------------- -// -void CQtS60MainAppUi::OpenCMainCallBack() +void QS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *) { - TInt ret; - TRAPD(err, ret = QtMainWrapper()); - Q_UNUSED(ret); - Q_UNUSED(err); - Exit(); } -void CQtS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *) -{ -} - -void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) +void QS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) { if (aResourceId == R_QT_WRAPPERAPP_MENU) { if (aMenuPane->NumberOfItemsInPane() <= 1) @@ -195,7 +163,7 @@ void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane } } -void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType) +void QS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType) { if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) { TResourceReader reader; @@ -210,4 +178,6 @@ void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenu DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow); } +QT_END_NAMESPACE + // End of File diff --git a/src/gui/s60framework/qs60mainappui_p.h b/src/gui/s60framework/qs60mainappui_p.h new file mode 100644 index 0000000..ef2de27 --- /dev/null +++ b/src/gui/s60framework/qs60mainappui_p.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPUI_P_H +#define QS60MAINAPPUI_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +// INCLUDES +#include <aknappui.h> + +#include <qglobal.h> + +QT_BEGIN_NAMESPACE + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +/** +* QS60MainAppUi application UI class. +* Interacts with the user through the UI and request message processing +* from the handler class +*/ +class QS60MainAppUi : public CAknAppUi +{ +public: // Constructors and destructor + + /** + * ConstructL. + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * QS60MainAppUi. + * C++ default constructor. This needs to be public due to + * the way the framework constructs the AppUi + */ + QS60MainAppUi(); + + /** + * ~QS60MainAppUi. + * Virtual Destructor. + */ + virtual ~QS60MainAppUi(); + +protected: + void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType); + void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar); + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); + +private: // Functions from base classes + + /** + * From CEikAppUi, HandleCommandL. + * Takes care of command handling. + * @param aCommand Command to be handled. + */ + void HandleCommandL( TInt aCommand ); + + /** + * From CAknAppUi, HandleResourceChangeL + * Handles resource change events such as layout switches in global level. + * @param aType event type. + */ + void HandleResourceChangeL(TInt aType); + + /** + * HandleStatusPaneSizeChange. + * Called by the framework when the application status pane + * size is changed. + */ + void HandleStatusPaneSizeChange(); + +protected: + void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); +}; + +QT_END_NAMESPACE + +#endif // QS60MAINAPPUI_P_H + +// End of File diff --git a/src/s60main/qts60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 0f134bf..5a34a14 100644 --- a/src/s60main/qts60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -41,77 +41,81 @@ // INCLUDE FILES #include <exception> -#include "qts60mainappui_p.h" -#include "qts60maindocument_p.h" +#include "qs60mainappui_p.h" +#include "qs60maindocument_p.h" + +QT_BEGIN_NAMESPACE // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- -// CQtS60MainDocument::NewL() +// QS60MainDocument::NewL() // Two-phased constructor. // ----------------------------------------------------------------------------- // -CQtS60MainDocument* CQtS60MainDocument::NewL(CEikApplication& aApp) +QS60MainDocument* QS60MainDocument::NewL(CEikApplication& aApp) { - CQtS60MainDocument* self = NewLC(aApp); + QS60MainDocument* self = NewLC(aApp); CleanupStack::Pop(self); return self; } // ----------------------------------------------------------------------------- -// CQtS60MainDocument::NewLC() +// QS60MainDocument::NewLC() // Two-phased constructor. // ----------------------------------------------------------------------------- // -CQtS60MainDocument* CQtS60MainDocument::NewLC(CEikApplication& aApp) +QS60MainDocument* QS60MainDocument::NewLC(CEikApplication& aApp) { - CQtS60MainDocument* self = new(ELeave) CQtS60MainDocument(aApp); + QS60MainDocument* self = new(ELeave) QS60MainDocument(aApp); CleanupStack::PushL(self); self->ConstructL(); return self; } // ----------------------------------------------------------------------------- -// CQtS60MainDocument::ConstructL() +// QS60MainDocument::ConstructL() // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CQtS60MainDocument::ConstructL() +void QS60MainDocument::ConstructL() { // No implementation required } // ----------------------------------------------------------------------------- -// CQtS60MainDocument::CQtS60MainDocument() +// QS60MainDocument::QS60MainDocument() // C++ default constructor can NOT contain any code, that might leave. // ----------------------------------------------------------------------------- // -CQtS60MainDocument::CQtS60MainDocument(CEikApplication& aApp) +QS60MainDocument::QS60MainDocument(CEikApplication& aApp) : CAknDocument(aApp) { // No implementation required } // --------------------------------------------------------------------------- -// CQtS60MainDocument::~CQtS60MainDocument() +// QS60MainDocument::~QS60MainDocument() // Destructor. // --------------------------------------------------------------------------- // -CQtS60MainDocument::~CQtS60MainDocument() +QS60MainDocument::~QS60MainDocument() { // No implementation required } // --------------------------------------------------------------------------- -// CQtS60MainDocument::CreateAppUiL() +// QS60MainDocument::CreateAppUiL() // Constructs CreateAppUi. // --------------------------------------------------------------------------- // -CEikAppUi* CQtS60MainDocument::CreateAppUiL() +CEikAppUi* QS60MainDocument::CreateAppUiL() { // Create the application user interface, and return a pointer to it; // the framework takes ownership of this object - return (static_cast <CEikAppUi*>(new(ELeave)CQtS60MainAppUi)); + return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi)); } +QT_END_NAMESPACE + // End of File diff --git a/src/gui/s60framework/qs60maindocument_p.h b/src/gui/s60framework/qs60maindocument_p.h new file mode 100644 index 0000000..dfb439f --- /dev/null +++ b/src/gui/s60framework/qs60maindocument_p.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINDOCUMENT_P_H +#define QS60MAINDOCUMENT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +// INCLUDES +#include <akndoc.h> + +#include <qglobal.h> + +class CEikApplication; + +QT_BEGIN_NAMESPACE + +// FORWARD DECLARATIONS +class QS60MainAppUi; + +// CLASS DECLARATION + +/** +* QS60MainDocument application class. +* An instance of class QS60MainDocument is the Document part of the +* AVKON application framework for the QtS60Main application. +*/ +class QS60MainDocument : public CAknDocument +{ +public: // Constructors and destructor + + /** + * NewL. + * Two-phased constructor. + * Construct a QS60MainDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of QS60MainDocument. + */ + static QS60MainDocument* NewL( CEikApplication& aApp ); + + /** + * NewLC. + * Two-phased constructor. + * Construct a QS60MainDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of QS60MainDocument. + */ + static QS60MainDocument* NewLC( CEikApplication& aApp ); + + /** + * ~QS60MainDocument + * Virtual Destructor. + */ + virtual ~QS60MainDocument(); + +public: // Functions from base classes + + /** + * CreateAppUiL + * From CEikDocument, CreateAppUiL. + * Create a QS60MainAppUi object and return a pointer to it. + * The object returned is owned by the Uikon framework. + * @return Pointer to created instance of AppUi. + */ + CEikAppUi* CreateAppUiL(); + +private: // Constructors + + /** + * ConstructL + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * QS60MainDocument. + * C++ default constructor. + * @param aApp Application creating this document. + */ + QS60MainDocument( CEikApplication& aApp ); + +}; + +QT_END_NAMESPACE + +#endif // QS60MAINDOCUMENT_P_H + +// End of File diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri new file mode 100644 index 0000000..f9a6d95 --- /dev/null +++ b/src/gui/s60framework/s60framework.pri @@ -0,0 +1,7 @@ +SOURCES += s60framework/qs60mainapplication.cpp \ + s60framework/qs60mainappui.cpp \ + s60framework/qs60maindocument.cpp + +HEADERS += s60framework/qs60mainapplication_p.h \ + s60framework/qs60mainappui_p.h \ + s60framework/qs60maindocument_p.h diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 41f9ec0..7fefb19 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1882,7 +1882,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, break; case CE_TabBarTabLabel: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { - // ### consider merging this with SE_TabBarTabText QStyleOptionTabV3 tabV2(*tab); QRect tr = tabV2.rect; bool verticalTabs = tabV2.shape == QTabBar::RoundedEast diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index cead2ac..3d8dec6 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3948,7 +3948,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QFont oldFont = p->font(); if (subRule.hasFont) p->setFont(subRule.font); - if (subRule.hasBox()) { + if (subRule.hasBox() || !subRule.hasNativeBorder()) { tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r) : subRule.contentsRect(r); QWindowsStyle::drawControl(ce, &tabCopy, p, w); @@ -5702,6 +5702,15 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c } break; } + case SE_TabBarTabText: + case SE_TabBarTabLeftButton: + case SE_TabBarTabRightButton: { + QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); + if (subRule.hasBox() || !subRule.hasNativeBorder()) { + return ParentStyle::subElementRect(se, opt, w); + } + break; + } #endif // QT_NO_TABBAR case SE_DockWidgetCloseButton: diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp index 06a13de..5bbf638 100644 --- a/src/gui/text/qcssscanner.cpp +++ b/src/gui/text/qcssscanner.cpp @@ -46,7 +46,7 @@ public: QCssScanner_Generated(const QString &inp); inline QChar next() { - return (pos < input.length()) ? input.at(pos++).toLower() : QChar(); + return (pos < input.length()) ? input.at(pos++) : QChar(); } int handleCommentStart(); int lex(); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 0e2dc31..78847ef 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -595,7 +595,7 @@ static QList<QFontDatabase::WritingSystem> determineWritingSystemsFromTrueTypeBi class QFontDatabaseS60Store { public: - virtual ~QFontDatabaseS60Store() {}; + virtual ~QFontDatabaseS60Store() {} }; #endif diff --git a/src/gui/widgets/qdatetimeedit_p.h b/src/gui/widgets/qdatetimeedit_p.h index 7e1c24d..689b508 100644 --- a/src/gui/widgets/qdatetimeedit_p.h +++ b/src/gui/widgets/qdatetimeedit_p.h @@ -89,7 +89,7 @@ public: QDateTime validateAndInterpret(QString &input, int &, QValidator::State &state, bool fixup = false) const; void clearSection(int index); - virtual QString displayText() const { return edit->displayText(); } // this is from QDateTimeParser + virtual QString displayText() const { return edit->text(); } // this is from QDateTimeParser int absoluteIndex(QDateTimeEdit::Section s, int index) const; int absoluteIndex(const SectionNode &s) const; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 7ae799c..c5953af 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -3,6 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the S60 port of the Qt toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index bc01e82..2b2504f 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -306,6 +306,7 @@ static QByteArray proxyAuthenticationKey(const QNetworkProxy &proxy, const QStri case QNetworkProxy::FtpCachingProxy: key.setScheme(QLatin1String("proxy-ftp")); + break; case QNetworkProxy::DefaultProxy: case QNetworkProxy::NoProxy: diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index 000de07..ee741aa 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from +// of the QHostInfo class. This header file may change from // version to version without notice, or even be removed. // // We mean it. @@ -180,7 +180,8 @@ class QHostInfoPrivate public: inline QHostInfoPrivate() : err(QHostInfo::NoError), - errorStr(QLatin1String(QT_TRANSLATE_NOOP("QHostInfo", "Unknown error"))) + errorStr(QLatin1String(QT_TRANSLATE_NOOP("QHostInfo", "Unknown error"))), + lookupId(0) { } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index b85a9d2..98740ba 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -453,6 +453,9 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() peerPort(0), socketEngine(0), cachedSocketDescriptor(-1), +#ifdef Q_OS_LINUX + addToBytesAvailable(0), +#endif readBufferMaxSize(0), readBuffer(QABSTRACTSOCKET_BUFFERSIZE), writeBuffer(QABSTRACTSOCKET_BUFFERSIZE), @@ -461,6 +464,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() connectTimer(0), connectTimeElapsed(0), hostLookupId(-1), + socketType(QAbstractSocket::UnknownSocketType), state(QAbstractSocket::UnconnectedState), socketError(QAbstractSocket::UnknownSocketError) { diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 3e292f9..49605c5 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from +// of the QAbstractSocket class. This header file may change from // version to version without notice, or even be removed. // // We mean it. diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index a774cbf..a7248f6 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -139,7 +139,7 @@ public: void _q_emitReadyRead(); DWORD bytesAvailable(); void startAsyncRead(); - void completeAsyncRead(); + bool completeAsyncRead(); void checkReadyRead(); HANDLE handle; OVERLAPPED overlapped; diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index f70a0aa..96dfa6e 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -199,9 +199,13 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize) } } - if (!d->readSequenceStarted) - d->startAsyncRead(); - d->checkReadyRead(); + if (d->pipeClosed) { + QTimer::singleShot(0, this, SLOT(_q_pipeClosed())); + } else { + if (!d->readSequenceStarted) + d->startAsyncRead(); + d->checkReadyRead(); + } return readSoFar; } @@ -251,9 +255,22 @@ void QLocalSocketPrivate::startAsyncRead() readSequenceStarted = true; if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) { completeAsyncRead(); - } else if (GetLastError() != ERROR_IO_PENDING) { - setErrorString(QLatin1String("QLocalSocketPrivate::startAsyncRead")); - return; + } else { + switch (GetLastError()) { + case ERROR_IO_PENDING: + // This is not an error. We're getting notified, when data arrives. + return; + case ERROR_PIPE_NOT_CONNECTED: + { + // It may happen, that the other side closes the connection directly + // after writing data. Then we must set the appropriate socket state. + pipeClosed = true; + return; + } + default: + setErrorString(QLatin1String("QLocalSocketPrivate::startAsyncRead")); + return; + } } } while (!readSequenceStarted); } @@ -261,20 +278,23 @@ void QLocalSocketPrivate::startAsyncRead() /*! \internal Sets the correct size of the read buffer after a read operation. + Returns false, if an error occured or the connection dropped. */ -void QLocalSocketPrivate::completeAsyncRead() +bool QLocalSocketPrivate::completeAsyncRead() { ResetEvent(overlapped.hEvent); readSequenceStarted = false; DWORD bytesRead; if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) { - setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead")); - return; + if (GetLastError() != ERROR_PIPE_NOT_CONNECTED) + setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead")); + return false; } actualReadBufferSize += bytesRead; readBuffer.truncate(actualReadBufferSize); + return true; } qint64 QLocalSocket::writeData(const char *data, qint64 maxSize) @@ -425,7 +445,10 @@ void QLocalSocketPrivate::_q_canWrite() void QLocalSocketPrivate::_q_notified() { Q_Q(QLocalSocket); - completeAsyncRead(); + if (!completeAsyncRead()) { + pipeClosed = true; + return; + } startAsyncRead(); pendingReadyRead = false; emit q->readyRead(); diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 427aab3..8e97edf 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -97,7 +97,7 @@ public: \i \link setSamples() Number of samples per pixels.\endlink \i \link setAttachment() Depth and/or stencil attachments.\endlink \i \link setTextureTarget() Texture target.\endlink - \i \link setInternalFormat() Internal format.\endlink + \i \link setInternalTextureFormat() Internal texture format.\endlink \endlist Note that the desired attachments or number of samples per pixels might not @@ -109,38 +109,28 @@ public: */ /*! - Creates a QGLFramebufferObjectFormat object with properties specifying + Creates a QGLFramebufferObjectFormat object for specifying the format of an OpenGL framebuffer object. - A multisample framebuffer object is specified by setting \a samples - to a value different from zero. If the desired amount of samples per pixel is - not supported by the hardware then the maximum number of samples per pixel - will be used. Note that multisample framebuffer objects can not be bound as - textures. Also, the \c{GL_EXT_framebuffer_multisample} extension is required - to create a framebuffer with more than one sample per pixel. + By default the format specifies a non-multisample framebuffer object with no + attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8. - For multisample framebuffer objects a color render buffer is created, - otherwise a texture with the texture target \a target is created. - The color render buffer or texture will have the internal format - \a internalFormat, and will be bound to the \c GL_COLOR_ATTACHMENT0 - attachment in the framebuffer object. - - The \a attachment parameter describes the depth/stencil buffer - configuration. - - \sa samples(), attachment(), target(), internalFormat() + \sa samples(), attachment(), target(), internalTextureFormat() */ -QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(int samples, - QGLFramebufferObject::Attachment attachment, - GLenum target, - GLenum internalFormat) +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + +QGLFramebufferObjectFormat::QGLFramebufferObjectFormat() { d = new QGLFramebufferObjectFormatPrivate; - d->samples = samples; - d->attachment = attachment; - d->target = target; - d->internal_format = internalFormat; + d->samples = 0; + d->attachment = QGLFramebufferObject::NoAttachment; + d->target = GL_TEXTURE_2D; + d->internal_format = DEFAULT_FORMAT; } /*! @@ -176,6 +166,12 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() to \a samples. A sample count of 0 represents a regular non-multisample framebuffer object. + If the desired amount of samples per pixel is not supported by the hardware + then the maximum number of samples per pixel will be used. Note that + multisample framebuffer objects can not be bound as textures. Also, the + \c{GL_EXT_framebuffer_multisample} extension is required to create a + framebuffer with more than one sample per pixel. + \sa samples() */ void QGLFramebufferObjectFormat::setSamples(int samples) @@ -195,7 +191,7 @@ int QGLFramebufferObjectFormat::samples() const } /*! - Sets the attachments a framebuffer object should have to \a attachment. + Sets the attachment configuration of a framebuffer object to \a attachment. \sa attachment() */ @@ -238,27 +234,42 @@ GLenum QGLFramebufferObjectFormat::textureTarget() const } /*! - Sets the internal format of a framebuffer object's texture or multisample - framebuffer object's color buffer to \a internalFormat. + Sets the internal format of a framebuffer object's texture or + multisample framebuffer object's color buffer to + \a internalTextureFormat. - \sa internalFormat() + \sa internalTextureFormat() */ -void QGLFramebufferObjectFormat::setInternalFormat(GLenum internalFormat) +void QGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat) { - d->internal_format = internalFormat; + d->internal_format = internalTextureFormat; } /*! Returns the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer. - \sa setInternalFormat() + \sa setInternalTextureFormat() */ -GLenum QGLFramebufferObjectFormat::internalFormat() const +GLenum QGLFramebufferObjectFormat::internalTextureFormat() const { return d->internal_format; } +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS +/*! \internal */ +void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target) +{ + d->target = target; +} + +/*! \internal */ +void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat) +{ + d->internal_format = internalTextureFormat; +} +#endif + class QGLFramebufferObjectPrivate { public: @@ -469,7 +480,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At format.setTextureTarget(target); format.setSamples(int(samples)); format.setAttachment(fbo_attachment); - format.setInternalFormat(internal_format); + format.setInternalTextureFormat(internal_format); } /*! @@ -526,6 +537,12 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At the constructors that take a QGLFramebufferObject parameter, and set the QGLFramebufferObject::samples() property to a non-zero value. + For multisample framebuffer objects a color render buffer is created, + otherwise a texture with the specified texture target is created. + The color render buffer or texture will have the specified internal + format, and will be bound to the \c GL_COLOR_ATTACHMENT0 + attachment in the framebuffer object. + If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QGLContext::blitFramebuffer(). @@ -579,12 +596,6 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At \sa size(), texture(), attachment() */ -#ifndef QT_OPENGL_ES -#define DEFAULT_FORMAT GL_RGBA8 -#else -#define DEFAULT_FORMAT GL_RGBA -#endif - QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) : d_ptr(new QGLFramebufferObjectPrivate) { @@ -626,7 +637,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, const QGLFramebuff : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(size, format.attachment(), format.textureTarget(), format.internalFormat(), format.samples()); + d->init(size, format.attachment(), format.textureTarget(), format.internalTextureFormat(), format.samples()); } /*! \overload @@ -639,7 +650,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(QSize(width, height), format.attachment(), format.textureTarget(), format.internalFormat(), format.samples()); + d->init(QSize(width, height), format.attachment(), format.textureTarget(), format.internalTextureFormat(), format.samples()); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index cfc824b..ec1ae7d 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -137,18 +137,7 @@ class QGLFramebufferObjectFormatPrivate; class Q_OPENGL_EXPORT QGLFramebufferObjectFormat { public: -#if !defined(QT_OPENGL_ES) || defined(Q_QDOC) - QGLFramebufferObjectFormat(int samples = 0, - QGLFramebufferObject::Attachment attachment = QGLFramebufferObject::NoAttachment, - GLenum target = GL_TEXTURE_2D, - GLenum internalFormat = GL_RGBA8); -#else - QGLFramebufferObjectFormat(int samples = 0, - QGLFramebufferObject::Attachment attachment = QGLFramebufferObject::NoAttachment, - GLenum target = GL_TEXTURE_2D, - GLenum internalFormat = GL_RGBA); -#endif - + QGLFramebufferObjectFormat(); QGLFramebufferObjectFormat(const QGLFramebufferObjectFormat &other); QGLFramebufferObjectFormat &operator=(const QGLFramebufferObjectFormat &other); ~QGLFramebufferObjectFormat(); @@ -162,8 +151,13 @@ public: void setTextureTarget(GLenum target); GLenum textureTarget() const; - void setInternalFormat(GLenum internalFormat); - GLenum internalFormat() const; + void setInternalTextureFormat(GLenum internalTextureFormat); + GLenum internalTextureFormat() const; + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void setTextureTarget(QMacCompatGLenum target); + void setInternalTextureFormat(QMacCompatGLenum internalTextureFormat); +#endif private: QGLFramebufferObjectFormatPrivate *d; diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index c51ccc7..68db9c0 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -324,7 +324,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const filter->setSource(generateBlurShader(radius(), quality() == Qt::SmoothTransformation)); QGLFramebufferObjectFormat format; - format.setInternalFormat(src.hasAlphaChannel() ? GL_RGBA : GL_RGB); + format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(src.size(), format); if (!fbo) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 56b55d0..bcc6c61 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -2288,6 +2288,58 @@ void QGLShaderProgram::setUniformValue(const char *name, const QSizeF& size) setUniformValue(uniformLocation(name), size); } +// We have to repack matrices from qreal to GLfloat. +#define setUniformMatrix(func,location,value,cols,rows) \ + if (location == -1) \ + return; \ + if (sizeof(qreal) == sizeof(GLfloat)) { \ + func(location, 1, GL_FALSE, \ + reinterpret_cast<const GLfloat *>(value.constData())); \ + } else { \ + GLfloat mat[cols * rows]; \ + const qreal *data = value.constData(); \ + for (int i = 0; i < cols * rows; ++i) \ + mat[i] = data[i]; \ + func(location, 1, GL_FALSE, mat); \ + } +#if !defined(QT_OPENGL_ES_2) +#define setUniformGenericMatrix(func,colfunc,location,value,cols,rows) \ + if (location == -1) \ + return; \ + if (sizeof(qreal) == sizeof(GLfloat)) { \ + const GLfloat *data = reinterpret_cast<const GLfloat *> \ + (value.constData()); \ + if (func) \ + func(location, 1, GL_FALSE, data); \ + else \ + colfunc(location, cols, data); \ + } else { \ + GLfloat mat[cols * rows]; \ + const qreal *data = value.constData(); \ + for (int i = 0; i < cols * rows; ++i) \ + mat[i] = data[i]; \ + if (func) \ + func(location, 1, GL_FALSE, mat); \ + else \ + colfunc(location, cols, mat); \ + } +#else +#define setUniformGenericMatrix(func,colfunc,location,value,cols,rows) \ + if (location == -1) \ + return; \ + if (sizeof(qreal) == sizeof(GLfloat)) { \ + const GLfloat *data = reinterpret_cast<const GLfloat *> \ + (value.constData()); \ + colfunc(location, cols, data); \ + } else { \ + GLfloat mat[cols * rows]; \ + const qreal *data = value.constData(); \ + for (int i = 0; i < cols * rows; ++i) \ + mat[i] = data[i]; \ + colfunc(location, cols, mat); \ + } +#endif + /*! Sets the uniform variable at \a location in the current context to a 2x2 matrix \a value. @@ -2296,8 +2348,7 @@ void QGLShaderProgram::setUniformValue(const char *name, const QSizeF& size) */ void QGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value) { - if (location != -1) - glUniformMatrix2fv(location, 1, GL_FALSE, value.data()); + setUniformMatrix(glUniformMatrix2fv, location, value, 2, 2); } /*! @@ -2321,20 +2372,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix2x3fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix2x3fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform3fv(location, 2, value.data()); - } - } -#else - if (location != -1) - glUniform3fv(location, 2, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix2x3fv, glUniform3fv, location, value, 2, 3); } /*! @@ -2358,20 +2397,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix2x4fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix2x4fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform4fv(location, 2, value.data()); - } - } -#else - if (location != -1) - glUniform4fv(location, 2, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix2x4fv, glUniform4fv, location, value, 2, 4); } /*! @@ -2395,20 +2422,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix3x2fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix3x2fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform2fv(location, 3, value.data()); - } - } -#else - if (location != -1) - glUniform2fv(location, 3, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix3x2fv, glUniform2fv, location, value, 3, 2); } /*! @@ -2432,8 +2447,7 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value) { - if (location != -1) - glUniformMatrix3fv(location, 1, GL_FALSE, value.data()); + setUniformMatrix(glUniformMatrix3fv, location, value, 3, 3); } /*! @@ -2457,20 +2471,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix3x4fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix3x4fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform4fv(location, 3, value.data()); - } - } -#else - if (location != -1) - glUniform4fv(location, 3, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix3x4fv, glUniform4fv, location, value, 3, 4); } /*! @@ -2494,20 +2496,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix4x2fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix4x2fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform2fv(location, 4, value.data()); - } - } -#else - if (location != -1) - glUniform2fv(location, 4, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix4x2fv, glUniform2fv, location, value, 4, 2); } /*! @@ -2531,20 +2521,8 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value) { -#if !defined(QT_OPENGL_ES_2) - if (location != -1) { - if (glUniformMatrix4x3fv) { - // OpenGL 2.1+: pass the matrix directly. - glUniformMatrix4x3fv(location, 1, GL_FALSE, value.data()); - } else { - // OpenGL 2.0: pass the matrix columns as a vector. - glUniform3fv(location, 4, value.data()); - } - } -#else - if (location != -1) - glUniform3fv(location, 4, value.data()); -#endif + setUniformGenericMatrix + (glUniformMatrix4x3fv, glUniform3fv, location, value, 4, 3); } /*! @@ -2568,8 +2546,7 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value */ void QGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value) { - if (location != -1) - glUniformMatrix4fv(location, 1, GL_FALSE, value.data()); + setUniformMatrix(glUniformMatrix4fv, location, value, 4, 4); } /*! @@ -2815,18 +2792,20 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *v setUniformValueArray(uniformLocation(name), values, count); } -// We may have to repack matrix arrays if the matrix types -// contain additional flag bits. Especially QMatrix4x4. +// We have to repack matrix arrays from qreal to GLfloat. #define setUniformMatrixArray(func,location,values,count,type,cols,rows) \ if (location == -1 || count <= 0) \ return; \ - if (count == 1 || sizeof(type) == cols * rows * sizeof(GLfloat)) { \ - func(location, count, GL_FALSE, values->constData()); \ + if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ + func(location, count, GL_FALSE, \ + reinterpret_cast<const GLfloat *>(values[0].constData())); \ } else { \ QVarLengthArray<GLfloat> temp(cols * rows * count); \ for (int index = 0; index < count; ++index) { \ - qMemCopy(temp.data() + cols * rows * index, \ - values[index].constData(), cols * rows * sizeof(GLfloat)); \ + for (int index2 = 0; index2 < (cols * rows); ++index2) { \ + temp.data()[cols * rows * index + index2] = \ + values[index].constData()[index2]; \ + } \ } \ func(location, count, GL_FALSE, temp.constData()); \ } @@ -2834,16 +2813,20 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *v #define setUniformGenericMatrixArray(func,colfunc,location,values,count,type,cols,rows) \ if (location == -1 || count <= 0) \ return; \ - if (count == 1 || sizeof(type) == cols * rows * sizeof(GLfloat)) { \ + if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ + const GLfloat *data = reinterpret_cast<const GLfloat *> \ + (values[0].constData()); \ if (func) \ - func(location, count, GL_FALSE, values->constData()); \ + func(location, count, GL_FALSE, data); \ else \ - colfunc(location, cols * count, values->constData()); \ + colfunc(location, count * cols, data); \ } else { \ QVarLengthArray<GLfloat> temp(cols * rows * count); \ for (int index = 0; index < count; ++index) { \ - qMemCopy(temp.data() + cols * rows * index, \ - values[index].constData(), cols * rows * sizeof(GLfloat)); \ + for (int index2 = 0; index2 < (cols * rows); ++index2) { \ + temp.data()[cols * rows * index + index2] = \ + values[index].constData()[index2]; \ + } \ } \ if (func) \ func(location, count, GL_FALSE, temp.constData()); \ @@ -2854,13 +2837,17 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *v #define setUniformGenericMatrixArray(func,colfunc,location,values,count,type,cols,rows) \ if (location == -1 || count <= 0) \ return; \ - if (count == 1 || sizeof(type) == cols * rows * sizeof(GLfloat)) { \ - colfunc(location, cols * count, values->constData()); \ + if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ + const GLfloat *data = reinterpret_cast<const GLfloat *> \ + (values[0].constData()); \ + colfunc(location, count * cols, data); \ } else { \ QVarLengthArray<GLfloat> temp(cols * rows * count); \ for (int index = 0; index < count; ++index) { \ - qMemCopy(temp.data() + cols * rows * index, \ - values[index].constData(), cols * rows * sizeof(GLfloat)); \ + for (int index2 = 0; index2 < (cols * rows); ++index2) { \ + temp.data()[cols * rows * index + index2] = \ + values[index].constData()[index2]; \ + } \ } \ colfunc(location, count * cols, temp.constData()); \ } diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 5e87e96..d63d2ad 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -84,7 +84,7 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize if (format.samples() == requestFormat.samples() && format.attachment() == requestFormat.attachment() && format.textureTarget() == requestFormat.textureTarget() - && format.internalFormat() == requestFormat.internalFormat()) + && format.internalTextureFormat() == requestFormat.internalTextureFormat()) { // choose the fbo with a matching format and the closest size if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) @@ -467,7 +467,7 @@ QPaintEngine* QGLPixmapData::paintEngine() const QGLFramebufferObjectFormat format; format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); format.setSamples(4); - format.setInternalFormat(m_hasAlpha ? GL_RGBA : GL_RGB); + format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); m_renderFbo = qgl_fbo_pool()->acquire(size(), format); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index a59501c..a85b9ae 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -569,7 +569,7 @@ void QGLWindowSurface::updateGeometry() QGLFramebufferObjectFormat format; format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - format.setInternalFormat(GL_RGBA); + format.setInternalTextureFormat(GLenum(GL_RGBA)); format.setTextureTarget(target); if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 5651506..211e8a5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -95,6 +95,9 @@ public: IDirectFBImageProvider *imageProvider; #endif QColor backgroundColor; + IDirectFBSurface *cursorSurface; + qint64 cursorImageKey; + QDirectFBScreen *q; }; @@ -117,6 +120,8 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) #if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE , imageProvider(0) #endif + , cursorSurface(0) + , cursorImageKey(0) , q(qptr) { #ifndef QT_NO_QWS_SIGNALHANDLER @@ -1386,94 +1391,149 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const return QScreen::createSurface(key); } -// Normally, when using DirectFB to compose the windows (I.e. when -// QT_NO_DIRECTFB_WM isn't set), exposeRegion will simply return. If -// QT_NO_DIRECTFB_WM is set, exposeRegion will compose only non-directFB -// window surfaces. Normal, directFB surfaces are handled by DirectFB. -void QDirectFBScreen::exposeRegion(QRegion r, int changing) +#if defined QT_NO_DIRECTFB_WM +struct PaintCommand { + PaintCommand() : dfbSurface(0), windowOpacity(255), blittingFlags(DSBLIT_NOFX) {} + IDirectFBSurface *dfbSurface; + QImage image; + QPoint windowPosition; + QRegion source; + quint8 windowOpacity; + DFBSurfaceBlittingFlags blittingFlags; +}; + +static inline void initParameters(DFBRectangle &source, const QRect &sourceGlobal, const QPoint &pos) +{ + source.x = sourceGlobal.x() - pos.x(); + source.y = sourceGlobal.y() - pos.y(); + source.w = sourceGlobal.width(); + source.h = sourceGlobal.height(); +} +#endif + +void QDirectFBScreen::exposeRegion(QRegion r, int) { + Q_UNUSED(r); #if defined QT_NO_DIRECTFB_WM - const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows(); - if (changing < 0 || changing >= windows.size()) { - return; - } - QWSWindow *win = windows.at(changing); - QWSWindowSurface *s = win->windowSurface(); r &= region(); if (r.isEmpty()) { return; } + r = r.boundingRect(); - const QRect brect = r.boundingRect(); + IDirectFBSurface *primary = d_ptr->primarySurface; + const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows(); + QVarLengthArray<PaintCommand, 4> commands(windows.size()); + QRegion region = r; + int idx = 0; + for (int i=0; i<windows.size(); ++i) { + QWSWindowSurface *surface = windows.at(i)->windowSurface(); + if (!surface) + continue; + + const QRect windowGeometry = surface->geometry(); + const QRegion intersection = region & windowGeometry; + if (intersection.isEmpty()) { + continue; + } - if (!s) { - solidFill(d_ptr->backgroundColor, r); - } else { - const QRect windowGeometry = s->geometry(); - const QRegion outsideWindow = r.subtracted(windowGeometry); - if (!outsideWindow.isEmpty()) { - solidFill(d_ptr->backgroundColor, outsideWindow); + PaintCommand &cmd = commands[idx]; + + if (surface->key() == QLatin1String("directfb")) { + const QDirectFBWindowSurface *ws = static_cast<QDirectFBWindowSurface*>(surface); + cmd.dfbSurface = ws->directFBSurface(); + + if (!cmd.dfbSurface) { + continue; + } + } else { + cmd.image = surface->image(); + if (cmd.image.isNull()) { + continue; + } } - const QRegion insideWindow = r.intersected(windowGeometry); - if (!insideWindow.isEmpty()) { - QDirectFBWindowSurface *dfbWindowSurface = (s->key() == QLatin1String("directfb")) - ? static_cast<QDirectFBWindowSurface*>(s) : 0; - if (dfbWindowSurface) { - IDirectFBSurface *surface = dfbWindowSurface->directFBSurface(); - Q_ASSERT(surface); - const int n = insideWindow.numRects(); - if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) { - const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft()); - const DFBRectangle rect = { - source.x(), source.y(), source.width(), source.height() - }; - - d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect, - windowGeometry.x() + source.x(), - windowGeometry.y() + source.y()); - - } else { - const QVector<QRect> rects = insideWindow.rects(); - QVarLengthArray<DFBRectangle, 16> dfbRectangles(n); - QVarLengthArray<DFBPoint, 16> dfbPoints(n); - - for (int i=0; i<n; ++i) { - const QRect source = (rects.at(i).intersected(windowGeometry)).translated(-windowGeometry.topLeft()); - DFBRectangle &rect = dfbRectangles[i]; - rect.x = source.x(); - rect.y = source.y(); - rect.w = source.width(); - rect.h = source.height(); - dfbPoints[i].x = (windowGeometry.x() + source.x()); - dfbPoints[i].y = (windowGeometry.y() + source.y()); - } - d_ptr->primarySurface->BatchBlit(d_ptr->primarySurface, surface, dfbRectangles.constData(), - dfbPoints.constData(), n); - } + ++idx; + + cmd.windowPosition = windowGeometry.topLeft(); + cmd.source = intersection; + if (windows.at(i)->isOpaque()) { + region -= intersection; + if (region.isEmpty()) + break; + } else { + cmd.windowOpacity = windows.at(i)->opacity(); + cmd.blittingFlags = cmd.windowOpacity == 255 + ? DSBLIT_BLEND_ALPHACHANNEL + : (DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA); + } + } + if (!region.isEmpty()) { + solidFill(d_ptr->backgroundColor, region); + } + + while (idx > 0) { + const PaintCommand &cmd = commands[--idx]; + Q_ASSERT(cmd.dfbSurface || !cmd.image.isNull()); + IDirectFBSurface *surface; + if (cmd.dfbSurface) { + surface = cmd.dfbSurface; + } else { + Q_ASSERT(!cmd.image.isNull()); + DFBResult result; + surface = createDFBSurface(cmd.image, cmd.image.format(), DontTrackSurface, &result); + Q_ASSERT((result != DFB_OK) == !surface); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::exposeRegion: Can't create surface from image", result); + continue; + } + } + + primary->SetBlittingFlags(primary, cmd.blittingFlags); + if (cmd.blittingFlags & DSBLIT_BLEND_COLORALPHA) { + primary->SetColor(primary, 0xff, 0xff, 0xff, cmd.windowOpacity); + } + const QRegion ®ion = cmd.source; + const int rectCount = region.numRects(); + DFBRectangle source; + if (rectCount == 1) { + ::initParameters(source, region.boundingRect(), cmd.windowPosition); + primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); + } else { + const QVector<QRect> rects = region.rects(); + for (int i=0; i<rectCount; ++i) { + ::initParameters(source, rects.at(i), cmd.windowPosition); + primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); } } + if (surface != cmd.dfbSurface) { + surface->Release(surface); + } } -#ifdef QT_NO_DIRECTFB_CURSOR + primary->SetColor(primary, 0xff, 0xff, 0xff, 0xff); + +#if defined QT_NO_DIRECTFB_CURSOR and !defined QT_NO_QWS_CURSOR if (QScreenCursor *cursor = QScreenCursor::instance()) { const QRect cursorRectangle = cursor->boundingRect(); - if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) { + if (cursor->isVisible() && !cursor->isAccelerated() && r.intersects(cursorRectangle)) { const QImage image = cursor->image(); - IDirectFBSurface *surface = createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); - d_ptr->primarySurface->SetBlittingFlags(d_ptr->primarySurface, DSBLIT_BLEND_ALPHACHANNEL); - d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, 0, cursorRectangle.x(), cursorRectangle.y()); - surface->Release(surface); -#if (Q_DIRECTFB_VERSION >= 0x010000) - d_ptr->primarySurface->ReleaseSource(d_ptr->primarySurface); -#endif + if (image.cacheKey() != d_ptr->cursorImageKey) { + if (d_ptr->cursorSurface) { + releaseDFBSurface(d_ptr->cursorSurface); + } + d_ptr->cursorSurface = createDFBSurface(image, image.format(), QDirectFBScreen::TrackSurface); + d_ptr->cursorImageKey = image.cacheKey(); + } + + Q_ASSERT(d_ptr->cursorSurface); + primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL); + primary->Blit(primary, d_ptr->cursorSurface, 0, cursorRectangle.x(), cursorRectangle.y()); } } #endif - flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint()); -#else - Q_UNUSED(r); - Q_UNUSED(changing); + flipSurface(primary, d_ptr->flipFlags, r, QPoint()); + primary->SetBlittingFlags(primary, DSBLIT_NOFX); #endif } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 9e0691d..61cfec51 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -184,11 +184,23 @@ static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, void QDirectFBWindowSurface::setGeometry(const QRect &rect) { + const QRect oldRect = geometry(); + if (oldRect == rect) + return; + IDirectFBSurface *oldSurface = dfbSurface; -#ifdef QT_NO_DIRECTFB_WM - IDirectFBSurface *primarySurface = screen->primarySurface(); - Q_ASSERT(primarySurface); + const bool sizeChanged = oldRect.size() != rect.size(); + if (sizeChanged) { + delete engine; + engine = 0; + unlockSurface(); +#ifdef QT_DIRECTFB_SUBSURFACE + releaseSubSurface(); #endif + releaseSurface(); + Q_ASSERT(!dfbSurface); + } + if (rect.isNull()) { #ifndef QT_NO_DIRECTFB_WM if (dfbWindow) { @@ -196,27 +208,25 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) dfbWindow = 0; } #endif - if (dfbSurface) { -#ifdef QT_NO_DIRECTFB_WM - if (dfbSurface != primarySurface) + Q_ASSERT(!dfbSurface); +#ifdef QT_DIRECTFB_SUBSURFACE + Q_ASSERT(!subSurface); #endif - dfbSurface->Release(dfbSurface); - dfbSurface = 0; - } - } else if (rect != geometry()) { - const QRect oldRect = geometry(); - DFBResult result = DFB_OK; - // If we're in a resize, the surface shouldn't be locked + } else { #ifdef QT_DIRECTFB_WM if (!dfbWindow) { createWindow(rect); } else { setWindowGeometry(dfbWindow, oldRect, rect); + Q_ASSERT(!sizeChanged || !dfbSurface); + if (sizeChanged) + dfbWindow->GetSurface(dfbWindow, &dfbSurface); } #else + IDirectFBSurface *primarySurface = screen->primarySurface(); + DFBResult result = DFB_OK; if (mode == Primary) { - if (dfbSurface && dfbSurface != primarySurface) - dfbSurface->Release(dfbSurface); + Q_ASSERT(primarySurface); if (rect == screen->region().boundingRect()) { dfbSurface = primarySurface; } else { @@ -224,28 +234,23 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) rect.width(), rect.height() }; result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface); } - } else { - if (!dfbSurface || oldRect.size() != rect.size()) { - if (dfbSurface) - dfbSurface->Release(dfbSurface); + } else { // mode == Offscreen + if (!dfbSurface) { dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); } - const QRegion region = QRegion(oldRect.isEmpty() ? screen->region() : QRegion(oldRect)).subtracted(rect); - screen->erase(region); - screen->flipSurface(primarySurface, flipFlags, region, QPoint()); - } -#endif - if (size() != geometry().size()) { - delete engine; - engine = 0; } - if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); +#endif } if (oldSurface != dfbSurface) updateFormat(); + QWSWindowSurface::setGeometry(rect); +#ifdef QT_NO_DIRECTFB_WM + if (oldRect.isEmpty()) + screen->exposeRegion(screen->region(), 0); +#endif } QByteArray QDirectFBWindowSurface::permanentState() const @@ -346,63 +351,16 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, const QRect windowGeometry = QDirectFBWindowSurface::geometry(); #ifdef QT_NO_DIRECTFB_WM - IDirectFBSurface *primarySurface = screen->primarySurface(); if (mode == Offscreen) { - primarySurface->SetBlittingFlags(primarySurface, DSBLIT_NOFX); - const QRect windowRect(0, 0, windowGeometry.width(), windowGeometry.height()); - const int n = region.numRects(); - if (n == 1 || boundingRectFlip ) { - const QRect regionBoundingRect = region.boundingRect().translated(offset); - const QRect source = windowRect & regionBoundingRect; - const DFBRectangle rect = { - source.x(), source.y(), source.width(), source.height() - }; - primarySurface->Blit(primarySurface, dfbSurface, &rect, - windowGeometry.x() + source.x(), - windowGeometry.y() + source.y()); - } else { - const QVector<QRect> rects = region.rects(); - QVarLengthArray<DFBRectangle, 16> dfbRectangles(n); - QVarLengthArray<DFBPoint, 16> dfbPoints(n); - - for (int i=0; i<n; ++i) { - const QRect &r = rects.at(i).translated(offset); - const QRect source = windowRect & r; - DFBRectangle &rect = dfbRectangles[i]; - rect.x = source.x(); - rect.y = source.y(); - rect.w = source.width(); - rect.h = source.height(); - dfbPoints[i].x = (windowGeometry.x() + source.x()); - dfbPoints[i].y = (windowGeometry.y() + source.y()); - } - primarySurface->BatchBlit(primarySurface, dfbSurface, dfbRectangles.constData(), - dfbPoints.constData(), n); - } - } - -#ifdef QT_NO_DIRECTFB_CURSOR - if (QScreenCursor *cursor = QScreenCursor::instance()) { - const QRect cursorRectangle = cursor->boundingRect(); - if (cursor->isVisible() && !cursor->isAccelerated() - && region.intersects(cursorRectangle.translated(-(offset + windowGeometry.topLeft())))) { - const QImage image = cursor->image(); - - IDirectFBSurface *surface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); - primarySurface->SetBlittingFlags(primarySurface, DSBLIT_BLEND_ALPHACHANNEL); - primarySurface->Blit(primarySurface, surface, 0, cursorRectangle.x(), cursorRectangle.y()); - surface->Release(surface); -#if (Q_DIRECTFB_VERSION >= 0x010000) - primarySurface->ReleaseSource(primarySurface); -#endif - } + QRegion r = region; + r.translate(offset + windowGeometry.topLeft()); + screen->exposeRegion(r, 0); + } else { + screen->flipSurface(dfbSurface, flipFlags, region, offset); } -#endif - if (mode == Offscreen) { - screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft()); - } else -#endif +#else screen->flipSurface(dfbSurface, flipFlags, region, offset); +#endif #ifdef QT_DIRECTFB_TIMING enum { Secs = 3 }; @@ -417,8 +375,9 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, void QDirectFBWindowSurface::beginPaint(const QRegion &) { - if (!engine) + if (!engine) { engine = new QDirectFBPaintEngine(this); + } } void QDirectFBWindowSurface::endPaint(const QRegion &) diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index bac8f3a..2b17b27 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -40,17 +40,10 @@ ****************************************************************************/ // INCLUDE FILES -#include <exception> -#include <eikstart.h> -#include "qts60mainapplication_p.h" +#include <e32base.h> +#include <qglobal.h> -/** - * factory function to create the QtS60Main application class - */ -LOCAL_C CApaApplication* NewApplication() -{ - return new CQtS60MainApplication; -} +GLDEF_C TInt QtMainWrapper(); /** * A normal Symbian OS executable provides an E32Main() function which is @@ -58,5 +51,10 @@ LOCAL_C CApaApplication* NewApplication() */ GLDEF_C TInt E32Main() { - return EikStart::RunApplication(NewApplication); + CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New()); + TInt err = 0; + TRAP(err, QtMainWrapper()); + delete cleanupStack; + + return err; } diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index ea6132f..1040652 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -49,8 +49,12 @@ #include <e32std.h> #include <e32base.h> +#include <exception> #include "estlib.h" +// Needed for QT_TRYCATCH_LEAVING. +#include <qglobal.h> + #ifdef __ARMCC__ __asm int CallMain(int argc, char *argv[], char *envp[]) { diff --git a/src/s60main/qts60mainappui_p.h b/src/s60main/qts60mainappui_p.h deleted file mode 100644 index 7f8d730..0000000 --- a/src/s60main/qts60mainappui_p.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Symbian application wrapper of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef __QtS60MainAPPUI_H__ -#define __QtS60MainAPPUI_H__ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include <aknappui.h> - -// FORWARD DECLARATIONS - -// CLASS DECLARATION -/** -* CQtS60MainAppUi application UI class. -* Interacts with the user through the UI and request message processing -* from the handler class -*/ -class CQtS60MainAppUi : public CAknAppUi - { - public: // Constructors and destructor - - /** - * ConstructL. - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CQtS60MainAppUi. - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi - */ - CQtS60MainAppUi(); - - /** - * ~CQtS60MainAppUi. - * Virtual Destructor. - */ - virtual ~CQtS60MainAppUi(); - - protected: - void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType); - void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar); - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); - - private: // Functions from base classes - - /** - * From CEikAppUi, HandleCommandL. - * Takes care of command handling. - * @param aCommand Command to be handled. - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknAppUi, HandleResourceChangeL - * Handles resource change events such as layout switches in global level. - * @param aType event type. - */ - void HandleResourceChangeL(TInt aType); - - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - - /** - * Static callback method for invoking Qt main. - * Called asynchronously from ConstructL() - passes call to non static method. - */ - static TInt OpenCMainStaticCallBack( TAny* aObject ); - - /** - * Callback method for invoking Qt main. - * Called from static OpenCMainStaticCallBack. - */ - void OpenCMainCallBack(); - - protected: - void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); - - - private: // Data - - /** - * Async callback object to call Qt main - * Owned by CQtS60MainAppUi - */ - CAsyncCallBack* iAsyncCallBack; - - }; - -#endif // __QtS60MainAPPUI_H__ - -// End of File diff --git a/src/s60main/qts60maindocument_p.h b/src/s60main/qts60maindocument_p.h deleted file mode 100644 index 35d6d85..0000000 --- a/src/s60main/qts60maindocument_p.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Symbian application wrapper of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef __QTS60MAINDOCUMENT_H__ -#define __QTS60MAINDOCUMENT_H__ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include <akndoc.h> - -// FORWARD DECLARATIONS -class CQtS60MainAppUi; -class CEikApplication; - - -// CLASS DECLARATION - -/** -* CQtS60MainDocument application class. -* An instance of class CQtS60MainDocument is the Document part of the -* AVKON application framework for the QtS60Main application. -*/ -class CQtS60MainDocument : public CAknDocument - { - public: // Constructors and destructor - - /** - * NewL. - * Two-phased constructor. - * Construct a CQtS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CQtS60MainDocument. - */ - static CQtS60MainDocument* NewL( CEikApplication& aApp ); - - /** - * NewLC. - * Two-phased constructor. - * Construct a CQtS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CQtS60MainDocument. - */ - static CQtS60MainDocument* NewLC( CEikApplication& aApp ); - - /** - * ~CQtS60MainDocument - * Virtual Destructor. - */ - virtual ~CQtS60MainDocument(); - - public: // Functions from base classes - - /** - * CreateAppUiL - * From CEikDocument, CreateAppUiL. - * Create a CQtS60MainAppUi object and return a pointer to it. - * The object returned is owned by the Uikon framework. - * @return Pointer to created instance of AppUi. - */ - CEikAppUi* CreateAppUiL(); - - private: // Constructors - - /** - * ConstructL - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CQtS60MainDocument. - * C++ default constructor. - * @param aApp Application creating this document. - */ - CQtS60MainDocument( CEikApplication& aApp ); - - }; - -#endif // __QTS60MAINDOCUMENT_H__ - -// End of File diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index a4833af..cc3c547 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -14,13 +14,7 @@ symbian { CONFIG -= jpeg INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore $$MW_LAYER_SYSTEMINCLUDE SOURCES = qts60main.cpp \ - qts60mainapplication.cpp \ - qts60mainappui.cpp \ - qts60maindocument.cpp - - HEADERS = qts60mainapplication_p.h \ - qts60mainappui_p.h \ - qts60maindocument_p.h + qts60main_mcrt0.cpp # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index bd5d161..ecfb060 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -610,7 +610,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c if (i < (int)scriptArgs.size()) actual = engine->scriptValueFromJSCValue(scriptArgs.at(i)); else - actual = QScriptValue::QScriptValue(QScriptValue::UndefinedValue); + actual = QScriptValue(QScriptValue::UndefinedValue); QScriptMetaType argType = mtd.argumentType(i); int tid = -1; QVariant v; diff --git a/src/src.pro b/src/src.pro index 1801d55..780e56e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -120,7 +120,7 @@ src_webkit.target = sub-webkit src_tools_activeqt.depends = src_tools_idc src_gui src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, webkit) { - src_webkit.depends = src_gui src_sql src_network src_xml + src_webkit.depends = src_gui src_sql src_network src_xml src_phonon #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index b7b041f..e2c3d92 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -78,7 +78,7 @@ double qstrtod(const char *s00, char const **se, bool *ok); // ======== duplicated from qcolor_p -static inline int h2i(char hex) +static inline int qsvg_h2i(char hex) { if (hex >= '0' && hex <= '9') return hex - '0'; @@ -89,18 +89,18 @@ static inline int h2i(char hex) return -1; } -static inline int hex2int(const char *s) +static inline int qsvg_hex2int(const char *s) { - return (h2i(s[0]) << 4) | h2i(s[1]); + return (qsvg_h2i(s[0]) << 4) | qsvg_h2i(s[1]); } -static inline int hex2int(char s) +static inline int qsvg_hex2int(char s) { - int h = h2i(s); + int h = qsvg_h2i(s); return (h << 4) | h; } -bool qt_get_hex_rgb(const char *name, QRgb *rgb) +bool qsvg_get_hex_rgb(const char *name, QRgb *rgb) { if(name[0] != '#') return false; @@ -108,21 +108,21 @@ bool qt_get_hex_rgb(const char *name, QRgb *rgb) int len = qstrlen(name); int r, g, b; if (len == 12) { - r = hex2int(name); - g = hex2int(name + 4); - b = hex2int(name + 8); + r = qsvg_hex2int(name); + g = qsvg_hex2int(name + 4); + b = qsvg_hex2int(name + 8); } else if (len == 9) { - r = hex2int(name); - g = hex2int(name + 3); - b = hex2int(name + 6); + r = qsvg_hex2int(name); + g = qsvg_hex2int(name + 3); + b = qsvg_hex2int(name + 6); } else if (len == 6) { - r = hex2int(name); - g = hex2int(name + 2); - b = hex2int(name + 4); + r = qsvg_hex2int(name); + g = qsvg_hex2int(name + 2); + b = qsvg_hex2int(name + 4); } else if (len == 3) { - r = hex2int(name[0]); - g = hex2int(name[1]); - b = hex2int(name[2]); + r = qsvg_hex2int(name[0]); + g = qsvg_hex2int(name[1]); + b = qsvg_hex2int(name[2]); } else { r = g = b = -1; } @@ -134,7 +134,7 @@ bool qt_get_hex_rgb(const char *name, QRgb *rgb) return true; } -bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb) +bool qsvg_get_hex_rgb(const QChar *str, int len, QRgb *rgb) { if (len > 13) return false; @@ -142,7 +142,7 @@ bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb) for(int i = 0; i < len; ++i) tmp[i] = str[i].toLatin1(); tmp[len] = 0; - return qt_get_hex_rgb(tmp, rgb); + return qsvg_get_hex_rgb(tmp, rgb); } // ======== end of qcolor_p duplicate @@ -801,7 +801,7 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler // #rrggbb is very very common, so let's tackle it here // rather than falling back to QColor QRgb rgb; - bool ok = qt_get_hex_rgb(colorStrTr.unicode(), colorStrTr.length(), &rgb); + bool ok = qsvg_get_hex_rgb(colorStrTr.unicode(), colorStrTr.length(), &rgb); if (ok) color.setRgb(rgb); return ok; diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 9d23c8b..665b784 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -67,6 +67,7 @@ QT_MODULE(Test) namespace QTest { enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDClick, MouseMove }; + const char *mouseActionNames[] = { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) @@ -113,8 +114,10 @@ namespace QTest QTEST_ASSERT(false); } QSpontaneKeyEvent::setSpontaneous(&me); - if (!qApp->notify(widget, &me)) - QTest::qWarn("Mouse event not accepted by receiving widget"); + if (!qApp->notify(widget, &me)) { + QString warning("Mouse event \"%1\" not accepted by receiving widget"); + QTest::qWarn(warning.arg(mouseActionNames[static_cast<int>(action)]).toAscii().data()); + } } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 8dcc4aa..197414b 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -474,6 +474,7 @@ WriteInitialization::WriteInitialization(Uic *uic, bool activateScripts) : m_dindent(m_indent + m_option.indent), m_stdsetdef(true), m_layoutMarginType(TopLevelMargin), + m_mainFormUsedInRetranslateUi(false), m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly), m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly), m_actionOut(&m_delayedActionInitialization, QIODevice::WriteOnly), @@ -569,11 +570,11 @@ void WriteInitialization::acceptUI(DomUI *node) m_output << m_option.indent << "} // setupUi\n\n"; - if (m_delayedActionInitialization.isEmpty()) { + if (!m_mainFormUsedInRetranslateUi) { m_refreshInitialization += m_indent; m_refreshInitialization += QLatin1String("Q_UNUSED("); m_refreshInitialization += varName ; - m_refreshInitialization +=QLatin1String(");\n"); + m_refreshInitialization += QLatin1String(");\n"); } m_output << m_option.indent << "void " << "retranslateUi(" << widgetClassName << " *" << varName << ")\n" @@ -1531,6 +1532,12 @@ void WriteInitialization::writeProperties(const QString &varName, o << ");\n"; if (defineC) closeIfndef(o, QLatin1String(defineC)); + + if (varName == m_mainFormVarName && &o == &m_refreshOut) { + // this is the only place (currently) where we output mainForm name to the retranslateUi(). + // Other places output merely instances of a certain class (which cannot be main form, e.g. QListWidget). + m_mainFormUsedInRetranslateUi = true; + } } } if (leftMargin != -1 || topMargin != -1 || rightMargin != -1 || bottomMargin != -1) { diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h index 19e4fc7..b0564d0 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.h +++ b/src/tools/uic/cpp/cppwriteinitialization.h @@ -350,6 +350,7 @@ private: QString m_generatedClass; QString m_mainFormVarName; + bool m_mainFormUsedInRetranslateUi; QString m_delayedInitialization; QTextStream m_delayedOut; |