OSSP CVS Repository

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

ossp-pkg/as/as-gui/as_assist.cpp 1.106 -> 1.107

--- as_assist.cpp        2003/02/14 17:31:54     1.106
+++ as_assist.cpp        2003/02/14 19:27:03     1.107
@@ -41,13 +41,17 @@
 #include <qtooltip.h>
 #include <qwhatsthis.h>
 #include <qstringlist.h>
+#include <qpopupmenu.h>
 #include <qcombobox.h>
 #include <qlistbox.h>
+#include <qstatusbar.h>
+#include <qmenubar.h>
 #include <qcursor.h>
+#include <qaction.h>
+#include <qrect.h>
 #include <qdir.h>
 
 // User interface
-#include "as_gui.h"             // Main classes
 #include "as_amount.h"          // AmountBox class
 #include "as_user.h"            // User class
 #include "as_const.h"           // Application constants
@@ -81,6 +85,7 @@
 #include "as_gfx/refreshd.xpm"  // static const char *s_kpcDrefresh_xpm[]
 #include "as_gfx/sync.xpm"      // static const char *s_kpcSync_xpm[]
 #include "as_gfx/syncd.xpm"     // static const char *s_kpcDsync_xpm[]
+#include "as_gfx/prefs.xpm"     // static const char *s_kpcPrefs_xpm[]
 
 
 //
@@ -192,12 +197,13 @@
     QMimeSourceFactory::defaultFactory()->setPixmap("rowdel", QPixmap(s_kpcRowdel_xpm));
     QMimeSourceFactory::defaultFactory()->setPixmap("refresh", QPixmap(s_kpcRefresh_xpm));
     QMimeSourceFactory::defaultFactory()->setPixmap("syncrpc", QPixmap(s_kpcSync_xpm));
