mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove deviceskin
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
0053585bf5
commit
0da9099032
35 changed files with 62 additions and 2416 deletions
|
@ -608,7 +608,6 @@ endif()
|
|||
|
||||
# semi-shared
|
||||
include(src/shared/linguist/linguist.cmake)
|
||||
include(src/shared/deviceskin/deviceskin.cmake)
|
||||
include(src/shared/qtgradienteditor/qtgradienteditor.cmake)
|
||||
include(src/shared/qtpropertybrowser/qtpropertybrowser.cmake)
|
||||
include(src/shared/findwidget/findwidget.cmake)
|
||||
|
|
|
@ -62,7 +62,6 @@ set(DESIGNER_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_components.h
|
||||
${SHAREDGRADIENDEDITOR_HEADERS}
|
||||
${SHAREDPROPERTYBROWSER_HEADERS}
|
||||
${SHAREDDEVICESKIN_HEADERS}
|
||||
${SHAREDFINDWIDGET_HEADERS}
|
||||
)
|
||||
|
||||
|
@ -97,7 +96,6 @@ include_directories(
|
|||
${CMAKE_CURRENT_BINARY_DIR}/shared
|
||||
${SHAREDGRADIENDEDITOR_INCLUDES}
|
||||
${SHAREDPROPERTYBROWSER_INCLUDES}
|
||||
${SHAREDDEVICESKIN_INCLUDES}
|
||||
${SHAREDFINDWIDGET_INCLUDES}
|
||||
# for widgets.table
|
||||
${CMAKE_SOURCE_DIR}/src/shared
|
||||
|
@ -128,7 +126,6 @@ katie_setup_target(KtDesigner ${DESIGNER_SOURCES} ${DESIGNER_HEADERS})
|
|||
add_library(KtDesigner ${KATIE_TYPE} ${KtDesigner_SOURCES}
|
||||
$<TARGET_OBJECTS:sharedqtgradienteditor>
|
||||
$<TARGET_OBJECTS:sharedqtpropertybrowser>
|
||||
$<TARGET_OBJECTS:shareddeviceskin>
|
||||
$<TARGET_OBJECTS:sharedfindwidget>
|
||||
)
|
||||
target_link_libraries(KtDesigner ${EXTRA_DESIGNER_LIBS})
|
||||
|
@ -138,7 +135,7 @@ set_target_properties(KtDesigner PROPERTIES
|
|||
EXPORT_NAME Designer
|
||||
)
|
||||
|
||||
katie_setup_object(KtDesigner sharedqtgradienteditor sharedqtpropertybrowser shareddeviceskin sharedfindwidget)
|
||||
katie_setup_object(KtDesigner sharedqtgradienteditor sharedqtpropertybrowser sharedfindwidget)
|
||||
|
||||
install(
|
||||
TARGETS KtDesigner
|
||||
|
|
|
@ -70,14 +70,6 @@
|
|||
static void initResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(shared);
|
||||
Q_INIT_RESOURCE(ClamshellPhone);
|
||||
Q_INIT_RESOURCE(PortableMedia);
|
||||
Q_INIT_RESOURCE(S60_nHD_Touchscreen);
|
||||
Q_INIT_RESOURCE(S60_QVGA_Candybar);
|
||||
Q_INIT_RESOURCE(SmartPhone);
|
||||
Q_INIT_RESOURCE(SmartPhone2);
|
||||
Q_INIT_RESOURCE(SmartPhoneWithButtons);
|
||||
Q_INIT_RESOURCE(TouchscreenPhone);
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -624,4 +616,5 @@ void QDesignerFormEditorInterface::setDialogGui(QDesignerDialogGuiInterface *dia
|
|||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include <moc_abstractformeditor.h>
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
/* It is possible to link the skins as resources into Designer by specifying:
|
||||
* QVFB_ROOT=$$QT_SOURCE_TREE/tools/qvfb
|
||||
* RESOURCES += $$QVFB_ROOT/ClamshellPhone.qrc $$QVFB_ROOT/TouchScreenPhone.qrc ...
|
||||
* in lib/shared/shared.pri. However, this exceeds a limit of Visual Studio 6. */
|
||||
|
||||
#include "previewconfigurationwidget_p.h"
|
||||
#include "ui_previewconfigurationwidget.h"
|
||||
#include "previewmanager_p.h"
|
||||
|
@ -53,8 +48,6 @@
|
|||
#include <iconloader_p.h>
|
||||
#include <stylesheeteditor_p.h>
|
||||
|
||||
#include <deviceskin.h>
|
||||
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QStyleFactory>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
@ -65,36 +58,8 @@
|
|||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QSharedData>
|
||||
|
||||
|
||||
static const char *skinResourcePathC = ":/skins/";
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const char *skinExtensionC = "skin";
|
||||
|
||||
// Pair of skin name, path
|
||||
typedef QPair<QString, QString> SkinNamePath;
|
||||
typedef QList<SkinNamePath> Skins;
|
||||
enum { SkinComboNoneIndex = 0 };
|
||||
|
||||
// find default skins (resources)
|
||||
static const Skins &defaultSkins() {
|
||||
static Skins rc;
|
||||
if (rc.empty()) {
|
||||
const QString skinPath = QLatin1String(skinResourcePathC);
|
||||
QString pattern = QLatin1String("*.");
|
||||
pattern += QLatin1String(skinExtensionC);
|
||||
const QDir dir(skinPath, pattern);
|
||||
const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
|
||||
if (list.empty())
|
||||
return rc;
|
||||
const QFileInfoList::const_iterator lcend = list.constEnd();
|
||||
for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it)
|
||||
rc.push_back(SkinNamePath(it->baseName(), it->filePath()));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
namespace qdesigner_internal {
|
||||
|
||||
// ------------- PreviewConfigurationWidgetPrivate
|
||||
|
@ -103,15 +68,11 @@ public:
|
|||
PreviewConfigurationWidgetPrivate(QDesignerFormEditorInterface *core, QGroupBox *g);
|
||||
|
||||
void slotEditAppStyleSheet();
|
||||
void slotDeleteSkinEntry();
|
||||
void slotSkinChanged(int index);
|
||||
|
||||
void retrieveSettings();
|
||||
void storeSettings() const;
|
||||
|
||||
QAbstractButton *appStyleSheetChangeButton() const { return m_ui.m_appStyleSheetChangeButton; }
|
||||
QAbstractButton *skinRemoveButton() const { return m_ui.m_skinRemoveButton; }
|
||||
QComboBox *skinCombo() const { return m_ui.m_skinCombo; }
|
||||
|
||||
QDesignerFormEditorInterface *m_core;
|
||||
|
||||
|
@ -119,28 +80,16 @@ private:
|
|||
PreviewConfiguration previewConfiguration() const;
|
||||
void setPreviewConfiguration(const PreviewConfiguration &pc);
|
||||
|
||||
QStringList userSkins() const;
|
||||
void addUserSkins(const QStringList &files);
|
||||
bool canRemoveSkin(int index) const;
|
||||
int browseSkin();
|
||||
|
||||
const QString m_defaultStyle;
|
||||
QGroupBox *m_parent;
|
||||
Ui_PreviewConfigurationWidget m_ui;
|
||||
|
||||
int m_firstUserSkinIndex;
|
||||
int m_browseSkinIndex;
|
||||
int m_lastSkinIndex; // required in case browse fails
|
||||
};
|
||||
|
||||
PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::PreviewConfigurationWidgetPrivate(
|
||||
QDesignerFormEditorInterface *core, QGroupBox *g) :
|
||||
m_core(core),
|
||||
m_defaultStyle(PreviewConfigurationWidget::tr("Default")),
|
||||
m_parent(g),
|
||||
m_firstUserSkinIndex(0),
|
||||
m_browseSkinIndex(0),
|
||||
m_lastSkinIndex(0)
|
||||
m_parent(g)
|
||||
{
|
||||
m_ui.setupUi(g);
|
||||
// styles
|
||||
|
@ -154,52 +103,9 @@ PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::PreviewConfigurat
|
|||
m_ui.m_appStyleSheetClearButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("resetproperty.png")));
|
||||
QObject::connect(m_ui.m_appStyleSheetClearButton, SIGNAL(clicked()), m_ui.m_appStyleSheetLineEdit, SLOT(clear()));
|
||||
|
||||
m_ui.m_skinRemoveButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png")));
|
||||
// skins: find default skins (resources)
|
||||
m_ui.m_skinRemoveButton->setEnabled(false);
|
||||
Skins skins = defaultSkins();
|
||||
skins.push_front(SkinNamePath(PreviewConfigurationWidget::tr("None"), QString()));
|
||||
|
||||
const Skins::const_iterator scend = skins.constEnd();
|
||||
for (Skins::const_iterator it = skins.constBegin(); it != scend; ++it)
|
||||
m_ui.m_skinCombo->addItem (it->first, QVariant(it->second));
|
||||
m_browseSkinIndex = m_firstUserSkinIndex = skins.size();
|
||||
m_ui.m_skinCombo->addItem(PreviewConfigurationWidget::tr("Browse..."), QString());
|
||||
|
||||
m_ui.m_skinCombo->setMaxVisibleItems (qMax(15, 2 * m_browseSkinIndex));
|
||||
m_ui.m_skinCombo->setEditable(false);
|
||||
|
||||
retrieveSettings();
|
||||
}
|
||||
|
||||
bool PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::canRemoveSkin(int index) const
|
||||
{
|
||||
return index >= m_firstUserSkinIndex && index != m_browseSkinIndex;
|
||||
}
|
||||
|
||||
QStringList PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::userSkins() const
|
||||
{
|
||||
QStringList rc;
|
||||
for (int i = m_firstUserSkinIndex; i < m_browseSkinIndex; i++)
|
||||
rc.push_back(m_ui.m_skinCombo->itemData(i).toString());
|
||||
return rc;
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::addUserSkins(const QStringList &files)
|
||||
{
|
||||
if (files.empty())
|
||||
return;
|
||||
const QStringList ::const_iterator fcend = files.constEnd();
|
||||
for (QStringList::const_iterator it = files.constBegin(); it != fcend; ++it) {
|
||||
const QFileInfo fi(*it);
|
||||
if (fi.isDir() && fi.isReadable()) {
|
||||
m_ui.m_skinCombo->insertItem(m_browseSkinIndex++, fi.baseName(), QVariant(*it));
|
||||
} else {
|
||||
qWarning() << "Unable to access the skin directory '" << *it << "'.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PreviewConfiguration PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::previewConfiguration() const
|
||||
{
|
||||
PreviewConfiguration rc;
|
||||
|
@ -207,13 +113,7 @@ PreviewConfiguration PreviewConfigurationWidget::PreviewConfigurationWidgetPriva
|
|||
if (style == m_defaultStyle)
|
||||
style.clear();
|
||||
const QString applicationStyleSheet = m_ui.m_appStyleSheetLineEdit->text();
|
||||
// Figure out skin. 0 is None by definition..
|
||||
const int skinIndex = m_ui.m_skinCombo->currentIndex();
|
||||
QString deviceSkin;
|
||||
if (skinIndex != SkinComboNoneIndex && skinIndex != m_browseSkinIndex)
|
||||
deviceSkin = m_ui.m_skinCombo->itemData(skinIndex).toString();
|
||||
|
||||
return PreviewConfiguration(style, applicationStyleSheet, deviceSkin);
|
||||
return PreviewConfiguration(style, applicationStyleSheet);
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::setPreviewConfiguration(const PreviewConfiguration &pc)
|
||||
|
@ -223,14 +123,6 @@ void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::setPreviewCo
|
|||
styleIndex = m_ui.m_styleCombo->findText(m_defaultStyle);
|
||||
m_ui.m_styleCombo->setCurrentIndex(styleIndex);
|
||||
m_ui.m_appStyleSheetLineEdit->setText(pc.applicationStyleSheet());
|
||||
// find skin by file name. 0 is "none"
|
||||
const QString deviceSkin = pc.deviceSkin();
|
||||
int skinIndex = deviceSkin.isEmpty() ? 0 : m_ui.m_skinCombo->findData(QVariant(deviceSkin));
|
||||
if (skinIndex == -1) {
|
||||
qWarning() << "Unable to find skin '" << deviceSkin << "'.";
|
||||
skinIndex = 0;
|
||||
}
|
||||
m_ui.m_skinCombo->setCurrentIndex(skinIndex);
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::slotEditAppStyleSheet()
|
||||
|
@ -241,33 +133,11 @@ void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::slotEditApp
|
|||
m_ui.m_appStyleSheetLineEdit->setText(dlg.text());
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::slotDeleteSkinEntry()
|
||||
{
|
||||
const int index = m_ui.m_skinCombo->currentIndex();
|
||||
if (canRemoveSkin(index)) {
|
||||
m_ui.m_skinCombo->setCurrentIndex(SkinComboNoneIndex);
|
||||
m_ui.m_skinCombo->removeItem(index);
|
||||
m_browseSkinIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::slotSkinChanged(int index)
|
||||
{
|
||||
if (index == m_browseSkinIndex) {
|
||||
m_ui.m_skinCombo->setCurrentIndex(browseSkin());
|
||||
} else {
|
||||
m_lastSkinIndex = index;
|
||||
m_ui.m_skinRemoveButton->setEnabled(canRemoveSkin(index));
|
||||
m_ui.m_skinCombo->setToolTip(index != SkinComboNoneIndex ? m_ui.m_skinCombo->itemData(index).toString() : QString());
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::retrieveSettings()
|
||||
{
|
||||
QDesignerSharedSettings settings(m_core);
|
||||
m_parent->setChecked(settings.isCustomPreviewConfigurationEnabled());
|
||||
setPreviewConfiguration(settings.customPreviewConfiguration());
|
||||
addUserSkins(settings.userDeviceSkins());
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::storeSettings() const
|
||||
|
@ -275,52 +145,6 @@ void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::storeSetting
|
|||
QDesignerSharedSettings settings(m_core);
|
||||
settings.setCustomPreviewConfigurationEnabled(m_parent->isChecked());
|
||||
settings.setCustomPreviewConfiguration(previewConfiguration());
|
||||
settings.setUserDeviceSkins(userSkins());
|
||||
}
|
||||
|
||||
int PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::browseSkin()
|
||||
{
|
||||
QFileDialog dlg(m_parent);
|
||||
dlg.setFileMode(QFileDialog::DirectoryOnly);
|
||||
const QString title = tr("Load Custom Device Skin");
|
||||
dlg.setWindowTitle(title);
|
||||
dlg.setNameFilter(tr("All QVFB Skins (*.%1)").arg(QLatin1String(skinExtensionC)));
|
||||
|
||||
int rc = m_lastSkinIndex;
|
||||
do {
|
||||
if (!dlg.exec())
|
||||
break;
|
||||
|
||||
const QStringList directories = dlg.selectedFiles();
|
||||
if (directories.size() != 1)
|
||||
break;
|
||||
|
||||
// check: 1) name already there
|
||||
const QString directory = directories.front();
|
||||
const QString name = QFileInfo(directory).baseName();
|
||||
const int existingIndex = m_ui.m_skinCombo->findText(name);
|
||||
if (existingIndex != -1 && existingIndex != SkinComboNoneIndex && existingIndex != m_browseSkinIndex) {
|
||||
const QString msgTitle = tr("%1 - Duplicate Skin").arg(title);
|
||||
const QString msg = tr("The skin '%1' already exists.").arg(name);
|
||||
QMessageBox::information(m_parent, msgTitle, msg);
|
||||
break;
|
||||
}
|
||||
// check: 2) can read
|
||||
DeviceSkinParameters parameters;
|
||||
QString readError;
|
||||
if (parameters.read(directory, DeviceSkinParameters::ReadSizeOnly, &readError)) {
|
||||
const QString name = QFileInfo(directory).baseName();
|
||||
m_ui.m_skinCombo->insertItem(m_browseSkinIndex, name, QVariant(directory));
|
||||
rc = m_browseSkinIndex++;
|
||||
|
||||
break;
|
||||
} else {
|
||||
const QString msgTitle = tr("%1 - Error").arg(title);
|
||||
const QString msg = tr("%1 is not a valid skin directory:\n%2").arg(directory).arg(readError);
|
||||
QMessageBox::warning (m_parent, msgTitle, msg);
|
||||
}
|
||||
} while (true);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// ------------- PreviewConfigurationWidget
|
||||
|
@ -330,8 +154,6 @@ PreviewConfigurationWidget::PreviewConfigurationWidget(QDesignerFormEditorInterf
|
|||
m_impl(new PreviewConfigurationWidgetPrivate(core, this))
|
||||
{
|
||||
connect(m_impl->appStyleSheetChangeButton(), SIGNAL(clicked()), this, SLOT(slotEditAppStyleSheet()));
|
||||
connect(m_impl->skinRemoveButton(), SIGNAL(clicked()), this, SLOT(slotDeleteSkinEntry()));
|
||||
connect(m_impl->skinCombo(), SIGNAL(currentIndexChanged(int)), this, SLOT(slotSkinChanged(int)));
|
||||
|
||||
m_impl->retrieveSettings();
|
||||
}
|
||||
|
@ -351,16 +173,6 @@ void PreviewConfigurationWidget::slotEditAppStyleSheet()
|
|||
m_impl->slotEditAppStyleSheet();
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::slotDeleteSkinEntry()
|
||||
{
|
||||
m_impl->slotDeleteSkinEntry();
|
||||
}
|
||||
|
||||
void PreviewConfigurationWidget::slotSkinChanged(int index)
|
||||
{
|
||||
m_impl->slotSkinChanged(index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -1,38 +1,47 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreviewConfigurationWidget</class>
|
||||
<widget class="QGroupBox" name="PreviewConfigurationWidget" >
|
||||
<property name="windowTitle" >
|
||||
<widget class="QGroupBox" name="PreviewConfigurationWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>364</width>
|
||||
<height>94</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<property name="title">
|
||||
<string>Print/Preview Configuration</string>
|
||||
</property>
|
||||
<property name="checkable" >
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="m_styleLabel" >
|
||||
<property name="text" >
|
||||
<layout class="QFormLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_styleLabel">
|
||||
<property name="text">
|
||||
<string>Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="m_styleCombo" />
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_styleCombo"/>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="m_appStyleSheetLabel" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_appStyleSheetLabel">
|
||||
<property name="text">
|
||||
<string>Style sheet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="qdesigner_internal::TextPropertyEditor" name="m_appStyleSheetLineEdit" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="qdesigner_internal::TextPropertyEditor" name="m_appStyleSheetLineEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>149</width>
|
||||
<height>0</height>
|
||||
|
@ -41,41 +50,23 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_appStyleSheetChangeButton" >
|
||||
<property name="text" >
|
||||
<widget class="QToolButton" name="m_appStyleSheetChangeButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_appStyleSheetClearButton" >
|
||||
<property name="text" >
|
||||
<widget class="QToolButton" name="m_appStyleSheetClearButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="m_skinLabel" >
|
||||
<property name="text" >
|
||||
<string>Device skin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_skinCombo" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_skinRemoveButton" >
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -83,7 +74,7 @@
|
|||
<customwidget>
|
||||
<class>qdesigner_internal::TextPropertyEditor</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global" >textpropertyeditor_p.h</header>
|
||||
<header location="global">textpropertyeditor_p.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -78,8 +78,6 @@ public:
|
|||
|
||||
private slots:
|
||||
void slotEditAppStyleSheet();
|
||||
void slotDeleteSkinEntry();
|
||||
void slotSkinChanged(int);
|
||||
|
||||
private:
|
||||
class PreviewConfigurationWidgetPrivate;
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "formwindowbase_p.h"
|
||||
#include "widgetfactory_p.h"
|
||||
|
||||
#include <deviceskin.h>
|
||||
|
||||
#include <QtDesigner/abstractformwindow.h>
|
||||
#include <QtDesigner/abstractformeditor.h>
|
||||
#include <QtDesigner/abstractformwindowmanager.h>
|
||||
|
@ -82,10 +80,7 @@ static inline int compare(const qdesigner_internal::PreviewConfiguration &pc1, c
|
|||
int rc = pc1.style().compare(pc2.style());
|
||||
if (rc)
|
||||
return rc;
|
||||
rc = pc1.applicationStyleSheet().compare(pc2.applicationStyleSheet());
|
||||
if (rc)
|
||||
return rc;
|
||||
return pc1.deviceSkin().compare(pc2.deviceSkin());
|
||||
return pc1.applicationStyleSheet().compare(pc2.applicationStyleSheet());
|
||||
}
|
||||
|
||||
// ------ PreviewData (data associated with a preview window)
|
||||
|
@ -148,320 +143,35 @@ QGraphicsProxyWidget *DesignerZoomWidget::createProxyWidget(QGraphicsItem *paren
|
|||
return new DesignerZoomProxyWidget(parent, wFlags);
|
||||
}
|
||||
|
||||
// PreviewDeviceSkin: Forwards the key events to the window and
|
||||
// provides context menu with rotation options. Derived class
|
||||
// can apply additional transformations to the skin.
|
||||
|
||||
class PreviewDeviceSkin : public DeviceSkin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Direction { DirectionUp, DirectionLeft, DirectionRight };
|
||||
|
||||
explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent);
|
||||
virtual void setPreview(QWidget *w);
|
||||
QSize screenSize() const { return m_screenSize; }
|
||||
|
||||
private slots:
|
||||
void slotSkinKeyPressEvent(int code, const QString& text, bool autorep);
|
||||
void slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep);
|
||||
void slotPopupMenu();
|
||||
|
||||
protected:
|
||||
virtual void populateContextMenu(QMenu *) {}
|
||||
|
||||
private slots:
|
||||
void slotDirection(QAction *);
|
||||
|
||||
protected:
|
||||
// Fit the widget in case the orientation changes (transposing screensize)
|
||||
virtual void fitWidget(const QSize &size);
|
||||
// Calculate the complete transformation for the skin
|
||||
// (base class implementation provides rotation).
|
||||
virtual QMatrix skinTransform() const;
|
||||
|
||||
private:
|
||||
const QSize m_screenSize;
|
||||
Direction m_direction;
|
||||
|
||||
QAction *m_directionUpAction;
|
||||
QAction *m_directionLeftAction;
|
||||
QAction *m_directionRightAction;
|
||||
QAction *m_closeAction;
|
||||
};
|
||||
|
||||
PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) :
|
||||
DeviceSkin(parameters, parent),
|
||||
m_screenSize(parameters.screenSize()),
|
||||
m_direction(DirectionUp),
|
||||
m_directionUpAction(0),
|
||||
m_directionLeftAction(0),
|
||||
m_directionRightAction(0),
|
||||
m_closeAction(0)
|
||||
{
|
||||
connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)),
|
||||
this, SLOT(slotSkinKeyPressEvent(int,QString,bool)));
|
||||
connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)),
|
||||
this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool)));
|
||||
connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu()));
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::setPreview(QWidget *formWidget)
|
||||
{
|
||||
formWidget->setFixedSize(m_screenSize);
|
||||
formWidget->setParent(this, Qt::SubWindow);
|
||||
formWidget->setAutoFillBackground(true);
|
||||
setView(formWidget);
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep)
|
||||
{
|
||||
if (QWidget *focusWidget = QApplication::focusWidget()) {
|
||||
QKeyEvent e(QEvent::KeyPress,code,0,text,autorep);
|
||||
QApplication::sendEvent(focusWidget, &e);
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep)
|
||||
{
|
||||
if (QWidget *focusWidget = QApplication::focusWidget()) {
|
||||
QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep);
|
||||
QApplication::sendEvent(focusWidget, &e);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a checkable action with integer data and
|
||||
// set it checked if it matches the currentState.
|
||||
static inline QAction
|
||||
*createCheckableActionIntData(const QString &label,
|
||||
int actionValue, int currentState,
|
||||
QActionGroup *ag, QObject *parent)
|
||||
{
|
||||
QAction *a = new QAction(label, parent);
|
||||
a->setData(actionValue);
|
||||
a->setCheckable(true);
|
||||
if (actionValue == currentState)
|
||||
a->setChecked(true);
|
||||
ag->addAction(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::slotPopupMenu()
|
||||
{
|
||||
QMenu menu(this);
|
||||
// Create actions
|
||||
if (!m_directionUpAction) {
|
||||
QActionGroup *directionGroup = new QActionGroup(this);
|
||||
connect(directionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotDirection(QAction*)));
|
||||
directionGroup->setExclusive(true);
|
||||
m_directionUpAction = createCheckableActionIntData(tr("&Portrait"), DirectionUp, m_direction, directionGroup, this);
|
||||
//: Rotate form preview counter-clockwise
|
||||
m_directionLeftAction = createCheckableActionIntData(tr("Landscape (&CCW)"), DirectionLeft, m_direction, directionGroup, this);
|
||||
//: Rotate form preview clockwise
|
||||
m_directionRightAction = createCheckableActionIntData(tr("&Landscape (CW)"), DirectionRight, m_direction, directionGroup, this);
|
||||
m_closeAction = new QAction(tr("&Close"), this);
|
||||
connect(m_closeAction, SIGNAL(triggered()), parentWidget(), SLOT(close()));
|
||||
}
|
||||
menu.addAction(m_directionUpAction);
|
||||
menu.addAction(m_directionLeftAction);
|
||||
menu.addAction(m_directionRightAction);
|
||||
menu.addSeparator();
|
||||
populateContextMenu(&menu);
|
||||
menu.addAction(m_closeAction);
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::slotDirection(QAction *a)
|
||||
{
|
||||
const Direction newDirection = static_cast<Direction>(a->data().toInt());
|
||||
if (m_direction == newDirection)
|
||||
return;
|
||||
const Qt::Orientation newOrientation = newDirection == DirectionUp ? Qt::Vertical : Qt::Horizontal;
|
||||
const Qt::Orientation oldOrientation = m_direction == DirectionUp ? Qt::Vertical : Qt::Horizontal;
|
||||
m_direction = newDirection;
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
if (oldOrientation != newOrientation) {
|
||||
QSize size = screenSize();
|
||||
if (newOrientation == Qt::Horizontal)
|
||||
size.transpose();
|
||||
fitWidget(size);
|
||||
}
|
||||
setTransform(skinTransform());
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PreviewDeviceSkin::fitWidget(const QSize &size)
|
||||
{
|
||||
view()->setFixedSize(size);
|
||||
}
|
||||
|
||||
QMatrix PreviewDeviceSkin::skinTransform() const
|
||||
{
|
||||
QMatrix newTransform;
|
||||
switch (m_direction) {
|
||||
case DirectionUp:
|
||||
break;
|
||||
case DirectionLeft:
|
||||
newTransform.rotate(270.0);
|
||||
break;
|
||||
case DirectionRight:
|
||||
newTransform.rotate(90.0);
|
||||
break;
|
||||
}
|
||||
return newTransform;
|
||||
}
|
||||
|
||||
// ------------ PreviewConfigurationPrivate
|
||||
class PreviewConfigurationData : public QSharedData {
|
||||
public:
|
||||
PreviewConfigurationData() {}
|
||||
explicit PreviewConfigurationData(const QString &style, const QString &applicationStyleSheet, const QString &deviceSkin);
|
||||
explicit PreviewConfigurationData(const QString &style, const QString &applicationStyleSheet);
|
||||
|
||||
QString m_style;
|
||||
// Style sheet to prepend (to simulate the effect od QApplication::setSyleSheet()).
|
||||
QString m_applicationStyleSheet;
|
||||
QString m_deviceSkin;
|
||||
};
|
||||
|
||||
PreviewConfigurationData::PreviewConfigurationData(const QString &style, const QString &applicationStyleSheet, const QString &deviceSkin) :
|
||||
PreviewConfigurationData::PreviewConfigurationData(const QString &style, const QString &applicationStyleSheet) :
|
||||
m_style(style),
|
||||
m_applicationStyleSheet(applicationStyleSheet),
|
||||
m_deviceSkin(deviceSkin)
|
||||
m_applicationStyleSheet(applicationStyleSheet)
|
||||
{
|
||||
}
|
||||
|
||||
/* ZoomablePreviewDeviceSkin: A Zoomable Widget Preview skin. Embeds preview
|
||||
* into a ZoomWidget and this in turn into the DeviceSkin view and keeps
|
||||
* Device skin zoom + ZoomWidget zoom in sync. */
|
||||
|
||||
class ZoomablePreviewDeviceSkin : public PreviewDeviceSkin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ZoomablePreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent);
|
||||
virtual void setPreview(QWidget *w);
|
||||
|
||||
int zoomPercent() const; // Device Skins have a double 'zoom' property
|
||||
|
||||
public slots:
|
||||
void setZoomPercent(int);
|
||||
|
||||
signals:
|
||||
void zoomPercentChanged(int);
|
||||
|
||||
protected:
|
||||
virtual void populateContextMenu(QMenu *m);
|
||||
virtual QMatrix skinTransform() const;
|
||||
virtual void fitWidget(const QSize &size);
|
||||
|
||||
private:
|
||||
ZoomMenu *m_zoomMenu;
|
||||
QAction *m_zoomSubMenuAction;
|
||||
ZoomWidget *m_zoomWidget;
|
||||
};
|
||||
|
||||
ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) :
|
||||
PreviewDeviceSkin(parameters, parent),
|
||||
m_zoomMenu(new ZoomMenu(this)),
|
||||
m_zoomSubMenuAction(0),
|
||||
m_zoomWidget(new DesignerZoomWidget)
|
||||
{
|
||||
connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SLOT(setZoomPercent(int)));
|
||||
connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SIGNAL(zoomPercentChanged(int)));
|
||||
m_zoomWidget->setZoomContextMenuEnabled(false);
|
||||
m_zoomWidget->setWidgetZoomContextMenuEnabled(false);
|
||||
m_zoomWidget->resize(screenSize());
|
||||
m_zoomWidget->setParent(this, Qt::SubWindow);
|
||||
m_zoomWidget->setAutoFillBackground(true);
|
||||
setView(m_zoomWidget);
|
||||
}
|
||||
|
||||
static inline qreal zoomFactor(int percent)
|
||||
{
|
||||
return qreal(percent) / 100.0;
|
||||
}
|
||||
|
||||
static inline QSize scaleSize(int zoomPercent, const QSize &size)
|
||||
{
|
||||
return zoomPercent == 100 ? size : (QSizeF(size) * zoomFactor(zoomPercent)).toSize();
|
||||
}
|
||||
|
||||
void ZoomablePreviewDeviceSkin::setPreview(QWidget *formWidget)
|
||||
{
|
||||
m_zoomWidget->setWidget(formWidget);
|
||||
m_zoomWidget->resize(scaleSize(zoomPercent(), screenSize()));
|
||||
}
|
||||
|
||||
int ZoomablePreviewDeviceSkin::zoomPercent() const
|
||||
{
|
||||
return m_zoomWidget->zoom();
|
||||
}
|
||||
|
||||
void ZoomablePreviewDeviceSkin::setZoomPercent(int zp)
|
||||
{
|
||||
if (zp == zoomPercent())
|
||||
return;
|
||||
|
||||
// If not triggered by the menu itself: Update it
|
||||
if (m_zoomMenu->zoom() != zp)
|
||||
m_zoomMenu->setZoom(zp);
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
m_zoomWidget->setZoom(zp);
|
||||
setTransform(skinTransform());
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ZoomablePreviewDeviceSkin::populateContextMenu(QMenu *menu)
|
||||
{
|
||||
if (!m_zoomSubMenuAction) {
|
||||
m_zoomSubMenuAction = new QAction(tr("&Zoom"), this);
|
||||
QMenu *zoomSubMenu = new QMenu;
|
||||
m_zoomSubMenuAction->setMenu(zoomSubMenu);
|
||||
m_zoomMenu->addActions(zoomSubMenu);
|
||||
}
|
||||
menu->addAction(m_zoomSubMenuAction);
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
QMatrix ZoomablePreviewDeviceSkin::skinTransform() const
|
||||
{
|
||||
// Complete transformation consisting of base class rotation and zoom.
|
||||
QMatrix rc = PreviewDeviceSkin::skinTransform();
|
||||
const int zp = zoomPercent();
|
||||
if (zp != 100) {
|
||||
const qreal factor = zoomFactor(zp);
|
||||
rc.scale(factor, factor);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void ZoomablePreviewDeviceSkin::fitWidget(const QSize &size)
|
||||
{
|
||||
m_zoomWidget->resize(scaleSize(zoomPercent(), size));
|
||||
}
|
||||
|
||||
// ------------- PreviewConfiguration
|
||||
|
||||
static const char *styleKey = "Style";
|
||||
static const char *appStyleSheetKey = "AppStyleSheet";
|
||||
static const char *skinKey = "Skin";
|
||||
|
||||
PreviewConfiguration::PreviewConfiguration() :
|
||||
m_d(new PreviewConfigurationData)
|
||||
{
|
||||
}
|
||||
|
||||
PreviewConfiguration::PreviewConfiguration(const QString &sty, const QString &applicationSheet, const QString &skin) :
|
||||
m_d(new PreviewConfigurationData(sty, applicationSheet, skin))
|
||||
PreviewConfiguration::PreviewConfiguration(const QString &sty, const QString &applicationSheet) :
|
||||
m_d(new PreviewConfigurationData(sty, applicationSheet))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -485,7 +195,6 @@ void PreviewConfiguration::clear()
|
|||
PreviewConfigurationData &d = *m_d;
|
||||
d.m_style.clear();
|
||||
d.m_applicationStyleSheet.clear();
|
||||
d.m_deviceSkin.clear();
|
||||
}
|
||||
|
||||
QString PreviewConfiguration::style() const
|
||||
|
@ -509,23 +218,12 @@ void PreviewConfiguration::setApplicationStyleSheet(const QString &as)
|
|||
m_d->m_applicationStyleSheet = as;
|
||||
}
|
||||
|
||||
QString PreviewConfiguration::deviceSkin() const
|
||||
{
|
||||
return m_d->m_deviceSkin;
|
||||
}
|
||||
|
||||
void PreviewConfiguration::setDeviceSkin(const QString &s)
|
||||
{
|
||||
m_d->m_deviceSkin = s;
|
||||
}
|
||||
|
||||
void PreviewConfiguration::toSettings(const QString &prefix, QDesignerSettingsInterface *settings) const
|
||||
{
|
||||
const PreviewConfigurationData &d = *m_d;
|
||||
settings->beginGroup(prefix);
|
||||
settings->setValue(QLatin1String(styleKey), d.m_style);
|
||||
settings->setValue(QLatin1String(appStyleSheetKey), d.m_applicationStyleSheet);
|
||||
settings->setValue(QLatin1String(skinKey), d.m_deviceSkin);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
|
@ -545,9 +243,6 @@ void PreviewConfiguration::fromSettings(const QString &prefix, const QDesignerSe
|
|||
|
||||
key.replace(prefixSize, key.size() - prefixSize, QLatin1String(appStyleSheetKey));
|
||||
d.m_applicationStyleSheet = settings->value(key, emptyString).toString();
|
||||
|
||||
key.replace(prefixSize, key.size() - prefixSize, QLatin1String(skinKey));
|
||||
d.m_deviceSkin = settings->value(key, emptyString).toString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,9 +274,6 @@ public:
|
|||
|
||||
PreviewDataList m_previews;
|
||||
|
||||
typedef QMap<QString, DeviceSkinParameters> DeviceSkinConfigCache;
|
||||
DeviceSkinConfigCache m_deviceSkinConfigCache;
|
||||
|
||||
QDesignerFormEditorInterface *m_core;
|
||||
bool m_updateBlocked;
|
||||
};
|
||||
|
@ -621,11 +313,6 @@ Qt::WindowFlags PreviewManager::previewWindowFlags(const QWidget *widget) const
|
|||
return windowFlags;
|
||||
}
|
||||
|
||||
QWidget *PreviewManager::createDeviceSkinContainer(const QDesignerFormWindowInterface *fw) const
|
||||
{
|
||||
return new QDialog(fw->window());
|
||||
}
|
||||
|
||||
// Some widgets might require fake containers
|
||||
|
||||
static QWidget *fakeContainer(QWidget *w)
|
||||
|
@ -699,56 +386,25 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw,
|
|||
|
||||
// Clear any modality settings, child widget modalities must not be higher than parent's
|
||||
formWidget->setWindowModality(Qt::NonModal);
|
||||
// No skin
|
||||
const QString deviceSkin = pc.deviceSkin();
|
||||
if (deviceSkin.isEmpty()) {
|
||||
if (zoomable) { // Embed into ZoomWidget
|
||||
ZoomWidget *zw = new DesignerZoomWidget;
|
||||
connect(zw->zoomMenu(), SIGNAL(zoomChanged(int)), this, SLOT(slotZoomChanged(int)));
|
||||
zw->setWindowTitle(title);
|
||||
zw->setWidget(formWidget);
|
||||
// Keep any widgets' context menus working, do not use global menu
|
||||
zw->setWidgetZoomContextMenuEnabled(true);
|
||||
zw->setParent(fw->window(), previewWindowFlags(formWidget));
|
||||
// Make preview close when Widget closes (Dialog/accept, etc)
|
||||
formWidget->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(formWidget, SIGNAL(destroyed()), zw, SLOT(close()));
|
||||
zw->setZoom(initialZoom);
|
||||
zw->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true));
|
||||
return zw;
|
||||
}
|
||||
formWidget->setParent(fw->window(), previewWindowFlags(formWidget));
|
||||
formWidget->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true));
|
||||
return formWidget;
|
||||
}
|
||||
// Embed into skin. find config in cache
|
||||
PreviewManagerPrivate::DeviceSkinConfigCache::iterator it = d->m_deviceSkinConfigCache.find(deviceSkin);
|
||||
if (it == d->m_deviceSkinConfigCache.end()) {
|
||||
DeviceSkinParameters parameters;
|
||||
if (!parameters.read(deviceSkin, DeviceSkinParameters::ReadAll, errorMessage)) {
|
||||
formWidget->deleteLater();
|
||||
return 0;
|
||||
}
|
||||
it = d->m_deviceSkinConfigCache.insert(deviceSkin, parameters);
|
||||
}
|
||||
|
||||
QWidget *skinContainer = createDeviceSkinContainer(fw);
|
||||
PreviewDeviceSkin *skin = 0;
|
||||
// Embed into ZoomWidget
|
||||
if (zoomable) {
|
||||
ZoomablePreviewDeviceSkin *zds = new ZoomablePreviewDeviceSkin(it.value(), skinContainer);
|
||||
zds->setZoomPercent(initialZoom);
|
||||
connect(zds, SIGNAL(zoomPercentChanged(int)), this, SLOT(slotZoomChanged(int)));
|
||||
skin = zds;
|
||||
} else {
|
||||
skin = new PreviewDeviceSkin(it.value(), skinContainer);
|
||||
ZoomWidget *zw = new DesignerZoomWidget;
|
||||
connect(zw->zoomMenu(), SIGNAL(zoomChanged(int)), this, SLOT(slotZoomChanged(int)));
|
||||
zw->setWindowTitle(title);
|
||||
zw->setWidget(formWidget);
|
||||
// Keep any widgets' context menus working, do not use global menu
|
||||
zw->setWidgetZoomContextMenuEnabled(true);
|
||||
zw->setParent(fw->window(), previewWindowFlags(formWidget));
|
||||
// Make preview close when Widget closes (Dialog/accept, etc)
|
||||
formWidget->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(formWidget, SIGNAL(destroyed()), zw, SLOT(close()));
|
||||
zw->setZoom(initialZoom);
|
||||
zw->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true));
|
||||
return zw;
|
||||
}
|
||||
skin->setPreview(formWidget);
|
||||
// Make preview close when Widget closes (Dialog/accept, etc)
|
||||
formWidget->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(formWidget, SIGNAL(destroyed()), skinContainer, SLOT(close()));
|
||||
skinContainer->setWindowTitle(title);
|
||||
skinContainer->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true));
|
||||
return skinContainer;
|
||||
formWidget->setParent(fw->window(), previewWindowFlags(formWidget));
|
||||
formWidget->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true));
|
||||
return formWidget;
|
||||
}
|
||||
|
||||
QWidget *PreviewManager::showPreview(const QDesignerFormWindowInterface *fw,
|
||||
|
@ -942,5 +598,4 @@ void PreviewManager::slotZoomChanged(int z)
|
|||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_previewmanager.cpp"
|
||||
#include <moc_previewmanager_p.h>
|
||||
|
|
|
@ -80,8 +80,7 @@ class QDESIGNER_SHARED_EXPORT PreviewConfiguration {
|
|||
public:
|
||||
PreviewConfiguration();
|
||||
explicit PreviewConfiguration(const QString &style,
|
||||
const QString &applicationStyleSheet = QString(),
|
||||
const QString &deviceSkin = QString());
|
||||
const QString &applicationStyleSheet = QString());
|
||||
|
||||
PreviewConfiguration(const PreviewConfiguration&);
|
||||
PreviewConfiguration& operator=(const PreviewConfiguration&);
|
||||
|
@ -94,9 +93,6 @@ public:
|
|||
QString applicationStyleSheet() const;
|
||||
void setApplicationStyleSheet(const QString &);
|
||||
|
||||
QString deviceSkin() const;
|
||||
void setDeviceSkin(const QString &);
|
||||
|
||||
void clear();
|
||||
void toSettings(const QString &prefix, QDesignerSettingsInterface *settings) const;
|
||||
void fromSettings(const QString &prefix, const QDesignerSettingsInterface *settings);
|
||||
|
@ -160,7 +156,6 @@ private slots:
|
|||
private:
|
||||
|
||||
virtual Qt::WindowFlags previewWindowFlags(const QWidget *widget) const;
|
||||
virtual QWidget *createDeviceSkinContainer(const QDesignerFormWindowInterface *) const;
|
||||
|
||||
QWidget *raise(const QDesignerFormWindowInterface *, const PreviewConfiguration &pc);
|
||||
QWidget *createPreview(const QDesignerFormWindowInterface *,
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
set(SHAREDDEVICESKIN_DEFINITIONS)
|
||||
|
||||
set(SHAREDDEVICESKIN_INCLUDES
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/privateinclude
|
||||
${CMAKE_BINARY_DIR}/include/QtCore
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtCore
|
||||
${CMAKE_BINARY_DIR}/include/QtGui
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtGui
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin
|
||||
${CMAKE_BINARY_DIR}/src/shared/deviceskin
|
||||
${CMAKE_BINARY_DIR}/src/shared/deviceskin/skins
|
||||
)
|
||||
|
||||
set(SHAREDDEVICESKIN_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/deviceskin.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/ClamshellPhone.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/SmartPhone2.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/SmartPhone.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/SmartPhoneWithButtons.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/TouchscreenPhone.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/PortableMedia.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/S60-QVGA-Candybar.qrc
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc
|
||||
)
|
||||
|
||||
set(SHAREDDEVICESKIN_HEADERS
|
||||
${CMAKE_SOURCE_DIR}/src/shared/deviceskin/deviceskin.h
|
||||
)
|
||||
|
||||
katie_setup_target(shareddeviceskin ${SHAREDDEVICESKIN_SOURCES} ${SHAREDDEVICESKIN_HEADERS})
|
||||
|
||||
add_library(shareddeviceskin OBJECT ${shareddeviceskin_SOURCES})
|
||||
target_compile_definitions(shareddeviceskin PRIVATE ${SHAREDDEVICESKIN_DEFINITIONS})
|
||||
target_include_directories(shareddeviceskin PRIVATE ${SHAREDDEVICESKIN_INCLUDES})
|
|
@ -1,866 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "deviceskin.h"
|
||||
|
||||
#include <QtCore/qnamespace.h>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QBitmap>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#ifdef TEST_SKIN
|
||||
# include <QtGui/QMainWindow>
|
||||
# include <QtGui/QDialog>
|
||||
# include <QtGui/QDialogButtonBox>
|
||||
# include <QtGui/QHBoxLayout>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace {
|
||||
enum { joydistance = 10, key_repeat_period = 50, key_repeat_delay = 500 };
|
||||
enum { debugDeviceSkin = 0 };
|
||||
}
|
||||
|
||||
static void parseRect(const QString &value, QRect *rect) {
|
||||
const QStringList l = value.split(QLatin1Char(' '));
|
||||
rect->setRect(l[0].toInt(), l[1].toInt(), l[2].toInt(), l[3].toInt());
|
||||
}
|
||||
|
||||
static QString msgImageNotLoaded(const QString &f) {
|
||||
return DeviceSkin::tr("The image file '%1' could not be loaded.").arg(f);
|
||||
}
|
||||
|
||||
// ------------ DeviceSkinButtonArea
|
||||
DeviceSkinButtonArea::DeviceSkinButtonArea() :
|
||||
keyCode(0),
|
||||
activeWhenClosed(0)
|
||||
{
|
||||
}
|
||||
|
||||
QDebug &operator<<(QDebug &str, const DeviceSkinButtonArea &a)
|
||||
{
|
||||
|
||||
str << "Area: " << a.name << " keyCode=" << a.keyCode << " area=" << a.area
|
||||
<< " text=" << a.text << " activeWhenClosed=" << a.activeWhenClosed;
|
||||
return str;
|
||||
}
|
||||
|
||||
// ------------ DeviceSkinParameters
|
||||
|
||||
QDebug operator<<(QDebug str, const DeviceSkinParameters &p)
|
||||
{
|
||||
str << "Images " << p.skinImageUpFileName << ','
|
||||
<< p.skinImageDownFileName<< ',' << p.skinImageClosedFileName
|
||||
<< ',' << p.skinCursorFileName <<"\nScreen: " << p.screenRect
|
||||
<< " back: " << p.backScreenRect << " closed: " << p.closedScreenRect
|
||||
<< " cursor: " << p.cursorHot << " Prefix: " << p.prefix
|
||||
<< " Joystick: " << p.joystick << " MouseHover" << p.hasMouseHover;
|
||||
const int numAreas = p.buttonAreas.size();
|
||||
for (int i = 0; i < numAreas; i++)
|
||||
str << p.buttonAreas[i];
|
||||
return str;
|
||||
}
|
||||
|
||||
QSize DeviceSkinParameters::secondaryScreenSize() const
|
||||
{
|
||||
return backScreenRect.isNull() ? closedScreenRect .size(): backScreenRect.size();
|
||||
}
|
||||
|
||||
bool DeviceSkinParameters::hasSecondaryScreen() const
|
||||
{
|
||||
return secondaryScreenSize() != QSize(0, 0);
|
||||
}
|
||||
|
||||
bool DeviceSkinParameters::read(const QString &skinDirectory, ReadMode rm, QString *errorMessage)
|
||||
{
|
||||
// Figure out the name. remove ending '/' if present
|
||||
QString skinFile = skinDirectory;
|
||||
if (skinFile.endsWith(QLatin1Char('/')))
|
||||
skinFile.truncate(skinFile.length() - 1);
|
||||
|
||||
QFileInfo fi(skinFile);
|
||||
QString fn;
|
||||
if ( fi.isDir() ) {
|
||||
prefix = skinFile;
|
||||
prefix += QLatin1Char('/');
|
||||
fn = prefix;
|
||||
fn += fi.baseName();
|
||||
fn += QLatin1String(".skin");
|
||||
} else if (fi.isFile()){
|
||||
fn = skinFile;
|
||||
prefix = fi.path();
|
||||
prefix += QLatin1Char('/');
|
||||
} else {
|
||||
*errorMessage = DeviceSkin::tr("The skin directory '%1' does not contain a configuration file.").arg(skinDirectory);
|
||||
return false;
|
||||
}
|
||||
QFile f(fn);
|
||||
if (!f.open(QIODevice::ReadOnly )) {
|
||||
*errorMessage = DeviceSkin::tr("The skin configuration file '%1' could not be opened.").arg(fn);
|
||||
return false;
|
||||
}
|
||||
QTextStream ts(&f);
|
||||
const bool rc = read(ts, rm, errorMessage);
|
||||
if (!rc)
|
||||
*errorMessage = DeviceSkin::tr("The skin configuration file '%1' could not be read: %2").arg(fn).arg(*errorMessage);
|
||||
return rc;
|
||||
}
|
||||
bool DeviceSkinParameters::read(QTextStream &ts, ReadMode rm, QString *errorMessage)
|
||||
{
|
||||
QStringList closedAreas;
|
||||
QStringList toggleAreas;
|
||||
QStringList toggleActiveAreas;
|
||||
int nareas = 0;
|
||||
screenDepth = 0;
|
||||
QString mark;
|
||||
ts >> mark;
|
||||
hasMouseHover = true; // historical default
|
||||
if ( mark == QLatin1String("[SkinFile]") ) {
|
||||
const QString UpKey = QLatin1String("Up");
|
||||
const QString DownKey = QLatin1String("Down");
|
||||
const QString ClosedKey = QLatin1String("Closed");
|
||||
const QString ClosedAreasKey = QLatin1String("ClosedAreas");
|
||||
const QString ScreenKey = QLatin1String("Screen");
|
||||
const QString ScreenDepthKey = QLatin1String("ScreenDepth");
|
||||
const QString BackScreenKey = QLatin1String("BackScreen");
|
||||
const QString ClosedScreenKey = QLatin1String("ClosedScreen");
|
||||
const QString CursorKey = QLatin1String("Cursor");
|
||||
const QString AreasKey = QLatin1String("Areas");
|
||||
const QString ToggleAreasKey = QLatin1String("ToggleAreas");
|
||||
const QString ToggleActiveAreasKey = QLatin1String("ToggleActiveAreas");
|
||||
const QString HasMouseHoverKey = QLatin1String("HasMouseHover");
|
||||
// New
|
||||
while (!nareas) {
|
||||
QString line = ts.readLine();
|
||||
if ( line.isNull() )
|
||||
break;
|
||||
if ( line[0] != QLatin1Char('#') && !line.isEmpty() ) {
|
||||
int eq = line.indexOf(QLatin1Char('='));
|
||||
if ( eq >= 0 ) {
|
||||
const QString key = line.left(eq);
|
||||
eq++;
|
||||
while (eq<line.length()-1 && line[eq].isSpace())
|
||||
eq++;
|
||||
const QString value = line.mid(eq);
|
||||
if ( key == UpKey ) {
|
||||
skinImageUpFileName = value;
|
||||
} else if ( key == DownKey ) {
|
||||
skinImageDownFileName = value;
|
||||
} else if ( key == ClosedKey ) {
|
||||
skinImageClosedFileName = value;
|
||||
} else if ( key == ClosedAreasKey ) {
|
||||
closedAreas = value.split(QLatin1Char(' '));
|
||||
} else if ( key == ScreenKey ) {
|
||||
parseRect( value, &screenRect);
|
||||
} else if ( key == ScreenDepthKey ) {
|
||||
screenDepth = value.toInt();
|
||||
} else if ( key == BackScreenKey ) {
|
||||
parseRect(value, &backScreenRect);
|
||||
} else if ( key == ClosedScreenKey ) {
|
||||
parseRect( value, &closedScreenRect );
|
||||
} else if ( key == CursorKey ) {
|
||||
QStringList l = value.split(QLatin1Char(' '));
|
||||
skinCursorFileName = l[0];
|
||||
cursorHot = QPoint(l[1].toInt(),l[2].toInt());
|
||||
} else if ( key == AreasKey ) {
|
||||
nareas = value.toInt();
|
||||
} else if ( key == ToggleAreasKey ) {
|
||||
toggleAreas = value.split(QLatin1Char(' '));
|
||||
} else if ( key == ToggleActiveAreasKey ) {
|
||||
toggleActiveAreas = value.split(QLatin1Char(' '));
|
||||
} else if ( key == HasMouseHoverKey ) {
|
||||
hasMouseHover = value == QLatin1String("true") || value == QLatin1String("1");
|
||||
}
|
||||
} else {
|
||||
*errorMessage = DeviceSkin::tr("Syntax error: %1").arg(line);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Old
|
||||
skinImageUpFileName = mark;
|
||||
QString s;
|
||||
int x,y,w,h,na;
|
||||
ts >> s >> x >> y >> w >> h >> na;
|
||||
skinImageDownFileName = s;
|
||||
screenRect.setRect(x, y, w, h);
|
||||
nareas = na;
|
||||
}
|
||||
// Done for short mode
|
||||
if (rm == ReadSizeOnly)
|
||||
return true;
|
||||
// verify skin files exist
|
||||
skinImageUpFileName.insert(0, prefix);
|
||||
if (!QFile(skinImageUpFileName).exists()) {
|
||||
*errorMessage = DeviceSkin::tr("The skin \"up\" image file '%1' does not exist.").arg(skinImageUpFileName);
|
||||
return false;
|
||||
}
|
||||
if (!skinImageUp.load(skinImageUpFileName)) {
|
||||
*errorMessage = msgImageNotLoaded(skinImageUpFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
skinImageDownFileName.insert(0, prefix);
|
||||
if (!QFile(skinImageDownFileName).exists()) {
|
||||
*errorMessage = DeviceSkin::tr("The skin \"down\" image file '%1' does not exist.").arg(skinImageDownFileName);
|
||||
return false;
|
||||
}
|
||||
if (!skinImageDown.load(skinImageDownFileName)) {
|
||||
*errorMessage = msgImageNotLoaded(skinImageDownFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!skinImageClosedFileName.isEmpty()) {
|
||||
skinImageClosedFileName.insert(0, prefix);
|
||||
if (!QFile(skinImageClosedFileName).exists()) {
|
||||
*errorMessage = DeviceSkin::tr("The skin \"closed\" image file '%1' does not exist.").arg(skinImageClosedFileName);
|
||||
return false;
|
||||
}
|
||||
if (!skinImageClosed.load(skinImageClosedFileName)) {
|
||||
*errorMessage = msgImageNotLoaded(skinImageClosedFileName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skinCursorFileName.isEmpty()) {
|
||||
skinCursorFileName.insert(0, prefix);
|
||||
if (!QFile(skinCursorFileName).exists()) {
|
||||
*errorMessage = DeviceSkin::tr("The skin cursor image file '%1' does not exist.").arg(skinCursorFileName);
|
||||
return false;
|
||||
}
|
||||
if (!skinCursor.load(skinCursorFileName)) {
|
||||
*errorMessage = msgImageNotLoaded(skinCursorFileName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read areas
|
||||
if (!nareas)
|
||||
return true;
|
||||
buttonAreas.reserve(nareas);
|
||||
|
||||
int i = 0;
|
||||
ts.readLine(); // eol
|
||||
joystick = -1;
|
||||
const QString Joystick = QLatin1String("Joystick");
|
||||
while (i < nareas && !ts.atEnd() ) {
|
||||
buttonAreas.push_back(DeviceSkinButtonArea());
|
||||
DeviceSkinButtonArea &area = buttonAreas.back();
|
||||
const QString line = ts.readLine();
|
||||
if ( !line.isEmpty() && line[0] != QLatin1Char('#') ) {
|
||||
const QStringList tok = line.split(QRegExp(QLatin1String("[ \t][ \t]*")));
|
||||
if ( tok.count()<6 ) {
|
||||
*errorMessage = DeviceSkin::tr("Syntax error in area definition: %1").arg(line);
|
||||
return false;
|
||||
} else {
|
||||
area.name = tok[0];
|
||||
QString k = tok[1];
|
||||
if ( k.left(2).toLower() == QLatin1String("0x")) {
|
||||
area.keyCode = k.mid(2).toInt(0,16);
|
||||
} else {
|
||||
area.keyCode = k.toInt();
|
||||
}
|
||||
|
||||
int p=0;
|
||||
for (int j=2; j < tok.count() - 1; ) {
|
||||
const int x = tok[j++].toInt();
|
||||
const int y = tok[j++].toInt();
|
||||
area.area.putPoints(p++,1,x,y);
|
||||
}
|
||||
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
if ( area.name[0] == doubleQuote && area.name.endsWith(doubleQuote)) {
|
||||
area.name.truncate(area.name.size() - 1);
|
||||
area.name.remove(0, 1);
|
||||
}
|
||||
if ( area.name.length() == 1 )
|
||||
area.text = area.name;
|
||||
if ( area.name == Joystick)
|
||||
joystick = i;
|
||||
area.activeWhenClosed = closedAreas.contains(area.name)
|
||||
|| area.keyCode == Qt::Key_Flip; // must be to work
|
||||
area.toggleArea = toggleAreas.contains(area.name);
|
||||
area.toggleActiveArea = toggleActiveAreas.contains(area.name);
|
||||
if ( area.toggleArea )
|
||||
toggleAreaList += i;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != nareas) {
|
||||
qWarning() << DeviceSkin::tr("Mismatch in number of areas, expected %1, got %2.")
|
||||
.arg(nareas).arg(i);
|
||||
}
|
||||
if (debugDeviceSkin)
|
||||
qDebug() << *this;
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------- CursorWindow declaration
|
||||
|
||||
namespace qvfb_internal {
|
||||
|
||||
class CursorWindow : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit CursorWindow(const QImage &cursor, QPoint hot, QWidget *sk);
|
||||
|
||||
void setView(QWidget*);
|
||||
void setPos(QPoint);
|
||||
bool handleMouseEvent(QEvent *ev);
|
||||
|
||||
protected:
|
||||
bool event( QEvent *);
|
||||
bool eventFilter( QObject*, QEvent *);
|
||||
|
||||
private:
|
||||
QWidget *mouseRecipient;
|
||||
QWidget *m_view;
|
||||
QWidget *skin;
|
||||
QPoint hotspot;
|
||||
};
|
||||
}
|
||||
|
||||
// --------- Skin
|
||||
|
||||
DeviceSkin::DeviceSkin(const DeviceSkinParameters ¶meters, QWidget *p ) :
|
||||
QWidget(p),
|
||||
m_parameters(parameters),
|
||||
buttonRegions(parameters.buttonAreas.size(), QRegion()),
|
||||
parent(p),
|
||||
m_view(0),
|
||||
m_secondaryView(0),
|
||||
buttonPressed(false),
|
||||
buttonIndex(0),
|
||||
cursorw(0),
|
||||
joydown(0),
|
||||
t_skinkey(new QTimer(this)),
|
||||
t_parentmove(new QTimer(this)),
|
||||
flipped_open(true)
|
||||
{
|
||||
Q_ASSERT(p);
|
||||
setMouseTracking(true);
|
||||
setAttribute(Qt::WA_NoSystemBackground);
|
||||
|
||||
setZoom(1.0);
|
||||
connect( t_skinkey, SIGNAL(timeout()), this, SLOT(skinKeyRepeat()) );
|
||||
t_parentmove->setSingleShot( true );
|
||||
connect( t_parentmove, SIGNAL(timeout()), this, SLOT(moveParent()) );
|
||||
}
|
||||
|
||||
void DeviceSkin::skinKeyRepeat()
|
||||
{
|
||||
if ( m_view ) {
|
||||
const DeviceSkinButtonArea &area = m_parameters.buttonAreas[buttonIndex];
|
||||
emit skinKeyReleaseEvent( area.keyCode,area.text, true );
|
||||
emit skinKeyPressEvent( area.keyCode, area.text, true );
|
||||
t_skinkey->start(key_repeat_period);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::calcRegions()
|
||||
{
|
||||
const int numAreas = m_parameters.buttonAreas.size();
|
||||
for (int i=0; i<numAreas; i++) {
|
||||
QPolygon xa(m_parameters.buttonAreas[i].area.count());
|
||||
int n = m_parameters.buttonAreas[i].area.count();
|
||||
for (int p=0; p<n; p++) {
|
||||
xa.setPoint(p,transform.map(m_parameters.buttonAreas[i].area[p]));
|
||||
}
|
||||
if ( n == 2 ) {
|
||||
buttonRegions[i] = QRegion(xa.boundingRect());
|
||||
} else {
|
||||
buttonRegions[i] = QRegion(xa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::loadImages()
|
||||
{
|
||||
QImage iup = m_parameters.skinImageUp;
|
||||
QImage idown = m_parameters.skinImageDown;
|
||||
|
||||
QImage iclosed;
|
||||
const bool hasClosedImage = !m_parameters.skinImageClosed.isNull();
|
||||
|
||||
if (hasClosedImage)
|
||||
iclosed = m_parameters.skinImageClosed;
|
||||
QImage icurs;
|
||||
const bool hasCursorImage = !m_parameters.skinCursor.isNull();
|
||||
if (hasCursorImage)
|
||||
icurs = m_parameters.skinCursor;
|
||||
|
||||
if (!transform.isIdentity()) {
|
||||
iup = iup.transformed(transform, Qt::SmoothTransformation);
|
||||
idown = idown.transformed(transform, Qt::SmoothTransformation);
|
||||
if (hasClosedImage)
|
||||
iclosed = iclosed.transformed(transform, Qt::SmoothTransformation);
|
||||
if (hasCursorImage)
|
||||
icurs = icurs.transformed(transform, Qt::SmoothTransformation);
|
||||
}
|
||||
const Qt::ImageConversionFlags conv = Qt::ThresholdAlphaDither|Qt::AvoidDither;
|
||||
skinImageUp = QPixmap::fromImage(iup);
|
||||
skinImageDown = QPixmap::fromImage(idown, conv);
|
||||
if (hasClosedImage)
|
||||
skinImageClosed = QPixmap::fromImage(iclosed, conv);
|
||||
if (hasCursorImage)
|
||||
skinCursor = QPixmap::fromImage(icurs, conv);
|
||||
|
||||
setFixedSize( skinImageUp.size() );
|
||||
if (skinImageUp.mask().isNull())
|
||||
skinImageUp.setMask(skinImageUp.createHeuristicMask());
|
||||
if (skinImageClosed.mask().isNull())
|
||||
skinImageClosed.setMask(skinImageClosed.createHeuristicMask());
|
||||
|
||||
QWidget* parent = parentWidget();
|
||||
parent->setMask( skinImageUp.mask() );
|
||||
parent->setFixedSize( skinImageUp.size() );
|
||||
|
||||
delete cursorw;
|
||||
cursorw = 0;
|
||||
if (hasCursorImage) {
|
||||
cursorw = new qvfb_internal::CursorWindow(m_parameters.skinCursor, m_parameters.cursorHot, this);
|
||||
if ( m_view )
|
||||
cursorw->setView(m_view);
|
||||
}
|
||||
}
|
||||
|
||||
DeviceSkin::~DeviceSkin( )
|
||||
{
|
||||
delete cursorw;
|
||||
}
|
||||
|
||||
void DeviceSkin::setTransform( const QMatrix& wm )
|
||||
{
|
||||
transform = QImage::trueMatrix(wm,m_parameters.skinImageUp.width(),m_parameters.skinImageUp.height());
|
||||
calcRegions();
|
||||
loadImages();
|
||||
if ( m_view ) {
|
||||
QPoint p = transform.map(QPolygon(m_parameters.screenRect)).boundingRect().topLeft();
|
||||
m_view->move(p);
|
||||
}
|
||||
updateSecondaryScreen();
|
||||
}
|
||||
|
||||
void DeviceSkin::setZoom( double z )
|
||||
{
|
||||
setTransform(QMatrix().scale(z,z));
|
||||
}
|
||||
|
||||
void DeviceSkin::updateSecondaryScreen()
|
||||
{
|
||||
if (!m_secondaryView)
|
||||
return;
|
||||
if (flipped_open) {
|
||||
if (m_parameters.backScreenRect.isNull()) {
|
||||
m_secondaryView->hide();
|
||||
} else {
|
||||
m_secondaryView->move(transform.map(QPolygon(m_parameters.backScreenRect)).boundingRect().topLeft());
|
||||
m_secondaryView->show();
|
||||
}
|
||||
} else {
|
||||
if (m_parameters.closedScreenRect.isNull()) {
|
||||
m_secondaryView->hide();
|
||||
} else {
|
||||
m_secondaryView->move(transform.map(QPolygon(m_parameters.closedScreenRect)).boundingRect().topLeft());
|
||||
m_secondaryView->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::setView( QWidget *v )
|
||||
{
|
||||
m_view = v;
|
||||
m_view->setFocus();
|
||||
m_view->move(transform.map(QPolygon(m_parameters.screenRect)).boundingRect().topLeft());
|
||||
if ( cursorw )
|
||||
cursorw->setView(v);
|
||||
}
|
||||
|
||||
void DeviceSkin::setSecondaryView( QWidget *v )
|
||||
{
|
||||
m_secondaryView = v;
|
||||
updateSecondaryScreen();
|
||||
}
|
||||
|
||||
void DeviceSkin::paintEvent( QPaintEvent *)
|
||||
{
|
||||
QPainter p( this );
|
||||
if ( flipped_open ) {
|
||||
p.drawPixmap( 0, 0, skinImageUp );
|
||||
} else {
|
||||
p.drawPixmap( 0, 0, skinImageClosed );
|
||||
}
|
||||
QList<int> toDraw;
|
||||
if ( buttonPressed == true ) {
|
||||
toDraw += buttonIndex;
|
||||
}
|
||||
foreach (int toggle, m_parameters.toggleAreaList) {
|
||||
const DeviceSkinButtonArea &ba = m_parameters.buttonAreas[toggle];
|
||||
if ( flipped_open || ba.activeWhenClosed ) {
|
||||
if ( ba.toggleArea && ba.toggleActiveArea )
|
||||
toDraw += toggle;
|
||||
}
|
||||
}
|
||||
foreach (int button, toDraw ) {
|
||||
const DeviceSkinButtonArea &ba = m_parameters.buttonAreas[button];
|
||||
const QRect r = buttonRegions[button].boundingRect();
|
||||
if ( ba.area.count() > 2 )
|
||||
p.setClipRegion(buttonRegions[button]);
|
||||
p.drawPixmap( r.topLeft(), skinImageDown, r);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::mousePressEvent( QMouseEvent *e )
|
||||
{
|
||||
if (e->button() == Qt::RightButton) {
|
||||
emit popupMenu();
|
||||
} else {
|
||||
buttonPressed = false;
|
||||
|
||||
onjoyrelease = -1;
|
||||
const int numAreas = m_parameters.buttonAreas.size();
|
||||
for (int i = 0; i < numAreas ; i++) {
|
||||
const DeviceSkinButtonArea &ba = m_parameters.buttonAreas[i];
|
||||
if ( buttonRegions[i].contains( e->pos() ) ) {
|
||||
if ( flipped_open || ba.activeWhenClosed ) {
|
||||
if ( m_parameters.joystick == i ) {
|
||||
joydown = true;
|
||||
} else {
|
||||
if ( joydown )
|
||||
onjoyrelease = i;
|
||||
else
|
||||
startPress(i);
|
||||
break;
|
||||
if (debugDeviceSkin)// Debug message to be sure we are clicking the right areas
|
||||
qDebug()<< m_parameters.buttonAreas[i].name << " clicked";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clickPos = e->pos();
|
||||
// This is handy for finding the areas to define rectangles for new skins
|
||||
if (debugDeviceSkin)
|
||||
qDebug()<< "Clicked in " << e->pos().x() << ',' << e->pos().y();
|
||||
clickPos = e->pos();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::flip(bool open)
|
||||
{
|
||||
if ( flipped_open == open )
|
||||
return;
|
||||
if ( open ) {
|
||||
parent->setMask( skinImageUp.mask() );
|
||||
emit skinKeyReleaseEvent( Qt::Key(Qt::Key_Flip), QString(), false);
|
||||
} else {
|
||||
parent->setMask( skinImageClosed.mask() );
|
||||
emit skinKeyPressEvent( Qt::Key(Qt::Key_Flip), QString(), false);
|
||||
}
|
||||
flipped_open = open;
|
||||
updateSecondaryScreen();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void DeviceSkin::startPress(int i)
|
||||
{
|
||||
buttonPressed = true;
|
||||
buttonIndex = i;
|
||||
if (m_view) {
|
||||
const DeviceSkinButtonArea &ba = m_parameters.buttonAreas[buttonIndex];
|
||||
if ( ba.keyCode == Qt::Key_Flip ) {
|
||||
flip(!flipped_open);
|
||||
} else if ( ba.toggleArea ) {
|
||||
bool active = !ba.toggleActiveArea;
|
||||
const_cast<DeviceSkinButtonArea &>(ba).toggleActiveArea = active;
|
||||
if ( active )
|
||||
emit skinKeyPressEvent( ba.keyCode, ba.text, false);
|
||||
else
|
||||
emit skinKeyReleaseEvent( ba.keyCode, ba.text, false);
|
||||
} else {
|
||||
emit skinKeyPressEvent( ba.keyCode, ba.text, false);
|
||||
t_skinkey->start(key_repeat_delay);
|
||||
}
|
||||
repaint( buttonRegions[buttonIndex].boundingRect() );
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSkin::endPress()
|
||||
{
|
||||
const DeviceSkinButtonArea &ba = m_parameters.buttonAreas[buttonIndex];
|
||||
if (m_view && ba.keyCode != Qt::Key_Flip && !ba.toggleArea )
|
||||
emit skinKeyReleaseEvent(ba.keyCode, ba.text, false );
|
||||
t_skinkey->stop();
|
||||
buttonPressed = false;
|
||||
repaint( buttonRegions[buttonIndex].boundingRect() );
|
||||
}
|
||||
|
||||
void DeviceSkin::mouseMoveEvent( QMouseEvent *e )
|
||||
{
|
||||
if ( e->buttons() & Qt::LeftButton ) {
|
||||
const int joystick = m_parameters.joystick;
|
||||
QPoint newpos = e->globalPos() - clickPos;
|
||||
if ( joydown ) {
|
||||
int k1=0, k2=0;
|
||||
if ( newpos.x() < -joydistance ) {
|
||||
k1 = joystick+1;
|
||||
} else if ( newpos.x() > +joydistance ) {
|
||||
k1 = joystick+3;
|
||||
}
|
||||
if ( newpos.y() < -joydistance ) {
|
||||
k2 = joystick+2;
|
||||
} else if ( newpos.y() > +joydistance ) {
|
||||
k2 = joystick+4;
|
||||
}
|
||||
if ( k1 || k2 ) {
|
||||
if ( !buttonPressed ) {
|
||||
onjoyrelease = -1;
|
||||
if ( k1 && k2 ) {
|
||||
startPress(k2);
|
||||
endPress();
|
||||
}
|
||||
startPress(k1 ? k1 : k2);
|
||||
}
|
||||
} else if ( buttonPressed ) {
|
||||
endPress();
|
||||
}
|
||||
} else if ( buttonPressed == false ) {
|
||||
parentpos = newpos;
|
||||
if ( !t_parentmove->isActive() )
|
||||
t_parentmove->start(50);
|
||||
}
|
||||
}
|
||||
if ( cursorw )
|
||||
cursorw->setPos(e->globalPos());
|
||||
}
|
||||
|
||||
void DeviceSkin::moveParent()
|
||||
{
|
||||
parent->move( parentpos );
|
||||
}
|
||||
|
||||
void DeviceSkin::mouseReleaseEvent( QMouseEvent * )
|
||||
{
|
||||
if ( buttonPressed )
|
||||
endPress();
|
||||
if ( joydown ) {
|
||||
joydown = false;
|
||||
if ( onjoyrelease >= 0 ) {
|
||||
startPress(onjoyrelease);
|
||||
endPress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceSkin::hasCursor() const
|
||||
{
|
||||
return !skinCursor.isNull();
|
||||
}
|
||||
|
||||
// ------------------ CursorWindow implementation
|
||||
|
||||
namespace qvfb_internal {
|
||||
|
||||
bool CursorWindow::eventFilter( QObject *, QEvent *ev)
|
||||
{
|
||||
handleMouseEvent(ev);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CursorWindow::event( QEvent *ev )
|
||||
{
|
||||
if (handleMouseEvent(ev))
|
||||
return true;
|
||||
return QWidget::event(ev);
|
||||
}
|
||||
|
||||
bool CursorWindow::handleMouseEvent(QEvent *ev)
|
||||
{
|
||||
bool handledEvent = false;
|
||||
static int inhere=0;
|
||||
if ( !inhere ) {
|
||||
inhere++;
|
||||
if ( m_view ) {
|
||||
if ( ev->type() >= QEvent::MouseButtonPress && ev->type() <= QEvent::MouseMove ) {
|
||||
QMouseEvent *e = (QMouseEvent*)ev;
|
||||
QPoint gp = e->globalPos();
|
||||
QPoint vp = m_view->mapFromGlobal(gp);
|
||||
QPoint sp = skin->mapFromGlobal(gp);
|
||||
if ( e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick ) {
|
||||
if ( m_view->rect().contains(vp) )
|
||||
mouseRecipient = m_view;
|
||||
else if ( skin->parentWidget()->geometry().contains(gp) )
|
||||
mouseRecipient = skin;
|
||||
else
|
||||
mouseRecipient = 0;
|
||||
}
|
||||
if ( mouseRecipient ) {
|
||||
setPos(gp);
|
||||
QMouseEvent me(e->type(),mouseRecipient==skin ? sp : vp,gp,e->button(),e->buttons(),e->modifiers());
|
||||
QApplication::sendEvent(mouseRecipient, &me);
|
||||
} else if ( !skin->parentWidget()->geometry().contains(gp) ) {
|
||||
hide();
|
||||
} else {
|
||||
setPos(gp);
|
||||
}
|
||||
if ( e->type() == QEvent::MouseButtonRelease )
|
||||
mouseRecipient = 0;
|
||||
handledEvent = true;
|
||||
}
|
||||
}
|
||||
inhere--;
|
||||
}
|
||||
return handledEvent;
|
||||
}
|
||||
|
||||
void CursorWindow::setView(QWidget* v)
|
||||
{
|
||||
if ( m_view ) {
|
||||
m_view->removeEventFilter(this);
|
||||
m_view->removeEventFilter(this);
|
||||
}
|
||||
m_view = v;
|
||||
m_view->installEventFilter(this);
|
||||
m_view->installEventFilter(this);
|
||||
mouseRecipient = 0;
|
||||
}
|
||||
|
||||
CursorWindow::CursorWindow(const QImage &img, QPoint hot, QWidget* sk)
|
||||
:QWidget(0),
|
||||
m_view(0), skin(sk),
|
||||
hotspot(hot)
|
||||
{
|
||||
setWindowFlags( Qt::FramelessWindowHint );
|
||||
mouseRecipient = 0;
|
||||
setMouseTracking(true);
|
||||
#ifndef QT_NO_CURSOR
|
||||
setCursor(Qt::BlankCursor);
|
||||
#endif
|
||||
QPixmap p;
|
||||
p = QPixmap::fromImage(img);
|
||||
if (p.mask().isNull()) {
|
||||
if ( img.hasAlphaChannel() ) {
|
||||
QBitmap bm;
|
||||
bm = QPixmap::fromImage(img.createAlphaMask());
|
||||
p.setMask( bm );
|
||||
} else {
|
||||
QBitmap bm;
|
||||
bm = QPixmap::fromImage(img.createHeuristicMask());
|
||||
p.setMask( bm );
|
||||
}
|
||||
}
|
||||
QPalette palette;
|
||||
palette.setBrush(backgroundRole(), QBrush(p));
|
||||
setPalette(palette);
|
||||
setFixedSize( p.size() );
|
||||
if ( !p.mask().isNull() )
|
||||
setMask( p.mask() );
|
||||
}
|
||||
|
||||
void CursorWindow::setPos(QPoint p)
|
||||
{
|
||||
move(p-hotspot);
|
||||
show();
|
||||
raise();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TEST_SKIN
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
if (argc < 1)
|
||||
return 1;
|
||||
const QString skinFile = QString::fromUtf8(argv[1]);
|
||||
QApplication app(argc,argv);
|
||||
QMainWindow mw;
|
||||
|
||||
DeviceSkinParameters params;
|
||||
QString errorMessage;
|
||||
if (!params.read(skinFile, DeviceSkinParameters::ReadAll, &errorMessage)) {
|
||||
qWarning() << errorMessage;
|
||||
return 1;
|
||||
}
|
||||
DeviceSkin ds(params, &mw);
|
||||
// View Dialog
|
||||
QDialog *dialog = new QDialog();
|
||||
QHBoxLayout *dialogLayout = new QHBoxLayout();
|
||||
dialog->setLayout(dialogLayout);
|
||||
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
QObject::connect(dialogButtonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
QObject::connect(dialogButtonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||
dialogLayout->addWidget(dialogButtonBox);
|
||||
dialog->setFixedSize(params.screenSize());
|
||||
dialog->setParent(&ds, Qt::SubWindow);
|
||||
dialog->setAutoFillBackground(true);
|
||||
ds.setView(dialog);
|
||||
|
||||
QObject::connect(&ds, SIGNAL(popupMenu()), &mw, SLOT(close()));
|
||||
QObject::connect(&ds, SIGNAL(skinKeyPressEvent(int,QString,bool)), &mw, SLOT(close()));
|
||||
mw.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_deviceskin.h"
|
||||
#include "qrc_ClamshellPhone.cpp"
|
||||
#include "qrc_PortableMedia.cpp"
|
||||
#include "qrc_S60-nHD-Touchscreen.cpp"
|
||||
#include "qrc_S60-QVGA-Candybar.cpp"
|
||||
#include "qrc_SmartPhone.cpp"
|
||||
#include "qrc_SmartPhone2.cpp"
|
||||
#include "qrc_SmartPhoneWithButtons.cpp"
|
||||
#include "qrc_TouchscreenPhone.cpp"
|
|
@ -1,174 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef SKIN_H
|
||||
#define SKIN_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QPolygon>
|
||||
#include <QtGui/QRegion>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace qvfb_internal {
|
||||
class CursorWindow;
|
||||
}
|
||||
|
||||
class QTextStream;
|
||||
|
||||
// ------- Button Area
|
||||
struct DeviceSkinButtonArea {
|
||||
DeviceSkinButtonArea();
|
||||
QString name;
|
||||
int keyCode;
|
||||
QPolygon area;
|
||||
QString text;
|
||||
bool activeWhenClosed;
|
||||
bool toggleArea;
|
||||
bool toggleActiveArea;
|
||||
};
|
||||
|
||||
// -------- Parameters
|
||||
struct DeviceSkinParameters {
|
||||
enum ReadMode { ReadAll, ReadSizeOnly };
|
||||
bool read(const QString &skinDirectory, ReadMode rm, QString *errorMessage);
|
||||
bool read(QTextStream &ts, ReadMode rm, QString *errorMessage);
|
||||
|
||||
QSize screenSize() const { return screenRect.size(); }
|
||||
QSize secondaryScreenSize() const;
|
||||
bool hasSecondaryScreen() const;
|
||||
|
||||
QString skinImageUpFileName;
|
||||
QString skinImageDownFileName;
|
||||
QString skinImageClosedFileName;
|
||||
QString skinCursorFileName;
|
||||
|
||||
QImage skinImageUp;
|
||||
QImage skinImageDown;
|
||||
QImage skinImageClosed;
|
||||
QImage skinCursor;
|
||||
|
||||
QRect screenRect;
|
||||
QRect backScreenRect;
|
||||
QRect closedScreenRect;
|
||||
int screenDepth;
|
||||
QPoint cursorHot;
|
||||
QVector<DeviceSkinButtonArea> buttonAreas;
|
||||
QList<int> toggleAreaList;
|
||||
|
||||
int joystick;
|
||||
QString prefix;
|
||||
bool hasMouseHover;
|
||||
};
|
||||
|
||||
// --------- Skin Widget
|
||||
class DeviceSkin : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DeviceSkin(const DeviceSkinParameters ¶meters, QWidget *p );
|
||||
~DeviceSkin( );
|
||||
|
||||
QWidget *view() const { return m_view; }
|
||||
void setView( QWidget *v );
|
||||
|
||||
QWidget *secondaryView() const { return m_secondaryView; }
|
||||
void setSecondaryView( QWidget *v );
|
||||
|
||||
void setZoom( double );
|
||||
void setTransform( const QMatrix& );
|
||||
|
||||
bool hasCursor() const;
|
||||
|
||||
QString prefix() const {return m_parameters.prefix;}
|
||||
|
||||
signals:
|
||||
void popupMenu();
|
||||
void skinKeyPressEvent(int code, const QString& text, bool autorep);
|
||||
void skinKeyReleaseEvent(int code, const QString& text, bool autorep);
|
||||
|
||||
protected slots:
|
||||
void skinKeyRepeat();
|
||||
void moveParent();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent( QPaintEvent * );
|
||||
virtual void mousePressEvent( QMouseEvent *e );
|
||||
virtual void mouseMoveEvent( QMouseEvent *e );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * );
|
||||
|
||||
private:
|
||||
void calcRegions();
|
||||
void flip(bool open);
|
||||
void updateSecondaryScreen();
|
||||
void loadImages();
|
||||
void startPress(int);
|
||||
void endPress();
|
||||
|
||||
const DeviceSkinParameters m_parameters;
|
||||
QVector<QRegion> buttonRegions;
|
||||
QPixmap skinImageUp;
|
||||
QPixmap skinImageDown;
|
||||
QPixmap skinImageClosed;
|
||||
QPixmap skinCursor;
|
||||
QWidget *parent;
|
||||
QWidget *m_view;
|
||||
QWidget *m_secondaryView;
|
||||
QPoint parentpos;
|
||||
QPoint clickPos;
|
||||
bool buttonPressed;
|
||||
int buttonIndex;
|
||||
QMatrix transform;
|
||||
qvfb_internal::CursorWindow *cursorw;
|
||||
|
||||
bool joydown;
|
||||
QTimer *t_skinkey;
|
||||
QTimer *t_parentmove;
|
||||
int onjoyrelease;
|
||||
|
||||
bool flipped_open;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>ClamshellPhone.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,30 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=ClamshellPhone1-5.png
|
||||
Down=ClamshellPhone1-5-pressed.png
|
||||
Closed=ClamshellPhone1-5-closed.png
|
||||
Screen=72 84 176 208
|
||||
Areas=22
|
||||
HasMouseHover=false
|
||||
|
||||
"Power" 0x0100000a 205 563 249 586
|
||||
"1" 0x0031 62 414 119 438
|
||||
"2" 0x0032 130 414 189 438
|
||||
"3" 0x0033 198 413 257 438
|
||||
"4" 0x0034 54 444 117 470
|
||||
"5" 0x0035 128 444 189 471
|
||||
"6" 0x0036 202 444 264 471
|
||||
"7" 0x0037 47 477 113 507
|
||||
"8" 0x0038 126 477 190 507
|
||||
"9" 0x0039 205 478 270 509
|
||||
"*" 0x002a 39 515 110 552
|
||||
"0" 0x0030 122 515 195 553
|
||||
"#" 0x0023 207 516 280 553
|
||||
"Context1" 0x01100000 137 360 108 383 123 410 90 409 60 387 63 378 100 362
|
||||
"Back" 0x01000061 184 361 206 376 213 387 197 410 226 410 256 392 258 381 244 369
|
||||
"Backspace" 0x01000003 68 563 113 587
|
||||
"Select" 0x01010000 160 391 172 390 181 386 184 381 180 377 173 373 165 372 155 372 145 375 138 378 136 382 138 387 147 390
|
||||
"Left" 0x1000012 141 390 136 385 136 381 143 375 132 371 120 380 121 393 129 401
|
||||
"Down" 0x1000015 143 389 130 402 162 412 191 404 175 390
|
||||
"Right" 0x1000014 186 370 176 375 184 382 182 387 175 390 190 404 201 396 202 375
|
||||
"Up" 0x1000013 133 370 143 374 176 374 185 370 169 362 149 362
|
||||
"Flip" 0x01100006 98 325 225 353
|
|
@ -1,78 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/datebook.desktop
|
||||
3=Applications
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Games
|
||||
7=Settings/Beaming.desktop
|
||||
8=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
9=Settings
|
||||
*=Applications/mediarecorder.desktop
|
||||
0=Applications/todolist.desktop
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
Key3=Flip
|
||||
Key4=Backspace
|
||||
[TextButtons]
|
||||
Buttons=0123456789*#
|
||||
Hold0='0
|
||||
Hold1='1
|
||||
Hold2='2
|
||||
Hold3='3
|
||||
Hold4='4
|
||||
Hold5='5
|
||||
Hold6='6
|
||||
Hold7='7
|
||||
Hold8='8
|
||||
Hold9='9
|
||||
Hold*=symbol
|
||||
Hold#=mode
|
||||
Tap0=space
|
||||
Tap1="\".,'?!-@:1"
|
||||
Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32"
|
||||
Tap3="\"de\xe8\xe9\xea\x66\x33"
|
||||
Tap4="\"ghi\xec\xed\xee\x34"
|
||||
Tap5="\"jkl5"
|
||||
Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36"
|
||||
Tap7="\"pqrs\xdf\x37"
|
||||
Tap8="\"tu\xfc\xf9\xfav8"
|
||||
Tap9="\"wxyz9"
|
||||
Tap*=modify
|
||||
Tap#=shift
|
||||
[LocaleTextButtons]
|
||||
Buttons=23456789
|
||||
Tap2[]='abc
|
||||
Tap3[]='def
|
||||
Tap4[]='ghi
|
||||
Tap5[]='jkl
|
||||
Tap6[]='mno
|
||||
Tap7[]='pqrs
|
||||
Tap8[]='tuv
|
||||
Tap9[]='wxyz
|
||||
[PhoneTextButtons]
|
||||
Buttons=*#
|
||||
Tap*='*+pw
|
||||
Hold*=+
|
||||
Tap#=#
|
||||
Hold#=mode
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>PortableMedia.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,14 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=portablemedia.png
|
||||
Down=portablemedia-pressed.png
|
||||
Screen=18 20 480 272
|
||||
Areas=7
|
||||
HasMouseHover=false
|
||||
|
||||
"Context1" 0x01100000 530 192 565 223
|
||||
"Back" 0x01000061 530 138 565 173
|
||||
"Select" 0x01010000 530 65 565 98
|
||||
"Left" 0x1000012 529 67 519 57 511 65 511 104 519 110 529 100 529 98
|
||||
"Down" 0x1000015 530 102 520 111 529 120 569 120 577 114 566 103 564 103
|
||||
"Right" 0x1000014 565 65 576 52 585 67 585 102 578 113 567 104
|
||||
"Up" 0x1000013 530 65 519 55 528 48 567 48 573 51 564 66
|
|
@ -1,23 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Map=123
|
||||
Default=1
|
||||
1=Applications/mediaplayer.desktop
|
||||
2=Applications/photoedit.desktop
|
||||
3=Settings
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>S60-QVGA-Candybar.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,15 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=S60-QVGA-Candybar.png
|
||||
Down=S60-QVGA-Candybar-down.png
|
||||
Screen=61 93 240 320
|
||||
Areas=7
|
||||
HasMouseHover=false
|
||||
|
||||
|
||||
"Context1" 0x01100000 54 469 151 469 140 483 88 485 81 496 54 498
|
||||
"Back" 0x01000061 211 468 307 467 307 498 278 497 219 486
|
||||
"Select" 0x01010000 165 491 196 522
|
||||
"Left" 0x1000012 149 474 166 492 163 519 143 538 142 481
|
||||
"Down" 0x1000015 164 521 195 522 212 539 204 545 154 544 145 536
|
||||
"Right" 0x1000014 214 475 219 487 219 528 212 539 196 522 197 492
|
||||
"Up" 0x1000013 150 474 156 467 209 467 213 476 197 489 165 489
|
|
@ -1,78 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/datebook.desktop
|
||||
3=Applications
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Games
|
||||
7=Settings/Beaming.desktop
|
||||
8=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
9=Settings
|
||||
*=Applications/mediarecorder.desktop
|
||||
0=Applications/todolist.desktop
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
Key3=Flip
|
||||
Key4=Backspace
|
||||
[TextButtons]
|
||||
Buttons=0123456789*#
|
||||
Hold0='0
|
||||
Hold1='1
|
||||
Hold2='2
|
||||
Hold3='3
|
||||
Hold4='4
|
||||
Hold5='5
|
||||
Hold6='6
|
||||
Hold7='7
|
||||
Hold8='8
|
||||
Hold9='9
|
||||
Hold*=symbol
|
||||
Hold#=mode
|
||||
Tap0=space
|
||||
Tap1="\".,'?!-@:1"
|
||||
Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32"
|
||||
Tap3="\"de\xe8\xe9\xea\x66\x33"
|
||||
Tap4="\"ghi\xec\xed\xee\x34"
|
||||
Tap5="\"jkl5"
|
||||
Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36"
|
||||
Tap7="\"pqrs\xdf\x37"
|
||||
Tap8="\"tu\xfc\xf9\xfav8"
|
||||
Tap9="\"wxyz9"
|
||||
Tap*=modify
|
||||
Tap#=shift
|
||||
[LocaleTextButtons]
|
||||
Buttons=23456789
|
||||
Tap2[]='abc
|
||||
Tap3[]='def
|
||||
Tap4[]='ghi
|
||||
Tap5[]='jkl
|
||||
Tap6[]='mno
|
||||
Tap7[]='pqrs
|
||||
Tap8[]='tuv
|
||||
Tap9[]='wxyz
|
||||
[PhoneTextButtons]
|
||||
Buttons=*#
|
||||
Tap*='*+pw
|
||||
Hold*=+
|
||||
Tap#=#
|
||||
Hold#=mode
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>S60-nHD-Touchscreen.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,10 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=S60-nHD-Touchscreen.png
|
||||
Down=S60-nHD-Touchscreen-down.png
|
||||
Screen=53 183 360 640
|
||||
Areas=3
|
||||
HasMouseHover=false
|
||||
|
||||
"Call" 0x01100004 76 874 171 899
|
||||
"Hangup" 0x01100005 300 876 393 899
|
||||
"Home" 0x1000010 174 878 298 899
|
|
@ -1,53 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/mediaplayer.desktop
|
||||
3=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Applications/datebook.desktop
|
||||
7=Games
|
||||
8=Settings/beaming.desktop
|
||||
9=Applications/todolist.desktop
|
||||
*=Settings
|
||||
0=Applications
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Back
|
||||
Key2=Select
|
||||
Key3=Call
|
||||
Key4=Hangup
|
||||
[Device]
|
||||
PrimaryInput=Touchscreen
|
||||
[Button]
|
||||
Count=2
|
||||
[Button0]
|
||||
Name[]=Home Button
|
||||
Key=Home
|
||||
PressedActionMappable=0
|
||||
PressedActionService=TaskManager
|
||||
PressedActionMessage=multitask()
|
||||
HeldActionMappable=0
|
||||
HeldActionService=TaskManager
|
||||
HeldActionMessage=showRunningTasks()
|
||||
[Button1]
|
||||
Name=Power Button
|
||||
Key=Hangup
|
||||
HeldActionService=Launcher
|
||||
HeldActionMessage=execute(QString)
|
||||
HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n)
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>SmartPhone.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,28 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=SmartPhone.png
|
||||
Down=SmartPhone-pressed.png
|
||||
Screen=90 107 176 208
|
||||
Areas=21
|
||||
HasMouseHover=false
|
||||
|
||||
"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454
|
||||
"2" 0x0032 153 467 202 492
|
||||
"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453
|
||||
"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487
|
||||
"5" 0x0035 153 499 202 524
|
||||
"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485
|
||||
"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519
|
||||
"8" 0x0038 153 531 202 556
|
||||
"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517
|
||||
"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551
|
||||
"0" 0x0030 153 564 202 589
|
||||
"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550
|
||||
"Call" 0x01100004 88 395 130 439
|
||||
"Hangup" 0x01100005 227 395 269 439
|
||||
"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318
|
||||
"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318
|
||||
"Select" 0x01010000 160 338 195 371
|
||||
"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369
|
||||
"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374
|
||||
"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375
|
||||
"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337
|
|
@ -1,78 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/datebook.desktop
|
||||
3=Applications
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Games
|
||||
7=Settings/Beaming.desktop
|
||||
8=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
9=Settings
|
||||
*=Applications/mediarecorder.desktop
|
||||
0=Applications/todolist.desktop
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
Key3=Call
|
||||
Key4=Hangup
|
||||
[TextButtons]
|
||||
Buttons=0123456789*#
|
||||
Hold0='0
|
||||
Hold1='1
|
||||
Hold2='2
|
||||
Hold3='3
|
||||
Hold4='4
|
||||
Hold5='5
|
||||
Hold6='6
|
||||
Hold7='7
|
||||
Hold8='8
|
||||
Hold9='9
|
||||
Hold*=symbol
|
||||
Hold#=mode
|
||||
Tap0=space
|
||||
Tap1="\".,'?!-@:1"
|
||||
Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32"
|
||||
Tap3="\"de\xe8\xe9\xea\x66\x33"
|
||||
Tap4="\"ghi\xec\xed\xee\x34"
|
||||
Tap5="\"jkl5"
|
||||
Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36"
|
||||
Tap7="\"pqrs\xdf\x37"
|
||||
Tap8="\"tu\xfc\xf9\xfav8"
|
||||
Tap9="\"wxyz9"
|
||||
Tap*=modify
|
||||
Tap#=shift
|
||||
[LocaleTextButtons]
|
||||
Buttons=23456789
|
||||
Tap2[]='abc
|
||||
Tap3[]='def
|
||||
Tap4[]='ghi
|
||||
Tap5[]='jkl
|
||||
Tap6[]='mno
|
||||
Tap7[]='pqrs
|
||||
Tap8[]='tuv
|
||||
Tap9[]='wxyz
|
||||
[PhoneTextButtons]
|
||||
Buttons=*#
|
||||
Tap*='*+pw
|
||||
Hold*=+
|
||||
Tap#='#
|
||||
Hold#=mode
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>SmartPhone2.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,25 +0,0 @@
|
|||
SmartPhone2.png SmartPhone2-pressed.png
|
||||
90 107
|
||||
176 220
|
||||
21
|
||||
"Menu" 0x01100000 70 400 115 427
|
||||
"Backspace" 0x01000003 238 400 285 427
|
||||
"1" 0x0031 138 437 149 451 142 461 120 462 102 455 95 442 99 435 121 432
|
||||
"2" 0x0032 153 445 202 470
|
||||
"3" 0x0033 258 435 260 448 243 461 215 462 207 452 218 438 248 431
|
||||
"4" 0x0034 138 470 149 484 142 494 120 495 102 488 95 475 99 468 121 465
|
||||
"5" 0x0035 153 477 202 502
|
||||
"6" 0x0036 258 467 260 480 243 493 215 494 207 484 218 470 248 463
|
||||
"7" 0x0037 138 502 149 516 142 526 120 527 102 520 95 507 99 500 121 497
|
||||
"8" 0x0038 153 509 202 534
|
||||
"9" 0x0039 258 499 260 512 243 525 215 526 207 516 218 502 248 495
|
||||
"*" 0x002a 138 534 149 548 142 558 120 559 102 552 95 539 99 532 121 529
|
||||
"0" 0x0030 153 542 202 567
|
||||
"#" 0x0023 258 532 260 545 243 558 215 559 207 549 218 535 248 528
|
||||
"Yes" 0x01010001 91 343 141 393
|
||||
"No" 0x01010002 219 343 269 393
|
||||
"Select" 0x01010000 160 356 195 389
|
||||
"Left" 0x1000012 159 356 149 346 141 354 141 391 149 399 159 389 159 387
|
||||
"Down" 0x1000015 160 391 150 400 159 409 199 409 207 403 196 392 194 392
|
||||
"Right" 0x1000014 195 354 206 341 215 356 215 391 208 402 197 393
|
||||
"Up" 0x1000013 160 354 149 344 158 337 197 337 203 340 194 355
|
|
@ -1,52 +0,0 @@
|
|||
[Button]
|
||||
[IMethod]
|
||||
key_count = 5
|
||||
key_hold_action_1 = insertText
|
||||
key_hold_action_2 = insertText
|
||||
key_hold_action_3 = insertSymbol
|
||||
key_hold_action_4 = changeMode
|
||||
key_hold_arg_1 = 1
|
||||
key_hold_arg_2 = 0
|
||||
key_id_1 = 1
|
||||
key_id_2 = 0
|
||||
key_id_3 = *
|
||||
key_id_4 = #
|
||||
key_id_5 = *
|
||||
key_mode_1 = Abc
|
||||
key_mode_2 = Abc
|
||||
key_mode_3 = Abc
|
||||
key_mode_4 = Abc
|
||||
key_mode_5 = Phone
|
||||
key_tap_action_1 = insertText
|
||||
key_tap_action_2 = insertSpace
|
||||
key_tap_action_3 = modifyText
|
||||
key_tap_action_4 = changeShift
|
||||
key_tap_action_5 = insertText
|
||||
key_tap_arg_1 = .,'?!-@:〓
|
||||
key_tap_arg_5 = *+pw
|
||||
[Menu]
|
||||
1 = Applications/camera.desktop
|
||||
2 = Applications/datebook.desktop
|
||||
3 = Games
|
||||
4 = Applications/qtmail.desktop
|
||||
5 = Applications/addressbook.desktop
|
||||
6 = Settings
|
||||
7 = Settings/Beaming.desktop
|
||||
8 = Applications
|
||||
9 = Documents
|
||||
Columns = 3
|
||||
Default = 5
|
||||
Map = 123456789
|
||||
Rows = 3
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Yes
|
||||
Key1=Select
|
||||
Key2=No
|
||||
Key3=Menu
|
||||
Key4=Backspace
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>SmartPhoneWithButtons.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,31 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=SmartPhoneWithButtons.png
|
||||
Down=SmartPhoneWithButtons-pressed.png
|
||||
Screen=90 107 176 208
|
||||
Areas=24
|
||||
HasMouseHover=false
|
||||
|
||||
"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454
|
||||
"2" 0x0032 153 467 202 492
|
||||
"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453
|
||||
"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487
|
||||
"5" 0x0035 153 499 202 524
|
||||
"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485
|
||||
"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519
|
||||
"8" 0x0038 153 531 202 556
|
||||
"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517
|
||||
"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551
|
||||
"0" 0x0030 153 564 202 589
|
||||
"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550
|
||||
"Call" 0x01100004 88 395 130 439
|
||||
"Hangup" 0x01100005 227 395 269 439
|
||||
"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318
|
||||
"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318
|
||||
"Select" 0x01010000 160 338 195 371
|
||||
"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369
|
||||
"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374
|
||||
"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375
|
||||
"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337
|
||||
"Home" 0x1000010 164 402 195 434
|
||||
"F1" 0x1000030 138 422 163 448
|
||||
"F2" 0x1000031 196 422 220 448
|
|
@ -1,103 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Button]
|
||||
Count=3
|
||||
[Button0]
|
||||
Name[]=Calendar Button
|
||||
Key=F1
|
||||
PressedActionService=Calendar
|
||||
PressedActionMessage=raiseToday()
|
||||
HeldActionService=Calendar
|
||||
HeldActionMessage=newEvent()
|
||||
[Button1]
|
||||
Name[]=Tasks Button
|
||||
Key=F2
|
||||
PressedActionService=Tasks
|
||||
PressedActionMessage=raise()
|
||||
HeldActionService=Tasks
|
||||
HeldActionMessage=newTask()
|
||||
[Button2]
|
||||
Name[]=Home Button
|
||||
Key=Home
|
||||
PressedActionMappable=0
|
||||
PressedActionService=TaskManager
|
||||
PressedActionMessage=multitask()
|
||||
HeldActionMappable=0
|
||||
HeldActionService=TaskManager
|
||||
HeldActionMessage=showRunningTasks()
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/datebook.desktop
|
||||
3=Applications
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Games
|
||||
7=Settings/Beaming.desktop
|
||||
8=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
9=Settings
|
||||
*=Applications/mediarecorder.desktop
|
||||
0=Applications/todolist.desktop
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
Key3=Call
|
||||
Key4=Hangup
|
||||
[TextButtons]
|
||||
Buttons=0123456789*#
|
||||
Hold0='0
|
||||
Hold1='1
|
||||
Hold2='2
|
||||
Hold3='3
|
||||
Hold4='4
|
||||
Hold5='5
|
||||
Hold6='6
|
||||
Hold7='7
|
||||
Hold8='8
|
||||
Hold9='9
|
||||
Hold*=symbol
|
||||
Hold#=mode
|
||||
Tap0=space
|
||||
Tap1="\".,'?!-@:1"
|
||||
Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32"
|
||||
Tap3="\"de\xe8\xe9\xea\x66\x33"
|
||||
Tap4="\"ghi\xec\xed\xee\x34"
|
||||
Tap5="\"jkl5"
|
||||
Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36"
|
||||
Tap7="\"pqrs\xdf\x37"
|
||||
Tap8="\"tu\xfc\xf9\xfav8"
|
||||
Tap9="\"wxyz9"
|
||||
Tap*=modify
|
||||
Tap#=shift
|
||||
[LocaleTextButtons]
|
||||
Buttons=23456789
|
||||
Tap2[]='abc
|
||||
Tap3[]='def
|
||||
Tap4[]='ghi
|
||||
Tap5[]='jkl
|
||||
Tap6[]='mno
|
||||
Tap7[]='pqrs
|
||||
Tap8[]='tuv
|
||||
Tap9[]='wxyz
|
||||
[PhoneTextButtons]
|
||||
Buttons=*#
|
||||
Tap*='*+pw
|
||||
Hold*=+
|
||||
Tap#='#
|
||||
Hold#=mode
|
||||
[Device]
|
||||
PrimaryInput=Keypad
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/skins">
|
||||
<file>TouchscreenPhone.skin</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,16 +0,0 @@
|
|||
[SkinFile]
|
||||
Up=TouchscreenPhone.png
|
||||
Down=TouchscreenPhone-pressed.png
|
||||
Screen=90 107 176 208
|
||||
Areas=9
|
||||
HasMouseHover=false
|
||||
|
||||
"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318
|
||||
"Call" 0x01100004 88 395 130 439
|
||||
"Hangup" 0x01100005 227 395 269 439
|
||||
"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318
|
||||
"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369
|
||||
"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374
|
||||
"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375
|
||||
"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337
|
||||
"Select" 0x01010000 160 338 195 371
|
|
@ -1,45 +0,0 @@
|
|||
[Translation]
|
||||
File=QtopiaDefaults
|
||||
Context=Buttons
|
||||
[Menu]
|
||||
Rows=4
|
||||
Columns=3
|
||||
Map=123456789*0#
|
||||
Default=5
|
||||
1=Applications/camera.desktop
|
||||
2=Applications/datebook.desktop
|
||||
3=Applications
|
||||
4=Applications/qtmail.desktop
|
||||
5=Applications/addressbook.desktop
|
||||
6=Games
|
||||
7=Settings/Beaming.desktop
|
||||
8=Applications/simapp.desktop,Applications/calculator.desktop
|
||||
9=Settings
|
||||
*=Applications/mediarecorder.desktop
|
||||
0=Applications/todolist.desktop
|
||||
#=Documents
|
||||
Animator=Bounce
|
||||
AnimatorBackground=Radial
|
||||
[SoftKeys]
|
||||
Count=3
|
||||
Key0=Context1
|
||||
Key1=Select
|
||||
Key2=Back
|
||||
[SystemButtons]
|
||||
Count=5
|
||||
Key0=Context1
|
||||
Key1=Back
|
||||
Key2=Select
|
||||
Key3=Call
|
||||
Key4=Hangup
|
||||
[Button]
|
||||
Count=1
|
||||
[Button0]
|
||||
Name=Power Button
|
||||
Key=Hangup
|
||||
HeldActionService=Launcher
|
||||
HeldActionMessage=execute(QString)
|
||||
HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n)
|
||||
[Device]
|
||||
PrimaryInput=Touchscreen
|
||||
|
Loading…
Add table
Reference in a new issue