OSSP CVS Repository

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

Check-in Number: 2831
Date: 2002-Nov-14 23:26:30 (local)
2002-Nov-14 22:26:30 (UTC)
User:ms
Branch:
Comment: Actions added for push buttons, whatsthis text added for all actions, and more features added. Write button is now red.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_gui.cpp      1.10 -> 1.11     67 inserted, 19 deleted
ossp-pkg/as/as-gui/as_gui.h      1.7 -> 1.8     11 inserted, 3 deleted
ossp-pkg/titraq/titraq.cpp      1.10 -> 1.11     67 inserted, 19 deleted
ossp-pkg/titraq/titraq.h      1.7 -> 1.8     11 inserted, 3 deleted

ossp-pkg/as/as-gui/as_gui.cpp 1.10 -> 1.11

--- as_gui.cpp   2002/11/14 21:01:29     1.10
+++ as_gui.cpp   2002/11/14 22:26:30     1.11
@@ -13,6 +13,7 @@
 #include "titraq.h"         // Main classes
 #include "generic.h"        // Generic classes
 #include "gfx/ossplogo.xpm" // OSSP logo: static const char *s_kpcOssplogo_xpm[]
+#include "gfx/filenew.xpm"  // static const char *s_kpcFilenew_xpm[]
 #include "gfx/fileopen.xpm" // static const char *s_kpcFileopen_xpm[]
 #include "gfx/filesave.xpm" // static const char *s_kpcFilesave_xpm[]
 
@@ -22,7 +23,7 @@
     // Set fill color of buttons
     m_pAddbutton->setPaletteBackgroundColor(QColor(196, 196, 176));
     m_pDeletebutton->setPaletteBackgroundColor(QColor(196, 196, 176));
-    m_pWritebutton->setPaletteBackgroundColor(QColor(196, 196, 176));
+    m_pWritebutton->setPaletteBackgroundColor(QColor(206, 192, 176));
     m_pQuitbutton->setPaletteBackgroundColor(QColor(196, 196, 176));
     m_pMaintable->setCurrentCell(0, 0);     // Set the initial focus
     m_pMaintable->setFocus();               // Focus on the table
@@ -46,36 +47,52 @@
         setName(trUtf8("Titraqform"));
     resize(600, 480);
     m_pMenubar = menuBar();     // Setup the menu bar
-//    m_pMenubar = new QMenuBar(this, "Menubar");
-//    m_pStatbar = new QStatusBar(this, "Statusbar");
     m_pStatbar = statusBar();   // Setup the status bar
     setCaption("OSSP Titraq");
 
+//    // Lock down window size
+//    setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0,
+//        (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth()));
+
+    // Early member initialization
+    m_bDirt = false;
+    m_szFilename = new QString();
+
+    // Make an easter egg ;-)
+    QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), "Easter egg");
+
     // File new action