+    QMimeSourceFactory::defaultFactory()->setPixmap("prefs", QPixmap(s_kpcPrefs_xpm));
 
     // File new action
     m_pFilenewact = new QAction(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New"), CTRL+Key_N, this, "New");
     if (m_pFilenewact == NULL)  // Sanity check
         throw Genexcept("Main window file new action creation failed.");
-    connect(m_pFilenewact, SIGNAL(activated()), this, SLOT(newDoc()));
+    connect(m_pFilenewact, SIGNAL(activated()), SLOT(newDoc()));
     const char *kszFilenewtext = "<p><img source=\"filenew\"> "
                                         "Click this button to make a "
                                         "<em>blank file</em>. You can also "
@@ -209,7 +215,7 @@
     m_pFileopenact = new QAction(trUtf8("Open File"), QPixmap(s_kpcFileopen_xpm), trUtf8("&Open..."), CTRL+Key_O, this, "Open");
     if (m_pFileopenact == NULL) // Sanity check
         throw Genexcept("Main window file open action creation failed.");
-    connect(m_pFileopenact, SIGNAL(activated()), this, SLOT(openDoc()));
+    connect(m_pFileopenact, SIGNAL(activated()), SLOT(openDoc()));
     const char *kszFileopentext = "<p><img source=\"fileopen\"> "
                                   "Click this button to open a "
                                   "<em>new file</em>. You can also select "
@@ -221,7 +227,7 @@
     m_pFilesaveact = new QAction(trUtf8("Save File"), Saveiset, trUtf8("&Save"), CTRL+Key_S, this, "Save");
     if (m_pFilesaveact == NULL) // Sanity check
         throw Genexcept("Main window file save action creation failed.");
-    connect(m_pFilesaveact, SIGNAL(activated()), this, SLOT(saveFile()));
+    connect(m_pFilesaveact, SIGNAL(activated()), SLOT(saveFile()));
     const char *kszFilesavetext = "<p><img source=\"filesave\"> "
                                   "Click this button to <em>save</em> "
                                   "the file you are editing. You will be "
@@ -234,26 +240,26 @@
     m_pFilesaveasact = new QAction(trUtf8("Save File As"), trUtf8("Save &As..."), 0, this, "SaveAs");
     if (m_pFilesaveasact == NULL)   // Sanity check
         throw Genexcept("Main window file save as action creation failed.");
-    connect(m_pFilesaveasact, SIGNAL(activated()), this, SLOT(saveAs()));
+    connect(m_pFilesaveasact, SIGNAL(activated()), SLOT(saveAs()));
     m_pFilesaveasact->setWhatsThis(kszFilesavetext);
 
     // File close current action
     m_pFilecloseact = new QAction(trUtf8("Close"), trUtf8("&Close"), CTRL+Key_W, this, "Close");
     if (m_pFilecloseact == NULL)    // Sanity check
         throw Genexcept("Main window file close action creation failed.");
-    connect(m_pFilecloseact, SIGNAL(activated()), this, SLOT(close()));
+    connect(m_pFilecloseact, SIGNAL(activated()), SLOT(close()));
 
     // File quit action
     m_pFilequitact = new QAction(trUtf8("Exit"), trUtf8("E&xit"), CTRL+Key_Q, this, "Exit");
     if (m_pFilequitact == NULL)     // Sanity check
         throw Genexcept("Main window file quit action creation failed.");
-    connect(m_pFilequitact, SIGNAL(activated()), this, SLOT(quitApp()));
+    connect(m_pFilequitact, SIGNAL(activated()), SLOT(quitApp()));
 
     // Cut action
     m_pCutact = new QAction(trUtf8("Cut"), Cutiset, trUtf8("&Cut"), CTRL+Key_X, this, "Cut");
     if (m_pCutact == NULL)      // Sanity check
         throw Genexcept("Main window cut edit action creation failed.");
-    connect(m_pCutact, SIGNAL(activated()), this, SLOT(cutEntry()));
+    connect(m_pCutact, SIGNAL(activated()), SLOT(cutEntry()));
     const char *kszCuttext = "<p><img source=\"cut\"> "
                                    "Click this button to cut an <em>entry</em>. "
                                    "You can also select the <b>Cut</b> command "
@@ -264,7 +270,7 @@
     m_pCopyact = new QAction(trUtf8("Copy"), Copyiset, trUtf8("&Copy"), CTRL+Key_C, this, "Copy");
     if (m_pCopyact == NULL)     // Sanity check
         throw Genexcept("Main window copy edit action creation failed.");
-    connect(m_pCopyact, SIGNAL(activated()), this, SLOT(copyEntry()));
+    connect(m_pCopyact, SIGNAL(activated()), SLOT(copyEntry()));
     const char *kszCopytext = "<p><img source=\"copy\"> "
                                    "Click this button to copy an <em>entry</em>. "
                                    "You can also select the <b>Copy</b> command "
@@ -275,7 +281,7 @@
     m_pPasteact = new QAction(trUtf8("Paste"), Pasteiset, trUtf8("&Paste"), CTRL+Key_V, this, "Paste");
     if (m_pPasteact == NULL)    // Sanity check
         throw Genexcept("Main window paste edit action creation failed.");
-    connect(m_pPasteact, SIGNAL(activated()), this, SLOT(pasteEntry()));
+    connect(m_pPasteact, SIGNAL(activated()), SLOT(pasteEntry()));
     const char *kszPastetext = "<p><img source=\"paste\"> "
                                    "Click this button to paste an <em>entry</em>. "
                                    "You can also select the <b>Paste</b> command "
@@ -286,7 +292,7 @@
     m_pAddrowact = new QAction(trUtf8("Add Entry"), Rowaddiset, trUtf8("&Add entry"), Key_Insert, this, "Addentry");
     if (m_pAddrowact == NULL)   // Sanity check
         throw Genexcept("Main window add entry action creation failed.");
-    connect(m_pAddrowact, SIGNAL(activated()), this, SLOT(addEntry()));
+    connect(m_pAddrowact, SIGNAL(activated()), SLOT(addEntry()));
     const char *kszAddrowtext = "<p><img source=\"rowadd\"> "
                                 "Click this button to add a <em>new entry</em>. "
                                 "You can also select the <b>Add</b> command "
@@ -297,7 +303,7 @@
     m_pDelrowact = new QAction(trUtf8("Delete Entry"), Rowdeliset, trUtf8("&Delete entry"), Key_Delete, this, "Delentry");
     if (m_pDelrowact == NULL)   // Sanity check
         throw Genexcept("Main window delete entry action creation failed.");
-    connect(m_pDelrowact, SIGNAL(activated()), this, SLOT(delEntry()));
+    connect(m_pDelrowact, SIGNAL(activated()), SLOT(delEntry()));
     const char *kszDelrowtext = "<p><img source=\"rowdel\"> "
                                    "Click this button to delete a <em>entry</em>. "
                                    "You can also select the <b>Delete</b> command "
@@ -308,7 +314,7 @@
     m_pRefreshact = new QAction(trUtf8("Refresh Display"), Refreshiset, trUtf8("&Refresh display"), CTRL+Key_R, this, "Refresh");
     if (m_pRefreshact == NULL)  // Sanity check
         throw Genexcept("Main window refresh action creation failed.");
-    connect(m_pRefreshact, SIGNAL(activated()), this, SLOT(refreshDisplay()));
+    connect(m_pRefreshact, SIGNAL(activated()), SLOT(refreshDisplay()));
     const char *kszRefreshtext = "<p><img source=\"refresh\"> "
                                  "Click this button to <em>refresh the display</em>. "
                                  "You can also select the <b>Refresh</b> command "
@@ -319,14 +325,26 @@
     m_pSyncact = new QAction(trUtf8("Synchronize with server"), Synciset, trUtf8("&Synchronize"), CTRL+Key_E, this, "Synchronize");
     if (m_pSyncact == NULL) // Sanity check
         throw Genexcept("Main window synchronize RPC action creation failed.");
-    connect(m_pSyncact, SIGNAL(activated()), this, SLOT(syncIiop()));
-    connect(m_pSyncact, SIGNAL(activated()), this, SLOT(syncSoap()));
+    connect(m_pSyncact, SIGNAL(activated()), SLOT(syncIiop()));
+    connect(m_pSyncact, SIGNAL(activated()), SLOT(syncSoap()));
     const char *kszSynctext = "<p><img source=\"syncrpc\"> "
                               "Click this button to <em>synchronize the data</em>. "
                               "Your changed entries will be sent to the server. "
                               "You can also select the <b>Synchronize</b> command "
                               "from the <b>Report</b> menu.</p>";
     m_pSyncact->setWhatsThis(kszSynctext);
+
+    // Offer a formatted preferences panel for intuitive prefs object editing
+    m_pPrefsact = new QAction(trUtf8("Edit the preferences"), QPixmap(s_kpcPrefs_xpm), trUtf8("P&references..."), CTRL+Key_F, this, "Prefspanel");
+    if (m_pPrefsact == NULL) // Sanity check
+        throw Genexcept("Main window preferences panel action creation failed.");
+    connect(m_pPrefsact, SIGNAL(activated()), SLOT(configPrefs()));
+    const char *kszPrefstext = "<p><img source=\"prefs\"> "
+                               "Click this button to <em>edit the preferences</em>. "
+                               "You can then apply, accept, or cancel your changes. "
+                               "You can also select the <b>Preferences</b> command "
+                               "from the <b>Edit</b> menu.</p>";
+    m_pPrefsact->setWhatsThis(kszPrefstext);
 }
 
 //
