[Scummvm-cvs-logs] SF.net SVN: scummvm:[41268] scummvm/trunk/gui

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Jun 6 19:54:08 CEST 2009


Revision: 41268
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41268&view=rev
Author:   sev
Date:     2009-06-06 17:54:08 +0000 (Sat, 06 Jun 2009)

Log Message:
-----------
Implement FR#1970293: "LAUNCHER: Add "quick search" input field like in iTunes"

Modified Paths:
--------------
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ListWidget.h
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/launcher.h
    scummvm/trunk/gui/themes/default.inc
    scummvm/trunk/gui/themes/scummclassic/classic_layout.stx
    scummvm/trunk/gui/themes/scummclassic/classic_layout_lowres.stx
    scummvm/trunk/gui/themes/scummclassic.zip
    scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
    scummvm/trunk/gui/themes/scummmodern/scummmodern_layout_lowres.stx
    scummvm/trunk/gui/themes/scummmodern.zip

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/ListWidget.cpp	2009-06-06 17:54:08 UTC (rev 41268)
@@ -122,7 +122,12 @@
 	if (_editMode && _caretVisible)
 		drawCaret(true);
 	int size = list.size();
+	_dataList = list;
+
+	// Copy everything
 	_list = list;
+	_filter = "";
+
 	if (_currentPos >= size)
 		_currentPos = size - 1;
 	if (_currentPos < 0)
@@ -134,6 +139,7 @@
 }
 
 void ListWidget::append(const String &s) {
+	_dataList.push_back(s);
 	_list.push_back(s);
 	scrollBarRecalc();
 }
@@ -529,4 +535,35 @@
 	}
 }
 
+void ListWidget::setFilter(const String &filter) {
+	String filt;
+
+	filt = filter;
+
+	filt.toLowercase();
+	_filter = filt;
+
+	if (_filter == "") {
+		_list = _dataList;
+	} else {
+		String tmp;
+
+		_list.clear();
+
+		for (StringList::iterator i = _dataList.begin(); i != _dataList.end(); ++i) {
+			tmp = *i;
+			tmp.toLowercase();
+			if (tmp.contains(_filter.c_str())) {
+				_list.push_back(*i);
+			}
+		}
+	}
+
+	_currentPos = 0;
+	_selectedItem = -1;
+	scrollBarRecalc();
+
+	draw();
+}
+
 } // End of namespace GUI

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/ListWidget.h	2009-06-06 17:54:08 UTC (rev 41268)
@@ -53,6 +53,7 @@
 	typedef Common::StringList StringList;
 protected:
 	StringList		_list;
+	StringList		_dataList;
 	bool			_editable;
 	bool			_editMode;
 	NumberingMode	_numberingMode;
@@ -73,6 +74,8 @@
 	int				_bottomPadding;
 	int				_scrollBarWidth;
 
+	String			_filter;
+
 public:
 	ListWidget(GuiObject *boss, const String &name);
 	ListWidget(GuiObject *boss, int x, int y, int w, int h);
@@ -82,7 +85,7 @@
 
 	void setList(const StringList &list);
 	void append(const String &s);
-	const StringList &getList()	const			{ return _list; }
+	const StringList &getList()	const			{ return _dataList; }
 	int getSelected() const						{ return _selectedItem; }
 	void setSelected(int item);
 	const String &getSelectedString() const		{ return _list[_selectedItem]; }
@@ -92,6 +95,8 @@
 	void scrollTo(int item);
 	void scrollToEnd();
 
+	void setFilter(const String &filter);
+
 	virtual void handleTickle();
 	virtual void handleMouseDown(int x, int y, int button, int clickCount);
 	virtual void handleMouseUp(int x, int y, int button, int clickCount);

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/launcher.cpp	2009-06-06 17:54:08 UTC (rev 41268)
@@ -510,8 +510,16 @@
 		new ButtonWidget(this, "Launcher.RemoveGameButton", "Remove Game", kRemoveGameCmd, 'R');
 
 	// Search box
-	_searchPic = new GraphicsWidget(this, "Launcher.SearchPic");
-	_searchPic->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSearch));
+	_searchDesc = 0;
+#ifndef DISABLE_FANCY_THEMES
+	_searchPic = 0;
+	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
+		_searchPic = new GraphicsWidget(this, "Launcher.SearchPic");
+		_searchPic->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSearch));
+	} else
+#endif
+		_searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", "Search:");
+
 	_searchWidget = new EditTextWidget(this, "Launcher.Search", _search, kSearchCmd);
 
 	// Add list with game titles
