summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-27 23:25:07 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-27 23:25:07 (GMT)
commitfb2e33b21557412ae7bde009662ca89870407f5f (patch)
tree61e7765a4e644d12a0addc21a0bf63e13e992cb9 /tools
parentd53e4499f864719446abdb7fdeff433dbb3f7d98 (diff)
parentfcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6 (diff)
downloadQt-fb2e33b21557412ae7bde009662ca89870407f5f.zip
Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.gz
Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: mkspecs/features/qt.prf src/corelib/animation/qanimationgroup.cpp src/corelib/animation/qparallelanimationgroup.cpp src/corelib/animation/qpauseanimation.cpp src/corelib/animation/qpropertyanimation.cpp src/corelib/animation/qsequentialanimationgroup.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qvariant_p.h src/corelib/tools/qeasingcurve.cpp src/gui/graphicsview/qgraphicsitem.cpp src/opengl/opengl.pro src/opengl/qgl_x11egl.cpp tests/auto/auto.pro
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp166
-rw-r--r--tools/assistant/tools/assistant/centralwidget.h10
-rw-r--r--tools/assistant/translations/qt_help.pro3
-rw-r--r--tools/assistant/translations/translations.pro3
-rw-r--r--tools/designer/src/components/formeditor/formwindow.cpp5
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp121
-rw-r--r--tools/designer/src/lib/shared/newformwidget.cpp5
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formbuilder.cpp14
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formbuilder_p.h17
-rw-r--r--tools/designer/src/lib/shared/qdesigner_toolbar.cpp16
-rw-r--r--tools/designer/src/lib/shared/qsimpleresource.cpp133
-rw-r--r--tools/designer/src/lib/shared/qsimpleresource_p.h17
-rw-r--r--tools/linguist/lconvert/main.cpp24
-rw-r--r--tools/linguist/lupdate/java.cpp13
-rw-r--r--tools/linguist/shared/translator.cpp20
-rw-r--r--tools/linguist/shared/translator.h3
-rw-r--r--tools/qdoc3/doc.cpp4
-rw-r--r--tools/qdoc3/htmlgenerator.cpp18
-rw-r--r--tools/qdoc3/main.cpp4
-rw-r--r--tools/qdoc3/test/classic.css12
20 files changed, 366 insertions, 242 deletions
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index b78f346..52d48d5 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -87,6 +87,7 @@ namespace {
FindWidget::FindWidget(QWidget *parent)
: QWidget(parent)
+ , appPalette(qApp->palette())
{
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
@@ -148,6 +149,34 @@ FindWidget::~FindWidget()
{
}
+void FindWidget::hideEvent(QHideEvent* event)
+{
+#if !defined(QT_NO_WEBKIT)
+ // TODO: remove this once webkit supports setting the palette
+ if (!event->spontaneous())
+ qApp->setPalette(appPalette);
+#else
+ Q_UNUSED(event);
+#endif
+}
+
+void FindWidget::showEvent(QShowEvent* event)
+{
+#if !defined(QT_NO_WEBKIT)
+ // TODO: remove this once webkit supports setting the palette
+ if (!event->spontaneous()) {
+ QPalette p = appPalette;
+ p.setColor(QPalette::Inactive, QPalette::Highlight,
+ p.color(QPalette::Active, QPalette::Highlight));
+ p.setColor(QPalette::Inactive, QPalette::HighlightedText,
+ p.color(QPalette::Active, QPalette::HighlightedText));
+ qApp->setPalette(p);
+ }
+#else
+ Q_UNUSED(event);
+#endif
+}
+
void FindWidget::updateButtons()
{
if (editFind->text().isEmpty()) {
@@ -245,12 +274,14 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
SLOT(showTabBarContextMenu(QPoint)));
}
- QPalette p = qApp->palette();
+#if defined(QT_NO_WEBKIT)
+ QPalette p = palette();
p.setColor(QPalette::Inactive, QPalette::Highlight,
p.color(QPalette::Active, QPalette::Highlight));
p.setColor(QPalette::Inactive, QPalette::HighlightedText,
p.color(QPalette::Active, QPalette::HighlightedText));
- qApp->setPalette(p);
+ setPalette(p);
+#endif
}
CentralWidget::~CentralWidget()
@@ -848,60 +879,64 @@ void CentralWidget::keyPressEvent(QKeyEvent *e)
QWidget::keyPressEvent(e);
}
-void CentralWidget::find(QString ttf, bool forward, bool backward)
+void CentralWidget::find(const QString &ttf, bool forward, bool backward)
{
- QTextCursor cursor;
- QTextDocument *doc = 0;
- QTextBrowser *browser = 0;
-
- HelpViewer *viewer = currentHelpViewer();
QPalette p = findWidget->editFind->palette();
p.setColor(QPalette::Active, QPalette::Base, Qt::white);
-#if !defined(QT_NO_WEBKIT)
- Q_UNUSED(forward)
- Q_UNUSED(doc)
- Q_UNUSED(browser)
-
- if (viewer) {
- QWebPage::FindFlags options;
- if (backward)
- options |= QWebPage::FindBackward;
+ if (!ttf.isEmpty()) {
+ HelpViewer *viewer = currentHelpViewer();
- if (findWidget->checkCase->isChecked())
- options |= QWebPage::FindCaseSensitively;
+ bool found = false;
+#if !defined(QT_NO_WEBKIT)
+ if (viewer) {
+ QWebPage::FindFlags options;
+ if (backward)
+ options |= QWebPage::FindBackward;
- bool found = viewer->findText(ttf, options);
- findWidget->labelWrapped->hide();
+ if (findWidget->checkCase->isChecked())
+ options |= QWebPage::FindCaseSensitively;
- if (!found) {
- options |= QWebPage::FindWrapsAroundDocument;
found = viewer->findText(ttf, options);
+ findWidget->labelWrapped->hide();
if (!found) {
- p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102));
- } else {
- findWidget->labelWrapped->show();
+ options |= QWebPage::FindWrapsAroundDocument;
+ found = viewer->findText(ttf, options);
+ if (found)
+ findWidget->labelWrapped->show();
}
+ } else if (tabWidget->currentWidget() == m_searchWidget) {
+ QTextBrowser *browser = qFindChild<QTextBrowser*>(m_searchWidget);
+ found = findInTextBrowser(browser, ttf, forward, backward);
}
- }
#else
- if (viewer) {
- doc = viewer->document();
- cursor = viewer->textCursor();
- browser = qobject_cast<QTextBrowser*>(viewer);
- }
+ QTextBrowser *browser = qobject_cast<QTextBrowser*>(viewer);
+ if (tabWidget->currentWidget() == m_searchWidget)
+ browser = qFindChild<QTextBrowser*>(m_searchWidget);
+ found = findInTextBrowser(browser, ttf, forward, backward);
+#endif
- if (tabWidget->currentWidget() == m_searchWidget) {
- QTextBrowser *browser = qFindChild<QTextBrowser*>(m_searchWidget);
- if (browser) {
- doc = browser->document();
- cursor = browser->textCursor();
- }
+ if (!found)
+ p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102));
}
- if (!browser || !doc || cursor.isNull())
- return;
+ if (!findWidget->isVisible())
+ findWidget->show();
+ findWidget->editFind->setPalette(p);
+}
+
+bool CentralWidget::findInTextBrowser(QTextBrowser* browser, const QString &ttf,
+ bool forward, bool backward)
+{
+ if (!browser)
+ return false;
+
+ QTextDocument *doc = browser->document();
+ QTextCursor cursor = browser->textCursor();
+
+ if (!doc || cursor.isNull())
+ return false;
QTextDocument::FindFlags options;
@@ -910,44 +945,33 @@ void CentralWidget::find(QString ttf, bool forward, bool backward)
QTextCursor::MoveAnchor);
}
- QTextCursor newCursor = cursor;
+ if (backward)
+ options |= QTextDocument::FindBackward;
- if (!ttf.isEmpty()) {
- if (backward)
- options |= QTextDocument::FindBackward;
-
- if (findWidget->checkCase->isChecked())
- options |= QTextDocument::FindCaseSensitively;
+ if (findWidget->checkCase->isChecked())
+ options |= QTextDocument::FindCaseSensitively;
- if (findWidget->checkWholeWords->isChecked())
- options |= QTextDocument::FindWholeWords;
+ if (findWidget->checkWholeWords->isChecked())
+ options |= QTextDocument::FindWholeWords;
- newCursor = doc->find(ttf, cursor, options);
- findWidget->labelWrapped->hide();
+ findWidget->labelWrapped->hide();
+ bool found = true;
+ QTextCursor newCursor = doc->find(ttf, cursor, options);
+ if (newCursor.isNull()) {
+ QTextCursor ac(doc);
+ ac.movePosition(options & QTextDocument::FindBackward
+ ? QTextCursor::End : QTextCursor::Start);
+ newCursor = doc->find(ttf, ac, options);
if (newCursor.isNull()) {
- QTextCursor ac(doc);
- ac.movePosition(options & QTextDocument::FindBackward
- ? QTextCursor::End : QTextCursor::Start);
- newCursor = doc->find(ttf, ac, options);
- if (newCursor.isNull()) {
- p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102));
- newCursor = cursor;
- } else {
- findWidget->labelWrapped->show();
- }
+ found = false;
+ newCursor = cursor;
+ } else {
+ findWidget->labelWrapped->show();
}
}
-#endif
-
- if (!findWidget->isVisible())
- findWidget->show();
-
-#if defined(QT_NO_WEBKIT)
- if (browser)
- browser->setTextCursor(newCursor);
-#endif
- findWidget->editFind->setPalette(p);
+ browser->setTextCursor(newCursor);
+ return found;
}
void CentralWidget::updateBrowserFont()
diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h
index e3ce200..d59dbe5 100644
--- a/tools/assistant/tools/assistant/centralwidget.h
+++ b/tools/assistant/tools/assistant/centralwidget.h
@@ -55,6 +55,7 @@ class QLabel;
class QAction;
class QCheckBox;
class QLineEdit;
+class QTextBrowser;
class QToolButton;
class HelpViewer;
@@ -79,6 +80,10 @@ signals:
void findNext();
void findPrevious();
+protected:
+ void hideEvent(QHideEvent* event);
+ void showEvent(QShowEvent * event);
+
private slots:
void updateButtons();
@@ -94,6 +99,7 @@ private:
QToolButton *toolPrevious;
QCheckBox *checkWholeWords;
+ QPalette appPalette;
friend class CentralWidget;
};
@@ -176,7 +182,9 @@ private slots:
private:
void connectSignals();
bool eventFilter(QObject *object, QEvent *e);
- void find(QString ttf, bool forward, bool backward);
+ void find(const QString &ttf, bool forward, bool backward);
+ bool findInTextBrowser(QTextBrowser* browser, const QString &ttf,
+ bool forward, bool backward);
void initPrinter();
QString quoteTabTitle(const QString &title) const;
void highlightSearchTerms();
diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro
index efad6bf..e6208a6 100644
--- a/tools/assistant/translations/qt_help.pro
+++ b/tools/assistant/translations/qt_help.pro
@@ -44,5 +44,6 @@ TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qt_help_de.ts \
$$[QT_INSTALL_TRANSLATIONS]/qt_help_pl.ts \
$$[QT_INSTALL_TRANSLATIONS]/qt_help_untranslated.ts \
$$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_CN.ts \
- $$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_TW.ts
+ $$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_TW.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/qt_help_da.ts
error("This is a dummy profile to be used for translations ONLY.")
diff --git a/tools/assistant/translations/translations.pro b/tools/assistant/translations/translations.pro
index 58de554..8572123 100644
--- a/tools/assistant/translations/translations.pro
+++ b/tools/assistant/translations/translations.pro
@@ -45,4 +45,5 @@ TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/assistant_de.ts \
$$[QT_INSTALL_TRANSLATIONS]/assistant_pl.ts \
$$[QT_INSTALL_TRANSLATIONS]/assistant_untranslated.ts \
$$[QT_INSTALL_TRANSLATIONS]/assistant_zh_CN.ts \
- $$[QT_INSTALL_TRANSLATIONS]/assistant_zh_TW.ts
+ $$[QT_INSTALL_TRANSLATIONS]/assistant_zh_TW.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/assistant_da.ts
diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp
index 07d785a..66bab9b 100644
--- a/tools/designer/src/components/formeditor/formwindow.cpp
+++ b/tools/designer/src/components/formeditor/formwindow.cpp
@@ -2136,7 +2136,10 @@ void FormWindow::layoutContainer(QWidget *w, int type)
bool FormWindow::hasInsertedChildren(QWidget *widget) const // ### move
{
if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), widget)) {
- widget = container->widget(container->currentIndex());
+ const int index = container->currentIndex();
+ if (index < 0)
+ return false;
+ widget = container->widget(index);
}
const QWidgetList l = widgets(widget);
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index 75a53b7..5f53ae2 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -743,26 +743,6 @@ void QDesignerResource::setSaveRelative(bool relative)
m_resourceBuilder->setSaveRelative(relative);
}
-static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals)
-{
- if (!domSlots)
- return false;
-
- bool rc = false;
- foreach (const QString &fakeSlot, domSlots->elementSlot())
- if (fakeSlots.indexOf(fakeSlot) == -1) {
- fakeSlots += fakeSlot;
- rc = true;
- }
-
- foreach (const QString &fakeSignal, domSlots->elementSignal())
- if (fakeSignals.indexOf(fakeSignal) == -1) {
- fakeSignals += fakeSignal;
- rc = true;
- }
- return rc;
-}
-
QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
{
// Load extra info extension. This is used by Jambi for preventing
@@ -1425,108 +1405,9 @@ DomLayoutItem *QDesignerResource::createDom(QLayoutItem *item, DomLayout *ui_lay
return ui_item;
}
-static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item)
-{
- const DomSlots *domSlots = domCustomWidget->elementSlots();
- if (!domSlots)
- return;
-
- // Merge in new slots, signals
- QStringList fakeSlots = item->fakeSlots();
- QStringList fakeSignals = item->fakeSignals();
- if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
- item->setFakeSlots(fakeSlots);
- item->setFakeSignals(fakeSignals);
- }
-}
-
-void QDesignerResource::addCustomWidgetsToWidgetDatabase(DomCustomWidgetList& custom_widget_list)
-{
- // Perform one iteration of adding the custom widgets to the database,
- // looking up the base class and inheriting its data.
- // Remove the succeeded custom widgets from the list.
- // Classes whose base class could not be found are left in the list.
- QDesignerWidgetDataBaseInterface *db = m_formWindow->core()->widgetDataBase();
- for (int i=0; i < custom_widget_list.size(); ) {
- bool classInserted = false;
- DomCustomWidget *custom_widget = custom_widget_list[i];
- const QString customClassName = custom_widget->elementClass();
- const QString base_class = custom_widget->elementExtends();
- QString includeFile;
- IncludeType includeType = IncludeLocal;
- if (const DomHeader *header = custom_widget->elementHeader()) {
- includeFile = header->text();
- if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global"))
- includeType = IncludeGlobal;
- }
- const bool domIsContainer = custom_widget->elementContainer();
- // Append a new item
- if (base_class.isEmpty()) {
- WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName);
- item->setPromoted(false);
- item->setGroup(QApplication::translate("Designer", "Custom Widgets"));
- item->setIncludeFile(buildIncludeFile(includeFile, includeType));
- item->setContainer(domIsContainer);
- item->setCustom(true);
- addFakeMethodsToWidgetDataBase(custom_widget, item);
- db->append(item);
- custom_widget_list.removeAt(i);
- classInserted = true;
- } else {
- // Create a new entry cloned from base class. Note that this will ignore existing
- // classes, eg, plugin custom widgets.
- QDesignerWidgetDataBaseItemInterface *item =
- appendDerived(db, customClassName, QApplication::translate("Designer", "Promoted Widgets"),
- base_class,
- buildIncludeFile(includeFile, includeType),
- true,true);
- // Ok, base class found.
- if (item) {
- // Hack to accommodate for old UI-files in which "contains" is not set properly:
- // Apply "contains" from DOM only if true (else, eg classes from QFrame might not accept
- // dropping child widgets on them as container=false). This also allows for
- // QWidget-derived stacked pages.
- if (domIsContainer)
- item->setContainer(domIsContainer);
-
- addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item));
- custom_widget_list.removeAt(i);
- classInserted = true;
- }
- }
- // Skip failed item.
- if (!classInserted)
- i++;
- }
-
-}
void QDesignerResource::createCustomWidgets(DomCustomWidgets *dom_custom_widgets)
{
- if (dom_custom_widgets == 0)
- return;
- DomCustomWidgetList custom_widget_list = dom_custom_widgets->elementCustomWidget();
- // Attempt to insert each item derived from its base class.
- // This should at most require two iterations in the event that the classes are out of order
- // (derived first, max depth: promoted custom plugin = 2)
- for (int iteration = 0; iteration < 2; iteration++) {
- addCustomWidgetsToWidgetDatabase(custom_widget_list);
- if (custom_widget_list.empty())
- return;
- }
- // Oops, there are classes left whose base class could not be found.
- // Default them to QWidget with warnings.
- const QString fallBackBaseClass = QLatin1String("QWidget");
- for (int i=0; i < custom_widget_list.size(); i++ ) {
- DomCustomWidget *custom_widget = custom_widget_list[i];
- const QString customClassName = custom_widget->elementClass();
- const QString base_class = custom_widget->elementExtends();
- qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName
- << " could not be found. Defaulting to " << fallBackBaseClass << '.';
- custom_widget->setElementExtends(fallBackBaseClass);
- }
- // One more pass.
- addCustomWidgetsToWidgetDatabase(custom_widget_list);
- Q_ASSERT(custom_widget_list.empty());
+ QSimpleResource::handleDomCustomWidgets(core(), dom_custom_widgets);
}
DomTabStops *QDesignerResource::saveTabStops()
diff --git a/tools/designer/src/lib/shared/newformwidget.cpp b/tools/designer/src/lib/shared/newformwidget.cpp
index d79d77a..503e597 100644
--- a/tools/designer/src/lib/shared/newformwidget.cpp
+++ b/tools/designer/src/lib/shared/newformwidget.cpp
@@ -310,9 +310,8 @@ QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core,
const QString &workingDir,
const qdesigner_internal::DeviceProfile &dp)
{
- qdesigner_internal::QDesignerFormBuilder formBuilder(core,
- qdesigner_internal::QDesignerFormBuilder::DisableScripts,
- dp);
+ qdesigner_internal::NewFormWidgetFormBuilder
+ formBuilder(core, qdesigner_internal::QDesignerFormBuilder::DisableScripts, dp);
if (!workingDir.isEmpty())
formBuilder.setWorkingDirectory(workingDir);
diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
index 6394847..b92a48d 100644
--- a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -473,6 +473,20 @@ QPixmap QDesignerFormBuilder::createPreviewPixmap(const QDesignerFormWindowInter
return rc;
}
+// ---------- NewFormWidgetFormBuilder
+
+NewFormWidgetFormBuilder::NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core,
+ Mode mode,
+ const DeviceProfile &deviceProfile) :
+ QDesignerFormBuilder(core, mode, deviceProfile)
+{
+}
+
+void NewFormWidgetFormBuilder::createCustomWidgets(DomCustomWidgets *dc)
+{
+ QSimpleResource::handleDomCustomWidgets(core(), dc);
+}
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
index b982e1c..ee40085 100644
--- a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
@@ -75,7 +75,7 @@ namespace qdesigner_internal {
class DesignerPixmapCache;
class DesignerIconCache;
-/* Form builder used for previewing forms, widget box and new form dialog.
+/* Form builder used for previewing forms and widget box.
* It applies the system settings to its toplevel window. */
class QDESIGNER_SHARED_EXPORT QDesignerFormBuilder: public QFormBuilder
@@ -159,6 +159,21 @@ private:
bool m_mainWidget;
};
+// Form builder for a new form widget (preview). To allow for promoted
+// widgets in the template, it implements the handling of custom widgets
+// (adding of them to the widget database).
+
+class QDESIGNER_SHARED_EXPORT NewFormWidgetFormBuilder: public QDesignerFormBuilder {
+public:
+ NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core,
+ Mode mode,
+ const DeviceProfile &deviceProfile = DeviceProfile());
+
+protected:
+ virtual void createCustomWidgets(DomCustomWidgets *);
+};
+
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
index 0bb91ee..898be1e 100644
--- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -440,18 +440,14 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos)
return tb->actions().at(index);
}
+//that's a trick to get acces to the initStyleOption which is a protected member
+class FriendlyToolBar : public QToolBar {
+public:
+ friend class ToolBarEventFilter;
+};
+
QRect ToolBarEventFilter::handleArea(const QToolBar *tb)
{
- //that's a trick to get acces to the initStyleOption which is a protected member
- class FriendlyToolBar : public QToolBar
- {
- public:
-#ifdef Q_NO_USING_KEYWORD
- void initStyleOption(QStyleOptionToolBar *option) { QToolBar::initStyleOption(option); }
-#else
- using QToolBar::initStyleOption;
-#endif
- };
QStyleOptionToolBar opt;
static_cast<const FriendlyToolBar*>(tb)->initStyleOption(&opt);
return tb->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, tb);
diff --git a/tools/designer/src/lib/shared/qsimpleresource.cpp b/tools/designer/src/lib/shared/qsimpleresource.cpp
index 8d29002..69d48fd 100644
--- a/tools/designer/src/lib/shared/qsimpleresource.cpp
+++ b/tools/designer/src/lib/shared/qsimpleresource.cpp
@@ -41,6 +41,7 @@
#include "qsimpleresource_p.h"
#include "widgetfactory_p.h"
+#include "widgetdatabase_p.h"
#include <formscriptrunner_p.h>
#include <properties_p.h>
@@ -57,6 +58,8 @@
#include <QtGui/QWidget>
#include <QtGui/QAction>
#include <QtCore/QDebug>
+#include <QtCore/QCoreApplication>
+
QT_BEGIN_NAMESPACE
@@ -267,6 +270,136 @@ bool QSimpleResource::warningsEnabled()
return m_warningsEnabled;
}
+// Custom widgets handling helpers
+
+// Add unique fake slots and signals to lists
+bool QSimpleResource::addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals)
+{
+ if (!domSlots)
+ return false;
+
+ bool rc = false;
+ foreach (const QString &fakeSlot, domSlots->elementSlot())
+ if (fakeSlots.indexOf(fakeSlot) == -1) {
+ fakeSlots += fakeSlot;
+ rc = true;
+ }
+
+ foreach (const QString &fakeSignal, domSlots->elementSignal())
+ if (fakeSignals.indexOf(fakeSignal) == -1) {
+ fakeSignals += fakeSignal;
+ rc = true;
+ }
+ return rc;
+}
+
+void QSimpleResource::addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item)
+{
+ const DomSlots *domSlots = domCustomWidget->elementSlots();
+ if (!domSlots)
+ return;
+
+ // Merge in new slots, signals
+ QStringList fakeSlots = item->fakeSlots();
+ QStringList fakeSignals = item->fakeSignals();
+ if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
+ item->setFakeSlots(fakeSlots);
+ item->setFakeSignals(fakeSignals);
+ }
+}
+
+// Perform one iteration of adding the custom widgets to the database,
+// looking up the base class and inheriting its data.
+// Remove the succeeded custom widgets from the list.
+// Classes whose base class could not be found are left in the list.
+
+void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core,
+ QList<DomCustomWidget*>& custom_widget_list)
+{
+ QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
+ for (int i=0; i < custom_widget_list.size(); ) {
+ bool classInserted = false;
+ DomCustomWidget *custom_widget = custom_widget_list[i];
+ const QString customClassName = custom_widget->elementClass();
+ const QString base_class = custom_widget->elementExtends();
+ QString includeFile;
+ IncludeType includeType = IncludeLocal;
+ if (const DomHeader *header = custom_widget->elementHeader()) {
+ includeFile = header->text();
+ if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global"))
+ includeType = IncludeGlobal;
+ }
+ const bool domIsContainer = custom_widget->elementContainer();
+ // Append a new item
+ if (base_class.isEmpty()) {
+ WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName);
+ item->setPromoted(false);
+ item->setGroup(QCoreApplication::translate("Designer", "Custom Widgets"));
+ item->setIncludeFile(buildIncludeFile(includeFile, includeType));
+ item->setContainer(domIsContainer);
+ item->setCustom(true);
+ addFakeMethodsToWidgetDataBase(custom_widget, item);
+ db->append(item);
+ custom_widget_list.removeAt(i);
+ classInserted = true;
+ } else {
+ // Create a new entry cloned from base class. Note that this will ignore existing
+ // classes, eg, plugin custom widgets.
+ QDesignerWidgetDataBaseItemInterface *item =
+ appendDerived(db, customClassName, QCoreApplication::translate("Designer", "Promoted Widgets"),
+ base_class,
+ buildIncludeFile(includeFile, includeType),
+ true,true);
+ // Ok, base class found.
+ if (item) {
+ // Hack to accommodate for old UI-files in which "container" is not set properly:
+ // Apply "container" from DOM only if true (else, eg classes from QFrame might not accept
+ // dropping child widgets on them as container=false). This also allows for
+ // QWidget-derived stacked pages.
+ if (domIsContainer)
+ item->setContainer(domIsContainer);
+
+ addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item));
+ custom_widget_list.removeAt(i);
+ classInserted = true;
+ }
+ }
+ // Skip failed item.
+ if (!classInserted)
+ i++;
+ }
+
+}
+
+void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface *core,
+ const DomCustomWidgets *dom_custom_widgets)
+{
+ if (dom_custom_widgets == 0)
+ return;
+ QList<DomCustomWidget*> custom_widget_list = dom_custom_widgets->elementCustomWidget();
+ // Attempt to insert each item derived from its base class.
+ // This should at most require two iterations in the event that the classes are out of order
+ // (derived first, max depth: promoted custom plugin = 2)
+ for (int iteration = 0; iteration < 2; iteration++) {
+ addCustomWidgetsToWidgetDatabase(core, custom_widget_list);
+ if (custom_widget_list.empty())
+ return;
+ }
+ // Oops, there are classes left whose base class could not be found.
+ // Default them to QWidget with warnings.
+ const QString fallBackBaseClass = QLatin1String("QWidget");
+ for (int i=0; i < custom_widget_list.size(); i++ ) {
+ DomCustomWidget *custom_widget = custom_widget_list[i];
+ const QString customClassName = custom_widget->elementClass();
+ const QString base_class = custom_widget->elementExtends();
+ qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName
+ << " could not be found. Defaulting to " << fallBackBaseClass << '.';
+ custom_widget->setElementExtends(fallBackBaseClass);
+ }
+ // One more pass.
+ addCustomWidgetsToWidgetDatabase(core, custom_widget_list);
+}
+
// ------------ FormBuilderClipboard
FormBuilderClipboard::FormBuilderClipboard(QWidget *w)
diff --git a/tools/designer/src/lib/shared/qsimpleresource_p.h b/tools/designer/src/lib/shared/qsimpleresource_p.h
index 8d45c3c..a25cb88 100644
--- a/tools/designer/src/lib/shared/qsimpleresource_p.h
+++ b/tools/designer/src/lib/shared/qsimpleresource_p.h
@@ -55,15 +55,21 @@
#include "shared_global_p.h"
#include "abstractformbuilder.h"
+#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
class DomScript;
+class DomCustomWidgets;
+class DomCustomWidget;
+class DomSlots;
class QDesignerFormEditorInterface;
namespace qdesigner_internal {
+class WidgetDataBaseItem;
+
class QDESIGNER_SHARED_EXPORT QSimpleResource : public QAbstractFormBuilder
{
public:
@@ -92,6 +98,11 @@ public:
static QString customWidgetScript(QDesignerFormEditorInterface *core, const QString &className);
static bool hasCustomWidgetScript(QDesignerFormEditorInterface *core, QObject *object);
+ // Implementation for FormBuilder::createDomCustomWidgets() that adds
+ // the custom widgets to the widget database
+ static void handleDomCustomWidgets(const QDesignerFormEditorInterface *core,
+ const DomCustomWidgets *dom_custom_widgets);
+
protected:
virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath);
virtual QString iconToFilePath(const QIcon &pm) const;
@@ -105,7 +116,13 @@ protected:
typedef QList<DomScript*> DomScripts;
static void addScript(const QString &script, ScriptSource source, DomScripts &domScripts);
+ static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals);
+
private:
+ static void addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core,
+ QList<DomCustomWidget*>& custom_widget_list);
+ static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item);
+
static bool m_warningsEnabled;
QDesignerFormEditorInterface *m_core;
};
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index bdc6c9a..ce17b6f 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -97,6 +97,11 @@ static int usage(const QStringList &args)
" Drop obsolete messages.\n\n"
" --no-finished\n"
" Drop finished messages.\n\n"
+ " --locations {absolute|relative|none}\n"
+ " Override how source code references are saved in ts files.\n"
+ " Default is absolute.\n}n"
+ " --no-ui-lines\n"
+ " Drop line numbers from references to .ui files.\n\n"
" --verbose\n"
" be a bit more verbose\n\n"
"Long options can be specified with only one leading dash, too.\n\n"
@@ -129,6 +134,8 @@ int main(int argc, char *argv[])
bool noObsolete = false;
bool noFinished = false;
bool verbose = false;
+ bool noUiLines = false;
+ Translator::LocationsType locations = Translator::DefaultLocations;
ConversionData cd;
Translator tr;
@@ -180,6 +187,19 @@ int main(int argc, char *argv[])
noObsolete = true;
} else if (args[i] == QLatin1String("-no-finished")) {
noFinished = true;
+ } else if (args[i] == QLatin1String("-locations")) {
+ if (++i >= args.size())
+ return usage(args);
+ if (args[i] == QLatin1String("none"))
+ locations = Translator::NoLocations;
+ else if (args[i] == QLatin1String("relative"))
+ locations = Translator::RelativeLocations;
+ else if (args[i] == QLatin1String("absolute"))
+ locations = Translator::AbsoluteLocations;
+ else
+ return usage(args);
+ } else if (args[i] == QLatin1String("-no-ui-lines")) {
+ noUiLines = true;
} else if (args[i] == QLatin1String("-verbose")) {
verbose = true;
} else if (args[i].startsWith(QLatin1Char('-'))) {
@@ -224,6 +244,10 @@ int main(int argc, char *argv[])
tr.stripFinishedMessages();
if (dropTranslations)
tr.dropTranslations();
+ if (noUiLines)
+ tr.dropUiLines();
+ if (locations != Translator::DefaultLocations)
+ tr.setLocationsType(locations);
if (!tr.save(outFileName, cd, outFormat)) {
qWarning("%s", qPrintable(cd.error()));
diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp
index 31024f9..658aebf 100644
--- a/tools/linguist/lupdate/java.cpp
+++ b/tools/linguist/lupdate/java.cpp
@@ -375,22 +375,13 @@ static bool matchString( QString &s )
return true;
}
-static bool matchInteger( qlonglong *number)
-{
- bool matches = (yyTok == Tok_Integer);
- if (matches) {
- yyTok = getToken();
- *number = yyInteger;
- }
- return matches;
-}
-
static bool matchStringOrNull(QString &s)
{
bool matches = matchString(s);
if (!matches) {
matches = (yyTok == Tok_null);
- if (matches) yyTok = getToken();
+ if (matches)
+ yyTok = getToken();
}
return matches;
}
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 312bb71..c1f242d 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -416,6 +416,26 @@ void Translator::dropTranslations()
}
}
+void Translator::dropUiLines()
+{
+ QString uiXt = QLatin1String(".ui");
+ QString juiXt = QLatin1String(".jui");
+ for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ++it) {
+ QHash<QString, int> have;
+ QList<TranslatorMessage::Reference> refs;
+ foreach (const TranslatorMessage::Reference &itref, it->allReferences()) {
+ const QString &fn = itref.fileName();
+ if (fn.endsWith(uiXt) || fn.endsWith(juiXt)) {
+ if (++have[fn] == 1)
+ refs.append(TranslatorMessage::Reference(fn, -1));
+ } else {
+ refs.append(itref);
+ }
+ }
+ it->setReferences(refs);
+ }
+}
+
QSet<TranslatorMessagePtr> Translator::resolveDuplicates()
{
QSet<TranslatorMessagePtr> dups;
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index 4e97000..5d0549b 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -132,6 +132,7 @@ public:
void stripNonPluralForms();
void stripIdenticalSourceTranslations();
void dropTranslations();
+ void dropUiLines();
void makeFileNamesAbsolute(const QDir &originalPath);
QSet<TranslatorMessagePtr> resolveDuplicates();
static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes,
@@ -143,7 +144,7 @@ public:
QString languageCode() const { return m_language; }
QString sourceLanguageCode() const { return m_sourceLanguage; }
- enum LocationsType { NoLocations, RelativeLocations, AbsoluteLocations };
+ enum LocationsType { DefaultLocations, NoLocations, RelativeLocations, AbsoluteLocations };
void setLocationsType(LocationsType lt) { m_locationsType = lt; }
LocationsType locationsType() const { return m_locationsType; }
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 601d0bc..da5b2f0 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -1265,9 +1265,7 @@ void DocParser::parse(const QString& source,
}
else {
append(Atom::ParaLeft);
- append(Atom::String,
- "This is an overloaded member function, "
- "provided for convenience.");
+ append(Atom::String,"This is an overloaded function.");
append(Atom::ParaRight);
x = getMetaCommandArgument(cmdStr);
}
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index fd1a2e6..c2d2d22 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -2386,23 +2386,19 @@ void HtmlGenerator::generateSectionList(const Section& section,
if (name_alignment) {
out() << "<tr><td class=\"memItemLeft\" "
- << "nowrap align=\"right\" valign=\"top\">";
+ << "align=\"right\" valign=\"top\">";
}
else {
if (twoColumn && i == (int) (section.members.count() + 1) / 2)
out() << "</ul></td><td valign=\"top\"><ul>\n";
- out() << "<li><div class=\"fn\"></div>";
+ out() << "<li><div class=\"fn\">";
}
- if (style == CodeMarker::Accessors)
- out() << "<b>";
generateSynopsis(*m, relative, marker, style, name_alignment);
- if (style == CodeMarker::Accessors)
- out() << "</b>";
if (name_alignment)
out() << "</td></tr>\n";
else
- out() << "</li>\n";
+ out() << "</div></li>\n";
i++;
++m;
}
@@ -2467,8 +2463,10 @@ void HtmlGenerator::generateSynopsis(const Node *node,
marked.replace("<@param>", "<i>");
marked.replace("</@param>", "</i>");
- if (style == CodeMarker::Summary)
- marked.replace("@name>", "b>");
+ if (style == CodeMarker::Summary) {
+ marked.replace("<@name>", ""); // was "<b>"
+ marked.replace("</@name>", ""); // was "</b>"
+ }
if (style == CodeMarker::SeparateList) {
QRegExp extraRegExp("<@extra>.*</@extra>");
@@ -3290,7 +3288,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
section.members += property->resetters();
if (!section.members.isEmpty()) {
- out() << "<p>Access functions:</p>\n";
+ out() << "<p><b>Access functions:</b></p>\n";
generateSectionList(section, node, marker, CodeMarker::Accessors);
}
}
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 3e6f832..5c247fa 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -43,6 +43,7 @@
main.cpp
*/
+#include <qglobal.h>
#include <QtCore>
#include <stdlib.h>
#include "apigenerator.h"
@@ -136,7 +137,8 @@ static void printHelp()
*/
static void printVersion()
{
- Location::information(tr("qdoc version 4.4.1"));
+ QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR);
+ Location::information(s);
}
/*!
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index c35c633..aef6c5d 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -1,9 +1,6 @@
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
font-family: Arial, Geneva, Helvetica, sans-serif;
}
-BODY,TD {
- font-size: 90%;
-}
H1 {
text-align: center;
font-size: 160%;
@@ -86,6 +83,7 @@ table td.memItemLeft {
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
+ white-space: nowrap
}
table td.memItemRight {
padding: 1px 8px 0px 8px;
@@ -127,10 +125,10 @@ table.annotated td {
table tr pre
{
- padding-top: none;
- padding-bottom: none;
- padding-left: none;
- padding-right: none;
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 0px;
+ padding-right: 0px;
border: none;
background: none
}