[Scummvm-cvs-logs] SF.net SVN: scummvm:[44200] scummvm/trunk/backends/platform/wii

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Sun Sep 20 13:29:33 CEST 2009


Revision: 44200
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44200&view=rev
Author:   dhewg
Date:     2009-09-20 11:29:33 +0000 (Sun, 20 Sep 2009)

Log Message:
-----------
Only update status label of the active tab (lables print their text when updating, regardless of its visibility status).

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wii/options.cpp
    scummvm/trunk/backends/platform/wii/options.h

Modified: scummvm/trunk/backends/platform/wii/options.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/options.cpp	2009-09-20 11:25:39 UTC (rev 44199)
+++ scummvm/trunk/backends/platform/wii/options.cpp	2009-09-20 11:29:33 UTC (rev 44200)
@@ -20,12 +20,12 @@
  *
  */
 
+#include <errno.h>
 #include <network.h>
 #include <gfx/gfx.h>
 
 #include "common/config-manager.h"
 #include "gui/dialog.h"
-#include "gui/TabWidget.h"
 #include "backends/fs/wii/wii-fs-factory.h"
 
 #include "options.h"
@@ -45,71 +45,71 @@
 	new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, "Ok", 'k');
 	new ButtonWidget(this, _w - 216 - 32, _h - 24 - 16, 108, 24, "Cancel", 'c');
 
-	TabWidget *tab = new TabWidget(this, 0, 0, _w, _h - 54);
+	_tab = new TabWidget(this, 0, 0, _w, _h - 54);
 
-	int tabVideo = tab->addTab("Video");
+	_tabVideo = _tab->addTab("Video");
 