@@ -913,6 +921,7 @@
 		close();
 		break;
 	case kSearchCmd:
+		_list->setFilter(_searchWidget->getEditString());
 		break;
 	default:
 		Dialog::handleCommand(sender, cmd, data);
@@ -975,6 +984,29 @@
 			_logo = 0;
 		}
 	}
+
+	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
+		if (!_searchPic)
+			_searchPic = new GraphicsWidget(this, "Launcher.SearchPic");
+		_searchPic->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSearch));
+
+		if (_searchDesc) {
+			removeWidget(_searchDesc);
+			_searchDesc->setNext(0);
+			delete _searchDesc;
+			_searchDesc = 0;
+		}
+	} else {
+		if (!_searchDesc)
+			_searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", "Search:");
+
+		if (_searchPic) {
+			removeWidget(_searchPic);
+			_searchPic->setNext(0);
+			delete _searchPic;
+			_searchPic = 0;
+		}
+	}
 #endif
 
 	_w = g_system->getOverlayWidth();

Modified: scummvm/trunk/gui/launcher.h
===================================================================
--- scummvm/trunk/gui/launcher.h	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/launcher.h	2009-06-06 17:54:08 UTC (rev 41268)
@@ -62,6 +62,7 @@
 	GraphicsWidget		*_logo;
 	GraphicsWidget		*_searchPic;
 #endif
+	StaticTextWidget	*_searchDesc;
 	StringList		_domains;
 	BrowserDialog	*_browser;
 	SaveLoadChooser	*_loadDialog;

Modified: scummvm/trunk/gui/themes/default.inc
===================================================================
--- scummvm/trunk/gui/themes/default.inc	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/themes/default.inc	2009-06-06 17:54:08 UTC (rev 41268)
@@ -332,6 +332,7 @@
 "<def var='Layout.Spacing' value='8' /> "
 "<def var='ShowLauncherLogo' value='0'/> "
 "<def var='ShowGlobalMenuLogo' value='0'/> "
+"<def var='ShowSearchPic' value='0'/> "
 "<def var='ScummSaveLoad.ExtInfo.Visible' value='1'/> "
 "<widget name='OptionsLabel' "
 "size='110,Globals.Line.Height' "
@@ -384,6 +385,18 @@
 "<widget name='Version' "
 "height='Globals.Line.Height' "
 "/> "
+"<layout type='horizontal' spacing='5' padding='10,0,0,0'> "
+"<widget name='SearchDesc' "
+"width='60' "
+"height='Globals.Line.Height' "
+"textalign='right' "
+"/> "
+"<widget name='Search' "
+"width='150' "
+"height='Globals.Line.Height' "
+"/> "
+"<space /> "
+"</layout> "
 "<widget name='GameList'/> "
 "<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
 "<widget name='LoadGameButton' "
@@ -1044,6 +1057,7 @@
 "<def var='Layout.Spacing' value='8'/> "
 "<def var='ShowLauncherLogo' value='0'/> "
 "<def var='ShowGlobalMenuLogo' value='0'/> "
+"<def var='ShowSearchPic' value='0'/> "
 "<def var='ScummSaveLoad.ExtInfo.Visible' value='0'/> "
 "<widget name='Button' "
 "size='72,16' "
@@ -1093,6 +1107,18 @@
 "<widget name='Version' "
 "height='Globals.Line.Height' "
 "/> "
+"<layout type='horizontal' spacing='5' padding='10,0,0,0'> "
+"<widget name='SearchDesc' "
+"width='50' "
+"height='Globals.Line.Height' "
+"textalign='right' "
+"/> "
+"<widget name='Search' "
+"width='150' "
+"height='Globals.Line.Height' "
+"/> "
+"<space /> "
+"</layout> "
 "<widget name='GameList'/> "
 "<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
 "<widget name='LoadGameButton' "

Modified: scummvm/trunk/gui/themes/scummclassic/classic_layout.stx
===================================================================
--- scummvm/trunk/gui/themes/scummclassic/classic_layout.stx	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/themes/scummclassic/classic_layout.stx	2009-06-06 17:54:08 UTC (rev 41268)
@@ -29,14 +29,11 @@
 		<def var = 'Font.Height' value = '16' />
 		
 		<def var = 'About.OuterBorder' value = '80'/>