-    m_pFilenewact = new QAction(trUtf8("New"), trUtf8("&New"), CTRL+Key_N, this, "New");
+    m_pFilenewact = new QAction(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New"), CTRL+Key_N, this, "New");
     connect(m_pFilenewact, SIGNAL(activated()), this, SLOT(newDoc()));
+    QMimeSourceFactory::defaultFactory()->setPixmap("filenew", m_pFilenewact->iconSet().pixmap());
+    const char *kszFilenewtext = trUtf8("<p><img source=\"filenew\"> "
+                                 "Click this button to make a <em>blank file</em>."
+                                 "You can also select the <b>New</b> command "
+                                 "from the <b>File</b> menu.</p>");
+    m_pFilenewact->setWhatsThis(kszFilenewtext);
 
     // File open action
     m_pFileopenact = new QAction(trUtf8("Open File"), QPixmap(s_kpcFileopen_xpm), trUtf8("&Open"), CTRL+Key_O, this, "Open");
     connect(m_pFileopenact, SIGNAL(activated()), this, SLOT(choose()));
+    QMimeSourceFactory::defaultFactory()->setPixmap("fileopen", m_pFileopenact->iconSet().pixmap());
     const char *kszFileopentext = trUtf8("<p><img source=\"fileopen\"> "
-                                  "Click this button to open a <em>new file</em>.<br>"
+                                  "Click this button to open a <em>new file</em>."
                                   "You can also select the <b>Open</b> command "
                                   "from the <b>File</b> menu.</p>");
-    QMimeSourceFactory::defaultFactory()->setPixmap("fileopen", m_pFileopenact->iconSet().pixmap());
     m_pFileopenact->setWhatsThis(kszFileopentext);
 
     // File save current action
     m_pFilesaveact = new QAction(trUtf8("Save File"), QPixmap(s_kpcFilesave_xpm), trUtf8("&Save"), CTRL+Key_S, this, "Save");
     connect(m_pFilesaveact, SIGNAL(activated()), this, SLOT(save()));
-    const char *kszFilesavetext = trUtf8("<p>Click this button to save the file you "
+    QMimeSourceFactory::defaultFactory()->setPixmap("filesave", m_pFilesaveact->iconSet().pixmap());
+    const char *kszFilesavetext = trUtf8("<p><img source=\"filesave\"> "
+                                  "Click this button to <em>save</em> the file you "
                                   "are editing. You will be prompted for a file name.\n"
                                   "You can also select the <b>Save</b> command "
                                   "from the <b>File</b> menu.</p>");
     m_pFilesaveact->setWhatsThis(kszFilesavetext);
 
     // File save selected action
-    m_szFilename = new QString();
     m_pFilesaveasact = new QAction(trUtf8("Save File As"), trUtf8("Save &as"), 0, this, "SaveAs");
     connect(m_pFilesaveasact, SIGNAL(activated()), this, SLOT(saveAs()));
     m_pFilesaveasact->setWhatsThis(kszFilesavetext);
@@ -88,12 +105,35 @@
     m_pFilequitact = new QAction(trUtf8("Quit"), trUtf8("&Quit"), CTRL+Key_Q, this, "Quit");
     connect(m_pFilequitact, SIGNAL(activated()), qApp, SLOT(quit()));
 
-//    // Lock down window size
-//    setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0,
-//        (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth()));
-
-    // Make an easter egg ;-)
-    QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), "Easter egg");
+    // Add data row action
+    m_pAddrowact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Addrow");
+    connect(m_pAddrowact, SIGNAL(activated()), this, SLOT(addEntry()));
+    QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pAddrowact->iconSet().pixmap());
+    const char *kszAddrowtext = trUtf8("<p><img source=\"ossplogo\"> "
+                                "Click this button to add a <em>new row</em>."
+                                "You can also select the <b>Add row</b> command "
+                                "from the <b>Accounting</b> menu.</p>");
+    m_pAddrowact->setWhatsThis(kszAddrowtext);
+
+    // Delete data row action
+    m_pDeleterowact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Deleterow");
+    connect(m_pDeleterowact, SIGNAL(activated()), this, SLOT(delEntry()));
+    QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pDeleterowact->iconSet().pixmap());
+    const char *kszDeleterowtext = trUtf8("<p><img source=\"ossplogo\"> "
+                                   "Click this button to delete a <em>row</em>."
+                                   "You can also select the <b>Delete row</b> command "
+                                   "from the <b>Accounting</b> menu.</p>");
+    m_pDeleterowact->setWhatsThis(kszDeleterowtext);
+
+    // Write data action
+    m_pWritedataact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Writedata");
+    connect(m_pWritedataact, SIGNAL(activated()), this, SLOT(writeEntry()));
+    QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pWritedataact->iconSet().pixmap());
+    const char *kszWritedatatext = trUtf8("<p><img source=\"ossplogo\"> "
+                                   "Click this button to <em>write out</em> your accounting data."
+                                   "You can also select the <b>Write data</b> command "
+                                   "from the <b>Accounting</b> menu.</p>");
+    m_pWritedataact->setWhatsThis(kszWritedatatext);
 
     // Construct and populate the file menu with actions
     QPopupMenu *pFilepopup = new QPopupMenu(this);
@@ -117,6 +157,7 @@
     // Construct and populate the main tool bar
     m_pToolbar = new QToolBar("Toolfile", this, DockTop);
     m_pToolbar->setLabel(trUtf8("File Ops"));
+    m_pFilenewact->addTo(m_pToolbar);
     m_pFileopenact->addTo(m_pToolbar);
     m_pFilesaveact->addTo(m_pToolbar);
     QWhatsThis::whatsThisButton(m_pToolbar); // Preconfigured whats this button
