Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-10820 Blackberry: Upgrade to R8 #155

Merged
merged 2 commits into from
Sep 19, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions blackberry/tibb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ clean:

.PHONY: Makefile
Makefile: FORCE
$(QMAKE) -spec unsupported/blackberry-armv7le-g++ -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
$(QMAKE) -spec unsupported/blackberry-x86-g++ -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator
$(QMAKE) -spec unsupported/blackberry-armv7le-qcc -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
$(QMAKE) -spec unsupported/blackberry-x86-qcc -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator

.PHONY: FORCE
FORCE:
Expand Down
12 changes: 7 additions & 5 deletions blackberry/tibb/NativeAbstractTextControlObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include "NativeLoggerObject.h"
#include "NativeMessageStrings.h"
#include "TiConstants.h"
#include <bb/cascades/controls/abstracttextcontrol.h>
#include <bb/cascades/AbstractTextControl>
#include <bb/cascades/FontSize>
#include <QMap>
#include <QString>

Expand Down Expand Up @@ -85,13 +86,13 @@ int NativeAbstractTextControlObject::setTextAlign(TiObject* obj)
switch (value)
{
case Ti::UI::TEXT_ALIGNMENT_LEFT:
textControl_->textStyle()->setAlignment(bb::cascades::TextAlignment::ForceLeft);
textControl_->textStyle()->setTextAlign(bb::cascades::TextAlign::Left);
break;
case Ti::UI::TEXT_ALIGNMENT_CENTER:
textControl_->textStyle()->setAlignment(bb::cascades::TextAlignment::Center);
textControl_->textStyle()->setTextAlign(bb::cascades::TextAlign::Center);
break;
case Ti::UI::TEXT_ALIGNMENT_RIGHT:
textControl_->textStyle()->setAlignment(bb::cascades::TextAlignment::ForceRight);
textControl_->textStyle()->setTextAlign(bb::cascades::TextAlign::Right);
break;
default:
N_DEBUG(Native::Msg::Unknown_value_received << ": " << value);
Expand Down Expand Up @@ -123,7 +124,8 @@ int NativeAbstractTextControlObject::setFont(TiObject* obj)
float size = it.value().toFloat(&bSucceeded);
if (bSucceeded)
{
textControl_->textStyle()->setSize(size);
textControl_->textStyle()->setFontSize(bb::cascades::FontSize::PointValue);
textControl_->textStyle()->setFontSizeValue(size);
}
else
{
Expand Down
7 changes: 0 additions & 7 deletions blackberry/tibb/NativeButtonObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
#include "TiEvent.h"
#include "TiEventContainerFactory.h"
#include <bb/cascades/Button>
#include <bb/cascades/DockLayoutProperties>
#include <bb/cascades/HorizontalAlignment>
#include <bb/cascades/VerticalAlignment>

NativeButtonObject::NativeButtonObject(TiObject* tiObject)
: NativeControlObject(tiObject)
Expand All @@ -36,10 +33,6 @@ int NativeButtonObject::getObjectType() const
int NativeButtonObject::initialize()
{
button_ = bb::cascades::Button::create();
bb::cascades::DockLayoutProperties* properties = bb::cascades::DockLayoutProperties::create();
properties->setHorizontalAlignment(bb::cascades::HorizontalAlignment::Center);
properties->setVerticalAlignment(bb::cascades::VerticalAlignment::Top);
button_->setLayoutProperties(properties);
setControl(button_);
return NATIVE_ERROR_OK;
}
Expand Down
53 changes: 27 additions & 26 deletions blackberry/tibb/NativeControlObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <bb/cascades/Color>
#include <bb/cascades/Container>
#include <bb/cascades/LayoutUpdateHandler>
#include <bb/device/Display>
#include <bb/device/DisplayInfo>
#include <QColor>
#include <QRectF>

Expand Down Expand Up @@ -147,16 +147,16 @@ NativeControlObject::NativeControlObject(TiObject* tiObject) :
height_(0),
right_(0),
batchUpdating_(false),
heightIsUpdated(false),
widthIsUpdated(false),
leftIsUpdated(false),
topIsUpdated(false),
rightIsUpdated(false),
bottomIsUpdate(false)
heightIsUpdated_(false),
widthIsUpdated_(false),
leftIsUpdated_(false),
topIsUpdated_(false),
rightIsUpdated_(false),
bottomIsUpdated_(false)
{
if ((g_width <= 0) || (g_height <= 0))
{
bb::device::Display display;
bb::device::DisplayInfo display;
QSize size = display.pixelSize();
g_width = size.width();
g_height = size.height();
Expand Down Expand Up @@ -275,6 +275,7 @@ int NativeControlObject::removeChildImpl(NativeObject* obj)
Q_ASSERT(container_ != NULL);
bb::cascades::Control* control = (bb::cascades::Control*) obj->getNativeHandle();
container_->remove(control);
control->setParent(NULL);
return NATIVE_ERROR_OK;
}

Expand Down Expand Up @@ -354,35 +355,35 @@ int NativeControlObject::finishLayout()

void NativeControlObject::updateViewLayout()
{
if (widthIsUpdated)
if (widthIsUpdated_)
{
updateWidth();
widthIsUpdated = false;
widthIsUpdated_ = false;
}
if (heightIsUpdated)
if (heightIsUpdated_)
{
updateHeight();
heightIsUpdated = false;
heightIsUpdated_ = false;
}
if (leftIsUpdated)
if (leftIsUpdated_)
{
updateLeft();
leftIsUpdated = false;
leftIsUpdated_ = false;
}
if (topIsUpdated)
if (topIsUpdated_)
{
updateTop();
topIsUpdated = false;
topIsUpdated_ = false;
}
if (rightIsUpdated)
if (rightIsUpdated_)
{
updateRight();
rightIsUpdated = false;
rightIsUpdated_ = false;
}
if (bottomIsUpdate)
if (bottomIsUpdated_)
{
updateBottom();
bottomIsUpdate = false;
bottomIsUpdated_ = false;
}
//TODO: need to verify if other UI.View properties needs to be updated as well
}
Expand Down Expand Up @@ -509,7 +510,7 @@ int NativeControlObject::setHeight(TiObject* obj)
}
else
{
heightIsUpdated = true;
heightIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down Expand Up @@ -571,7 +572,7 @@ int NativeControlObject::setLeft(TiObject* obj)
}
else
{
leftIsUpdated = true;
leftIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down Expand Up @@ -611,7 +612,7 @@ int NativeControlObject::setBottom(TiObject* obj)
}
else
{
bottomIsUpdate = true;
bottomIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down Expand Up @@ -662,7 +663,7 @@ int NativeControlObject::setRight(TiObject* obj)
}
else
{
rightIsUpdated = true;
rightIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down Expand Up @@ -773,7 +774,7 @@ int NativeControlObject::setTop(TiObject* obj)
}
else
{
topIsUpdated = true;
topIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down Expand Up @@ -855,7 +856,7 @@ int NativeControlObject::setWidth(TiObject* obj)
}
else
{
widthIsUpdated = true;
widthIsUpdated_ = true;
}
return NATIVE_ERROR_OK;
}
Expand Down
14 changes: 8 additions & 6 deletions blackberry/tibb/NativeControlObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,29 @@ class NativeControlObject : public NativeProxyObject
int updateTop();
int updateRight();
int updateBottom();
bool heightIsUpdated;
bool widthIsUpdated;
bool leftIsUpdated;
bool topIsUpdated;
bool rightIsUpdated;
bool bottomIsUpdate;

bb::cascades::Container* container_;
bb::cascades::Control* control_;
bb::cascades::AbsoluteLayoutProperties* layout_;
bb::cascades::Color backgroundColor_;
bb::cascades::Color disabledBackgroundColor_;
NativeLayoutHandler* layoutHandler_;

TiObject* bottom_;
TiObject* left_;
TiObject* top_;
TiObject* width_;
TiObject* height_;
TiObject* right_;
QRectF rect_;

bool batchUpdating_;
bool heightIsUpdated_;
bool widthIsUpdated_;
bool leftIsUpdated_;
bool topIsUpdated_;
bool rightIsUpdated_;
bool bottomIsUpdated_;
};

