diff options
Diffstat (limited to 'tools/activeqt/testcon')
25 files changed, 3621 insertions, 0 deletions
diff --git a/tools/activeqt/testcon/ambientproperties.cpp b/tools/activeqt/testcon/ambientproperties.cpp new file mode 100644 index 0000000..8e284d8 --- /dev/null +++ b/tools/activeqt/testcon/ambientproperties.cpp @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ambientproperties.h" + +#include <QtGui> + +QT_BEGIN_NAMESPACE + +AmbientProperties::AmbientProperties(QWidget *parent) +: QDialog(parent), container(0) +{ + setupUi(this); + + connect(buttonClose, SIGNAL(clicked()), this, SLOT(close())); +} + +void AmbientProperties::setControl(QWidget *widget) +{ + container = widget; + + QColor c = container->palette().color(container->backgroundRole()); + QPalette p = backSample->palette(); p.setColor(backSample->backgroundRole(), c); backSample->setPalette(p); + + c = container->palette().color(container->foregroundRole()); + p = foreSample->palette(); p.setColor(foreSample->backgroundRole(), c); foreSample->setPalette(p); + + fontSample->setFont( container->font() ); + buttonEnabled->setChecked( container->isEnabled() ); + enabledSample->setEnabled( container->isEnabled() ); +} + +void AmbientProperties::on_buttonBackground_clicked() +{ + QColor c = QColorDialog::getColor(backSample->palette().color(backSample->backgroundRole()), this); + QPalette p = backSample->palette(); p.setColor(backSample->backgroundRole(), c); backSample->setPalette(p); + p = container->palette(); p.setColor(container->backgroundRole(), c); container->setPalette(p); + + if (QWorkspace *ws = qobject_cast<QWorkspace*>(container)) { + QWidgetList list( ws->windowList() ); + for (int i = 0; i < list.count(); ++i) { + QWidget *widget = list.at(i); + p = widget->palette(); p.setColor(widget->backgroundRole(), c); widget->setPalette(p); + } + } +} + +void AmbientProperties::on_buttonForeground_clicked() +{ + QColor c = QColorDialog::getColor(foreSample->palette().color(foreSample->backgroundRole()), this); + QPalette p = foreSample->palette(); p.setColor(foreSample->backgroundRole(), c); foreSample->setPalette(p); + p = container->palette(); p.setColor(container->foregroundRole(), c); container->setPalette(p); + + if (QWorkspace *ws = qobject_cast<QWorkspace*>(container)) { + QWidgetList list( ws->windowList() ); + for (int i = 0; i < list.count(); ++i) { + QWidget *widget = list.at(i); + p = widget->palette(); p.setColor(widget->foregroundRole(), c); widget->setPalette(p); + } + } +} + +void AmbientProperties::on_buttonFont_clicked() +{ + bool ok; + QFont f = QFontDialog::getFont( &ok, fontSample->font(), this ); + if ( !ok ) + return; + fontSample->setFont( f ); + container->setFont( f ); + + if (QWorkspace *ws = qobject_cast<QWorkspace*>(container)) { + QWidgetList list( ws->windowList() ); + for (int i = 0; i < list.count(); ++i) { + QWidget *widget = list.at(i); + widget->setFont( f ); + } + } +} + +void AmbientProperties::on_buttonEnabled_toggled(bool on) +{ + enabledSample->setEnabled( on ); + container->setEnabled( on ); +} + +QT_END_NAMESPACE diff --git a/tools/activeqt/testcon/ambientproperties.h b/tools/activeqt/testcon/ambientproperties.h new file mode 100644 index 0000000..fa15158 --- /dev/null +++ b/tools/activeqt/testcon/ambientproperties.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AMBIENTPROPERTIES_H +#define AMBIENTPROPERTIES_H + +#include <QtCore/qglobal.h> + +#include "ui_ambientproperties.h" + +QT_BEGIN_NAMESPACE + +class AmbientProperties : public QDialog, Ui::AmbientProperties +{ + Q_OBJECT +public: + AmbientProperties(QWidget *parent); + + void setControl(QWidget *widget); + +public slots: + void on_buttonBackground_clicked(); + void on_buttonForeground_clicked(); + void on_buttonFont_clicked(); + void on_buttonEnabled_toggled(bool on); + +private: + QWidget *container; +}; + +QT_END_NAMESPACE + +#endif // AMBIENTPROPERTIES_H diff --git a/tools/activeqt/testcon/ambientproperties.ui b/tools/activeqt/testcon/ambientproperties.ui new file mode 100644 index 0000000..5c68825 --- /dev/null +++ b/tools/activeqt/testcon/ambientproperties.ui @@ -0,0 +1,299 @@ +<ui version="4.0" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>AmbientProperties</class> + <widget class="QDialog" name="AmbientProperties" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>185</width> + <height>173</height> + </rect> + </property> + <property name="windowTitle" > + <string>Change Ambient Properties</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QGroupBox" name="boxProperties" > + <property name="title" > + <string>&Properties</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="TextLabel1" > + <property name="text" > + <string>Background:</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="TextLabel2" > + <property name="text" > + <string>Foreground:</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="TextLabel3" > + <property name="text" > + <string>Font:</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="TextLabel4" > + <property name="text" > + <string>Enabled:</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QFrame" name="foreSample" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QFrame" name="backSample" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item row="0" column="2" > + <widget class="QToolButton" name="buttonBackground" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>...</string> + </property> + </widget> + </item> + <item row="1" column="2" > + <widget class="QToolButton" name="buttonForeground" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>...</string> + </property> + </widget> + </item> + <item row="2" column="2" > + <widget class="QToolButton" name="buttonFont" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>...</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QFrame" name="Frame6" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item> + <widget class="QLabel" name="enabledSample" > + <property name="enabled" > + <bool>true</bool> + </property> + <property name="text" > + <string><sample></string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="2" > + <widget class="QToolButton" name="buttonEnabled" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>...</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QFrame" name="fontSample" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="TextLabel6" > + <property name="text" > + <string><sample></string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>1</width> + <height>1</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="buttonClose" > + <property name="text" > + <string>C&lose</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>buttonClose</sender> + <signal>clicked()</signal> + <receiver>AmbientProperties</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>141</x> + <y>150</y> + </hint> + <hint type="destinationlabel" > + <x>51</x> + <y>141</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/activeqt/testcon/changeproperties.cpp b/tools/activeqt/testcon/changeproperties.cpp new file mode 100644 index 0000000..64387cc --- /dev/null +++ b/tools/activeqt/testcon/changeproperties.cpp @@ -0,0 +1,286 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "changeproperties.h" + +#include <QtGui> +#include <qt_windows.h> +#include <ActiveQt/ActiveQt> + +QT_BEGIN_NAMESPACE + +ChangeProperties::ChangeProperties(QWidget *parent) +: QDialog(parent), activex(0) +{ + setupUi(this); + + listProperties->setColumnCount(3); + listProperties->headerItem()->setText(0, QLatin1String("Name")); + listProperties->headerItem()->setText(1, QLatin1String("Type")); + listProperties->headerItem()->setText(2, QLatin1String("Value")); + + listEditRequests->setColumnCount(1); + listEditRequests->headerItem()->setText(0, QLatin1String("Name")); +} + +void ChangeProperties::setControl(QAxWidget *ax) +{ + activex = ax; + updateProperties(); +} + +void ChangeProperties::on_listProperties_currentItemChanged(QTreeWidgetItem *current) +{ + editValue->setEnabled(current != 0); + buttonSet->setEnabled(current != 0); + valueLabel->setEnabled(current != 0); + + if (!current) + return; + + editValue->setText(current->text(2)); + QString prop = current->text(0); + valueLabel->setText(prop + QLatin1String(" =")); + + const QMetaObject *mo = activex->metaObject(); + const QMetaProperty property = mo->property(mo->indexOfProperty(prop.toLatin1())); + + valueLabel->setEnabled(property.isWritable()); + editValue->setEnabled(property.isWritable()); + buttonSet->setEnabled(property.isWritable()); +} + +void ChangeProperties::on_buttonSet_clicked() +{ + QTreeWidgetItem *item = listProperties->currentItem(); + if (!item) + return; + + QString prop = item->text(0); + QVariant value = activex->property(prop.toLatin1()); + QVariant::Type type = value.type(); + if (!value.isValid()) { + const QMetaObject *mo = activex->metaObject(); + const QMetaProperty property = mo->property(mo->indexOfProperty(prop.toLatin1())); + type = QVariant::nameToType(property.typeName()); + } + switch (type) { + case QVariant::Color: + { + QColor col; + col.setNamedColor(editValue->text()); + if (col.isValid()) { + value = qVariantFromValue(col); + } else { + QMessageBox::warning(this, tr("Can't parse input"), + QString(tr("Failed to create a color from %1\n" + "The string has to be a valid color name (e.g. 'red')\n" + "or a RGB triple of format '#rrggbb'." + ).arg(editValue->text()))); + } + } + break; + case QVariant::Font: + { + QFont fnt; + if (fnt.fromString(editValue->text())) { + value = qVariantFromValue(fnt); + } else { + QMessageBox::warning(this, tr("Can't parse input"), + (tr("Failed to create a font from %1\n" + "The string has to have a format family,<point size> or\n" + "family,pointsize,stylehint,weight,italic,underline,strikeout,fixedpitch,rawmode." + ).arg(editValue->text()))); + } + } + break; + case QVariant::Pixmap: + { + QString fileName = editValue->text(); + if (fileName.isEmpty()) + fileName = QFileDialog::getOpenFileName(this); + QPixmap pm(fileName); + if (pm.isNull()) + return; + + value = qVariantFromValue(pm); + } + break; + case QVariant::Bool: + { + QString txt = editValue->text().toLower(); + value = QVariant(txt != QLatin1String("0") && txt != QLatin1String("false")); + } + break; + case QVariant::List: + { + QStringList txtList = editValue->text().split(QRegExp(QLatin1String("[,;]"))); + QList<QVariant> varList; + for (int i = 0; i < txtList.count(); ++i) { + QVariant svar(txtList.at(i)); + QString str = svar.toString(); + str = str.trimmed(); + bool ok; + int n = str.toInt(&ok); + if (ok) { + varList << n; + continue; + } + double d = str.toDouble(&ok); + if (ok) { + varList << d; + continue; + } + varList << str; + } + value = varList; + } + break; + + default: + value = editValue->text(); + break; + } + + Q_ASSERT(activex->setProperty(prop.toLatin1(), value)); + updateProperties(); + listProperties->setCurrentItem(listProperties->findItems(prop, Qt::MatchExactly).at(0)); +} + +void ChangeProperties::on_listEditRequests_itemChanged(QTreeWidgetItem *item) +{ + if (!item) + return; + + QString property = item->text(0); + activex->setPropertyWritable(property.toLatin1(), item->checkState(0) == Qt::Checked); +} + + +void ChangeProperties::updateProperties() +{ + bool hasControl = activex && !activex->isNull(); + tabWidget->setEnabled(hasControl); + + listProperties->clear(); + listEditRequests->clear(); + if (hasControl) { + const QMetaObject *mo = activex->metaObject(); + const int numprops = mo->propertyCount(); + for (int i = mo->propertyOffset(); i < numprops; ++i) { + const QMetaProperty property = mo->property(i); + QTreeWidgetItem *item = new QTreeWidgetItem(listProperties); + item->setText(0, QString::fromLatin1(property.name())); + item->setText(1, QString::fromLatin1(property.typeName())); + if (!property.isDesignable()) { + item->setTextColor(0, Qt::gray); + item->setTextColor(1, Qt::gray); + item->setTextColor(2, Qt::gray); + } + QVariant var = activex->property(property.name()); + + switch (var.type()) { + case QVariant::Color: + { + QColor col = qvariant_cast<QColor>(var); + item->setText(2, col.name()); + } + break; + case QVariant::Font: + { + QFont fnt = qvariant_cast<QFont>(var); + item->setText(2, fnt.toString()); + } + break; + case QVariant::Bool: + { + item->setText(2, var.toBool() ? QLatin1String("true") : QLatin1String("false")); + } + break; + case QVariant::Pixmap: + { + QPixmap pm = qvariant_cast<QPixmap>(var); + item->setIcon(2, pm); + } + break; + case QVariant::List: + { + QList<QVariant> varList = var.toList(); + QStringList strList; + for (int i = 0; i < varList.count(); ++i) { + QVariant var = varList.at(i); + strList << var.toString(); + } + item->setText(2, strList.join(QLatin1String(", "))); + } + break; + case QVariant::Int: + if (property.isEnumType()) { + const QMetaEnum enumerator = mo->enumerator(mo->indexOfEnumerator(property.typeName())); + item->setText(2, QString::fromLatin1(enumerator.valueToKey(var.toInt()))); + break; + } + //FALLTHROUGH + default: + item->setText(2, var.toString()); + break; + } + + bool requesting = false; +#if 0 + { + void *argv[] = { &requesting }; + activex->qt_metacall(QMetaObject::Call(0x10000000) /*RequestingEdit*/, i, argv); + } +#endif + if (requesting) { + QTreeWidgetItem *check = new QTreeWidgetItem(listEditRequests); + check->setText(0, QString::fromLatin1(property.name())); + check->setCheckState(0, activex->propertyWritable(property.name()) ? Qt::Checked : Qt::Unchecked); + } + } + listProperties->setCurrentItem(listProperties->topLevelItem(0)); + } else { + editValue->clear(); + } +} + +QT_END_NAMESPACE diff --git a/tools/activeqt/testcon/changeproperties.h b/tools/activeqt/testcon/changeproperties.h new file mode 100644 index 0000000..5bb053a --- /dev/null +++ b/tools/activeqt/testcon/changeproperties.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHANGEPROPERTIES_H +#define CHANGEPROPERTIES_H + +#include <QtCore/qglobal.h> +#include "ui_changeproperties.h" + +QT_BEGIN_NAMESPACE + +class QAxWidget; + +class ChangeProperties : public QDialog, Ui::ChangeProperties +{ + Q_OBJECT +public: + ChangeProperties(QWidget *parent); + + void setControl(QAxWidget *control); + +public slots: + void updateProperties(); + +protected slots: + void on_listProperties_currentItemChanged(QTreeWidgetItem *current); + void on_listEditRequests_itemChanged(QTreeWidgetItem *item); + void on_buttonSet_clicked(); + +private: + QAxWidget *activex; +}; + +QT_END_NAMESPACE + +#endif // CHANGEPROPERTIES_H diff --git a/tools/activeqt/testcon/changeproperties.ui b/tools/activeqt/testcon/changeproperties.ui new file mode 100644 index 0000000..2714b99 --- /dev/null +++ b/tools/activeqt/testcon/changeproperties.ui @@ -0,0 +1,211 @@ +<ui version="4.0" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>ChangeProperties</class> + <widget class="QDialog" name="ChangeProperties" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>728</width> + <height>584</height> + </rect> + </property> + <property name="windowTitle" > + <string>Change Control Properties</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTabWidget" name="tabWidget" > + <widget class="QWidget" name="propertiesTab" > + <attribute name="title" > + <string>&Properties</string> + </attribute> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTreeWidget" name="listProperties" > + <property name="rootIsDecorated" > + <bool>false</bool> + </property> + <column> + <property name="text" > + <string>Property</string> + </property> + </column> + <column> + <property name="text" > + <string>Type</string> + </property> + </column> + <column> + <property name="text" > + <string>Value</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="valueLabel" > + <property name="text" > + <string>Property &Value:</string> + </property> + <property name="buddy" > + <cstring>editValue</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="editValue" /> + </item> + <item> + <widget class="QToolButton" name="buttonSet" > + <property name="text" > + <string>&Set</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="requestTab" > + <attribute name="title" > + <string>Property Edit &Requests</string> + </attribute> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTreeWidget" name="listEditRequests" > + <column> + <property name="text" > + <string>Property</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>1</width> + <height>1</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="buttonClose" > + <property name="text" > + <string>C&lose</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>buttonClose</sender> + <signal>clicked()</signal> + <receiver>ChangeProperties</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>669</x> + <y>558</y> + </hint> + <hint type="destinationlabel" > + <x>566</x> + <y>551</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/activeqt/testcon/controlinfo.cpp b/tools/activeqt/testcon/controlinfo.cpp new file mode 100644 index 0000000..8c76448 --- /dev/null +++ b/tools/activeqt/testcon/controlinfo.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "controlinfo.h" + +#include <QtGui> + +QT_BEGIN_NAMESPACE + +ControlInfo::ControlInfo(QWidget *parent) + : QDialog(parent) +{ + setupUi(this); + + listInfo->setColumnCount(2); + listInfo->headerItem()->setText(0, tr("Item")); + listInfo->headerItem()->setText(1, tr("Details")); +} + +void ControlInfo::setControl(QWidget *activex) +{ + listInfo->clear(); + + const QMetaObject *mo = activex->metaObject(); + QTreeWidgetItem *group = new QTreeWidgetItem(listInfo); + group->setText(0, tr("Class Info")); + group->setText(1, QString::number(mo->classInfoCount())); + + QTreeWidgetItem *item = 0; + int i; + int count; + for (i = mo->classInfoOffset(); i < mo->classInfoCount(); ++i) { + const QMetaClassInfo info = mo->classInfo(i); + item = new QTreeWidgetItem(group); + item->setText(0, QString::fromLatin1(info.name())); + item->setText(1, QString::fromLatin1(info.value())); + } + group = new QTreeWidgetItem(listInfo); + group->setText(0, tr("Signals")); + + count = 0; + for (i = mo->methodOffset(); i < mo->methodCount(); ++i) { + const QMetaMethod method = mo->method(i); + if (method.methodType() == QMetaMethod::Signal) { + ++count; + item = new QTreeWidgetItem(group); + item->setText(0, QString::fromLatin1(method.signature())); + } + } + group->setText(1, QString::number(count)); + + group = new QTreeWidgetItem(listInfo); + group->setText(0, tr("Slots")); + + count = 0; + for (i = mo->methodOffset(); i < mo->methodCount(); ++i) { + const QMetaMethod method = mo->method(i); + if (method.methodType() == QMetaMethod::Slot) { + ++count; + item = new QTreeWidgetItem(group); + item->setText(0, QString::fromLatin1(method.signature())); + } + } + group->setText(1, QString::number(count)); + + group = new QTreeWidgetItem(listInfo); + group->setText(0, tr("Properties")); + + count = 0; + for (i = mo->propertyOffset(); i < mo->propertyCount(); ++i) { + ++count; + const QMetaProperty property = mo->property(i); + item = new QTreeWidgetItem(group); + item->setText(0, QString::fromLatin1(property.name())); + item->setText(1, QString::fromLatin1(property.typeName())); + if (!property.isDesignable()) { + item->setTextColor(0, Qt::gray); + item->setTextColor(1, Qt::gray); + } + } + group->setText(1, QString::number(count)); +} + +QT_END_NAMESPACE diff --git a/tools/activeqt/testcon/controlinfo.h b/tools/activeqt/testcon/controlinfo.h new file mode 100644 index 0000000..11235bb --- /dev/null +++ b/tools/activeqt/testcon/controlinfo.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CONTROLINFO_H +#define CONTROLINFO_H + +#include <QtCore/qglobal.h> +#include "ui_controlinfo.h" + +QT_BEGIN_NAMESPACE + +class ControlInfo : public QDialog, Ui::ControlInfo +{ + Q_OBJECT +public: + ControlInfo(QWidget *parent); + + void setControl(QWidget *activex); +}; + +QT_END_NAMESPACE + +#endif // CONTROLINFO_H diff --git a/tools/activeqt/testcon/controlinfo.ui b/tools/activeqt/testcon/controlinfo.ui new file mode 100644 index 0000000..3aeaf58 --- /dev/null +++ b/tools/activeqt/testcon/controlinfo.ui @@ -0,0 +1,134 @@ +<ui version="4.0" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>ControlInfo</class> + <widget class="QDialog" name="ControlInfo" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="windowTitle" > + <string>Control Details</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTreeWidget" name="listInfo" > + <column> + <property name="text" > + <string>Item</string> + </property> + </column> + <column> + <property name="text" > + <string>Value</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>1</width> + <height>1</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="buttonClose" > + <property name="text" > + <string>C&lose</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>buttonClose</sender> + <signal>clicked()</signal> + <receiver>ControlInfo</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>536</x> + <y>457</y> + </hint> + <hint type="destinationlabel" > + <x>428</x> + <y>449</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/activeqt/testcon/docuwindow.cpp b/tools/activeqt/testcon/docuwindow.cpp new file mode 100644 index 0000000..b0b2d81 --- /dev/null +++ b/tools/activeqt/testcon/docuwindow.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "docuwindow.h" +#include <QTextBrowser> +#include <QTextDocument> +#include <QToolBar> +#include <QToolButton> +#include <QFileDialog> +#include <QFile> +#include <QStatusBar> +#include <QPrinter> +#include <QPainter> +#include <QPrintDialog> +#include <QTextStream> + +QT_BEGIN_NAMESPACE + +static const char *filesave[] = { +" 14 14 4 1", +". c #040404", +"# c #808304", +"a c #bfc2bf", +"b c None", +"..............", +".#.aaaaaaaa.a.", +".#.aaaaaaaa...", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".##........##.", +".############.", +".##.........#.", +".##......aa.#.", +".##......aa.#.", +".##......aa.#.", +"b............." +}; + +static const char *fileprint[] = { +" 16 14 6 1", +". c #000000", +"# c #848284", +"a c #c6c3c6", +"b c #ffff00", +"c c #ffffff", +"d c None", +"ddddd.........dd", +"dddd.cccccccc.dd", +"dddd.c.....c.ddd", +"ddd.cccccccc.ddd", +"ddd.c.....c....d", +"dd.cccccccc.a.a.", +"d..........a.a..", +".aaaaaaaaaa.a.a.", +".............aa.", +".aaaaaa###aa.a.d", +".aaaaaabbbaa...d", +".............a.d", +"d.aaaaaaaaa.a.dd", +"dd...........ddd" +}; + + +DocuWindow::DocuWindow(const QString& docu, QWidget *parent, QWidget *source) + : QMainWindow(parent) +{ + setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("%1 - Documentation").arg(source->windowTitle())); + + browser = new QTextBrowser(this); + browser->setHtml(docu); + + setCentralWidget(browser); + + QToolBar *fileTools = new QToolBar(tr("File Operations"), this); + fileTools->addAction(QPixmap(filesave), tr("Save File"), this, SLOT(save())); + fileTools->addAction(QPixmap(fileprint), tr("Print"), this, SLOT(print())); + + addToolBar(fileTools); + statusBar(); +} + +void DocuWindow::save() +{ + QString filename = QFileDialog::getSaveFileName(this); + + if (filename.isEmpty()) + return; + + QString text = browser->document()->toHtml(); + QFile f(filename); + if (!f.open(QIODevice::WriteOnly)) { + statusBar()->showMessage(tr("Could not write to %1").arg(filename), 2000); + return; + } + + QTextStream t(&f); + t << text; + f.close(); + + statusBar()->showMessage(tr("File %1 saved").arg(filename), 2000); +} + +void DocuWindow::print() +{ + QPrinter printer; + if (printer.printerName().isEmpty()) { + statusBar()->showMessage(tr("No printer installed"), 2000); + return; + } + + QPrintDialog printDialog(&printer, this); + if (!printDialog.exec()) { + statusBar()->showMessage(tr("Printing aborted"), 2000); + return; + } + + browser->document()->print(&printer); +} + +QT_END_NAMESPACE diff --git a/tools/activeqt/testcon/docuwindow.h b/tools/activeqt/testcon/docuwindow.h new file mode 100644 index 0000000..99d0286 --- /dev/null +++ b/tools/activeqt/testcon/docuwindow.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DOCUWINDOW_H +#define DOCUWINDOW_H + +#include <QMainWindow> + +QT_BEGIN_NAMESPACE + +class QTextBrowser; + +class DocuWindow : public QMainWindow +{ + Q_OBJECT +public: + DocuWindow( const QString& docu, QWidget *parent, QWidget *source ); + +public slots: + void save(); + void print(); + +private: + QTextBrowser *browser; +}; + +QT_END_NAMESPACE + +#endif // DOCUWINDOW_H diff --git a/tools/activeqt/testcon/invokemethod.cpp b/tools/activeqt/testcon/invokemethod.cpp new file mode 100644 index 0000000..7319adc --- /dev/null +++ b/tools/activeqt/testcon/invokemethod.cpp @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "invokemethod.h" + +#include <qt_windows.h> +#include <ActiveQt/ActiveQt> + +QT_BEGIN_NAMESPACE + +InvokeMethod::InvokeMethod(QWidget *parent) +: QDialog(parent), activex(0) +{ + setupUi(this); + + listParameters->setColumnCount(3); + listParameters->headerItem()->setText(0, tr("Parameter")); + listParameters->headerItem()->setText(1, tr("Type")); + listParameters->headerItem()->setText(2, tr("Value")); +} + +void InvokeMethod::setControl(QAxBase *ax) +{ + activex = ax; + bool hasControl = activex && !activex->isNull(); + labelMethods->setEnabled(hasControl); + comboMethods->setEnabled(hasControl); + buttonInvoke->setEnabled(hasControl); + boxParameters->setEnabled(hasControl); + + comboMethods->clear(); + listParameters->clear(); + + if (!hasControl) { + editValue->clear(); + return; + } + + const QMetaObject *mo = activex->metaObject(); + if (mo->methodCount()) { + for (int i = mo->methodOffset(); i < mo->methodCount(); ++i) { + const QMetaMethod method = mo->method(i); + if (method.methodType() == QMetaMethod::Slot) + comboMethods->addItem(QString::fromLatin1(method.signature())); + } + comboMethods->model()->sort(0); + + on_comboMethods_activated(comboMethods->currentText()); + } +} + +void InvokeMethod::on_buttonInvoke_clicked() +{ + if (!activex) + return; + + on_buttonSet_clicked(); + QString method = comboMethods->currentText(); + QList<QVariant> vars; + + int itemCount = listParameters->topLevelItemCount(); + for (int i = 0; i < itemCount; ++i) { + QTreeWidgetItem *parameter = listParameters->topLevelItem(i); + vars << parameter->text(2); + } + QVariant result = activex->dynamicCall(method.toLatin1(), vars); + + int v = 0; + for (int i = 0; i < itemCount; ++i) { + QTreeWidgetItem *parameter = listParameters->topLevelItem(i); + parameter->setText(2, vars[v++].toString()); + } + + QString resString = result.toString(); + QString resType = QString::fromLatin1(result.typeName()); + editReturn->setText(resType + QLatin1String(" ") + resString); +} + +void InvokeMethod::on_comboMethods_activated(const QString &method) +{ + if (!activex) + return; + listParameters->clear(); + + const QMetaObject *mo = activex->metaObject(); + const QMetaMethod slot = mo->method(mo->indexOfSlot(method.toLatin1())); + QString signature = QString::fromLatin1(slot.signature()); + signature = signature.mid(signature.indexOf(QLatin1Char('(')) + 1); + signature.truncate(signature.length()-1); + + QList<QByteArray> pnames = slot.parameterNames(); + QList<QByteArray> ptypes = slot.parameterTypes(); + + for (int p = 0; p < ptypes.count(); ++p) { + QString ptype(QString::fromLatin1(ptypes.at(p))); + if (ptype.isEmpty()) + continue; + QString pname(QString::fromLatin1(pnames.at(p).constData())); + if (pname.isEmpty()) + pname = QString::fromLatin1("<unnamed %1>").arg(p); + QTreeWidgetItem *item = new QTreeWidgetItem(listParameters); + item->setText(0, pname); + item->setText(1, ptype); + } + + if (listParameters->topLevelItemCount()) + listParameters->setCurrentItem(listParameters->topLevelItem(0)); + editReturn->setText(QString::fromLatin1(slot.typeName())); +} + +void InvokeMethod::on_listParameters_currentItemChanged(QTreeWidgetItem *item) +{ + if (!activex) + return; + editValue->setEnabled(item != 0); + buttonSet->setEnabled(item != 0); + if (!item) + return; + editValue->setText(item->text(2)); +} + +void InvokeMethod::on_buttonSet_clicked() +{ + if (!activex) + return; + QTreeWidgetItem *item = listParameters->currentItem(); + if (!item) + return; + item->setText(2, editValue->text()); +} + +QT_END_NAMESPACE diff --git a/tools/activeqt/testcon/invokemethod.h b/tools/activeqt/testcon/invokemethod.h new file mode 100644 index 0000000..c374bad --- /dev/null +++ b/tools/activeqt/testcon/invokemethod.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef INVOKEMETHOD_H +#define INVOKEMETHOD_H + +#include <QtCore/qglobal.h> +#include "ui_invokemethod.h" + +QT_BEGIN_NAMESPACE + +class QAxBase; + +class InvokeMethod : public QDialog, Ui::InvokeMethod +{ + Q_OBJECT +public: + InvokeMethod(QWidget *parent); + + void setControl(QAxBase *ax); + +protected slots: + void on_buttonInvoke_clicked(); + void on_buttonSet_clicked(); + + void on_comboMethods_activated(const QString &method); + void on_listParameters_currentItemChanged(QTreeWidgetItem *item); + +private: + QAxBase *activex; +}; + +QT_END_NAMESPACE + +#endif // INVOKEMETHOD_H diff --git a/tools/activeqt/testcon/invokemethod.ui b/tools/activeqt/testcon/invokemethod.ui new file mode 100644 index 0000000..c92ab0c --- /dev/null +++ b/tools/activeqt/testcon/invokemethod.ui @@ -0,0 +1,270 @@ +<ui version="4.0" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>InvokeMethod</class> + <widget class="QDialog" name="InvokeMethod" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>503</width> + <height>416</height> + </rect> + </property> + <property name="windowTitle" > + <string>Invoke Methods</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="1" column="0" colspan="2" > + <widget class="QGroupBox" name="boxParameters" > + <property name="title" > + <string>&Parameter List</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" colspan="3" > + <widget class="QTreeWidget" name="listParameters" > + <property name="rootIsDecorated" > + <bool>false</bool> + </property> + <column> + <property name="text" > + <string>Parameter</string> + </property> + </column> + <column> + <property name="text" > + <string>Type</string> + </property> + </column> + <column> + <property name="text" > + <string>Value</string> + </property> + </column> + </widget> + </item> + <item row="1" column="2" > + <widget class="QToolButton" name="buttonSet" > + <property name="text" > + <string>&Set</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="editValue" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="TextLabel3" > + <property name="text" > + <string>Parameter &Value:</string> + </property> + <property name="buddy" > + <cstring>editValue</cstring> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="0" colspan="2" > + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="1" column="1" > + <widget class="QLineEdit" name="editReturn" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QComboBox" name="comboMethods" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable" > + <bool>true</bool> + </property> + <property name="insertPolicy" > + <enum>QComboBox::NoInsert</enum> + </property> + <property name="autoCompletion" > + <bool>true</bool> + </property> + <property name="duplicatesEnabled" > + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="labelMethods" > + <property name="text" > + <string>&Method Name:</string> + </property> + <property name="buddy" > + <cstring>comboMethods</cstring> + </property> + </widget> + </item> + <item row="0" column="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="TextLabel1" > + <property name="text" > + <string>Returned Value:</string> + </property> + </widget> + </item> + <item row="0" column="3" > + <widget class="QPushButton" name="buttonInvoke" > + <property name="text" > + <string>&Invoke</string> + </property> + <property name="default" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="2" colspan="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>111</width> + <height>21</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="0" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>361</width> + <height>21</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1" > + <widget class="QPushButton" name="buttonClose" > + <property name="text" > + <string>C&lose</string> + </property> + <property name="autoDefault" > + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>buttonClose</sender> + <signal>clicked()</signal> + <receiver>InvokeMethod</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>453</x> + <y>396</y> + </hint> + <hint type="destinationlabel" > + <x>327</x> + <y>384</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/activeqt/testcon/main.cpp b/tools/activeqt/testcon/main.cpp new file mode 100644 index 0000000..1800fcb --- /dev/null +++ b/tools/activeqt/testcon/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" + +#include <QApplication> +#include <QAxFactory> + +QAXFACTORY_DEFAULT(MainWindow, + QLatin1String("{5f5ce700-48a8-47b1-9b06-3b7f79e41d7c}"), + QLatin1String("{3fc86f5f-8b15-4428-8f6b-482bae91f1ae}"), + QLatin1String("{02a268cd-24b4-4fd9-88ff-b01b683ef39d}"), + QLatin1String("{4a43e44d-9d1d-47e5-a1e5-58fe6f7be0a4}"), + QLatin1String("{16ee5998-77d2-412f-ad91-8596e29f123f}")) + +QT_USE_NAMESPACE + +int main( int argc, char **argv ) +{ + QApplication app( argc, argv ); + + MainWindow mw; + mw.show(); + + return app.exec();; +} diff --git a/tools/activeqt/testcon/mainwindow.cpp b/tools/activeqt/testcon/mainwindow.cpp new file mode 100644 index 0000000..15f9d4c --- /dev/null +++ b/tools/activeqt/testcon/mainwindow.cpp @@ -0,0 +1,461 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include "changeproperties.h" +#include "invokemethod.h" +#include "ambientproperties.h" +#include "controlinfo.h" +#include "docuwindow.h" + +#include <QtGui> +#include <qt_windows.h> +#include <ActiveQt/ActiveQt> + +QT_BEGIN_NAMESPACE + +QAxObject *ax_mainWindow = 0; + +static QTextEdit *debuglog = 0; + +static void redirectDebugOutput(QtMsgType type, const char*msg) +{ + Q_UNUSED(type); + debuglog->append(QLatin1String(msg)); +} + +QT_END_NAMESPACE + +QT_USE_NAMESPACE + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + setupUi(this); + setObjectName(QLatin1String("MainWindow")); + + QAxScriptManager::registerEngine(QLatin1String("PerlScript"), QLatin1String(".pl")); + QAxScriptManager::registerEngine(QLatin1String("Python"), QLatin1String(".py")); + + dlgInvoke = 0; + dlgProperties = 0; + dlgAmbient = 0; + scripts = 0; + debuglog = logDebug; + oldDebugHandler = qInstallMsgHandler(redirectDebugOutput); + QHBoxLayout *layout = new QHBoxLayout(Workbase); + workspace = new QWorkspace(Workbase); + layout->addWidget(workspace); + layout->setMargin(0); + + connect(workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateGUI())); + connect(actionFileExit, SIGNAL(triggered()), qApp, SLOT(quit())); +} + +MainWindow::~MainWindow() +{ + qInstallMsgHandler(oldDebugHandler); + debuglog = 0; +} + + +void MainWindow::on_actionFileNew_triggered() +{ + QAxSelect select(this); + if (select.exec()) { + QAxWidget *container = new QAxWidget(workspace); + container->setAttribute(Qt::WA_DeleteOnClose); + container->setControl(select.clsid()); + container->setObjectName(container->windowTitle()); + workspace->addWindow(container); + container->show(); + } + updateGUI(); +} + +void MainWindow::on_actionFileLoad_triggered() +{ + QString fname = QFileDialog::getOpenFileName(this, tr("Load"), QString(), QLatin1String("*.qax")); + if (fname.isEmpty()) + return; + + QFile file(fname); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::information(this, tr("Error Loading File"), tr("The file could not be opened for reading.\n%1").arg(fname)); + return; + } + + QAxWidget *container = new QAxWidget(workspace); + workspace->addWindow(container); + + QDataStream d(&file); + d >> *container; + + container->setObjectName(container->windowTitle()); + container->show(); + + updateGUI(); +} + +void MainWindow::on_actionFileSave_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QString fname = QFileDialog::getSaveFileName(this, tr("Save"), QString(), QLatin1String("*.qax")); + if (fname.isEmpty()) + return; + + QFile file(fname); + if (!file.open(QIODevice::WriteOnly)) { + QMessageBox::information(this, tr("Error Saving File"), tr("The file could not be opened for writing.\n%1").arg(fname)); + return; + } + QDataStream d(&file); + d << *container; +} + + +void MainWindow::on_actionContainerSet_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QAxSelect select(this); + if (select.exec()) + container->setControl(select.clsid()); + updateGUI(); +} + +void MainWindow::on_actionContainerClear_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (container) + container->clear(); + updateGUI(); +} + +void MainWindow::on_actionContainerProperties_triggered() +{ + if (!dlgAmbient) { + dlgAmbient = new AmbientProperties(this); + dlgAmbient->setControl(workspace); + } + dlgAmbient->show(); +} + + +void MainWindow::on_actionControlInfo_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + ControlInfo info(this); + info.setControl(container); + info.exec(); +} + +void MainWindow::on_actionControlProperties_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + if (!dlgProperties) { + dlgProperties = new ChangeProperties(this); + connect(container, SIGNAL(propertyChanged(const QString&)), dlgProperties, SLOT(updateProperties())); + } + dlgProperties->setControl(container); + dlgProperties->show(); +} + +void MainWindow::on_actionControlMethods_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + if (!dlgInvoke) + dlgInvoke = new InvokeMethod(this); + dlgInvoke->setControl(container); + dlgInvoke->show(); +} + +void MainWindow::on_VerbMenu_aboutToShow() +{ + VerbMenu->clear(); + + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QStringList verbs = container->verbs(); + for (int i = 0; i < verbs.count(); ++i) { + VerbMenu->addAction(verbs.at(i)); + } + + if (!verbs.count()) { // no verbs? + VerbMenu->addAction(tr("-- Object does not support any verbs --"))->setEnabled(false); + } +} + +void MainWindow::on_VerbMenu_triggered(QAction *action) +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + container->doVerb(action->text()); +} + +void MainWindow::on_actionControlDocumentation_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QString docu = container->generateDocumentation(); + if (docu.isEmpty()) + return; + + DocuWindow *docwindow = new DocuWindow(docu, workspace, container); + workspace->addWindow(docwindow); + docwindow->show(); +} + + +void MainWindow::on_actionControlPixmap_triggered() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QPixmap pm = QPixmap::grabWidget(container); + + QLabel *label = new QLabel(workspace); + label->setAttribute(Qt::WA_DeleteOnClose); + label->setPixmap(pm); + label->setWindowTitle(tr("%1 - Pixmap").arg(container->windowTitle())); + + workspace->addWindow(label); + label->show(); +} + +void MainWindow::on_actionScriptingRun_triggered() +{ +#ifndef QT_NO_QAXSCRIPT + if (!scripts) + return; + + // If we have only one script loaded we can use the cool dialog + QStringList scriptList = scripts->scriptNames(); + if (scriptList.count() == 1) { + InvokeMethod scriptInvoke(this); + scriptInvoke.setWindowTitle(tr("Execute Script Function")); + scriptInvoke.setControl(scripts->script(scriptList[0])->scriptEngine()); + scriptInvoke.exec(); + return; + } + + bool ok = false; + QStringList macroList = scripts->functions(QAxScript::FunctionNames); + QString macro = QInputDialog::getItem(this, tr("Select Macro"), tr("Macro:"), macroList, 0, true, &ok); + + if (!ok) + return; + + QVariant result = scripts->call(macro); + if (result.isValid()) + logMacros->append(tr("Return value of %1: %2").arg(macro).arg(result.toString())); +#endif +} + +void MainWindow::on_actionScriptingLoad_triggered() +{ +#ifndef QT_NO_QAXSCRIPT + QString file = QFileDialog::getOpenFileName(this, tr("Open Script"), QString(), QAxScriptManager::scriptFileFilter()); + + if (file.isEmpty()) + return; + + if (!scripts) { + scripts = new QAxScriptManager(this); + scripts->addObject(this); + } + + QWidgetList widgets = workspace->windowList(); + QWidgetList::Iterator it(widgets.begin()); + while (it != widgets.end()) { + QAxBase *ax = (QAxBase*)(*it)->qt_metacast("QAxBase"); + ++it; + if (!ax) + continue; + scripts->addObject(ax); + } + + QAxScript *script = scripts->load(file, file); + if (script) { + connect(script, SIGNAL(error(int, const QString&, int, const QString&)), + this, SLOT(logMacro(int, const QString&, int, const QString&))); + actionScriptingRun->setEnabled(true); + } +#else + QMessageBox::information(this, tr("Function not available"), + tr("QAxScript functionality is not available with this compiler.")); +#endif +} + +void MainWindow::updateGUI() +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + + bool hasControl = container && !container->isNull(); + actionFileNew->setEnabled(true); + actionFileLoad->setEnabled(true); + actionFileSave->setEnabled(hasControl); + actionContainerSet->setEnabled(container != 0); + actionContainerClear->setEnabled(hasControl); + actionControlProperties->setEnabled(hasControl); + actionControlMethods->setEnabled(hasControl); + actionControlInfo->setEnabled(hasControl); + actionControlDocumentation->setEnabled(hasControl); + actionControlPixmap->setEnabled(hasControl); + VerbMenu->setEnabled(hasControl); + if (dlgInvoke) + dlgInvoke->setControl(hasControl ? container : 0); + if (dlgProperties) + dlgProperties->setControl(hasControl ? container : 0); + + QWidgetList list = workspace->windowList(); + QWidgetList::Iterator it = list.begin(); + while (it != list.end()) { + QWidget *container = *it; + + QAxWidget *ax = qobject_cast<QAxWidget*>(container); + if (ax) { + container->disconnect(SIGNAL(signal(const QString&, int, void*))); + if (actionLogSignals->isChecked()) + connect(container, SIGNAL(signal(const QString&, int, void*)), this, SLOT(logSignal(const QString&, int, void*))); + + container->disconnect(SIGNAL(exception(int,const QString&,const QString&,const QString&))); + connect(container, SIGNAL(exception(int,const QString&,const QString&,const QString&)), + this, SLOT(logException(int,const QString&,const QString&,const QString&))); + + container->disconnect(SIGNAL(propertyChanged(const QString&))); + if (actionLogProperties->isChecked()) + connect(container, SIGNAL(propertyChanged(const QString&)), this, SLOT(logPropertyChanged(const QString&))); + container->blockSignals(actionFreezeEvents->isChecked()); + } + + ++it; + } +} + + +void MainWindow::logPropertyChanged(const QString &prop) +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QVariant var = container->property(prop.toLatin1()); + logProperties->append(tr("%1: Property Change: %2 - { %3 }").arg(container->windowTitle(), prop, var.toString())); +} + +void MainWindow::logSignal(const QString &signal, int argc, void *argv) +{ + QAxWidget *container = qobject_cast<QAxWidget*>(workspace->activeWindow()); + if (!container) + return; + + QString paramlist; + VARIANT *params = (VARIANT*)argv; + for (int a = argc-1; a >= 0; --a) { + if (a == argc-1) + paramlist = QLatin1String(" - {"); + QVariant qvar = VARIANTToQVariant(params[a], 0); + paramlist += QLatin1String(" ") + qvar.toString(); + if (a > 0) + paramlist += QLatin1String(","); + else + paramlist += QLatin1String(" "); + } + if (argc) + paramlist += QLatin1String("}"); + logSignals->append(container->windowTitle() + QLatin1String(": ") + signal + paramlist); +} + +void MainWindow::logException(int code, const QString&source, const QString&desc, const QString&help) +{ + Q_UNUSED(desc); + QAxWidget *container = qobject_cast<QAxWidget*>(sender()); + if (!container) + return; + + QString str = tr("%1: Exception code %2 thrown by %3"). + arg(container->windowTitle()).arg(code).arg(source); + logDebug->append(str); + logDebug->append(tr("\tDescription: %1").arg(desc)); + + if (!help.isEmpty()) + logDebug->append(tr("\tHelp available at %1").arg(help)); + else + logDebug->append(tr("\tNo help available.")); +} + +void MainWindow::logMacro(int code, const QString &description, int sourcePosition, const QString &sourceText) +{ + /* FIXME This needs to be rewritten to not use string concatentation, such + * that it can be translated in a sane way. */ + QString message = tr("Script: "); + if (code) + message += QString::number(code) + QLatin1String(" "); + message += QLatin1String("'") + description + QLatin1String("'"); + if (sourcePosition) + message += tr(" at position ") + QString::number(sourcePosition); + if (!sourceText.isEmpty()) + message += QLatin1String(" '") + sourceText + QLatin1String("'"); + + logMacros->append(message); +} diff --git a/tools/activeqt/testcon/mainwindow.h b/tools/activeqt/testcon/mainwindow.h new file mode 100644 index 0000000..abab47e --- /dev/null +++ b/tools/activeqt/testcon/mainwindow.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "ui_mainwindow.h" + +QT_BEGIN_NAMESPACE + +class InvokeMethod; +class ChangeProperties; +class AmbientProperties; +class QAxScriptManager; + +class QWorkspace; + +QT_END_NAMESPACE + +QT_USE_NAMESPACE + + +class MainWindow : public QMainWindow, public Ui::MainWindow +{ + Q_OBJECT +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +protected slots: + void on_actionFileNew_triggered(); + void on_actionFileLoad_triggered(); + void on_actionFileSave_triggered(); + + void on_actionContainerSet_triggered(); + void on_actionContainerClear_triggered(); + void on_actionContainerProperties_triggered(); + + void on_actionControlInfo_triggered(); + void on_actionControlDocumentation_triggered(); + void on_actionControlPixmap_triggered(); + void on_actionControlProperties_triggered(); + void on_actionControlMethods_triggered(); + void on_VerbMenu_aboutToShow(); + + void on_actionScriptingLoad_triggered(); + void on_actionScriptingRun_triggered(); + +private: + InvokeMethod *dlgInvoke; + ChangeProperties *dlgProperties; + AmbientProperties *dlgAmbient; + QAxScriptManager *scripts; + QWorkspace *workspace; + + QtMsgHandler oldDebugHandler; + +private slots: + void updateGUI(); + void logPropertyChanged(const QString &prop); + void logSignal(const QString &signal, int argc, void *argv); + void logException(int code, const QString&source, const QString&desc, const QString&help); + void logMacro(int code, const QString &description, int sourcePosition, const QString &sourceText); + + void on_VerbMenu_triggered(QAction *action); +}; + +#endif // MAINWINDOW_H diff --git a/tools/activeqt/testcon/mainwindow.ui b/tools/activeqt/testcon/mainwindow.ui new file mode 100644 index 0000000..96fe7bd --- /dev/null +++ b/tools/activeqt/testcon/mainwindow.ui @@ -0,0 +1,682 @@ +<ui version="4.0" stdsetdef="1" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="objectName" > + <string notr="true" >MainWindow</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>929</width> + <height>620</height> + </rect> + </property> + <property name="windowTitle" > + <string>ActiveX Control Test Container</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QFrame" name="Frame" > + <property name="objectName" > + <string notr="true" >Frame</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape" > + <enum>StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>Sunken</enum> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item> + <widget class="QSplitter" name="Splitter2" > + <property name="objectName" > + <string notr="true" >Splitter2</string> + </property> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <widget class="QFrame" name="Workbase" > + <property name="objectName" > + <string notr="true" >Workbase</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape" > + <enum>NoFrame</enum> + </property> + <property name="frameShadow" > + <enum>Raised</enum> + </property> + </widget> + <widget class="QTabWidget" name="TabWidget2" > + <property name="objectName" > + <string notr="true" >TabWidget2</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget" name="logSignalsTab" > + <property name="objectName" > + <string notr="true" >logSignalsTab</string> + </property> + <attribute name="title" > + <string>Signal log</string> + </attribute> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTextEdit" name="logSignals" > + <property name="objectName" > + <string notr="true" >logSignals</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="logPropertiesTab" > + <property name="objectName" > + <string notr="true" >logPropertiesTab</string> + </property> + <attribute name="title" > + <string>Property log</string> + </attribute> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTextEdit" name="logProperties" > + <property name="objectName" > + <string notr="true" >logProperties</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="TabPage" > + <property name="objectName" > + <string notr="true" >TabPage</string> + </property> + <attribute name="title" > + <string>Macro Log</string> + </attribute> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <item> + <widget class="QTextEdit" name="logMacros" > + <property name="objectName" > + <string notr="true" >logMacros</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="logDebugTab" > + <property name="objectName" > + <string notr="true" >logDebugTab</string> + </property> + <attribute name="title" > + <string>Debug log</string> + </attribute> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTextEdit" name="logDebug" > + <property name="objectName" > + <string notr="true" >logDebug</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QToolBar" name="Toolbar_2" > + <property name="objectName" > + <string notr="true" >Toolbar_2</string> + </property> + <property name="windowTitle" > + <string>Toolbar_2</string> + </property> + <addaction name="actionFileNew" /> + <addaction name="actionControlMethods" /> + <addaction name="actionControlProperties" /> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="objectName" > + <string notr="true" >menubar</string> + </property> + <widget class="QMenu" name="FileMenu" > + <property name="objectName" > + <string notr="true" >FileMenu</string> + </property> + <property name="title" > + <string>&File</string> + </property> + <addaction name="actionFileNew" /> + <addaction name="actionFileLoad" /> + <addaction name="actionFileSave" /> + <addaction name="separator" /> + <addaction name="actionFileExit" /> + </widget> + <widget class="QMenu" name="ContainerMenu" > + <property name="objectName" > + <string notr="true" >ContainerMenu</string> + </property> + <property name="title" > + <string>Con&tainer</string> + </property> + <addaction name="actionContainerSet" /> + <addaction name="actionContainerClear" /> + <addaction name="separator" /> + <addaction name="actionContainerProperties" /> + </widget> + <widget class="QMenu" name="ControlMenu" > + <property name="objectName" > + <string notr="true" >ControlMenu</string> + </property> + <property name="title" > + <string>&Control</string> + </property> + <widget class="QMenu" name="VerbMenu" > + <property name="objectName" > + <string notr="true" >VerbMenu</string> + </property> + <property name="title" > + <string>&Verbs...</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + </widget> + <addaction name="actionControlMethods" /> + <addaction name="actionControlProperties" /> + <addaction name="VerbMenu" /> + <addaction name="separator" /> + <addaction name="actionControlInfo" /> + <addaction name="actionControlDocumentation" /> + <addaction name="actionControlPixmap" /> + </widget> + <widget class="QMenu" name="ScriptMenu" > + <property name="objectName" > + <string notr="true" >ScriptMenu</string> + </property> + <property name="title" > + <string>&Scripting</string> + </property> + <addaction name="actionScriptingLoad" /> + <addaction name="actionScriptingRun" /> + </widget> + <widget class="QMenu" name="OptionsMenu" > + <property name="objectName" > + <string notr="true" >OptionsMenu</string> + </property> + <property name="title" > + <string>&Options</string> + </property> + <widget class="QMenu" name="LoggingMenu" > + <property name="objectName" > + <string notr="true" >LoggingMenu</string> + </property> + <property name="title" > + <string>Log...</string> + </property> + <addaction name="actionLogSignals" /> + <addaction name="actionLogProperties" /> + </widget> + <addaction name="actionFreezeEvents" /> + <addaction name="actionGroupLogging" /> + <addaction name="LoggingMenu" /> + </widget> + <addaction name="FileMenu" /> + <addaction name="ContainerMenu" /> + <addaction name="ControlMenu" /> + <addaction name="ScriptMenu" /> + <addaction name="OptionsMenu" /> + </widget> + <action name="actionFileExit" > + <property name="objectName" > + <string>actionFileExit</string> + </property> + <property name="iconText" > + <string>Exit</string> + </property> + <property name="text" > + <string>E&xit</string> + </property> + </action> + <action name="actionContainerSet" > + <property name="objectName" > + <string>actionContainerSet</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Set Control</string> + </property> + <property name="text" > + <string>&Set Control</string> + </property> + <property name="shortcut" > + <string>Ctrl+S</string> + </property> + </action> + <action name="actionControlMethods" > + <property name="objectName" > + <string>actionControlMethods</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="icon" > + <iconset>image0</iconset> + </property> + <property name="iconText" > + <string>Invoke Methods</string> + </property> + <property name="text" > + <string>Invoke &Methods</string> + </property> + <property name="shortcut" > + <string>Ctrl+M</string> + </property> + </action> + <action name="actionControlProperties" > + <property name="objectName" > + <string>actionControlProperties</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="icon" > + <iconset>image1</iconset> + </property> + <property name="iconText" > + <string>Change Properties</string> + </property> + <property name="text" > + <string>Change &Properties</string> + </property> + <property name="shortcut" > + <string>Ctrl+P</string> + </property> + </action> + <action name="actionContainerClear" > + <property name="objectName" > + <string>actionContainerClear</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Clear Control</string> + </property> + <property name="text" > + <string>C&lear Control</string> + </property> + <property name="shortcut" > + <string/> + </property> + </action> + <action name="actionContainerProperties" > + <property name="objectName" > + <string>actionContainerProperties</string> + </property> + <property name="iconText" > + <string>Ambient Properties</string> + </property> + <property name="text" > + <string>Ambient &Properties</string> + </property> + <property name="shortcut" > + <string>Ctrl+A</string> + </property> + </action> + <action name="actionControlInfo" > + <property name="objectName" > + <string>actionControlInfo</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Details</string> + </property> + <property name="text" > + <string>&Details</string> + </property> + <property name="shortcut" > + <string>Ctrl+I</string> + </property> + </action> + <action name="actionFileSave" > + <property name="objectName" > + <string>actionFileSave</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Save Control</string> + </property> + <property name="text" > + <string>&Save Control</string> + </property> + </action> + <action name="actionFileLoad" > + <property name="objectName" > + <string>actionFileLoad</string> + </property> + <property name="iconText" > + <string>Load Control</string> + </property> + <property name="text" > + <string>&Load Control</string> + </property> + </action> + <action name="actionFreezeEvents" > + <property name="objectName" > + <string>actionFreezeEvents</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="iconText" > + <string>Freeze Events</string> + </property> + <property name="text" > + <string>&Freeze Events</string> + </property> + </action> + <action name="actionFileNew" > + <property name="objectName" > + <string>actionFileNew</string> + </property> + <property name="icon" > + <iconset>image2</iconset> + </property> + <property name="iconText" > + <string>Insert Control</string> + </property> + <property name="text" > + <string>&Insert Control</string> + </property> + <property name="shortcut" > + <string>Ctrl+N</string> + </property> + </action> + <action name="actionControlDocumentation" > + <property name="objectName" > + <string>actionControlDocumentation</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Show Documentation</string> + </property> + <property name="text" > + <string>Show D&ocumentation</string> + </property> + <property name="shortcut" > + <string>Ctrl+D</string> + </property> + </action> + <action name="actionControlPixmap" > + <property name="objectName" > + <string>actionControlPixmap</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Render to Pixmap</string> + </property> + <property name="text" > + <string>Render to Pi&xmap</string> + </property> + <property name="shortcut" > + <string>Ctrl+X</string> + </property> + </action> + <action name="actionScriptingLoad" > + <property name="objectName" > + <string>actionScriptingLoad</string> + </property> + <property name="iconText" > + <string>Load Script</string> + </property> + <property name="text" > + <string>&Load Script</string> + </property> + </action> + <action name="actionScriptingRun" > + <property name="objectName" > + <string>actionScriptingRun</string> + </property> + <property name="enabled" > + <bool>false</bool> + </property> + <property name="iconText" > + <string>Run Macro</string> + </property> + <property name="text" > + <string>&Run Macro...</string> + </property> + </action> + <actiongroup name="actionGroupLogging" > + <action name="actionLogSignals" > + <property name="objectName" > + <string>actionLogSignals</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="iconText" > + <string>Signals</string> + </property> + <property name="text" > + <string>&Signals</string> + </property> + </action> + <action name="actionLogProperties" > + <property name="objectName" > + <string>actionLogProperties</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="iconText" > + <string>Properties</string> + </property> + <property name="text" > + <string>&Properties</string> + </property> + </action> + <property name="objectName" > + <string>actionGroupLogging</string> + </property> + <property name="exclusive" > + <bool>false</bool> + </property> + </actiongroup> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <images> + <image name="image0" > + <data format="XPM.GZ" length="3502" >789cdd95c96e1c371086ef7a8a81eb6604e56e92bd21c84192175996648d6559b2831cd85cb4ef23d95290770fe72f36e3003ee41220485373f8543f975a587cf17c76b8bb3d7bfe62e56e6117276ee68eededecb9bfbfb878fcf5b75f7e5f79a6d42cfdd54d3553cf7e5a79365fccdc6ce7ea322cc19e26a0aa51aaeb964c31b3ee46d8a9b05b32b7994d27f3178523ecbb99bbbe87fdaef000be06b7ca0e067c9b791c5af04d6637c87e8f99fde0c11edc6935c2193e01f7dab91a1cc083314ef4c7e0b15141ece29f6b4c68c047998720fb7d01473d8e60b24bae2b1d1cf416faba36cacbfe1b99b597f5e04f6d4c081af335b86f5c80ff74091eda3a20beb40376ad8b381fbd0487ce44890f83a3a92cf6a3fd25abca682beb7d15ee42141ec0e90016fed366e6c6223ff498b91d2b30ceab5462d93f1416ff9accdd28e741bc9531e388fcd3c7c292fff7e0c67827febf05b74de5e47c3db84b2cfedf64ae9dc4df1496fc55e0bed15eceb75758ce578387a6f1a81fda288cfa639db9f5d89f55610b7d07b64defc51f3f71407c18f95163aa0fd9ff43662bf543a867e51b9ff3391696fa719943107f241ea189926f96fc84b68a92df3785113fdece5c47a9af77e09818fef2566615e5bea1de75ddb6c284fbaa753b487df03770d34ef532070f5d9bf90aecbb18253ec8bf317d88f08f719f4d3ba8cca83f330c5d147f5f67ee33239fc60e6366ec6fc6c10933fa87f1b6ca7c9fb98e12af0770b05a98d05f4cb42633eaade9c6364afe5e816d2a47e94fb86f9dafea0af1b617e05018fe76b1f0f9927b5df80c1c2a55213f16fd607085d14f6c5d18f7c7b6f5584b3da03e6d5718f567fb494f5bc2c5be061e26b6a847ebea3460477c6c2c8cfa18abb2de2ab8ae7d2df15907ab625f084f768bfa1c4d61d4ef38d4a196787e02db693e8bbef84f88d718ea584b7f417cdd5fe7c1fbe14a7c08f7d9a9e581c088af3385515fae298cfcbbb6d295f49327e1c9ce9fc1dd6467dc1fd7173dfab9f3aa5672dfd06f5c2c76f4575fa9f481b19eaf0be37df46a623e04ebc2e8b7de28ad64ff03705318f7c1b73a7d60c4d35b6514fa29a19ffa7162467ff7ae30f2e17d39afecef8b1dfdd7c7c2a8ff6074aba53f20fea1cc679bd954a2473f0d41754ade7ff497d8a85e49ffc47b145b6db5f403f817fb62477ca29dd623f49fe8d4a0a4dff4994725fde25a58a701463f8d5e375afadb7ae6c9be96396aa92fbcbf3198f4c1de656e8ccc9f67b606e7e5d5ccde483fb9126efa46ce7f29dc9a56d6bbc8dcb4b21eea2dc6f41ccbfb762edca6171b7c26dc990ef3e78b7f3efe2f7a26b6e9473cb24be43970e4a3328ef9e47b3d9ff2199ff3055ff2155ff34dfacf2ddff182eff901e32b7fe3c7499f567d4ada555ee3757ec9aff835bf493336f82d6ff23bde4a639b77f83def66bde5397fe03dfec8fb697ce2033ee4cf69c617aeb866958666c30db765fd8efbac9619437285e60bb2349223bfd453a038e9e9888e8b7a9f4ee894cee89c2ed28c4bbaa26bd67443b73fd6d3091fd01d2de89e1e92fe2b7d4b3e2cf58f3fd243fd44abb446eb49fd925ed16b7a431bf496368b7ee4757af737f5166d27f50ebda75d9ad307daa38fb43fe9e9131dd0217d4e3e7ea12aa96b5249adc950432d75d427f560d9d2942f6be9c98ed6d1c27a1b6c5ac71ed9e3149b3d7b92e2b249fb497dfa7d3dd8337b6e2fd2b8b45789aeed8dbdb5777661693952b3a0ff763dff6bfa3f7e5ef9138fb14e09</data> + </image> + <image name="image1" > + <data format="XPM.GZ" length="2493" >789ca59459531b391446dff9152ef4464dddb8dbbd566a1eb2af10c84a929a87de8c0dd86c76623235ff3dfa8eb0878c3309a9e850a64fe9d3b5a4967c6babb7bfbbdddbbab57131ab66e3a6d78caaf3de563b9f4c2e3ffef5e7df1b9b71dcf37f45de8b37ffd8d8dc9bf59adecec9b493d8dc8bebd3f0311e09fc151e0b7c07af05fe146f84dca9b88b1241ff17794cc347782ac89fc90791a07f8a27026ff042e043bc128c3fc51b417f8db7028ff14ee0bbc1b3a62af177f850e07bc1b3b60aeb3b90277d81bfc0a33caac37c3b9c86bfc67381b77821f00778990f9bd09fe0b5c01fe26d91b561bf2a79da17acf7088f044e7db693bc9be003c1f847c1cb7e17fad9ff341178a84f23ff12cf04fe18cfcbbc633f1dfb91760277f2ac2fc8e7782ce83fc60782fe90e70be83fc77dbbdaef27782ee83fc40b814f975e87fdb8c0ebacaec3f933bc13f878e94d582fe7271b0afc64e94da8cff9c9fdfb6dc2f9e1fbf381c039df795aa55d78df255e0abcc03b81bf97737cc378e65b1455d186f1295e099cfd28ea2a6d42bd7dbc15cc8ffb500e04fd039c463ff7b96c05fd91bc4a05fe1c2f57f7611baf57e7bf8fb702ff20e7ba87f7fb0c4f933809e7330b2ef0b7f850e097f22616cc8ffbc2750df35fe089c0efe079522661fdbc9fa62cea229c8f37782df0bbf2364eda24cc77125ce0fc3eb449e11bfe19678138e7b3ed047e4fdec5abfbc3ef5397e4691ed6c7fdeb0a817fc22b81df970fe3b44ccbf0637b737e276fce2aabadf14fad7536bc7a3ab0918dd7f376684776ec99d8d44e3ca776e69fce3d1736b3f9b7799ffe649f6de1b9f47cb13b76d7eed97dfff4c01eda237b1c4684bc3df1b5437a39e2a93db3e7b6edd9b117b66b7b9ef92affd2cf63710d8d187b5e79c6365fb2cabffe4f5e23deb09a7f797b2dff6e2d2ff6ed3dff3f58df7f46d7f2f177f3034b2cb5cc726c3d5f58e9cc3957b93a8c708d1f915c8dfe79fd856b9577ddffe44b3774076ee419933ef4335fb8237774d3fadfb09677c77ee6233771ad9b527f0427eb7977fa6bf5dd19f54757d55b774efd095c7c273ffbc5f9cffddb8e7e8cbb767e18f1537ef73ede28ffcfed8daf804d6c7a</data> + </image> + <image name="image2" > + <data format="XPM.GZ" length="1232" >789ccdd24b4fe2501c86f13d9fa2811d99a8ad9442cc2c44f082327169625c1c4e5b4f552e721398cc771f9f570907837bff0f8bfef226400287d5e0eeb617540f4bd399991536b0ce4c826a3a1f0c56f70fbfff96ca5114bcbf6a6110967f95ca07810dfe8c8619cfeefdb972a483e7306c107c84518de0293c360473312598c15a83602a1a8256b404fb30d64103eb09c10a4c9a047bb019119c8931c12e3475821dd88f094ec53ac1b5a8834bd1127c13738237d08604afc498e0b5a88313982604dba221f82a5a82633127b882594470211e137c116382976242f0496c121c8929c10b3127f80cf3238267624870282604e76293604bd4978603516f0d0b51a7ffd8dedb2c15d3b7699ae58feecb522936e7dcee62b6cb93db59fadbe5f9c5f98bdd0c03371c8d9db7a4dee770fb96e275329ded5f8af9e2eddb65f9a396cc5f566b6f392d8ad6fcf3ceda1d6f396f5d5c2e3e6ed5beea7a8b1b5fdf2c3f6edde9f6bce5c0ed9cff6b7fff3fd8b3fc3b29fd07f8c43cbd</data> + </image> + </images> +</ui> diff --git a/tools/activeqt/testcon/scripts/javascript.js b/tools/activeqt/testcon/scripts/javascript.js new file mode 100644 index 0000000..e2bd54b --- /dev/null +++ b/tools/activeqt/testcon/scripts/javascript.js @@ -0,0 +1,25 @@ +function QAxWidget2::Click() +{ + QAxWidget2.lineWidth++; + MainWindow.logMacro(0, "Hello from JavaScript: QAxWidget2::Click", 0, ""); +} + +function fatLines() +{ + QAxWidget2.lineWidth = 25; +} + +function thinLines() +{ + QAxWidget2.lineWidth = 1; +} + +function setLineWidth(width) +{ + QAxWidget2.lineWidth = width; +} + +function getLineWidth() +{ + return(QAxWidget2.lineWidth) +} diff --git a/tools/activeqt/testcon/scripts/perlscript.pl b/tools/activeqt/testcon/scripts/perlscript.pl new file mode 100644 index 0000000..029bdc2 --- /dev/null +++ b/tools/activeqt/testcon/scripts/perlscript.pl @@ -0,0 +1,24 @@ +sub QAxWidget2_Click { + $QAxWidget2->{'lineWidth'} = $QAxWidget2->{'lineWidth'} + 1; + $MainWindow->logMacro(0, "Hello from Perl: QAxWidget2_Click", 0, ""); +} + +sub fatLines +{ + $QAxWidget2->{'lineWidth'} = 25; +} + +sub thinLines +{ + $QAxWidget2->{'lineWidth'} = 1; +} + +sub setLineWidth(width) +{ + $QAxWidget2->{'lineWidth'} = width; +} + +sub getLineWidth() +{ + return $QAxWidget2->{'lineWidth'}; +} diff --git a/tools/activeqt/testcon/scripts/pythonscript.py b/tools/activeqt/testcon/scripts/pythonscript.py new file mode 100644 index 0000000..79bca87 --- /dev/null +++ b/tools/activeqt/testcon/scripts/pythonscript.py @@ -0,0 +1,15 @@ +def QAxWidget2_Click(): + QAxWidget2.lineWidth = QAxWidget2.lineWidth + 1; + MainWindow.logMacro(0, "Hello from Python: QAxWidget2_Click", 0, ""); + +def fatLines(): + QAxWidget2.lineWidth = 25; + +def thinLines(): + QAxWidget2.lineWidth = 1; + +def setLineWidth(width): + QAxWidget2.lineWidth = width; + +def getLineWidth(): + return QAxWidget2.lineWidth; diff --git a/tools/activeqt/testcon/scripts/vbscript.vbs b/tools/activeqt/testcon/scripts/vbscript.vbs new file mode 100644 index 0000000..bd29f19 --- /dev/null +++ b/tools/activeqt/testcon/scripts/vbscript.vbs @@ -0,0 +1,20 @@ +Sub QAxWidget2_Click + QAxWidget2.lineWidth = QAxWidget2.lineWidth + 1 + MainWindow.logMacro 0, "Hello from VBScript: QAxWidget2_Click", 0, "" +End Sub + +Sub fatLines + QAxWidget2.lineWidth = 25 +End Sub + +Sub thinLines + QAxWidget2.lineWidth = 1 +End Sub + +Sub setLineWidth(width) + QAxWidget2.lineWidth = width +End Sub + +Public Function getLineWidth + getLineWidth = QAxWidget2.lineWidth +End Function diff --git a/tools/activeqt/testcon/testcon.idl b/tools/activeqt/testcon/testcon.idl new file mode 100644 index 0000000..7dd88a5 --- /dev/null +++ b/tools/activeqt/testcon/testcon.idl @@ -0,0 +1,44 @@ +/**************************************************************************** +** Interface definition generated for ActiveQt project +** +** 'C:\depot\qt\3.3\extensions\activeqt\tools\testcon\testcon.exe' +** +** Created: Fr 31. Okt 15:33:50 2003 +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +import "ocidl.idl"; +#include <olectl.h> + +[ + uuid(4A43E44D-9D1D-47E5-A1E5-58FE6F7BE0A4), + version(1.0), + helpstring("testcon 1.0 Type Library") +] +library testconLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(3FC86F5F-8B15-4428-8F6B-482BAE91F1AE), + helpstring("MainWindow Interface") + ] + dispinterface IMainWindow + { + properties: + methods: + [id(7)] void logMacro( [in] int p_code, [in] BSTR p_description, [in] int p_sourcePosition, [in] BSTR p_sourceText); + }; + + [ + aggregatable, + helpstring("MainWindow Class"), + uuid(5F5CE700-48A8-47B1-9B06-3B7F79E41D7C) + ] + coclass MainWindow + { + [default] dispinterface IMainWindow; + }; +}; diff --git a/tools/activeqt/testcon/testcon.pro b/tools/activeqt/testcon/testcon.pro new file mode 100644 index 0000000..dc98218 --- /dev/null +++ b/tools/activeqt/testcon/testcon.pro @@ -0,0 +1,21 @@ +TEMPLATE = app + +CONFIG += qaxserver qaxserver_no_postlink qaxcontainer +# QT += qt3support + +# ui_qaxselect.h +INCLUDEPATH += $$QT_SOURCE_TREE/tools/activeqt/container/debug \ + $$QT_SOURCE_TREE/tools/activeqt/container/release \ + $$QT_BUILD_TREE/src/activeqt/container \ + +SOURCES = main.cpp docuwindow.cpp mainwindow.cpp invokemethod.cpp changeproperties.cpp ambientproperties.cpp controlinfo.cpp +HEADERS = docuwindow.h mainwindow.h invokemethod.h changeproperties.h ambientproperties.h controlinfo.h +FORMS = mainwindow.ui invokemethod.ui changeproperties.ui ambientproperties.ui controlinfo.ui +RC_FILE = testcon.rc + +win32-borland { + QMAKE_POST_LINK = -midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl +} else { + !win32-g++:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR) + +} diff --git a/tools/activeqt/testcon/testcon.rc b/tools/activeqt/testcon/testcon.rc new file mode 100644 index 0000000..6fe4036 --- /dev/null +++ b/tools/activeqt/testcon/testcon.rc @@ -0,0 +1,35 @@ +#ifndef Q_CC_BOR +#include <winver.h> +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 3, 2, 0, 0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)\0" + VALUE "FileDescription", "ActiveQt Test Container\0" + VALUE "FileVersion", "1,0,0,1\0" + VALUE "InternalName", "testcon\0" + VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "testcon.exe\0" + VALUE "ProductName", "ActiveQt Test Container\0" + VALUE "ProductVersion", "3, 2, 0, 0\0" + END + END + END +/* End of Version info */ + |