@@ -232,7 +273,7 @@
 //        m_pMaintable->setItem(i, 4, pTasks);
 //    }
 
-    m_pPackagelayout->addWidget(m_pMaintable);  // Finally add the table widget
+    m_pPackagelayout->addWidget(m_pMaintable);  // Finally add the damn table
 
     // Bottom output line
     m_pStatus = new QLineEdit(m_pCenframe, "Status");
@@ -244,6 +285,13 @@
     QToolTip::add(m_pStatus, trUtf8("Status Line"));
     m_pPackagelayout->addWidget(m_pStatus);
 
+    // Whatsthis info for the output line
+    const char *kszStatouttext = trUtf8("<p><img source=\"ossplogo\"> "
+                                "This line shows the <em>current row</em> of your accounting data."
+                                " You can also change the data in place, or above "
+                                "from the <b>Accounting table</b>.");
+    QWhatsThis::add(m_pStatus, kszStatouttext);
+
     // Tuple push button add
     m_pAddbutton = new QPushButton(m_pCenframe, "AddButton");
     m_pAddbutton->setCursor(QCursor(13));
@@ -279,7 +327,7 @@
     m_pControllayout->addWidget(m_pQuitbutton);
 
     init(); // Initialize signal and slot connections
-    m_pStatbar->message(trUtf8("Ready"));
+    m_pStatbar->message(trUtf8("Ready"));   // Signal a ready condition
 }
 
 //
@@ -384,6 +432,7 @@
     m_pStatus->setEdited(FALSE);
     setCaption(*m_szFilename);
     m_pStatbar->message(QString(trUtf8("File %1 saved")).arg(*m_szFilename), 4000);
+    m_bDirt = false;    // Set the clean state to allow a close operation
 }
 
 //
@@ -415,7 +464,7 @@
         return;
     }
 
-    // Ask user to aknowlege a possibly data-damaging close event
+    // Ask user to acknowlege a possibly data-damaging close event
     switch(QMessageBox::information(this, "OSSP titraq",
         trUtf8("The document has been\nchanged since the last save.")),
         trUtf8("Save Now"), trUtf8("Cancel"), trUtf8("Leave Anyway"), 0, 1) {
@@ -438,8 +487,7 @@
 //
 bool Titraqform::isDirty(void)
 {
-    // FIXME: We're really not THAT dirty
-    return true;
+    return m_bDirt;
 }
 
 //


ossp-pkg/as/as-gui/as_gui.h 1.7 -> 1.8

--- as_gui.h     2002/11/14 20:29:33     1.7
+++ as_gui.h     2002/11/14 22:26:30     1.8
@@ -15,13 +15,13 @@
 
 
 // Main table size
-const int g_knRows = 18;
+const int g_knRows = 16;
 const int g_knCols = 6;
 
 // Main application form window
 class Titraqform : public QMainWindow
 {
-    Q_OBJECT    // Needed for MOC object model generation
+    Q_OBJECT    // Generate MOC object model stubs
 
 public:
     Titraqform(QWidget *pParent = 0, const char *kszName = 0, WFlags Flags = 0);
@@ -31,6 +31,8 @@
     QAction     *m_pFilenewact,   *m_pFileopenact;
     QAction     *m_pFilesaveact,  *m_pFilesaveasact;
     QAction     *m_pFilecloseact, *m_pFilequitact;
+    QAction     *m_pAddrowact, *m_pDeleterowact;
+    QAction     *m_pWritedataact;
 
     // Table, cells, and entries in package layout
     QTable      *m_pMaintable;
@@ -74,10 +76,16 @@
 private:
     // Don't destroy these, they are owned by QMainWindow
     QMenuBar    *m_pMenubar;
-    QToolBar    *m_pToolbar;
     QStatusBar  *m_pStatbar;
+
+    // Belong to us
+    QToolBar    *m_pToolbar;
     QString     *m_szFilename;
 
+    // Standard members
+    bool        m_bDirt;                // To track dirty and clean states
+
+    // Standard methods
     bool isDirty(void);                 // Check for changed state danger
 };
 



CVSTrac 2.0.1