diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-13 14:06:59 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-13 14:06:59 (GMT) |
commit | 9bd9a52549bc8e0069051ad36b55ab0c7dda06ab (patch) | |
tree | 8957a1a3621ee421a8c4bdd02e88c90ca21f4a76 | |
parent | 92f58608aa0bac53ed64450b5d94c879eb01cbc3 (diff) | |
parent | 23788fc8431d80f7d7f613685ff8571d576a73a2 (diff) | |
download | Qt-9bd9a52549bc8e0069051ad36b55ab0c7dda06ab.zip Qt-9bd9a52549bc8e0069051ad36b55ab0c7dda06ab.tar.gz Qt-9bd9a52549bc8e0069051ad36b55ab0c7dda06ab.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
-rw-r--r-- | bin/patch_capabilities.pl | 46 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 1 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 51 | ||||
-rw-r--r-- | src/gui/inputmethod/qinputcontext.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 38 |
6 files changed, 86 insertions, 63 deletions
diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 586e7b0..d75605b 100644 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -14,7 +14,7 @@ if (@ARGV) { # Parse the first given script argument as a ".pkg" file name. my $pkgFileName = shift(@ARGV); - + # If the specified ".pkg" file exists (and can be read), if (($pkgFileName =~ m|\.pkg$|i) && -r($pkgFileName)) { @@ -27,44 +27,44 @@ if (@ARGV) push (@capabilitiesToSet, pop(@ARGV)); } } - + # Start with no binaries listed. my @binaries = (); - + # Open the ".pkg" file. - open (PKG, "<".$pkgFileName); - + open (PKG, "<".$pkgFileName); + # Parse each line. while (<PKG>) { my $line = $_; - chomp ($line); - + chomp ($line); + # If the line specifies a file, parse the source and destination locations. if ($line =~ m|\"([^\"]+)\"\s*\-\s*\"([^\"]+)\"|) { my $sourcePath = $1; my $destinationPath = $2; - + # If the given file is a binary, check the target and binary type (+ the actual filename) from its path. - if ($sourcePath =~ m:\\epoc32\\release\\([^\\]+)\\(udeb|urel)\\(\w+(\.dll|\.exe)):i) + if ($sourcePath =~ m:/epoc32/release/([^/]+)/(udeb|urel)/(\w+(\.dll|\.exe)):i) { push (@binaries, $sourcePath); } } } - + # Close the ".pkg" file. close (PKG); - + print ("\n"); - - my $baseCommandToExecute = "elftran -capability \""; + + my $baseCommandToExecute = "elftran -capability \""; if (@capabilitiesToSet) - { + { $baseCommandToExecute .= join(" ", @capabilitiesToSet); - } - $baseCommandToExecute .= "\" "; + } + $baseCommandToExecute .= "\" "; # Actually set the capabilities of the listed binaries. foreach my $binaryPath(@binaries) @@ -72,19 +72,19 @@ if (@ARGV) # Create the command line for setting the capabilities. my $commandToExecute = $baseCommandToExecute; $commandToExecute .= $binaryPath; - + # Actually execute the elftran command to set the capabilities. system ($commandToExecute." > NUL"); print ("Executed ".$commandToExecute."\n"); - + ## Create another command line to check that the set capabilities are correct. - #$commandToExecute = "elftran -dump s ".$binaryPath; - } - + #$commandToExecute = "elftran -dump s ".$binaryPath; + } + print ("\n"); } -} -else +} +else { print("This script can be used to set capabilities of all binaries\n"); print("specified for deployment in a .pkg file.\n"); diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 9ce9724..50f8a12 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -65,6 +65,7 @@ private: void commitCurrentString(); void updateHints(); void applyHints(Qt::InputMethodHints hints); + void applyFormat(QList<QInputMethodEvent::Attribute> *attributes); // From MCoeFepAwareTextEditor public: diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 1ae3d79..8612e55 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -465,6 +465,37 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) CCoeEnv::Static()->InputCapabilitiesChanged(); } +void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attributes) +{ + TCharFormat cFormat; + TInt numChars = 0; + TInt charPos = 0; + int oldSize = attributes->size(); + while (m_formatRetriever) { + m_formatRetriever->GetFormatOfFepInlineText(cFormat, numChars, charPos); + if (numChars <= 0) { + // This shouldn't happen according to S60 docs, but apparently does sometimes. + break; + } + attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, + charPos, + numChars, + QVariant(qt_TCharFormat2QTextCharFormat(cFormat)))); + charPos += numChars; + if (charPos >= m_preeditString.size()) { + break; + } + } + + if (attributes->size() == oldSize) { + // S60 didn't provide any format, so let's give our own instead. + attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, + 0, + m_preeditString.size(), + standardFormat(PreeditFormat))); + } +} + void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* /*aCustomDraw*/, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, @@ -485,24 +516,7 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, m_formatRetriever = &aInlineTextFormatRetriever; m_pointerHandler = &aPointerEventHandlerDuringInlineEdit; - TCharFormat cFormat; - TInt numChars = 0; - TInt charPos = 0; - while (m_formatRetriever) { - m_formatRetriever->GetFormatOfFepInlineText(cFormat, numChars, charPos); - if (numChars <= 0) { - // This shouldn't happen according to S60 docs, but apparently does sometimes. - break; - } - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, - charPos, - numChars, - QVariant(qt_TCharFormat2QTextCharFormat(cFormat)))); - charPos += numChars; - if (charPos >= m_preeditString.size()) { - break; - } - } + applyFormat(&attributes); attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, m_inlinePosition, @@ -522,6 +536,7 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, m_inlinePosition = aPositionOfInsertionPointInInlineText; QList<QInputMethodEvent::Attribute> attributes; + applyFormat(&attributes); attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, m_inlinePosition, m_cursorVisibility, diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp index c7d156c..00a9225 100644 --- a/src/gui/inputmethod/qinputcontext.cpp +++ b/src/gui/inputmethod/qinputcontext.cpp @@ -427,13 +427,6 @@ QTextFormat QInputContext::standardFormat(StandardFormat s) const switch (s) { case QInputContext::PreeditFormat: { fmt.setUnderlineStyle(QTextCharFormat::DashUnderline); -#ifndef Q_WS_WIN - int h1, s1, v1, h2, s2, v2; - pal.color(QPalette::Base).getHsv(&h1, &s1, &v1); - pal.color(QPalette::Background).getHsv(&h2, &s2, &v2); - bg.setHsv(h1, s1, (v1 + v2) / 2); - fmt.setBackground(QBrush(bg)); -#endif break; } case QInputContext::SelectionFormat: { diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1b6bdea..1906025 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -135,8 +135,10 @@ bool QApplicationPrivate::quitOnLastWindowClosed = true; #ifdef Q_OS_WINCE int QApplicationPrivate::autoMaximizeThreshold = -1; -#endif bool QApplicationPrivate::autoSipEnabled = false; +#else +bool QApplicationPrivate::autoSipEnabled = true; +#endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) @@ -1241,6 +1243,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis The property only has an effect on platforms which use software input panels, such as Windows CE and Symbian. + + The default is platform dependent. */ #ifdef Q_OS_WINCE diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 0fdbf13..24c1608 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -617,6 +617,11 @@ void QS60Style::polish(QWidget *widget) const QFont suggestedFont = d->s60Font( QS60StyleEnums::FC_Title, widget->font().pointSizeF()); widget->setFont(suggestedFont); + } else if (qobject_cast<QLineEdit *>(widget)) { + widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); + QApplication::setPalette(widgetPalette, "QLineEdit"); + } } @@ -2115,17 +2120,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QCommonStyle::drawPrimitive(element, option, painter, widget); } else { - if (option->state & State_Children) { - QS60StyleEnums::SkinParts skinPart = - (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; - int minDimension = qMin(option->rect.width(), option->rect.height()); - const int resizeValue = minDimension >> 1; - minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. - QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension)); - iconRect.translate(3, 2 - resizeValue); - QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); - } - const bool rightLine = option->state & State_Item; const bool downLine = option->state & State_Sibling; const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling); @@ -2147,10 +2141,26 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, (flags | QS60StylePrivate::SF_ColorSkinned)); } + + if (option->state & State_Children) { + QS60StyleEnums::SkinParts skinPart = + (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; + int minDimension = qMin(option->rect.width(), option->rect.height()); + const int resizeValue = minDimension >> 1; + minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. + QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension)); + int verticalMagic(0); + // magic values for positioning svg icon. + if (option->rect.width() <= option->rect.height()) + verticalMagic = 3; + iconRect.translate(3, verticalMagic - resizeValue); + iconRect.adjust(-3,5,0,0); + QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); + } } - } - break; - + } + break; + // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: case PE_IndicatorButtonDropDown: |