OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_slot.cpp versions 1.124 and 1.125
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_slot.cpp 1.124 -> 1.125

--- as_slot.cpp  2003/02/14 09:18:25     1.124
+++ as_slot.cpp  2003/02/14 17:31:55     1.125
@@ -50,14 +50,17 @@
 
 // User interface
 #include "as_gui.h"             // Main classes
+#include "as_const.h"           // Application constants
 #include "as_except.h"          // Exception classes
 #include "as_tableitem.h"       // For our custom table items
 #include "as_generic.h"         // Generic classes
 #include "as_uuid.h"            // UUID classes
 #include "as_datedit.h"         // Derived from QDateEdit
 #include "as_crc.h"             // Useful Qualistring class
+#include "as_pref.h"            // For Preferences class
 #include "as_panel.h"           // For Prefpanel class
 #include "as_sfile.h"           // For Simplefile class
+#include "as_table.h"           // For TiTable class
 
 // RPC headers
 #ifdef HAVE_ESOAP
@@ -1123,6 +1126,7 @@
 
     // Create a new preferences panel window
     pUserpanel = new Prefpanel(this, "Userprefpanel");
+    connect(pUserpanel, SIGNAL(applied(void)), SLOT(applyPrefs(void)));
 
     // Set default values to appear in initialized panel widgets
     pUserpanel->setAccounts(m_pPrefs->getString(TITRAQ_PREFACCOUNTS, TITRAQ_DEFACCOUNTS));
@@ -1172,53 +1176,10 @@
     }
 
     // Modal panel handler
-    if (pUserpanel->exec() == QDialog::Accepted) {
-        m_pPrefs->setString(TITRAQ_PREFACCOUNTS, pUserpanel->getAccounts());
-        m_pPrefs->setString(TITRAQ_PREFASDIR, pUserpanel->getEvents());
-        m_pPrefs->setString(TITRAQ_PREFUSER, pUserpanel->getUser());
-        m_pPrefs->setString(TITRAQ_PREFHOME, pUserpanel->getHome());
-        m_pPrefs->setString(TITRAQ_PREFCORBHOST, pUserpanel->getCorbahost());
-        m_pPrefs->setString(TITRAQ_PREFSOAPHOST, pUserpanel->getSoaphost());
-        m_pPrefs->setBool(TITRAQ_PREFCORBON, pUserpanel->getCorbaon());
-        m_pPrefs->setBool(TITRAQ_PREFSOAPON, pUserpanel->getSoapon());
-        m_pPrefs->setBool(TITRAQ_PREFBAKON, pUserpanel->getBackon());
-        m_pPrefs->setBool(TITRAQ_PREFEXTENDON, pUserpanel->getExtendon());
-
-        // Dim the lights if no RPC transports are available
-        if (this->isOpen())
-            m_pSyncact->setEnabled(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON)
-                | m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON));
-        else
-            m_pSyncact->setEnabled(false);
+    if (pUserpanel->exec() == QDialog::Accepted)
+        this->applyPrefs(pUserpanel);
 
-        // Get the selected style which can be more complicated due to mapping...
-        if (pUserpanel->getStyle() == TITRAQ_STRCDE) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
-            qApp->setStyle(new QCDEStyle);
-        }
-        else if (pUserpanel->getStyle() == TITRAQ_STRSGI) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI);
-            qApp->setStyle(new QSGIStyle);
-        }
-        else if (pUserpanel->getStyle() == TITRAQ_STRMOTIF) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF);
-            qApp->setStyle(new QMotifStyle);
-        }
-        else if (pUserpanel->getStyle() == TITRAQ_STRMPLUS) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS);
-            qApp->setStyle(new QMotifPlusStyle);
-        }
-        else if (pUserpanel->getStyle() == TITRAQ_STRPLAT) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT);
-            qApp->setStyle(new QPlatinumStyle);
-        }
-        else if (pUserpanel->getStyle() == TITRAQ_STRMSOFT) {
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMSOFT);
-            qApp->setStyle(new QWindowsStyle);
-        }
-        else // My personal favourite ;-)
-            m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
-    }
+    // Dispose Panel object
     delete pUserpanel;
 }
 
@@ -1890,3 +1851,64 @@
 {
     QMessageBox::aboutQt(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short);
 }
+
+//
+// Apply preference values from a signal emitting object
+//
+void Titraqform::applyPrefs(void)
+{
+    Prefpanel *pPan = (Prefpanel *)QObject::sender();
+    this->applyPrefs(pPan);
+}
+
+//
+// Accept preference values from a inbound Panel object
+//
+void Titraqform::applyPrefs(Prefpanel *pPrefpanel)
+{
+    m_pPrefs->setString(TITRAQ_PREFACCOUNTS, pPrefpanel->getAccounts());
+    m_pPrefs->setString(TITRAQ_PREFASDIR, pPrefpanel->getEvents());
+    m_pPrefs->setString(TITRAQ_PREFUSER, pPrefpanel->getUser());
+    m_pPrefs->setString(TITRAQ_PREFHOME, pPrefpanel->getHome());
+    m_pPrefs->setString(TITRAQ_PREFCORBHOST, pPrefpanel->getCorbahost());
+    m_pPrefs->setString(TITRAQ_PREFSOAPHOST, pPrefpanel->getSoaphost());
+    m_pPrefs->setBool(TITRAQ_PREFCORBON, pPrefpanel->getCorbaon());
+    m_pPrefs->setBool(TITRAQ_PREFSOAPON, pPrefpanel->getSoapon());
+    m_pPrefs->setBool(TITRAQ_PREFBAKON, pPrefpanel->getBackon());
+    m_pPrefs->setBool(TITRAQ_PREFEXTENDON, pPrefpanel->getExtendon());
+
+    // Dim the lights if no RPC transports are available
+    if (this->isOpen())
+        m_pSyncact->setEnabled(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON)
+            | m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON));
+    else
+        m_pSyncact->setEnabled(false);
+
+    // Get the selected style which can be more complicated due to mapping...
+    if (pPrefpanel->getStyle() == TITRAQ_STRCDE) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
+        qApp->setStyle(new QCDEStyle);
+    }
+    else if (pPrefpanel->getStyle() == TITRAQ_STRSGI) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI);
+        qApp->setStyle(new QSGIStyle);
+    }
+    else if (pPrefpanel->getStyle() == TITRAQ_STRMOTIF) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF);
+        qApp->setStyle(new QMotifStyle);
+    }
+    else if (pPrefpanel->getStyle() == TITRAQ_STRMPLUS) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS);
+        qApp->setStyle(new QMotifPlusStyle);
+    }
+    else if (pPrefpanel->getStyle() == TITRAQ_STRPLAT) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT);
+        qApp->setStyle(new QPlatinumStyle);
+    }
+    else if (pPrefpanel->getStyle() == TITRAQ_STRMSOFT) {
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMSOFT);
+        qApp->setStyle(new QWindowsStyle);
+    }
+    else // My personal favourite ;-)
+        m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
+}

CVSTrac 2.0.1