TutorialScreen::TutorialScreen(MainScreen *previous, tutItem *items, int itemCount) :tutItems(items), itemCount(itemCount) {
	lprintfln("TutorialScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	index = 0;

	mainLayout = new Layout(0, 0, scrWidth, scrHeight, NULL, 1, 2);
	mainLayout->setSkin(Util::getSkinBack());
	mainLayout->setDrawBackground(true);

	Widget *softKeys = Util::createSoftKeyBar(Util::getSoftKeyBarHeight(), "", "", "");

	Layout *subLayout = new Layout(0, 0, scrWidth, scrHeight-(softKeys->getHeight()), mainLayout, 3, 1);
	subLayout->setPaddingLeft(PADDING);
	subLayout->setPaddingRight(PADDING);
	subLayout->setDrawBackground(false);
	/*subLayout->setSkin(Util::getSkinBack());*/

	leftArrow = new Image(0, 0, ARROW_WIDTH, subLayout->getHeight(), subLayout, false, false, RES_UNSELECT_ICON);
	leftArrow->setDrawBackground(false);

	imge = new TransitionImage(0, 0, scrWidth - (ARROW_WIDTH * 2) - (PADDING*2), subLayout->getHeight(), subLayout, false, false, NULL);
	imge->setDrawBackground(false);
	imge->setResource(tutItems[0].image);

	rightArrow = new Image(0, 0, ARROW_WIDTH, subLayout->getHeight(), subLayout, false, false, RES_RIGHT_ARROW);
	rightArrow->setDrawBackground(false);

	mainLayout->add(softKeys);

	this->setMain(mainLayout);
}
Esempio n. 2
0
MAUIMoblet::MAUIMoblet() {
	lprintfln("MAUIMoblet::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	Engine& engine = Engine::getSingleton();
	engine.setDefaultFont(Util::getFontBlack());
	engine.setDefaultSkin(Util::getSkinBack());
	MAExtent screenSize = maGetScrSize();
	scrWidth = EXTENT_X(screenSize);
	scrHeight = EXTENT_Y(screenSize);
	feed = Feed();
	String data = "";
	Util::getData("fd.sav", data);
	if (data.length() <= 0) {
		data = "";
	}
	feed.setAll(data.c_str());
	Util::getData("lb.sav", data);
	if (data.length() <= 0) {
		data = "";
	}
	feed.setAlbum(data.c_str());
	data = "";
	if (feed.getLoaded()) {
		next = new AlbumLoadScreen(&feed);
		next->show();
	} else {
		next = new OptionsScreen(&feed, OptionsScreen::ST_LOGIN_OPTIONS);
		next->show();
	}
}
Esempio n. 3
0
RedeemScreen::RedeemScreen(Feed *feed, Screen *previous) : mHttp(this), feed(feed), prev(previous) {
    lprintfln("RedeemScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
    moved = 0;
    isBusy = false;
    next = NULL;

    result = "";
    error_msg = "";
    parentTag = "";

    mainLayout = Util::createMainLayout("Redeem", "Back", "", true);

    listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2];
    notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];
    notice->setMultiLine(true);

    label = new Label(0,0, scrWidth-PADDING*2, DEFAULT_SMALL_LABEL_HEIGHT, NULL, "Redeem code:", 0, Util::getDefaultFont());
    label->setDrawBackground(false);
    listBox->add(label);

    label = Util::createEditLabel("");
    editBoxRedeem = new NativeEditBox(0, 0, label->getWidth()-PADDING*2, label->getHeight()-PADDING*2, 64, MA_TB_TYPE_ANY, label, "",L"Redeem");
    editBoxRedeem->setDrawBackground(false);
    label->addWidgetListener(this);
    listBox->add(label);

    if (feed->getUnsuccessful() != "Success") {
        label->setCaption(feed->getUnsuccessful());
    }
    this->setMain(mainLayout);
    listBox->setSelectedIndex(1);
}
Esempio n. 4
0
Login::~Login() {
	lprintfln("~Login::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	clearListBox();
	kinListBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	error_msg = "";
	parentTag="";
	conCatenation="";
	value="";
	value1="";
	value2="";
	convertAsterisk="";
	underscore="";
	username="";
	credits="0";
	premium="0";
	encrypt="";
	error_msg="";
	email="";
	handle="";
	touch="";
	result="";
	freebie="";
	notedate="";
}
Esempio n. 5
0
Login::Login(MainScreen *previous, Feed *feed, int screen) : mHttp(this), screen(screen) {
	lprintfln("Login::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	this->feed = feed;
	moved = 0;
	changed = false;
	isBusy = false;
	result = "";
	currentSelectedKey = NULL;
	currentKeyPosition = -1;
	mainLayout = Util::createMainLayout("", "", "", true);

	kinListBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2];
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];
	notice->setMultiLine(true);

	switch (screen) {
		case S_LOGIN:
			drawLoginScreen();
			break;
		case S_REGISTER:
			drawRegisterScreen();
			break;
	}
	touch = "false";
	this->setMain(mainLayout);
}
AuctionListScreen::~AuctionListScreen() {
	lprintfln("~AuctionListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	clearListBox();
	listBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	if (next != NULL) {
		delete next;
		feed->remHttp();
		next = NULL;
	}
	delete mImageCache;
	mImageCache = NULL;

	clearAuctions();
	deleteAuctions();

	parentTag="";
	cardText="";
	cardId="";
	description="";
	thumburl="";
	categoryId="";
	error_msg="";
	openingBid="";
	price="";
	userCardId="";
	auctionCardId="";
	username="";
	buyNowPrice="";
	endDate="";
	lastBidUser="";
}
Esempio n. 7
0
CompareScreen::CompareScreen(Screen *previous, MAHandle img, Feed *feed, bool flip, Card *card, Card *compare) :mHttp(this), previous(previous), img(img), flip(flip), card(card), feed(feed), compare(compare) {
	lprintfln("CompareScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	busy = false;
	next = NULL;
	currentSelectedStat = -1;
	flipOrSelect = 0;
	imageCache = new ImageCache();

	if (card != NULL) {
		mainLayout = Util::createImageLayout("", "Back", "Flip");
		listBox = (ListBox*) mainLayout->getChildren()[0];
		height = listBox->getHeight();
	}else{
		mainLayout = Util::createImageLayout("Back");
		listBox = (ListBox*) mainLayout->getChildren()[0]->getChildren()[1];
		height = listBox->getHeight()-70;
	}
	imge = new MobImage(0, 0, scrWidth-PADDING*2, height/2, listBox, false, false, Util::loadImageFromResource(img));
	cmpge = new MobImage(0, 0, scrWidth-PADDING*2, height/2, listBox, false, false, Util::loadImageFromResource(img));
	this->setMain(mainLayout);
	if (card != NULL && compare != NULL) {
		if (flip) {
			Util::retrieveBackFlip(imge, card, height-PADDING*2, imageCache);
			Util::retrieveBackFlip(cmpge, compare, height-PADDING*2, imageCache);
		} else {
			Util::retrieveFrontFlip(imge, card, height-PADDING*2, imageCache);
			Util::retrieveFrontFlip(cmpge, compare, height-PADDING*2, imageCache);
		}
	}
	else {
		imageCache = NULL;
	}
}
Esempio n. 8
0
MenuScreen::~MenuScreen() {
	lprintfln("~MenuScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	clearListBox();
	listBox->clear();
	delete mainLayout;
	if(menu!=NULL){
		delete menu;
	}
	parentTag="";
	notedate="";
}
Esempio n. 9
0
NewMenuScreen::~NewMenuScreen() {
	lprintfln("~NewMenuScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	delete mainLayout;
	mainLayout = NULL;
	if(next!=NULL){
		delete next;
		feed->remHttp();
		next = NULL;
	}
	parentTag="";
	notedate="";
}
Esempio n. 10
0
ImageScreen::ImageScreen(MainScreen *previous, MAHandle img, Feed *feed, bool flip, Card *card, int screenType, bool hasConnection, bool canAuction):mHttp(this) {
	this->previous = previous;
	this->img = img;
	this->flip = flip;
	this->card = card;
	this->screenType = screenType;
	this->feed = feed;
	this->hasConnection = hasConnection;
	this->canAuction = canAuction;
	lprintfln("ImageScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	//TODO add touch
	busy = false;
	tapped = false;
	next = NULL;
	currentSelectedStat = -1;
	flipOrSelect = 0;
	imageCacheFront = new ImageCache();
	imageCacheBack = new ImageCache();

	if (card != NULL) {
		if (screenType == ST_NEW_CARD) {
			layout =  Util::createImageLayout("Accept", "Reject", "Flip");
		} else if (screenType == ST_VIEW_CARD) {
			layout = Util::createImageLayout("", "Back", "Flip");
		} else if (screenType == Util::AT_SHARE) {
			layout = Util::createImageLayout("Share", "Back", "Flip");
		} else {
			layout = Util::createImageLayout((hasConnection&&canAuction)?"Options":"", "Back", "Flip");
		}
		listBox = (KineticListBox*) layout->getChildren()[0];
		listBox->setPaddingTop(0);
		height = listBox->getHeight();
	}else{
		layout = Util::createImageLayout("Back");
		listBox = (KineticListBox*) layout->getChildren()[0]->getChildren()[1];
		height = listBox->getHeight()-70;
	}
	imge = new MobImage(0, 0, scrWidth-PADDING*2, height, listBox, false, false, img);
	this->setMain(layout);
	if (card != NULL) {
		if (flip) {
			Util::retrieveBack(imge, card, height-PADDING*2, imageCacheBack);
			Util::retrieveFront(NULL, card, height-PADDING*2, imageCacheFront);
		} else {
			Util::retrieveFront(imge, card, height-PADDING*2, imageCacheFront);
			Util::retrieveBack(NULL, card, height-PADDING*2, imageCacheBack);
		}
	}
	else {
		imageCacheFront = NULL;
		imageCacheBack = NULL;
	}
}
Esempio n. 11
0
TutorialScreen::~TutorialScreen() {
	lprintfln("~TutorialScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	delete mainLayout;
	mainLayout = NULL;

	previous = NULL;
	imge = NULL;
	leftArrow = NULL;
	rightArrow = NULL;
	itemCount = 0, index = 0;

	tutItems = NULL;
}
Esempio n. 12
0
RedeemScreen::~RedeemScreen() {
    lprintfln("~RedeemScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
    clearListBox();
    listBox->clear();
    delete mainLayout;
    mainLayout = NULL;
    if (next != NULL) {
        delete next;
        feed->remHttp();
        next = NULL;
    }
    result = "";
    error_msg = "";
    parentTag = "";
}
ShopCategoriesScreen::~ShopCategoriesScreen() {
	lprintfln("~ShopCategoriesScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	clearListBox();
	listBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	if (next != NULL) {
		delete next;
		feed->remHttp();
		next = NULL;
	}
	parentTag="";
	temp="";
	temp1="";
	error_msg="";
}
Esempio n. 14
0
NewMenuScreen::NewMenuScreen(Feed *feed) : mHttp(this), screenType(screenType) {
	lprintfln("NewMenuScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->feed = feed;

	int itemCount = sizeof(menuItems)/sizeof(item);

	c=0;
	versionChecked=0;
	next = NULL;
	first = 1;

	mainLayout = new Layout(0, 0, scrWidth, scrHeight, NULL, 1, 2);

	MAExtent imgSize = maGetImageSize(RES_IMAGE);
	int imgHeight = EXTENT_Y(imgSize);

	ListBox *listBox = new ListBox(0, 0, scrWidth, scrHeight, mainLayout, ListBox::LBO_VERTICAL, ListBox::LBA_LINEAR, true);
	listBox->setSkin(Util::getSkinBack());
	/*listBox->setSkin(Util::getSkinHeader());*/
	/*listBox->setDrawBackground(false);*/


	/*Layout *header = new Layout(0,0,scrWidth, imgHeight, NULL, 1, 1);
	header->setSkin(Util::getSkinHeader());*/

	ListBox *header = new ListBox(0, 0, scrWidth, imgHeight, NULL, ListBox::LBO_VERTICAL, ListBox::LBA_LINEAR, true);
	header->setSkin(Util::getSkinHeader());

	Image *image = new Image(0, 0, scrWidth,  imgHeight, NULL, true, true, RES_IMAGE);
	header->add(image);

	listBox->add(header);

	label = new Label(0,0,scrWidth,36,NULL,"",0,Util::getDefaultSelected());
	label->setMultiLine(true);
	label->setAutoSizeY();
	label->setMultiLine(true);
	label->setDrawBackground(false);
	listBox->add(label);

	menu = new GCMenu(menuItems, itemCount, 0, 0, scrWidth, listBox->getHeight() - imgHeight, false, false, listBox);

	setMain(mainLayout);

	origMenu = this;
}
Esempio n. 15
0
NoteScreen::~NoteScreen() {
	lprintfln("~NoteScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	clearListBox();
	kinListBox->clear();
	delete mainLayout;
	mainLayout = NULL;

	parentTag = "";
	note = "";
	origionalNote = "";
	encodedNote = "";
	cardText = "";

	if(mImageCache!=NULL) {
		delete mImageCache;
		mImageCache = NULL;
	}
}
Esempio n. 16
0
CompareScreen::~CompareScreen() {
	lprintfln("~CompareScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	if (imge->getResource() != NULL) {
		maDestroyObject(imge->getResource());
	}
	clearListBox();
	listBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	img = -1;
	if (next != NULL) {
		delete next;
		feed->remHttp();
		next = NULL;
	}
	if (imageCache != NULL) {
		delete imageCache;
		imageCache = NULL;
	}
}
Esempio n. 17
0
DeckListScreen::~DeckListScreen() {
	lprintfln("~DeckListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	delete mainLayout;
	mainLayout = NULL;
	currentSelectedKey = NULL;
	parentTag= "";
	description = "";
	deckId = "";
	categoryId = "";

	if (next != NULL) {
		delete next;
		feed->remHttp();
		next = NULL;
	}
	for (int i = 0; i < albums.size(); i++) {
		delete albums[i];
		albums[i] = NULL;
	}
	albums.clear();
}
Esempio n. 18
0
EditDeckScreen::~EditDeckScreen() {
	lprintfln("~EditDeckScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	delete mainLayout;
	mainLayout = NULL;
	if(next != NULL){
		delete next;
		feed->remHttp();
		next = NULL;
	}
	delete mImageCache;
	mImageCache = NULL;

	clearCards();

	stats.clear();
	parentTag="";
	statDesc="";
	statIVal="";
	statDisplay="";
	note="";
	deckId="";
	id="";
	description="";
	quantity="";
	thumburl="";
	fronturl="";
	frontflipurl="";
	backurl="";
	backflipurl="";
	filename="";
	error_msg="";
	rate="";
	rarity="";
	ranking="";
	value="";
	updated="";
	deckCategory="";
}
Esempio n. 19
0
OptionsScreen::~OptionsScreen() {
	lprintfln("~OptionsScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	temp = "";
	temp1 = "";
	error_msg = "";
	number = "";
	deckId = "";

	clearListBox();
	listBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	if(next!=NULL){
		delete next;
		feed->remHttp();
		next = NULL;
	}

	if (album != NULL) {
		delete album;
		album = NULL;
	}
}
TradeFriendDetailScreen::~TradeFriendDetailScreen() {
    lprintfln("~TradeFriendDetailScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
    method="";
    methodLabel="";
    friendDetail="";
    parentTag="";
    temp="";
    temp1="";
    error_msg="";
    result="";
    delete layout;
    layout = NULL;
    if (menu != NULL) {
        delete menu;
        feed->remHttp();
        menu = NULL;
    }

    cardText="";
    delete mImageCache;
    mImageCache = NULL;
}
TradeFriendDetailScreen::TradeFriendDetailScreen(Screen *previous, Feed *feed, Card *card) :previous(previous), feed(feed), card(card), mHttp(this) {
    lprintfln("TradeFriendDetailScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
    sending = false;
    friendDetail = "";
    methodLabel = "";
    method = "";
    result = "";
    moved = 0;
    menu = NULL;

    layout = Util::createMainLayout("Continue", "Back", "", true);

    listBox = (KineticListBox*)layout->getChildren()[0]->getChildren()[2];
    notice = (Label*)layout->getChildren()[0]->getChildren()[1];
    notice->setMultiLine(true);

    drawMethodScreen();

    this->setMain(layout);
}
Esempio n. 22
0
DeckListScreen::DeckListScreen(MainScreen *previous, Feed *feed, int screenType, String categoryId)
		:mHttp(this), screenType(screenType), categoryId(categoryId) {
	lprintfln("DeckListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	this->feed = feed;
	currentSelectedKey = NULL;
	currentKeyPosition = -1;
	mainLayout = Util::createMainLayout("", "Back", true);
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];
	listBox = (KineticListBox*)mainLayout->getChildren()[0]->getChildren()[2];

	this->setMain(mainLayout);

	deckId = "";
	description = "";
	moved = 0;

	album = NULL;

	next = NULL;

	selecting = true;

	notice->setCaption("Loading decks...");

	int urlLength = 0;
	char *url = NULL;

	switch (screenType) {
		case ST_EDIT:
			//work out how long the url will be, the 2 is for the & and = symbals, as well as hard coded vars
			urlLength = strlen("?getalldecks=1") + URLSIZE;
			url = new char[urlLength+1];
			memset(url,'\0',urlLength+1);
			sprintf(url, "%s?getalldecks=1", URL);
			lprintfln("%s", url);
			break;
		case ST_SELECT:
			//work out how long the url will be, the 2 is for the & and = symbals, as well as hard coded vars
			urlLength = strlen("?getcategorydecks=1&category_id=") + categoryId.length() + URLSIZE;
			url = new char[urlLength+1];
			memset(url,'\0',urlLength+1);
			sprintf(url, "%s?getcategorydecks=1&category_id=%s", URL, categoryId.c_str());
			lprintfln("%s", url);
			break;
	}

	if(mHttp.isOpen()){
		mHttp.close();
	}
	mHttp = HttpConnection(this);
	int res = mHttp.create(url, HTTP_GET);
	if(res < 0) {
		notice->setCaption("Connection error.");
	} else {
		mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str());
		mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str());
		feed->addHttp();
		mHttp.finish();

	}

	urlLength = 0;
	if (url != NULL) {
		delete [] url;
		url = NULL;
	}
}
Esempio n. 23
0
MenuScreen::MenuScreen(Feed *feed) : GameCardScreen(NULL, feed, -1) {
	lprintfln("MenuScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());

	c=0;
	versionChecked=0;
	menu = NULL;
	first = 1;
#if defined(MA_PROF_STRING_PLATFORM_IPHONEOS)
	mainLayout = Util::createMainLayout("", "", true);
#else
	mainLayout = Util::createMainLayout("", "Exit", true);
#endif

	listBox = (KineticListBox*)mainLayout->getChildren()[0]->getChildren()[2];

#if (OP_ALBUMS > -1)
		label = Util::createSubLabel("Albums");
		label->addWidgetListener(this);
		listBox->add(label);
#endif
#if (OP_SHOP > -1)
	label = Util::createSubLabel("Shop");
	label->addWidgetListener(this);
	listBox->add(label);
#endif
#if (OP_NOTIFICATIONS > -1)
	if(feed->getNoteLoaded()){
		noteLabel = Util::createSubLabel("*Notifications");
		noteLabel->setFont(Util::getDefaultSelected());
	}else{
		noteLabel = Util::createSubLabel("Notifications");
		noteLabel->setFont(Util::getDefaultFont());
	}
	noteLabel->addWidgetListener(this);
	listBox->add(noteLabel);
#endif
#if (OP_PROFILE > -1)
	label = Util::createSubLabel("Profile");
	label->addWidgetListener(this);
	listBox->add(label);
#endif
#if (OP_FRIENDS > -1)
	label = Util::createSubLabel("Friends");
	label->addWidgetListener(this);
	listBox->add(label);
#endif
#if (OP_INVITEFRIENDS > -1)
	label = Util::createSubLabel("Invite Friends");
	label->addWidgetListener(this);
	listBox->add(label);
#endif
#if (OP_LOGOUT > -1)
#if not defined(MA_PROF_STRING_PLATFORM_IPHONEOS)
	label = Util::createSubLabel("Log Out");
	label->addWidgetListener(this);
	listBox->add(label);
#endif
#endif
	label = new Label(0, 0, scrWidth-(PADDING*2), 72, NULL, "", 0, Util::getDefaultFont());
	listBox->add(label);

	listBox->setSelectedIndex(0);

	moved=0;

	this->setMain(mainLayout);

	origMenu = this;

	 if (strcmp("0", feed->getFreebie().c_str()) == 0) {
		 if (menu!=NULL) {
			 delete menu;
		 }
		menu = new ShopCategoriesScreen(this, feed, ShopCategoriesScreen::ST_FREEBIE);
	}
}
Esempio n. 24
0
EditDeckScreen::EditDeckScreen(MainScreen *previous, Feed *feed, String deckId) : mHttp(this), deckId(deckId) {
	busy = true;
	emp = true;
	this->previous = previous;
	this->feed = feed;
	deleting = false;

	currentSelectedKey = NULL;
	currentKeyPosition = -1;
	next = NULL;

	lprintfln("EditDeckScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());

	id = "";
	description = "";
	quantity = "";
	thumburl = "";
	fronturl = "";
	frontflipurl = "";
	backurl = "";
	backflipurl = "";
	rate = "";
	ranking = "";
	rarity = "";
	value = "";
	error_msg = "";
	updated = "";
	statDisplay = "";
	note = "";
	statDesc = "";
	statIVal = "";
	deckCategory = "";

	mainLayout = Util::createMainLayout("", "Back" , "", true);

	listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2];
	listBox->setWrapping(true);
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];
	notice->setCaption("Getting card list...");

	mImageCache = new ImageCache();
	int urlLength = 71 + URLSIZE + strlen("deck_id") + deckId.length() + Util::intlen(scrHeight) + Util::intlen(scrWidth);
	char *url = new char[urlLength+1];
	memset(url,'\0',urlLength+1);
	sprintf(url, "%s?getcardsindeck=1&deck_id=%s&height=%d&width=%d&jpg=1", URL,
			deckId.c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth());
	lprintfln("%s", url);
	if(mHttp.isOpen()){
		mHttp.close();
	}
	mHttp = HttpConnection(this);
	int res = mHttp.create(url, HTTP_GET);
	if(res < 0) {
		busy = false;
		hasConnection = false;
		notice->setCaption("");
	} else {
		hasConnection = true;
		mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str());
		mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str());
		feed->addHttp();
		mHttp.finish();

	}
	delete [] url;
	url = NULL;

	this->setMain(mainLayout);
	moved=0;

	orig = this;
}
Esempio n. 25
0
File: kheap.c Progetto: jawline/Dawn
void kfree(void* addr) {
	heapFreeMemory(addr, &kernel_heap);
}
Esempio n. 26
0
ContactScreen::ContactScreen(MainScreen *previous) {
	this->previous = previous;
	lprintfln("ContactScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	moved = 0;
	index = -1;
	isBusy = false;

	layout = Util::createMainLayout("Search", "Back", "", false);

	listBox = (KineticListBox*) layout->getChildren()[0]->getChildren()[2];

	notice = (Label*) layout->getChildren()[0]->getChildren()[1];

	label = new Label(0,0, scrWidth-PADDING*2, 24, NULL, "Enter contact name", 0, Util::getDefaultFont());
	listBox->add(label);

	label = Util::createEditLabel("");
	editBoxSearch = new NativeEditBox(0, 0, label->getWidth()-PADDING*2, 48-PADDING*2, 64, MA_TB_TYPE_ANY, label, "",L"Search term:");
#if defined(MA_PROF_SUPPORT_STYLUS)

#else
	editBoxSearch->setInputMode(NativeEditBox::IM_NUMBERS);
#endif
	editBoxSearch->setDrawBackground(false);
	label->addWidgetListener(this);
	listBox->add(label);

	contactListBox = new KineticListBox(0, 0, scrWidth, listBox->getHeight() - editBoxSearch->getParent()->getHeight() - 24,
		listBox, KineticListBox::LBO_VERTICAL, KineticListBox::LBA_LINEAR, false);

	this->setMain(layout);

	listBox->setSelectedIndex(1);
	editBoxSearch->setSelected(true);

	//load all the contacts into a list
	Contact *temp;
	char *name, *number;
	String strName, strNumber;

	MAHandle mContactsListHandle = maPimListOpen(MA_PIM_CONTACTS);
	MAHandle pimItemHandle = maPimListNext(mContactsListHandle);

	MA_PIM_ARGS args;
	args.item = pimItemHandle;
	args.bufSize = 512;
	char *mBuffer;
	mBuffer = new char[512];
	args.buf = mBuffer;

	while (pimItemHandle > 0) {
		strName = "";
		strNumber = "";

		args.item = pimItemHandle;

		int countFields = maPimItemCount(pimItemHandle);
		if (countFields >= 0)
		{
			args.field = MA_PIM_FIELD_CONTACT_NAME;

			// Get value from name field at position 0.
			maPimItemGetValue(&args, 0);

			// there can be up to 8 parts of a name
			for (int i = 0; i < 8; i++)
			{
				const wchar* contactNameValue = Util::getWCharArrayFromBuf(args.buf, i);
				if (contactNameValue && *contactNameValue != 0)
				{
					name = new char[wcslen(contactNameValue)];
					memset(name, '\0', wcslen(contactNameValue));
					sprintf(name, "%S", contactNameValue);

					if (strName.length() > 0) {
						strName.append(", ", 2);
					}
					strName.append(name, strlen(name));

					delete name;
				}
			}

			//printf("name: %s", strName.c_str());

			args.field = MA_PIM_FIELD_CONTACT_TEL;

			// Get the number of values.
			int countValues =
				maPimItemFieldCount(pimItemHandle, MA_PIM_FIELD_CONTACT_TEL);

			for (int i = 0; i < countValues; i++)
			{
				int result = maPimItemGetValue(&args, i);

				if (result >= 0) {
					number = new char[wcslen((wchar*) args.buf)];
					memset(number, '\0', wcslen((wchar*) args.buf));
					sprintf(number, "%S", (wchar*) args.buf);
				}

				strNumber = number;
				temp = new Contact(strName, strNumber);
				allContacts.add(temp);

				delete number;
				//printf("number: %s", strNumber.c_str());
			}
		}

		maPimItemClose(pimItemHandle);
		pimItemHandle = maPimListNext(mContactsListHandle);
	}
	maPimListClose(mContactsListHandle);
}
ShopCategoriesScreen::ShopCategoriesScreen(MainScreen *previous, Feed *feed, int screenType) : mHttp(this), screenType(screenType) {

	lprintfln("ShopCategoriesScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	this->feed = feed;
	next = NULL;
	label = NULL;
	currentSelectedKey = NULL;
	currentKeyPosition = -1;
	if (screenType == ST_FREEBIE) {
		mainLayout = Util::createMainLayout("", "", true);
	} else {
		mainLayout = Util::createMainLayout("", "Back", true);
	}

	listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2];
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];

	notice->setDrawBackground(false);

	listBox->setHeight(listBox->getHeight() - 20);

	int res = -1;
	int urlLength = 100 + URLSIZE;
	char *url = new char[urlLength+1];
	memset(url,'\0',urlLength+1);
	switch(screenType) {
		case ST_FREEBIE:
			notice->setCaption("Checking for shop categories...");
			sprintf(url, "%s?productcategories=1", URL);
			lprintfln("%s", url);
			res = mHttp.create(url, HTTP_GET);
			break;
		case ST_SHOP:
			notice->setCaption("Checking for shop categories...");
			sprintf(url, "%s?productcategories=2", URL);
			lprintfln("%s", url);
			res = mHttp.create(url, HTTP_GET);
			break;
		case ST_AUCTIONS:
			notice->setCaption("Checking for auction categories...");
			sprintf(url, "%s?auctioncategories=1", URL);
			lprintfln("%s", url);
			res = mHttp.create(url, HTTP_GET);
			break;
		case ST_RANKING:
		case ST_FRIEND:
			notice->setCaption("Checking the latest rankings...");
			sprintf(url, "%s?leaders=1", URL);
			lprintfln("%s", url);
			res = mHttp.create(url, HTTP_GET);
			break;
	}
	delete [] url;
	url = NULL;
	if(res < 0) {
		drawList();
		notice->setCaption("Unable to connect, try again later...");
	} else {
		mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str());
		mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str());
		feed->addHttp();
		mHttp.finish();
	}
	this->setMain(mainLayout);

	moved = 0;
}
Esempio n. 28
0
NoteScreen::NoteScreen(MainScreen *previous, Feed *feed, Card *card, int screenType, String detail) : mHttp(this),
card(card), screenType(screenType), detail(detail) {
	lprintfln("NoteScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	this->feed = feed;
	moved = 0;
	list = false;
	left = false;
	right = false;
	isBusy = false;

	parentTag = "";
	note = "";
	encodedNote = "";
	origionalNote = "";
	currentSelectedKey = NULL;
	currentKeyPosition = -1;

	switch (screenType) {
		case ST_CARD_NOTE:
			mainLayout = Util::createMainLayout("Save", "Back", "", true);
			break;
		case ST_SMS:
			mainLayout = Util::createMainLayout("Send", "Back", "", true);
		break;
	}

	kinListBox = (KineticListBox*)mainLayout->getChildren()[0]->getChildren()[2];
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];

	Layout *feedlayout;
	String cardText = "";
	switch (screenType) {
		case ST_CARD_NOTE:
			mImageCache = new ImageCache();


			cardText += card->getText();
			cardText += " (";
			cardText += card->getQuantity();
			cardText += ")\n";
			cardText += card->getRarity();
			cardText += "\nRating: ";
			cardText += card->getRanking();
			//cardText += "\nRarity: ";

			feedlayout = new Layout(0, 0, kinListBox->getWidth()-(PADDING*2), 74, kinListBox, 3, 1);
			feedlayout->setSkin(Util::getSkinAlbum());
			feedlayout->setDrawBackground(false);
			feedlayout->addWidgetListener(this);

			if (strcmp(card->getQuantity().c_str(), "0") != 0) {
				//if the user has one or more of the card, the image must be downloaded
				tempImage = new MobImage(0, 0, 56, 64, feedlayout, false, false, Util::loadImageFromResource(RES_LOADINGTHUMB));
				tempImage->setHasNote(card->getNote().length()>0);
				Util::retrieveThumb(tempImage, card, mImageCache);
			}
			else {
				//we use the blank image for cards they dont have yet
				tempImage = new MobImage(0, 0, 56, 64, feedlayout, false, false, Util::loadImageFromResource(RES_MISSINGTHUMB));
			}

			label = new Label(0,0, scrWidth-86, 74, feedlayout, cardText, 0, Util::getDefaultFont());
			label->setVerticalAlignment(Label::VA_CENTER);
			label->setAutoSizeY();
			label->setDrawBackground(false);
			label->setAutoSizeX();
			label->setMultiLine();
			label = new Label(0,0, scrWidth-PADDING*2, DEFAULT_SMALL_LABEL_HEIGHT, NULL, "Note", 0, Util::getDefaultFont());
			label->setDrawBackground(false);
			kinListBox->add(label);
			break;
		case ST_SMS:
			label = new Label(0,0, scrWidth-PADDING*2, DEFAULT_SMALL_LABEL_HEIGHT, NULL, "SMS", 0, Util::getDefaultFont());
			label->setDrawBackground(false);
			kinListBox->add(label);
		break;
	}
	int height = 48;
	if((kinListBox->getHeight()-(feedlayout->getHeight()+48)) > 48){
		height = (kinListBox->getHeight()-(feedlayout->getHeight()+48));
	}
	label =  new Label(0,0, scrWidth-(PADDING*2), height, NULL, "", 0, Util::getDefaultFont());
	label->setSkin(Util::getSkinEditBox());
	Util::setPadding(label);

	editBoxNote = new NativeEditBox(0, 0, label->getWidth()-PADDING*2, label->getHeight()-PADDING*2,140, MA_TB_TYPE_ANY, label, "",L"Note");
	editBoxNote->setDrawBackground(false);
	editBoxNote->setMaxLength(140);
	editBoxNote->setMultiLine(true);

	switch (screenType) {
		case ST_CARD_NOTE:
			editBoxNote->setCaption(Util::base64_decode(card->getNote()));
			break;
	}

	label->addWidgetListener(this);
	kinListBox->add(label);

	this->setMain(mainLayout);

	label->setSelected(true);
	kinListBox->setSelectedIndex(1);
}
AuctionListScreen::AuctionListScreen(Screen *previous, Feed *feed, int screenType, String catId) : mHttp(this), screenType(screenType), categoryId(catId), previous(previous), feed(feed) {
	lprintfln("AuctionListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	emp = true;
	left = false;
	right = false;
	list = false;
	shouldUpdateAuction = false;


	clearAuctions();
	deleteAuctions();

	parentTag = "";
	cardText = "";
	cardId = "";
	description = "";
	thumburl = "";
	openingBid = "";
	price = "";
	userCardId = "";
	auctionCardId = "";
	username = "";
	buyNowPrice = "";
	error_msg = "";
	endDate = "";
	lastBidUser = "";

	moved = 0;

	card = NULL;
	auction = NULL;

	next = NULL;

	label = NULL;
	tempImage = NULL;

	mImageCache = new ImageCache();
	mainLayout = Util::createMainLayout("", "Back", "", true);

	listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2];
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];
	notice->setCaption("Getting auctions...");

	//work out how long the url will be, the number is for the & and = symbols as well as hard coded params
	int urlLength = 0;
	switch (screenType) {
		case ST_CATEGORY:
			urlLength = 74 + URLSIZE + categoryId.length() + Util::intlen(scrHeight) + Util::intlen(scrWidth);
			break;
		case ST_USER:
			urlLength = 73 + URLSIZE + feed->getUsername().length() +  + Util::intlen(scrHeight) + Util::intlen(scrWidth);
			break;
	}
	char *url = new char[urlLength+1];
	memset(url,'\0',urlLength+1);
	switch (screenType) {
		case ST_CATEGORY:
			sprintf(url, "%s?categoryauction=1&category_id=%s&height=%d&width=%d&jpg=1", URL,
					categoryId.c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth());
			break;
		case ST_USER:
			sprintf(url, "%s?userauction=1&username=%s&height=%d&width=%d&jpg=1", URL,
					feed->getUsername().c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth());
			break;
	}
	if(mHttp.isOpen()){
		mHttp.close();
	}
	mHttp = HttpConnection(this);
	int res = mHttp.create(url, HTTP_GET);
	if(res < 0) {
		drawList();

		notice->setCaption("Unable to connect, try again later...");

	} else {
		mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str());
		mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str());
		feed->addHttp();
		mHttp.finish();

	}
	delete [] url;
	url = NULL;

	this->setMain(mainLayout);
}
Esempio n. 30
0
OptionsScreen::OptionsScreen(Feed *feed, int screenType, MainScreen *previous, Card *card, String number, String deckId) :mHttp(this),
card(card), screenType(screenType), number(number), deckId(deckId) {
	lprintfln("OptionsScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	this->previous = previous;
	this->feed = feed;
	temp = "";
	temp1 = "";
	error_msg = "";

	connError = false;
	busy = false;

	currentSelectedKey = NULL;
	currentKeyPosition = -1;
	menu = NULL;

	next = NULL;
	album = NULL;
	if (screenType == ST_LOGIN_OPTIONS) {
		mainLayout = Util::createMainLayout("", "Exit");
	}
	else {
		mainLayout = Util::createMainLayout("", "Back");
	}
	listBox = (KineticListBox*)mainLayout->getChildren()[0]->getChildren()[2];
	notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1];

	switch(screenType) {
		case ST_TRADE_OPTIONS:
			label = Util::createSubLabel("Send card to auction");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Send card to friend");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_AUCTION_OPTIONS:
			label = Util::createSubLabel("My Auctions");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Create New Auction");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_PLAY_OPTIONS:
			checkForGames();
			this->setMain(mainLayout);
			return;
		case ST_GAME_OPTIONS:
			label = Util::createSubLabel("Leave Game");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("View Game Log");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_NEW_GAME_OPTIONS:
			label = Util::createSubLabel("Play versus PC");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Play Quick Match");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Play versus friend");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Game Lobby");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_CARD_OPTIONS:
			label = Util::createSubLabel("Notes");
			label->addWidgetListener(this);
			listBox->add(label);
			//label = Util::createSubLabel("Share");
			//label->addWidgetListener(this);
			//listBox->add(label);
			label = Util::createSubLabel("Auction");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Compare");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Details");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_NEW_CARD:
			label = Util::createSubLabel("Accept");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Reject");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_NUMBER_OPTIONS:
			label = Util::createSubLabel("Call");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("SMS");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
		case ST_LOGIN_OPTIONS:
			label = Util::createSubLabel("Log In");
			label->addWidgetListener(this);
			listBox->add(label);
			label = Util::createSubLabel("Register");
			label->addWidgetListener(this);
			listBox->add(label);
			break;
	}

	listBox->setSelectedIndex(0);

	this->setMain(mainLayout);
}