@@ -340,8 +358,8 @@
     if (m_pMenubar == NULL) // Sanity check
         throw Genexcept("Main window menu bar nonexistant.");
 
-    // Make an easter egg ;-)
-    QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), "Easter Egg");
+//    // Make an easter egg ;-)
+//    QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), trUtf8("Easter Egg"));
 
     // Construct and populate the file menu with actions
     QPopupMenu *pFilepopup = new QPopupMenu(this);
@@ -370,7 +388,7 @@
     m_pAddrowact->addTo(pEditpopup);
     m_pDelrowact->addTo(pEditpopup);
     pEditpopup->insertSeparator();
-    pEditpopup->insertItem("Preferences...", this, SLOT(configPrefs()));
+    m_pPrefsact->addTo(pEditpopup);
 
     // Construct the view menu and submenus
     m_pViewpopup = new QPopupMenu(this);
@@ -404,6 +422,8 @@
     m_pTbarspopup->setItemChecked(nMenuid, true);
     nMenuid = m_pTbarspopup->insertItem(trUtf8("&View"), this, SLOT(showViewbar()));
     m_pTbarspopup->setItemChecked(nMenuid, true);
+    nMenuid = m_pTbarspopup->insertItem(trUtf8("&Prefs"), this, SLOT(showPrefsbar()));
+    m_pTbarspopup->setItemChecked(nMenuid, true);
     nMenuid = m_pTbarspopup->insertItem(trUtf8("&Whats"), this, SLOT(showWhatsbar()));
     m_pTbarspopup->setItemChecked(nMenuid, true);
     m_pViewpopup->insertItem(trUtf8("&Columns"), m_pColspopup);
