mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge pull request #2364 from Laserlicht/map-select-popup
Mapselection - popup
This commit is contained in:
		| @@ -38,6 +38,9 @@ | ||||
| 	"vcmi.mainMenu.hostTCP" : "Host TCP/IP game", | ||||
| 	"vcmi.mainMenu.joinTCP" : "Join TCP/IP game", | ||||
| 	"vcmi.mainMenu.playerName" : "Player", | ||||
| 	 | ||||
| 	"vcmi.lobby.filename" : "Filename", | ||||
| 	"vcmi.lobby.creationDate" : "Creation date", | ||||
|  | ||||
| 	"vcmi.server.errors.existingProcess"     : "Another VCMI server process is running. Please terminate it before starting a new game.", | ||||
| 	"vcmi.server.errors.modsIncompatibility" : "The following mods are required to load the game:", | ||||
|   | ||||
| @@ -131,7 +131,7 @@ static ESortBy getSortBySelectionScreen(ESelectionScreen Type) | ||||
| } | ||||
|  | ||||
| SelectionTab::SelectionTab(ESelectionScreen Type) | ||||
| 	: CIntObject(LCLICK | KEYBOARD | DOUBLECLICK), callOnSelect(nullptr), tabType(Type), selectionPos(0), sortModeAscending(true), inputNameRect{32, 539, 350, 20} | ||||
| 	: CIntObject(LCLICK | SHOW_POPUP | KEYBOARD | DOUBLECLICK), callOnSelect(nullptr), tabType(Type), selectionPos(0), sortModeAscending(true), inputNameRect{32, 539, 350, 20} | ||||
| { | ||||
| 	OBJ_CONSTRUCTION; | ||||
|  | ||||
| @@ -324,6 +324,21 @@ void SelectionTab::clickDouble(const Point & cursorPosition) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void SelectionTab::showPopupWindow(const Point & cursorPosition) | ||||
| { | ||||
| 	int position = getLine(); | ||||
| 	int py = position + slider->getValue(); | ||||
|  | ||||
| 	if(py >= curItems.size()) | ||||
| 		return; | ||||
|  | ||||
| 	std::string text = boost::str(boost::format("{%1%}\r\n\r\n%2%:\r\n%3%") % curItems[py]->getName() % CGI->generaltexth->translate("vcmi.lobby.filename") % curItems[py]->fileURI); | ||||
| 	if(curItems[py]->date != "") | ||||
| 	    text += boost::str(boost::format("\r\n\r\n%1%:\r\n%2%") % CGI->generaltexth->translate("vcmi.lobby.creationDate") % curItems[py]->date); | ||||
|  | ||||
| 	CRClickPopup::createAndPush(text); | ||||
| } | ||||
|  | ||||
| // A new size filter (Small, Medium, ...) has been selected. Populate | ||||
| // selMaps with the relevant data. | ||||
| void SelectionTab::filter(int size, bool selectFirst) | ||||
|   | ||||
| @@ -68,6 +68,7 @@ public: | ||||
| 	void clickReleased(const Point & cursorPosition) override; | ||||
| 	void keyPressed(EShortcut key) override; | ||||
| 	void clickDouble(const Point & cursorPosition) override; | ||||
| 	void showPopupWindow(const Point & cursorPosition) override; | ||||
| 	bool receiveEvent(const Point & position, int eventType) const override; | ||||
|  | ||||
| 	void filter(int size, bool selectFirst = false); //0 - all | ||||
|   | ||||
		Reference in New Issue
	
	Block a user