diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-03 00:05:16 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-03 00:05:16 (GMT) |
commit | b437255afe8348d0e5b865bd28cbf0500b3750f7 (patch) | |
tree | 76e31711c342d3176e5a26813937177bd4318b2d /tools | |
parent | 17d0ed5af4922645a268b6550742fb521d459c8e (diff) | |
parent | 778e902e675a4fb2680012f9bf1221abd3b13981 (diff) | |
download | Qt-b437255afe8348d0e5b865bd28cbf0500b3750f7.zip Qt-b437255afe8348d0e5b865bd28cbf0500b3750f7.tar.gz Qt-b437255afe8348d0e5b865bd28cbf0500b3750f7.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tools')
57 files changed, 359 insertions, 402 deletions
diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index b614cb4..f2bb816 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -122,17 +122,17 @@ private: void retranslate() { - simpleSearchLabel->setText(tr("Search for:")); - prevQueryButton->setToolTip(tr("Previous search")); - nextQueryButton->setToolTip(tr("Next search")); - searchButton->setText(tr("Search")); + simpleSearchLabel->setText(QHelpSearchQueryWidget::tr("Search for:")); + prevQueryButton->setToolTip(QHelpSearchQueryWidget::tr("Previous search")); + nextQueryButton->setToolTip(QHelpSearchQueryWidget::tr("Next search")); + searchButton->setText(QHelpSearchQueryWidget::tr("Search")); #ifdef QT_CLUCENE_SUPPORT - advancedSearchLabel->setText(tr("Advanced search")); - similarLabel->setText(tr("words <B>similar</B> to:")); - withoutLabel->setText(tr("<B>without</B> the words:")); - exactLabel->setText(tr("with <B>exact phrase</B>:")); - allLabel->setText(tr("with <B>all</B> of the words:")); - atLeastLabel->setText(tr("with <B>at least one</B> of the words:")); + advancedSearchLabel->setText(QHelpSearchQueryWidget::tr("Advanced search")); + similarLabel->setText(QHelpSearchQueryWidget::tr("words <B>similar</B> to:")); + withoutLabel->setText(QHelpSearchQueryWidget::tr("<B>without</B> the words:")); + exactLabel->setText(QHelpSearchQueryWidget::tr("with <B>exact phrase</B>:")); + allLabel->setText(QHelpSearchQueryWidget::tr("with <B>all</B> of the words:")); + atLeastLabel->setText(QHelpSearchQueryWidget::tr("with <B>at least one</B> of the words:")); #endif } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 7751143..abf81bd 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2535,8 +2535,11 @@ void Configure::generateOutputVars() qtConfig += "phonon-backend"; } - if (dictionary["MULTIMEDIA"] == "yes") + if (dictionary["MULTIMEDIA"] == "yes") { qtConfig += "multimedia"; + if (dictionary["AUDIO_BACKEND"] == "yes") + qtConfig += "audio-backend"; + } if (dictionary["WEBKIT"] == "yes") qtConfig += "webkit"; diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp index 2d013c9..9fd084d 100644 --- a/tools/designer/src/components/formeditor/formwindow.cpp +++ b/tools/designer/src/components/formeditor/formwindow.cpp @@ -2219,6 +2219,11 @@ QMenu *FormWindow::createPopupMenu(QWidget *w) QToolBoxHelper::addToolBoxContextMenuActions(toolBox, popup); } + if (manager->actionLower()->isEnabled()) { + popup->addAction(manager->actionLower()); + popup->addAction(manager->actionRaise()); + popup->addSeparator(); + } popup->addAction(manager->actionCut()); popup->addAction(manager->actionCopy()); } diff --git a/tools/designer/src/components/formeditor/formwindow.h b/tools/designer/src/components/formeditor/formwindow.h index eed7417..3eee476 100644 --- a/tools/designer/src/components/formeditor/formwindow.h +++ b/tools/designer/src/components/formeditor/formwindow.h @@ -278,8 +278,6 @@ private: void checkPreviewGeometry(QRect &r); - void finishContextMenu(QWidget *w, QWidget *menuParent, QContextMenuEvent *e); - bool handleContextMenu(QWidget *widget, QWidget *managedWidget, QContextMenuEvent *e); bool handleMouseButtonDblClickEvent(QWidget *widget, QWidget *managedWidget, QMouseEvent *e); bool handleMousePressEvent(QWidget *widget, QWidget *managedWidget, QMouseEvent *e); diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index b005e42..b659179 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -1446,7 +1446,7 @@ void QDesignerResource::applyTabStops(QWidget *widget, DomTabStops *tabStops) return; QList<QWidget*> tabOrder; - foreach (QString widgetName, tabStops->elementTabStop()) { + foreach (const QString &widgetName, tabStops->elementTabStop()) { if (QWidget *w = qFindChild<QWidget*>(widget, widgetName)) { tabOrder.append(w); } @@ -2418,7 +2418,7 @@ DomResources *QDesignerResource::saveResources(const QStringList &qrcPaths) QList<DomResource*> dom_include; if (resourceSet) { const QStringList activePaths = resourceSet->activeQrcPaths(); - foreach (QString path, activePaths) { + foreach (const QString &path, activePaths) { if (qrcPaths.contains(path)) { DomResource *dom_res = new DomResource; QString conv_path = path; diff --git a/tools/designer/src/components/propertyeditor/designerpropertymanager.h b/tools/designer/src/components/propertyeditor/designerpropertymanager.h index 0ec5241..11f900b 100644 --- a/tools/designer/src/components/propertyeditor/designerpropertymanager.h +++ b/tools/designer/src/components/propertyeditor/designerpropertymanager.h @@ -102,7 +102,7 @@ class DesignerPropertyManager : public QtVariantPropertyManager { Q_OBJECT public: - DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent = 0); ~DesignerPropertyManager(); virtual QStringList attributes(int propertyType) const; diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp index fbaf461..887ba98 100644 --- a/tools/designer/src/designer/qdesigner_actions.cpp +++ b/tools/designer/src/designer/qdesigner_actions.cpp @@ -580,7 +580,7 @@ bool QDesignerActions::openForm(QWidget *parent) return false; bool atLeastOne = false; - foreach (QString fileName, fileNames) { + foreach (const QString &fileName, fileNames) { if (readInForm(fileName) && !atLeastOne) atLeastOne = true; } @@ -869,7 +869,7 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr if (f.fileName() != fileName) { removeBackup(backupFile); fi.setFile(fileName); - backupFile = QString(); + backupFile.clear(); if (fi.exists()) backupFile = createBackup(fileName); } diff --git a/tools/designer/src/designer/qdesigner_server.cpp b/tools/designer/src/designer/qdesigner_server.cpp index 8016dff..de1532c 100644 --- a/tools/designer/src/designer/qdesigner_server.cpp +++ b/tools/designer/src/designer/qdesigner_server.cpp @@ -83,7 +83,7 @@ void QDesignerServer::sendOpenRequest(int port, const QStringList &files) sSocket->connectToHost(QHostAddress::LocalHost, port); if(sSocket->waitForConnected(3000)) { - foreach(QString file, files) + foreach(const QString &file, files) { QFileInfo fi(file); sSocket->write(fi.absoluteFilePath().toUtf8() + '\n'); @@ -96,9 +96,8 @@ void QDesignerServer::sendOpenRequest(int port, const QStringList &files) void QDesignerServer::readFromClient() { - QString file = QString(); while (m_socket->canReadLine()) { - file = QString::fromUtf8(m_socket->readLine()); + QString file = QString::fromUtf8(m_socket->readLine()); if (!file.isNull()) { file.remove(QLatin1Char('\n')); file.remove(QLatin1Char('\r')); @@ -143,7 +142,6 @@ QDesignerClient::~QDesignerClient() void QDesignerClient::readFromSocket() { - QString file = QString(); while (m_socket->canReadLine()) { QString file = QString::fromUtf8(m_socket->readLine()); if (!file.isNull()) { diff --git a/tools/designer/src/designer/qdesigner_server.h b/tools/designer/src/designer/qdesigner_server.h index 08bce68..d522056 100644 --- a/tools/designer/src/designer/qdesigner_server.h +++ b/tools/designer/src/designer/qdesigner_server.h @@ -53,7 +53,7 @@ class QDesignerServer: public QObject { Q_OBJECT public: - QDesignerServer(QObject *parent = 0); + explicit QDesignerServer(QObject *parent = 0); virtual ~QDesignerServer(); quint16 serverPort() const; diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp index 624b8bb..26ac8a8 100644 --- a/tools/designer/src/lib/shared/actioneditor.cpp +++ b/tools/designer/src/lib/shared/actioneditor.cpp @@ -428,7 +428,7 @@ void ActionEditor::unmanageAction(QAction *action) m_actionView->model()->remove(row); } -// Set an intial property and mark it as changed in the sheet +// Set an initial property and mark it as changed in the sheet static void setInitialProperty(QDesignerPropertySheetExtension *sheet, const QString &name, const QVariant &value) { const int index = sheet->indexOf(name); diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp index 64cf9c4..e3ff2c1 100644 --- a/tools/designer/src/lib/shared/actionrepository.cpp +++ b/tools/designer/src/lib/shared/actionrepository.cpp @@ -244,7 +244,7 @@ QMimeData *ActionModel::mimeData(const QModelIndexList &indexes ) const ActionRepositoryMimeData::ActionList actionList; QSet<QAction*> actions; - foreach (const QModelIndex &index, indexes) + foreach (const QModelIndex &index, indexes) if (QStandardItem *item = itemFromIndex(index)) if (QAction *action = actionOfItem(item)) actions.insert(action); diff --git a/tools/designer/src/lib/shared/connectionedit_p.h b/tools/designer/src/lib/shared/connectionedit_p.h index 4f0148d..37dfe75 100644 --- a/tools/designer/src/lib/shared/connectionedit_p.h +++ b/tools/designer/src/lib/shared/connectionedit_p.h @@ -87,7 +87,7 @@ public: class EndPoint { public: enum Type { Source, Target }; - EndPoint(Connection *_con = 0, Type _type = Source) : con(_con), type(_type) {} + explicit EndPoint(Connection *_con = 0, Type _type = Source) : con(_con), type(_type) {} bool isNull() const { return con == 0; } bool operator == (const EndPoint &other) const { return con == other.con && type == other.type; } bool operator != (const EndPoint &other) const { return !operator == (other); } diff --git a/tools/designer/src/lib/shared/filterwidget_p.h b/tools/designer/src/lib/shared/filterwidget_p.h index fdb199d..025d708 100644 --- a/tools/designer/src/lib/shared/filterwidget_p.h +++ b/tools/designer/src/lib/shared/filterwidget_p.h @@ -66,7 +66,7 @@ class QPushButton; namespace qdesigner_internal { /* A line edit that displays a grayed hintText (like "Type Here to Filter") - * when not focussed and empty. When connecting to the changed signals and + * when not focused and empty. When connecting to the changed signals and * querying text, one has to be aware that the text is set to that hint * text if isShowingHintText() returns true (that is, does not contain * valid user input). This widget should never have initial focus diff --git a/tools/designer/src/lib/shared/iconloader.cpp b/tools/designer/src/lib/shared/iconloader.cpp index 2c97f62..df0bb7e 100644 --- a/tools/designer/src/lib/shared/iconloader.cpp +++ b/tools/designer/src/lib/shared/iconloader.cpp @@ -60,7 +60,7 @@ QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name) #endif << (QString::fromUtf8(":/trolltech/formeditor/images/designer_") + name); - foreach (QString f, candidates) { + foreach (const QString &f, candidates) { if (QFile::exists(f)) return QIcon(f); } diff --git a/tools/designer/src/lib/shared/iconselector_p.h b/tools/designer/src/lib/shared/iconselector_p.h index 63d4ad7..3373f80 100644 --- a/tools/designer/src/lib/shared/iconselector_p.h +++ b/tools/designer/src/lib/shared/iconselector_p.h @@ -76,7 +76,7 @@ class QDESIGNER_SHARED_EXPORT LanguageResourceDialog : public QDialog { Q_OBJECT - LanguageResourceDialog(QDesignerResourceBrowserInterface *rb, QWidget *parent = 0); + explicit LanguageResourceDialog(QDesignerResourceBrowserInterface *rb, QWidget *parent = 0); public: virtual ~LanguageResourceDialog(); diff --git a/tools/designer/src/lib/shared/plugindialog.cpp b/tools/designer/src/lib/shared/plugindialog.cpp index c79dcf2..3e88043 100644 --- a/tools/designer/src/lib/shared/plugindialog.cpp +++ b/tools/designer/src/lib/shared/plugindialog.cpp @@ -105,7 +105,7 @@ void PluginDialog::populateTreeWidget() QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Loaded Plugins")); QFont boldFont = topLevelItem->font(0); - foreach (QString fileName, fileNames) { + foreach (const QString &fileName, fileNames) { QPluginLoader loader(fileName); const QFileInfo fileInfo(fileName); @@ -127,7 +127,7 @@ void PluginDialog::populateTreeWidget() if (!notLoadedPlugins.isEmpty()) { QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Failed Plugins")); const QFont boldFont = topLevelItem->font(0); - foreach (const QString plugin, notLoadedPlugins) { + foreach (const QString &plugin, notLoadedPlugins) { const QString failureReason = pluginManager->failureReason(plugin); QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, plugin, boldFont); setItem(pluginItem, failureReason, failureReason, QString(), QIcon()); diff --git a/tools/designer/src/lib/shared/qdesigner_introspection.cpp b/tools/designer/src/lib/shared/qdesigner_introspection.cpp index 170a111..7bc60d4 100644 --- a/tools/designer/src/lib/shared/qdesigner_introspection.cpp +++ b/tools/designer/src/lib/shared/qdesigner_introspection.cpp @@ -63,7 +63,7 @@ static QStringList byteArrayListToStringList(const QList<QByteArray> &l) static inline QString charToQString(const char *c) { if (!c) - return QString::null; + return QString(); return QString::fromUtf8(c); } diff --git a/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h b/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h index 354ef2a..f4b6672 100644 --- a/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h +++ b/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h @@ -85,7 +85,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerObjectInspector: public QDesignerObjectIn { Q_OBJECT public: - QDesignerObjectInspector(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerObjectInspector(QWidget *parent = 0, Qt::WindowFlags flags = 0); // Select a qobject unmanaged by form window virtual bool selectObject(QObject *o) = 0; diff --git a/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h b/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h index d1e407d..1e63d81 100644 --- a/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h +++ b/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h @@ -80,9 +80,9 @@ namespace qdesigner_internal { class NewPromotedClassPanel : public QGroupBox { Q_OBJECT public: - NewPromotedClassPanel(const QStringList &baseClasses, - int selectedBaseClass = -1, - QWidget *parent = 0); + explicit NewPromotedClassPanel(const QStringList &baseClasses, + int selectedBaseClass = -1, + QWidget *parent = 0); signals: void newPromotedClass(const PromotionParameters &, bool *ok); @@ -114,10 +114,10 @@ namespace qdesigner_internal { public: enum Mode { ModeEdit, ModeEditChooseClass }; - QDesignerPromotionDialog(QDesignerFormEditorInterface *core, - QWidget *parent = 0, - const QString &promotableWidgetClassName = QString(), - QString *promoteTo = 0); + explicit QDesignerPromotionDialog(QDesignerFormEditorInterface *core, + QWidget *parent = 0, + const QString &promotableWidgetClassName = QString(), + QString *promoteTo = 0); // Return an alphabetically ordered list of base class names for adding new classes. static const QStringList &baseClassNames(const QDesignerPromotionInterface *promotion); diff --git a/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h b/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h index c618bd7..cdd53f0 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h +++ b/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h @@ -69,7 +69,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerPropertyEditor: public QDesignerPropertyE { Q_OBJECT public: - QDesignerPropertyEditor(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerPropertyEditor(QWidget *parent = 0, Qt::WindowFlags flags = 0); // A pair <ValidationMode, bool isTranslatable>. typedef QPair<TextPropertyValidationMode, bool> StringPropertyParameters; diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 1cee074..02a2f6d 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -440,7 +440,7 @@ 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 +//that's a trick to get access to the initStyleOption which is a protected member class FriendlyToolBar : public QToolBar { public: friend class ToolBarEventFilter; diff --git a/tools/designer/src/lib/shared/qdesigner_utils_p.h b/tools/designer/src/lib/shared/qdesigner_utils_p.h index 502703d..fac0697 100644 --- a/tools/designer/src/lib/shared/qdesigner_utils_p.h +++ b/tools/designer/src/lib/shared/qdesigner_utils_p.h @@ -298,7 +298,7 @@ class QDESIGNER_SHARED_EXPORT DesignerIconCache : public QObject { Q_OBJECT public: - DesignerIconCache(DesignerPixmapCache *pixmapCache, QObject *parent = 0); + explicit DesignerIconCache(DesignerPixmapCache *pixmapCache, QObject *parent = 0); QIcon icon(const PropertySheetIconValue &value) const; void clear(); signals: @@ -313,7 +313,7 @@ private: class QDESIGNER_SHARED_EXPORT PropertySheetStringValue { public: - PropertySheetStringValue(const QString &value = QString(), + explicit PropertySheetStringValue(const QString &value = QString(), bool translatable = true, const QString &disambiguation = QString(), const QString &comment = QString()); @@ -345,11 +345,11 @@ private: class QDESIGNER_SHARED_EXPORT PropertySheetKeySequenceValue { public: - PropertySheetKeySequenceValue(const QKeySequence &value = QKeySequence(), + explicit PropertySheetKeySequenceValue(const QKeySequence &value = QKeySequence(), bool translatable = true, const QString &disambiguation = QString(), const QString &comment = QString()); - PropertySheetKeySequenceValue(const QKeySequence::StandardKey &standardKey, + explicit PropertySheetKeySequenceValue(const QKeySequence::StandardKey &standardKey, bool translatable = true, const QString &disambiguation = QString(), const QString &comment = QString()); diff --git a/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h b/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h index cf944b9..13b7f74 100644 --- a/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h +++ b/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h @@ -70,7 +70,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerWidgetBox : public QDesignerWidgetBoxInte public: enum LoadMode { LoadMerge, LoadReplace, LoadCustomWidgetsOnly }; - QDesignerWidgetBox(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerWidgetBox(QWidget *parent = 0, Qt::WindowFlags flags = 0); LoadMode loadMode() const; void setLoadMode(LoadMode lm); diff --git a/tools/designer/src/lib/shared/qtresourceview_p.h b/tools/designer/src/lib/shared/qtresourceview_p.h index 26c4754..8da2975 100644 --- a/tools/designer/src/lib/shared/qtresourceview_p.h +++ b/tools/designer/src/lib/shared/qtresourceview_p.h @@ -68,7 +68,7 @@ class QDESIGNER_SHARED_EXPORT QtResourceView : public QWidget { Q_OBJECT public: - QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent = 0); ~QtResourceView(); void setDragEnabled(bool dragEnabled); @@ -120,7 +120,7 @@ class QDESIGNER_SHARED_EXPORT QtResourceViewDialog : public QDialog { Q_OBJECT public: - QtResourceViewDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit QtResourceViewDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); virtual ~QtResourceViewDialog(); QString selectedResource() const; diff --git a/tools/designer/src/lib/shared/richtexteditor_p.h b/tools/designer/src/lib/shared/richtexteditor_p.h index 4157d2c..44023ef 100644 --- a/tools/designer/src/lib/shared/richtexteditor_p.h +++ b/tools/designer/src/lib/shared/richtexteditor_p.h @@ -72,7 +72,7 @@ class QDESIGNER_SHARED_EXPORT RichTextEditorDialog : public QDialog { Q_OBJECT public: - RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); ~RichTextEditorDialog(); int showDialog(); diff --git a/tools/designer/src/lib/shared/shared_settings.cpp b/tools/designer/src/lib/shared/shared_settings.cpp index d6fd4bc..281b5c6 100644 --- a/tools/designer/src/lib/shared/shared_settings.cpp +++ b/tools/designer/src/lib/shared/shared_settings.cpp @@ -161,7 +161,7 @@ QStringList QDesignerSharedSettings::additionalFormTemplatePaths() const { // get template paths excluding internal ones QStringList rc = formTemplatePaths(); - foreach (QString internalTemplatePath, defaultFormTemplatePaths()) { + foreach (const QString &internalTemplatePath, defaultFormTemplatePaths()) { const int index = rc.indexOf(internalTemplatePath); if (index != -1) rc.removeAt(index); diff --git a/tools/designer/src/lib/shared/textpropertyeditor_p.h b/tools/designer/src/lib/shared/textpropertyeditor_p.h index 5b913ac..48f7898 100644 --- a/tools/designer/src/lib/shared/textpropertyeditor_p.h +++ b/tools/designer/src/lib/shared/textpropertyeditor_p.h @@ -90,7 +90,7 @@ namespace qdesigner_internal { UpdateOnFinished }; - TextPropertyEditor(QWidget *parent = 0, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine); + explicit TextPropertyEditor(QWidget *parent = 0, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine); TextPropertyValidationMode textPropertyValidationMode() const { return m_validationMode; } void setTextPropertyValidationMode(TextPropertyValidationMode vm); diff --git a/tools/designer/src/lib/shared/widgetdatabase_p.h b/tools/designer/src/lib/shared/widgetdatabase_p.h index 0e99999..873e79b 100644 --- a/tools/designer/src/lib/shared/widgetdatabase_p.h +++ b/tools/designer/src/lib/shared/widgetdatabase_p.h @@ -74,8 +74,8 @@ namespace qdesigner_internal { class QDESIGNER_SHARED_EXPORT WidgetDataBaseItem: public QDesignerWidgetDataBaseItemInterface { public: - WidgetDataBaseItem(const QString &name = QString(), - const QString &group = QString()); + explicit WidgetDataBaseItem(const QString &name = QString(), + const QString &group = QString()); QString name() const; void setName(const QString &name); @@ -159,7 +159,7 @@ class QDESIGNER_SHARED_EXPORT WidgetDataBase: public QDesignerWidgetDataBaseInte { Q_OBJECT public: - WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); virtual ~WidgetDataBase(); virtual QDesignerFormEditorInterface *core() const; diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index 1d2d6f8..a0c9e83 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -364,7 +364,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge const QStringList zOrderNames = ui_widget->elementZOrder(); if (!zOrderNames.isEmpty()) { QList<QWidget *> zOrder = qVariantValue<QWidgetList>(w->property("_q_zOrder")); - foreach (QString widgetName, zOrderNames) { + foreach (const QString &widgetName, zOrderNames) { if (QWidget *child = qFindChild<QWidget*>(w, widgetName)) { if (child->parentWidget() == w) { zOrder.removeAll(child); diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index cc8483f..c97daac 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -494,7 +494,7 @@ void QFormBuilder::updateCustomWidgets() { m_customWidgets.clear(); - foreach (QString path, m_pluginPaths) { + foreach (const QString &path, m_pluginPaths) { const QDir dir(path); const QStringList candidates = dir.entryList(QDir::Files); diff --git a/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h b/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h index c48449c..9f3c252 100644 --- a/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h +++ b/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h @@ -77,7 +77,7 @@ class QAxWidgetExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - QAxWidgetExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit QAxWidgetExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h b/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h index 1308fe2..50132a6 100644 --- a/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h +++ b/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h @@ -105,7 +105,7 @@ private: class QDesignerAxPluginWidget : public QDesignerAxWidget { - // No Q_OBJECT here! - meta functionality is overriden + // No Q_OBJECT here! - meta functionality is overridden public: explicit QDesignerAxPluginWidget(QWidget *parent); virtual ~QDesignerAxPluginWidget(); diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h index 49a8a40..4f2b3b2 100644 --- a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h @@ -81,7 +81,7 @@ class Q3IconViewExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3IconViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3IconViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h index 19213d8..e20e344 100644 --- a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h @@ -51,7 +51,7 @@ class Q3IconViewPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3IconViewPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3IconViewPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h index 7e291b6..bfb6738 100644 --- a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h @@ -79,7 +79,7 @@ class Q3ListBoxExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3ListBoxExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3ListBoxExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h index 66002f5..68d6913 100644 --- a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h @@ -51,7 +51,7 @@ class Q3ListBoxPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ListBoxPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ListBoxPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h index f14f256..e5222ed 100644 --- a/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h @@ -82,7 +82,7 @@ class Q3ListViewExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3ListViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3ListViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h index 7127a57..f9c82a2 100644 --- a/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h @@ -51,7 +51,7 @@ class Q3ListViewPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ListViewPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ListViewPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h index de2a75e..4ac7daa 100644 --- a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h +++ b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h @@ -51,7 +51,7 @@ class Q3MainWindowPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3MainWindowPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3MainWindowPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h index 40222bd..4de8b71 100644 --- a/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h @@ -79,7 +79,7 @@ class Q3TableExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3TableExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3TableExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h index 94f663a..beeaf3b 100644 --- a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h @@ -79,7 +79,7 @@ class Q3TextEditExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3TextEditExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3TextEditExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h index 28e0386..77bfb58 100644 --- a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h @@ -51,7 +51,7 @@ class Q3TextEditPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3TextEditPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3TextEditPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h index f3ed995..22562b1 100644 --- a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h @@ -78,7 +78,7 @@ class Q3ToolBarExtraInfoFactory: public QExtensionFactory { Q_OBJECT public: - Q3ToolBarExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + explicit Q3ToolBarExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; diff --git a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h index c79390c..c750cfe 100644 --- a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h +++ b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h @@ -51,7 +51,7 @@ class Q3ButtonGroupPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ButtonGroupPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ButtonGroupPlugin(const QIcon &icon, QObject *parent = 0); virtual ~Q3ButtonGroupPlugin(); virtual QString name() const; @@ -80,7 +80,7 @@ class Q3ComboBoxPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ComboBoxPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ComboBoxPlugin(const QIcon &icon, QObject *parent = 0); virtual ~Q3ComboBoxPlugin(); virtual QString name() const; @@ -109,7 +109,7 @@ class Q3DateEditPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3DateEditPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3DateEditPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; @@ -157,7 +157,7 @@ class Q3FramePlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3FramePlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3FramePlugin(const QIcon &icon, QObject *parent = 0); virtual ~Q3FramePlugin(); virtual QString name() const; @@ -215,7 +215,7 @@ class Q3ProgressBarPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ProgressBarPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ProgressBarPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; @@ -263,7 +263,7 @@ class Q3TimeEditPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3TimeEditPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3TimeEditPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h index 524f3fd..e8cf4fa 100644 --- a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h @@ -59,7 +59,7 @@ class Q3WizardHelper : public QObject { Q_OBJECT public: - Q3WizardHelper(Q3Wizard *wizard); + explicit Q3WizardHelper(Q3Wizard *wizard); private slots: void slotCurrentChanged(); private: diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h index 1837769..c9fff40 100644 --- a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h @@ -51,7 +51,7 @@ class Q3WizardPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3WizardPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3WizardPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/src.pro b/tools/designer/src/src.pro index e1710b8..78665b7 100644 --- a/tools/designer/src/src.pro +++ b/tools/designer/src/src.pro @@ -9,6 +9,4 @@ SUBDIRS = \ CONFIG(shared,shared|static):SUBDIRS += plugins -wince*: SUBDIRS -= designer plugins -symbian: SUBDIRS = uitools -contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= lib components
\ No newline at end of file +symbian|wince*: SUBDIRS = uitools diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 7834b06..266474e 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "translator.h" -#include "proreader.h" +#include "profileevaluator.h" #ifndef QT_BOOTSTRAPPED #include <QtCore/QCoreApplication> @@ -246,24 +246,31 @@ int main(int argc, char **argv) foreach (const QString &inputFile, inputFiles) { if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) || inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { - QHash<QByteArray, QStringList> varMap; - bool ok = evaluateProFile(inputFile, cd.isVerbose(), &varMap); - if (ok) { - QStringList translations = varMap.value("TRANSLATIONS"); - if (translations.isEmpty()) { - qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in" - " project file '%s'\n", - qPrintable(inputFile)); - } else { - foreach (const QString &trans, translations) - if (!releaseTsFile(trans, cd, removeIdentical)) - return 1; - } + QFileInfo fi(inputFile); + ProFile pro(fi.absoluteFilePath()); + + ProFileEvaluator visitor; + visitor.setVerbose(cd.isVerbose()); + + if (!visitor.queryProFile(&pro)) { + qWarning("lrelease error: cannot read project file '%s'.", qPrintable(inputFile)); + continue; + } + if (!visitor.accept(&pro)) { + qWarning("lrelease error: cannot process project file '%s'.", qPrintable(inputFile)); + continue; + } + + QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); + if (translations.isEmpty()) { + qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in" + " project file '%s'\n", + qPrintable(inputFile)); } else { - qWarning("error: lrelease encountered project file functionality that is currently not supported.\n" - "You might want to consider using TS files as input instead of a project file.\n" - "Try the following syntax:\n" - " lrelease [options] ts-files [-qm qm-file]\n"); + QDir proDir(fi.absolutePath()); + foreach (const QString &trans, translations) + if (!releaseTsFile(QFileInfo(proDir, trans).filePath(), cd, removeIdentical)) + return 1; } } else { if (outputFile.isEmpty()) { diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 0b21c5f..2a1128e 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -43,7 +43,6 @@ #include <translator.h> #include <profileevaluator.h> -#include <proreader.h> #include <QtCore/QCoreApplication> #include <QtCore/QDebug> @@ -118,21 +117,26 @@ static void printUsage() " -disable-heuristic {sametext|similartext|number}\n" " Disable the named merge heuristic. Can be specified multiple times.\n" " -pro <filename>\n" - " Name of a .pro file. Useful for files with .pro\n" - " file syntax but different file suffix\n" + " Name of a .pro file. Useful for files with .pro file syntax but\n" + " different file suffix. Projects are recursed into and merged.\n" " -source-language <language>[_<region>]\n" " Specify the language of the source strings for new files.\n" " Defaults to POSIX if not specified.\n" " -target-language <language>[_<region>]\n" " Specify the language of the translations for new files.\n" " Guessed from the file name if not specified.\n" + " -ts <ts-file>...\n" + " Specify the output file(s). This will override the TRANSLATIONS\n" + " and nullify the CODECFORTR from possibly specified project files.\n" + " -codecfortr <codec>\n" + " Specify the codec assumed for tr() calls. Effective only with -ts.\n" " -version\n" " Display the version of lupdate and exit.\n" ).arg(m_defaultExtensions)); } static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames, - const QByteArray &codecForTr, const QString &sourceLanguage, const QString &targetLanguage, + bool setCodec, const QString &sourceLanguage, const QString &targetLanguage, UpdateOptions options, bool *fail) { QDir dir; @@ -150,10 +154,10 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil } tor.resolveDuplicates(); cd.clearErrors(); - if (!codecForTr.isEmpty() && codecForTr != tor.codecName()) + if (setCodec && fetchedTor.codec() != tor.codec()) qWarning("lupdate warning: Codec for tr() '%s' disagrees with " "existing file's codec '%s'. Expect trouble.", - codecForTr.constData(), tor.codecName().constData()); + fetchedTor.codecName().constData(), tor.codecName().constData()); if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode()) qWarning("lupdate warning: Specified target language '%s' disagrees with " "existing file's language '%s'. Ignoring.", @@ -163,8 +167,8 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil "existing file's language '%s'. Ignoring.", qPrintable(sourceLanguage), qPrintable(tor.sourceLanguageCode())); } else { - if (!codecForTr.isEmpty()) - tor.setCodecName(codecForTr); + if (setCodec) + tor.setCodec(fetchedTor.codec()); if (!targetLanguage.isEmpty()) tor.setLanguageCode(targetLanguage); else @@ -186,8 +190,8 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil if (tor.locationsType() == Translator::NoLocations) // Could be set from file theseOptions |= NoLocations; Translator out = merge(tor, fetchedTor, theseOptions, err); - if (!codecForTr.isEmpty()) - out.setCodecName(codecForTr); + if (setCodec) + out.setCodec(fetchedTor.codec()); if ((options & Verbose) && !err.isEmpty()) { printOut(err); @@ -214,16 +218,198 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil } } +static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, + const QString &projectDir, const ProFileEvaluator &visitor) +{ + QStringList vPaths = visitor.absolutePathValues(QLatin1String(vvar), projectDir); + vPaths += baseVPaths; + vPaths.removeDuplicates(); + return visitor.absoluteFileValues(QLatin1String(var), projectDir, vPaths, 0); +} + +static QStringList getSources(const ProFileEvaluator &visitor, const QString &projectDir) +{ + QStringList baseVPaths; + baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir); + baseVPaths << projectDir; // QMAKE_ABSOLUTE_SOURCE_PATH + baseVPaths += visitor.absolutePathValues(QLatin1String("DEPENDPATH"), projectDir); + baseVPaths.removeDuplicates(); + + QStringList sourceFiles; + + // app/lib template + sourceFiles += getSources("SOURCES", "VPATH_SOURCES", baseVPaths, projectDir, visitor); + + sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor); + sourceFiles += getSources("FORMS3", "VPATH_FORMS3", baseVPaths, projectDir, visitor); + + QStringList vPathsInc = baseVPaths; + vPathsInc += visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir); + vPathsInc.removeDuplicates(); + sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0); + + sourceFiles.removeDuplicates(); + sourceFiles.sort(); + + return sourceFiles; +} + +static void processSources(Translator &fetchedTor, + const QStringList &sourceFiles, ConversionData &cd) +{ + QStringList sourceFilesCpp; + for (QStringList::const_iterator it = sourceFiles.begin(); it != sourceFiles.end(); ++it) { + if (it->endsWith(QLatin1String(".java"), Qt::CaseInsensitive)) + loadJava(fetchedTor, *it, cd); + else if (it->endsWith(QLatin1String(".ui"), Qt::CaseInsensitive) + || it->endsWith(QLatin1String(".jui"), Qt::CaseInsensitive)) + loadUI(fetchedTor, *it, cd); + else if (it->endsWith(QLatin1String(".js"), Qt::CaseInsensitive) + || it->endsWith(QLatin1String(".qs"), Qt::CaseInsensitive)) + loadQScript(fetchedTor, *it, cd); + else if (it->endsWith(QLatin1String(".qml"), Qt::CaseInsensitive)) + loadQml(fetchedTor, *it, cd); + else + sourceFilesCpp << *it; + } + loadCPP(fetchedTor, sourceFilesCpp, cd); + if (!cd.error().isEmpty()) + printOut(cd.error()); +} + +static void processProjects( + bool topLevel, bool nestComplain, const QStringList &proFiles, + UpdateOptions options, const QByteArray &codecForSource, + const QString &targetLanguage, const QString &sourceLanguage, + Translator *parentTor, bool *fail); + +static void processProject( + bool nestComplain, const QFileInfo &pfi, ProFileEvaluator &visitor, + UpdateOptions options, const QByteArray &_codecForSource, + const QString &targetLanguage, const QString &sourceLanguage, + Translator *fetchedTor, bool *fail) +{ + QByteArray codecForSource = _codecForSource; + QStringList tmp = visitor.values(QLatin1String("CODECFORSRC")); + if (!tmp.isEmpty()) { + codecForSource = tmp.last().toLatin1(); + if (!QTextCodec::codecForName(codecForSource)) { + qWarning("lupdate warning: Codec for source '%s' is invalid. " + "Falling back to codec for tr().", codecForSource.constData()); + codecForSource.clear(); + } + } + if (visitor.templateType() == ProFileEvaluator::TT_Subdirs) { + QStringList subProFiles; + QDir proDir(pfi.absoluteDir()); + foreach (const QString &subdir, visitor.values(QLatin1String("SUBDIRS"))) { + QString subPro = QDir::cleanPath(proDir.absoluteFilePath(subdir)); + QFileInfo subInfo(subPro); + if (subInfo.isDir()) + subProFiles << (subPro + QLatin1Char('/') + + subInfo.fileName() + QLatin1String(".pro")); + else + subProFiles << subPro; + } + processProjects(false, nestComplain, subProFiles, options, codecForSource, + targetLanguage, sourceLanguage, fetchedTor, fail); + } else { + ConversionData cd; + cd.m_noUiLines = options & NoUiLines; + cd.m_codecForSource = codecForSource; + cd.m_includePath = visitor.values(QLatin1String("INCLUDEPATH")); + QStringList sourceFiles = getSources(visitor, pfi.absolutePath()); + QSet<QString> sourceDirs; + sourceDirs.insert(QDir::cleanPath(pfi.absolutePath()) + QLatin1Char('/')); + foreach (const QString &sf, sourceFiles) + sourceDirs.insert(sf.left(sf.lastIndexOf(QLatin1Char('/')) + 1)); + QStringList rootList = sourceDirs.toList(); + rootList.sort(); + for (int prev = 0, curr = 1; curr < rootList.length(); ) + if (rootList.at(curr).startsWith(rootList.at(prev))) + rootList.removeAt(curr); + else + prev = curr++; + cd.m_projectRoots = QSet<QString>::fromList(rootList); + processSources(*fetchedTor, sourceFiles, cd); + } +} + +static void processProjects( + bool topLevel, bool nestComplain, const QStringList &proFiles, + UpdateOptions options, const QByteArray &codecForSource, + const QString &targetLanguage, const QString &sourceLanguage, + Translator *parentTor, bool *fail) +{ + foreach (const QString &proFile, proFiles) { + ProFileEvaluator visitor; + visitor.setVerbose(options & Verbose); + + QFileInfo pfi(proFile); + ProFile pro(pfi.absoluteFilePath()); + if (!visitor.queryProFile(&pro) || !visitor.accept(&pro)) { + if (topLevel) + *fail = true; + continue; + } + + if (visitor.contains(QLatin1String("TRANSLATIONS"))) { + if (parentTor) { + if (topLevel) { + std::cerr << "lupdate warning: TS files from command line " + "will override TRANSLATIONS in " << qPrintable(proFile) << ".\n"; + goto noTrans; + } else if (nestComplain) { + std::cerr << "lupdate warning: TS files from command line " + "prevent recursing into " << qPrintable(proFile) << ".\n"; + continue; + } + } + QStringList tsFiles; + QDir proDir(pfi.absolutePath()); + foreach (const QString &tsFile, visitor.values(QLatin1String("TRANSLATIONS"))) + tsFiles << QFileInfo(proDir, tsFile).filePath(); + if (tsFiles.isEmpty()) { + // This might mean either a buggy PRO file or an intentional detach - + // we can't know without seeing the actual RHS of the assignment ... + // Just assume correctness and be silent. + continue; + } + Translator tor; + bool setCodec = false; + QStringList tmp = visitor.values(QLatin1String("CODEC")) + + visitor.values(QLatin1String("DEFAULTCODEC")) + + visitor.values(QLatin1String("CODECFORTR")); + if (!tmp.isEmpty()) { + tor.setCodecName(tmp.last().toLatin1()); + setCodec = true; + } + processProject(false, pfi, visitor, options, codecForSource, + targetLanguage, sourceLanguage, &tor, fail); + updateTsFiles(tor, tsFiles, setCodec, sourceLanguage, targetLanguage, options, fail); + continue; + } + noTrans: + if (!parentTor) { + if (topLevel) + std::cerr << "lupdate warning: no TS files specified. Only diagnostics " + "will be produced for '" << qPrintable(proFile) << "'.\n"; + Translator tor; + processProject(nestComplain, pfi, visitor, options, codecForSource, + targetLanguage, sourceLanguage, &tor, fail); + } else { + processProject(nestComplain, pfi, visitor, options, codecForSource, + targetLanguage, sourceLanguage, parentTor, fail); + } + } +} + int main(int argc, char **argv) { QCoreApplication app(argc, argv); m_defaultExtensions = QLatin1String("ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx"); QStringList args = app.arguments(); - QString defaultContext; // This was QLatin1String("@default") before. - Translator fetchedTor; - QByteArray codecForTr; - QByteArray codecForSource; QStringList tsFileNames; QStringList proFiles; QMultiHash<QString, QString> allCSources; @@ -232,6 +418,7 @@ int main(int argc, char **argv) QStringList includePath; QString targetLanguage; QString sourceLanguage; + QByteArray codecForTr; UpdateOptions options = Verbose | // verbose is on by default starting with Qt 4.2 @@ -330,6 +517,14 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-version")) { printOut(QObject::tr("lupdate version %1\n").arg(QLatin1String(QT_VERSION_STR))); return 0; + } else if (arg == QLatin1String("-codecfortr")) { + ++i; + if (i == argc) { + qWarning("The -codecfortr option should be followed by a codec name."); + return 1; + } + codecForTr = args[i].toLatin1(); + continue; } else if (arg == QLatin1String("-ts")) { metTsFlag = true; continue; @@ -367,11 +562,6 @@ int main(int argc, char **argv) return 1; } - numFiles++; - - codecForTr.clear(); - codecForSource.clear(); - if (metTsFlag) { bool found = false; foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) { @@ -395,6 +585,7 @@ int main(int argc, char **argv) } else if (arg.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) || arg.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { proFiles << arg; + numFiles++; } else { QFileInfo fi(arg); if (!fi.exists()) { @@ -440,107 +631,53 @@ int main(int argc, char **argv) } else { sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; } + numFiles++; } } // for args - foreach (const QString &proFile, proFiles) - projectRoots.insert(QDir::cleanPath(QFileInfo(proFile).absolutePath()) + QLatin1Char('/')); + if (numFiles == 0) { + printUsage(); + return 1; + } + + if (!targetLanguage.isEmpty() && tsFileNames.count() != 1) + std::cerr << "lupdate warning: -target-language usually only " + "makes sense with exactly one TS file.\n"; + if (!codecForTr.isEmpty() && tsFileNames.isEmpty()) + std::cerr << "lupdate warning: -codecfortr has no effect without -ts.\n"; - bool firstPass = true; bool fail = false; - while (firstPass || !proFiles.isEmpty()) { + if (proFiles.isEmpty()) { + if (tsFileNames.isEmpty()) + std::cerr << "lupdate warning: no TS files specified. " + "Only diagnostics will be produced.\n"; + + Translator fetchedTor; ConversionData cd; - cd.m_defaultContext = defaultContext; cd.m_noUiLines = options & NoUiLines; cd.m_projectRoots = projectRoots; cd.m_includePath = includePath; cd.m_allCSources = allCSources; - - QStringList tsFiles = tsFileNames; - if (proFiles.count() > 0) { - QFileInfo pfi(proFiles.takeFirst()); - QHash<QByteArray, QStringList> variables; - - ProFileEvaluator visitor; - visitor.setVerbose(options & Verbose); - - ProFile pro(pfi.absoluteFilePath()); - if (!visitor.queryProFile(&pro)) - return 2; - if (!visitor.accept(&pro)) - return 2; - - if (visitor.templateType() == ProFileEvaluator::TT_Subdirs) { - QDir proDir(pfi.absoluteDir()); - foreach (const QString &subdir, visitor.values(QLatin1String("SUBDIRS"))) { - QString subPro = QDir::cleanPath(proDir.absoluteFilePath(subdir)); - QFileInfo subInfo(subPro); - if (subInfo.isDir()) - proFiles << (subPro + QLatin1Char('/') - + subInfo.fileName() + QLatin1String(".pro")); - else - proFiles << subPro; - } - continue; - } - - cd.m_includePath += visitor.values(QLatin1String("INCLUDEPATH")); - - evaluateProFile(visitor, &variables, pfi.absolutePath()); - - sourceFiles = variables.value("SOURCES"); - - QStringList tmp = variables.value("CODECFORTR"); - if (!tmp.isEmpty() && !tmp.first().isEmpty()) { - codecForTr = tmp.first().toLatin1(); - fetchedTor.setCodecName(codecForTr); - cd.m_outputCodec = codecForTr; - } - tmp = variables.value("CODECFORSRC"); - if (!tmp.isEmpty() && !tmp.first().isEmpty()) { - codecForSource = tmp.first().toLatin1(); - if (!QTextCodec::codecForName(codecForSource)) - qWarning("lupdate warning: Codec for source '%s' is invalid. Falling back to codec for tr().", - codecForSource.constData()); - else - cd.m_codecForSource = codecForSource; - } - - tsFiles += variables.value("TRANSLATIONS"); + fetchedTor.setCodecName(codecForTr); + processSources(fetchedTor, sourceFiles, cd); + updateTsFiles(fetchedTor, tsFileNames, !codecForTr.isEmpty(), + sourceLanguage, targetLanguage, options, &fail); + } else { + if (!sourceFiles.isEmpty() || !includePath.isEmpty()) { + qWarning("lupdate error: Both project and source files / include paths specified.\n"); + return 1; } - - QStringList sourceFilesCpp; - for (QStringList::iterator it = sourceFiles.begin(); it != sourceFiles.end(); ++it) { - if (it->endsWith(QLatin1String(".java"), Qt::CaseInsensitive)) - loadJava(fetchedTor, *it, cd); - else if (it->endsWith(QLatin1String(".ui"), Qt::CaseInsensitive) - || it->endsWith(QLatin1String(".jui"), Qt::CaseInsensitive)) - loadUI(fetchedTor, *it, cd); - else if (it->endsWith(QLatin1String(".js"), Qt::CaseInsensitive) - || it->endsWith(QLatin1String(".qs"), Qt::CaseInsensitive)) - loadQScript(fetchedTor, *it, cd); - else if (it->endsWith(QLatin1String(".qml"), Qt::CaseInsensitive)) - loadQml(fetchedTor, *it, cd); - else - sourceFilesCpp << *it; + if (!tsFileNames.isEmpty()) { + Translator fetchedTor; + fetchedTor.setCodecName(codecForTr); + processProjects(true, true, proFiles, options, QByteArray(), + targetLanguage, sourceLanguage, &fetchedTor, &fail); + updateTsFiles(fetchedTor, tsFileNames, !codecForTr.isEmpty(), + sourceLanguage, targetLanguage, options, &fail); + } else { + processProjects(true, false, proFiles, options, QByteArray(), + targetLanguage, sourceLanguage, 0, &fail); } - loadCPP(fetchedTor, sourceFilesCpp, cd); - if (!cd.error().isEmpty()) - printOut(cd.error()); - - tsFiles.sort(); - tsFiles.removeDuplicates(); - - if (!tsFiles.isEmpty()) - updateTsFiles(fetchedTor, tsFiles, codecForTr, sourceLanguage, targetLanguage, options, &fail); - - firstPass = false; - } - - if (numFiles == 0) { - printUsage(); - return 1; } - return fail ? 1 : 0; } diff --git a/tools/linguist/shared/proparser.pri b/tools/linguist/shared/proparser.pri index 99d32e7..372247e 100644 --- a/tools/linguist/shared/proparser.pri +++ b/tools/linguist/shared/proparser.pri @@ -2,13 +2,11 @@ INCLUDEPATH *= $$PWD HEADERS += \ - $$PWD/proreader.h \ $$PWD/abstractproitemvisitor.h \ $$PWD/proitems.h \ $$PWD/profileevaluator.h \ $$PWD/proparserutils.h SOURCES += \ - $$PWD/proreader.cpp \ $$PWD/proitems.cpp \ $$PWD/profileevaluator.cpp diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp deleted file mode 100644 index 4a621a8..0000000 --- a/tools/linguist/shared/proreader.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ - -#include "profileevaluator.h" - -#include <QtCore/QDir> -#include <QtCore/QFileInfo> - -QT_BEGIN_NAMESPACE - -static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, - const QString &projectDir, const ProFileEvaluator &visitor) -{ - QStringList vPaths = - visitor.absolutePathValues(QLatin1String(vvar), projectDir); - vPaths += baseVPaths; - vPaths.removeDuplicates(); - return visitor.absoluteFileValues(QLatin1String(var), projectDir, vPaths, 0); -} - -void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap, - const QString &projectDir) -{ - QStringList baseVPaths; - baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir); - baseVPaths << projectDir; // QMAKE_ABSOLUTE_SOURCE_PATH - baseVPaths += visitor.absolutePathValues(QLatin1String("DEPENDPATH"), projectDir); - baseVPaths.removeDuplicates(); - - QStringList sourceFiles; - QString codecForTr; - QString codecForSource; - QStringList tsFileNames; - - // app/lib template - sourceFiles += getSources("SOURCES", "VPATH_SOURCES", baseVPaths, projectDir, visitor); - - sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor); - sourceFiles += getSources("FORMS3", "VPATH_FORMS3", baseVPaths, projectDir, visitor); - - QStringList vPathsInc = baseVPaths; - vPathsInc += visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir); - vPathsInc.removeDuplicates(); - sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0); - - QDir proDir(projectDir); - foreach (const QString &tsFile, visitor.values(QLatin1String("TRANSLATIONS"))) - tsFileNames << QFileInfo(proDir, tsFile).filePath(); - - QStringList trcodec = visitor.values(QLatin1String("CODEC")) - + visitor.values(QLatin1String("DEFAULTCODEC")) - + visitor.values(QLatin1String("CODECFORTR")); - if (!trcodec.isEmpty()) - codecForTr = trcodec.last(); - - QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC")); - if (!srccodec.isEmpty()) - codecForSource = srccodec.last(); - - sourceFiles.sort(); - sourceFiles.removeDuplicates(); - tsFileNames.sort(); - tsFileNames.removeDuplicates(); - - varMap->insert("SOURCES", sourceFiles); - varMap->insert("CODECFORTR", QStringList() << codecForTr); - varMap->insert("CODECFORSRC", QStringList() << codecForSource); - varMap->insert("TRANSLATIONS", tsFileNames); -} - -bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap) -{ - QFileInfo fi(fileName); - if (!fi.exists()) - return false; - - ProFile pro(fi.absoluteFilePath()); - - ProFileEvaluator visitor; - visitor.setVerbose(verbose); - - if (!visitor.queryProFile(&pro)) - return false; - - if (!visitor.accept(&pro)) - return false; - - evaluateProFile(visitor, varMap, fi.absolutePath()); - - return true; -} - -QT_END_NAMESPACE diff --git a/tools/linguist/shared/proreader.h b/tools/linguist/shared/proreader.h deleted file mode 100644 index 70421d7..0000000 --- a/tools/linguist/shared/proreader.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist 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 PROREADER_H -#define PROREADER_H - -#include <QtCore/QHash> - -QT_BEGIN_NAMESPACE - -class ProFileEvaluator; - -void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap, - const QString &projectDir); -bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap); - -QT_END_NAMESPACE - -#endif // PROREADER_H diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 0fcd598..0b88c07 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -153,6 +153,7 @@ public: void reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose); void setCodecName(const QByteArray &name); + void setCodec(QTextCodec *codec) { m_codec = codec; } QByteArray codecName() const; QTextCodec *codec() const { return m_codec; } diff --git a/tools/shared/findwidget/texteditfindwidget.h b/tools/shared/findwidget/texteditfindwidget.h index 3034a42..a051f0e 100644 --- a/tools/shared/findwidget/texteditfindwidget.h +++ b/tools/shared/findwidget/texteditfindwidget.h @@ -53,7 +53,7 @@ class TextEditFindWidget : public AbstractFindWidget Q_OBJECT public: - TextEditFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); + explicit TextEditFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); QTextEdit *textEdit() const { return m_textEdit; } diff --git a/tools/shared/fontpanel/fontpanel.cpp b/tools/shared/fontpanel/fontpanel.cpp index 0b6f394..ad297df 100644 --- a/tools/shared/fontpanel/fontpanel.cpp +++ b/tools/shared/fontpanel/fontpanel.cpp @@ -217,7 +217,7 @@ void FontPanel::updateFamily(const QString &family) const QString normalStyle = QLatin1String("Normal"); if (hasStyles) { - foreach (QString style, styles) { + foreach (const QString &style, styles) { // try to maintain selection or select 'normal' preferably const int newIndex = m_styleComboBox->count(); m_styleComboBox->addItem(style); diff --git a/tools/shared/qtgradienteditor/qtgradientutils.cpp b/tools/shared/qtgradienteditor/qtgradientutils.cpp index 9fa0324..083ba89 100644 --- a/tools/shared/qtgradienteditor/qtgradientutils.cpp +++ b/tools/shared/qtgradienteditor/qtgradientutils.cpp @@ -395,7 +395,7 @@ static QStringList styleSheetParameters(const QGradient &gradient) static QStringList styleSheetStops(const QGradient &gradient) { QStringList result; - foreach (QGradientStop stop, gradient.stops()) { + foreach (const QGradientStop &stop, gradient.stops()) { const QColor color = stop.second; const QString stopDescription = QLatin1String("stop:") + QString::number(stop.first) + QLatin1String(" rgba(") diff --git a/tools/shared/qttoolbardialog/qttoolbardialog.h b/tools/shared/qttoolbardialog/qttoolbardialog.h index a1c099a..e182368 100644 --- a/tools/shared/qttoolbardialog/qttoolbardialog.h +++ b/tools/shared/qttoolbardialog/qttoolbardialog.h @@ -68,7 +68,7 @@ class QtToolBarManager : public QObject Q_OBJECT public: - QtToolBarManager(QObject *parent = 0); + explicit QtToolBarManager(QObject *parent = 0); ~QtToolBarManager(); void setMainWindow(QMainWindow *mainWindow); @@ -100,7 +100,7 @@ class QtToolBarDialog : public QDialog Q_OBJECT public: - QtToolBarDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QtToolBarDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); ~QtToolBarDialog(); void setToolBarManager(QtToolBarManager *toolBarManager); |