Index: ossp-pkg/as/as-gui/as_gui.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v' 2>/dev/null --- 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("
"
+ "Click this button to make a blank file."
+ "You can also select the New command "
+ "from the File menu.
"
- "Click this button to open a new file.
"
+ "Click this button to open a new file."
"You can also select the Open command "
"from the File menu.
Click this button to save the file you " + QMimeSourceFactory::defaultFactory()->setPixmap("filesave", m_pFilesaveact->iconSet().pixmap()); + const char *kszFilesavetext = trUtf8("
"
+ "Click this button to save the file you "
"are editing. You will be prompted for a file name.\n"
"You can also select the Save command "
"from the File menu.
"
+ "Click this button to add a new row."
+ "You can also select the Add row command "
+ "from the Accounting menu.
"
+ "Click this button to delete a row."
+ "You can also select the Delete row command "
+ "from the Accounting menu.
"
+ "Click this button to write out your accounting data."
+ "You can also select the Write data command "
+ "from the Accounting menu.
"
+ "This line shows the current row of your accounting data."
+ " You can also change the data in place, or above "
+ "from the Accounting table.");
+ 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;
}
//
Index: ossp-pkg/as/as-gui/as_gui.h
RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v
rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null
--- 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
};