forked from qt-creator/qt-creator
Designer: Compilation with Qt 5.
Test the new Qt Designer integration interfaces. Change-Id: I8364167d5be3e7c361b192318b0bba7fb70d0f2f Reviewed-on: http://codereview.qt.nokia.com/9 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
committed by
Kai Koehne
parent
0d3d38ecc1
commit
b0d093b0d7
@@ -7,20 +7,26 @@ include(../../shared/designerintegrationv2/designerintegration.pri)
|
|||||||
include(cpp/cpp.pri)
|
include(cpp/cpp.pri)
|
||||||
include(designer_dependencies.pri)
|
include(designer_dependencies.pri)
|
||||||
|
|
||||||
# -- figure out shared dir location
|
INCLUDEPATH += ../../tools/utils
|
||||||
!exists($$[QT_INSTALL_HEADERS]/QtDesigner/private/qdesigner_integration_p.h) {
|
|
||||||
QT_SOURCE_TREE=$$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE)
|
minQtVersion(5, 0, 0) {
|
||||||
INCLUDEPATH += $$QT_SOURCE_TREE/include
|
CONFIG += designer
|
||||||
|
# -- Fixme: Make tools available
|
||||||
|
INCLUDEPATH += $$QMAKE_INCDIR_QT/../../qttools/include
|
||||||
|
} else {
|
||||||
|
# -- figure out shared dir location
|
||||||
|
!exists($$[QT_INSTALL_HEADERS]/QtDesigner/private/qdesigner_integration_p.h) {
|
||||||
|
QT_SOURCE_TREE=$$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE)
|
||||||
|
INCLUDEPATH += $$QT_SOURCE_TREE/include
|
||||||
|
}
|
||||||
|
INCLUDEPATH += $$QMAKE_INCDIR_QT/QtDesigner
|
||||||
|
qtAddLibrary(QtDesigner)
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH += $$QMAKE_INCDIR_QT/QtDesigner \
|
QT += xml
|
||||||
../../tools/utils
|
|
||||||
|
|
||||||
qtAddLibrary(QtDesigner)
|
|
||||||
qtAddLibrary(QtDesignerComponents)
|
qtAddLibrary(QtDesignerComponents)
|
||||||
|
|
||||||
QT+=xml
|
|
||||||
|
|
||||||
HEADERS += formeditorplugin.h \
|
HEADERS += formeditorplugin.h \
|
||||||
formeditorfactory.h \
|
formeditorfactory.h \
|
||||||
formwindoweditor.h \
|
formwindoweditor.h \
|
||||||
|
|||||||
@@ -35,7 +35,12 @@
|
|||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerFormEditorInterface>
|
#include <QtDesigner/QDesignerFormEditorInterface>
|
||||||
#include "qt_private/qdesigner_integration_p.h"
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerIntegration>
|
||||||
|
#else
|
||||||
|
# include "qt_private/qdesigner_integration_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -56,16 +61,18 @@ DesignerContext::DesignerContext(const Core::Context &context,
|
|||||||
|
|
||||||
QString DesignerContext::contextHelpId() const
|
QString DesignerContext::contextHelpId() const
|
||||||
{
|
{
|
||||||
QString helpId;
|
|
||||||
const QDesignerFormEditorInterface *core = FormEditorW::instance()->designerEditor();
|
const QDesignerFormEditorInterface *core = FormEditorW::instance()->designerEditor();
|
||||||
// Present from Qt 4.5.1 onwards. This will show the class documentation
|
#if QT_VERSION >= 0x050000
|
||||||
|
return core->integration()->contextHelpId();
|
||||||
|
#else
|
||||||
|
QString helpId;
|
||||||
|
// Present from Qt 4.5.1 onwards. This will show the class documentation
|
||||||
// scrolled to the current property.
|
// scrolled to the current property.
|
||||||
if (const qdesigner_internal::QDesignerIntegration *integration =
|
if (const qdesigner_internal::QDesignerIntegration *integration =
|
||||||
qobject_cast<const qdesigner_internal::QDesignerIntegration*>(core->integration()))
|
qobject_cast<const qdesigner_internal::QDesignerIntegration*>(core->integration()))
|
||||||
helpId = integration->contextHelpId();
|
helpId = integration->contextHelpId();
|
||||||
if (debug)
|
|
||||||
qDebug() << "DesignerContext::contextHelpId" << m_widget << helpId;
|
|
||||||
return helpId;
|
return helpId;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -63,14 +63,18 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerFormEditorPluginInterface>
|
#include <QtDesigner/QDesignerFormEditorPluginInterface>
|
||||||
#include "qt_private/pluginmanager_p.h"
|
|
||||||
|
|
||||||
#include "qt_private/iconloader_p.h" // createIconSet
|
|
||||||
#include "qt_private/qdesigner_formwindowmanager_p.h"
|
|
||||||
#include "qt_private/formwindowbase_p.h"
|
|
||||||
#include <QtDesigner/QDesignerFormEditorInterface>
|
#include <QtDesigner/QDesignerFormEditorInterface>
|
||||||
#include <QtDesigner/QDesignerComponents>
|
#include <QtDesigner/QDesignerComponents>
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerFormWindowManagerInterface>
|
||||||
|
#else
|
||||||
|
# include "qt_private/pluginmanager_p.h"
|
||||||
|
# include "qt_private/iconloader_p.h" // createIconSet
|
||||||
|
# include "qt_private/qdesigner_formwindowmanager_p.h"
|
||||||
|
# include "qt_private/formwindowbase_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerWidgetBoxInterface>
|
#include <QtDesigner/QDesignerWidgetBoxInterface>
|
||||||
#include <QtDesigner/abstractobjectinspector.h>
|
#include <QtDesigner/abstractobjectinspector.h>
|
||||||
#include <QtDesigner/QDesignerPropertyEditorInterface>
|
#include <QtDesigner/QDesignerPropertyEditorInterface>
|
||||||
@@ -117,7 +121,11 @@ static const char settingsGroup[] = "Designer";
|
|||||||
|
|
||||||
static inline QIcon designerIcon(const QString &iconName)
|
static inline QIcon designerIcon(const QString &iconName)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
const QIcon icon = QDesignerFormEditorInterface::createIcon(iconName);
|
||||||
|
#else
|
||||||
const QIcon icon = qdesigner_internal::createIconSet(iconName);
|
const QIcon icon = qdesigner_internal::createIconSet(iconName);
|
||||||
|
#endif
|
||||||
if (icon.isNull())
|
if (icon.isNull())
|
||||||
qWarning() << "Unable to locate " << iconName;
|
qWarning() << "Unable to locate " << iconName;
|
||||||
return icon;
|
return icon;
|
||||||
@@ -180,7 +188,11 @@ FormEditorW::FormEditorW() :
|
|||||||
m_formeditor->setTopLevel(qobject_cast<QWidget *>(m_core->editorManager()));
|
m_formeditor->setTopLevel(qobject_cast<QWidget *>(m_core->editorManager()));
|
||||||
m_formeditor->setSettingsManager(new SettingsManager());
|
m_formeditor->setSettingsManager(new SettingsManager());
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_fwm = m_formeditor->formWindowManager();
|
||||||
|
#else
|
||||||
m_fwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager*>(m_formeditor->formWindowManager());
|
m_fwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager*>(m_formeditor->formWindowManager());
|
||||||
|
#endif
|
||||||
QTC_ASSERT(m_fwm, return);
|
QTC_ASSERT(m_fwm, return);
|
||||||
|
|
||||||
m_contexts.add(Designer::Constants::C_FORMEDITOR);
|
m_contexts.add(Designer::Constants::C_FORMEDITOR);
|
||||||
@@ -295,7 +307,11 @@ void FormEditorW::fullInit()
|
|||||||
* This will initialize our TabOrder, Signals and slots and Buddy editors.
|
* This will initialize our TabOrder, Signals and slots and Buddy editors.
|
||||||
*/
|
*/
|
||||||
QList<QObject*> plugins = QPluginLoader::staticInstances();
|
QList<QObject*> plugins = QPluginLoader::staticInstances();
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
plugins += m_formeditor->pluginInstances();
|
||||||
|
#else
|
||||||
plugins += m_formeditor->pluginManager()->instances();
|
plugins += m_formeditor->pluginManager()->instances();
|
||||||
|
#endif
|
||||||
foreach (QObject *plugin, plugins) {
|
foreach (QObject *plugin, plugins) {
|
||||||
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
|
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
|
||||||
if (!formEditorPlugin->isInitialized())
|
if (!formEditorPlugin->isInitialized())
|
||||||
@@ -535,13 +551,22 @@ void FormEditorW::setupActions()
|
|||||||
// Commands that do not go into the editor toolbar
|
// Commands that do not go into the editor toolbar
|
||||||
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator2"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator2"));
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_actionPreview = m_fwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction);
|
||||||
|
#else
|
||||||
m_actionPreview = m_fwm->actionDefaultPreview();
|
m_actionPreview = m_fwm->actionDefaultPreview();
|
||||||
|
#endif
|
||||||
QTC_ASSERT(m_actionPreview, return);
|
QTC_ASSERT(m_actionPreview, return);
|
||||||
addToolAction(m_actionPreview, am, m_contexts,
|
addToolAction(m_actionPreview, am, m_contexts,
|
||||||
QLatin1String("FormEditor.Preview"), mformtools, tr("Alt+Shift+R"));
|
QLatin1String("FormEditor.Preview"), mformtools, tr("Alt+Shift+R"));
|
||||||
|
|
||||||
// Preview in style...
|
// Preview in style...
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_actionGroupPreviewInStyle = m_fwm->actionGroup(QDesignerFormWindowManagerInterface::StyledPreviewActionGroup);
|
||||||
|
#else
|
||||||
m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle();
|
m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle();
|
||||||
|
#endif
|
||||||
|
|
||||||
Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle);
|
Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle);
|
||||||
m_previewInStyleMenu = previewAC->menu();
|
m_previewInStyleMenu = previewAC->menu();
|
||||||
mformtools->addMenu(previewAC);
|
mformtools->addMenu(previewAC);
|
||||||
@@ -562,14 +587,24 @@ void FormEditorW::setupActions()
|
|||||||
tr("Shift+F4"));
|
tr("Shift+F4"));
|
||||||
|
|
||||||
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator4"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator4"));
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QAction *actionFormSettings = m_fwm->action(QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction);
|
||||||
|
#else
|
||||||
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
|
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
|
||||||
|
#endif
|
||||||
addToolAction(actionFormSettings, am, m_contexts, QLatin1String("FormEditor.FormSettings"), mformtools);
|
addToolAction(actionFormSettings, am, m_contexts, QLatin1String("FormEditor.FormSettings"), mformtools);
|
||||||
|
|
||||||
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator5"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator5"));
|
||||||
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
|
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
|
||||||
addToolAction(m_actionAboutPlugins, am, m_contexts,
|
addToolAction(m_actionAboutPlugins, am, m_contexts,
|
||||||
QLatin1String("FormEditor.AboutPlugins"), mformtools);
|
QLatin1String("FormEditor.AboutPlugins"), mformtools);
|
||||||
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, SLOT(aboutPlugins()));
|
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm,
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
SLOT(showPluginDialog())
|
||||||
|
#else
|
||||||
|
SLOT(aboutPlugins())
|
||||||
|
#endif
|
||||||
|
);
|
||||||
m_actionAboutPlugins->setEnabled(false);
|
m_actionAboutPlugins->setEnabled(false);
|
||||||
|
|
||||||
// FWM
|
// FWM
|
||||||
@@ -706,12 +741,18 @@ EditorData FormEditorW::createEditor(QWidget *parent)
|
|||||||
// Create and associate form and text editor.
|
// Create and associate form and text editor.
|
||||||
EditorData data;
|
EditorData data;
|
||||||
m_fwm->closeAllPreviews();
|
m_fwm->closeAllPreviews();
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(0);
|
||||||
|
#else
|
||||||
qdesigner_internal::FormWindowBase *form = qobject_cast<qdesigner_internal::FormWindowBase *>(m_fwm->createFormWindow(0));
|
qdesigner_internal::FormWindowBase *form = qobject_cast<qdesigner_internal::FormWindowBase *>(m_fwm->createFormWindow(0));
|
||||||
|
#endif
|
||||||
QTC_ASSERT(form, return data);
|
QTC_ASSERT(form, return data);
|
||||||
connect(form, SIGNAL(toolChanged(int)), this, SLOT(toolChanged(int)));
|
connect(form, SIGNAL(toolChanged(int)), this, SLOT(toolChanged(int)));
|
||||||
ResourceHandler *resourceHandler = new ResourceHandler(form);
|
ResourceHandler *resourceHandler = new ResourceHandler(form);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
form->setDesignerGrid(qdesigner_internal::FormWindowBase::defaultDesignerGrid());
|
form->setDesignerGrid(qdesigner_internal::FormWindowBase::defaultDesignerGrid());
|
||||||
qdesigner_internal::FormWindowBase::setupDefaultAction(form);
|
qdesigner_internal::FormWindowBase::setupDefaultAction(form);
|
||||||
|
#endif
|
||||||
data.widgetHost = new SharedTools::WidgetHost( /* parent */ 0, form);
|
data.widgetHost = new SharedTools::WidgetHost( /* parent */ 0, form);
|
||||||
DesignerXmlEditor *xmlEditor = new DesignerXmlEditor(form, parent);
|
DesignerXmlEditor *xmlEditor = new DesignerXmlEditor(form, parent);
|
||||||
TextEditor::TextEditorSettings::instance()->initializeEditor(xmlEditor);
|
TextEditor::TextEditorSettings::instance()->initializeEditor(xmlEditor);
|
||||||
@@ -815,10 +856,13 @@ void FormEditorW::print()
|
|||||||
const QPrinter::Orientation oldOrientation = m_core->printer()->orientation ();
|
const QPrinter::Orientation oldOrientation = m_core->printer()->orientation ();
|
||||||
m_core->printer()->setFullPage(false);
|
m_core->printer()->setFullPage(false);
|
||||||
do {
|
do {
|
||||||
|
|
||||||
// Grab the image to be able to a suggest suitable orientation
|
// Grab the image to be able to a suggest suitable orientation
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
const QPixmap pixmap = m_fwm->createPreviewPixmap();
|
||||||
|
#else
|
||||||
const QPixmap pixmap = m_fwm->createPreviewPixmap(&errorMessage);
|
const QPixmap pixmap = m_fwm->createPreviewPixmap(&errorMessage);
|
||||||
|
#endif
|
||||||
if (pixmap.isNull()) {
|
if (pixmap.isNull()) {
|
||||||
critical(tr("The image could not be created: %1").arg(errorMessage));
|
critical(tr("The image could not be created: %1").arg(errorMessage));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -55,9 +55,13 @@ class QSignalMapper;
|
|||||||
class QSettings;
|
class QSettings;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
class QDesignerFormWindowManagerInterface;
|
||||||
|
#else
|
||||||
namespace qdesigner_internal {
|
namespace qdesigner_internal {
|
||||||
class QDesignerFormWindowManager;
|
class QDesignerFormWindowManager;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -172,7 +176,12 @@ private:
|
|||||||
|
|
||||||
QDesignerFormEditorInterface *m_formeditor;
|
QDesignerFormEditorInterface *m_formeditor;
|
||||||
QDesignerIntegrationInterface *m_integration;
|
QDesignerIntegrationInterface *m_integration;
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QDesignerFormWindowManagerInterface *m_fwm;
|
||||||
|
#else
|
||||||
qdesigner_internal::QDesignerFormWindowManager *m_fwm;
|
qdesigner_internal::QDesignerFormWindowManager *m_fwm;
|
||||||
|
#endif
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
InitializationStage m_initStage;
|
InitializationStage m_initStage;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,11 @@
|
|||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "designerconstants.h"
|
#include "designerconstants.h"
|
||||||
|
|
||||||
#include "qt_private/abstractnewformwidget_p.h"
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerNewFormWidgetInterface>
|
||||||
|
#else
|
||||||
|
# include "qt_private/abstractnewformwidget_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QXmlStreamReader>
|
#include <QtCore/QXmlStreamReader>
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "formwindowfile.h"
|
#include "formwindowfile.h"
|
||||||
#include "designerconstants.h"
|
#include "designerconstants.h"
|
||||||
#include "resourcehandler.h"
|
#include "resourcehandler.h"
|
||||||
#include "qt_private/formwindowbase_p.h"
|
|
||||||
#include "designerxmleditor.h"
|
#include "designerxmleditor.h"
|
||||||
#include <widgethost.h>
|
#include <widgethost.h>
|
||||||
|
|
||||||
@@ -48,7 +47,12 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerFormWindowInterface>
|
||||||
|
# include <QtCore/QBuffer>
|
||||||
|
#else
|
||||||
|
# include "qt_private/formwindowbase_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
@@ -114,12 +118,17 @@ bool FormWindowEditor::createNew(const QString &contents)
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
const bool success = form->setContents(contents);
|
||||||
|
#else
|
||||||
form->setContents(contents);
|
form->setContents(contents);
|
||||||
|
const bool success = form->mainContainer() != 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hasOverrideCursor)
|
if (hasOverrideCursor)
|
||||||
QApplication::setOverrideCursor(overrideCursor);
|
QApplication::setOverrideCursor(overrideCursor);
|
||||||
|
|
||||||
if (form->mainContainer() == 0)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
syncXmlEditor(contents);
|
syncXmlEditor(contents);
|
||||||
@@ -154,11 +163,17 @@ bool FormWindowEditor::open(QString *errorString, const QString &fileName, const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
form->setFileName(absfileName);
|
form->setFileName(absfileName);
|
||||||
|
QByteArray contents = reader.data();
|
||||||
const QString contents = QString::fromUtf8(reader.data());
|
#if QT_VERSION >= 0x050000
|
||||||
form->setContents(contents);
|
QBuffer str(&contents);
|
||||||
|
str.open(QIODevice::ReadOnly);
|
||||||
|
if (!form->setContents(&str, errorString))
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
form->setContents(QString::fromUtf8(contents));
|
||||||
if (!form->mainContainer())
|
if (!form->mainContainer())
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
form->setDirty(fileName != realFileName);
|
form->setDirty(fileName != realFileName);
|
||||||
syncXmlEditor(contents);
|
syncXmlEditor(contents);
|
||||||
|
|
||||||
@@ -249,9 +264,16 @@ QWidget *FormWindowEditor::toolBar()
|
|||||||
|
|
||||||
QString FormWindowEditor::contents() const
|
QString FormWindowEditor::contents() const
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000 // TODO: No warnings about spacers here
|
||||||
|
const QDesignerFormWindowInterface *fw = d->m_file.formWindow();
|
||||||
|
QTC_ASSERT(fw, return QString());
|
||||||
|
return fw->contents();
|
||||||
|
#else
|
||||||
|
// No warnings about spacers here
|
||||||
const qdesigner_internal::FormWindowBase *fw = qobject_cast<const qdesigner_internal::FormWindowBase *>(d->m_file.formWindow());
|
const qdesigner_internal::FormWindowBase *fw = qobject_cast<const qdesigner_internal::FormWindowBase *>(d->m_file.formWindow());
|
||||||
QTC_ASSERT(fw, return QString());
|
QTC_ASSERT(fw, return QString());
|
||||||
return fw->fileContents(); // No warnings about spacers here
|
return fw->fileContents();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::BaseTextDocument *FormWindowEditor::textDocument()
|
TextEditor::BaseTextDocument *FormWindowEditor::textDocument()
|
||||||
|
|||||||
@@ -41,7 +41,9 @@
|
|||||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||||
#include <QtDesigner/QDesignerFormWindowManagerInterface>
|
#include <QtDesigner/QDesignerFormWindowManagerInterface>
|
||||||
#include <QtDesigner/QDesignerFormEditorInterface>
|
#include <QtDesigner/QDesignerFormEditorInterface>
|
||||||
#include "qt_private/qsimpleresource_p.h"
|
#if QT_VERSION < 0x050000
|
||||||
|
# include "qt_private/qsimpleresource_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
@@ -83,10 +85,13 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
|
|||||||
const QString oldFormName = m_formWindow->fileName();
|
const QString oldFormName = m_formWindow->fileName();
|
||||||
if (!autoSave)
|
if (!autoSave)
|
||||||
m_formWindow->setFileName(fi.absoluteFilePath());
|
m_formWindow->setFileName(fi.absoluteFilePath());
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
const bool writeOK = writeFile(actualName, errorString);
|
||||||
|
#else
|
||||||
const bool warningsEnabled = qdesigner_internal::QSimpleResource::setWarningsEnabled(false);
|
const bool warningsEnabled = qdesigner_internal::QSimpleResource::setWarningsEnabled(false);
|
||||||
const bool writeOK = writeFile(actualName, errorString);
|
const bool writeOK = writeFile(actualName, errorString);
|
||||||
qdesigner_internal::QSimpleResource::setWarningsEnabled(warningsEnabled);
|
qdesigner_internal::QSimpleResource::setWarningsEnabled(warningsEnabled);
|
||||||
|
#endif
|
||||||
m_shouldAutoSave = false;
|
m_shouldAutoSave = false;
|
||||||
if (autoSave)
|
if (autoSave)
|
||||||
return writeOK;
|
return writeOK;
|
||||||
|
|||||||
@@ -89,12 +89,24 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :
|
QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :
|
||||||
qdesigner_internal::QDesignerIntegration(core, ::qobject_cast<QObject*>(parent)),
|
#if QT_VERSION >= 0x050000
|
||||||
|
QDesignerIntegration(core, parent),
|
||||||
|
#else
|
||||||
|
qdesigner_internal::QDesignerIntegration(core, parent),
|
||||||
|
#endif
|
||||||
m_few(parent)
|
m_few(parent)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
setResourceFileWatcherBehaviour(ReloadResourceFileSilently);
|
||||||
|
Feature f = features();
|
||||||
|
f |= SlotNavigationFeature;
|
||||||
|
f &= ~ResourceEditorFeature;
|
||||||
|
setFeatures(f);
|
||||||
|
#else
|
||||||
setResourceFileWatcherBehaviour(QDesignerIntegration::ReloadSilently);
|
setResourceFileWatcherBehaviour(QDesignerIntegration::ReloadSilently);
|
||||||
setResourceEditingEnabled(false);
|
setResourceEditingEnabled(false);
|
||||||
setSlotNavigationEnabled(true);
|
setSlotNavigationEnabled(true);
|
||||||
|
#endif
|
||||||
connect(this, SIGNAL(navigateToSlot(QString, QString, QStringList)),
|
connect(this, SIGNAL(navigateToSlot(QString, QString, QStringList)),
|
||||||
this, SLOT(slotNavigateToSlot(QString, QString, QStringList)));
|
this, SLOT(slotNavigateToSlot(QString, QString, QStringList)));
|
||||||
connect(this, SIGNAL(helpRequested(QString,QString)),
|
connect(this, SIGNAL(helpRequested(QString,QString)),
|
||||||
@@ -115,7 +127,11 @@ void QtCreatorIntegration::updateSelection()
|
|||||||
{
|
{
|
||||||
if (const EditorData ed = m_few->activeEditor())
|
if (const EditorData ed = m_few->activeEditor())
|
||||||
ed.widgetHost->updateFormWindowSelectionHandles(true);
|
ed.widgetHost->updateFormWindowSelectionHandles(true);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QDesignerIntegration::updateSelection();
|
||||||
|
#else
|
||||||
qdesigner_internal::QDesignerIntegration::updateSelection();
|
qdesigner_internal::QDesignerIntegration::updateSelection();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
||||||
|
|||||||
@@ -35,7 +35,11 @@
|
|||||||
|
|
||||||
#include <cplusplus/ModelManagerInterface.h>
|
#include <cplusplus/ModelManagerInterface.h>
|
||||||
|
|
||||||
#include "qt_private/qdesigner_integration_p.h"
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerIntegration>
|
||||||
|
#else
|
||||||
|
# include "qt_private/qdesigner_integration_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QUrl)
|
QT_FORWARD_DECLARE_CLASS(QUrl)
|
||||||
|
|
||||||
@@ -44,7 +48,12 @@ namespace Internal {
|
|||||||
|
|
||||||
class FormEditorW;
|
class FormEditorW;
|
||||||
|
|
||||||
class QtCreatorIntegration : public qdesigner_internal::QDesignerIntegration {
|
class QtCreatorIntegration :
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
public QDesignerIntegration {
|
||||||
|
#else
|
||||||
|
public qdesigner_internal::QDesignerIntegration {
|
||||||
|
#endif
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QtCreatorIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent = 0);
|
explicit QtCreatorIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent = 0);
|
||||||
|
|||||||
@@ -39,8 +39,12 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
#include "qt_private/formwindowbase_p.h"
|
#if QT_VERSION >= 0x050000
|
||||||
#include "qt_private/qtresourcemodel_p.h"
|
# include <QtDesigner/QDesignerFormWindowInterface>
|
||||||
|
#else
|
||||||
|
# include "qt_private/formwindowbase_p.h"
|
||||||
|
# include "qt_private/qtresourcemodel_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -83,7 +87,11 @@ void QrcFilesVisitor::visitFolderNode(FolderNode *folderNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------ ResourceHandler
|
// ------------ ResourceHandler
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
ResourceHandler::ResourceHandler(QDesignerFormWindowInterface *fw) :
|
||||||
|
#else
|
||||||
ResourceHandler::ResourceHandler(qdesigner_internal::FormWindowBase *fw) :
|
ResourceHandler::ResourceHandler(qdesigner_internal::FormWindowBase *fw) :
|
||||||
|
#endif
|
||||||
QObject(fw),
|
QObject(fw),
|
||||||
m_form(fw),
|
m_form(fw),
|
||||||
m_sessionNode(0),
|
m_sessionNode(0),
|
||||||
@@ -106,8 +114,11 @@ void ResourceHandler::ensureInitialized()
|
|||||||
connect(m_sessionWatcher, SIGNAL(foldersAdded()), this, SLOT(updateResources()));
|
connect(m_sessionWatcher, SIGNAL(foldersAdded()), this, SLOT(updateResources()));
|
||||||
connect(m_sessionWatcher, SIGNAL(foldersRemoved()), this, SLOT(updateResources()));
|
connect(m_sessionWatcher, SIGNAL(foldersRemoved()), this, SLOT(updateResources()));
|
||||||
m_sessionNode->registerWatcher(m_sessionWatcher);
|
m_sessionNode->registerWatcher(m_sessionWatcher);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_originalUiQrcPaths = m_form->activeResourceFilePaths();
|
||||||
|
#else
|
||||||
m_originalUiQrcPaths = m_form->resourceSet()->activeQrcPaths();
|
m_originalUiQrcPaths = m_form->resourceSet()->activeQrcPaths();
|
||||||
|
#endif
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;
|
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;
|
||||||
}
|
}
|
||||||
@@ -142,16 +153,26 @@ void ResourceHandler::updateResources()
|
|||||||
QrcFilesVisitor qrcVisitor;
|
QrcFilesVisitor qrcVisitor;
|
||||||
root->accept(&qrcVisitor);
|
root->accept(&qrcVisitor);
|
||||||
const QStringList projectQrcFiles = qrcVisitor.qrcFiles();
|
const QStringList projectQrcFiles = qrcVisitor.qrcFiles();
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_form->activateResourceFilePaths(projectQrcFiles);
|
||||||
|
m_form->setResourceFileSaveMode(QDesignerFormWindowInterface::SaveOnlyUsedResourceFiles);
|
||||||
|
#else
|
||||||
m_form->resourceSet()->activateQrcPaths(projectQrcFiles);
|
m_form->resourceSet()->activateQrcPaths(projectQrcFiles);
|
||||||
m_form->setSaveResourcesBehaviour(qdesigner_internal::FormWindowBase::SaveOnlyUsedQrcFiles);
|
m_form->setSaveResourcesBehaviour(qdesigner_internal::FormWindowBase::SaveOnlyUsedQrcFiles);
|
||||||
|
#endif
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "ResourceHandler::updateResources()" << fileName
|
qDebug() << "ResourceHandler::updateResources()" << fileName
|
||||||
<< " associated with project" << project->rootProjectNode()->path()
|
<< " associated with project" << project->rootProjectNode()->path()
|
||||||
<< " using project qrc files" << projectQrcFiles.size();
|
<< " using project qrc files" << projectQrcFiles.size();
|
||||||
} else {
|
} else {
|
||||||
// Use resource file originally used in form
|
// Use resource file originally used in form
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
m_form->activateResourceFilePaths(m_originalUiQrcPaths);
|
||||||
|
m_form->setResourceFileSaveMode(QDesignerFormWindowInterface::SaveAllResourceFiles);
|
||||||
|
#else
|
||||||
m_form->resourceSet()->activateQrcPaths(m_originalUiQrcPaths);
|
m_form->resourceSet()->activateQrcPaths(m_originalUiQrcPaths);
|
||||||
m_form->setSaveResourcesBehaviour(qdesigner_internal::FormWindowBase::SaveAll);
|
m_form->setSaveResourcesBehaviour(qdesigner_internal::FormWindowBase::SaveAll);
|
||||||
|
#endif
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "ResourceHandler::updateResources()" << fileName << " not associated with project, using loaded qrc files.";
|
qDebug() << "ResourceHandler::updateResources()" << fileName << " not associated with project, using loaded qrc files.";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,13 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
class QDesignerFormWindowInterface;
|
||||||
|
#else
|
||||||
namespace qdesigner_internal {
|
namespace qdesigner_internal {
|
||||||
class FormWindowBase;
|
class FormWindowBase;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -64,7 +68,11 @@ class ResourceHandler : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ResourceHandler(qdesigner_internal::FormWindowBase *fw);
|
#if QT_VERSION >= 0x050000
|
||||||
|
explicit ResourceHandler(QDesignerFormWindowInterface *fw);
|
||||||
|
#else
|
||||||
|
explicit ResourceHandler(qdesigner_internal::FormWindowBase *fw);
|
||||||
|
#endif
|
||||||
virtual ~ResourceHandler();
|
virtual ~ResourceHandler();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -72,9 +80,11 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ensureInitialized();
|
void ensureInitialized();
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QDesignerFormWindowInterface * const m_form;
|
||||||
|
#else
|
||||||
qdesigner_internal::FormWindowBase * const m_form;
|
qdesigner_internal::FormWindowBase * const m_form;
|
||||||
|
#endif
|
||||||
QStringList m_originalUiQrcPaths;
|
QStringList m_originalUiQrcPaths;
|
||||||
ProjectExplorer::SessionNode *m_sessionNode;
|
ProjectExplorer::SessionNode *m_sessionNode;
|
||||||
ProjectExplorer::NodesWatcher *m_sessionWatcher;
|
ProjectExplorer::NodesWatcher *m_sessionWatcher;
|
||||||
|
|||||||
@@ -33,7 +33,11 @@
|
|||||||
#ifndef SETTINGSMANAGER_H
|
#ifndef SETTINGSMANAGER_H
|
||||||
#define SETTINGSMANAGER_H
|
#define SETTINGSMANAGER_H
|
||||||
|
|
||||||
#include "qt_private/abstractsettings_p.h"
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerSettingsInterface>
|
||||||
|
#else
|
||||||
|
# include "qt_private/abstractsettings_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -35,7 +35,11 @@
|
|||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include "qt_private/abstractoptionspage_p.h"
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include <QtDesigner/QDesignerOptionsPageInterface>
|
||||||
|
#else
|
||||||
|
# include "qt_private/abstractoptionspage_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|||||||
Reference in New Issue
Block a user