OSSP CVS Repository

ossp - Check-in [3857]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3857
Date: 2002-Dec-12 13:19:48 (local)
2002-Dec-12 12:19:48 (UTC)
User:ms
Branch:
Comment: Load column view preferences on init, and save them on exit.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_assist.cpp      1.56 -> 1.57     32 inserted, 0 deleted
ossp-pkg/as/as-gui/as_const.h      1.19 -> 1.20     28 inserted, 2 deleted
ossp-pkg/as/as-gui/as_gui.cpp      1.25 -> 1.26     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_gui.h      1.47 -> 1.48     3 inserted, 1 deleted
ossp-pkg/as/as-gui/as_main.cpp      1.9 -> 1.10     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.48 -> 1.49     20 inserted, 0 deleted

ossp-pkg/as/as-gui/as_assist.cpp 1.56 -> 1.57

--- as_assist.cpp        2002/12/11 16:00:47     1.56
+++ as_assist.cpp        2002/12/12 12:19:48     1.57
@@ -766,3 +766,35 @@
     connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(updateTask(const QString &)));
     connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(updateRemark(const QString &)));
 }
+
+//
+// Arrange and configure columns
+//
+void Titraqform::setupColumns(void)
+{
+    // Handle column view handling presets and defaults
+    if (!m_pPrefs->getBool(TITRAQ_PREFSTATCOL, TITRAQ_DEFSTATCOL))
+        showStatcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFLCOL, TITRAQ_DEFLCOL))
+        showLinecol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFUCOL, TITRAQ_DEFUCOL))
+        showUsercol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFGCOL, TITRAQ_DEFGCOL))
+        showGuidcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFCCOL, TITRAQ_DEFCCOL))
+        showCrccol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFREVCOL, TITRAQ_DEFREVCOL))
+        showRevcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFDCOL, TITRAQ_DEFDCOL))
+        showDatecol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFSTARTCOL, TITRAQ_DEFSTARTCOL))
+        showStartcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFFCOL, TITRAQ_DEFFCOL))
+        showFinishcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFACOL, TITRAQ_DEFACOL))
+        showAmountcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFFCOL, TITRAQ_DEFFCOL))
+        showTaskcol();
+    if (!m_pPrefs->getBool(TITRAQ_PREFREMCOL, TITRAQ_DEFREMCOL))
+        showRemarkcol();
+}


ossp-pkg/as/as-gui/as_const.h 1.19 -> 1.20

--- as_const.h   2002/12/11 16:00:47     1.19
+++ as_const.h   2002/12/12 12:19:48     1.20
@@ -33,7 +33,7 @@
 #define TITCONST_H
 
 
-// Preferences string constants
+// General preferences
 #define TITRAQ_PREFNAME         "as_gui.conf"
 #define TITRAQ_APPTITLE         "AS Gui"
 #define TITRAQ_PREFVER          "0.5"
@@ -48,11 +48,37 @@
 #define TITRAQ_DEFREMOTELOG     "no"
 #define TITRAQ_PREFLOCALLOG     "loglocal"
 #define TITRAQ_DEFLOCALLOG      "no"
-#define TITRAQ_SAVEFIRST        "The timesheet contains unsaved changes\nDo you want to save the changes or discard them?"
+
+// Column view preferences
+#define TITRAQ_PREFSTATCOL      "statcol"
+#define TITRAQ_DEFSTATCOL       true
+#define TITRAQ_PREFLCOL         "linecol"
+#define TITRAQ_DEFLCOL          true
+#define TITRAQ_PREFUCOL         "usercol"
+#define TITRAQ_DEFUCOL          false
+#define TITRAQ_PREFGCOL         "guidcol"
+#define TITRAQ_DEFGCOL          false
+#define TITRAQ_PREFCCOL         "crccol"
+#define TITRAQ_DEFCCOL          false
+#define TITRAQ_PREFREVCOL       "revcol"
+#define TITRAQ_DEFREVCOL        false
+#define TITRAQ_PREFDCOL         "datecol"
+#define TITRAQ_DEFDCOL          true
+#define TITRAQ_PREFSTARTCOL     "startcol"
+#define TITRAQ_DEFSTARTCOL      false
+#define TITRAQ_PREFFCOL         "finishcol"
+#define TITRAQ_DEFFCOL          false
+#define TITRAQ_PREFACOL         "amountcol"
+#define TITRAQ_DEFACOL          true
+#define TITRAQ_PREFTCOL         "taskcol"
+#define TITRAQ_DEFTCOL          true
+#define TITRAQ_PREFREMCOL       "remarkcol"
+#define TITRAQ_DEFREMCOL        true
 
 // Other string constants
 #define TITRAQ_DATEZERO         "0000-00-00"
 #define TITRAQ_SEPARATORTOK     " "
