summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlli Werwolff <qt-info@nokia.com>2010-08-31 09:37:01 +0200
committerOlli Werwolff <qt-info@nokia.com>2010-08-31 09:37:01 +0200
commit714532c66812136541739d2bc3277d9fa2c0ff5a (patch)
tree52acc983087c4c4a22d48ccb9092661557ffb46e
parent79dfc9603f5c6580549a91693d771a7199afe2db (diff)
Symbian Softkey buttons for every orientation
Reviewed-by: ckamm
-rw-r--r--models/symbianNonTouch/symbianNonTouch.config8
-rw-r--r--models/symbianTouch/symbianTouch.config14
-rw-r--r--src/other/configurationreader.cpp22
-rw-r--r--src/other/deviceitem.cpp19
-rw-r--r--src/other/deviceitem.h2
5 files changed, 38 insertions, 27 deletions
diff --git a/models/symbianNonTouch/symbianNonTouch.config b/models/symbianNonTouch/symbianNonTouch.config
index 4d61967..f50bdeb 100644
--- a/models/symbianNonTouch/symbianNonTouch.config
+++ b/models/symbianNonTouch/symbianNonTouch.config
@@ -36,7 +36,7 @@ menuImage:rightUp,n95rightup.png
menuImage:topUp,n95topup.png
availableGeometry:rightUp,0,21,320,198
availableGeometry:topUp,0,58,240,235
-symbianSoftKeyButtonPortrait:0,0,293,120,27
-symbianSoftKeyButtonPortrait:1,120,293,120,27
-symbianSoftKeyButtonLandscape:1,220,0,100,21
-symbianSoftKeyButtonLandscape:0,220,219,100,21
+symbianSoftKeyButton:topUp,0,0,293,120,27
+symbianSoftKeyButton:topUp,1,120,293,120,27
+symbianSoftKeyButton:rightUp,1,220,0,100,21
+symbianSoftKeyButton:rightUp,0,220,219,100,21
diff --git a/models/symbianTouch/symbianTouch.config b/models/symbianTouch/symbianTouch.config
index 7050d97..aa51559 100644
--- a/models/symbianTouch/symbianTouch.config
+++ b/models/symbianTouch/symbianTouch.config
@@ -10,14 +10,14 @@ style:s60,nseriesblack
button:Key_TopMenu,,50,872,62,50
button:Key_Call,,165,864,42,66
button:Key_Hangup,,255,858,43,78
-symbianSoftKeyButtonPortrait:0,0,579,180,61
-symbianSoftKeyButtonPortrait:1,180,579,180,61
-symbianSoftKeyButtonLandscape:1,503,0,137,72
-symbianSoftKeyButtonLandscape:2,503,72,137,72
-symbianSoftKeyButtonLandscape:3,503,144,137,72
-symbianSoftKeyButtonLandscape:4,503,216,137,72
-symbianSoftKeyButtonLandscape:0,503,288,137,72
menuImage:topUp,menu_topup.png
availableGeometry:topUp,0,92,360,487
menuImage:rightUp,menu_rightup.png
availableGeometry:rightUp,0,73,502,288
+symbianSoftKeyButton:topUp,0,0,579,180,61
+symbianSoftKeyButton:topUp,1,180,579,180,61
+symbianSoftKeyButton:rightUp,1,503,0,137,72
+symbianSoftKeyButton:rightUp,2,503,72,137,72
+symbianSoftKeyButton:rightUp,3,503,144,137,72
+symbianSoftKeyButton:rightUp,4,503,216,137,72
+symbianSoftKeyButton:rightUp,0,503,288,137,72
diff --git a/src/other/configurationreader.cpp b/src/other/configurationreader.cpp
index 20a6291..12d8889 100644
--- a/src/other/configurationreader.cpp
+++ b/src/other/configurationreader.cpp
@@ -169,19 +169,25 @@ bool ConfigurationReader::processLine(const QByteArray &line, DeviceData *device
errorMsg = tr("Image file %1 does not exist.").arg(deviceData->maemoNavigationCloseButton);
return false;
}
- } else if (parameter == "symbianSoftKeyButtonPortrait" || parameter == "symbianSoftKeyButtonLandscape") {
+ } else if (parameter == "symbianSoftKeyButton") {
QList<QByteArray> values = value.split(',');
- if (values.count() != 5) {
- errorMsg = tr("ConfigurationReader: symbianSoftKeyButton property requires five comma separated values\n"
- " closeButton:buttonnr,x,y,width,height\n"
+ if (values.count() != 6) {
+ errorMsg = tr("ConfigurationReader: symbianSoftKeyButton property requires six comma separated values\n"
+ " symbianSoftKeyButton:orientation,buttonnr,x,y,width,height\n"
" where buttonnr: 0: positive, 1: negative, 2: middle, 3: middle, 4: middle");
return false;
}
SymbianSoftKeyButtonData key;
- key.buttonNumber = values[0].toInt();
- key.area = QRectF(values[1].toFloat(), values[2].toFloat(),
- values[3].toFloat(), values[4].toFloat());
- key.landscape = parameter.endsWith("Landscape");
+ key.buttonNumber = values[1].toInt();
+ key.area = QRectF(values[2].toFloat(), values[3].toFloat(),
+ values[4].toFloat(), values[5].toFloat());
+ Orientation orientation = stringToOrientation(values[0]);
+ if (orientation == notSet) {
+ errorMsg = tr("ConfigurationReader: unknown orientation: %1").arg(QString(values[0]));
+ return false;
+ } else {
+ key.orientation = orientation;
+ }
deviceData->symbianSoftKeys.append(key);
} else if (parameter == "availableGeometry") {
QList<QByteArray> values = value.split(',');
diff --git a/src/other/deviceitem.cpp b/src/other/deviceitem.cpp
index eddd96e..c8402c2 100644
--- a/src/other/deviceitem.cpp
+++ b/src/other/deviceitem.cpp
@@ -497,14 +497,19 @@ void DeviceItem::updateMenuPositionAndSize()
oldSoftKeyTexts.insert(button->buttonData().buttonNumber, button->text());
qDeleteAll(mSymbianSoftKeyButtons);
mSymbianSoftKeyButtons.clear();
+ // If the current orientation does not have a menu specified, we use the topUp menu and the according symbian softkey buttons
+ Orientation toUse;
+ if (mCurrentOrientation & mDeviceData.supportedOrientations)
+ toUse = mCurrentOrientation;
+ else
+ toUse = topUp;
foreach (const SymbianSoftKeyButtonData &data, mDeviceData.symbianSoftKeys) {
-// if (data.landscape != mLandscape)
-// continue; //TODO hmmm
-
- SymbianSoftKeyButton *button = new SymbianSoftKeyButton(data, mMenu);
- connect(button, SIGNAL(clicked(int)), this, SIGNAL(symbianSoftKeyClicked(int)));
- button->setText(oldSoftKeyTexts.value(data.buttonNumber));
- mSymbianSoftKeyButtons.append(button);
+ if (data.orientation == toUse) {
+ SymbianSoftKeyButton *button = new SymbianSoftKeyButton(data, mMenu);
+ connect(button, SIGNAL(clicked(int)), this, SIGNAL(symbianSoftKeyClicked(int)));
+ button->setText(oldSoftKeyTexts.value(data.buttonNumber));
+ mSymbianSoftKeyButtons.append(button);
+ }
}
emit offsetChanged(mAvailableGeometry.topLeft());
diff --git a/src/other/deviceitem.h b/src/other/deviceitem.h
index 4547737..6763e4f 100644
--- a/src/other/deviceitem.h
+++ b/src/other/deviceitem.h
@@ -66,7 +66,7 @@ struct SymbianSoftKeyButtonData {
NegativeButton = 1,
MaxButtons = 5
};
- bool landscape;
+ Orientation orientation;
QRectF area;
int buttonNumber;
};