-<!--
-		<def var = 'PopUpWidget.labelSpacing' value = '10' />
-		<def var = 'PopUpWidget.labelWidth' value = '110' />
--->
 		
 		<def var = 'Layout.Spacing' value = '8' />
 		<def var = 'ShowLauncherLogo' value = '0'/>
 		<def var = 'ShowGlobalMenuLogo' value = '0'/>
+		<def var = 'ShowSearchPic' value = '0'/>
 		
 		<def var = 'ScummSaveLoad.ExtInfo.Visible' value = '1'/>
 
@@ -95,6 +92,18 @@
 			<widget name = 'Version'
 					height = 'Globals.Line.Height'
 			/>
+			<layout type = 'horizontal' spacing = '5' padding = '10, 0, 0, 0'>
+				<widget name = 'SearchDesc'
+						width = '60'
+						height = 'Globals.Line.Height'
+						textalign = 'right'
+				/>
+				<widget name = 'Search'
+						width = '150'
+						height = 'Globals.Line.Height'
+				/>
+				<space />
+			</layout>
 			<widget name = 'GameList'/>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
 				<widget name = 'LoadGameButton' 

Modified: scummvm/trunk/gui/themes/scummclassic/classic_layout_lowres.stx
===================================================================
--- scummvm/trunk/gui/themes/scummclassic/classic_layout_lowres.stx	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/themes/scummclassic/classic_layout_lowres.stx	2009-06-06 17:54:08 UTC (rev 41268)
@@ -34,6 +34,8 @@
 
 		<def var = 'ShowLauncherLogo' value = '0'/>
 		<def var = 'ShowGlobalMenuLogo' value = '0'/>
+		<def var = 'ShowSearchPic' value = '0'/>
+
 		<def var = 'ScummSaveLoad.ExtInfo.Visible' value = '0'/>
 
 		<widget name = 'Button'
@@ -87,6 +89,18 @@
 			<widget name = 'Version'
 					height = 'Globals.Line.Height'
 			/>
+			<layout type = 'horizontal' spacing = '5' padding = '10, 0, 0, 0'>
+				<widget name = 'SearchDesc'
+						width = '50'
+						height = 'Globals.Line.Height'
+						textalign = 'right'
+				/>
+				<widget name = 'Search'
+						width = '150'
+						height = 'Globals.Line.Height'
+				/>
+				<space />
+			</layout>
 			<widget name = 'GameList'/>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
 				<widget name = 'LoadGameButton' 

Modified: scummvm/trunk/gui/themes/scummclassic.zip
===================================================================
(Binary files differ)

Modified: scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
===================================================================
--- scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx	2009-06-06 17:54:08 UTC (rev 41268)
@@ -40,6 +40,7 @@
 		
 		<def var = 'ShowLauncherLogo' value = '1'/>
 		<def var = 'ShowGlobalMenuLogo' value = '1'/>
+		<def var = 'ShowSearchPic' value = '1'/>
 		
 		<def var = 'ScummSaveLoad.ExtInfo.Visible' value = '1'/>
 

Modified: scummvm/trunk/gui/themes/scummmodern/scummmodern_layout_lowres.stx
===================================================================
--- scummvm/trunk/gui/themes/scummmodern/scummmodern_layout_lowres.stx	2009-06-06 17:53:25 UTC (rev 41267)
+++ scummvm/trunk/gui/themes/scummmodern/scummmodern_layout_lowres.stx	2009-06-06 17:54:08 UTC (rev 41268)
@@ -32,6 +32,8 @@
 
 		<def var = 'ShowLauncherLogo' value = '0'/>
 		<def var = 'ShowGlobalMenuLogo' value = '0'/>
+		<def var = 'ShowSearchPic' value = '0'/>
+
 		<def var = 'ScummSaveLoad.ExtInfo.Visible' value = '0'/>
 
 		<widget name = 'Button'
@@ -85,6 +87,18 @@
 			<widget name = 'Version'
 					height = 'Globals.Line.Height'
 			/>
+			<layout type = 'horizontal' spacing = '5' padding = '10, 0, 0, 0'>
+				<widget name = 'SearchDesc'
+						width = '50'
+						height = 'Globals.Line.Height'
+						textalign = 'right'
+				/>
+				<widget name = 'Search'
+						width = '150'
+						height = 'Globals.Line.Height'
+				/>
+				<space />
+			</layout>
 			<widget name = 'GameList'/>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6'>
 				<widget name = 'LoadGameButton' 

Modified: scummvm/trunk/gui/themes/scummmodern.zip
===================================================================
(Binary files differ)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list