-	new StaticTextWidget(tab, 16, 16, 128, 16,
+	new StaticTextWidget(_tab, 16, 16, 128, 16,
 							"Current video mode:", Graphics::kTextAlignRight);
-	new StaticTextWidget(tab, 160, 16, 128, 16,
+	new StaticTextWidget(_tab, 160, 16, 128, 16,
 							_doubleStrike ? "Double-strike" : "Default",
 							Graphics::kTextAlignLeft);
 
-	new StaticTextWidget(tab, 16, 48, 128, 16,
+	new StaticTextWidget(_tab, 16, 48, 128, 16,
 							"Horizontal underscan:", Graphics::kTextAlignRight);
-	_sliderUnderscanX = new SliderWidget(tab, 160, 47, 128, 18, 'x');
+	_sliderUnderscanX = new SliderWidget(_tab, 160, 47, 128, 18, 'x');
 	_sliderUnderscanX->setMinValue(0);
 	_sliderUnderscanX->setMaxValue(32);
 
-	new StaticTextWidget(tab, 16, 80, 128, 16,
+	new StaticTextWidget(_tab, 16, 80, 128, 16,
 							"Vertical underscan:", Graphics::kTextAlignRight);
-	_sliderUnderscanY = new SliderWidget(tab, 160, 79, 128, 18, 'y');
+	_sliderUnderscanY = new SliderWidget(_tab, 160, 79, 128, 18, 'y');
 	_sliderUnderscanY->setMinValue(0);
 	_sliderUnderscanY->setMaxValue(32);
 
 #ifdef USE_WII_DI
-	tab->addTab("DVD");
+	_tabDVD = _tab->addTab("DVD");
 
-	new StaticTextWidget(tab, 16, 16, 64, 16,
+	new StaticTextWidget(_tab, 16, 16, 64, 16,
 							"Status:", Graphics::kTextAlignRight);
-	_textDVDStatus = new StaticTextWidget(tab, 96, 16, 192, 16, "Unknown",
+	_textDVDStatus = new StaticTextWidget(_tab, 96, 16, 192, 16, "Unknown",
 											Graphics::kTextAlignLeft);
 
-	new ButtonWidget(tab, 16, 48, 108, 24, "Mount DVD", 'mdvd');
-	new ButtonWidget(tab, 140, 48, 108, 24, "Unmount DVD", 'udvd');
+	new ButtonWidget(_tab, 16, 48, 108, 24, "Mount DVD", 'mdvd');
+	new ButtonWidget(_tab, 140, 48, 108, 24, "Unmount DVD", 'udvd');
 #endif
 
 #ifdef USE_WII_SMB
-	tab->addTab("SMB");
+	_tabSMB = _tab->addTab("SMB");
 
-	new StaticTextWidget(tab, 16, 16, 64, 16,
+	new StaticTextWidget(_tab, 16, 16, 64, 16,
 							"Status:", Graphics::kTextAlignRight);
-	_textSMBStatus = new StaticTextWidget(tab, 96, 16, 192, 16, "Unknown",
+	_textSMBStatus = new StaticTextWidget(_tab, 96, 16, 192, 16, "Unknown",
 											Graphics::kTextAlignLeft);
 
-	new StaticTextWidget(tab, 16, 52, 64, 16,
+	new StaticTextWidget(_tab, 16, 52, 64, 16,
 							"Server:", Graphics::kTextAlignRight);
-	_editSMBServer = new EditTextWidget(tab, 96, 48, _w - 96 - 32, 24, "");
+	_editSMBServer = new EditTextWidget(_tab, 96, 48, _w - 96 - 32, 24, "");
 
-	new StaticTextWidget(tab, 16, 92, 64, 16,
+	new StaticTextWidget(_tab, 16, 92, 64, 16,
 							"Share:", Graphics::kTextAlignRight);
-	_editSMBShare = new EditTextWidget(tab, 96, 88, _w - 96 - 32, 24, "");
+	_editSMBShare = new EditTextWidget(_tab, 96, 88, _w - 96 - 32, 24, "");
 
-	new StaticTextWidget(tab, 16, 132, 64, 16,
+	new StaticTextWidget(_tab, 16, 132, 64, 16,
 							"Username:", Graphics::kTextAlignRight);
-	_editSMBUsername = new EditTextWidget(tab, 96, 128, _w - 96 - 32, 24, "");
+	_editSMBUsername = new EditTextWidget(_tab, 96, 128, _w - 96 - 32, 24, "");
 
-	new StaticTextWidget(tab, 16, 172, 64, 16,
+	new StaticTextWidget(_tab, 16, 172, 64, 16,
 							"Password:", Graphics::kTextAlignRight);
-	_editSMBPassword = new EditTextWidget(tab, 96, 168, _w - 96 - 32, 24, "");
+	_editSMBPassword = new EditTextWidget(_tab, 96, 168, _w - 96 - 32, 24, "");
 
-	new ButtonWidget(tab, 16, 208, 108, 24, "Init network", 'net');
+	new ButtonWidget(_tab, 16, 208, 108, 24, "Init network", 'net');
 
-	new ButtonWidget(tab, 140, 208, 108, 24, "Mount SMB", 'msmb');
-	new ButtonWidget(tab, 264, 208, 108, 24, "Unmount SMB", 'usmb');
+	new ButtonWidget(_tab, 140, 208, 108, 24, "Mount SMB", 'msmb');
+	new ButtonWidget(_tab, 264, 208, 108, 24, "Unmount SMB", 'usmb');
 #endif
 
-	tab->setActiveTab(tabVideo);
+	_tab->setActiveTab(_tabVideo);
 
 	load();
 }
@@ -118,26 +118,52 @@
 }
 
 void WiiOptionsDialog::handleTickle() {
+	WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
+
+	int tab = _tab->getActiveTab();
+
 #ifdef USE_WII_DI
-	if (WiiFilesystemFactory::instance().isMounted(WiiFilesystemFactory::kDVD))
-		_textDVDStatus->setLabel("Mounted");
-	else
-		_textDVDStatus->setLabel("Not mounted");
+	if (tab == _tabDVD) {
+		if (fsf.isMounted(WiiFilesystemFactory::kDVD))
+			_textDVDStatus->setLabel("Mounted");
+		else
+			_textDVDStatus->setLabel("Not mounted");
+	}
 #endif
+
 #ifdef USE_WII_SMB
-	s32 net = net_get_status();
-	String label;
+	if (tab == _tabSMB) {
+		s32 status = net_get_status();
+		String label;
 
-	if (net) {
-		label = String::printf("Network not initialsed (%d)\n", net);
-	} else {
-		if (WiiFilesystemFactory::instance().isMounted(WiiFilesystemFactory::kSMB))
-			label = "Mounted";
-		else
-			label = "Not mounted";
+		switch (status) {
+		case 0:
+			if (fsf.isMounted(WiiFilesystemFactory::kSMB))
+				label = "Network up, share mounted";
+			else
+				label = "Network up, share not mounted";
+
+			break;
+
+		case -ENETDOWN:
+			label = "Network down";
+			break;
+
+		case -EBUSY:
+			label = "Initialising network";
+			break;
+
+		case -ETIMEDOUT:
+			label = "Timeout while initialising network";
+			break;
+
+		default:
+			label = String::printf("Network not initialsed (%d)", status);
+			break;
+		}
+
+		_textSMBStatus->setLabel(label);
 	}
-
-	_textSMBStatus->setLabel(label);
 #endif
 
 	Dialog::handleTickle();

Modified: scummvm/trunk/backends/platform/wii/options.h
===================================================================
--- scummvm/trunk/backends/platform/wii/options.h	2009-09-20 11:25:39 UTC (rev 44199)
+++ scummvm/trunk/backends/platform/wii/options.h	2009-09-20 11:29:33 UTC (rev 44200)
@@ -25,6 +25,7 @@
 
 #include "common/str.h"
 #include "gui/dialog.h"
+#include "gui/TabWidget.h"
 #include "gui/EditTextWidget.h"
 
 using namespace GUI;
@@ -45,14 +46,19 @@
 	String _strUnderscanX;
 	String _strUnderscanY;
 
+	TabWidget *_tab;
+
+	int _tabVideo;
 	SliderWidget *_sliderUnderscanX;
 	SliderWidget *_sliderUnderscanY;
 
 #ifdef USE_WII_DI
+	int _tabDVD;
 	StaticTextWidget *_textDVDStatus;
 #endif
 
 #ifdef USE_WII_SMB
+	int _tabSMB;
 	StaticTextWidget *_textNetworkStatus;
 	StaticTextWidget *_textSMBStatus;
 	EditTextWidget *_editSMBServer;


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