void StandardPLPanel::showView( int i_view ) { switch( i_view ) { case TREE_VIEW: { if( treeView == NULL ) createTreeView(); currentView = treeView; break; } case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } default: return; } viewStack->setCurrentWidget( currentView ); viewActions[i_view]->setChecked( true ); browseInto(); gotoPlayingItem(); }
/** * Lay out the widgets (portrait mode). */ void TitleScreen::setupUI() { // Get the handle to the main layout and the screen. mMainLayout = getMainLayout(); mScreen = getScreen(); mLabel = getTopLabel(); mBackButton = getTopButtonLeft(); mNextButton = getTopButtonRight(); // Set the text for the widget in the top layout: the label and the buttons. setButtonText(mNextButton, " NEXT "); setButtonText(mBackButton, " BACK "); // The creation of the main layout is already done in the base class // constructor, called at derived object creation. // So, we can use a handle for the main layout at any point. // Add an empty list view. // Each line will have a check box, and the related label with article title // List is populated when search is performed, and showScreen() is called. // The height is ScreenHeight - the size of the top layout. mListView = createListView(mScreenWidth, 7*mScreenHeight/8); maWidgetAddChild(mMainLayout, mListView); }
void OutputWidget::addOutput( int id ) { QTreeView* listview = createListView(id); setCurrentWidget( listview ); connect( data->outputdata.value(id), SIGNAL(modelChanged(int)), this, SLOT(changeModel(int))); connect( data->outputdata.value(id), SIGNAL(delegateChanged(int)), this, SLOT(changeDelegate(int))); enableActions(); }
void OutputWidget::addOutput( int id ) { QTreeView* listview = createListView(id); setCurrentWidget( listview ); connect( data->outputdata.value(id), &OutputData::modelChanged, this, &OutputWidget::changeModel); connect( data->outputdata.value(id), &OutputData::delegateChanged, this, &OutputWidget::changeDelegate); enableActions(); }
NewsScene::NewsScene() { CCHttpRequest *requestor = CCHttpRequest::sharedHttpRequest(); char tmpbuf[128]; time_t ltime; struct tm *today; time( <ime ); today = localtime( <ime ); /* Use strftime to build a customized time string. */ strftime( tmpbuf, 128,"Today is %A, day %d of %B in the year %Y.\n", today ); std::stringstream ss; std::stringstream ss2; ss << today->tm_mday<<"-" << today->tm_mon<<"-" << today->tm_year+1900<<"&hora="<<today->tm_hour<<"-"<<today->tm_min; ss2 << today->tm_mday<<"-" << today->tm_mon+1<<"-" << today->tm_year+1900<<"&hora="<<today->tm_hour<<"-"<<today->tm_min; // ss << "28"<<"-" << "05"<<"-" << "2014"; // Create a new dictionary // Add the data you would like to store string url; FileFunctions * tmpFile = new FileFunctions; tmpFile->writeDay(ss2.str()); url = url +"http://clientes.farofastudios.com.br/Einstein/admin/v2/json.php?data=" + ss.str(); string postData = "key=val"; requestor->addGetTask(url, this, callfuncND_selector(NewsScene::onHttpRequestCompleted)); createListView(); }
void StandardPLPanel::showView( int i_view ) { switch( i_view ) { case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } case PICTUREFLOW_VIEW: { if( picFlowView == NULL ) createCoverView(); currentView = picFlowView; break; } default: case TREE_VIEW: { if( treeView == NULL ) createTreeView(); currentView = treeView; break; } } changeModel( false ); viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); }
/** * Fill the list box with data provided by the engine. */ void SummaryScreen::fillListBox() { // Clear previous data. mSnippetLabels.clear(); mSnippets.clear(); // For each snippet we need to know the article title. mSnippets = mWiki->getAllSnippetsWithTitle(); // Destroy the list view, and recreate it. if ( mListView != -1){ maWidgetDestroy(mListView); } mListView = createListView(mScreenWidth, 7*mScreenHeight/8); setWidgetProperty(mListView, MAW_WIDGET_BACKGROUND_COLOR, DARK_WHITE, 16); maWidgetAddChild(mMainLayout, mListView); // If no titles are selected, display a short message. if (mSnippets.size() == 0) { MAWidgetHandle listItem = maWidgetCreate(MAW_LIST_VIEW_ITEM); maWidgetSetProperty( listItem, MAW_LIST_VIEW_ITEM_TEXT, WARNING_NOTHING_SELECTED.c_str() ); maWidgetAddChild(mListView, listItem); } // Update the UI. for (int i=0; i < mSnippets.size(); i++) { MAWidgetHandle listItem = maWidgetCreate(MAW_LIST_VIEW_ITEM); maWidgetSetProperty( listItem, MAW_LIST_VIEW_ITEM_TEXT, mSnippets[i].c_str() ); mSnippetLabels.add(listItem); maWidgetAddChild(mListView,mSnippetLabels[i]); } }
/** * Lay out the widgets (portrait mode). */ void SummaryScreen::setupUI() { // Get the handle to the main layout and the screen. mMainLayout = getMainLayout(); mScreen = getScreen(); mLabel = getTopLabel(); mHomeButton = getTopButtonRight(); mBackButton = getTopButtonLeft(); // Set the text for the widget in the top layout: the label and button. setButtonText(mBackButton, " BACK "); setButtonText(mHomeButton, " New Search "); // Add the list view that will contain the snippets. // It will be filled when this screen is displayed, based on the checked // titles from TitlesScreen. // The height is ScreenHeight - the size of the top layout. mListView = createListView(mScreenWidth, 7*mScreenHeight/8); maWidgetAddChild(mMainLayout, mListView); }
void TuiManager::parseControl(Node* container,xml_node<char> *item) { int tag = atof(item->first_attribute("tag")->value()); int x = atof(item->first_attribute("x")->value()); int y = atof(item->first_attribute("y")->value()); int w = atoi(item->first_attribute("width")->value()); int h = atoi(item->first_attribute("height")->value()); int rotation = atof(item->first_attribute("rotation")->value()); if(strcmp(item->first_attribute("type")->value(), kTuiContainerPanel) == 0){//panel CWidgetWindow* pPanel = createPanel(tag,x,y,w,h,rotation); container->addChild(pPanel); //recursive for( xml_node<char> *iitem = item->first_node( kTuiNodeControl );iitem != NULL; iitem = iitem->next_sibling()){ parseControl(pPanel,iitem); } }else if (strcmp(item->first_attribute("type")->value(), kTuiControlCell) == 0){//cell //recursive for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){ parseControl(container, iitem); } }else if(strcmp(item->first_attribute("type")->value(),kTuiControlImage) == 0){//image const char* file = item->first_attribute("image")->value(); float scaleX = atof(item->first_attribute("scaleX")->value()); float scaleY = atof(item->first_attribute("scaleY")->value()); CImageView *pImg = createImage(tag, file, scaleX, scaleY, x, y, rotation); container->addChild(pImg); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlImage9) == 0){//image9 const char* file = item->first_attribute("image")->value(); float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); float up = atof(item->first_attribute("up")->value()); float down = atof(item->first_attribute("down")->value()); float left = atof(item->first_attribute("left")->value()); float right = atof(item->first_attribute("right")->value()); CImageViewScale9 *pImg = createImage9(tag,file,x,y,w,h,up,down,left,right,rotation); container->addChild(pImg); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlButton) == 0){//button const char* normal = item->first_attribute("normal")->value(); const char* select = item->first_attribute("select")->value(); const char* disable = item->first_attribute("disable")->value(); float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); CButton *pBtn = createBtn(tag,normal,select,disable,x,y,w,h,rotation); container->addChild(pBtn); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlToggleView) == 0){//toggleView const char* normal = item->first_attribute("normal")->value(); const char* select = item->first_attribute("select")->value(); const char* disable = item->first_attribute("disable")->value(); float exclusion = atof(item->first_attribute("exclusion")->value()); CToggleView* toggle = createToggleView(tag,exclusion,normal,select,disable,x,y,rotation); container->addChild(toggle); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlSlider) == 0){//slider const char* bg = item->first_attribute("bg")->value(); const char* progress = item->first_attribute("progress")->value(); const char* thumb = item->first_attribute("thumb")->value(); CSlider *pSlider = createSlider(tag,bg,progress,thumb,x,y,rotation); container->addChild(pSlider); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlProgress) == 0){//progress const char* bg = item->first_attribute("bg")->value(); const char* progress = item->first_attribute("progress")->value(); CProgressBar *pProgress = createProgress(tag,bg,progress,x,y,rotation); container->addChild(pProgress); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlLabel) == 0){//label float size = atof(item->first_attribute("textSize")->value()); int alignment = atoi(item->first_attribute("alignment")->value()); const char* text = item->first_attribute("text")->value(); const char* font = item->first_attribute("textFont")->value(); float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); int r = atoi(item->first_attribute("red")->value()); int g = atoi(item->first_attribute("green")->value()); int b = atoi(item->first_attribute("blue")->value()); int r2 = atoi(item->first_attribute("strokeRed")->value()); int g2 = atoi(item->first_attribute("strokeGreen")->value()); int b2 = atoi(item->first_attribute("strokeBlue")->value()); int strokeSize = atoi(item->first_attribute("strokeSize")->value()); int shadowDistance = atoi(item->first_attribute("shadowDistance")->value()); int shadowBlur = atoi(item->first_attribute("shadowBlur")->value()); CLabel *pLabel = createLabel(tag, text, font, alignment, size, r, g, b, x, y, w, h, r2,g2,b2,strokeSize,shadowDistance,shadowBlur,rotation); container->addChild(pLabel); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlLabelAtlas) == 0){//labelAtlas const char* imgPath = item->first_attribute("image")->value(); float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); CLabelAtlas *pLabAtlas = createLabelAtlas(tag,imgPath,x,y,w,h,rotation); container->addChild(pLabAtlas); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlArmature) == 0){//armature const char* xml = item->first_attribute("xml")->value(); const char* png = item->first_attribute("png")->value(); const char* plist = item->first_attribute("plist")->value(); const char* name = item->first_attribute("name")->value(); Armature *pArmature = createArmature(tag,name,png,plist,xml,x,y,rotation); container->addChild(pArmature); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlAnim) == 0){//animation const char* png = item->first_attribute("png")->value(); const char* plist = item->first_attribute("plist")->value(); const char* name = item->first_attribute("name")->value(); Sprite *pSprite = createAnim(tag,name,png,plist,x,y,rotation); container->addChild(pSprite); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlControl) == 0){//controlView const char* baseboard = item->first_attribute("baseboard")->value(); const char* joystick = item->first_attribute("joystick")->value(); CControlView *pControl = createControl(tag,baseboard,joystick,x,y,rotation); container->addChild(pControl); }else if (strcmp(item->first_attribute("type")->value(), kTuiContainerScroll) == 0){//scrollView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); int direction = atof(item->first_attribute("direction")->value()); int innerWidth = atoi(item->first_attribute("innerWidth")->value()); int innerHeight = atoi(item->first_attribute("innerHeight")->value()); CScrollView *pView = createScrollView(tag, direction, innerWidth, innerHeight, x, y, w, h, rotation); container->addChild(pView); //recursive for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){ parseControl(pView->getContainer(), iitem); } }else if (strcmp(item->first_attribute("type")->value(), kTuiContainerLayout) == 0){//layout float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); CLayout *pLayout = createLayout(tag, x, y, w, h, rotation); container->addChild(pLayout); //recursive for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){ parseControl(pLayout, iitem); } Vector<Node*> vet = pLayout->getChildren(); for (Node *pChild : vet){//Offset coordinates Because CLayout zero point in the lower left corner pChild->setPosition(pChild->getPosition() + Point(w / 2, h / 2)); } }else if(strcmp(item->first_attribute("type")->value(),kTuiControlListView) == 0){//listView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); const char* img = item->first_attribute("image")->value(); float num = atof(item->first_attribute("num")->value()); CListView* pList = createListView(tag,img,x,y,w,h,rotation); container->addChild(pList); for(int i=0; i<num;i++){//add item xml_node<char> *iitem = item->first_node( kTuiNodeControl ); w = atof(iitem->first_attribute("width")->value()); h = atof(iitem->first_attribute("height")->value()); CLayout *pLayout = createLayout(i,0,0,w,h,rotation); for( xml_node<char> *iiitem = iitem->first_node( kTuiNodeControl );iiitem!=NULL; iiitem = iiitem->next_sibling()){ parseControl(pLayout,iiitem); } Vector<Node*> vet = pLayout->getChildren(); for(Node *pChild : vet){//Offset coordinates Because CLayout zero point in the lower left corner if(pChild->getTag() > 0) pChild->setPosition(pChild->getPosition()+Point(w/2,h/2)); } pList->insertNodeAtLast(pLayout); } pList->reloadData(); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlPageView) == 0){//pageView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); float num = atoi(item->first_attribute("num")->value()); int dir = atoi(item->first_attribute("direction")->value()); const char* img = item->first_attribute("image")->value(); CPageView *pPageView = createPageView(tag, img, dir, num, x, y, w, h, rotation); container->addChild(pPageView); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlCheckBox) == 0){//checkBox const char* normal1 = item->first_attribute("normal1")->value(); const char* normal2 = item->first_attribute("normal2")->value(); const char* select1 = item->first_attribute("select1")->value(); const char* select2 = item->first_attribute("select2")->value(); const char* disable1 = item->first_attribute("disable1")->value(); const char* disable2 = item->first_attribute("disable2")->value(); CCheckBox *pCheckBox = createCheckBox(tag,normal1,normal2,select1,select2,disable1,disable2,x,y,rotation); container->addChild(pCheckBox); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlArmatureBtn) == 0){//ArmatureBtn const char* png = item->first_attribute("png")->value(); const char* plist = item->first_attribute("plist")->value(); const char* name = item->first_attribute("name")->value(); const char* xml = item->first_attribute("xml")->value(); ArmatureBtn *pArmBtn = createArmatureBtn(tag,name,png,plist,xml,x,y,rotation); container->addChild(pArmBtn); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlNumbericStepper) == 0){//NumbericStepper const char* lnormal = item->first_attribute("lnormal")->value(); const char* rnormal = item->first_attribute("rnormal")->value(); const char* lselect = item->first_attribute("lselect")->value(); const char* rselect = item->first_attribute("rselect")->value(); const char* ldisable = item->first_attribute("ldisable")->value(); const char* rdisable = item->first_attribute("rdisable")->value(); const char* stepBg = item->first_attribute("stepBg")->value(); NumericStepper *pNumStep = createNumStep(tag,lnormal,lselect,ldisable,rnormal,rselect,rdisable,stepBg,x,y,rotation); container->addChild(pNumStep); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlPaticle) == 0){//Paticle const char* plist = item->first_attribute("plist")->value(); ParticleSystem *pPartical = createParticle(tag,plist,x,y); container->addChild(pPartical); }else if (strcmp(item->first_attribute("type")->value(), kTuiControlTable) == 0){//TableView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); float num = atoi(item->first_attribute("num")->value()); int dir = atoi(item->first_attribute("direction")->value()); int cellWidth = atoi(item->first_attribute("cellWidth")->value()); int cellHeight = atoi(item->first_attribute("cellHeight")->value()); const char* img = item->first_attribute("image")->value(); CTableView *pView = createTableView(tag, img, dir, num, cellWidth, cellHeight, x, y, w, h, rotation); container->addChild(pView); }else if (strcmp(item->first_attribute("type")->value(), kTuiControlGridView) == 0){//GridView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); int cellWidth = atoi(item->first_attribute("cellWidth")->value()); int cellHeight = atoi(item->first_attribute("cellHeight")->value()); int column = atoi(item->first_attribute("column")->value()); int num = atoi(item->first_attribute("num")->value()); const char* img = item->first_attribute("image")->value(); CGridView *pView = createGridView(tag, img, column, num, cellWidth, cellHeight, x, y, w, h, rotation); container->addChild(pView); }else if (strcmp(item->first_attribute("type")->value(), kTuiControlGridPageView) == 0){//GridPageView float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); int cellWidth = atoi(item->first_attribute("cellWidth")->value()); int cellHeight = atoi(item->first_attribute("cellHeight")->value()); int column = atoi(item->first_attribute("column")->value()); int row = atoi(item->first_attribute("row")->value()); int num = atoi(item->first_attribute("num")->value()); int dir = atoi(item->first_attribute("direction")->value()); const char* img = item->first_attribute("image")->value(); CGridPageView *pView = createGridPageView(tag, img, dir, column, row, num, cellWidth, cellHeight, x, y, w, h, rotation); container->addChild(pView); }else if(strcmp(item->first_attribute("type")->value(),kTuiControlEditBox) == 0){//EditBox float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); const char* img = item->first_attribute("image")->value(); int inputMode = atoi(item->first_attribute("inputMode")->value()); int inputFlag = atoi(item->first_attribute("inputFlag")->value()); EditBox *pEdit = createEditBox(tag, img, inputMode, inputFlag, x, y, w, h, rotation); container->addChild(pEdit); }else if (strcmp(item->first_attribute("type")->value(), kTuiControlMovieView) == 0){//MovieView const char* png = item->first_attribute("png")->value(); const char* plist = item->first_attribute("plist")->value(); const char* json = item->first_attribute("json")->value(); MovieView *pMovieView = createMovieView(tag, json, plist, png, x, y, rotation); container->addChild(pMovieView); }else if (strcmp(item->first_attribute("type")->value(), kTuiContainerCircleMenu) == 0){//CircleMenu float w = atof(item->first_attribute("width")->value()); float h = atof(item->first_attribute("height")->value()); CircleMenu *pMenu = createCircleMenu(tag, x, y, w, h, rotation); container->addChild(pMenu); //recursive for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){ parseControl(pMenu, iitem); } pMenu->reloadData(); } }
void StandardPLPanel::showView( int i_view ) { bool b_treeViewCreated = false; switch( i_view ) { case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } case PICTUREFLOW_VIEW: { if( picFlowView == NULL ) createCoverView(); currentView = picFlowView; break; } default: case TREE_VIEW: { if( treeView == NULL ) { createTreeView(); b_treeViewCreated = true; } currentView = treeView; break; } } changeModel( false ); /* Restoring the header Columns must come after changeModel */ if( b_treeViewCreated ) { assert( treeView ); if( getSettings()->contains( "Playlist/headerStateV2" ) ) { treeView->header()->restoreState(getSettings() ->value( "Playlist/headerStateV2" ).toByteArray() ); /* if there is allready stuff in playlist, we don't sort it and we reset sorting */ if( model->rowCount() ) { treeView->header()->setSortIndicator( -1 , Qt::AscendingOrder ); } } else { for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ ) { treeView->setColumnHidden( c, !( m & COLUMN_DEFAULT ) ); if( m == COLUMN_TITLE ) treeView->header()->resizeSection( c, 200 ); else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 ); } } } viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); }
/** * Fill the list box with data provided by the engine. */ void TitleScreen::fillListBox() { // Clear previous entries. mCheckBoxes.clear(); mTitleLabels.clear(); mTitles.clear(); mSnippets.clear(); mTitles = mWiki->getAllTitles(); mSnippets = mWiki->getAllSnippets(); // Destroy the list view, and recreate it. if ( mListView != -1){ maWidgetDestroy(mListView); } mListView = createListView(mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); maWidgetAddChild(mMainLayout, mListView); // Add a Select/Deselect All button. MAWidgetHandle selectAllLayout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT); // Set layout's size. setWidgetSize( selectAllLayout, mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); mSelectAll = createCheckBox(); // All titles are deselected by default. maWidgetSetProperty(mSelectAll, MAW_CHECK_BOX_CHECKED, "false"); maWidgetAddChild(selectAllLayout, mSelectAll); MAWidgetHandle labelSelectAll = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, MESSAGE_SELECT_ALL.c_str(), DARK_GREY, mFontSize ); mTitleLabels.add(labelSelectAll); maWidgetAddChild(selectAllLayout, labelSelectAll); maWidgetAddChild(mListView,selectAllLayout); // Update the UI. for (int i=0; i < mTitles.size(); i++) { // Add results in a horizontal layout. MAWidgetHandle layout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT); setWidgetSize(layout, mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); MAWidgetHandle checkbox = createCheckBox(); mCheckBoxes.add(checkbox); maWidgetAddChild(layout, mCheckBoxes[i]); MAWidgetHandle label = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, mTitles[i].c_str(), BLUE, mFontSize); mTitleLabels.add(label); maWidgetAddChild(layout, label); setWidgetProperty(layout, MAW_WIDGET_BACKGROUND_COLOR, DARK_WHITE, 16); maWidgetAddChild(mListView,layout); } }