@@ -503,6 +523,15 @@
     m_pRefreshact->addTo(m_pViewtools);
     m_pSyncact->addTo(m_pViewtools);
 
+    // Construct and populate the lonely preferences tool bar
+    m_pPrefstools = new QToolBar("Preferences", this, DockTop);
+    if (m_pPrefstools == NULL)                   // Sanity check
+        throw Genexcept("Prefs tool bar creation failed.");
+    m_pPrefstools->setLabel(trUtf8("Preferences editor"));
+    m_pPrefstools->setOpaqueMoving(false);
+    m_pPrefstools->setCloseMode(QDockWindow::Never);
+    m_pPrefsact->addTo(m_pPrefstools);
+
     // Construct and populate the lonely whatsthis tool bar
     m_pWhatstools = new QToolBar("Toolwhats", this, DockTop);
     if (m_pWhatstools == NULL)                  // Sanity check
@@ -612,11 +641,11 @@
     m_pPackagelayout->addWidget(m_pMaintable);  // Finally add the damn table
 
     // Table update signals
-    connect(m_pMaintable, SIGNAL(currentChanged(int, int)), this, SLOT(updEdit(int, int)));
-    connect(m_pMaintable, SIGNAL(clicked(int, int, int, const QPoint&)), this, SLOT(onClick(int, int, int, const QPoint&)));
-    connect(m_pMaintable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), this, SLOT(inplaceEdit(int, int, int, const QPoint&)));
-    connect(m_pTablehead, SIGNAL(sizeChange(int, int, int)), this, SLOT(updSizes(int, int, int)));
-    connect(m_pMaintable, SIGNAL(textEdited(int, int)), this, SLOT(dataChanged(int, int)));
+    connect(m_pMaintable, SIGNAL(currentChanged(int, int)), SLOT(updEdit(int, int)));
+    connect(m_pMaintable, SIGNAL(clicked(int, int, int, const QPoint&)), SLOT(onClick(int, int, int, const QPoint&)));
+    connect(m_pMaintable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), SLOT(inplaceEdit(int, int, int, const QPoint&)));
+    connect(m_pTablehead, SIGNAL(sizeChange(int, int, int)), SLOT(updSizes(int, int, int)));
+    connect(m_pMaintable, SIGNAL(textEdited(int, int)), SLOT(dataChanged(int, int)));
 }
 
 //
@@ -875,34 +904,34 @@
     this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1);
 
     // Validate data just as it is being entered
