[Scummvm-cvs-logs] SF.net SVN: scummvm:[42928] tools/branches/gsoc2009-gui/gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Thu Jul 30 16:45:05 CEST 2009
Revision: 42928
http://scummvm.svn.sourceforge.net/scummvm/?rev=42928&view=rev
Author: Remere
Date: 2009-07-30 14:45:04 +0000 (Thu, 30 Jul 2009)
Log Message:
-----------
*Added a platform page, were you can select the target platform (which influences default audio settings, although this is minimal right now).
Modified Paths:
--------------
tools/branches/gsoc2009-gui/gui/configuration.h
tools/branches/gsoc2009-gui/gui/pages.cpp
tools/branches/gsoc2009-gui/gui/pages.h
Modified: tools/branches/gsoc2009-gui/gui/configuration.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/configuration.h 2009-07-30 14:31:54 UTC (rev 42927)
+++ tools/branches/gsoc2009-gui/gui/configuration.h 2009-07-30 14:45:04 UTC (rev 42928)
@@ -35,6 +35,16 @@
struct Configuration {
Configuration();
+ /**
+ * Returns a list of all supported (as in, we have some defaults for it) platforms
+ */
+ static wxArrayString getTargetPlatforms();
+
+ /**
+ * Sets all the compression members to default values based on the 'selectedPlatform' member
+ */
+ void setPlatformDefaults();
+
// While prepending with _ would be in line with the coding conventions
// this class is just a glorified map with different types, so it seems
// unnecessary.
@@ -44,8 +54,8 @@
/** true if the chose to compress, false if compress, undefined if advanced */
bool compressing;
- /** The name of the game we are extracting or compressing */
- wxString selectedGame;
+ /** The platform the output files are going to be used on (compression only) */
+ wxString selectedPlatform;
/** The tool the user chose to use, NULL if none has been chosen yet */
const ToolGUI* selectedTool;
@@ -108,7 +118,29 @@
oggMinBitrate = wxT("24");
oggAvgBitrate = wxT("24");
oggMaxBitrate = wxT("64");
+}
+inline wxArrayString Configuration::getTargetPlatforms() {
+ wxArrayString platforms;
+ // Just add new platforms here, it's easy!
+ // You specify additional defaults in the next function
+ platforms.Add(wxT("PC"));
+ platforms.Add(wxT("iPhone"));
+ platforms.Add(wxT("Nintendo DS"));
+ platforms.Add(wxT("PlayStation 2"));
+ platforms.Add(wxT("PocketPC"));
+ platforms.Add(wxT("PSP"));
+ platforms.Add(wxT("Symbian"));
+ platforms.Add(wxT("Wii"));
+
+ return platforms;
}
+inline void Configuration::setPlatformDefaults() {
+ // Switch for strings would be nice here...
+ // Ogg works better on the small platforms (maybe all...?)
+ if (selectedPlatform == wxT("iPhone") || selectedPlatform == wxT("Nintendo DS") || selectedPlatform == wxT("PocketPC"))
+ selectedAudioFormat = AUDIO_VORBIS;
+}
+
#endif
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-30 14:31:54 UTC (rev 42927)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-30 14:45:04 UTC (rev 42928)
@@ -561,13 +561,60 @@
void ChooseOutPage::onNext(wxWindow *panel) {
if (_configuration.selectedTool->getType() == TOOLTYPE_COMPRESSION)
- switchPage(new ChooseAudioFormatPage(_topframe));
+ switchPage(new ChooseTargetPlatformPage(_topframe));
else
switchPage(new ProcessPage(_topframe));
}
// Page to choose input and output directory or file
+ChooseTargetPlatformPage::ChooseTargetPlatformPage(ScummToolsFrame *frame)
+ : WizardPage(frame)
+{
+}
+
+wxWindow *ChooseTargetPlatformPage::CreatePanel(wxWindow *parent) {
+ wxWindow *panel = WizardPage::CreatePanel(parent);
+
+ wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ sizer->AddSpacer(15);
+
+ sizer->Add(new wxStaticText(panel, wxID_ANY,
+ wxT("Select target platform (The platform ScummVM will run on)")));
+
+ sizer->AddSpacer(20);
+
+ wxArrayString choices = _configuration.getTargetPlatforms();
+
+ wxChoice *platform = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(80, -1),
+ choices, 0, wxDefaultValidator, wxT("PlatformSelection"));
+ sizer->Add(platform);
+
+ SetAlignedSizer(panel, sizer);
+
+ // Load already set values
+ // We call with (0) first to set a default if the platform ain't in the list
+ platform->SetSelection(0);
+ platform->SetStringSelection(_configuration.selectedPlatform);
+
+
+ return panel;
+}
+
+void ChooseTargetPlatformPage::save(wxWindow *panel) {
+ wxChoice *platform = static_cast<wxChoice *>(panel->FindWindowByName(wxT("PlatformSelection")));
+
+ _configuration.selectedPlatform = platform->GetStringSelection();
+ _configuration.setPlatformDefaults();
+}
+
+void ChooseTargetPlatformPage::onNext(wxWindow *panel) {
+ switchPage(new ChooseAudioFormatPage(_topframe));
+}
+
+// Page to choose input and output directory or file
+
ChooseAudioFormatPage::ChooseAudioFormatPage(ScummToolsFrame *frame)
: WizardPage(frame)
{
Modified: tools/branches/gsoc2009-gui/gui/pages.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.h 2009-07-30 14:31:54 UTC (rev 42927)
+++ tools/branches/gsoc2009-gui/gui/pages.h 2009-07-30 14:45:04 UTC (rev 42928)
@@ -232,8 +232,6 @@
* Presents a dropdown list of the three different audio compression methods
* or possibly fewer, if the selected tool does not support all methods.
*
- * @todo Make it look better and save state, and possibly skip it if the tool
- * only support one method of compression.
*/
class ChooseAudioFormatPage : public WizardPage {
@@ -248,6 +246,21 @@
};
/**
+ * Presents a dropdown list of different target platforms, and sets audio settings accordingly
+ */
+
+class ChooseTargetPlatformPage : public WizardPage {
+public:
+ ChooseTargetPlatformPage(ScummToolsFrame *frame);
+
+ wxWindow *CreatePanel(wxWindow *parent);
+
+ void onNext(wxWindow *panel);
+
+ void save(wxWindow *panel);
+};
+
+/**
* Presents advanced audio settings for the MP3 compression format
*
*/
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