diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-26 15:27:59 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-26 15:27:59 (GMT) |
commit | 20ec83dc4c19436092262ab46615c19c9c8b20e7 (patch) | |
tree | 928af012d381bc2ce37edf93a09346955184215d | |
parent | 3ca156558dad24f5ac0f9d0e35a558c5b8052c81 (diff) | |
parent | 6bcf2ca6645409ffa1aaadd1bd302c6e86b5b028 (diff) | |
download | Qt-20ec83dc4c19436092262ab46615c19c9c8b20e7.zip Qt-20ec83dc4c19436092262ab46615c19c9c8b20e7.tar.gz Qt-20ec83dc4c19436092262ab46615c19c9c8b20e7.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
22 files changed, 279 insertions, 162 deletions
diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp index c4ca731..1f754d5 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp +++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp @@ -71,7 +71,7 @@ MainWindow::MainWindow() QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateTimeInformation())); - timer->start(1000*60); + timer->start(1000*60*5); const QSettings settings("Qt Software", "trafficinfo"); m_station = StationInformation(settings.value("stationId", "03012130").toString(), diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index af48a6e..da530c8 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 70604503a0365edaeff82ffad7b71f90641fa592 + 0b6fc217c2b853827926313c09bb3c32f66ffe43 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 10a3840..3b20751 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2009-02-06 Dirk Schulze <krit@webkit.org> + + Reviewed by Simon Hausmann. + + Fix bug in clearRect(). Use fillRect() instead of eraseRect() to get + the context transparent. + + [QT] clearRect fill's a given rect with white + https://bugs.webkit.org/show_bug.cgi?id=23728 + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::clearRect): + 2009-03-19 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 80a6390..1830566 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -815,7 +815,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) QPainter::CompositionMode currentCompositionMode = p->compositionMode(); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(QPainter::CompositionMode_Source); - p->eraseRect(rect); + p->fillRect(rect, Qt::transparent); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(currentCompositionMode); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 5e3c656..636b6e8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -533,6 +533,8 @@ void QWebPagePrivate::updateEditorActions() updateAction(QWebPage::ToggleBold); updateAction(QWebPage::ToggleItalic); updateAction(QWebPage::ToggleUnderline); + updateAction(QWebPage::InsertParagraphSeparator); + updateAction(QWebPage::InsertLineSeparator); } void QWebPagePrivate::timerEvent(QTimerEvent *ev) @@ -1792,6 +1794,13 @@ QAction *QWebPage::action(WebAction action) const text = contextMenuItemTagInspectElement(); break; + case InsertParagraphSeparator: + text = tr("Insert a new paragraph"); + break; + case InsertLineSeparator: + text = tr("Insert a new line"); + break; + case NoWebAction: return 0; } @@ -2319,7 +2328,8 @@ QWebPluginFactory *QWebPage::pluginFactory() const \list \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system. \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true. - \o %Locale% is replaced with QLocale::name(). + \o %Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage, + then a default constructed QLocale is used instead. \o %WebKitVersion% currently expands to 527+ \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 0755133..32d27cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,25 @@ +2009-03-26 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Tor Arne Vestbø. + + Fix the documentation of the QLocale usage in userAgentForUrl. + + * Api/qwebpage.cpp: + +2009-03-20 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Simon Hausmann. + + Fix for InsertParagraphSeparator and InsertLineSeparator so that + QWebPage::action() creates QActions for them. Also make sure they get + updated appropriately. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateEditorActions): + (QWebPage::action): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textEditing): + 2009-03-20 Erik L. Bunce <elbunce@xendom.com> Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 54d342e..d85e880 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -956,6 +956,8 @@ void tst_QWebPage::textEditing() QVERIFY(page->action(QWebPage::ToggleBold) != 0); QVERIFY(page->action(QWebPage::ToggleItalic) != 0); QVERIFY(page->action(QWebPage::ToggleUnderline) != 0); + QVERIFY(page->action(QWebPage::InsertParagraphSeparator) != 0); + QVERIFY(page->action(QWebPage::InsertLineSeparator) != 0); // right now they are disabled because contentEditable is false QCOMPARE(page->action(QWebPage::DeleteStartOfWord)->isEnabled(), false); @@ -966,6 +968,8 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), false); // make it editable before navigating the cursor page->setContentEditable(true); @@ -979,6 +983,8 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), true); delete page; } diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/corelib/concurrent/qtconcurrentreducekernel.h index e863b63..2dad519 100644 --- a/src/corelib/concurrent/qtconcurrentreducekernel.h +++ b/src/corelib/concurrent/qtconcurrentreducekernel.h @@ -51,6 +51,7 @@ #include <QtCore/qmap.h> #include <QtCore/qmutex.h> #include <QtCore/qthread.h> +#include <QtCore/qthreadpool.h> #include <QtCore/qvector.h> QT_BEGIN_HEADER @@ -107,7 +108,7 @@ class ReduceKernel const ReduceOptions reduceOptions; QMutex mutex; - int progress, resultsMapSize; + int progress, resultsMapSize, threadCount; ResultsMap resultsMap; bool canReduce(int begin) const @@ -140,7 +141,8 @@ class ReduceKernel public: ReduceKernel(ReduceOptions _reduceOptions) - : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0) + : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0), + threadCount(QThreadPool::globalInstance()->maxThreadCount()) { } void runReduce(ReduceFunctor &reduce, @@ -210,12 +212,12 @@ public: inline bool shouldThrottle() { - return (resultsMapSize > (ReduceQueueThrottleLimit * QThread::idealThreadCount())); + return (resultsMapSize > (ReduceQueueThrottleLimit * threadCount)); } inline bool shouldStartThread() { - return (resultsMapSize <= (ReduceQueueStartLimit * QThread::idealThreadCount())); + return (resultsMapSize <= (ReduceQueueStartLimit * threadCount)); } }; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 08d6fed..226b4d0 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3888,13 +3888,16 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_TabBarTabShape: - if (const QStyleOptionTabV3 *tabOpt = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { - if (tabOpt->documentMode) { - p->save(); - QRect tabRect = tabOpt->rect; - drawTabShape(p, tabOpt); - p->restore(); - return; + if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { + + if (const QStyleOptionTabV3 *tabOptV3 = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { + if (tabOptV3->documentMode) { + p->save(); + QRect tabRect = tabOptV3->rect; + drawTabShape(p, tabOptV3); + p->restore(); + return; + } } #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index c337783..9c3d6c2 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -287,6 +287,7 @@ public: private: Q_DISABLE_COPY(QTextDocument) Q_DECLARE_PRIVATE(QTextDocument) + friend class QTextObjectPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextDocument::FindFlags) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 320ecbf..05ddf47 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1484,7 +1484,6 @@ QTextObject *QTextDocumentPrivate::createObject(const QTextFormat &f, int object QTextObject *obj = document()->createObject(f); if (obj) { - obj->d_func()->pieceTable = this; obj->d_func()->objectIndex = objectIndex == -1 ? formats.createObjectIndex(f) : objectIndex; objects[obj->d_func()->objectIndex] = obj; } diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index e305027..d1a3361 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -50,6 +50,11 @@ QT_BEGIN_NAMESPACE class QTextListPrivate : public QTextBlockGroupPrivate { +public: + QTextListPrivate(QTextDocument *doc) + : QTextBlockGroupPrivate(doc) + { + } }; /*! @@ -111,7 +116,7 @@ class QTextListPrivate : public QTextBlockGroupPrivate /*! \internal */ QTextList::QTextList(QTextDocument *doc) - : QTextBlockGroup(*new QTextListPrivate, doc) + : QTextBlockGroup(*new QTextListPrivate(doc), doc) { } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 1645a21..3f4c8e5 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE from QTextDocument::createObject(). */ QTextObject::QTextObject(QTextDocument *doc) - : QObject(*new QTextObjectPrivate, doc) + : QObject(*new QTextObjectPrivate(doc), doc) { } @@ -98,7 +98,7 @@ QTextObject::QTextObject(QTextDocument *doc) \internal */ QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *doc) - :QObject(p, doc) + : QObject(p, doc) { } @@ -221,7 +221,7 @@ void QTextBlockGroupPrivate::markBlocksDirty() QTextDocument::createObject(). */ QTextBlockGroup::QTextBlockGroup(QTextDocument *doc) - : QTextObject(*new QTextBlockGroupPrivate, doc) + : QTextObject(*new QTextBlockGroupPrivate(doc), doc) { } @@ -410,7 +410,7 @@ QTextFrameLayoutData::~QTextFrameLayoutData() Creates a new empty frame for the text \a document. */ QTextFrame::QTextFrame(QTextDocument *doc) - : QTextObject(*new QTextFramePrivate, doc) + : QTextObject(*new QTextFramePrivate(doc), doc) { Q_D(QTextFrame); d->fragment_start = 0; diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h index b00a16a..dd05eb4 100644 --- a/src/gui/text/qtextobject_p.h +++ b/src/gui/text/qtextobject_p.h @@ -55,6 +55,7 @@ #include "QtGui/qtextobject.h" #include "private/qobject_p.h" +#include "QtGui/qtextdocument.h" QT_BEGIN_NAMESPACE @@ -64,6 +65,10 @@ class QTextObjectPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QTextObject) public: + QTextObjectPrivate(QTextDocument *doc) + : pieceTable(doc->d_func()), objectIndex(-1) + { + } QTextDocumentPrivate *pieceTable; int objectIndex; }; @@ -72,7 +77,10 @@ class QTextBlockGroupPrivate : public QTextObjectPrivate { Q_DECLARE_PUBLIC(QTextBlockGroup) public: - + QTextBlockGroupPrivate(QTextDocument *doc) + : QTextObjectPrivate(doc) + { + } typedef QList<QTextBlock> BlockList; BlockList blocks; void markBlocksDirty(); @@ -85,7 +93,10 @@ class QTextFramePrivate : public QTextObjectPrivate friend class QTextDocumentPrivate; Q_DECLARE_PUBLIC(QTextFrame) public: - + QTextFramePrivate(QTextDocument *doc) + : QTextObjectPrivate(doc) + { + } virtual void fragmentAdded(const QChar &type, uint fragment); virtual void fragmentRemoved(const QChar &type, uint fragment); void remove_me(); diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 375bb09..ba1c04f 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -553,7 +553,7 @@ void QTextTablePrivate::update() const /*! \internal */ QTextTable::QTextTable(QTextDocument *doc) - : QTextFrame(*new QTextTablePrivate, doc) + : QTextFrame(*new QTextTablePrivate(doc), doc) { } diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h index 1ba3a3f..f2b45b6 100644 --- a/src/gui/text/qtexttable_p.h +++ b/src/gui/text/qtexttable_p.h @@ -62,7 +62,7 @@ class QTextTablePrivate : public QTextFramePrivate { Q_DECLARE_PUBLIC(QTextTable) public: - QTextTablePrivate() : grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {} + QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {} ~QTextTablePrivate(); static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat); diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index fc43369..b225c17 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -435,7 +435,7 @@ void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol prot The class also supports common predefined addresses: \l Null, \l LocalHost, \l LocalHostIPv6, \l Broadcast, and \l Any. - \sa QTcpSocket, QTcpServer, QUdpSocket + \sa QHostInfo, QTcpSocket, QTcpServer, QUdpSocket */ /*! \enum QHostAddress::SpecialAddress diff --git a/src/script/qscriptengine.cpp b/src/script/qscriptengine.cpp index d4e1923..d8908ed 100644 --- a/src/script/qscriptengine.cpp +++ b/src/script/qscriptengine.cpp @@ -1169,7 +1169,8 @@ bool QScriptEngine::convert(const QScriptValue &value, int type, void *ptr) bool QScriptEngine::convertV2(const QScriptValue &value, int type, void *ptr) { QScriptValueImpl impl = QScriptValuePrivate::valueOf(value); - return QScriptEnginePrivate::convert(impl, type, ptr, /*engine=*/0); + QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(value.engine()); + return QScriptEnginePrivate::convert(impl, type, ptr, eng_p); } /*! diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 9995b46..5339fb4 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1187,6 +1187,16 @@ static void fooFromScriptValue(const QScriptValue &value, Foo &foo) foo.y = value.property("y").toInt32(); } +static QScriptValue fooToScriptValueV2(QScriptEngine *eng, const Foo &foo) +{ + return QScriptValue(eng, foo.x); +} + +static void fooFromScriptValueV2(const QScriptValue &value, Foo &foo) +{ + foo.x = value.toInt32(); +} + Q_DECLARE_METATYPE(QLinkedList<QString>) Q_DECLARE_METATYPE(QList<Foo>) Q_DECLARE_METATYPE(QVector<QChar>) @@ -1427,6 +1437,24 @@ void tst_QScriptEngine::valueConversion() QVERIFY(val.isVariant()); QCOMPARE(val.toVariant(), var); } + + // task 248802 + qScriptRegisterMetaType<Foo>(&eng, fooToScriptValueV2, fooFromScriptValueV2); + { + QScriptValue num(&eng, 123); + Foo foo = qScriptValueToValue<Foo>(num); + QCOMPARE(foo.x, 123); + } + { + QScriptValue num(123); + Foo foo = qScriptValueToValue<Foo>(num); + QCOMPARE(foo.x, -1); + } + { + QScriptValue str(&eng, "123"); + Foo foo = qScriptValueToValue<Foo>(str); + QCOMPARE(foo.x, 123); + } } static QScriptValue __import__(QScriptContext *ctx, QScriptEngine *eng) diff --git a/tests/auto/qtextobject/tst_qtextobject.cpp b/tests/auto/qtextobject/tst_qtextobject.cpp index 4fbc155..4d1d4b2 100644 --- a/tests/auto/qtextobject/tst_qtextobject.cpp +++ b/tests/auto/qtextobject/tst_qtextobject.cpp @@ -62,6 +62,7 @@ public: private slots: void getSetCheck(); + void testStandAloneTextObject(); }; tst_QTextObject::tst_QTextObject() @@ -105,5 +106,23 @@ void tst_QTextObject::getSetCheck() QCOMPARE(INT_MAX, obj2.userState()); } +class TestTextObject : public QTextObject +{ +public: + TestTextObject(QTextDocument *document) : QTextObject(document) {} +}; + +void tst_QTextObject::testStandAloneTextObject() +{ + QTextDocument document; + TestTextObject textObject(&document); + + QCOMPARE(textObject.document(), &document); + // don't crash + textObject.format(); + textObject.formatIndex(); + QCOMPARE(textObject.objectIndex(), -1); +} + QTEST_MAIN(tst_QTextObject) #include "tst_qtextobject.moc" diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 0f246be..df39650 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -186,9 +186,11 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) m_helpEngine->setCustomValue(QLatin1String("useAppFont"), false); m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), false); m_helpEngine->setCustomValue(QLatin1String("appFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), QFontDatabase::Latin); + m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), + QFontDatabase::Latin); m_helpEngine->setCustomValue(QLatin1String("browserFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), QFontDatabase::Latin); + m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), + QFontDatabase::Latin); } else { updateApplicationFont(); } @@ -377,118 +379,107 @@ void MainWindow::insertLastPages() void MainWindow::setupActions() { - QString system = QLatin1String("win"); + QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); #ifdef Q_OS_MAC - system = QLatin1String("mac"); setUnifiedTitleAndToolBarOnMac(true); + resourcePath.append(QLatin1String("mac")); +#else + resourcePath.append(QLatin1String("win")); #endif QMenu *menu = menuBar()->addMenu(tr("&File")); - m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget, SLOT(pageSetup())); - m_printPreviewAction = menu->addAction(tr("Print Preview..."), m_centralWidget, SLOT(printPreview())); + m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget, + SLOT(pageSetup())); + m_printPreviewAction = menu->addAction(tr("Print Preview..."), m_centralWidget, + SLOT(printPreview())); + m_printAction = menu->addAction(tr("&Print..."), m_centralWidget, SLOT(print())); - m_printAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/print.png").arg(system))); - m_printAction->setShortcut(tr("CTRL+P")); + m_printAction->setIcon(QIcon(resourcePath + QLatin1String("/print.png"))); + m_printAction->setShortcut(QKeySequence::Print); menu->addSeparator(); m_newTabAction = menu->addAction(tr("New &Tab"), m_centralWidget, SLOT(newTab())); - m_newTabAction->setShortcut(tr("CTRL+T")); - m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget, SLOT(closeTab())); - m_closeTabAction->setShortcut(tr("CTRL+W")); + m_newTabAction->setShortcut(QKeySequence::AddTab); + + m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget, + SLOT(closeTab())); + m_closeTabAction->setShortcuts(QKeySequence::Close); QAction *tmp = menu->addAction(tr("&Quit"), this, SLOT(close())); tmp->setShortcut(tr("CTRL+Q")); tmp->setMenuRole(QAction::QuitRole); menu = menuBar()->addMenu(tr("&Edit")); - m_copyAction = menu->addAction(tr("&Copy selected Text"), - m_centralWidget, SLOT(copySelection())); - m_copyAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/editcopy.png").arg(system))); - m_copyAction->setShortcut(tr("Ctrl+C")); + m_copyAction = menu->addAction(tr("&Copy selected Text"), m_centralWidget, + SLOT(copySelection())); + m_copyAction->setIcon(QIcon(resourcePath + QLatin1String("/editcopy.png"))); + m_copyAction->setShortcuts(QKeySequence::Copy); m_copyAction->setEnabled(false); - m_findAction = menu->addAction(tr("&Find in Text..."), - m_centralWidget, SLOT(showTextSearch())); - m_findAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/find.png").arg(system))); - m_findAction->setShortcut(tr("Ctrl+F")); - m_findAction->setShortcut(QKeySequence::Find); + m_findAction = menu->addAction(tr("&Find in Text..."), m_centralWidget, + SLOT(showTextSearch())); + m_findAction->setIcon(QIcon(resourcePath + QLatin1String("/find.png"))); + m_findAction->setShortcuts(QKeySequence::Find); - QAction *findNextAction = menu->addAction(tr("Find &Next"), - m_centralWidget, SLOT(findNext())); - findNextAction->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("F3")) - << QKeySequence(tr("CTRL+G"))); + QAction *findNextAction = menu->addAction(tr("Find &Next"), m_centralWidget, + SLOT(findNext())); + findNextAction->setShortcuts(QKeySequence::FindNext); QAction *findPreviousAction = menu->addAction(tr("Find &Previous"), m_centralWidget, SLOT(findPrevious())); - findPreviousAction->setShortcuts(QList<QKeySequence>() << - QKeySequence(tr("Shift+F3")) << QKeySequence(tr("CTRL+SHIFT+G"))); + findPreviousAction->setShortcuts(QKeySequence::FindPrevious); menu->addSeparator(); tmp = menu->addAction(tr("Preferences..."), this, SLOT(showPreferences())); tmp->setMenuRole(QAction::PreferencesRole); m_viewMenu = menuBar()->addMenu(tr("&View")); - m_zoomInAction = m_viewMenu->addAction(tr("Zoom &in"), - m_centralWidget, SLOT(zoomIn())); - m_zoomInAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/zoomin.png").arg(system))); - m_zoomInAction->setShortcut(tr("Ctrl++")); - - m_zoomOutAction = m_viewMenu->addAction(tr("Zoom &out"), - m_centralWidget, SLOT(zoomOut())); - m_zoomOutAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/zoomout.png").arg(system))); - m_zoomOutAction->setShortcut(tr("Ctrl+-")); - - m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), - m_centralWidget, SLOT(resetZoom())); - m_resetZoomAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/resetzoom.png").arg(system))); + m_zoomInAction = m_viewMenu->addAction(tr("Zoom &in"), m_centralWidget, + SLOT(zoomIn())); + m_zoomInAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomin.png"))); + m_zoomInAction->setShortcut(QKeySequence::ZoomIn); + + m_zoomOutAction = m_viewMenu->addAction(tr("Zoom &out"), m_centralWidget, + SLOT(zoomOut())); + m_zoomOutAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomout.png"))); + m_zoomOutAction->setShortcut(QKeySequence::ZoomOut); + + m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), m_centralWidget, + SLOT(resetZoom())); + m_resetZoomAction->setIcon(QIcon(resourcePath + QLatin1String("/resetzoom.png"))); m_resetZoomAction->setShortcut(tr("Ctrl+0")); m_viewMenu->addSeparator(); - m_viewMenu->addAction(tr("Contents"), this, - SLOT(showContents()), QKeySequence(tr("ALT+C"))); - m_viewMenu->addAction(tr("Index"), this, - SLOT(showIndex()), QKeySequence(tr("ALT+I"))); - m_viewMenu->addAction(tr("Bookmarks"), this, - SLOT(showBookmarks()), QKeySequence(tr("ALT+O"))); - m_viewMenu->addAction(tr("Search"), this, - SLOT(showSearch()), QKeySequence(tr("ALT+S"))); + m_viewMenu->addAction(tr("Contents"), this, SLOT(showContents()), + QKeySequence(tr("ALT+C"))); + m_viewMenu->addAction(tr("Index"), this, SLOT(showIndex()), + QKeySequence(tr("ALT+I"))); + m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarks()), + QKeySequence(tr("ALT+O"))); + m_viewMenu->addAction(tr("Search"), this, SLOT(showSearch()), + QKeySequence(tr("ALT+S"))); menu = menuBar()->addMenu(tr("&Go")); - m_homeAction = menu->addAction(tr("&Home"), - m_centralWidget, SLOT(home())); + m_homeAction = menu->addAction(tr("&Home"), m_centralWidget, SLOT(home())); m_homeAction->setShortcut(tr("Ctrl+Home")); - m_homeAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/home.png").arg(system))); + m_homeAction->setIcon(QIcon(resourcePath + QLatin1String("/home.png"))); - m_backAction = menu->addAction(tr("&Back"), - m_centralWidget, SLOT(backward())); + m_backAction = menu->addAction(tr("&Back"), m_centralWidget, SLOT(backward())); m_backAction->setEnabled(false); - m_backAction->setShortcuts(QList<QKeySequence>() - << QKeySequence(Qt::CTRL|Qt::Key_Left) << QKeySequence::Back); - m_backAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/previous.png").arg(system))); + m_backAction->setShortcuts(QKeySequence::Back); + m_backAction->setIcon(QIcon(resourcePath + QLatin1String("/previous.png"))); - m_nextAction = menu->addAction(tr("&Forward"), - m_centralWidget, SLOT(forward())); + m_nextAction = menu->addAction(tr("&Forward"), m_centralWidget, SLOT(forward())); m_nextAction->setEnabled(false); - m_nextAction->setShortcuts(QList<QKeySequence>() - << QKeySequence(Qt::CTRL|Qt::Key_Right) << QKeySequence::Forward); - m_nextAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/next.png").arg(system))); + m_nextAction->setShortcuts(QKeySequence::Forward); + m_nextAction->setIcon(QIcon(resourcePath + QLatin1String("/next.png"))); - m_syncAction = menu->addAction(tr("Sync with Table of Contents"), - this, SLOT(syncContents())); - m_syncAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/synctoc.png").arg(system))); + m_syncAction = menu->addAction(tr("Sync with Table of Contents"), this, + SLOT(syncContents())); + m_syncAction->setIcon(QIcon(resourcePath + QLatin1String("/synctoc.png"))); menu->addSeparator(); @@ -496,8 +487,7 @@ void MainWindow::setupActions() tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Right")) << QKeySequence(Qt::CTRL + Qt::Key_PageDown)); - tmp = menu->addAction(tr("Previous Page"), - m_centralWidget, SLOT(previousPage())); + tmp = menu->addAction(tr("Previous Page"), m_centralWidget, SLOT(previousPage())); tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Left")) << QKeySequence(Qt::CTRL + Qt::Key_PageUp)); @@ -525,53 +515,52 @@ void MainWindow::setupActions() navigationBar->addAction(m_resetZoomAction); QList<QAction*> actionList; - actionList << m_backAction << m_nextAction << m_homeAction; - actionList << sep << m_zoomInAction << m_zoomOutAction; - actionList << sep2 << m_copyAction << m_printAction << m_findAction; + actionList << m_backAction << m_nextAction << m_homeAction << sep + << m_zoomInAction << m_zoomOutAction << sep2 << m_copyAction + << m_printAction << m_findAction; m_centralWidget->setGlobalActions(actionList); #if defined(Q_WS_MAC) QMenu *windowMenu = new QMenu(tr("&Window"), this); menuBar()->insertMenu(menu->menuAction(), windowMenu); - windowMenu->addAction(tr("Minimize"), this, - SLOT(showMinimized()), QKeySequence(tr("Ctrl+M"))); - windowMenu->addAction(tr("Zoom"), this, - SLOT(showMaximized())); + windowMenu->addAction(tr("Zoom"), this, SLOT(showMaximized())); + windowMenu->addAction(tr("Minimize"), this, SLOT(showMinimized()), + QKeySequence(tr("Ctrl+M"))); #endif // content viewer connections - connect(m_centralWidget, SIGNAL(copyAvailable(bool)), - this, SLOT(copyAvailable(bool))); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(highlighted(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_centralWidget, SIGNAL(addNewBookmark(const QString&, - const QString&)), this, SLOT(addNewBookmark(const QString&, const QString&))); + connect(m_centralWidget, SIGNAL(copyAvailable(bool)), this, + SLOT(copyAvailable(bool))); + connect(m_centralWidget, SIGNAL(currentViewerChanged()), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(highlighted(QString)), statusBar(), + SLOT(showMessage(QString))); + connect(m_centralWidget, SIGNAL(addNewBookmark(QString, QString)), this, + SLOT(addNewBookmark(QString, QString))); // bookmarks - connect(m_bookmarkWidget, SIGNAL(requestShowLink(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_bookmarkWidget, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_bookmarkWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_bookmarkWidget, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); // index window - connect(m_indexWindow, SIGNAL(linkActivated(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_indexWindow, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)), - this, SLOT(showTopicChooser(const QMap<QString, QUrl>&, const QString&))); - connect(m_indexWindow, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_indexWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_indexWindow, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)), + this, SLOT(showTopicChooser(QMap<QString, QUrl>, QString))); + connect(m_indexWindow, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); // content window - connect(m_contentWindow, SIGNAL(linkActivated(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_contentWindow, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_contentWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_contentWindow, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); #if defined(QT_NO_PRINTER) m_pageSetupAction->setVisible(false); @@ -601,17 +590,19 @@ void MainWindow::setupFilterToolbar() QToolBar *filterToolBar = addToolBar(tr("Filter Toolbar")); filterToolBar->setObjectName(QLatin1String("FilterToolBar")); - filterToolBar->addWidget(new QLabel(tr("Filtered by:").append(QLatin1String(" ")), this)); + filterToolBar->addWidget(new QLabel(tr("Filtered by:").append(QLatin1Char(' ')), + this)); filterToolBar->addWidget(m_filterCombo); - if (m_helpEngine->customValue(QLatin1String("HideFilterFunctionality"), true).toBool()) + const QLatin1String hideFilter("HideFilterFunctionality"); + if (m_helpEngine->customValue(hideFilter, true).toBool()) filterToolBar->hide(); toolBarMenu()->addAction(filterToolBar->toggleViewAction()); - connect(m_helpEngine, SIGNAL(setupFinished()), - this, SLOT(setupFilterCombo())); - connect(m_filterCombo, SIGNAL(activated(const QString&)), - this, SLOT(filterDocumentation(const QString&))); + connect(m_helpEngine, SIGNAL(setupFinished()), this, + SLOT(setupFilterCombo())); + connect(m_filterCombo, SIGNAL(activated(const QString&)), this, + SLOT(filterDocumentation(const QString&))); setupFilterCombo(); } @@ -626,7 +617,8 @@ void MainWindow::setupAddressToolbar() addressToolBar->setObjectName(QLatin1String("AddressToolBar")); insertToolBarBreak(addressToolBar); - addressToolBar->addWidget(new QLabel(tr("Address:").append(QLatin1String(" ")), this)); + addressToolBar->addWidget(new QLabel(tr("Address:").append(QLatin1String(" ")), + this)); addressToolBar->addWidget(m_addressLineEdit); if (m_helpEngine->customValue(QLatin1String("HideAddressBar"), true).toBool()) @@ -684,7 +676,8 @@ void MainWindow::showNewAddress(const QUrl &url) void MainWindow::addBookmark() { - addNewBookmark(m_centralWidget->currentTitle(), m_centralWidget->currentSource().toString()); + addNewBookmark(m_centralWidget->currentTitle(), + m_centralWidget->currentSource().toString()); } void MainWindow::gotoAddress() @@ -784,7 +777,8 @@ void MainWindow::showAboutDialog() if (!contents.isEmpty()) { iconArray = m_helpEngine->customValue(QLatin1String("AboutIcon"), QByteArray()).toByteArray(); - QByteArray resources = m_helpEngine->customValue(QLatin1String("AboutImages"), + QByteArray resources = + m_helpEngine->customValue(QLatin1String("AboutImages"), QByteArray()).toByteArray(); QPixmap pix; pix.loadFromData(iconArray); @@ -795,13 +789,16 @@ void MainWindow::showAboutDialog() } else { #if QT_EDITION == QT_EDITION_OPENSOURCE QString edition = tr("Open Source Edition"); - QString info = tr("This version of Qt Assistant is part of the Qt Open Source Edition, for use " + QString info = tr("This version of Qt Assistant is part of the Qt Open " + "Source Edition, for use " "in the development of Open Source applications. " "Qt is a comprehensive C++ framework for cross-platform application " "development."); - QString moreInfo = tr("You need a commercial Qt license for development of proprietary (closed " - "source) applications. Please see <a href=\"http://qtsoftware.com/company/about/businessmodel" - "\">http://qtsoftware.com/company/about/businessmodel</a> for an overview of Qt licensing."); + QString moreInfo = tr("You need a commercial Qt license for development " + "of proprietary (closed source) applications. Please see " + "<a href=\"http://qtsoftware.com/company/about/businessmodel" + "\">http://qtsoftware.com/company/about/businessmodel</a> for an " + "overview of Qt licensing."); #else QString edition; QString info; @@ -816,13 +813,14 @@ void MainWindow::showAboutDialog() "<p>Version %2 %3</p></center>" "<p>%4</p>" "<p>%5</p>" - "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>" - "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND," + "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)" + ".</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.<p/>") .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)) .arg(edition).arg(info).arg(moreInfo), resources); - aboutDia.setPixmap(QString::fromLatin1(":/trolltech/assistant/images/assistant-128.png")); + QLatin1String path(":/trolltech/assistant/images/assistant-128.png"); + aboutDia.setPixmap(QString(path)); } if (aboutDia.windowTitle().isEmpty()) aboutDia.setWindowTitle(tr("About %1").arg(windowTitle())); @@ -974,20 +972,19 @@ QWidget* MainWindow::setupBookmarkWidget() QString MainWindow::collectionFileDirectory(bool createDir, const QString &cacheDir) { - QString collectionPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + QString collectionPath = + QDesktopServices::storageLocation(QDesktopServices::DataLocation); if (collectionPath.isEmpty()) { if (cacheDir.isEmpty()) collectionPath = QDir::homePath() + QDir::separator() + QLatin1String(".assistant"); else - collectionPath = QDir::homePath() + QLatin1String("/.") - + cacheDir; + collectionPath = QDir::homePath() + QLatin1String("/.") + cacheDir; } else { if (cacheDir.isEmpty()) collectionPath = collectionPath + QLatin1String("/Trolltech/Assistant"); else - collectionPath = collectionPath + QDir::separator() - + cacheDir; + collectionPath = collectionPath + QDir::separator() + cacheDir; } collectionPath = QDir::cleanPath(collectionPath); if (createDir) { @@ -1001,8 +998,8 @@ QString MainWindow::collectionFileDirectory(bool createDir, const QString &cache QString MainWindow::defaultHelpCollectionFileName() { return collectionFileDirectory() + QDir::separator() + - QString(QLatin1String("qthelpcollection_%1.qhc")). - arg(QLatin1String(QT_VERSION_STR)); + QString(QLatin1String("qthelpcollection_%1.qhc")). + arg(QLatin1String(QT_VERSION_STR)); } QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 8b87b7b..c716b1c 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -72,7 +72,7 @@ public: MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0); ~MainWindow(); - static void activateCurrentBrowser(); + static void activateCurrentBrowser(); static QString collectionFileDirectory(bool createDir = false, const QString &cacheDir = QString()); static QString defaultHelpCollectionFileName(); @@ -103,12 +103,12 @@ private slots: void gotoAddress(); void showPreferences(); void showNewAddress(); - void showAboutDialog(); + void showAboutDialog(); void copyAvailable(bool yes); void updateNavigationItems(); void showNewAddress(const QUrl &url); void addNewBookmark(const QString &title, const QString &url); - void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword); + void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword); void updateApplicationFont(); void filterDocumentation(const QString &customFilter); void setupFilterCombo(); @@ -128,7 +128,7 @@ private: void setupFilterToolbar(); void setupAddressToolbar(); QMenu *toolBarMenu(); - QWidget *setupBookmarkWidget(); + QWidget *setupBookmarkWidget(); QHelpEngine *m_helpEngine; CentralWidget *m_centralWidget; |