Author: sh-sh-sh
Date: Thu Jul 3 14:58:09 2008
New Revision: 48826
URL: http://svn.opensuse.org/viewcvs/yast?rev=48826&view=rev
Log:
second wizard page
Added:
branches/tmp/jdsn/registration/src/RegHWInfoPage.cc
branches/tmp/jdsn/registration/src/RegHWInfoPage.h
Modified:
branches/tmp/jdsn/registration/src/Makefile.am
branches/tmp/jdsn/registration/src/RegMain.cc
Modified: branches/tmp/jdsn/registration/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/Makefile.am?rev=48826&r1=48825&r2=48826&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/Makefile.am (original)
+++ branches/tmp/jdsn/registration/src/Makefile.am Thu Jul 3 14:58:09 2008
@@ -11,6 +11,7 @@
RegWizard.cc \
RegWizardPage.cc \
RegUpdateRepoPage.cc \
+ RegHWInfoPage.cc \
WizardEmulation.cc
yast2_registration_LDADD = -L$(top_srcdir)/src -lyui
Added: branches/tmp/jdsn/registration/src/RegHWInfoPage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegHWInfoPage.cc?rev=48826&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/RegHWInfoPage.cc (added)
+++ branches/tmp/jdsn/registration/src/RegHWInfoPage.cc Thu Jul 3 14:58:09 2008
@@ -0,0 +1,138 @@
+// Wizard page for "Update Repository"
+
+
+#define YUILogComponent "reg"
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "RegHWInfoPage.h"
+#include "RegWizard.h"
+#include "Reg_i18n.h"
+
+
+
+RegHWInfoPage::RegHWInfoPage()
+ : _sendHWInfo( true )
+{
+ forgetWidgets();
+}
+
+
+RegHWInfoPage::~RegHWInfoPage()
+{
+ // NOP
+}
+
+
+void RegHWInfoPage::init()
+{
+ // TO DO: Obtain HW and system info (+text)
+
+ // DEBUG
+ // DEBUG
+ // DEBUG
+ _hwInfoText =
+ "01: None 00.0: 10103 CPU\n"
+ " [Created at cpu.301]\n"
+ " Unique ID: rdCR.j8NaKXDZtZ6\n"
+ " Hardware Class: cpu\n"
+ " Arch: Intel\n"
+ " Vendor: \"GenuineIntel\"\n"
+ " Model: 15.2.9 \"Intel(R) Pentium(R) 4 CPU 2.60GHz\"\n"
+ " Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,pebs,bts,cid,xtpr\n"
+ " Clock: 2593 MHz\n"
+ " BogoMips: 5192.07\n"
+ " Cache: 512 kb\n"
+ " Units/Processor: 2\n"
+ " Config Status: cfg=new, avail=yes, need=no, active=unknown\n"
+ "\n"
+ "02: None 01.0: 10103 CPU\n"
+ " [Created at cpu.301]\n"
+ " Unique ID: wkFv.j8NaKXDZtZ6\n"
+ " Hardware Class: cpu\n"
+ " Arch: Intel\n"
+ " Vendor: \"GenuineIntel\"\n"
+ " Model: 15.2.9 \"Intel(R) Pentium(R) 4 CPU 2.60GHz\"\n"
+ " Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,pebs,bts,cid,xtpr\n"
+ " Clock: 2593 MHz\n"
+ " BogoMips: 5187.36\n"
+ " Cache: 512 kb\n"
+ " Units/Processor: 2\n"
+ " Config Status: cfg=new, avail=yes, need=no, active=unknown\n"
+ ;
+ // DEBUG
+ // DEBUG
+ // DEBUG
+}
+
+
+void RegHWInfoPage::createWidgets( YWidget * parent )
+{
+ YWizard * wizard = RegWizard::regWizard()->wizard();
+ YUI_CHECK_PTR( wizard );
+
+ wizard->setDialogHeading( _( "System and Hardware Information" ) );
+ wizard->setDialogIcon( "yast-hardware.png" );
+ wizard->setHelpText( helpText() );
+
+ YWidgetFactory * fac = YUI::widgetFactory(); // shortcut
+
+ YLayoutBox * vbox = fac->createVBox( parent );
+
+ string explanationText =
+ _( "You can contribute to improve Linux by submitting information\n"
+ "about your system. This is purely voluntary." );
+ YAlignment * left = fac->createLeft( vbox );
+ fac->createLabel( left, explanationText );
+
+ fac->createVSpacing( vbox, 0.8 );
+
+ _sendHWInfoCheckBoxFrame = fac->createCheckBoxFrame( vbox, _( "Send Hardware and System Information" ), _sendHWInfo );
+ YAlignment * marginBox = fac->createMarginBox( _sendHWInfoCheckBoxFrame, 1.5, 0.7 );
+ _hwInfoRichText = fac->createRichText( marginBox, _hwInfoText, true ); // plainText
+}
+
+
+string RegHWInfoPage::helpText()
+{
+ string text =
+ _( "Help text for hw+sys info page" );
+
+ // TO DO: Help text
+
+ return text;
+}
+
+
+void RegHWInfoPage::save()
+{
+ _sendHWInfo = _sendHWInfoCheckBoxFrame->value();
+}
+
+
+void RegHWInfoPage::forgetWidgets()
+{
+ _sendHWInfoCheckBoxFrame = 0;
+ _hwInfoRichText = 0;
+}
+
+
+bool RegHWInfoPage::sendHWInfo()
+{
+ if ( _sendHWInfoCheckBoxFrame &&
+ _sendHWInfoCheckBoxFrame->isValid() )
+ {
+ _sendHWInfo = _sendHWInfoCheckBoxFrame->value();
+ }
+
+ return _sendHWInfo;
+}
Added: branches/tmp/jdsn/registration/src/RegHWInfoPage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegHWInfoPage.h?rev=48826&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/RegHWInfoPage.h (added)
+++ branches/tmp/jdsn/registration/src/RegHWInfoPage.h Thu Jul 3 14:58:09 2008
@@ -0,0 +1,94 @@
+// Wizard page for "Hardware and System Information"
+
+#ifndef RegHWInfoPage_h
+#define RegHWInfoPage_h
+
+#include "RegWizardPage.h"
+#include <string>
+
+using std::string;
+
+class YCheckBoxFrame;
+class YRichText;
+
+
+/**
+ * Wizard page for "Hardware and System Information" in the registration
+ * workflow.
+ *
+ * This class holds the data of this page, regardless whether or not this page
+ * is currently displayed.
+ **/
+class RegHWInfoPage: public RegWizardPage
+{
+public:
+ /**
+ * Constructor.
+ *
+ * This does not create any widget yet or show any page content; it only
+ * stores the parameters for later use when show() is called.
+ **/
+ RegHWInfoPage();
+
+ /**
+ * Destructor.
+ **/
+ virtual ~RegHWInfoPage();
+
+ /**
+ * Initialize internal data. This is called in show() just before widgets
+ * are created.
+ *
+ * Reimplemented from RegWizardPage.
+ **/
+ virtual void init();
+
+ /**
+ * Create the widgets for this page.
+ *
+ * Implemented from RegWizardPage.
+ **/
+ virtual void createWidgets( YWidget * parent );
+
+ /**
+ * Clear all pointers to internally stored widgets. This should not delete
+ * the widgets, just set all internally stored pointers to widgets etc. to
+ * 0.
+ *
+ * Reimplemented from RegWizardPage.
+ **/
+ virtual void forgetWidgets();
+
+ /**
+ * Save the widget values to the internal values.
+ *
+ * Reimplemented from RegWizardPage.
+ **/
+ virtual void save();
+
+ /**
+ * Return the help text for this wizard page.
+ *
+ * Reimplemented from RegWizardPage.
+ **/
+ virtual string helpText();
+
+ /**
+ * Return 'true' if updates are enabled. If the page is currently shown,
+ * this will retrieve the status of the CheckBoxFrame. Otherwise, it
+ * returns the stored value.
+ **/
+ bool sendHWInfo();
+
+
+private:
+
+ bool _sendHWInfo;
+ string _hwInfoText;
+
+ YCheckBoxFrame * _sendHWInfoCheckBoxFrame;
+ YRichText * _hwInfoRichText;
+};
+
+
+#endif // RegHWInfoPage_h
Modified: branches/tmp/jdsn/registration/src/RegMain.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegMain.cc?rev=48826&r1=48825&r2=48826&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegMain.cc (original)
+++ branches/tmp/jdsn/registration/src/RegMain.cc Thu Jul 3 14:58:09 2008
@@ -17,6 +17,7 @@
#include "Reg_i18n.h"
#include "RegWizard.h"
#include "RegUpdateRepoPage.h"
+#include "RegHWInfoPage.h"
int main( int argc, char **argv )
@@ -24,11 +25,13 @@
YUILog::setLogFileName( "/tmp/registration.log" );
YUILog::enableDebugLogging();
- RegUpdateRepoPage updateRepoPage( true, "http://download.opensuse.org/update/11.0/" );
- RegUpdateRepoPage updateRepoPage2( true, "Page 2" );
- RegUpdateRepoPage updateRepoPage3( true, "Page 3" );
+ RegUpdateRepoPage updateRepoPage( true, "http://download.opensuse.org/update/11.0/" );
+ RegHWInfoPage hwInfoPage;
+ RegUpdateRepoPage updateRepoPage2( true, "Page 2" );
+ RegUpdateRepoPage updateRepoPage3( true, "Page 3" );
- updateRepoPage.setNextPage ( &updateRepoPage2 );
+ updateRepoPage.setNextPage ( &hwInfoPage );
+ hwInfoPage.setNextPage ( &updateRepoPage2 );
updateRepoPage2.setNextPage( &updateRepoPage3 );
RegWizard::regWizard()->showPage( &updateRepoPage );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org