diff options
author | Max Horn | 2010-03-18 15:09:24 +0000 |
---|---|---|
committer | Max Horn | 2010-03-18 15:09:24 +0000 |
commit | c934642bdb7e6747a20054d7cc7b079e69bc22c2 (patch) | |
tree | 190d12bad5ed1cbabbd498d310f261c3a1c25bc9 /gui | |
parent | 30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac (diff) | |
download | scummvm-rg350-c934642bdb7e6747a20054d7cc7b079e69bc22c2.tar.gz scummvm-rg350-c934642bdb7e6747a20054d7cc7b079e69bc22c2.tar.bz2 scummvm-rg350-c934642bdb7e6747a20054d7cc7b079e69bc22c2.zip |
COMMON: Move typedef StringList from str.h to new header str-array.h
This removes the dependency on array.h from str.h.
Also, begun migration from the confusing type name "StringList" to
the more appropriate StringArray.
svn-id: r48282
Diffstat (limited to 'gui')
-rw-r--r-- | gui/KeysDialog.cpp | 2 | ||||
-rw-r--r-- | gui/ListWidget.cpp | 6 | ||||
-rw-r--r-- | gui/ListWidget.h | 10 | ||||
-rw-r--r-- | gui/about.cpp | 4 | ||||
-rw-r--r-- | gui/about.h | 4 | ||||
-rw-r--r-- | gui/browser.cpp | 2 | ||||
-rw-r--r-- | gui/chooser.cpp | 2 | ||||
-rw-r--r-- | gui/chooser.h | 4 | ||||
-rw-r--r-- | gui/debugger.cpp | 2 | ||||
-rw-r--r-- | gui/launcher.cpp | 8 | ||||
-rw-r--r-- | gui/launcher.h | 4 | ||||
-rw-r--r-- | gui/massadd.cpp | 6 | ||||
-rw-r--r-- | gui/massadd.h | 3 | ||||
-rw-r--r-- | gui/message.cpp | 2 | ||||
-rw-r--r-- | gui/saveload.cpp | 4 | ||||
-rw-r--r-- | gui/saveload.h | 4 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 2 |
17 files changed, 35 insertions, 34 deletions
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp index 7a9256e30f..103ae918ef 100644 --- a/gui/KeysDialog.cpp +++ b/gui/KeysDialog.cpp @@ -55,7 +55,7 @@ KeysDialog::KeysDialog(const Common::String &title) _keyMapping->setFlags(WIDGET_CLEARBG); // Get actions names - Common::StringList l; + ListWidget::StringArray l; for (int i = 0; i < Actions::Instance()->size(); i++) l.push_back(Actions::Instance()->actionName((ActionType)i)); diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index f138fe7cc1..80289b9b80 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -152,7 +152,7 @@ ThemeEngine::FontColor ListWidget::getSelectionColor() const { return _listColors[_listIndex[_selectedItem]]; } -void ListWidget::setList(const StringList &list, const ColorList *colors) { +void ListWidget::setList(const StringArray &list, const ColorList *colors) { if (_editMode && _caretVisible) drawCaret(true); @@ -306,7 +306,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) { int newSelectedItem = 0; int bestMatch = 0; bool stop; - for (StringList::const_iterator i = _list.begin(); i != _list.end(); ++i) { + for (StringArray::const_iterator i = _list.begin(); i != _list.end(); ++i) { const int match = matchingCharsIgnoringCase(i->c_str(), _quickSelectStr.c_str(), stop); if (match > bestMatch || stop) { _selectedItem = newSelectedItem; @@ -692,7 +692,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) { _list.clear(); _listIndex.clear(); - for (StringList::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) { + for (StringArray::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) { tmp = *i; tmp.toLowercase(); bool matches = true; diff --git a/gui/ListWidget.h b/gui/ListWidget.h index 9b9949c299..02f2c22e7c 100644 --- a/gui/ListWidget.h +++ b/gui/ListWidget.h @@ -52,11 +52,11 @@ enum { class ListWidget : public EditableWidget { public: typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; typedef Common::Array<ThemeEngine::FontColor> ColorList; protected: - StringList _list; - StringList _dataList; + StringArray _list; + StringArray _dataList; ColorList _listColors; Common::Array<int> _listIndex; bool _editable; @@ -93,8 +93,8 @@ public: virtual Widget *findWidget(int x, int y); - void setList(const StringList &list, const ColorList *colors = 0); - const StringList &getList() const { return _dataList; } + void setList(const StringArray &list, const ColorList *colors = 0); + const StringArray &getList() const { return _dataList; } void append(const String &s, ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal); diff --git a/gui/about.cpp b/gui/about.cpp index 650c42d97c..74851caf94 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -164,10 +164,10 @@ void AboutDialog::addLine(const char *str) { Common::String format(str, 2); str += 2; - Common::StringList wrappedLines; + StringArray wrappedLines; g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines); - for (Common::StringList::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) { + for (StringArray::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) { _lines.push_back(format + *i); } } diff --git a/gui/about.h b/gui/about.h index d62510b1a6..fc216a78dc 100644 --- a/gui/about.h +++ b/gui/about.h @@ -32,11 +32,11 @@ namespace GUI { class AboutDialog : public Dialog { - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; protected: int _scrollPos; uint32 _scrollTime; - StringList _lines; + StringArray _lines; uint32 _lineHeight; bool _willClose; diff --git a/gui/browser.cpp b/gui/browser.cpp index 906ca0dbe0..c090742988 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -150,7 +150,7 @@ void BrowserDialog::updateListing() { Common::sort(_nodeContent.begin(), _nodeContent.end()); // Populate the ListWidget - Common::StringList list; + ListWidget::StringArray list; ListWidget::ColorList colors; for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { if (i->isDirectory()) diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 04f68a60b0..0155bb2afb 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -50,7 +50,7 @@ ChooserDialog::ChooserDialog(const String &title, String dialogId) _chooseButton->setEnabled(false); } -void ChooserDialog::setList(const StringList& list) { +void ChooserDialog::setList(const StringArray& list) { _list->setList(list); } diff --git a/gui/chooser.h b/gui/chooser.h index 836f30bd8c..ce67c008df 100644 --- a/gui/chooser.h +++ b/gui/chooser.h @@ -39,7 +39,7 @@ class ListWidget; class ChooserDialog : public Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; protected: ListWidget *_list; ButtonWidget *_chooseButton; @@ -47,7 +47,7 @@ protected: public: ChooserDialog(const String &title, String dialogId = "Browser"); - void setList(const StringList& list); + void setList(const StringArray& list); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); }; diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 39e5d7d3bb..fa1c12f28e 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -427,7 +427,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) { DebugPrintf("Commands are:\n"); // Obtain a list of sorted command names - Common::StringList cmds; + Common::Array<Common::String> cmds; CommandsMap::const_iterator iter, e = _cmds.end(); for (iter = _cmds.begin(); iter != e; ++iter) { cmds.push_back(iter->_key); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 0b26c6c44e..ae23fe9499 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -119,7 +119,7 @@ protected: class EditGameDialog : public OptionsDialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; public: EditGameDialog(const String &domain, const String &desc); @@ -553,7 +553,7 @@ LauncherDialog::LauncherDialog() void LauncherDialog::selectTarget(const String &target) { if (!target.empty()) { int itemToSelect = 0; - StringList::const_iterator iter; + StringArray::const_iterator iter; for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { if (target == *iter) { _list->setSelected(itemToSelect); @@ -593,7 +593,7 @@ void LauncherDialog::close() { } void LauncherDialog::updateListing() { - Common::StringList l; + StringArray l; // Retrieve a list of all games defined in the config file _domains.clear(); @@ -722,7 +722,7 @@ void LauncherDialog::addGame() { idx = 0; } else { // Display the candidates to the user and let her/him pick one - StringList list; + StringArray list; for (idx = 0; idx < (int)candidates.size(); idx++) list.push_back(candidates[idx].description()); diff --git a/gui/launcher.h b/gui/launcher.h index ceb44d9e8e..df9a6fb639 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -40,7 +40,7 @@ Common::String addGameToConf(const GameDescriptor &result); class LauncherDialog : public Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; public: LauncherDialog(); ~LauncherDialog(); @@ -64,7 +64,7 @@ protected: #endif StaticTextWidget *_searchDesc; ButtonWidget *_searchClearButton; - StringList _domains; + StringArray _domains; BrowserDialog *_browser; SaveLoadChooser *_loadDialog; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 8a1206ee31..91c1b6c459 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -66,7 +66,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) _dirProgressText(0), _gameProgressText(0) { - Common::StringList l; + StringArray l; // The dir we start our scan at _scanStack.push(startDir); @@ -199,8 +199,8 @@ void MassAddDialog::handleTickle() { // Check for existing config entries for this path/gameid/lang/platform combination if (_pathToTargets.contains(path)) { bool duplicate = false; - const Common::StringList &targets = _pathToTargets[path]; - for (Common::StringList::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { + const StringArray &targets = _pathToTargets[path]; + for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { // If the gameid, platform and language match -> skip it Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter); assert(dom); diff --git a/gui/massadd.h b/gui/massadd.h index e37df9f426..31a8821a26 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -37,6 +37,7 @@ namespace GUI { class StaticTextWidget; class MassAddDialog : public Dialog { + typedef Common::Array<Common::String> StringArray; public: MassAddDialog(const Common::FSNode &startDir); @@ -59,7 +60,7 @@ private: * Used to detect whether a potential new target is already present in the * config manager. */ - Common::HashMap<Common::String, Common::StringList> _pathToTargets; + Common::HashMap<Common::String, StringArray> _pathToTargets; int _dirsScanned; diff --git a/gui/message.cpp b/gui/message.cpp index e4f0bb12da..12ac3123a4 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -53,7 +53,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB // down the string into lines, and taking the maximum of their widths. // Using this, and accounting for the space the button(s) need, we can set // the real size of the dialog - Common::StringList lines; + Common::Array<Common::String> lines; int lineCount, okButtonPos, cancelButtonPos; int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 247b7bdeb8..8ec4dc4133 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -313,7 +313,7 @@ void SaveLoadChooser::close() { _plugin = 0; _target.clear(); _saveList.clear(); - _list->setList(StringList()); + _list->setList(StringArray()); Dialog::close(); } @@ -323,7 +323,7 @@ void SaveLoadChooser::updateSaveList() { int curSlot = 0; int saveSlot = 0; - StringList saveNames; + StringArray saveNames; ListWidget::ColorList colors; for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { // Handle gaps in the list of save games diff --git a/gui/saveload.h b/gui/saveload.h index d1f58b1f59..dde70c9a7a 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -35,7 +35,7 @@ class GraphicsWidget; class SaveLoadChooser : public GUI::Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array<Common::String> StringArray; protected: GUI::ListWidget *_list; GUI::ButtonWidget *_chooseButton; @@ -65,7 +65,7 @@ public: ~SaveLoadChooser(); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); - void setList(const StringList& list); + void setList(const StringArray& list); int runModal(const EnginePlugin *plugin, const String &target); void open(); diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index cd207c54fe..5d0e24394f 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -100,7 +100,7 @@ void ThemeBrowser::updateListing() { const Common::String currentThemeId = g_gui.theme()->getThemeId(); int currentThemeIndex = 0, index = 0; - Common::StringList list; + ListWidget::StringArray list; for (ThemeDescList::const_iterator i = _themes.begin(); i != _themes.end(); ++i, ++index) { list.push_back(i->name); |