Ejemplo n.º 1
0
ProjectMenu::ProjectMenu() : ConcreteMenuable(menuName())
{
	MenuNode* project = node(action("Project"));
	project->children.append(node(action("Add Existing Files...", QKeySequence::UnknownKey)));
	project->children.append(node(action("Add New File...", QKeySequence::UnknownKey)));
	project->children.append(node(action("Remove Selected Files", QKeySequence::UnknownKey)));
	project->children.append(node(action("Extract to...", QKeySequence::UnknownKey)));
	m_actions.append(project);
}
Ejemplo n.º 2
0
DeveloperMenu::DeveloperMenu(MainWindow* mainWindow) : ConcreteMenuable(menuName()), m_mainWindow(mainWindow)
{
	MenuNode* developer = new MenuNode("Developer");
	developer->children.append(node(injectScript = action("Inject Script")));
	developer->children.append(node(writeFullProject = action("Write Full Project")));
	developer->children.append(node(writeDeltaProject = action("Write Delta Project")));
#ifdef BUILD_DECLARATIVE_TAB
	developer->children.append(node(declTab = action("Create Declarative Tab")));
#endif
	developer->children.append(MenuNode::separator());
	developer->children.append(node(uninstallAll = action("Uninstall All Packages")));
	m_actions.append(developer);
}
Ejemplo n.º 3
0
//TODO: this is kind of funky; a launchpoint of an app should really just present the info for the app.
json_object* LaunchPoint::toJSON() const
{
	json_object* json = json_object_new_object();
	json_object_object_add(json, (char*) "id",   json_object_new_string((char*) id().c_str()));
	if (m_appDesc) {
		json_object_object_add(json, (char*) "version", json_object_new_string(m_appDesc->version().c_str()));
		json_object_object_add(json, (char*) "appId", json_object_new_string((char*) m_appDesc->id().c_str()));
		json_object_object_add(json, (char*) "vendor", json_object_new_string((char*) m_appDesc->vendorName().c_str()));
		json_object_object_add(json, (char*) "vendorUrl", json_object_new_string((char *) m_appDesc->vendorUrl().c_str()));
		int appSize = 0;
		std::string packageId = m_appDesc->id();
		if (this->isDefault()) {
			PackageDescription* packageDesc = ApplicationManager::instance()->getPackageInfoByAppId(m_appDesc->id());
			if (packageDesc) {
				appSize = packageDesc->packageSize();
				packageId = packageDesc->id();
			}

		}
		json_object_object_add(json, (char*) "size", json_object_new_int(appSize));
		json_object_object_add(json, (char*) "packageId", json_object_new_string((char*) packageId.c_str()));

		if (m_appDesc->dockModeStatus()) {
			json_object_object_add(json, (char*) "exhibitionMode", json_object_new_boolean(true));
			json_object_object_add(json, (char*) "exhibitionModeTitle", json_object_new_string((char*)m_appDesc->dockModeTitle().c_str()));
		}
	} else {
		json_object_object_add(json, (char*) "size", json_object_new_int(0));
		json_object_object_add(json, (char*) "packageId", json_object_new_string((char*) m_appDesc->id().c_str()));
	}
	json_object_object_add(json, (char*) "removable", json_object_new_boolean(m_removable));

	json_object_object_add(json, (char*) "launchPointId", json_object_new_string((char*) launchPointId().c_str()));
	json_object_object_add(json, (char*) "title", json_object_new_string((char*) title().c_str()));
	json_object_object_add(json, (char*) "appmenu", json_object_new_string((char*)menuName().c_str()));
	json_object_object_add(json, (char*) "icon", json_object_new_string((char*) iconPath().c_str()));

	if (!params().empty() && m_appDesc->type() != ApplicationDescription::Type_Qt) {
        if (m_appDesc->type() == ApplicationDescription::Type_Qt) {
            json_object_object_add(json, (char*) "params", json_object_new_string(params().c_str()));
        }
        else {
    		json_object* paramsJson = json_tokener_parse(params().c_str());
	    	json_object_object_add(json, (char*) "params", paramsJson);
        }
	}

	return json;
}
Ejemplo n.º 4
0
QMenu* BaseWindow::buildServerMenu(ServerRecord *rec)
{
    QString menuName("%1 (%2)");
    menuName = menuName.arg(rec->serverName(), rec->serverHost());

    // Build the base menu
    QMenu *menu = new QMenu(menuName);

    QAction *open = menu->addAction("Knock Open...");
    QAction *close = menu->addAction("Knock Close...");

    // Connect the actions
    connect(open, SIGNAL(triggered()), rec, SIGNAL(knockOpen()));
    connect(close, SIGNAL(triggered()), rec, SIGNAL(knockClose()));

    return menu;
}
Ejemplo n.º 5
0
// Split component path into "top-level menu name" and "everything else".
// Path is of format "MenuType/tile/tile/..." following hierarchy defined in menu's xml.
// Returns pointer to top-level menu or NULL.
// pSlashPos is set to the slash character after the top-level menu name.
TileMenu* InterfaceManager::GetMenuByPath(const char * componentPath, const char ** pSlashPos)
{
	// get menu name - stored by game as "&MENUNAME;" so need to fix it up
	const char* slashPos = strpbrk(componentPath, "\\/");
	if(slashPos)
	{
		std::string menuName("&");
		menuName.append(componentPath, (slashPos - componentPath));
		menuName.append(";");

		UInt32 menuType = Tile::TraitNameToID(menuName.c_str());
		if((menuType >= kMenuType_Min) && (menuType <= kMenuType_Max))
		{
			TileMenu * tileMenu = g_TileMenuArray->Get(menuType - kMenuType_Min);
			if(tileMenu)
			{
				*pSlashPos = slashPos;
				return tileMenu;
			}
		}
	}

	return NULL;
}
MainView::MainView(BRect frame) 
	:
	BView(frame, 
			NULL, 
			B_FOLLOW_TOP|B_FOLLOW_LEFT, 
			B_FRAME_EVENTS|B_WILL_DRAW|B_FULL_UPDATE_ON_RESIZE)
{
	this->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BRect tempRect = this->Bounds();
	tempRect.InsetBy(5, 5);
	
	CategoryListView* listView = new CategoryListView( tempRect, "list" );
	if ( !listView )
	{
		/* Panic! */
		exit(1);
	}
	
/*	tempRect.right -= B_V_SCROLL_BAR_WIDTH;
	tempRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
	
	BListView* listView = new BListView(tempRect, "list");
	if (!listView) { exit(1); }
	
*/
	this->scrollView = new BScrollView("scroll",
			listView,
			B_FOLLOW_LEFT | B_FOLLOW_TOP,
			B_FRAME_EVENTS,
			true, true);

	if (!scrollView) { exit(1); }
	
	listView->SetScroller( scrollView );
/*	((BScrollBar*)(scrollView->ScrollBar(B_VERTICAL)))->SetSteps(5, 20);
	((BScrollBar*)(scrollView->ScrollBar(B_HORIZONTAL)))->SetSteps(5, 20);

	 
	BBitmap *icon = NULL;
	icon = CreateIcon(kBlue);
	IconListItem *item = new IconListItem(icon,
										  "Test1",
										  0,
										  false);											  
	if (!item) { exit(1); }
	
	listView->AddItem(item);
	
	icon = CreateIcon(kMagen);
	item = new IconListItem(icon,
						  "Test2",
						  0,
						  false);											  
	if (!item) { exit(1); }
	listView->AddItem(item);
	
	icon = CreateIcon(kWhite);
	item = new IconListItem(icon,
						  "White icon",
						  0,
						  false);											  
	if (!item) { exit(1); }
	listView->AddItem(item);
	
	icon = CreateIcon(kMedGray);
	item = new IconListItem(icon,
						  "Категория на русском",
						  0,
						  false);											  
	if (!item) { exit(1); }
	listView->AddItem(item);

	BString categoryName("Категория с именем из BString");
	icon = CreateIcon(kBlue);	
	item = new IconListItem(icon,
				categoryName.String(),
				0,
				false);
	if (!item) { exit(1); }
	listView->AddItem(item);
*/	
	rgb_color red = { 255, 0, 0, 255 };
	BString catName = "CategoryListItem";
	
	BListItem* listItem = new CategoryListItem( red, catName );
	if ( !listItem ) { exit(1); }
	listView->AddItem( listItem );
	
//	listView->ResizeToPreferred();
	
	
	BGroupLayout* layout = new BGroupLayout( B_VERTICAL );
	if (!layout ) { /* Panic! */  exit(1); }
	this->SetLayout( layout );
	layout->SetInsets( 5, 5, 5, 5 );
	
	layout->AddView( scrollView );
	
	CategoryMenu* catMenu = new CategoryMenu( "CatMenu", NULL );
	
	CategoryMenuItem* item1 = new CategoryMenuItem( catName, red, NULL );
	
	catMenu->AddItem( item1 );
	
	BString menuName("Categories");
	BMenuField* menuField = new BMenuField( BRect( 0, 0, 1, 1),
											"Menu field",
											menuName,
											catMenu );
	menuField->ResizeToPreferred();
	layout->AddView( menuField );
	
	
	// this->AddChild(scrollView);
	// FixupScrollbars();
}