+#define TITRAQ_SAVEFIRST        "The timesheet contains unsaved changes\nDo you want to save the changes or discard them?"
 
 // Indexes of table columns
 #define TITRAQ_IDXALLCTRLS     -1


ossp-pkg/as/as-gui/as_gui.cpp 1.25 -> 1.26

--- as_gui.cpp   2002/12/04 11:41:55     1.25
+++ as_gui.cpp   2002/12/12 12:19:48     1.26
@@ -65,6 +65,7 @@
         setupStatusbar();
         setupTable();
         setupEditlay();
+        setupColumns();
     }
     catch (Genexcept& Genex) {
         Genex.reportErr();


ossp-pkg/as/as-gui/as_gui.h 1.47 -> 1.48

--- as_gui.h     2002/12/11 17:15:35     1.47
+++ as_gui.h     2002/12/12 12:19:48     1.48
@@ -162,6 +162,7 @@
     void showAmountcol(void);           // View menu show Amounts column
     void showTaskcol(void);             // View menu show Tasks column
     void showRemarkcol(void);           // View menu show Remarks column
+    void savePrefs(void);               // Save user preferences
 
 protected:
     // Application main events
@@ -188,7 +189,7 @@
     QString     *m_szFilename;
 
     // Standard members
-    bool        m_bDirt;                    // To track dirty and clean states
+    bool        m_bDirt;                // To track dirty and clean states
 
     // Constructor helpers
     void setupPrefs(void);              // Preferences
@@ -200,6 +201,7 @@
     void setupTable(void);              // Table widget
     void setupEditlay(void);            // Editing lay
     void setupPieces(void);             // Assemble widget pieces
+    void setupColumns(void);            // Arrange and configure columns
 
     // Data processing
     void loadData(QFile &);             // Load accounting data from file


ossp-pkg/as/as-gui/as_main.cpp 1.9 -> 1.10

--- as_main.cpp  2002/12/10 00:00:57     1.9
+++ as_main.cpp  2002/12/12 12:19:48     1.10
@@ -40,5 +40,6 @@
     App.setMainWidget(&Mainform);
     Mainform.show();                // Finally start the show
     App.connect(&App, SIGNAL(lastWindowClosed()), &App, SLOT(quit()));
+    App.connect(&App, SIGNAL(aboutToQuit()), &Mainform, SLOT(savePrefs()));
     return App.exec();
 }


ossp-pkg/as/as-gui/as_slot.cpp 1.48 -> 1.49

--- as_slot.cpp  2002/12/11 17:15:35     1.48
+++ as_slot.cpp  2002/12/12 12:19:48     1.49
@@ -972,6 +972,26 @@
 }
 
 //
+// Save user preferences
+//
+void Titraqform::savePrefs(void)
+{
+    // Get check status from column menu and pass it to prefs handler
+    m_pPrefs->setBool(TITRAQ_PREFSTATCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFLCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFUCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFGCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFCCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFREVCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFDCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFSTARTCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFFCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFACOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL)));
+    m_pPrefs->setBool(TITRAQ_PREFFCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL)));
+    m_pPrefs->setBool(TITRAQ_PREFREMCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL)));
+}
+
+//
 // Get help on Titraq functionality
 //
 void Titraqform::helpContents(void)

CVSTrac 2.0.1