-    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(validateData(void)));
-    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void)));
-    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void)));
-    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void)));
-    connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void)));
-    connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void)));
+    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), SLOT(validateData(void)));
+    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), SLOT(validateData(void)));
+    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), SLOT(validateData(void)));
+    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), SLOT(validateData(void)));
+    connect(m_pTasks, SIGNAL(textChanged(const QString &)), SLOT(validateData(void)));
+    connect(m_pRemark, SIGNAL(textChanged(const QString &)), SLOT(validateData(void)));
 
     // Signals sent between table cells and corresponding edit control widgets
-    connect(m_pLineedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateLine(const QString &)));
-    connect(m_pUseredit, SIGNAL(textChanged(const QString &)), this, SLOT(updateUser(const QString &)));
-    connect(m_pGuidedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateGuid(const QString &)));
-    connect(m_pCrcedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateCrc(const QString &)));
-    connect(m_pRevedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateRev(const QString &)));
-    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(updateDate(const QDate &)));
-    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), this, SLOT(updateStart(const QTime &)));
-    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), this, SLOT(updateFinish(const QTime &)));
-    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), this, SLOT(updateAmount(const QTime &)));
-    connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(updateTask(const QString &)));
-    connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(updateRemark(const QString &)));
+    connect(m_pLineedit, SIGNAL(textChanged(const QString &)), SLOT(updateLine(const QString &)));
+    connect(m_pUseredit, SIGNAL(textChanged(const QString &)), SLOT(updateUser(const QString &)));
+    connect(m_pGuidedit, SIGNAL(textChanged(const QString &)), SLOT(updateGuid(const QString &)));
+    connect(m_pCrcedit, SIGNAL(textChanged(const QString &)), SLOT(updateCrc(const QString &)));
+    connect(m_pRevedit, SIGNAL(textChanged(const QString &)), SLOT(updateRev(const QString &)));
+    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), SLOT(updateDate(const QDate &)));
+    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), SLOT(updateStart(const QTime &)));
+    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), SLOT(updateFinish(const QTime &)));
+    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), SLOT(updateAmount(const QTime &)));
+    connect(m_pTasks, SIGNAL(textChanged(const QString &)), SLOT(updateTask(const QString &)));
+    connect(m_pRemark, SIGNAL(textChanged(const QString &)), SLOT(updateRemark(const QString &)));
 
     // Correctly update checksum and revision fields also
-    connect(m_pUseredit, SIGNAL(textChanged(const QString &)), this, SLOT(calcCrc(void)));
-    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(calcCrc(void)));
-    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), this, SLOT(calcCrc(void)));
-    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), this, SLOT(calcCrc(void)));
-    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), this, SLOT(calcCrc(void)));
-    connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(calcCrc(void)));
-    connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(calcCrc(void)));
+    connect(m_pUseredit, SIGNAL(textChanged(const QString &)), SLOT(calcCrc(void)));
+    connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), SLOT(calcCrc(void)));
+    connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), SLOT(calcCrc(void)));
+    connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), SLOT(calcCrc(void)));
+    connect(m_pAmount, SIGNAL(valueChanged(const QTime &)), SLOT(calcCrc(void)));
+    connect(m_pTasks, SIGNAL(textChanged(const QString &)), SLOT(calcCrc(void)));
+    connect(m_pRemark, SIGNAL(textChanged(const QString &)), SLOT(calcCrc(void)));
 }
 
 //
@@ -949,6 +978,10 @@
         m_pViewtools->hide();
         m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXVIEWBAR), false);
     }
+    if (!m_pPrefs->getBool(TITRAQ_PREFPREFBAR, TITRAQ_DEFPREFBAR)) {
+        m_pPrefstools->hide();
+        m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXPREFBAR), false);
+    }
     if (!m_pPrefs->getBool(TITRAQ_PREFWHATBAR, TITRAQ_DEFWHATBAR)) {
         m_pWhatstools->hide();
         m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXWHATBAR), false);

CVSTrac 2.0.1