// Event handler for Ti.UI.View
Expand Down
1 change: 0 additions & 1 deletion blackberry/tibb/NativeLabelObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

#include "NativeLabelObject.h"
#include <bb/cascades/TextAlignment>
#include <bb/cascades/Color>
#include <qtgui/QColor>

Expand Down
7 changes: 3 additions & 4 deletions blackberry/tibb/NativeListViewObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <bb/cascades/DataModel>
#include <bb/cascades/ListView>
#include <bb/cascades/QListDataModel>
#include <bb/cascades/ListItemManager>
#include <bb/cascades/VisualNode>
#include "NativeListViewObject.h"
#include "PersistentV8Value.h"
Expand All @@ -37,7 +36,7 @@ int NativeListViewObject::initialize()
{
listView_ = bb::cascades::ListView::create();
setControl(listView_);
listView_->setListItemManager(new ListViewItemFactory());
listView_->setListItemProvider(new ListViewItemFactory());
return NATIVE_ERROR_OK;
}

Expand Down Expand Up @@ -90,7 +89,7 @@ void NativeListViewObject::setupEvents(TiEventContainerFactory* containerFactory
TiEventContainer* eventClicked = containerFactory->createEventContainer();
eventClicked->setDataProperty("type", tetCLICK);
events_.insert(tetCLICK, EventPairSmartPtr(eventClicked, new ListViewEventHandler(eventClicked, this)));
QObject::connect(listView_, SIGNAL(selectionChanged(QVariantList, bool)), events_[tetCLICK]->handler, SLOT(selectionChanged(QVariantList, bool)));
QObject::connect(listView_, SIGNAL(triggered(QVariantList)), events_[tetCLICK]->handler, SLOT(triggered(QVariantList)));
}

/*********** ListViewItemFactory class *************/
Expand Down Expand Up @@ -119,7 +118,7 @@ void ListViewItemFactory::updateItem(bb::cascades::ListView*, bb::cascades::Visu
}

/*********** ListViewEventHandler class *************/
void ListViewEventHandler::selectionChanged(QVariantList var, bool)
void ListViewEventHandler::triggered(QVariantList var)
{
eventContainer_->setDataProperty("index", var[0].toInt());
Persistent<Value> propValue;
Expand Down
7 changes: 4 additions & 3 deletions blackberry/tibb/NativeListViewObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class VisualNode;
};
};

#include <bb/cascades/ListItemManager>
#include <bb/cascades/ListItemProvider>
#include <bb/cascades/StandardListItem>

class TiEventContainer;
Expand Down Expand Up @@ -57,7 +57,7 @@ class NativeListViewObject : public NativeControlObject
bb::cascades::ListView* listView_;
};

class ListViewItemFactory: public bb::cascades::ListItemManager
class ListViewItemFactory: public bb::cascades::ListItemProvider
{
public:
ListViewItemFactory() {};
Expand All @@ -79,7 +79,8 @@ class ListViewEventHandler : public QObject
virtual ~ListViewEventHandler() {}

public slots:
void selectionChanged(QVariantList var, bool);
void triggered(QVariantList var);

private:
TiEventContainer* eventContainer_;
NativeListViewObject* owner_;
Expand Down
16 changes: 8 additions & 8 deletions blackberry/tibb/NativePlatformInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <math.h>
#include <qsize.h>

#include <bb/device/Display>
#include <bb/device/DisplayInfo>
#include <bps/deviceinfo.h>

// TODO: Remove once all functions implemented
Expand Down Expand Up @@ -79,23 +79,23 @@ Handle<Value> NativePlatformInterface::getBatteryMonitoring()
PROP_GETTER(getBatteryState)
Handle<Value> NativePlatformInterface::getBatteryState()
{
bb::device::BatteryInfo::ChargingState bState = instance()->batteryInfo_.chargingState();
bb::device::BatteryChargingState::Type bState = instance()->batteryInfo_.chargingState();
Ti::Platform::TI_BATTERY_STATE tiState = Ti::Platform::BATTERY_STATE_UNKNOWN;
switch (bState)
{
case bb::device::BatteryInfo::UnknownChargingState:
case bb::device::BatteryChargingState::Unknown:
tiState = Ti::Platform::BATTERY_STATE_UNKNOWN;
break;
case bb::device::BatteryInfo::NotCharging:
case bb::device::BatteryChargingState::NotCharging:
tiState = Ti::Platform::BATTERY_STATE_UNKNOWN;
break;
case bb::device::BatteryInfo::Full:
case bb::device::BatteryChargingState::Full:
tiState = Ti::Platform::BATTERY_STATE_FULL;
break;
case bb::device::BatteryInfo::Discharging:
case bb::device::BatteryChargingState::Discharging:
tiState = Ti::Platform::BATTERY_STATE_UNPLUGGED;
break;
case bb::device::BatteryInfo::Charging:
case bb::device::BatteryChargingState::Charging:
tiState = Ti::Platform::BATTERY_STATE_CHARGING;
break;
}
Expand All @@ -108,7 +108,7 @@ Handle<Value> NativePlatformInterface::getDisplayCaps()
HandleScope scope;
Local<Object> dCapsObject = Object::New();

bb::device::Display display;
bb::device::DisplayInfo display;

const float MMPERINCH = 25.4f;

Expand Down
7 changes: 0 additions & 7 deletions blackberry/tibb/NativeProgressBarObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
*/

#include "NativeProgressBarObject.h"
#include <bb/cascades/DockLayoutProperties>
#include <bb/cascades/VerticalAlignment>
#include <bb/cascades/HorizontalAlignment>

NativeProgressBarObject::NativeProgressBarObject(TiObject* tiObject)
: NativeControlObject(tiObject)
Expand All @@ -33,10 +30,6 @@ NativeProgressBarObject* NativeProgressBarObject::createProgressBar(TiObject* ti
int NativeProgressBarObject::initialize()
{
progressIndicator_ = bb::cascades::ProgressIndicator::create();
bb::cascades::DockLayoutProperties* properties = bb::cascades::DockLayoutProperties::create();
properties->setHorizontalAlignment(bb::cascades::HorizontalAlignment::Center);
properties->setVerticalAlignment(bb::cascades::VerticalAlignment::Top);
progressIndicator_->setLayoutProperties(properties);
setControl(progressIndicator_);
return NATIVE_ERROR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion blackberry/tibb/NativeSliderObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void NativeSliderObject::setupEvents(TiEventContainerFactory* containerFactory)
NativeControlObject::setupEvents(containerFactory);
TiEventContainer* eventChange = containerFactory->createEventContainer();
events_.insert(tetCHANGE, EventPairSmartPtr(eventChange, new SliderEventHandler(eventChange, this)));
QObject::connect(slider_, SIGNAL(valueChanging(float)), events_[tetCHANGE]->handler, SLOT(valueChanging(float)));
QObject::connect(slider_, SIGNAL(immediateValueChanged(float)), events_[tetCHANGE]->handler, SLOT(valueChanging(float)));
}

void NativeSliderObject::updateValue(float value)
Expand Down